diff options
author | Rui Paulo <rpaulo@FreeBSD.org> | 2009-03-13 16:08:08 +0000 |
---|---|---|
committer | Rui Paulo <rpaulo@FreeBSD.org> | 2009-03-13 16:08:08 +0000 |
commit | fc1f75e512df3ae08ea50c496cd6c7e89780b201 (patch) | |
tree | 69cb71746e0a1bc2159586bec7dc7c5c1be9c138 | |
parent | 1cbe9ccf464b6dad649d3371558955d900daddba (diff) | |
download | src-fc1f75e512df3ae08ea50c496cd6c7e89780b201.tar.gz src-fc1f75e512df3ae08ea50c496cd6c7e89780b201.zip |
Rename the k8temp driver to amdtemp.
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=189768
-rw-r--r-- | sys/conf/files.amd64 | 2 | ||||
-rw-r--r-- | sys/conf/files.i386 | 2 | ||||
-rw-r--r-- | sys/dev/amdtemp/amdtemp.c (renamed from sys/dev/k8temp/k8temp.c) | 85 | ||||
-rw-r--r-- | sys/modules/Makefile | 6 | ||||
-rw-r--r-- | sys/modules/amdtemp/Makefile | 8 | ||||
-rw-r--r-- | sys/modules/k8temp/Makefile | 8 |
6 files changed, 40 insertions, 71 deletions
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 97f5ee5a4f91..e826550edaaa 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -136,6 +136,7 @@ dev/agp/agp_amd64.c optional agp dev/agp/agp_i810.c optional agp dev/agp/agp_intel.c optional agp dev/agp/agp_via.c optional agp +dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/asmc/asmc.c optional asmc isa dev/atkbdc/atkbd.c optional atkbd atkbdc @@ -187,7 +188,6 @@ dev/hwpmc/hwpmc_core.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/k8temp/k8temp.c optional k8temp dev/kbd/kbd.c optional atkbd | sc | ukbd | usb2_input_kbd dev/mem/memutil.c optional mem dev/nfe/if_nfe.c optional nfe pci diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 069e3b9256a5..c27acaaff580 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -128,6 +128,7 @@ dev/agp/agp_nvidia.c optional agp dev/agp/agp_sis.c optional agp dev/agp/agp_via.c optional agp dev/aic/aic_isa.c optional aic isa +dev/amdtemp/amdtemp.c optional amdtemp dev/arcmsr/arcmsr.c optional arcmsr pci dev/ar/if_ar.c optional ar dev/ar/if_ar_isa.c optional ar isa @@ -198,7 +199,6 @@ dev/ipmi/ipmi_smbus.c optional ipmi smbus dev/ipmi/ipmi_smbios.c optional ipmi dev/ipmi/ipmi_ssif.c optional ipmi smbus dev/ipmi/ipmi_pci.c optional ipmi pci -dev/k8temp/k8temp.c optional k8temp dev/kbd/kbd.c optional atkbd | sc | ukbd | usb2_input_kbd dev/le/if_le_isa.c optional le isa dev/mem/memutil.c optional mem diff --git a/sys/dev/k8temp/k8temp.c b/sys/dev/amdtemp/amdtemp.c index 20c3f0d68778..35cca988e351 100644 --- a/sys/dev/k8temp/k8temp.c +++ b/sys/dev/amdtemp/amdtemp.c @@ -48,15 +48,6 @@ __FBSDID("$FreeBSD$"); #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> -typedef enum { - SENSOR0_CORE0, - SENSOR0_CORE1, - SENSOR1_CORE0, - SENSOR1_CORE1, - CORE0, - CORE1 -} k8sensor_t; - struct k8temp_softc { device_t sc_dev; int sc_temps[4]; @@ -64,38 +55,36 @@ struct k8temp_softc { struct sysctl_oid *sc_oid; struct sysctl_oid *sc_sysctl_cpu[2]; struct intr_config_hook sc_ich; - int32_t (*sc_gettemp)(device_t, k8sensor_t); }; #define VENDORID_AMD 0x1022 -#define DEVICEID_AMD_MISC0F 0x1103 -#define DEVICEID_AMD_MISC10 0x1203 -#define DEVICEID_AMD_MISC11 0x1303 +#define DEVICEID_AMD_MISC 0x1103 static struct k8temp_product { uint16_t k8temp_vendorid; uint16_t k8temp_deviceid; } k8temp_products[] = { - { VENDORID_AMD, DEVICEID_AMD_MISC0F }, - { VENDORID_AMD, DEVICEID_AMD_MISC10 }, - { VENDORID_AMD, DEVICEID_AMD_MISC11 }, + { VENDORID_AMD, DEVICEID_AMD_MISC }, { 0, 0 } }; /* * Register control */ -#define K8TEMP_REG0F 0xe4 +#define K8TEMP_REG 0xe4 #define K8TEMP_REG_SELSENSOR 0x40 #define K8TEMP_REG_SELCORE 0x04 -#define K8TEMP_REG 0xa4 +#define K8TEMP_MINTEMP 49 /* -49 C is the mininum temperature */ -#define TZ_ZEROC 2732 - - /* -49 C is the mininum temperature */ -#define K8TEMP_OFFSET0F (TZ_ZEROC-490) -#define K8TEMP_OFFSET (TZ_ZEROC) +typedef enum { + SENSOR0_CORE0, + SENSOR0_CORE1, + SENSOR1_CORE0, + SENSOR1_CORE1, + CORE0, + CORE1 +} k8sensor_t; /* * Device methods. @@ -106,7 +95,6 @@ static int k8temp_attach(device_t dev); static void k8temp_intrhook(void *arg); static int k8temp_detach(device_t dev); static int k8temp_match(device_t dev); -static int32_t k8temp_gettemp0f(device_t dev, k8sensor_t sensor); static int32_t k8temp_gettemp(device_t dev, k8sensor_t sensor); static int k8temp_sysctl(SYSCTL_HANDLER_ARGS); @@ -205,13 +193,6 @@ k8temp_attach(device_t dev) return (ENXIO); } - if (pci_get_device(dev) == DEVICEID_AMD_MISC0F) - sc->sc_gettemp = k8temp_gettemp0f; - else { - sc->sc_gettemp = k8temp_gettemp; - return (0); - } - /* * dev.k8temp.N tree. */ @@ -223,13 +204,13 @@ k8temp_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR0_CORE0, k8temp_sysctl, "IK", + dev, SENSOR0_CORE0, k8temp_sysctl, "I", "Sensor 0 / Core 0 temperature"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR0_CORE1, k8temp_sysctl, "IK", + dev, SENSOR0_CORE1, k8temp_sysctl, "I", "Sensor 0 / Core 1 temperature"); sysctlnode = SYSCTL_ADD_NODE(sysctlctx, @@ -239,13 +220,13 @@ k8temp_attach(device_t dev) SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core0", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR1_CORE0, k8temp_sysctl, "IK", + dev, SENSOR1_CORE0, k8temp_sysctl, "I", "Sensor 1 / Core 0 temperature"); SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "core1", CTLTYPE_INT | CTLFLAG_RD, - dev, SENSOR1_CORE1, k8temp_sysctl, "IK", + dev, SENSOR1_CORE1, k8temp_sysctl, "I", "Sensor 1 / Core 1 temperature"); return (0); @@ -277,7 +258,7 @@ k8temp_intrhook(void *arg) sc->sc_sysctl_cpu[i] = SYSCTL_ADD_PROC(sysctlctx, SYSCTL_CHILDREN(device_get_sysctl_tree(cpu)), OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, - dev, CORE0, k8temp_sysctl, "IK", + dev, CORE0, k8temp_sysctl, "I", "Max of sensor 0 / 1"); } } @@ -304,23 +285,22 @@ static int k8temp_sysctl(SYSCTL_HANDLER_ARGS) { device_t dev = (device_t) arg1; - struct k8temp_softc *sc = device_get_softc(dev); int error; int32_t temp, auxtemp[2]; switch (arg2) { case CORE0: - auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE0); - auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE0); + auxtemp[0] = k8temp_gettemp(dev, SENSOR0_CORE0); + auxtemp[1] = k8temp_gettemp(dev, SENSOR1_CORE0); temp = imax(auxtemp[0], auxtemp[1]); break; case CORE1: - auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE1); - auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE1); + auxtemp[0] = k8temp_gettemp(dev, SENSOR0_CORE1); + auxtemp[1] = k8temp_gettemp(dev, SENSOR1_CORE1); temp = imax(auxtemp[0], auxtemp[1]); break; default: - temp = sc->sc_gettemp(dev, arg2); + temp = k8temp_gettemp(dev, arg2); break; } error = sysctl_handle_int(oidp, &temp, 0, req); @@ -329,12 +309,12 @@ k8temp_sysctl(SYSCTL_HANDLER_ARGS) } static int32_t -k8temp_gettemp0f(device_t dev, k8sensor_t sensor) +k8temp_gettemp(device_t dev, k8sensor_t sensor) { uint8_t cfg; uint32_t temp; - cfg = pci_read_config(dev, K8TEMP_REG0F, 1); + cfg = pci_read_config(dev, K8TEMP_REG, 1); switch (sensor) { case SENSOR0_CORE0: cfg &= ~(K8TEMP_REG_SELSENSOR | K8TEMP_REG_SELCORE); @@ -354,20 +334,9 @@ k8temp_gettemp0f(device_t dev, k8sensor_t sensor) cfg = 0; break; } - pci_write_config(dev, K8TEMP_REG0F, cfg, 1); - temp = pci_read_config(dev, K8TEMP_REG0F, 4); - temp = ((temp >> 16) & 0xff) * 10 + K8TEMP_OFFSET0F; - - return (temp); -} - -static int32_t -k8temp_gettemp(device_t dev, k8sensor_t sensor) -{ - uint32_t temp; - + pci_write_config(dev, K8TEMP_REG, cfg, 1); temp = pci_read_config(dev, K8TEMP_REG, 4); - temp = ((temp >> 21) & 0x3ff) * 10 / 8 + K8TEMP_OFFSET; - + temp = ((temp >> 16) & 0xff) - K8TEMP_MINTEMP; + return (temp); } diff --git a/sys/modules/Makefile b/sys/modules/Makefile index bb46b9cfda7a..1d82f9439485 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -18,6 +18,7 @@ SUBDIR= ${_3dfx} \ aic7xxx \ aio \ ${_amd} \ + ${_amdtemp} \ ale \ amr \ ${_an} \ @@ -137,7 +138,6 @@ SUBDIR= ${_3dfx} \ ${_ixgb} \ jme \ joy \ - ${_k8temp} \ kbdmux \ krpc \ le \ @@ -409,6 +409,7 @@ _zfs= zfs _aac= aac _acpi= acpi _ahb= ahb +_amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc _asr= asr @@ -435,7 +436,6 @@ _iwifw= iwifw _iwn= iwn _iwnfw= iwnfw _ixgb= ixgb -_k8temp= k8temp _mly= mly _nfe= nfe _nve= nve @@ -464,6 +464,7 @@ _aac= aac _acpi= acpi _agp= agp _an= an +_amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc _cardbus= cardbus @@ -502,7 +503,6 @@ _ipwfw= ipwfw _iwn= iwn _iwnfw= iwnfw _ixgb= ixgb -_k8temp= k8temp _linprocfs= linprocfs _linsysfs= linsysfs _linux= linux diff --git a/sys/modules/amdtemp/Makefile b/sys/modules/amdtemp/Makefile new file mode 100644 index 000000000000..1f7cff502ec4 --- /dev/null +++ b/sys/modules/amdtemp/Makefile @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/amdtemp + +KMOD= amdtemp +SRCS= amdtemp.c bus_if.h device_if.h pci_if.h + +.include <bsd.kmod.mk> diff --git a/sys/modules/k8temp/Makefile b/sys/modules/k8temp/Makefile deleted file mode 100644 index 32909ad506b8..000000000000 --- a/sys/modules/k8temp/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../dev/k8temp - -KMOD= k8temp -SRCS= k8temp.c bus_if.h device_if.h pci_if.h - -.include <bsd.kmod.mk> |