Lines Matching +full:sensor +full:- +full:id

43  *				  -- Constantine A. Murenin <http://cnst.su/>
137 sc->sc_dev = dev; in aibs_attach()
138 sc->sc_ah = acpi_get_handle(dev); in aibs_attach()
140 sc->sc_ggrp_method = false; in aibs_attach()
151 if (sc->sc_volt_sysctl != NULL) in aibs_attach()
152 sysctl_remove_oid(sc->sc_volt_sysctl, true, true); in aibs_attach()
153 if (sc->sc_temp_sysctl != NULL) in aibs_attach()
154 sysctl_remove_oid(sc->sc_temp_sysctl, true, true); in aibs_attach()
155 if (sc->sc_fan_sysctl != NULL) in aibs_attach()
156 sysctl_remove_oid(sc->sc_fan_sysctl, true, true); in aibs_attach()
159 sc->sc_ggrp_method = true; in aibs_attach()
166 struct aibs_sensor* sensor, const char ** descr) in aibs_add_sensor() argument
175 if (sc->sc_ggrp_method) in aibs_add_sensor()
180 if (o->Type != ACPI_TYPE_PACKAGE) { in aibs_add_sensor()
181 device_printf(sc->sc_dev, in aibs_add_sensor()
182 "sensor object is not a package: %i type\n", in aibs_add_sensor()
183 o->Type); in aibs_add_sensor()
187 o->Package.Elements[0].Type != ACPI_TYPE_INTEGER || in aibs_add_sensor()
188 o->Package.Elements[1].Type != ACPI_TYPE_STRING || in aibs_add_sensor()
189 o->Package.Elements[off].Type != ACPI_TYPE_INTEGER || in aibs_add_sensor()
190 o->Package.Elements[off + 1].Type != ACPI_TYPE_INTEGER || in aibs_add_sensor()
191 o->Package.Elements[off + 2].Type != ACPI_TYPE_INTEGER) { in aibs_add_sensor()
192 device_printf(sc->sc_dev, "unexpected package content\n"); in aibs_add_sensor()
196 sensor->i = o->Package.Elements[0].Integer.Value; in aibs_add_sensor()
197 *descr = o->Package.Elements[1].String.Pointer; in aibs_add_sensor()
198 sensor->l = o->Package.Elements[off].Integer.Value; in aibs_add_sensor()
199 sensor->h = o->Package.Elements[off + 1].Integer.Value; in aibs_add_sensor()
201 if (sc->sc_ggrp_method) in aibs_add_sensor()
202 sensor->h += sensor->l; in aibs_add_sensor()
203 sensor->t = AIBS_SENS_TYPE(sensor->i); in aibs_add_sensor()
205 switch (sensor->t) { in aibs_add_sensor()
211 device_printf(sc->sc_dev, "unknown sensor type 0x%x", in aibs_add_sensor()
212 sensor->t); in aibs_add_sensor()
219 const char *type_name, int idx, struct aibs_sensor *sensor, in aibs_sensor_added() argument
226 device_printf(sc->sc_dev, "%c%i: 0x%08jx %20s %5jd / %5jd\n", in aibs_sensor_added()
228 (uintmax_t)sensor->i, descr, (intmax_t)sensor->l, in aibs_sensor_added()
229 (intmax_t)sensor->h); in aibs_sensor_added()
231 SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->sc_dev), in aibs_sensor_added()
233 CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, (uintptr_t)sensor, in aibs_sensor_added()
234 sc->sc_ggrp_method ? aibs_sysctl_ggrp : aibs_sysctl, in aibs_sensor_added()
235 sensor->t == AIBS_SENS_TYPE_TEMP ? "IK" : "I", descr); in aibs_sensor_added()
244 ACPI_OBJECT id; in aibs_attach_ggrp() local
253 struct aibs_sensor *sensor; in aibs_attach_ggrp() local
257 s = AcpiGetHandle(sc->sc_ah, "GITM", &h); in aibs_attach_ggrp()
260 device_printf(sc->sc_dev, "GITM not found\n"); in aibs_attach_ggrp()
269 id.Integer.Value = AIBS_GROUP_SENSORS; in aibs_attach_ggrp()
270 id.Type = ACPI_TYPE_INTEGER; in aibs_attach_ggrp()
272 arg.Pointer = &id; in aibs_attach_ggrp()
275 s = AcpiEvaluateObjectTyped(sc->sc_ah, "GGRP", &arg, &buf, in aibs_attach_ggrp()
278 device_printf(sc->sc_dev, "GGRP not found\n"); in aibs_attach_ggrp()
283 sc->sc_asens_all = malloc(sizeof(*sc->sc_asens_all) * bp->Package.Count, in aibs_attach_ggrp()
286 for (i = 0; i < bp->Package.Count; i++) { in aibs_attach_ggrp()
287 sensor = &sc->sc_asens_all[i]; in aibs_attach_ggrp()
288 err = aibs_add_sensor(sc, &bp->Package.Elements[i], sensor, in aibs_attach_ggrp()
293 switch (sensor->t) { in aibs_attach_ggrp()
296 so = &sc->sc_volt_sysctl; in aibs_attach_ggrp()
301 so = &sc->sc_temp_sysctl; in aibs_attach_ggrp()
306 so = &sc->sc_fan_sysctl; in aibs_attach_ggrp()
310 panic("add_sensor succeeded for unknown sensor type %d", in aibs_attach_ggrp()
311 sensor->t); in aibs_attach_ggrp()
316 *so = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->sc_dev), in aibs_attach_ggrp()
317 SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sc_dev)), in aibs_attach_ggrp()
318 sensor->t, name, CTLFLAG_RD | CTLFLAG_MPSAFE, in aibs_attach_ggrp()
321 aibs_sensor_added(sc, *so, name, *s_idx, sensor, descr); in aibs_attach_ggrp()
346 so = &sc->sc_volt_sysctl; in aibs_attach_sif()
351 so = &sc->sc_temp_sysctl; in aibs_attach_sif()
356 so = &sc->sc_fan_sysctl; in aibs_attach_sif()
359 panic("Unsupported sensor type %d", st); in aibs_attach_sif()
363 s = AcpiEvaluateObjectTyped(sc->sc_ah, name, NULL, &b, in aibs_attach_sif()
366 device_printf(sc->sc_dev, "%s not found\n", name); in aibs_attach_sif()
371 o = bp->Package.Elements; in aibs_attach_sif()
373 device_printf(sc->sc_dev, "%s[0]: invalid type\n", name); in aibs_attach_sif()
379 if (bp->Package.Count - 1 < n) { in aibs_attach_sif()
380 device_printf(sc->sc_dev, "%s: invalid package\n", name); in aibs_attach_sif()
383 } else if (bp->Package.Count - 1 > n) { in aibs_attach_sif()
387 n = bp->Package.Count - 1; in aibs_attach_sif()
389 device_printf(sc->sc_dev, "%s: malformed package: %i/%i" in aibs_attach_sif()
390 ", assume %i\n", name, on, bp->Package.Count - 1, n); in aibs_attach_sif()
393 device_printf(sc->sc_dev, "%s: no members in the package\n", in aibs_attach_sif()
402 sc->sc_asens_volt = as; in aibs_attach_sif()
405 sc->sc_asens_temp = as; in aibs_attach_sif()
408 sc->sc_asens_fan = as; in aibs_attach_sif()
413 *so = SYSCTL_ADD_NODE(device_get_sysctl_ctx(sc->sc_dev), in aibs_attach_sif()
414 SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sc_dev)), st, in aibs_attach_sif()
434 if (sc->sc_asens_volt != NULL) in aibs_detach()
435 free(sc->sc_asens_volt, M_DEVBUF); in aibs_detach()
436 if (sc->sc_asens_temp != NULL) in aibs_detach()
437 free(sc->sc_asens_temp, M_DEVBUF); in aibs_detach()
438 if (sc->sc_asens_fan != NULL) in aibs_detach()
439 free(sc->sc_asens_fan, M_DEVBUF); in aibs_detach()
440 if (sc->sc_asens_all != NULL) in aibs_detach()
441 free(sc->sc_asens_all, M_DEVBUF); in aibs_detach()
455 struct aibs_sensor *sensor = (void *)(intptr_t)arg2; in aibs_sysctl() local
456 int i = oidp->oid_number; in aibs_sysctl()
465 switch (sensor->t) { in aibs_sysctl()
478 l = sensor->l; in aibs_sysctl()
479 h = sensor->h; in aibs_sysctl()
481 p.Integer.Value = sensor->i; in aibs_sysctl()
486 rs = AcpiEvaluateObjectTyped(sc->sc_ah, name, &mp, &b, in aibs_sysctl()
489 ddevice_printf(sc->sc_dev, in aibs_sysctl()
496 v = bp->Integer.Value; in aibs_sysctl()
500 switch (sensor->t) { in aibs_sysctl()
521 struct aibs_sensor *sensor = (void *)(intptr_t)arg2; in aibs_sysctl_ggrp() local
531 cmd[0] = sensor->i; in aibs_sysctl_ggrp()
542 rs = AcpiEvaluateObjectTyped(sc->sc_ah, "GITM", &arg, &buf, in aibs_sysctl_ggrp()
546 device_printf(sc->sc_dev, "GITM evaluation failed\n"); in aibs_sysctl_ggrp()
550 if (bp->Buffer.Length < 8) { in aibs_sysctl_ggrp()
551 device_printf(sc->sc_dev, "GITM returned short buffer\n"); in aibs_sysctl_ggrp()
554 ret = (uint32_t *)bp->Buffer.Pointer; in aibs_sysctl_ggrp()
556 device_printf(sc->sc_dev, "GITM returned error status\n"); in aibs_sysctl_ggrp()
562 l = sensor->l; in aibs_sysctl_ggrp()
563 h = sensor->h; in aibs_sysctl_ggrp()
565 switch (sensor->t) { in aibs_sysctl_ggrp()