示例#1
0
/*
 * 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);
}
示例#2
0
/**
 * Default implementation of BUS_CHILD_PNPINFO_STR().
 */
static int
bhnd_child_pnpinfo_str(device_t dev, device_t child, char *buf,
    size_t buflen)
{
	if (device_get_parent(child) != dev) {
		return (BUS_CHILD_PNPINFO_STR(device_get_parent(dev), child,
		    buf, buflen));
	}

	snprintf(buf, buflen, "vendor=0x%hx device=0x%hx rev=0x%hhx",
	    bhnd_get_vendor(child), bhnd_get_device(child),
	    bhnd_get_hwrev(child));

	return (0);
}
示例#3
0
/**
 * Helper function for implementing BUS_PRINT_CHILD().
 * 
 * This implementation requests the device's struct resource_list via
 * BUS_GET_RESOURCE_LIST.
 */
void
bhnd_generic_probe_nomatch(device_t dev, device_t child)
{
	struct resource_list		*rl;
	const struct bhnd_nomatch	*nm;
	bool				 report;

	/* Fetch reporting configuration for this device */
	report = true;
	for (nm = bhnd_nomatch_table; nm->device != BHND_COREID_INVALID; nm++) {
		if (nm->vendor != bhnd_get_vendor(child))
			continue;

		if (nm->device != bhnd_get_device(child))
			continue;

		report = false;
		if (bootverbose && nm->if_verbose)
			report = true;
		break;
	}
	
	if (!report)
		return;

	/* Print the non-matched device info */
	device_printf(dev, "<%s %s>", bhnd_get_vendor_name(child),
		bhnd_get_device_name(child));

	rl = BUS_GET_RESOURCE_LIST(dev, child);
	if (rl != NULL)
		resource_list_print_type(rl, "mem", SYS_RES_MEMORY, "%#lx");

	printf(" at core %u (no driver attached)\n",
	    bhnd_get_core_index(child));
}