Пример #1
0
static int
bcma_nexus_attach(device_t dev)
{
	int 		 erom_rid;
	int 		 error;
	struct resource	*erom_res;
	const struct bhnd_chipid *cid = BHND_BUS_GET_CHIPID(device_get_parent(dev), dev);

  	erom_rid = BCMA_NEXUS_EROM_RID;
 	error = bus_set_resource(dev, SYS_RES_MEMORY, erom_rid, cid->enum_addr, BCMA_EROM_TABLE_SIZE);
 	if (error != 0) {
 		BHND_ERROR_DEV(dev, "failed to set EROM resource");
 		return (error);
 	}

 	/* Map the EROM resource and enumerate our children. */
 	BHND_DEBUG_DEV(dev, "erom enum address: %jx", cid->enum_addr);
 	erom_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &erom_rid, RF_ACTIVE);
 	if (erom_res == NULL) {
 		BHND_ERROR_DEV(dev, "failed to allocate EROM resource");
 		return (ENXIO);
 	}

 	BHND_DEBUG_DEV(dev, "erom scanning start address: %p", rman_get_virtual(erom_res));
 	error = bcma_add_children(dev, erom_res, BCMA_EROM_TABLE_START);

 	/* Clean up */
 	bus_release_resource(dev, SYS_RES_MEMORY, erom_rid, erom_res);
 	if (error)
 		return (error);

 	/* Call our superclass' implementation */
 	return (bcma_attach(dev));
}
Пример #2
0
static int
bcma_nexus_probe(device_t dev)
{
	const struct bhnd_chipid *cid = BHND_BUS_GET_CHIPID(device_get_parent(dev), dev);

	/* Check bus type */
	if (cid->chip_type != BHND_CHIPTYPE_BCMA)
		return (ENXIO);

	/* Delegate to default probe implementation */
	return (bcma_probe(dev));
}
Пример #3
0
/**
 * Helper function for implementing BHND_BUS_GET_CHIPID().
 * 
 * This implementation delegates the request to the BHND_BUS_GET_CHIPID()
 * method on the parent of @p dev.
 */
const struct bhnd_chipid *
bhnd_generic_get_chipid(device_t dev, device_t child) {
	return (BHND_BUS_GET_CHIPID(device_get_parent(dev), child));
}