MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bcm_init_platform_data

Function bcm_init_platform_data

freebsd/mips/broadcom/bcm_machdep.c:344–457  ·  view source on GitHub ↗

* Populate platform configuration data. */

Source from the content-addressed store, hash-verified

342 * Populate platform configuration data.
343 */
344static int
345bcm_init_platform_data(struct bcm_platform *bp)
346{
347 bus_addr_t bus_addr, bus_size;
348 bus_space_tag_t erom_bst;
349 bus_space_handle_t erom_bsh;
350 bool aob, pmu;
351 int error;
352
353 bus_addr = bcm_get_bus_addr();
354 bus_size = bcm_get_bus_size();
355
356#ifdef CFE
357 /* Fetch CFE console handle (if any). Must be initialized before
358 * any calls to printf/early_putc. */
359 if ((bp->cfe_console = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE)) < 0)
360 bp->cfe_console = -1;
361
362 /* Probe CFE NVRAM sources */
363 bp->nvram_io = &bcm_cfe_nvram.io;
364 error = bcm_nvram_find_cfedev(&bcm_cfe_nvram, &bp->nvram_cls);
365 if (error) {
366 bp->nvram_io = NULL;
367 bp->nvram_cls = NULL;
368 }
369#endif /* CFE */
370
371 /* Probe and attach device table provider, populating our
372 * chip identification */
373 erom_bst = mips_bus_space_generic;
374 erom_bsh = BCM_SOC_BSH(bus_addr, 0);
375
376 error = bhnd_erom_iobus_init(&bp->erom_io, bus_addr, bus_size, erom_bst,
377 erom_bsh);
378 if (error) {
379 BCM_ERR("failed to initialize erom I/O callbacks: %d\n", error);
380 return (error);
381 }
382
383 error = bcm_erom_probe_and_attach(&bp->erom_impl, &bp->erom_ops,
384 &bp->erom.obj, sizeof(bp->erom), &bp->erom_io.eio, &bp->cid);
385 if (error) {
386 BCM_ERR("error attaching erom parser: %d\n", error);
387 bhnd_erom_io_fini(&bp->erom_io.eio);
388 return (error);
389 }
390
391 if (bootverbose)
392 bhnd_erom_dump(&bp->erom.obj);
393
394 /* Fetch chipcommon core info */
395 error = bcm_find_core(bp, bcm_chipc_cores, nitems(bcm_chipc_cores),
396 &bp->cc_id, &bp->cc_addr);
397 if (error) {
398 BCM_ERR("error locating chipc core: %d\n", error);
399 return (error);
400 }
401

Callers 1

platform_startFunction · 0.85

Calls 6

bcm_get_bus_addrFunction · 0.85
bcm_get_bus_sizeFunction · 0.85
bcm_nvram_find_cfedevFunction · 0.85
bcm_find_coreFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected