--- amdtemp.c.ori 2009-08-20 17:23:28.000000000 -0300 +++ amdtemp.c.new 2009-10-04 22:42:03.000000000 -0300 @@ -52,10 +52,16 @@ typedef enum { SENSOR0_CORE0, SENSOR0_CORE1, + SENSOR0_CORE2, + SENSOR0_CORE3, SENSOR1_CORE0, SENSOR1_CORE1, + SENSOR1_CORE2, + SENSOR1_CORE3, CORE0, - CORE1 + CORE1, + CORE2, + CORE3 } amdsensor_t; struct amdtemp_softc { @@ -63,7 +69,7 @@ int sc_temps[4]; int sc_ntemps; struct sysctl_oid *sc_oid; - struct sysctl_oid *sc_sysctl_cpu[2]; + struct sysctl_oid *sc_sysctl_cpu[4]; struct intr_config_hook sc_ich; int32_t (*sc_gettemp)(device_t, amdsensor_t); }; @@ -236,7 +242,19 @@ dev, SENSOR0_CORE1, amdtemp_sysctl, "IK", "Sensor 0 / Core 1 temperature"); - sysctlnode = SYSCTL_ADD_NODE(sysctlctx, + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core2", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR0_CORE2, amdtemp_sysctl, "IK", + "Sensor 0 / Core 2 temperature"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core3", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR0_CORE3, amdtemp_sysctl, "IK", + "Sensor 0 / Core 3 temperature"); + + sysctlnode = SYSCTL_ADD_NODE(sysctlctx, SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "sensor1", CTLFLAG_RD, 0, "Sensor 1"); @@ -252,7 +270,19 @@ dev, SENSOR1_CORE1, amdtemp_sysctl, "IK", "Sensor 1 / Core 1 temperature"); - return (0); + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core2", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR1_CORE2, amdtemp_sysctl, "IK", + "Sensor 1 / Core 2 temperature"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), + OID_AUTO, "core3", CTLTYPE_INT | CTLFLAG_RD, + dev, SENSOR1_CORE3, amdtemp_sysctl, "IK", + "Sensor 1 / Core 3 temperature"); + + return (0); } void @@ -272,7 +302,7 @@ nexus = device_find_child(root_bus, "nexus", 0); acpi = device_find_child(nexus, "acpi", 0); - for (i = 0; i < 2; i++) { + for (i = 0; i < 4; i++) { cpu = device_find_child(acpi, "cpu", device_get_unit(dev) * 2 + i); if (cpu) { @@ -323,6 +353,16 @@ auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE1); temp = imax(auxtemp[0], auxtemp[1]); break; + case CORE2: + auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE2); + auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE2); + temp = imax(auxtemp[0], auxtemp[1]); + break; + case CORE3: + auxtemp[0] = sc->sc_gettemp(dev, SENSOR0_CORE3); + auxtemp[1] = sc->sc_gettemp(dev, SENSOR1_CORE3); + temp = imax(auxtemp[0], auxtemp[1]); + break; default: temp = sc->sc_gettemp(dev, arg2); break; @@ -347,6 +387,14 @@ cfg &= ~AMDTEMP_REG_SELSENSOR; cfg |= AMDTEMP_REG_SELCORE; break; + case SENSOR0_CORE2: + cfg &= ~AMDTEMP_REG_SELSENSOR; + cfg |= AMDTEMP_REG_SELCORE; + break; + case SENSOR0_CORE3: + cfg &= ~AMDTEMP_REG_SELSENSOR; + cfg |= AMDTEMP_REG_SELCORE; + break; case SENSOR1_CORE0: cfg &= ~AMDTEMP_REG_SELCORE; cfg |= AMDTEMP_REG_SELSENSOR; @@ -354,6 +402,12 @@ case SENSOR1_CORE1: cfg |= (AMDTEMP_REG_SELSENSOR | AMDTEMP_REG_SELCORE); break; + case SENSOR1_CORE2: + cfg |= (AMDTEMP_REG_SELSENSOR | AMDTEMP_REG_SELCORE); + break; + case SENSOR1_CORE3: + cfg |= (AMDTEMP_REG_SELSENSOR | AMDTEMP_REG_SELCORE); + break; default: cfg = 0; break;