Skip to content

Commit

Permalink
[lib][fdtwalk] skip scanning pci busses marked 'disabled'
Browse files Browse the repository at this point in the history
  • Loading branch information
travisg committed Jun 19, 2024
1 parent e3a5f9c commit bd423ca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions dev/bus/pci/bus_mgr/bus_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ status_t pci_bus_mgr_init() {
// TODO: deal with root bus not having reference to bridge device
status_t err = bus::probe(loc, nullptr, &b, true);
if (err < 0) {
printf("PCI: failed to probe bus, error %d\n", err);
return err;
}

Expand Down
15 changes: 13 additions & 2 deletions lib/fdtwalk/fdtwalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,20 @@ status_t fdt_walk_find_pcie_info(const void *fdt, struct fdt_walk_pcie_info *inf
auto walker = [info, info_len, &count](const fdt_walk_state &state, const char *name) {
/* look for a pcie leaf and pass the address of the ecam and other info to the callback */
if (*count < info_len && (strncmp(name, "pcie@", 5) == 0 || strncmp(name, "pci@", 4) == 0)) {
/* find the range of the ecam */
int lenp;
const uint8_t *prop_ptr = (const uint8_t *)fdt_getprop(state.fdt, state.offset, "reg", &lenp);

/* check the status, is it disabled? */
const uint8_t *prop_ptr = (const uint8_t *)fdt_getprop(state.fdt, state.offset, "status", &lenp);
if (prop_ptr) {
if (fdt_stringlist_contains((const char *)prop_ptr, lenp, "disabled")) {
LTRACEF("found disabled pci node\n");
return;
}
}


/* find the range of the ecam */
prop_ptr = (const uint8_t *)fdt_getprop(state.fdt, state.offset, "reg", &lenp);
LTRACEF("%p, lenp %u\n", prop_ptr, lenp);
if (prop_ptr) {
LTRACEF_LEVEL(2, "found '%s' prop 'reg' len %d, ac %u, sc %u\n", name, lenp,
Expand Down

0 comments on commit bd423ca

Please sign in to comment.