MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / pci_child_bus_init

Function pci_child_bus_init

components/drivers/pci/probe.c:401–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399static struct rt_pci_bus *pci_alloc_bus(struct rt_pci_bus *parent);
400
401static rt_err_t pci_child_bus_init(struct rt_pci_bus *bus, rt_uint32_t bus_no,
402 struct rt_pci_host_bridge *host_bridge, struct rt_pci_device *pdev)
403{
404 rt_err_t err;
405 struct rt_pci_bus *parent_bus = bus->parent;
406
407 bus->sysdata = parent_bus->sysdata;
408 bus->self = pdev;
409 bus->ops = host_bridge->child_ops ? : parent_bus->ops;
410
411 bus->number = bus_no;
412 rt_sprintf(bus->name, "%04x:%02x", host_bridge->domain, bus_no);
413
414 rt_pci_ofw_bus_init(bus);
415
416 if (bus->ops->add)
417 {
418 if ((err = bus->ops->add(bus)))
419 {
420 rt_pci_ofw_bus_free(bus);
421
422 LOG_E("PCI-Bus<%s> add bus failed with err = %s",
423 bus->name, rt_strerror(err));
424
425 return err;
426 }
427 }
428
429 return RT_EOK;
430}
431
432static rt_bool_t pci_ea_fixed_busnrs(struct rt_pci_device *pdev,
433 rt_uint8_t *sec, rt_uint8_t *sub)

Callers 1

pci_scan_bridge_extendFunction · 0.85

Calls 4

rt_sprintfFunction · 0.85
rt_strerrorFunction · 0.85
rt_pci_ofw_bus_initFunction · 0.70
rt_pci_ofw_bus_freeFunction · 0.70

Tested by

no test coverage detected