Ejemplo n.º 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));
}
Ejemplo n.º 2
0
static int
bcma_nexus_attach(device_t dev)
{
	struct bcma_nexus_softc	*sc;
	struct resource		*erom_res;
	int			 error;
	int			 rid;

	sc = device_get_softc(dev);

	/* Map the EROM resource and enumerate the bus. */
	rid = 0;
	erom_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
	    sc->bcma_cid.enum_addr, 
	    sc->bcma_cid.enum_addr + BCMA_EROM_TABLE_SIZE,
	    BCMA_EROM_TABLE_SIZE, RF_ACTIVE);
	if (erom_res == NULL) {
		device_printf(dev, "failed to allocate EROM resource\n");
		return (ENXIO);
	}

	error = bcma_add_children(dev, erom_res, BCMA_EROM_TABLE_START);
	bus_release_resource(dev, SYS_RES_MEMORY, rid, erom_res);

	if (error)
		return (error);

	return (bcma_attach(dev));
}
Ejemplo n.º 3
0
static int
bcma_bhndb_attach(device_t dev)
{
	const struct bhnd_chipid	*cid;
	struct resource			*erom_res;
	int				 error;
	int				 rid;

	cid = BHNDB_GET_CHIPID(device_get_parent(dev), dev);

	/* Map the EROM resource and enumerate our children. */
	rid = 0;
	erom_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, cid->enum_addr,
		cid->enum_addr + BCMA_EROM_TABLE_SIZE, BCMA_EROM_TABLE_SIZE,
		RF_ACTIVE);
	if (erom_res == NULL) {
		device_printf(dev, "failed to allocate EROM resource\n");
		return (ENXIO);
	}

	error = bcma_add_children(dev, erom_res, BCMA_EROM_TABLE_START);

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

	/* Initialize full bridge configuration */
	error = BHNDB_INIT_FULL_CONFIG(device_get_parent(dev), dev,
	    bhndb_bcma_priority_table);
	if (error)
		return (error);

	/* Call our superclass' implementation */
	return (bcma_attach(dev));
}