Lines Matching defs:dev

37 __FBSDID("$FreeBSD: stable/11/sys/dev/amdtemp/amdtemp.c 355562 2019-12-09 17:14:43Z mav $");
51 #include <dev/pci/pcivar.h>
54 #include <dev/amdsmn/amdsmn.h>
180 static int amdtemp_probe(device_t dev);
181 static int amdtemp_attach(device_t dev);
183 static int amdtemp_detach(device_t dev);
184 static int32_t amdtemp_gettemp0f(device_t dev, amdsensor_t sensor);
185 static int32_t amdtemp_gettemp(device_t dev, amdsensor_t sensor);
186 static int32_t amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor);
187 static int32_t amdtemp_gettemp17h(device_t dev, amdsensor_t sensor);
212 amdtemp_match(device_t dev, const struct amdtemp_product **product_out)
217 vendor = pci_get_vendor(dev);
218 devid = pci_get_device(dev);
248 amdtemp_probe(device_t dev)
254 if (!amdtemp_match(device_get_parent(dev), NULL))
277 device_set_desc(dev, "AMD CPU On-Die Thermal Sensors");
283 amdtemp_attach(device_t dev)
296 sc = device_get_softc(dev);
300 if (!amdtemp_match(device_get_parent(dev), &product))
321 cpuid = pci_read_config(device_get_parent(dev), AMDTEMP_CPUID,
401 if ((pci_cfgregread(pci_get_bus(dev),
402 pci_get_slot(dev), 2, AMDTEMP_DRAM_CONF_HIGH, 2) &
435 device_printf(dev, "Bogus family 0x%x\n", family);
441 device_get_parent(dev), "amdsmn", -1);
444 device_printf(dev, "No SMN device found\n");
456 device_printf(dev,
459 device_printf(dev, "Found %d cores and %d sensors.\n",
464 * dev.amdtemp.N tree.
466 unit = device_get_unit(dev);
467 snprintf(tn, sizeof(tn), "dev.amdtemp.%d.sensor_offset", unit);
470 sysctlctx = device_get_sysctl_ctx(dev);
472 SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
476 SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
482 dev, CORE0_SENSOR0, amdtemp_sysctl, "IK",
489 dev, CORE0_SENSOR1, amdtemp_sysctl, "IK",
494 SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
500 dev, CORE1_SENSOR0, amdtemp_sysctl, "IK",
506 dev, CORE1_SENSOR1, amdtemp_sysctl, "IK",
512 * Try to create dev.cpu sysctl entries and setup intrhook function.
516 amdtemp_intrhook(dev);
518 sc->sc_ich.ich_arg = dev;
520 device_printf(dev, "config_intrhook_establish failed!\n");
532 device_t dev = (device_t)arg;
537 sc = device_get_softc(dev);
540 * dev.cpu.N.temperature.
549 device_get_unit(dev) * sc->sc_ncores + i);
558 dev, sensor, amdtemp_sysctl, "IK",
567 amdtemp_detach(device_t dev)
569 struct amdtemp_softc *sc = device_get_softc(dev);
576 /* NewBus removes the dev.amdtemp.N tree by itself. */
584 device_t dev = (device_t)arg1;
585 struct amdtemp_softc *sc = device_get_softc(dev);
592 auxtemp[0] = sc->sc_gettemp(dev, CORE0_SENSOR0);
593 auxtemp[1] = sc->sc_gettemp(dev, CORE0_SENSOR1);
597 auxtemp[0] = sc->sc_gettemp(dev, CORE1_SENSOR0);
598 auxtemp[1] = sc->sc_gettemp(dev, CORE1_SENSOR1);
602 temp = sc->sc_gettemp(dev, sensor);
613 amdtemp_gettemp0f(device_t dev, amdsensor_t sensor)
615 struct amdtemp_softc *sc = device_get_softc(dev);
619 temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 1);
639 pci_write_config(dev, AMDTEMP_THERMTP_STAT, temp, 1);
643 temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
674 amdtemp_gettemp(device_t dev, amdsensor_t sensor)
676 struct amdtemp_softc *sc = device_get_softc(dev);
679 temp = pci_read_config(dev, AMDTEMP_REPTMP_CTRL, 4);
684 amdtemp_gettemp15hm60h(device_t dev, amdsensor_t sensor)
686 struct amdtemp_softc *sc = device_get_softc(dev);
696 amdtemp_gettemp17h(device_t dev, amdsensor_t sensor)
698 struct amdtemp_softc *sc = device_get_softc(dev);