NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/39620: coretemp(4) module



The following reply was made to PR kern/39620; it has been noted by GNATS.

From: Juan RP <xtraeme%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/39620: coretemp(4) module
Date: Wed, 24 Sep 2008 06:57:09 +0200

 Here's the shar file:
 
 # This is a shell archive.  Save it in a file, remove anything before
 # this line, and then unpack it by entering "sh file".  Note, it may
 # create directories; files and directories will be owned by you and
 # have default permissions.
 #
 # This archive contains:
 #
 #      coretemp_kmod/Makefile
 #      coretemp_kmod/README
 #      coretemp_kmod/kmod.diff
 #
 echo x - coretemp_kmod/Makefile
 sed 's/^X//' >coretemp_kmod/Makefile << 'END-of-coretemp_kmod/Makefile'
 X#     $NetBSD$
 X
 X.include "../Makefile.inc"
 X
 X.PATH:        ${S}/arch/x86/x86
 X
 XKMOD= coretemp
 XSRCS= coretemp.c
 X
 X.include <bsd.kmodule.mk>
 END-of-coretemp_kmod/Makefile
 echo x - coretemp_kmod/README
 sed 's/^X//' >coretemp_kmod/README << 'END-of-coretemp_kmod/README'
 X# mkdir src/sys/modules/coretemp
 X# mv Makefile src/sys/modules/coretemp
 X# cd src && patch < ~/path_to_dir/coretemp_kmod.diff
 END-of-coretemp_kmod/README
 echo x - coretemp_kmod/kmod.diff
 sed 's/^X//' >coretemp_kmod/kmod.diff << 'END-of-coretemp_kmod/kmod.diff'
 XIndex: sys/arch/x86/x86/coretemp.c
 X===================================================================
 XRCS file: /cvsroot/src/sys/arch/x86/x86/coretemp.c,v
 Xretrieving revision 1.11
 Xdiff -b -u -p -r1.11 coretemp.c
 X--- sys/arch/x86/x86/coretemp.c       23 Sep 2008 22:14:09 -0000      1.11
 X+++ sys/arch/x86/x86/coretemp.c       24 Sep 2008 04:21:24 -0000
 X@@ -42,14 +42,19 @@ __KERNEL_RCSID(0, "$NetBSD: coretemp.c,v
 X #include <sys/kmem.h>
 X #include <sys/xcall.h>
 X #include <sys/cpu.h>
 X+#include <sys/module.h>
 X 
 X #include <dev/sysmon/sysmonvar.h>
 X 
 X+#ifndef _MODULE
 X #include <machine/cpuvar.h>
 X+#endif
 X #include <machine/specialreg.h>
 X #include <machine/cpufunc.h>
 X+#include <machine/cputypes.h>
 X 
 X struct coretemp_softc {
 X+     SLIST_ENTRY(coretemp_softc) sc_head;
 X      struct cpu_info         *sc_ci;
 X      struct sysmon_envsys    *sc_sme;
 X      envsys_data_t           sc_sensor;
 X@@ -57,6 +62,13 @@ struct coretemp_softc {
 X      int                     sc_tjmax;
 X };
 X 
 X+static SLIST_HEAD(, coretemp_softc) coretemp_softc_list =
 X+    SLIST_HEAD_INITIALIZER(&coretemp_softc_list);
 X+
 X+#ifdef _MODULE
 X+void         coretemp_register(struct cpu_info *);
 X+extern int   cpu_vendor;
 X+#endif
 X static void  coretemp_refresh(struct sysmon_envsys *, envsys_data_t *);
 X static void  coretemp_refresh_xcall(void *, void *);
 X 
 X@@ -158,6 +170,8 @@ coretemp_register(struct cpu_info *ci)
 X              goto bad;
 X      }
 X 
 X+     SLIST_INSERT_HEAD(&coretemp_softc_list, sc, sc_head);
 X+
 X      return;
 X 
 X bad:
 X@@ -230,3 +244,42 @@ coretemp_refresh_xcall(void *arg0, void 
 X      if (((msr >> 4) & 0x3) == 0x3)
 X              edata->state = ENVSYS_SCRITICAL;
 X }
 X+
 X+MODULE(MODULE_CLASS_MISC, coretemp, NULL);
 X+
 X+static int
 X+coretemp_modcmd(modcmd_t cmd, void *arg)
 X+{
 X+#ifdef _MODULE
 X+     CPU_INFO_ITERATOR cii;
 X+     struct cpu_info *ci;
 X+     struct coretemp_softc *sc;
 X+
 X+     switch (cmd) {
 X+     case MODULE_CMD_INIT:
 X+             if (cpu_vendor != CPUVENDOR_INTEL &&
 X+                 cpuid_level < 0x06)
 X+                     return ENOTSUP;
 X+
 X+             for (CPU_INFO_FOREACH(cii, ci))
 X+                     coretemp_register(ci);
 X+
 X+             return 0;
 X+     case MODULE_CMD_FINI:
 X+             SLIST_FOREACH(sc, &coretemp_softc_list, sc_head) {
 X+                     SLIST_REMOVE(&coretemp_softc_list, sc,
 X+                          coretemp_softc, sc_head);
 X+                     sysmon_envsys_unregister(sc->sc_sme);
 X+                     kmem_free(sc, sizeof(struct coretemp_softc));
 X+             }
 X+
 X+             return 0;
 X+     default:
 X+             return ENOTTY;
 X+     }
 X+#else
 X+     if (cmd == MODULE_CMD_INIT)
 X+             return 0;
 X+     return ENOTTY;
 X+#endif
 X+}
 XIndex: sys/modules/Makefile
 X===================================================================
 XRCS file: /cvsroot/src/sys/modules/Makefile,v
 Xretrieving revision 1.10
 Xdiff -b -u -p -r1.10 Makefile
 X--- sys/modules/Makefile      23 Sep 2008 07:56:59 -0000      1.10
 X+++ sys/modules/Makefile      24 Sep 2008 04:21:24 -0000
 X@@ -5,7 +5,7 @@ SUBDIR+=      fss
 X SUBDIR+=     putter
 X 
 X .if ${MACHINE} == "i386" || ${MACHINE} == "amd64"
 X-SUBDIR+=     azalia drm i915drm
 X+SUBDIR+=     azalia coretemp drm i915drm
 X .endif
 X .if ${MACHINE} == "i386"
 X SUBDIR+=     radeondrm
 XIndex: distrib/sets/lists/base/md.amd64
 X===================================================================
 XRCS file: /cvsroot/src/distrib/sets/lists/base/md.amd64,v
 Xretrieving revision 1.20
 Xdiff -b -u -p -r1.20 md.amd64
 X--- distrib/sets/lists/base/md.amd64  5 Aug 2008 01:00:20 -0000       1.20
 X+++ distrib/sets/lists/base/md.amd64  24 Sep 2008 04:21:24 -0000
 X@@ -9,6 +9,8 @@
 X ./@MODULEDIR@/coda/coda.kmod                 base-kernel-modules
 X ./@MODULEDIR@/coda5                          base-kernel-modules
 X ./@MODULEDIR@/coda5/coda5.kmod                       base-kernel-modules
 X+./@MODULEDIR@/coretemp                               base-kernel-modules
 X+./@MODULEDIR@/coretemp/coretemp.kmod         base-kernel-modules
 X ./@MODULEDIR@/drm                            base-kernel-modules
 X ./@MODULEDIR@/drm/drm.kmod                   base-kernel-modules
 X ./@MODULEDIR@/efs                            base-kernel-modules
 XIndex: distrib/sets/lists/base/md.i386
 X===================================================================
 XRCS file: /cvsroot/src/distrib/sets/lists/base/md.i386,v
 Xretrieving revision 1.128
 Xdiff -b -u -p -r1.128 md.i386
 X--- distrib/sets/lists/base/md.i386   25 Aug 2008 07:58:37 -0000      1.128
 X+++ distrib/sets/lists/base/md.i386   24 Sep 2008 04:21:24 -0000
 X@@ -9,6 +9,8 @@
 X ./@MODULEDIR@/coda/coda.kmod                 base-kernel-modules
 X ./@MODULEDIR@/coda5                          base-kernel-modules
 X ./@MODULEDIR@/coda5/coda5.kmod                       base-kernel-modules
 X+./@MODULEDIR@/coretemp                               base-kernel-modules
 X+./@MODULEDIR@/coretemp/coretemp.kmod         base-kernel-modules
 X ./@MODULEDIR@/drm                            base-kernel-modules
 X ./@MODULEDIR@/drm/drm.kmod                   base-kernel-modules
 X ./@MODULEDIR@/efs                            base-kernel-modules
 END-of-coretemp_kmod/kmod.diff
 exit
 
 
 


Home | Main Index | Thread Index | Old Index