static int nexus_probe(device_t dev) { device_quiet(dev); /* suppress attach message for neatness */ return (BUS_PROBE_GENERIC); }
/* * Support for attaching the PCIe-Gen1 MDIO driver to a parent bhndb PCIe * bridge device. */ static int bhndb_mdio_pcie_probe(device_t dev) { struct bhndb_softc *psc; device_t parent; /* Parent must be a bhndb_pcie instance */ parent = device_get_parent(dev); if (device_get_driver(parent) != &bhndb_pci_driver) return (ENXIO); /* Parent must have PCIe-Gen1 hostb device */ psc = device_get_softc(parent); if (psc->hostb_dev == NULL) return (ENXIO); if (bhnd_get_vendor(psc->hostb_dev) != BHND_MFGID_BCM || bhnd_get_device(psc->hostb_dev) != BHND_COREID_PCIE) { return (ENXIO); } device_quiet(dev); return (BUS_PROBE_NOWILDCARD); }
static int sbni_probe_isa(device_t dev) { struct sbni_softc *sc; int error; error = ISA_PNP_PROBE(device_get_parent(dev), dev, sbni_ids); if (error && error != ENOENT) return (error); sc = device_get_softc(dev); bzero(sc, sizeof(struct sbni_softc)); sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid, 0ul, ~0ul, SBNI_PORTS, RF_ACTIVE); if (!sc->io_res) { printf("sbni: cannot allocate io ports!\n"); return (ENOENT); } sc->base_addr = rman_get_start(sc->io_res); if (sbni_probe(sc) != 0) { bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res); return (ENXIO); } device_quiet(dev); return (0); }
static int intel_gmbus_attach(device_t idev) { struct intel_iic_softc *sc; struct drm_device *dev; struct drm_i915_private *dev_priv; int pin, port; sc = device_get_softc(idev); pin = device_get_unit(idev); port = pin + 1; /* +1 to map gmbus index to pin pair */ snprintf(sc->name, sizeof(sc->name), "i915 gmbus %s", intel_gmbus_is_port_valid(port) ? gmbus_ports[pin].name : "reserved"); device_set_desc(idev, sc->name); dev = device_get_softc(device_get_parent(idev)); dev_priv = dev->dev_private; sc->bus = &dev_priv->gmbus[pin]; /* add bus interface device */ sc->iic_dev = device_add_child(idev, "iicbus", -1); if (sc->iic_dev == NULL) return (ENXIO); device_quiet(sc->iic_dev); bus_generic_attach(idev); return (0); }
static int nexus_fdt_probe(device_t dev) { device_quiet(dev); return (BUS_PROBE_DEFAULT); }
static int intel_iicbb_attach(device_t idev) { struct intel_iic_softc *sc; struct drm_device *dev; struct drm_i915_private *dev_priv; int pin, port; sc = device_get_softc(idev); pin = device_get_unit(idev); port = pin + 1; snprintf(sc->name, sizeof(sc->name), "i915 iicbb %s", intel_gmbus_is_port_valid(port) ? gmbus_ports[pin].name : "reserved"); device_set_desc(idev, sc->name); dev = device_get_softc(device_get_parent(idev)); dev_priv = dev->dev_private; sc->bus = &dev_priv->gmbus[pin]; /* add generic bit-banging code */ sc->iic_dev = device_add_child(idev, "iicbb", -1); if (sc->iic_dev == NULL) return (ENXIO); device_quiet(sc->iic_dev); bus_generic_attach(idev); iicbus_set_nostop(idev, true); return (0); }
/* * Provide a device to "eat" the host->pci bridge devices that show up * on PCI busses and stop them showing up twice on the probes. This also * stops them showing up as 'none' in pciconf -l. If the host bridge * provides an AGP capability then we create a child agp device for the * agp GART driver to attach to. */ static int pci_hostb_probe(device_t dev) { u_int32_t id; id = pci_get_devid(dev); switch (id) { /* VIA VT82C596 Power Managment Function */ case 0x30501106: return (ENXIO); default: break; } if (pci_get_class(dev) == PCIC_BRIDGE && pci_get_subclass(dev) == PCIS_BRIDGE_HOST) { device_set_desc(dev, "Host to PCI bridge"); device_quiet(dev); return (-10000); } return (ENXIO); }
static int legacy_probe(device_t dev) { device_set_desc(dev, "legacy system"); device_quiet(dev); return (0); }
static int nexus_probe(device_t dev) { if (!bootverbose) device_quiet(dev); return (BUS_PROBE_DEFAULT); }
static int ram_probe(device_t dev) { device_quiet(dev); device_set_desc(dev, "System RAM"); return (0); }
static int nexus_probe(device_t dev) { int cpuid; device_quiet(dev); /* suppress attach message for neatness */ for (cpuid = 0; cpuid < ncpus; ++cpuid) { struct rman *rm = &irq_rman[cpuid]; rm->rm_start = 0; rm->rm_end = IDT_HWI_VECTORS - 1; rm->rm_type = RMAN_ARRAY; rm->rm_descr = "Interrupt request lines"; if (rman_init(rm, cpuid)) panic("nexus_probe rman_init"); MachIntrABI.rman_setup(rm); } /* * ISA DMA on PCI systems is implemented in the ISA part of each * PCI->ISA bridge and the channels can be duplicated if there are * multiple bridges. (eg: laptops with docking stations) */ drq_rman.rm_start = 0; drq_rman.rm_end = 7; drq_rman.rm_type = RMAN_ARRAY; drq_rman.rm_descr = "DMA request lines"; /* XXX drq 0 not available on some machines */ if (rman_init(&drq_rman, -1) || rman_manage_region(&drq_rman, drq_rman.rm_start, drq_rman.rm_end)) panic("nexus_probe drq_rman"); /* * However, IO ports and Memory truely are global at this level, * as are APIC interrupts (however many IO APICS there turn out * to be on large systems..) */ port_rman.rm_start = 0; port_rman.rm_end = 0xffff; port_rman.rm_type = RMAN_ARRAY; port_rman.rm_descr = "I/O ports"; if (rman_init(&port_rman, -1) || rman_manage_region(&port_rman, 0, 0xffff)) panic("nexus_probe port_rman"); mem_rman.rm_start = 0; mem_rman.rm_end = ~0u; mem_rman.rm_type = RMAN_ARRAY; mem_rman.rm_descr = "I/O memory addresses"; if (rman_init(&mem_rman, -1) || rman_manage_region(&mem_rman, 0, ~0)) panic("nexus_probe mem_rman"); return bus_generic_probe(dev); }
static int vgapm_probe(device_t dev) { device_set_desc(dev, "VGA suspend/resume"); device_quiet(dev); return (BUS_PROBE_DEFAULT); }
static int scpm_probe(device_t dev) { device_set_desc(dev, SC_DRIVER_NAME " suspend/resume"); device_quiet(dev); return (BUS_PROBE_DEFAULT); }
static int nexus_acpi_probe(device_t dev) { if (acpi_identify() != 0) return (ENXIO); device_quiet(dev); return (BUS_PROBE_LOW_PRIORITY); }
static int nexus_fdt_probe(device_t dev) { if (OF_peer(0) == 0) return (ENXIO); device_quiet(dev); return (BUS_PROBE_DEFAULT); }
static int nexus_acpi_probe(device_t dev) { if (arm64_bus_method != ARM64_BUS_ACPI || acpi_identify() != 0) return (ENXIO); device_quiet(dev); return (BUS_PROBE_LOW_PRIORITY); }
static int nexus_fdt_probe(device_t dev) { if (arm64_bus_method != ARM64_BUS_FDT) return (ENXIO); device_quiet(dev); return (BUS_PROBE_DEFAULT); }
static int sysresource_probe(device_t dev) { int result; if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, sysresource_ids)) <= 0) { device_quiet(dev); } return(result); }
/** * Default bhnd sprom driver implementation of DEVICE_PROBE(). */ int bhnd_sprom_probe(device_t dev) { /* Quiet by default */ if (!bootverbose) device_quiet(dev); device_set_desc(dev, "SPROM/OTP"); /* Refuse wildcard attachments */ return (BUS_PROBE_NOWILDCARD); }
static int fdtbus_probe(device_t dev) { debugf("%s(dev=%p); pass=%u\n", __func__, dev, bus_current_pass); device_set_desc(dev, "FDT main bus"); if (!bootverbose) device_quiet(dev); return (BUS_PROBE_DEFAULT); }
static int ignore_pci_probe(device_t dev) { switch (pci_get_devid(dev)) { case 0x10001042ul: /* SMC 37C665 */ device_set_desc(dev, "ignored"); device_quiet(dev); return(-10000); } return(ENXIO); }
static int doorbell_probe(device_t dev) { const char *name = ofw_bus_get_name(dev); if (strcmp(name, "smu-doorbell") != 0) return (ENXIO); device_set_desc(dev, "SMU Doorbell GPIO"); device_quiet(dev); return (0); }
static int dpms_probe(device_t dev) { int error, states; error = dpms_get_supported_states(&states); if (error) return (error); device_set_desc(dev, "DPMS suspend/resume"); device_quiet(dev); return (BUS_PROBE_DEFAULT); }
/* * Driver to swallow Grackle host bridges from the PCI bus side. */ static int grackle_hb_probe(device_t dev) { if (pci_get_devid(dev) == 0x00021057) { device_set_desc(dev, "Grackle Host to PCI bridge"); device_quiet(dev); return (0); } return (ENXIO); }
static int arm64_cpu_probe(device_t dev) { u_int cpuid; cpuid = device_get_unit(dev); if (cpuid >= MAXCPU || cpuid > mp_maxid) return (EINVAL); device_quiet(dev); return (0); }
/* * Driver to swallow UniNorth host bridges from the PCI bus side. */ static int unhb_probe(device_t dev) { if (pci_get_class(dev) == PCIC_BRIDGE && pci_get_subclass(dev) == PCIS_BRIDGE_HOST) { device_set_desc(dev, "Host to PCI bridge"); device_quiet(dev); return (-10000); } return (ENXIO); }
static int acpi_sysres_probe(device_t dev) { static char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL }; if (acpi_disabled("sysresource") || ACPI_ID_PROBE(device_get_parent(dev), dev, sysres_ids) == NULL) return (ENXIO); device_set_desc(dev, "System Resource"); device_quiet(dev); return (BUS_PROBE_DEFAULT); }
/* * misc support functions */ static device_t ata_add_child(device_t parent, struct ata_device *atadev, int unit) { device_t child; if ((child = device_add_child(parent, NULL, unit))) { device_set_softc(child, atadev); device_quiet(child); atadev->dev = child; atadev->max_iosize = DEV_BSIZE; atadev->mode = ATA_PIO_MAX; } return child; }
static int sbni_pci_probe(device_t dev) { struct sbni_softc *sc; u_int32_t ports; ports = SBNI_PORTS; if (pci_get_vendor(dev) != SBNI_PCI_VENDOR || pci_get_device(dev) != SBNI_PCI_DEVICE) return (ENXIO); sc = device_get_softc(dev); bzero(sc, sizeof(struct sbni_softc)); if (pci_get_subdevice(dev) == 2) { ports <<= 1; sc->slave_sc = malloc(sizeof(struct sbni_softc), M_DEVBUF, M_NOWAIT); if (!sc->slave_sc) return (ENOMEM); bzero(sc->slave_sc, sizeof(struct sbni_softc)); device_set_desc(dev, "Granch SBNI12/PCI Dual adapter"); } else device_set_desc(dev, "Granch SBNI12/PCI adapter"); sc->io_rid = PCIR_MAPS; sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid, 0ul, ~0ul, ports, RF_ACTIVE); if (!sc->io_res) { printf("sbni: cannot allocate io ports!\n"); if (sc->slave_sc) free(sc->slave_sc, M_DEVBUF); return (ENOENT); } sc->base_addr = rman_get_start(sc->io_res); if (sc->slave_sc) sc->slave_sc->base_addr = sc->base_addr + 4; if (sbni_probe(sc) != 0) { bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res); if (sc->slave_sc) free(sc->slave_sc, M_DEVBUF); return (ENXIO); } device_quiet(dev); return (0); }
static int t4iov_probe(device_t dev) { uint16_t d; size_t i; d = pci_get_device(dev); for (i = 0; i < nitems(t4iov_pciids); i++) { if (d == t4iov_pciids[i].device) { device_set_desc(dev, t4iov_pciids[i].desc); device_quiet(dev); return (BUS_PROBE_DEFAULT); } } return (ENXIO); }