Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/amdtemp/amdtemp.c
Show All 12 Lines | |||||
"sensor_offset", CTLFLAG_RW, &sc->sc_offset, 0, | "sensor_offset", CTLFLAG_RW, &sc->sc_offset, 0, | ||||
"Temperature sensor offset"); | "Temperature sensor offset"); | ||||
sysctlnode = SYSCTL_ADD_NODE(sysctlctx, | sysctlnode = SYSCTL_ADD_NODE(sysctlctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, | SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, | ||||
"core0", CTLFLAG_RD, 0, "Core 0"); | "core0", CTLFLAG_RD, 0, "Core 0"); | ||||
SYSCTL_ADD_PROC(sysctlctx, | SYSCTL_ADD_PROC(sysctlctx, | ||||
SYSCTL_CHILDREN(sysctlnode), | SYSCTL_CHILDREN(sysctlnode), | ||||
OID_AUTO, "sensor0", CTLTYPE_INT | CTLFLAG_RD, | OID_AUTO, "sensor0", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | ||||
dev, CORE0_SENSOR0, amdtemp_sysctl, "IK", | dev, CORE0_SENSOR0, amdtemp_sysctl, "IK", | ||||
"Core 0 / Sensor 0 temperature"); | "Core 0 / Sensor 0 temperature"); | ||||
if (sc->sc_ntemps > 1) { | if (sc->sc_ntemps > 1) { | ||||
SYSCTL_ADD_PROC(sysctlctx, | SYSCTL_ADD_PROC(sysctlctx, | ||||
SYSCTL_CHILDREN(sysctlnode), | SYSCTL_CHILDREN(sysctlnode), | ||||
OID_AUTO, "sensor1", CTLTYPE_INT | CTLFLAG_RD, | OID_AUTO, "sensor1", | ||||
CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | |||||
dev, CORE0_SENSOR1, amdtemp_sysctl, "IK", | dev, CORE0_SENSOR1, amdtemp_sysctl, "IK", | ||||
"Core 0 / Sensor 1 temperature"); | "Core 0 / Sensor 1 temperature"); | ||||
if (sc->sc_ncores > 1) { | if (sc->sc_ncores > 1) { | ||||
sysctlnode = SYSCTL_ADD_NODE(sysctlctx, | sysctlnode = SYSCTL_ADD_NODE(sysctlctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), | SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), | ||||
OID_AUTO, "core1", CTLFLAG_RD, 0, "Core 1"); | OID_AUTO, "core1", CTLFLAG_RD, 0, "Core 1"); | ||||
SYSCTL_ADD_PROC(sysctlctx, | SYSCTL_ADD_PROC(sysctlctx, | ||||
SYSCTL_CHILDREN(sysctlnode), | SYSCTL_CHILDREN(sysctlnode), | ||||
OID_AUTO, "sensor0", CTLTYPE_INT | CTLFLAG_RD, | OID_AUTO, "sensor0", | ||||
CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | |||||
dev, CORE1_SENSOR0, amdtemp_sysctl, "IK", | dev, CORE1_SENSOR0, amdtemp_sysctl, "IK", | ||||
"Core 1 / Sensor 0 temperature"); | "Core 1 / Sensor 0 temperature"); | ||||
SYSCTL_ADD_PROC(sysctlctx, | SYSCTL_ADD_PROC(sysctlctx, | ||||
SYSCTL_CHILDREN(sysctlnode), | SYSCTL_CHILDREN(sysctlnode), | ||||
OID_AUTO, "sensor1", CTLTYPE_INT | CTLFLAG_RD, | OID_AUTO, "sensor1", | ||||
CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | |||||
dev, CORE1_SENSOR1, amdtemp_sysctl, "IK", | dev, CORE1_SENSOR1, amdtemp_sysctl, "IK", | ||||
"Core 1 / Sensor 1 temperature"); | "Core 1 / Sensor 1 temperature"); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Try to create dev.cpu sysctl entries and setup intrhook function. | * Try to create dev.cpu sysctl entries and setup intrhook function. | ||||
* This is needed because the cpu driver may be loaded late on boot, | * This is needed because the cpu driver may be loaded late on boot, | ||||
Show All 24 Lines | |||||
device_get_unit(dev) * sc->sc_ncores + i); | device_get_unit(dev) * sc->sc_ncores + i); | ||||
if (cpu != NULL) { | if (cpu != NULL) { | ||||
sysctlctx = device_get_sysctl_ctx(cpu); | sysctlctx = device_get_sysctl_ctx(cpu); | ||||
sensor = sc->sc_ntemps > 1 ? | sensor = sc->sc_ntemps > 1 ? | ||||
(i == 0 ? CORE0 : CORE1) : CORE0_SENSOR0; | (i == 0 ? CORE0 : CORE1) : CORE0_SENSOR0; | ||||
sc->sc_sysctl_cpu[i] = SYSCTL_ADD_PROC(sysctlctx, | sc->sc_sysctl_cpu[i] = SYSCTL_ADD_PROC(sysctlctx, | ||||
SYSCTL_CHILDREN(device_get_sysctl_tree(cpu)), | SYSCTL_CHILDREN(device_get_sysctl_tree(cpu)), | ||||
OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, | OID_AUTO, "temperature", | ||||
CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_NEEDGIANT, | |||||
dev, sensor, amdtemp_sysctl, "IK", | dev, sensor, amdtemp_sysctl, "IK", | ||||
"Current temparature"); | "Current temparature"); | ||||
} | } | ||||
} | } | ||||
if (sc->sc_ich.ich_arg != NULL) | if (sc->sc_ich.ich_arg != NULL) | ||||
config_intrhook_disestablish(&sc->sc_ich); | config_intrhook_disestablish(&sc->sc_ich); | ||||
} | } | ||||
Show All 12 Lines |