Attention is currently required from: Angel Pons, Boris Mittelberg, Caveh Jalali, Christian Walter, Eran Mitrani, Felix Held, Fred Reitberger, Jason Glenesk, Jason Nien, Jeff Daly, Johnny Lin, Kapil Porwal, Lance Zhao, Martin L Roth, Martin Roth, Matt DeVillier, Michał Żygowski, Nick Vaccaro, Piotr Król, Sean Rhodes, Subrata Banik, Tarun, Tim Chu, Tim Wawrzynczak, Vanessa Eusebio, Werner Zeh.
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/78330?usp=email )
Change subject: device/device.h: Rename busses for clarity ......................................................................
device/device.h: Rename busses for clarity
This renames bus to upstream and link_list to downstream.
Signed-off-by: Arthur Heymans arthur@aheymans.xyz Change-Id: I80a81b6b8606e450ff180add9439481ec28c2420 --- M src/acpi/acpi.c M src/acpi/device.c M src/arch/x86/mpspec.c M src/cpu/intel/haswell/haswell_init.c M src/cpu/intel/model_2065x/model_2065x_init.c M src/cpu/intel/model_206ax/model_206ax_init.c M src/device/cardbus_device.c M src/device/device.c M src/device/device_const.c M src/device/device_util.c M src/device/i2c_bus.c M src/device/mdio.c M src/device/oprom/realmode/x86.c M src/device/oprom/realmode/x86_interrupts.c M src/device/oprom/yabel/device.c M src/device/oprom/yabel/interrupt.c M src/device/pci_device.c M src/device/pci_rom.c M src/device/pciexp_device.c M src/device/pcix_device.c M src/device/pnp_device.c M src/device/resource_allocator_v4.c M src/device/root_device.c M src/drivers/i2c/ptn3460/ptn3460.c M src/drivers/intel/dptf/dptf.c M src/drivers/intel/ish/ish.c M src/drivers/intel/mipi_camera/camera.c M src/drivers/intel/soundwire/soundwire.c M src/drivers/net/phy/m88e1512/m88e1512.c M src/drivers/net/r8168.c M src/drivers/nxp/uwb/uwb.c M src/drivers/pcie/generic/generic.c M src/drivers/spi/acpi/acpi.c M src/drivers/usb/hub/acpi.c M src/drivers/usb/pci_xhci/pci_xhci.c M src/drivers/wifi/generic/acpi.c M src/drivers/wifi/generic/smbios.c M src/drivers/wwan/fm/acpi_fm350gl.c M src/ec/google/chromeec/ec_acpi.c M src/include/device/device.h M src/include/device/pci_ops.h M src/lib/smbios.c M src/mainboard/aopen/dxplplusu/acpi_tables.c M src/mainboard/emulation/qemu-i440fx/northbridge.c M src/mainboard/google/brya/mainboard.c M src/mainboard/google/kahlee/variants/careena/mainboard.c M src/mainboard/google/kahlee/variants/treeya/audio.c M src/mainboard/google/octopus/mainboard.c M src/mainboard/google/rex/mainboard.c M src/mainboard/google/zork/variants/baseboard/ramstage_common.c M src/mainboard/ibase/mb899/mptable.c M src/mainboard/kontron/986lcd-m/mptable.c M src/mainboard/pcengines/apu2/mainboard.c M src/mainboard/roda/rk9/ti_pci7xx1.c M src/mainboard/siemens/mc_apl1/mainboard.c M src/mainboard/siemens/mc_apl1/variants/mc_apl3/mainboard.c M src/mainboard/siemens/mc_apl1/variants/mc_apl5/mainboard.c M src/mainboard/siemens/mc_apl1/variants/mc_apl6/mainboard.c M src/mainboard/siemens/mc_ehl/mainboard.c M src/northbridge/amd/pi/00730F01/northbridge.c M src/northbridge/intel/e7505/northbridge.c M src/northbridge/intel/gm45/northbridge.c M src/northbridge/intel/haswell/pcie.c M src/northbridge/intel/i440bx/northbridge.c M src/northbridge/intel/i945/northbridge.c M src/northbridge/intel/pineview/northbridge.c M src/northbridge/intel/sandybridge/pcie.c M src/northbridge/intel/x4x/northbridge.c M src/soc/amd/cezanne/xhci.c M src/soc/amd/common/block/acpi/ivrs.c M src/soc/amd/common/block/data_fabric/domain.c M src/soc/amd/common/block/lpc/lpc.c M src/soc/amd/glinda/xhci.c M src/soc/amd/mendocino/xhci.c M src/soc/amd/phoenix/xhci.c M src/soc/amd/picasso/xhci.c M src/soc/amd/stoneyridge/northbridge.c M src/soc/cavium/cn81xx/ecam0.c M src/soc/intel/apollolake/chip.c M src/soc/intel/braswell/southcluster.c M src/soc/intel/common/block/acpi/pep.c M src/soc/intel/common/block/lpc/lpc.c M src/soc/intel/common/block/pcie/rtd3/rtd3.c M src/soc/intel/common/block/usb4/pcie.c M src/soc/intel/common/block/xhci/xhci.c M src/soc/intel/denverton_ns/lpc.c M src/soc/intel/meteorlake/fsp_params.c M src/soc/intel/skylake/chip.c M src/soc/intel/xeon_sp/chip_common.c M src/soc/intel/xeon_sp/cpx/soc_acpi.c M src/soc/intel/xeon_sp/skx/soc_acpi.c M src/soc/intel/xeon_sp/spr/soc_acpi.c M src/soc/intel/xeon_sp/uncore.c M src/soc/intel/xeon_sp/uncore_acpi.c M src/southbridge/amd/pi/hudson/lpc.c M src/superio/common/generic.c M src/superio/common/ssdt.c M util/sconfig/main.c 98 files changed, 310 insertions(+), 316 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/78330/1
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 17cd24c..82846fe 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -691,7 +691,7 @@
if (device->path.type == DEVICE_PATH_PCI) { spmi->pci_device_flag = ACPI_IPMI_PCI_DEVICE_FLAG; - spmi->pci_bus = device->bus->secondary; + spmi->pci_bus = device->upstream->secondary; spmi->pci_device = device->path.pci.devfn >> 3; spmi->pci_function = device->path.pci.devfn & 0x7; } else if (type != IPMI_INTERFACE_SSIF) { diff --git a/src/acpi/device.c b/src/acpi/device.c index b76357e..36f02d1 100644 --- a/src/acpi/device.c +++ b/src/acpi/device.c @@ -80,8 +80,8 @@ return dev->ops->acpi_name(dev);
/* Walk up the tree to find if any parent can identify this device */ - while (pdev->bus) { - pdev = pdev->bus->dev; + while (pdev->upstream) { + pdev = pdev->upstream->dev; if (!pdev) break; if (pdev->path.type == DEVICE_PATH_ROOT) @@ -144,8 +144,8 @@ return cur;
/* Walk up the tree to the root device */ - if (dev->path.type != DEVICE_PATH_ROOT && dev->bus && dev->bus->dev) - next = acpi_device_path_fill(dev->bus->dev, buf, buf_len, cur); + if (dev->path.type != DEVICE_PATH_ROOT && dev->upstream && dev->upstream->dev) + next = acpi_device_path_fill(dev->upstream->dev, buf, buf_len, cur); if (next < 0) return next;
@@ -180,10 +180,10 @@ { static char buf[DEVICE_PATH_MAX] = {};
- if (!dev || !dev->bus || !dev->bus->dev) + if (!dev || !dev->upstream || !dev->upstream->dev) return NULL;
- if (acpi_device_path_fill(dev->bus->dev, buf, sizeof(buf), 0) <= 0) + if (acpi_device_path_fill(dev->upstream->dev, buf, sizeof(buf), 0) <= 0) return NULL;
return buf; diff --git a/src/arch/x86/mpspec.c b/src/arch/x86/mpspec.c index 3ecb42b..d18c478 100644 --- a/src/arch/x86/mpspec.c +++ b/src/arch/x86/mpspec.c @@ -283,11 +283,11 @@
unsigned char dstirq_x[4];
- if (!dev->link_list) + if (!dev->downstream) return;
- child = dev->link_list->children; - srcbus = dev->link_list->secondary; + child = dev->downstream->children; + srcbus = dev->downstream->secondary;
while (child) { if (child->path.type != DEVICE_PATH_PCI) @@ -475,7 +475,7 @@ memset(buses, 0, sizeof(buses));
for (dev = all_devices; dev; dev = dev->next) { - struct bus *bus = dev->link_list; + struct bus *bus = dev->downstream; if (!bus) continue; if (bus->secondary > 255) { diff --git a/src/cpu/intel/haswell/haswell_init.c b/src/cpu/intel/haswell/haswell_init.c index 83d847cb..86dcbea 100644 --- a/src/cpu/intel/haswell/haswell_init.c +++ b/src/cpu/intel/haswell/haswell_init.c @@ -449,7 +449,7 @@ static void configure_thermal_target(struct device *dev) { /* Make sure your devicetree has the cpu_cluster below chip cpu/intel/haswell! */ - struct cpu_intel_haswell_config *conf = dev->bus->dev->chip_info; + struct cpu_intel_haswell_config *conf = dev->upstream->dev->chip_info; msr_t msr;
/* Set TCC activation offset if supported */ diff --git a/src/cpu/intel/model_2065x/model_2065x_init.c b/src/cpu/intel/model_2065x/model_2065x_init.c index 3497ae0..cb74854 100644 --- a/src/cpu/intel/model_2065x/model_2065x_init.c +++ b/src/cpu/intel/model_2065x/model_2065x_init.c @@ -22,7 +22,7 @@
static void configure_thermal_target(struct device *dev) { - struct cpu_intel_model_2065x_config *conf = dev->bus->dev->chip_info; + struct cpu_intel_model_2065x_config *conf = dev->upstream->dev->chip_info; msr_t msr;
/* Set TCC activation offset if supported */ diff --git a/src/cpu/intel/model_206ax/model_206ax_init.c b/src/cpu/intel/model_206ax/model_206ax_init.c index 242746e..d28bf8b 100644 --- a/src/cpu/intel/model_206ax/model_206ax_init.c +++ b/src/cpu/intel/model_206ax/model_206ax_init.c @@ -213,7 +213,7 @@
static void configure_thermal_target(struct device *dev) { - struct cpu_intel_model_206ax_config *conf = dev->bus->dev->chip_info; + struct cpu_intel_model_206ax_config *conf = dev->upstream->dev->chip_info; msr_t msr;
/* Set TCC activation offset if supported */ diff --git a/src/device/cardbus_device.c b/src/device/cardbus_device.c index 23f24dd..2eb070e 100644 --- a/src/device/cardbus_device.c +++ b/src/device/cardbus_device.c @@ -119,7 +119,7 @@ u16 ctrl;
ctrl = pci_read_config16(dev, PCI_CB_BRIDGE_CONTROL); - ctrl |= (dev->link_list->bridge_ctrl & ( + ctrl |= (dev->downstream->bridge_ctrl & ( PCI_BRIDGE_CTL_VGA | PCI_BRIDGE_CTL_MASTER_ABORT | PCI_BRIDGE_CTL_BUS_RESET)); diff --git a/src/device/device.c b/src/device/device.c index 6bdbccf..5fc077c 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -101,7 +101,7 @@ dev->enabled = 1;
/* Add the new device to the list of children of the bus. */ - dev->bus = parent; + dev->upstream = parent; if (child) child->sibling = dev; else @@ -169,8 +169,8 @@ curdev->ops->read_resources(curdev);
/* Read in the resources behind the current device's links. */ - if (curdev->link_list) - read_resources(curdev->link_list); + if (curdev->downstream) + read_resources(curdev->downstream); } post_log_clear(); printk(BIOS_SPEW, "%s %s bus %d done\n", dev_path(bus->dev), __func__, bus->secondary); @@ -199,7 +199,7 @@ continue;
printk(BIOS_DEBUG, "found VGA at %s\n", dev_path(dev)); - if (dev->bus->no_vga16) { + if (dev->upstream->no_vga16) { printk(BIOS_WARNING, "A bridge on the path doesn't support 16-bit VGA decoding!"); } @@ -233,7 +233,7 @@ /* All legacy VGA cards have MEM & I/O space registers. */ vga->command |= (PCI_COMMAND_MEMORY | PCI_COMMAND_IO); vga_pri = vga; - bus = vga->bus; + bus = vga->upstream; }
/* Now walk up the bridges setting the VGA enable. */ @@ -241,7 +241,7 @@ printk(BIOS_DEBUG, "Setting PCI_BRIDGE_CTL_VGA for bridge %s\n", dev_path(bus->dev)); bus->bridge_ctrl |= PCI_BRIDGE_CTL_VGA | PCI_BRIDGE_CTL_VGA16; - bus = (bus == bus->dev->bus) ? 0 : bus->dev->bus; + bus = (bus == bus->dev->upstream) ? 0 : bus->dev->upstream; } }
@@ -304,8 +304,8 @@ }
for (dev = link->children; dev; dev = dev->sibling) { - if (dev->link_list) - enable_resources(dev->link_list); + if (dev->downstream) + enable_resources(dev->downstream); } post_log_clear(); } @@ -352,14 +352,14 @@
do_scan_bus = 1; while (do_scan_bus) { - struct bus *link = busdev->link_list; + struct bus *link = busdev->downstream; busdev->ops->scan_bus(busdev); do_scan_bus = 0; if (link && link->reset_needed) { if (reset_bus(link)) do_scan_bus = 1; else - busdev->bus->reset_needed = 1; + busdev->upstream->reset_needed = 1; } }
@@ -457,14 +457,14 @@ /* Read the resources for the entire tree. */
printk(BIOS_INFO, "Reading resources...\n"); - read_resources(root->link_list); + read_resources(root->downstream); printk(BIOS_INFO, "Done reading resources.\n");
print_resource_tree(root, BIOS_SPEW, "After reading.");
allocate_resources(root);
- assign_resources(root->link_list); + assign_resources(root->downstream); printk(BIOS_INFO, "Done setting resources.\n"); print_resource_tree(root, BIOS_SPEW, "After assigning values.");
@@ -482,8 +482,8 @@ printk(BIOS_INFO, "Enabling resources...\n");
/* Now enable everything. */ - if (dev_root.link_list) - enable_resources(dev_root.link_list); + if (dev_root.downstream) + enable_resources(dev_root.downstream);
printk(BIOS_INFO, "done.\n"); } @@ -507,7 +507,7 @@ long init_time;
if (dev->path.type == DEVICE_PATH_I2C) { - printk(BIOS_DEBUG, "smbus: %s->", dev_path(dev->bus->dev)); + printk(BIOS_DEBUG, "smbus: %s->", dev_path(dev->upstream->dev)); }
printk(BIOS_DEBUG, "%s init\n", dev_path(dev)); @@ -533,8 +533,8 @@ }
for (dev = link->children; dev; dev = dev->sibling) - if (dev->link_list) - init_link(dev->link_list); + if (dev->downstream) + init_link(dev->downstream); }
/** @@ -551,8 +551,8 @@ init_dev(&dev_root);
/* Now initialize everything. */ - if (dev_root.link_list) - init_link(dev_root.link_list); + if (dev_root.downstream) + init_link(dev_root.downstream); post_log_clear();
printk(BIOS_INFO, "Devices initialized\n"); @@ -587,8 +587,8 @@ final_dev(dev);
for (dev = link->children; dev; dev = dev->sibling) - if (dev->link_list) - final_link(dev->link_list); + if (dev->downstream) + final_link(dev->downstream); } /** * Finalize all devices in the global device tree. @@ -604,7 +604,7 @@ final_dev(&dev_root);
/* Now finalize everything. */ - final_link(dev_root.link_list); + final_link(dev_root.downstream);
printk(BIOS_INFO, "Devices finalized\n"); } diff --git a/src/device/device_const.c b/src/device/device_const.c index a63a629..588809d 100644 --- a/src/device/device_const.c +++ b/src/device/device_const.c @@ -34,7 +34,7 @@ result = 0; for (dev = all_devices; dev; dev = dev->next) { if ((dev->path.type == DEVICE_PATH_PCI) && - (dev->bus->secondary == bus) && + (dev->upstream->secondary == bus) && (dev->path.pci.devfn == devfn)) { result = dev; break; @@ -209,7 +209,7 @@ if (nested_path_length == 1 || !child) return child;
- return find_dev_nested_path(child->link_list, nested_path + 1, nested_path_length - 1); + return find_dev_nested_path(child->downstream, nested_path + 1, nested_path_length - 1); }
DEVTREE_CONST struct device *pcidev_path_behind( @@ -233,8 +233,8 @@ dev = dev->next; continue; } - if (dev->bus->secondary == bus) - return pcidev_path_behind(dev->bus, devfn); + if (dev->upstream->secondary == bus) + return pcidev_path_behind(dev->upstream, devfn); dev = dev->next; } return NULL; @@ -252,7 +252,7 @@ if (!pci_domain) return NULL;
- pci_root = pci_domain->link_list; + pci_root = pci_domain->downstream; return pci_root; }
@@ -276,7 +276,7 @@ return NULL; }
- return pcidev_path_behind(bridge->link_list, devfn); + return pcidev_path_behind(bridge->downstream, devfn); }
DEVTREE_CONST struct device *pcidev_path_on_root_debug(pci_devfn_t devfn, const char *func) @@ -316,7 +316,7 @@ result = 0; for (dev = all_devices; dev; dev = dev->next) { if ((dev->path.type == DEVICE_PATH_I2C) && - (dev->bus->secondary == bus) && + (dev->upstream->secondary == bus) && (dev->path.i2c.device == addr)) { result = dev; break; diff --git a/src/device/device_util.c b/src/device/device_util.c index a0824bd..9c80616 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -97,7 +97,7 @@ case DEVICE_PATH_ROOT: break; case DEVICE_PATH_PCI: - ret |= dev->bus->secondary << 8 | dev->path.pci.devfn; + ret |= dev->upstream->secondary << 8 | dev->path.pci.devfn; break; case DEVICE_PATH_PNP: ret |= dev->path.pnp.port << 8 | dev->path.pnp.device; @@ -169,7 +169,7 @@ case DEVICE_PATH_PCI: snprintf(buffer, sizeof(buffer), "PCI: %02x:%02x.%01x", - dev->bus->secondary, + dev->upstream->secondary, PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn)); break; @@ -179,7 +179,7 @@ break; case DEVICE_PATH_I2C: snprintf(buffer, sizeof(buffer), "I2C: %02x:%02x", - dev->bus->secondary, + dev->upstream->secondary, dev->path.i2c.device); break; case DEVICE_PATH_APIC: @@ -515,9 +515,9 @@ end = resource_end(resource); buf[0] = '\0';
- if (dev->link_list && (resource->flags & IORESOURCE_PCI_BRIDGE)) { + if (dev->downstream && (resource->flags & IORESOURCE_PCI_BRIDGE)) { snprintf(buf, sizeof(buf), - "bus %02x ", dev->link_list->secondary); + "bus %02x ", dev->downstream->secondary); } printk(BIOS_DEBUG, "%s %02lx <- [0x%016llx - 0x%016llx] size 0x%08llx " "gran 0x%02x %s%s%s\n", dev_path(dev), resource->index, @@ -545,7 +545,7 @@
/* If it is a subtractive resource recurse. */ if (res->flags & IORESOURCE_SUBTRACTIVE) { - search_bus_resources(curdev->link_list, type_mask, type, + search_bus_resources(curdev->downstream, type_mask, type, search, gp); continue; } @@ -601,8 +601,8 @@ struct device *child;
for (child = bus->children; child; child = child->sibling) { - if (child->link_list) - disable_children(child->link_list); + if (child->downstream) + disable_children(child->downstream); dev_set_enabled(child, 0); } } @@ -618,10 +618,10 @@ if (!dev || !dev->enabled) return 0;
- if (!dev->link_list || !dev->link_list->children) + if (!dev->downstream || !dev->downstream->children) return 0;
- for (child = dev->link_list->children; child; child = child->sibling) { + for (child = dev->downstream->children; child; child = child->sibling) { if (child->path.type == DEVICE_PATH_NONE) continue; if (child->enabled) @@ -643,9 +643,9 @@ indent[i] = '\0';
printk(BIOS_DEBUG, "%s%s", indent, dev_path(root)); - if (root->link_list && root->link_list->children) + if (root->downstream && root->downstream->children) printk(BIOS_DEBUG, " child on link 0 %s", - dev_path(root->link_list->children)); + dev_path(root->downstream->children)); printk(BIOS_DEBUG, "\n");
for (res = root->resource_list; res; res = res->next) { @@ -656,10 +656,10 @@ res->index); }
- if (!root->link_list) + if (!root->downstream) return;
- for (child = root->link_list->children; child; child = child->sibling) + for (child = root->downstream->children; child; child = child->sibling) resource_tree(child, debug_level, depth + 1); }
@@ -693,10 +693,10 @@ printk(debug_level, "%s%s: enabled %d\n", depth_str, dev_path(dev), dev->enabled);
- if (!dev->link_list) + if (!dev->downstream) return;
- for (sibling = dev->link_list->children; sibling; sibling = sibling->sibling) + for (sibling = dev->downstream->children; sibling; sibling = sibling->sibling) show_devs_tree(sibling, debug_level, depth + 1); }
@@ -874,7 +874,7 @@
bool dev_path_hotplug(const struct device *dev) { - for (dev = dev->bus->dev; dev != dev->bus->dev; dev = dev->bus->dev) { + for (dev = dev->upstream->dev; dev != dev->upstream->dev; dev = dev->upstream->dev) { if (dev->hotplug_port) return true; } @@ -893,7 +893,7 @@ bool is_cpu(const struct device *cpu) { return cpu->path.type == DEVICE_PATH_APIC && - cpu->bus->dev->path.type == DEVICE_PATH_CPU_CLUSTER; + cpu->upstream->dev->path.type == DEVICE_PATH_CPU_CLUSTER; }
bool is_enabled_cpu(const struct device *cpu) @@ -913,5 +913,5 @@
bool is_pci_dev_on_bus(const struct device *pci, unsigned int bus) { - return is_pci(pci) && pci->bus->secondary == bus; + return is_pci(pci) && pci->upstream->secondary == bus; } diff --git a/src/device/i2c_bus.c b/src/device/i2c_bus.c index 361bb67..a532e4c 100644 --- a/src/device/i2c_bus.c +++ b/src/device/i2c_bus.c @@ -16,10 +16,10 @@
struct bus *i2c_link(const struct device *const dev) { - if (!dev || !dev->bus) + if (!dev || !dev->upstream) return NULL;
- struct bus *link = dev->bus; + struct bus *link = dev->upstream; while (link) { struct device *const parent = link->dev;
@@ -27,8 +27,8 @@ (parent->ops->ops_i2c_bus || parent->ops->ops_smbus_bus)) break;
- if (parent && parent->bus && link != parent->bus) - link = parent->bus; + if (parent && parent->upstream && link != parent->upstream) + link = parent->upstream; else link = NULL; } diff --git a/src/device/mdio.c b/src/device/mdio.c index 39ac40b..89da60b 100644 --- a/src/device/mdio.c +++ b/src/device/mdio.c @@ -19,7 +19,7 @@ uint16_t mdio_read(struct device *dev, uint8_t offset) { const struct mdio_bus_operations *mdio_ops; - struct device *parent = dev->bus->dev; + struct device *parent = dev->upstream->dev;
assert(dev->path.type == DEVICE_PATH_MDIO); mdio_ops = dev_get_mdio_ops(parent); @@ -30,7 +30,7 @@ void mdio_write(struct device *dev, uint8_t offset, uint16_t val) { const struct mdio_bus_operations *mdio_ops; - struct device *parent = dev->bus->dev; + struct device *parent = dev->upstream->dev;
assert(dev->path.type == DEVICE_PATH_MDIO); mdio_ops = dev_get_mdio_ops(parent); diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c index 367614d..c3adf40 100644 --- a/src/device/oprom/realmode/x86.c +++ b/src/device/oprom/realmode/x86.c @@ -415,7 +415,7 @@
void run_bios(struct device *dev, unsigned long addr) { - u32 num_dev = (dev->bus->secondary << 8) | dev->path.pci.devfn; + u32 num_dev = (dev->upstream->secondary << 8) | dev->path.pci.devfn;
/* Setting up required hardware. * Removing this will cause random illegal instruction exceptions diff --git a/src/device/oprom/realmode/x86_interrupts.c b/src/device/oprom/realmode/x86_interrupts.c index 945052b..71fc1d5 100644 --- a/src/device/oprom/realmode/x86_interrupts.c +++ b/src/device/oprom/realmode/x86_interrupts.c @@ -138,7 +138,7 @@ X86_EAX |= PCIBIOS_SUCCESSFUL; // busnum is an unsigned char; // devfn is an int, so we mask it off. - busdevfn = (dev->bus->secondary << 8) + busdevfn = (dev->upstream->secondary << 8) | (dev->path.pci.devfn & 0xff); printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn); X86_EBX = busdevfn; diff --git a/src/device/oprom/yabel/device.c b/src/device/oprom/yabel/device.c index 2c98578..d1dc801 100644 --- a/src/device/oprom/yabel/device.c +++ b/src/device/oprom/yabel/device.c @@ -65,7 +65,7 @@ { int taa_index = 0; struct resource *r; - u8 bus = bios_device.dev->bus->secondary; + u8 bus = bios_device.dev->upstream->secondary; u16 devfn = bios_device.dev->path.pci.devfn;
bios_device.bus = bus; diff --git a/src/device/oprom/yabel/interrupt.c b/src/device/oprom/yabel/interrupt.c index 968e471..e78a3cb 100644 --- a/src/device/oprom/yabel/interrupt.c +++ b/src/device/oprom/yabel/interrupt.c @@ -375,7 +375,7 @@ } else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) { dev = dev_find_device(M.x86.R_DX, M.x86.R_CX, 0); if (dev != NULL) { - M.x86.R_BH = dev->bus->secondary; + M.x86.R_BH = dev->upstream->secondary; M.x86.R_BL = dev->path.pci.devfn; DEBUG_PRINTF_INTR ("%s(): function %x: PCI Find Device --> 0x%04x\n", diff --git a/src/device/pci_device.c b/src/device/pci_device.c index dcf4ce3..0df09c7 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -585,7 +585,7 @@
void pci_domain_set_resources(struct device *dev) { - assign_resources(dev->link_list); + assign_resources(dev->downstream); }
static void host_bridge_resources(struct device *dev) @@ -617,14 +617,14 @@ struct device *alloc_pci_host_bridge(struct device *parent_dev, uint16_t secondary_bus) { struct device_path path = { .type = DEVICE_PATH_GENERIC }; - struct device *pci_host_dev = alloc_dev(parent_dev->link_list, &path); + struct device *pci_host_dev = alloc_dev(parent_dev->downstream, &path); pci_host_dev->ops = &host_bridge_ops; struct bus *pci_bus = calloc(1, sizeof(struct bus)); if (pci_bus == NULL) die("%s: out of memory.\n", __func__); pci_bus->secondary = secondary_bus; pci_bus->subordinate = secondary_bus; - pci_host_dev->link_list = pci_bus; + pci_host_dev->downstream = pci_bus;
return pci_host_dev; } @@ -759,8 +759,8 @@ for (res = dev->resource_list; res; res = res->next) pci_set_resource(dev, res);
- if (dev->link_list && dev->link_list->children) - assign_resources(dev->link_list); + if (dev->downstream && dev->downstream->children) + assign_resources(dev->downstream);
/* Set a default latency timer. */ pci_write_config8(dev, PCI_LATENCY_TIMER, 0x40); @@ -823,10 +823,10 @@ * Enable I/O in command register if there is VGA card * connected with (even it does not claim I/O resource). */ - if (dev->link_list->bridge_ctrl & PCI_BRIDGE_CTL_VGA) + if (dev->downstream->bridge_ctrl & PCI_BRIDGE_CTL_VGA) dev->command |= PCI_COMMAND_IO; ctrl = pci_read_config16(dev, PCI_BRIDGE_CONTROL); - ctrl |= dev->link_list->bridge_ctrl; + ctrl |= dev->downstream->bridge_ctrl; ctrl |= (PCI_BRIDGE_CTL_PARITY | PCI_BRIDGE_CTL_SERR); /* Error check. */ printk(BIOS_DEBUG, "%s bridge ctrl <- %04x\n", dev_path(dev), ctrl); pci_write_config16(dev, PCI_BRIDGE_CONTROL, ctrl); @@ -1025,7 +1025,7 @@ pci_write_config16(bus->dev, PCI_BRIDGE_CONTROL, bridge_ctrl);
/* If the upstream bridge doesn't support VGA16, we don't have to check */ - bus->no_vga16 |= bus->dev->bus->no_vga16; + bus->no_vga16 |= bus->dev->upstream->no_vga16; if (bus->no_vga16) return;
@@ -1250,7 +1250,7 @@ if (!dev) { struct device dummy;
- dummy.bus = bus; + dummy.upstream = bus; dummy.path.type = DEVICE_PATH_PCI; dummy.path.pci.devfn = devfn;
@@ -1352,7 +1352,7 @@ */ unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev) { - return dev->bus->secondary == PCI_DEV2SEGBUS(sdev) && + return dev->upstream->secondary == PCI_DEV2SEGBUS(sdev) && dev->path.pci.devfn == PCI_DEV2DEVFN(sdev); }
@@ -1367,14 +1367,14 @@ */ uint16_t pci_find_cap_recursive(const struct device *dev, uint16_t cap) { - assert(dev->bus); + assert(dev->upstream); uint16_t pos = pci_find_capability(dev, cap); - const struct device *bridge = dev->bus->dev; + const struct device *bridge = dev->upstream->dev; while (bridge && (bridge->path.type == DEVICE_PATH_PCI)) { - assert(bridge->bus); + assert(bridge->upstream); if (!pci_find_capability(bridge, cap)) return 0; - bridge = bridge->bus->dev; + bridge = bridge->upstream->dev; } return pos; } @@ -1579,7 +1579,7 @@ static void pci_bridge_route(struct bus *link, scan_state state) { struct device *dev = link->dev; - struct bus *parent = dev->bus; + struct bus *parent = dev->upstream; uint8_t primary, secondary, subordinate;
if (state == PCI_ROUTE_SCAN) { @@ -1657,17 +1657,17 @@
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(dev));
- if (dev->link_list == NULL) { + if (dev->downstream == NULL) { struct bus *link; link = malloc(sizeof(*link)); if (link == NULL) die("Couldn't allocate a link!\n"); memset(link, 0, sizeof(*link)); link->dev = dev; - dev->link_list = link; + dev->downstream = link; }
- bus = dev->link_list; + bus = dev->downstream;
pci_bridge_vga_compat(bus);
@@ -1702,7 +1702,7 @@ */ void pci_host_bridge_scan_bus(struct device *dev) { - struct bus *link = dev->link_list; + struct bus *link = dev->downstream; pci_scan_bus(link, PCI_DEVFN(0, 0), 0xff); }
@@ -1765,8 +1765,8 @@
/* While our current device has parent devices */ child = dev; - for (parent = child->bus->dev; parent; parent = parent->bus->dev) { - parent_bus = parent->bus->secondary; + for (parent = child->upstream->dev; parent; parent = parent->upstream->dev) { + parent_bus = parent->upstream->secondary; parent_devfn = parent->path.pci.devfn; child_devfn = child->path.pci.devfn;
@@ -1830,7 +1830,7 @@ if (!(dev->enabled && (dev->path.type == DEVICE_PATH_PCI))) return -1;
- bus = dev->bus->secondary; + bus = dev->upstream->secondary; devfn = dev->path.pci.devfn;
/* Get and validate the interrupt pin used. Only 1-4 are allowed */ diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c index 46bf114..c4c74c0 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -241,7 +241,7 @@
header->DeviceID = device->device; header->VendorID = device->vendor; - header->PCIBus = device->bus->secondary; + header->PCIBus = device->upstream->secondary; header->PCIFunction = PCI_FUNC(device->path.pci.devfn); header->PCIDevice = PCI_SLOT(device->path.pci.devfn); header->ImageLength = rom->size * 512; diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c index ab8430f..969dbb00 100644 --- a/src/device/pciexp_device.c +++ b/src/device/pciexp_device.c @@ -302,7 +302,7 @@ struct device *parent = NULL; unsigned int parent_cap = 0; if (!dev->ops->ops_pci || !dev->ops->ops_pci->get_ltr_max_latencies) { - parent = dev->bus->dev; + parent = dev->upstream->dev; if (parent->path.type != DEVICE_PATH_PCI) return; parent_cap = pci_find_capability(parent, PCI_CAP_ID_PCIE); @@ -319,9 +319,9 @@ do { if (dev->ops->ops_pci && dev->ops->ops_pci->get_ltr_max_latencies) break; - if (dev->bus->dev == dev || dev->bus->dev->path.type != DEVICE_PATH_PCI) + if (dev->upstream->dev == dev || dev->upstream->dev->path.type != DEVICE_PATH_PCI) return false; - dev = dev->bus->dev; + dev = dev->upstream->dev; } while (true);
dev->ops->ops_pci->get_ltr_max_latencies(max_snoop, max_nosnoop); @@ -627,7 +627,7 @@
static void pciexp_tune_dev(struct device *dev) { - struct device *root = dev->bus->dev; + struct device *root = dev->upstream->dev; unsigned int root_cap, cap;
cap = pci_find_capability(dev, PCI_CAP_ID_PCIE); @@ -752,7 +752,7 @@ /* Add dummy slot to preserve resources, must happen after bus scan */ struct device *dummy; struct device_path dummy_path = { .type = DEVICE_PATH_NONE }; - dummy = alloc_dev(dev->link_list, &dummy_path); + dummy = alloc_dev(dev->downstream, &dummy_path); dummy->ops = &pciexp_hotplug_dummy_ops; }
diff --git a/src/device/pcix_device.c b/src/device/pcix_device.c index 5593357f..1b00aa9 100644 --- a/src/device/pcix_device.c +++ b/src/device/pcix_device.c @@ -107,10 +107,10 @@ sstatus = pci_read_config16(dev, pos + PCI_X_SEC_STATUS);
if (PCI_X_SSTATUS_MFREQ(sstatus) != PCI_X_SSTATUS_CONVENTIONAL_PCI) - pcix_tune_bus(dev->link_list); + pcix_tune_bus(dev->downstream);
/* Print the PCI-X bus speed. */ - printk(BIOS_DEBUG, "PCI: %02x: %s\n", dev->link_list->secondary, + printk(BIOS_DEBUG, "PCI: %02x: %s\n", dev->downstream->secondary, pcix_speed(sstatus)); }
diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index dad791c..f799530 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -384,7 +384,7 @@ continue;
path.pnp.device = info[i].function; - dev = alloc_find_dev(base_dev->bus, &path); + dev = alloc_find_dev(base_dev->upstream, &path);
/* Don't initialize a device multiple times. */ if (dev->ops) diff --git a/src/device/resource_allocator_v4.c b/src/device/resource_allocator_v4.c index 96d4488..c3132f4 100644 --- a/src/device/resource_allocator_v4.c +++ b/src/device/resource_allocator_v4.c @@ -78,7 +78,7 @@
static bool dev_has_children(const struct device *dev) { - const struct bus *bus = dev->link_list; + const struct bus *bus = dev->downstream; return bus && bus->children; }
@@ -119,7 +119,7 @@ resource_t base; const unsigned long type_mask = IORESOURCE_TYPE_MASK | IORESOURCE_PREFETCH; const unsigned long type_match = bridge_res->flags & type_mask; - struct bus *bus = bridge->link_list; + struct bus *bus = bridge->downstream;
child_res = NULL;
@@ -205,7 +205,7 @@ { const struct device *child; struct resource *res; - struct bus *bus = bridge->link_list; + struct bus *bus = bridge->downstream; const unsigned long type_mask = IORESOURCE_TYPE_MASK | IORESOURCE_PREFETCH;
for (res = bridge->resource_list; res; res = res->next) { @@ -253,10 +253,10 @@ const struct device *child; const int print_depth = 1;
- if (domain->link_list == NULL) + if (domain->downstream == NULL) return;
- for (child = domain->link_list->children; child; child = child->sibling) { + for (child = domain->downstream->children; child; child = child->sibling) {
/* Skip if this is not a bridge or has no children under it. */ if (!dev_has_children(child)) @@ -296,7 +296,7 @@ memranges_create_hole(ranges, res->base, res->size); }
- bus = dev->link_list; + bus = dev->downstream; if (bus == NULL) return;
@@ -396,7 +396,7 @@
setup_resource_ranges(domain, type, &ranges);
- while ((dev = largest_resource(domain->link_list, &res, type_mask, type))) { + while ((dev = largest_resource(domain->downstream, &res, type_mask, type))) {
if (!res->size) continue; @@ -438,7 +438,7 @@ { const unsigned long type_mask = IORESOURCE_TYPE_MASK | IORESOURCE_PREFETCH | IORESOURCE_FIXED; - struct bus *const bus = bridge->link_list; + struct bus *const bus = bridge->downstream; struct resource *res; struct device *child;
@@ -493,7 +493,7 @@ allocate_toplevel_resources(domain, IORESOURCE_MEM);
struct device *child; - for (child = domain->link_list->children; child; child = child->sibling) { + for (child = domain->downstream->children; child; child = child->sibling) { if (!dev_has_children(child)) continue;
@@ -550,10 +550,10 @@ { const struct device *child;
- if ((root == NULL) || (root->link_list == NULL)) + if ((root == NULL) || (root->downstream == NULL)) return;
- for (child = root->link_list->children; child; child = child->sibling) { + for (child = root->downstream->children; child; child = child->sibling) {
if (child->path.type != DEVICE_PATH_DOMAIN) continue; diff --git a/src/device/root_device.c b/src/device/root_device.c index cf5ffb7..d2f7e62 100644 --- a/src/device/root_device.c +++ b/src/device/root_device.c @@ -39,7 +39,7 @@ { struct device *child;
- for (child = bus->link_list->children; child; child = child->sibling) + for (child = bus->downstream->children; child; child = child->sibling) enable_static_device(child); }
@@ -50,12 +50,12 @@
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
- if (bus->link_list) { - bus->link_list->secondary = ++bus_max; + if (bus->downstream) { + bus->downstream->secondary = ++bus_max;
- for (child = bus->link_list->children; child; child = child->sibling) { + for (child = bus->downstream->children; child; child = child->sibling) { enable_static_device(child); - printk(BIOS_DEBUG, "bus: %s->", dev_path(child->bus->dev)); + printk(BIOS_DEBUG, "bus: %s->", dev_path(child->upstream->dev)); } }
@@ -75,7 +75,7 @@ * given by the mainboard's `devicetree.cb`. * * First, all direct descendants of the given device are - * enabled. Then, link_list buses are scanned. + * enabled. Then, downstream buses are scanned. */ void scan_static_bus(struct device *bus) { @@ -83,8 +83,8 @@
enable_static_devices(bus);
- if (bus->link_list) - scan_bridges(bus->link_list); + if (dev_root.downstream) + scan_bridges(bus->downstream);
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus)); } diff --git a/src/drivers/i2c/ptn3460/ptn3460.c b/src/drivers/i2c/ptn3460/ptn3460.c index 7dee222..086be9a 100644 --- a/src/drivers/i2c/ptn3460/ptn3460.c +++ b/src/drivers/i2c/ptn3460/ptn3460.c @@ -172,8 +172,8 @@ return; } /* Initialize the I2C controller before it is used. */ - if (ptn_dev->bus && ptn_dev->bus->dev->ops && ptn_dev->bus->dev->ops->init) - ptn_dev->bus->dev->ops->init(ptn_dev->bus->dev); + if (ptn_dev->upstream && ptn_dev->upstream->dev->ops && ptn_dev->upstream->dev->ops->init) + ptn_dev->upstream->dev->ops->init(ptn_dev->upstream->dev); ptn3460_init(ptn_dev); }
diff --git a/src/drivers/intel/dptf/dptf.c b/src/drivers/intel/dptf/dptf.c index 71a4ec3..9228584 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -503,7 +503,7 @@ enum dptf_participant p;
/* The CPU device gets an _ADR that matches the ACPI PCI address for 00:04.00 */ - parent = dev && dev->bus ? dev->bus->dev : NULL; + parent = dev && dev->upstream ? dev->upstream->dev : NULL; if (!parent || parent->path.type != DEVICE_PATH_PCI) { printk(BIOS_ERR, "%s: DPTF objects must live under 00:04.0 PCI device\n", __func__); diff --git a/src/drivers/intel/ish/ish.c b/src/drivers/intel/ish/ish.c index d1b85f5..5f73c35 100644 --- a/src/drivers/intel/ish/ish.c +++ b/src/drivers/intel/ish/ish.c @@ -12,7 +12,7 @@ static void ish_fill_ssdt_generator(const struct device *dev) { struct drivers_intel_ish_config *config = dev->chip_info; - struct device *root = dev->bus->dev; + struct device *root = dev->upstream->dev; struct acpi_dp *dsd;
if (!config) diff --git a/src/drivers/intel/mipi_camera/camera.c b/src/drivers/intel/mipi_camera/camera.c index 00c85a7..2da98fc 100644 --- a/src/drivers/intel/mipi_camera/camera.c +++ b/src/drivers/intel/mipi_camera/camera.c @@ -199,7 +199,7 @@ static uint32_t address_for_dev_type(const struct device *dev, uint8_t dev_type) { struct drivers_intel_mipi_camera_config *config = dev->chip_info; - uint16_t i2c_bus = dev->bus ? dev->bus->secondary : 0xFFFF; + uint16_t i2c_bus = dev->upstream ? dev->upstream->secondary : 0xFFFF; uint16_t i2c_addr;
switch (dev_type) { @@ -416,7 +416,7 @@ .type = DEVICE_PATH_I2C, .i2c.device = config->vcm_address, }; - struct device *vcm_dev = find_dev_path(dev->bus, &path); + struct device *vcm_dev = find_dev_path(dev->upstream, &path); struct drivers_intel_mipi_camera_config *vcm_config; vcm_config = vcm_dev ? vcm_dev->chip_info : NULL;
@@ -927,7 +927,7 @@ const struct device *pdev;
if (config->has_power_resource) { - pdev = dev->bus->dev; + pdev = dev->upstream->dev; if (!pdev || !pdev->enabled) return;
@@ -951,7 +951,7 @@ write_i2c_camera_device(dev, scope); break; case DEVICE_PATH_GENERIC: - pdev = dev->bus->dev; + pdev = dev->upstream->dev; scope = acpi_device_scope(pdev); if (!scope) return; diff --git a/src/drivers/intel/soundwire/soundwire.c b/src/drivers/intel/soundwire/soundwire.c index c7e84a5..1028176 100644 --- a/src/drivers/intel/soundwire/soundwire.c +++ b/src/drivers/intel/soundwire/soundwire.c @@ -21,7 +21,7 @@ { struct device *child;
- for (child = dev->link_list->children; child; child = child->sibling) { + for (child = dev->downstream->children; child; child = child->sibling) { if (child->enabled && child->path.type == DEVICE_PATH_GENERIC && child->path.generic.id == link) return true; diff --git a/src/drivers/net/phy/m88e1512/m88e1512.c b/src/drivers/net/phy/m88e1512/m88e1512.c index 2e8994c..5c6ed9a 100644 --- a/src/drivers/net/phy/m88e1512/m88e1512.c +++ b/src/drivers/net/phy/m88e1512/m88e1512.c @@ -21,10 +21,10 @@ if (config->downshift_cnt) { if (config->downshift_cnt > DOWNSHIFT_CNT_MAX) { printk(BIOS_INFO, "%s: Downshift counter for %s is too large.\n", - dev_path(dev->bus->dev), dev->chip_ops->name); + dev_path(dev->upstream->dev), dev->chip_ops->name); } else { printk(BIOS_DEBUG, "%s: Enable downshift after %d attempts for %s.\n", - dev_path(dev->bus->dev), config->downshift_cnt, + dev_path(dev->upstream->dev), config->downshift_cnt, dev->chip_ops->name);
reg = mdio_read(dev, COPPER_SPEC_CTRL_REG_1); @@ -42,7 +42,7 @@ /* Configure LEDs if requested. */ if (config->configure_leds) { printk(BIOS_DEBUG, "%s: Set a customized LED mode for %s.\n", - dev_path(dev->bus->dev), dev->chip_ops->name); + dev_path(dev->upstream->dev), dev->chip_ops->name);
/* Select page 3 to access LED function control register. */ switch_page(dev, 3); @@ -57,7 +57,7 @@ /* INTn can be routed to LED[2] pin. */ if (config->enable_int) { printk(BIOS_DEBUG, "%s: INTn is routed to LED[2] pin %s.\n", - dev_path(dev->bus->dev), dev->chip_ops->name); + dev_path(dev->upstream->dev), dev->chip_ops->name);
/* Select page 3 to access LED function control register. */ switch_page(dev, 3); @@ -70,7 +70,7 @@ /* Set RGMII output impedance manually. */ if (config->force_mos) { printk(BIOS_DEBUG, "%s: Set RGMII driver strength manually for %s.\n", - dev_path(dev->bus->dev), dev->chip_ops->name); + dev_path(dev->upstream->dev), dev->chip_ops->name);
/* Select page 2 to access RGMII output impedance calibration override register. */ diff --git a/src/drivers/net/r8168.c b/src/drivers/net/r8168.c index f21edd0..27296a7 100644 --- a/src/drivers/net/r8168.c +++ b/src/drivers/net/r8168.c @@ -364,7 +364,7 @@ static void r8168_net_fill_ssdt(const struct device *dev) { struct drivers_net_config *config = dev->chip_info; - const char *path = acpi_device_path(dev->bus->dev); + const char *path = acpi_device_path(dev->upstream->dev); u32 address;
if (!path || !config) diff --git a/src/drivers/nxp/uwb/uwb.c b/src/drivers/nxp/uwb/uwb.c index 978edeb..dc9da5b 100644 --- a/src/drivers/nxp/uwb/uwb.c +++ b/src/drivers/nxp/uwb/uwb.c @@ -15,10 +15,10 @@ struct device *spi_dev; struct device_operations *ops;
- if (!dev->bus || !dev->bus->dev) + if (!dev->upstream || !dev->bus->dev) return -1;
- spi_dev = dev->bus->dev; + spi_dev = dev->upstream->dev; ops = spi_dev->ops;
if (ops && ops->ops_spi_bus && ops->ops_spi_bus->dev_to_bus) diff --git a/src/drivers/pcie/generic/generic.c b/src/drivers/pcie/generic/generic.c index 1873e65..daa2959 100644 --- a/src/drivers/pcie/generic/generic.c +++ b/src/drivers/pcie/generic/generic.c @@ -27,13 +27,13 @@ pci_rom_ssdt(dev);
config = dev->chip_info; - if (!config || !dev->bus || !dev->bus->dev) + if (!config || !dev->upstream || !dev->upstream->dev) return;
const char *scope; const char *name;
- scope = acpi_device_path(dev->bus->dev); + scope = acpi_device_path(dev->upstream->dev); name = acpi_device_name(dev);
acpigen_write_scope(scope); diff --git a/src/drivers/spi/acpi/acpi.c b/src/drivers/spi/acpi/acpi.c index 9b6fd80..f39893b 100644 --- a/src/drivers/spi/acpi/acpi.c +++ b/src/drivers/spi/acpi/acpi.c @@ -15,10 +15,10 @@ struct device *spi_dev; struct device_operations *ops;
- if (!dev->bus || !dev->bus->dev) + if (!dev->upstream || !dev->upstream->dev) return -1;
- spi_dev = dev->bus->dev; + spi_dev = dev->upstream->dev; ops = spi_dev->ops;
if (ops && ops->ops_spi_bus && diff --git a/src/drivers/usb/hub/acpi.c b/src/drivers/usb/hub/acpi.c index 10e38fb6..2f3e249 100644 --- a/src/drivers/usb/hub/acpi.c +++ b/src/drivers/usb/hub/acpi.c @@ -41,7 +41,7 @@ struct device *port = NULL; unsigned int child_count = 0;
- while ((port = dev_bus_each_child(dev->link_list, port)) != NULL) { + while ((port = dev_bus_each_child(dev->downstream, port)) != NULL) { if (child_count++ >= config->port_count) { printk(BIOS_WARNING, "%s cannot be added. Port Count limit reached.\n", dev_name(port)); diff --git a/src/drivers/usb/pci_xhci/pci_xhci.c b/src/drivers/usb/pci_xhci/pci_xhci.c index 6d022d1..8e9d566 100644 --- a/src/drivers/usb/pci_xhci/pci_xhci.c +++ b/src/drivers/usb/pci_xhci/pci_xhci.c @@ -76,7 +76,7 @@ if (dev->path.type == DEVICE_PATH_ROOT) return NULL;
- dev = dev->bus->dev; + dev = dev->upstream->dev; }
return dev; diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index 3996739..6bd53d6 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -610,7 +610,7 @@ if (!dev) return;
- path = acpi_device_path(dev->bus->dev); + path = acpi_device_path(dev->upstream->dev); if (!path) return;
diff --git a/src/drivers/wifi/generic/smbios.c b/src/drivers/wifi/generic/smbios.c index 82c96a5..e6ccd5d 100644 --- a/src/drivers/wifi/generic/smbios.c +++ b/src/drivers/wifi/generic/smbios.c @@ -38,5 +38,5 @@
int smbios_write_wifi_cnvi(struct device *dev, int *handle, unsigned long *current) { - return smbios_write_wifi_pcie(dev->bus->dev, handle, current); + return smbios_write_wifi_pcie(dev->upstream->dev, handle, current); } diff --git a/src/drivers/wwan/fm/acpi_fm350gl.c b/src/drivers/wwan/fm/acpi_fm350gl.c index 139fd15..8d79517 100644 --- a/src/drivers/wwan/fm/acpi_fm350gl.c +++ b/src/drivers/wwan/fm/acpi_fm350gl.c @@ -266,7 +266,7 @@ static void wwan_fm350gl_acpi_fill_ssdt(const struct device *dev) { const struct drivers_wwan_fm_config *config = config_of(dev); - const struct device *parent = dev->bus->dev; + const struct device *parent = dev->upstream->dev; const char *scope = acpi_device_path(parent); const struct soc_intel_common_block_pcie_rtd3_config *rtd3_config;
diff --git a/src/ec/google/chromeec/ec_acpi.c b/src/ec/google/chromeec/ec_acpi.c index 3367cfa..cf29636 100644 --- a/src/ec/google/chromeec/ec_acpi.c +++ b/src/ec/google/chromeec/ec_acpi.c @@ -273,7 +273,7 @@ path.type = DEVICE_PATH_GENERIC; path.generic.id = 0; path.generic.subid = 0; - ec = alloc_find_dev(dev->bus, &path); + ec = alloc_find_dev(dev->upstream, &path); ec->ops = &ec_ops;
if (CONFIG(DRIVERS_INTEL_DPTF)) diff --git a/src/include/device/device.h b/src/include/device/device.h index a55ca82..6f1d13e 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -98,8 +98,8 @@ */
struct device { - DEVTREE_CONST struct bus *bus; /* bus this device is on, for bridge - * devices, it is the up stream bus */ + DEVTREE_CONST struct bus *upstream; + DEVTREE_CONST struct bus *downstream;
DEVTREE_CONST struct device *sibling; /* next device on this bus */
@@ -127,11 +127,6 @@ /* Base registers for this device. I/O, MEM and Expansion ROM */ DEVTREE_CONST struct resource *resource_list;
- /* links are (downstream) buses attached to the device, usually a leaf - * device with no children has 0 buses attached and a bridge has 1 bus - */ - DEVTREE_CONST struct bus *link_list; - #if !DEVTREE_EARLY struct device_operations *ops; struct chip_operations *chip_ops; @@ -228,14 +223,14 @@ static inline void mp_cpu_bus_init(struct device *dev) { /* Make sure the cpu cluster has a downstream bus for LAPICs to be allocated. */ - if (!dev->link_list) { + if (!dev->downstream) { struct bus *bus = calloc(1, sizeof(struct bus)); if (!bus) die("Couldn't allocate downstream bus!\n"); - dev->link_list = bus; + dev->downstream = bus; }
- mp_init_cpus(dev->link_list); + mp_init_cpus(dev->downstream); }
/* Debug functions */ diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index b5d4e23..a70b3af 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -12,7 +12,7 @@
static __always_inline pci_devfn_t pcidev_bdf(const struct device *dev) { - return (dev->path.pci.devfn << 12) | (dev->bus->secondary << 20); + return (dev->path.pci.devfn << 12) | (dev->upstream->secondary << 20); }
static __always_inline pci_devfn_t pcidev_assert(const struct device *dev) diff --git a/src/lib/smbios.c b/src/lib/smbios.c index deee193b..6121679 100644 --- a/src/lib/smbios.c +++ b/src/lib/smbios.c @@ -1114,7 +1114,7 @@ name, // name instance_id, // inst 0, // segment - dev->bus->secondary, //bus + dev->upstream->secondary, //bus PCI_SLOT(dev->path.pci.devfn), // device PCI_FUNC(dev->path.pci.devfn), // func device_type); @@ -1166,7 +1166,7 @@ 0, 1, 0, - dev->bus->secondary, + dev->upstream->secondary, dev->path.pci.devfn); }
diff --git a/src/mainboard/aopen/dxplplusu/acpi_tables.c b/src/mainboard/aopen/dxplplusu/acpi_tables.c index e22b454..114068f 100644 --- a/src/mainboard/aopen/dxplplusu/acpi_tables.c +++ b/src/mainboard/aopen/dxplplusu/acpi_tables.c @@ -11,7 +11,7 @@ bdev = pcidev_on_root(2, 0); /* P64H2 Bus B IOAPIC */ if (bdev) - dev = pcidev_path_behind(bdev->link_list, PCI_DEVFN(28, 0)); + dev = pcidev_path_behind(bdev->downstream, PCI_DEVFN(28, 0)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, res->base); @@ -19,7 +19,7 @@
/* P64H2 Bus A IOAPIC */ if (bdev) - dev = pcidev_path_behind(bdev->link_list, PCI_DEVFN(30, 0)); + dev = pcidev_path_behind(bdev->downstream, PCI_DEVFN(30, 0)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, res->base); diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c index 5fe12e7..75268bd 100644 --- a/src/mainboard/emulation/qemu-i440fx/northbridge.c +++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c @@ -39,7 +39,7 @@
static void cpu_pci_domain_set_resources(struct device *dev) { - assign_resources(dev->link_list); + assign_resources(dev->downstream); }
static void cpu_pci_domain_read_resources(struct device *dev) diff --git a/src/mainboard/google/brya/mainboard.c b/src/mainboard/google/brya/mainboard.c index aa332cd..9cf56b2 100644 --- a/src/mainboard/google/brya/mainboard.c +++ b/src/mainboard/google/brya/mainboard.c @@ -106,7 +106,7 @@ static void mainboard_generate_wwan_shutdown(const struct device *dev) { const struct drivers_wwan_fm_config *config = config_of(dev); - const struct device *parent = dev->bus->dev; + const struct device *parent = dev->upstream->dev;
if (!config) return; @@ -126,7 +126,7 @@ static void mainboard_generate_dgpu_shutdown(const struct device *dev) { /* Call `_OFF` from the Power Resource associated with the dGPU's PEG port. */ - const struct device *parent = dev->bus->dev; + const struct device *parent = dev->upstream->dev;
if (parent) acpigen_emit_namestring(acpi_device_path_join(parent, "PGPR._OFF")); diff --git a/src/mainboard/google/kahlee/variants/careena/mainboard.c b/src/mainboard/google/kahlee/variants/careena/mainboard.c index 937a411..c54b530 100644 --- a/src/mainboard/google/kahlee/variants/careena/mainboard.c +++ b/src/mainboard/google/kahlee/variants/careena/mainboard.c @@ -26,7 +26,7 @@ if (mmio_dev == NULL) return;
- while ((child = dev_bus_each_child(mmio_dev->link_list, child)) != NULL) { + while ((child = dev_bus_each_child(mmio_dev->downstream, child)) != NULL) { if (child->path.type != DEVICE_PATH_I2C) continue; if (child->path.i2c.device != 0x1a) diff --git a/src/mainboard/google/kahlee/variants/treeya/audio.c b/src/mainboard/google/kahlee/variants/treeya/audio.c index ac7f7a2..e7a20ea 100644 --- a/src/mainboard/google/kahlee/variants/treeya/audio.c +++ b/src/mainboard/google/kahlee/variants/treeya/audio.c @@ -25,7 +25,7 @@ } } while (mmio_dev->path.mmio.addr != APU_I2C0_BASE);
- while ((child = dev_bus_each_child(mmio_dev->link_list, child)) != NULL) { + while ((child = dev_bus_each_child(mmio_dev->downstream, child)) != NULL) { if (child->path.type != DEVICE_PATH_I2C) continue; if (child->path.i2c.device != RT58_I2C_ADDRESS) diff --git a/src/mainboard/google/octopus/mainboard.c b/src/mainboard/google/octopus/mainboard.c index 92b1074..3392a3c 100644 --- a/src/mainboard/google/octopus/mainboard.c +++ b/src/mainboard/google/octopus/mainboard.c @@ -179,7 +179,7 @@ { struct device *audio_dev = NULL; struct bus *audio_i2c_bus = - pcidev_path_on_root(PCH_DEVFN_I2C5)->link_list; + pcidev_path_on_root(PCH_DEVFN_I2C5)->downstream; enum ssfc_audio_codec codec = ssfc_get_audio_codec();
while ((audio_dev = dev_bus_each_child(audio_i2c_bus, audio_dev))) { diff --git a/src/mainboard/google/rex/mainboard.c b/src/mainboard/google/rex/mainboard.c index 619ca71..24356f3 100644 --- a/src/mainboard/google/rex/mainboard.c +++ b/src/mainboard/google/rex/mainboard.c @@ -82,7 +82,7 @@ static void mainboard_generate_wwan_shutdown(const struct device *dev) { const struct drivers_wwan_fm_config *config = config_of(dev); - const struct device *parent = dev->bus->dev; + const struct device *parent = dev->upstream->dev;
if (!config) return; diff --git a/src/mainboard/google/zork/variants/baseboard/ramstage_common.c b/src/mainboard/google/zork/variants/baseboard/ramstage_common.c index 3c203f5..a544548 100644 --- a/src/mainboard/google/zork/variants/baseboard/ramstage_common.c +++ b/src/mainboard/google/zork/variants/baseboard/ramstage_common.c @@ -115,7 +115,7 @@ if (variant_uses_v3_6_schematics()) return;
- while ((child = dev_bus_each_child(mmio_dev->link_list, child)) != NULL) { + while ((child = dev_bus_each_child(mmio_dev->downstream, child)) != NULL) { struct drivers_i2c_generic_config *cfg;
if (child->chip_ops == &drivers_i2c_generic_ops) { diff --git a/src/mainboard/ibase/mb899/mptable.c b/src/mainboard/ibase/mb899/mptable.c index 4ec578a..a9ad7c7 100644 --- a/src/mainboard/ibase/mb899/mptable.c +++ b/src/mainboard/ibase/mb899/mptable.c @@ -19,7 +19,7 @@
firewire = dev_find_device(0x104c, 0x8023, 0); if (firewire) { - firewire_bus = firewire->bus->secondary; + firewire_bus = firewire->upstream->secondary; printk(BIOS_SPEW, "Firewire device is on bus %x\n", firewire_bus); } @@ -30,7 +30,7 @@ if (!riser) riser = dev_find_device(0x3388, 0x0022, 0); if (riser) { - riser_bus = riser->link_list->secondary; + riser_bus = riser->downstream->secondary; printk(BIOS_SPEW, "Riser bus is %x\n", riser_bus); }
diff --git a/src/mainboard/kontron/986lcd-m/mptable.c b/src/mainboard/kontron/986lcd-m/mptable.c index 605b8d7..b0bfbe7 100644 --- a/src/mainboard/kontron/986lcd-m/mptable.c +++ b/src/mainboard/kontron/986lcd-m/mptable.c @@ -18,7 +18,7 @@
firewire = dev_find_device(0x104c, 0x8023, 0); if (firewire) { - firewire_bus = firewire->bus->secondary; + firewire_bus = firewire->upstream->secondary; }
/* If a riser card is used, this riser is detected on bus 4, so its secondary bus is the */ @@ -27,7 +27,7 @@ if (!riser) riser = dev_find_device(0x3388, 0x0022, 0); if (riser) { - riser_bus = riser->link_list->secondary; + riser_bus = riser->downstream->secondary; }
mptable_write_buses(mc, NULL, &isa_bus); diff --git a/src/mainboard/pcengines/apu2/mainboard.c b/src/mainboard/pcengines/apu2/mainboard.c index ab9156f..38e052c 100644 --- a/src/mainboard/pcengines/apu2/mainboard.c +++ b/src/mainboard/pcengines/apu2/mainboard.c @@ -275,7 +275,7 @@
dev = pcidev_on_root(2, 2); if (dev) - dev = pcidev_path_behind(dev->link_list, PCI_DEVFN(0, 0)); + dev = pcidev_path_behind(dev->downstream, PCI_DEVFN(0, 0)); if (!dev) return serial;
diff --git a/src/mainboard/roda/rk9/ti_pci7xx1.c b/src/mainboard/roda/rk9/ti_pci7xx1.c index a980f5c..7c5a808 100644 --- a/src/mainboard/roda/rk9/ti_pci7xx1.c +++ b/src/mainboard/roda/rk9/ti_pci7xx1.c @@ -19,7 +19,7 @@ u16 gcr = pci_read_config16(dev, 0x86); for (fn = 5; fn > 0; --fn) { const struct device *const d = - pcidev_path_behind(dev->bus, PCI_DEVFN(slot, fn)); + pcidev_path_behind(dev->upstream, PCI_DEVFN(slot, fn)); if (!d || d->enabled) continue; printk(BIOS_DEBUG, "%s: Hiding function #%d.\n", __func__, fn); diff --git a/src/mainboard/siemens/mc_apl1/mainboard.c b/src/mainboard/siemens/mc_apl1/mainboard.c index 0593797..51427be 100644 --- a/src/mainboard/siemens/mc_apl1/mainboard.c +++ b/src/mainboard/siemens/mc_apl1/mainboard.c @@ -55,7 +55,7 @@ */ enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[MAC_ADDR_LEN]) { - struct bus *parent = dev->bus; + struct bus *parent = dev->upstream; uint8_t buf[16], mapping[16], i = 0, chain_len = 0;
memset(buf, 0, sizeof(buf)); @@ -64,10 +64,10 @@ /* The first entry in the tree is the device itself. */ buf[0] = dev->path.pci.devfn; chain_len = 1; - for (i = 1; i < MAX_PATH_DEPTH && parent->dev->bus->subordinate; i++) { + for (i = 1; i < MAX_PATH_DEPTH && parent->dev->upstream->subordinate; i++) { buf[i] = parent->dev->path.pci.devfn; chain_len++; - parent = parent->dev->bus; + parent = parent->dev->upstream; } if (i == MAX_PATH_DEPTH) { /* The path is deeper than MAX_PATH_DEPTH devices, error. */ diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl3/mainboard.c b/src/mainboard/siemens/mc_apl1/variants/mc_apl3/mainboard.c index b61f32d..c6beff6 100644 --- a/src/mainboard/siemens/mc_apl1/variants/mc_apl3/mainboard.c +++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl3/mainboard.c @@ -41,7 +41,7 @@
/* Disable clock outputs 0 and 2-4 (CLKOUT) for upstream XIO2001 PCIe to PCI Bridge. */ - struct device *parent = dev->bus->dev; + struct device *parent = dev->upstream->dev; if (parent && parent->device == PCI_DID_TI_XIO2001) pci_write_config8(parent, 0xd8, 0x1d); } @@ -50,7 +50,7 @@ mainboard. */ dev = dev_find_device(PCI_VID_SIEMENS, 0x403f, 0); if (dev) { - struct device *parent = dev->bus->dev; + struct device *parent = dev->upstream->dev; if (parent && parent->device == PCI_DID_TI_XIO2001) pci_write_config8(parent, 0xd8, 0x3c); } diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/mainboard.c b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/mainboard.c index 8eedce6..eda4b1b 100644 --- a/src/mainboard/siemens/mc_apl1/variants/mc_apl5/mainboard.c +++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl5/mainboard.c @@ -51,7 +51,7 @@
/* Disable clock outputs 0-3 (CLKOUT) for upstream XIO2001 PCIe to PCI Bridge. */ - struct device *parent = dev->bus->dev; + struct device *parent = dev->upstream->dev; if (parent && parent->device == PCI_DID_TI_XIO2001) pci_write_config8(parent, 0xd8, 0x0f); } @@ -60,7 +60,7 @@ mainboard. */ dev = dev_find_device(PCI_VID_SIEMENS, 0x403f, 0); if (dev) { - struct device *parent = dev->bus->dev; + struct device *parent = dev->upstream->dev; if (parent && parent->device == PCI_DID_TI_XIO2001) pci_write_config8(parent, 0xd8, 0x3e); } diff --git a/src/mainboard/siemens/mc_apl1/variants/mc_apl6/mainboard.c b/src/mainboard/siemens/mc_apl1/variants/mc_apl6/mainboard.c index 1856a35..a5fe3d7 100644 --- a/src/mainboard/siemens/mc_apl1/variants/mc_apl6/mainboard.c +++ b/src/mainboard/siemens/mc_apl1/variants/mc_apl6/mainboard.c @@ -41,7 +41,7 @@
/* Disable clock outputs 0-3 (CLKOUT) for upstream XIO2001 PCIe to PCI Bridge. */ - struct device *parent = dev->bus->dev; + struct device *parent = dev->upstream->dev; if (parent && parent->device == PCI_DID_TI_XIO2001) pci_write_config8(parent, 0xd8, 0x0F); } @@ -50,7 +50,7 @@ mainboard. */ dev = dev_find_device(PCI_VID_SIEMENS, 0x403f, 0); if (dev) { - struct device *parent = dev->bus->dev; + struct device *parent = dev->upstream->dev; if (parent && parent->device == PCI_DID_TI_XIO2001) pci_write_config8(parent, 0xd8, 0x3c); } diff --git a/src/mainboard/siemens/mc_ehl/mainboard.c b/src/mainboard/siemens/mc_ehl/mainboard.c index 7aa0d86..ac16346 100644 --- a/src/mainboard/siemens/mc_ehl/mainboard.c +++ b/src/mainboard/siemens/mc_ehl/mainboard.c @@ -42,7 +42,7 @@ */ enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[MAC_ADDR_LEN]) { - struct bus *parent = dev->bus; + struct bus *parent = dev->upstream; uint8_t buf[16], mapping[16], i = 0, chain_len = 0;
memset(buf, 0, sizeof(buf)); @@ -51,10 +51,10 @@ /* The first entry in the tree is the device itself. */ buf[0] = dev->path.pci.devfn; chain_len = 1; - for (i = 1; i < MAX_PATH_DEPTH && parent->dev->bus->subordinate; i++) { + for (i = 1; i < MAX_PATH_DEPTH && parent->dev->upstream->subordinate; i++) { buf[i] = parent->dev->path.pci.devfn; chain_len++; - parent = parent->dev->bus; + parent = parent->dev->upstream; } if (i == MAX_PATH_DEPTH) { /* The path is deeper than MAX_PATH_DEPTH devices, error. */ diff --git a/src/northbridge/amd/pi/00730F01/northbridge.c b/src/northbridge/amd/pi/00730F01/northbridge.c index f471a00..b35fca9 100644 --- a/src/northbridge/amd/pi/00730F01/northbridge.c +++ b/src/northbridge/amd/pi/00730F01/northbridge.c @@ -177,10 +177,9 @@
sblink = (pci_read_config32(get_mc_dev(), 0x64) >> 8) & 7; // don't forget sublink1
- if (!dev->link_list) + if (!dev->downstream) return; - - if (!(dev->link_list->bridge_ctrl & PCI_BRIDGE_CTL_VGA)) + if (!(dev->downstream->bridge_ctrl & PCI_BRIDGE_CTL_VGA)) return;
printk(BIOS_DEBUG, "VGA: %s (aka node %d) link %d has VGA device\n", dev_path(dev), nodeid, sblink); @@ -299,7 +298,7 @@ ivrs_ivhd_generic_t *ivhd_entry = (ivrs_ivhd_generic_t *)*current;
ivhd_entry->type = type; - ivhd_entry->dev_id = dev->path.pci.devfn | (dev->bus->secondary << 8); + ivhd_entry->dev_id = dev->path.pci.devfn | (dev->upstream->secondary << 8); ivhd_entry->dte_setting = data; *current += sizeof(ivrs_ivhd_generic_t); } else if (type == IVHD_DEV_8_BYTE_ALIAS_SELECT) { @@ -308,12 +307,12 @@ ivrs_ivhd_alias_t *ivhd_entry = (ivrs_ivhd_alias_t *)*current;
ivhd_entry->type = type; - ivhd_entry->dev_id = dev->path.pci.devfn | (dev->bus->secondary << 8); + ivhd_entry->dev_id = dev->path.pci.devfn | (dev->upstream->secondary << 8); ivhd_entry->dte_setting = data; ivhd_entry->reserved1 = 0; ivhd_entry->reserved2 = 0; ivhd_entry->source_dev_id = parent->path.pci.devfn | - (parent->bus->secondary << 8); + (parent->upstream->secondary << 8); *current += sizeof(ivrs_ivhd_alias_t); }
@@ -356,7 +355,7 @@
if (dev->path.type == DEVICE_PATH_PCI) {
- if ((dev->bus->secondary == 0x0) && + if ((dev->upstream->secondary == 0x0) && (dev->path.pci.devfn == 0x0)) *root_level = depth;
@@ -366,8 +365,8 @@ } }
- if (dev->link_list) { - for (sibling = dev->link_list->children; sibling; sibling = sibling->sibling) + if (dev->downstream) { + for (sibling = dev->downstream->children; sibling; sibling = sibling->sibling) add_ivhd_device_entries(dev, sibling, depth + 1, depth, root_level, current, ivhd_length); } @@ -403,7 +402,7 @@ ivhd_11->flags = ivrs_agesa->ivhd.flags & 0x3f; ivhd_11->length = sizeof(struct acpi_ivrs_ivhd_11); /* BDF <bus>:00.2 */ - ivhd_11->device_id = 0x02 | (nb_dev->bus->secondary << 8); + ivhd_11->device_id = 0x02 | (nb_dev->upstream->secondary << 8); /* PCI Capability block 0x40 (type 0xf, "Secure device") */ ivhd_11->capability_offset = 0x40; ivhd_11->iommu_base_low = ivrs_agesa->ivhd.iommu_base_low; @@ -471,7 +470,7 @@ ivrs->ivhd.flags = ivrs_agesa->ivhd.flags; ivrs->ivhd.length = sizeof(struct acpi_ivrs_ivhd); /* BDF <bus>:00.2 */ - ivrs->ivhd.device_id = 0x02 | (nb_dev->bus->secondary << 8); + ivrs->ivhd.device_id = 0x02 | (nb_dev->upstream->secondary << 8); /* PCI Capability block 0x40 (type 0xf, "Secure device") */ ivrs->ivhd.capability_offset = 0x40; ivrs->ivhd.iommu_base_low = ivrs_agesa->ivhd.iommu_base_low; diff --git a/src/northbridge/intel/e7505/northbridge.c b/src/northbridge/intel/e7505/northbridge.c index 65a0212..e2bb24c 100644 --- a/src/northbridge/intel/e7505/northbridge.c +++ b/src/northbridge/intel/e7505/northbridge.c @@ -52,7 +52,7 @@
static void mch_domain_set_resources(struct device *dev) { - assign_resources(dev->link_list); + assign_resources(dev->downstream); }
struct device_operations e7505_pci_domain_ops = { diff --git a/src/northbridge/intel/gm45/northbridge.c b/src/northbridge/intel/gm45/northbridge.c index 4bddf20..c888546 100644 --- a/src/northbridge/intel/gm45/northbridge.c +++ b/src/northbridge/intel/gm45/northbridge.c @@ -122,7 +122,7 @@ report_resource_stored(dev, resource, ""); }
- assign_resources(dev->link_list); + assign_resources(dev->downstream); }
static void mch_domain_init(struct device *dev) diff --git a/src/northbridge/intel/haswell/pcie.c b/src/northbridge/intel/haswell/pcie.c index 7fe57e9..4eeaa3f 100644 --- a/src/northbridge/intel/haswell/pcie.c +++ b/src/northbridge/intel/haswell/pcie.c @@ -20,8 +20,8 @@ if (dev->path.type != DEVICE_PATH_PCI) return NULL;
- assert(dev->bus); - if (dev->bus->secondary == 0) + assert(dev->upstream); + if (dev->upstream->secondary == 0) switch (dev->path.pci.devfn) { case PCI_DEVFN(1, 0): return "PEGP"; @@ -31,12 +31,12 @@ return "PEG2"; };
- struct device *const port = dev->bus->dev; + struct device *const port = dev->upstream->dev; assert(port); - assert(port->bus); + assert(port->upstream);
if (dev->path.pci.devfn == PCI_DEVFN(0, 0) && - port->bus->secondary == 0 && + port->upstream->secondary == 0 && (port->path.pci.devfn == PCI_DEVFN(1, 0) || port->path.pci.devfn == PCI_DEVFN(1, 1) || port->path.pci.devfn == PCI_DEVFN(1, 2))) diff --git a/src/northbridge/intel/i440bx/northbridge.c b/src/northbridge/intel/i440bx/northbridge.c index 0670f72..cd0a570 100644 --- a/src/northbridge/intel/i440bx/northbridge.c +++ b/src/northbridge/intel/i440bx/northbridge.c @@ -34,8 +34,8 @@
pci_domain_read_resources(dev);
- pci_tolm = find_pci_tolm(dev->link_list); - mc_dev = dev->link_list->children; + pci_tolm = find_pci_tolm(dev->downstream); + mc_dev = dev->downstream->children; if (mc_dev) { unsigned long tomk, tolmk; int idx; diff --git a/src/northbridge/intel/i945/northbridge.c b/src/northbridge/intel/i945/northbridge.c index 1dfcc40..da0e4dd 100644 --- a/src/northbridge/intel/i945/northbridge.c +++ b/src/northbridge/intel/i945/northbridge.c @@ -26,7 +26,7 @@ /* Can we find out how much memory we can use at most * this way? */ - pci_tolm = find_pci_tolm(dev->link_list); + pci_tolm = find_pci_tolm(dev->downstream); printk(BIOS_DEBUG, "pci_tolm: 0x%x\n", pci_tolm);
tolud = pci_read_config8(d0f0, TOLUD) << 24; @@ -65,7 +65,7 @@ for (res = dev->resource_list; res; res = res->next) report_resource_stored(dev, res, "");
- assign_resources(dev->link_list); + assign_resources(dev->downstream); }
static const char *northbridge_acpi_name(const struct device *dev) diff --git a/src/northbridge/intel/pineview/northbridge.c b/src/northbridge/intel/pineview/northbridge.c index a23a0d5..dc7dd3d 100644 --- a/src/northbridge/intel/pineview/northbridge.c +++ b/src/northbridge/intel/pineview/northbridge.c @@ -108,7 +108,7 @@ for (res = dev->resource_list; res; res = res->next) report_resource_stored(dev, res, "");
- assign_resources(dev->link_list); + assign_resources(dev->downstream); }
static void mch_domain_init(struct device *dev) diff --git a/src/northbridge/intel/sandybridge/pcie.c b/src/northbridge/intel/sandybridge/pcie.c index ec737a2..94c3717 100644 --- a/src/northbridge/intel/sandybridge/pcie.c +++ b/src/northbridge/intel/sandybridge/pcie.c @@ -14,8 +14,8 @@ if (dev->path.type != DEVICE_PATH_PCI) return NULL;
- assert(dev->bus); - if (dev->bus->secondary == 0) + assert(dev->upstream); + if (dev->upstream->secondary == 0) switch (dev->path.pci.devfn) { case PCI_DEVFN(1, 0): return "PEGP"; @@ -27,12 +27,12 @@ return "PEG6"; };
- struct device *const port = dev->bus->dev; + struct device *const port = dev->upstream->dev; assert(port); - assert(port->bus); + assert(port->upstream);
if (dev->path.pci.devfn == PCI_DEVFN(0, 0) && - port->bus->secondary == 0 && + port->upstream->secondary == 0 && (port->path.pci.devfn == PCI_DEVFN(1, 0) || port->path.pci.devfn == PCI_DEVFN(1, 1) || port->path.pci.devfn == PCI_DEVFN(1, 2) || diff --git a/src/northbridge/intel/x4x/northbridge.c b/src/northbridge/intel/x4x/northbridge.c index 12a7a40..1f8b6c0 100644 --- a/src/northbridge/intel/x4x/northbridge.c +++ b/src/northbridge/intel/x4x/northbridge.c @@ -72,7 +72,7 @@ for (res = dev->resource_list; res; res = res->next) report_resource_stored(dev, res, "");
- assign_resources(dev->link_list); + assign_resources(dev->downstream); }
static void mch_domain_init(struct device *dev) diff --git a/src/soc/amd/cezanne/xhci.c b/src/soc/amd/cezanne/xhci.c index b0205c6..fc1c119 100644 --- a/src/soc/amd/cezanne/xhci.c +++ b/src/soc/amd/cezanne/xhci.c @@ -26,10 +26,10 @@
enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) { - if (dev->bus->dev->path.type != DEVICE_PATH_PCI) + if (dev->upstream->dev->path.type != DEVICE_PATH_PCI) return CB_ERR_ARG;
- if (dev->bus->dev->path.pci.devfn != PCIE_ABC_A_DEVFN) + if (dev->upstream->dev->path.pci.devfn != PCIE_ABC_A_DEVFN) return CB_ERR_ARG;
if (dev->path.type != DEVICE_PATH_PCI) diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c index 03e1fae..aaebedc 100644 --- a/src/soc/amd/common/block/acpi/ivrs.c +++ b/src/soc/amd/common/block/acpi/ivrs.c @@ -98,7 +98,7 @@ memset(ivhd_entry, 0, sizeof(*ivhd_entry));
ivhd_entry->type = type; - ivhd_entry->dev_id = dev->path.pci.devfn | (dev->bus->secondary << 8); + ivhd_entry->dev_id = dev->path.pci.devfn | (dev->upstream->secondary << 8); ivhd_entry->dte_setting = data; *current += sizeof(ivrs_ivhd_generic_t); } else if (type == IVHD_DEV_8_BYTE_ALIAS_SELECT) { @@ -106,12 +106,12 @@ memset(ivhd_entry, 0, sizeof(*ivhd_entry));
ivhd_entry->type = type; - ivhd_entry->dev_id = dev->path.pci.devfn | (dev->bus->secondary << 8); + ivhd_entry->dev_id = dev->path.pci.devfn | (dev->upstream->secondary << 8); ivhd_entry->dte_setting = data; ivhd_entry->reserved1 = 0; ivhd_entry->reserved2 = 0; ivhd_entry->source_dev_id = parent->path.pci.devfn | - (parent->bus->secondary << 8); + (parent->upstream->secondary << 8); *current += sizeof(ivrs_ivhd_alias_t); }
@@ -147,7 +147,7 @@ return;
if (dev->path.type == DEVICE_PATH_PCI) { - if ((dev->bus->secondary == nb_bus) && + if ((dev->upstream->secondary == nb_bus) && (dev->path.pci.devfn == 0x0)) *root_level = depth;
@@ -156,9 +156,9 @@ ivrs_add_device_or_bridge(parent, dev, current); }
- if (!dev->link_list) + if (!dev->downstream) return; - for (sibling = dev->link_list->children; sibling; sibling = sibling->sibling) + for (sibling = dev->downstream->children; sibling; sibling = sibling->sibling) add_ivhd_device_entries(dev, sibling, depth + 1, depth, root_level, current, nb_bus); } @@ -175,21 +175,21 @@ * Add all possible PCI devices in the domain that can generate transactions * processed by IOMMU. Start with device <bus>:01.0 */ - current = ivhd_dev_range(current, PCI_DEVFN(0, 3) | (dev->link_list->secondary << 8), - 0xff | (dev->link_list->subordinate << 8), 0); + current = ivhd_dev_range(current, PCI_DEVFN(0, 3) | (dev->downstream->secondary << 8), + 0xff | (dev->downstream->subordinate << 8), 0);
add_ivhd_device_entries(NULL, dev, 0, -1, &root_level, - ¤t, dev->link_list->secondary); + ¤t, dev->downstream->secondary);
res = probe_resource(dev, IOMMU_IOAPIC_IDX); if (res) { /* Describe IOAPIC associated with the IOMMU */ current = acpi_fill_ivrs_ioapic(current, (u8 *)(uintptr_t)res->base, - PCI_DEVFN(0, 1) | (dev->link_list->secondary << 8), 0); + PCI_DEVFN(0, 1) | (dev->downstream->secondary << 8), 0); }
/* If the domain has secondary bus as zero then associate HPET & FCH IOAPIC */ - if (dev->link_list->secondary == 0) { + if (dev->downstream->secondary == 0) { /* Describe HPET */ current = ivhd_describe_hpet(current, 0x00, SMBUS_DEVFN); /* Describe FCH IOAPICs */ @@ -214,7 +214,7 @@ ivhd_40->flags = ivhd->flags & 0x3f; ivhd_40->length = sizeof(struct acpi_ivrs_ivhd_40); /* BDF <bus>:00.2 */ - ivhd_40->device_id = 0x02 | (nb_dev->bus->secondary << 8); + ivhd_40->device_id = 0x02 | (nb_dev->upstream->secondary << 8); ivhd_40->capability_offset = pci_find_capability(iommu_dev, IOMMU_CAP_ID); ivhd_40->iommu_base_low = ivhd->iommu_base_low; ivhd_40->iommu_base_high = ivhd->iommu_base_high; @@ -232,9 +232,9 @@
/* Now repeat all the device entries from type 10h */ current_backup = current; - current = acpi_ivhd_misc(current, nb_dev->bus->dev); + current = acpi_ivhd_misc(current, nb_dev->upstream->dev);
- if (nb_dev->bus->secondary == 0) { + if (nb_dev->upstream->secondary == 0) { /* Describe EMMC */ if (CONFIG(SOC_AMD_COMMON_BLOCK_EMMC)) { /* PCI_DEVFN(0x13, 1) doesn't exist in the hardware, but it's what the @@ -271,7 +271,7 @@ ivhd_11->flags = ivhd->flags & 0x3f; ivhd_11->length = sizeof(struct acpi_ivrs_ivhd_11); /* BDF <bus>:00.2 */ - ivhd_11->device_id = 0x02 | (nb_dev->bus->secondary << 8); + ivhd_11->device_id = 0x02 | (nb_dev->upstream->secondary << 8); ivhd_11->capability_offset = pci_find_capability(iommu_dev, IOMMU_CAP_ID); ivhd_11->iommu_base_low = ivhd->iommu_base_low; ivhd_11->iommu_base_high = ivhd->iommu_base_high; @@ -291,7 +291,7 @@
/* Now repeat all the device entries from type 10h */ current_backup = current; - current = acpi_ivhd_misc(current, nb_dev->bus->dev); + current = acpi_ivhd_misc(current, nb_dev->upstream->dev); ivhd_11->length += (current - current_backup);
return acpi_fill_ivrs40(current, ivhd, nb_dev, iommu_dev); @@ -319,8 +319,8 @@
while ((dev = dev_find_path(dev, DEVICE_PATH_DOMAIN)) != NULL) {
- nb_dev = pcidev_path_behind(dev->link_list, PCI_DEVFN(0, 0)); - iommu_dev = pcidev_path_behind(dev->link_list, PCI_DEVFN(0, 2)); + nb_dev = pcidev_path_behind(dev->downstream, PCI_DEVFN(0, 0)); + iommu_dev = pcidev_path_behind(dev->downstream, PCI_DEVFN(0, 2)); if (!nb_dev) { printk(BIOS_WARNING, "%s: Northbridge device not present!\n", __func__); printk(BIOS_WARNING, "%s: IVRS table not generated...\n", __func__); @@ -336,7 +336,7 @@ ivhd->length = sizeof(struct acpi_ivrs_ivhd);
/* BDF <bus>:00.2 */ - ivhd->device_id = 0x02 | (nb_dev->bus->secondary << 8); + ivhd->device_id = 0x02 | (nb_dev->upstream->secondary << 8); ivhd->capability_offset = pci_find_capability(iommu_dev, IOMMU_CAP_ID); ivhd->iommu_base_low = pci_read_config32(iommu_dev, IOMMU_CAP_BASE_LO) & 0xffffc000; ivhd->iommu_base_high = pci_read_config32(iommu_dev, IOMMU_CAP_BASE_HI); diff --git a/src/soc/amd/common/block/data_fabric/domain.c b/src/soc/amd/common/block/data_fabric/domain.c index 4ec52fc..e8c93bb 100644 --- a/src/soc/amd/common/block/data_fabric/domain.c +++ b/src/soc/amd/common/block/data_fabric/domain.c @@ -27,11 +27,11 @@ limit = MIN(limit, CONFIG_ECAM_MMCONF_BUS_NUMBER - 1);
/* Set bus first number of PCI root */ - domain->link_list->secondary = bus; + domain->downstream->secondary = bus; /* subordinate needs to be the same as secondary before pci_host_bridge_scan_bus call. */ - domain->link_list->subordinate = bus; + domain->downstream->subordinate = bus; /* Tell allocator about maximum PCI bus number in domain */ - domain->link_list->max_subordinate = limit; + domain->downstream->max_subordinate = limit;
pci_host_bridge_scan_bus(domain); } @@ -241,11 +241,11 @@
/* PCI bus number range in domain */ printk(BIOS_DEBUG, "%s _CRS: adding busses [%x-%x]\n", acpi_device_name(domain), - domain->link_list->secondary, domain->link_list->max_subordinate); - acpigen_resource_producer_bus_number(domain->link_list->secondary, - domain->link_list->max_subordinate); + domain->downstream->secondary, domain->downstream->max_subordinate); + acpigen_resource_producer_bus_number(domain->downstream->secondary, + domain->downstream->max_subordinate);
- if (domain->link_list->secondary == 0) { + if (domain->downstream->secondary == 0) { /* ACPI 6.4.2.5 I/O Port Descriptor */ acpigen_write_io16(PCI_IO_CONFIG_INDEX, PCI_IO_CONFIG_LAST_PORT, 1, PCI_IO_CONFIG_PORT_COUNT, 1); @@ -273,7 +273,7 @@ } }
- if (domain->link_list->bridge_ctrl & PCI_BRIDGE_CTL_VGA) { + if (domain->downstream->bridge_ctrl & PCI_BRIDGE_CTL_VGA) { printk(BIOS_DEBUG, "%s _CRS: adding VGA resource\n", acpi_device_name(domain)); acpigen_resource_producer_mmio(VGA_MMIO_BASE, VGA_MMIO_LIMIT, MEM_RSRC_FLAG_MEM_READ_WRITE | MEM_RSRC_FLAG_MEM_ATTR_CACHE); @@ -281,7 +281,7 @@
acpigen_write_resourcetemplate_footer();
- acpigen_write_BBN(domain->link_list->secondary); + acpigen_write_BBN(domain->downstream->secondary);
/* Scope */ acpigen_pop_len(); diff --git a/src/soc/amd/common/block/lpc/lpc.c b/src/soc/amd/common/block/lpc/lpc.c index ca881a2..5c9addf 100644 --- a/src/soc/amd/common/block/lpc/lpc.c +++ b/src/soc/amd/common/block/lpc/lpc.c @@ -281,10 +281,10 @@ { struct device *child;
- if (!dev->link_list) + if (!dev->downstream) return;
- for (child = dev->link_list->children; child; child = child->sibling) { + for (child = dev->downstream->children; child; child = child->sibling) { if (!child->enabled) continue; if (child->path.type != DEVICE_PATH_PNP) diff --git a/src/soc/amd/glinda/xhci.c b/src/soc/amd/glinda/xhci.c index dad5593..74e8816 100644 --- a/src/soc/amd/glinda/xhci.c +++ b/src/soc/amd/glinda/xhci.c @@ -34,13 +34,13 @@
enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) { - if (dev->bus->dev->path.type != DEVICE_PATH_PCI) + if (dev->upstream->dev->path.type != DEVICE_PATH_PCI) return CB_ERR_ARG;
if (dev->path.type != DEVICE_PATH_PCI) return CB_ERR_ARG;
- if (dev->bus->dev->path.pci.devfn == PCIE_ABC_A_DEVFN) { + if (dev->upstream->dev->path.pci.devfn == PCIE_ABC_A_DEVFN) { if (dev->path.pci.devfn == XHCI0_DEVFN) { *gpe = xhci_sci_sources[0].gpe; return CB_SUCCESS; @@ -48,7 +48,7 @@ *gpe = xhci_sci_sources[1].gpe; return CB_SUCCESS; } - } else if (dev->bus->dev->path.pci.devfn == PCIE_ABC_C_DEVFN) { + } else if (dev->upstream->dev->path.pci.devfn == PCIE_ABC_C_DEVFN) { if (dev->path.pci.devfn == XHCI2_DEVFN && dev->device == PCI_DID_AMD_FAM17H_MODELA0H_XHCI2) { *gpe = xhci_sci_sources[2].gpe; diff --git a/src/soc/amd/mendocino/xhci.c b/src/soc/amd/mendocino/xhci.c index e564991..8f46374 100644 --- a/src/soc/amd/mendocino/xhci.c +++ b/src/soc/amd/mendocino/xhci.c @@ -35,13 +35,13 @@
enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) { - if (dev->bus->dev->path.type != DEVICE_PATH_PCI) + if (dev->upstream->dev->path.type != DEVICE_PATH_PCI) return CB_ERR_ARG;
if (dev->path.type != DEVICE_PATH_PCI) return CB_ERR_ARG;
- if (dev->bus->dev->path.pci.devfn == PCIE_ABC_A_DEVFN) { + if (dev->upstream->dev->path.pci.devfn == PCIE_ABC_A_DEVFN) { if (dev->path.pci.devfn == XHCI0_DEVFN) { *gpe = xhci_sci_sources[0].gpe; return CB_SUCCESS; @@ -49,7 +49,7 @@ *gpe = xhci_sci_sources[1].gpe; return CB_SUCCESS; } - } else if (dev->bus->dev->path.pci.devfn == PCIE_ABC_C_DEVFN) { + } else if (dev->upstream->dev->path.pci.devfn == PCIE_ABC_C_DEVFN) { if (dev->path.pci.devfn == XHCI2_DEVFN && dev->device == PCI_DID_AMD_FAM17H_MODELA0H_XHCI2) { *gpe = xhci_sci_sources[2].gpe; diff --git a/src/soc/amd/phoenix/xhci.c b/src/soc/amd/phoenix/xhci.c index 99033f9..79d4d07 100644 --- a/src/soc/amd/phoenix/xhci.c +++ b/src/soc/amd/phoenix/xhci.c @@ -39,13 +39,13 @@
enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) { - if (dev->bus->dev->path.type != DEVICE_PATH_PCI) + if (dev->upstream->dev->path.type != DEVICE_PATH_PCI) return CB_ERR_ARG;
if (dev->path.type != DEVICE_PATH_PCI) return CB_ERR_ARG;
- if (dev->bus->dev->path.pci.devfn == PCIE_ABC_A_DEVFN) { + if (dev->upstream->dev->path.pci.devfn == PCIE_ABC_A_DEVFN) { if (dev->path.pci.devfn == XHCI0_DEVFN) { *gpe = xhci_sci_sources[0].gpe; return CB_SUCCESS; @@ -55,7 +55,7 @@ } }
- if (dev->bus->dev->path.pci.devfn == PCIE_ABC_C_DEVFN) { + if (dev->upstream->dev->path.pci.devfn == PCIE_ABC_C_DEVFN) { if (dev->path.pci.devfn == USB4_XHCI0_DEVFN) { *gpe = xhci_sci_sources[2].gpe; return CB_SUCCESS; diff --git a/src/soc/amd/picasso/xhci.c b/src/soc/amd/picasso/xhci.c index 84b3a2b..a238916 100644 --- a/src/soc/amd/picasso/xhci.c +++ b/src/soc/amd/picasso/xhci.c @@ -26,10 +26,10 @@
enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) { - if (dev->bus->dev->path.type != DEVICE_PATH_PCI) + if (dev->upstream->dev->path.type != DEVICE_PATH_PCI) return CB_ERR_ARG;
- if (dev->bus->dev->path.pci.devfn != PCIE_GPP_A_DEVFN) + if (dev->upstream->dev->path.pci.devfn != PCIE_GPP_A_DEVFN) return CB_ERR_ARG;
if (dev->path.type != DEVICE_PATH_PCI) diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c index 66ebd2a..43b5501 100644 --- a/src/soc/amd/stoneyridge/northbridge.c +++ b/src/soc/amd/stoneyridge/northbridge.c @@ -127,9 +127,9 @@ { /* find out which link the VGA card is connected, * we only deal with the 'first' vga card */ - if (!dev->link_list) + if (!dev->downstream) return; - if (!(dev->link_list->bridge_ctrl & PCI_BRIDGE_CTL_VGA)) + if (!(dev->downstream->bridge_ctrl & PCI_BRIDGE_CTL_VGA)) return;
printk(BIOS_DEBUG, "VGA: %s has VGA device\n", dev_path(dev)); @@ -148,8 +148,8 @@ for (res = dev->resource_list ; res ; res = res->next) set_resource(dev, res, 0);
- if (dev->link_list && dev->link_list->children) - assign_resources(dev->link_list); + if (dev->downstream && dev->downstream->children) + assign_resources(dev->downstream); }
static void northbridge_init(struct device *dev) diff --git a/src/soc/cavium/cn81xx/ecam0.c b/src/soc/cavium/cn81xx/ecam0.c index d02e884..ff3e709 100644 --- a/src/soc/cavium/cn81xx/ecam0.c +++ b/src/soc/cavium/cn81xx/ecam0.c @@ -226,12 +226,12 @@ * Search for missing devices on BUS 1. * Only required for ARI capability programming. */ - ecam0_fix_missing_devices(bridge->link_list); + ecam0_fix_missing_devices(bridge->downstream);
/* Program secure ARI capability on bus 1 */ child_last = NULL; for (i = 0; i <= PCI_DEVFN(0x1f, 7); i++) { - child = pcidev_path_behind(bridge->link_list, i); + child = pcidev_path_behind(bridge->downstream, i); if (!child || !child->enabled) continue;
@@ -250,7 +250,7 @@ /* Program insecure ARI capability on bus 1 */ child_last = NULL; for (i = 0; i <= PCI_DEVFN(0x1f, 7); i++) { - child = pcidev_path_behind(bridge->link_list, i); + child = pcidev_path_behind(bridge->downstream, i); if (!child) continue; config = child->chip_info; @@ -281,7 +281,7 @@
/* Enable / disable devices and functions on bus 1 */ for (i = 0; i <= PCI_DEVFN(0x1f, 7); i++) { - child = pcidev_path_behind(bridge->link_list, i); + child = pcidev_path_behind(bridge->downstream, i); config = child ? child->chip_info : NULL; if (child && child->enabled && ((config && !config->secure) || !config)) @@ -293,7 +293,7 @@ /* Apply IRQ on PCI devices */ /* UUA */ for (i = 0; i < 4; i++) { - child = pcidev_path_behind(bridge->link_list, + child = pcidev_path_behind(bridge->downstream, PCI_DEVFN(8, i)); if (!child) continue; diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c index 07c2637..61052dd 100644 --- a/src/soc/intel/apollolake/chip.c +++ b/src/soc/intel/apollolake/chip.c @@ -478,7 +478,7 @@ return; } /* Only disable bus 0 devices. */ - for (dev = dev->bus->children; dev; dev = dev->sibling) { + for (dev = dev->upstream->children; dev; dev = dev->sibling) { if (!dev->enabled) disable_dev(dev, silconfig); } diff --git a/src/soc/intel/braswell/southcluster.c b/src/soc/intel/braswell/southcluster.c index a0df97c..2e37280 100644 --- a/src/soc/intel/braswell/southcluster.c +++ b/src/soc/intel/braswell/southcluster.c @@ -117,7 +117,7 @@ continue;
current_bdf = irq_dev->path.pci.devfn | - irq_dev->bus->secondary << 8; + irq_dev->upstream->secondary << 8;
/* * Step 1: Get the INT_PIN and device structure to look for @@ -132,7 +132,7 @@ original_int_pin = pci_read_config8(irq_dev, PCI_INTERRUPT_PIN);
parent_bdf = targ_dev->path.pci.devfn - | targ_dev->bus->secondary << 8; + | targ_dev->upstream->secondary << 8; device_num = PCI_SLOT(parent_bdf);
if (ir->pcidev[device_num] == 0) { diff --git a/src/soc/intel/common/block/acpi/pep.c b/src/soc/intel/common/block/acpi/pep.c index 5e03345..c024b42 100644 --- a/src/soc/intel/common/block/acpi/pep.c +++ b/src/soc/intel/common/block/acpi/pep.c @@ -144,7 +144,7 @@
case DEVICE_PATH_PCI: /* skip external buses*/ - if ((dev->bus->secondary != 0) || (!states_arr)) + if ((dev->upstream->secondary != 0) || (!states_arr)) return ACPI_DEVICE_SLEEP_NONE; for (size_t i = 0; i < size; i++) if (states_arr[i].pci_dev == dev->path.pci.devfn) diff --git a/src/soc/intel/common/block/lpc/lpc.c b/src/soc/intel/common/block/lpc/lpc.c index 283a07e..326727f 100644 --- a/src/soc/intel/common/block/lpc/lpc.c +++ b/src/soc/intel/common/block/lpc/lpc.c @@ -102,10 +102,10 @@ { struct device *child;
- if (!dev->link_list) + if (!dev->downstream) return;
- for (child = dev->link_list->children; child; child = child->sibling) + for (child = dev->downstream->children; child; child = child->sibling) pch_lpc_loop_resources(child); }
diff --git a/src/soc/intel/common/block/pcie/rtd3/rtd3.c b/src/soc/intel/common/block/pcie/rtd3/rtd3.c index abd7e466..76d9718 100644 --- a/src/soc/intel/common/block/pcie/rtd3/rtd3.c +++ b/src/soc/intel/common/block/pcie/rtd3/rtd3.c @@ -140,7 +140,7 @@ enum pcie_rp_type rp_type, const struct device *dev) { - const struct device *parent = dev->bus->dev; + const struct device *parent = dev->upstream->dev;
acpigen_write_method_serialized("_ON", 0);
@@ -224,7 +224,7 @@ const struct device *dev)
{ - const struct device *parent = dev->bus->dev; + const struct device *parent = dev->upstream->dev;
acpigen_write_method_serialized("_OFF", 0);
@@ -385,7 +385,7 @@
const struct soc_intel_common_block_pcie_rtd3_config *config = config_of(dev); static const char *const power_res_states[] = {"_PR0"}; - const struct device *parent = dev->bus->dev; + const struct device *parent = dev->upstream->dev; const char *scope = acpi_device_path(parent); const struct opregion opregion = OPREGION("PXCS", PCI_CONFIG, 0, 0xff); const struct fieldlist fieldlist[] = { diff --git a/src/soc/intel/common/block/usb4/pcie.c b/src/soc/intel/common/block/usb4/pcie.c index 0139647..5afe9af 100644 --- a/src/soc/intel/common/block/usb4/pcie.c +++ b/src/soc/intel/common/block/usb4/pcie.c @@ -19,7 +19,7 @@ int port_id;
/* Get parent PCI device */ - parent = dev->bus->dev; + parent = dev->upstream->dev; if (!parent) { printk(BIOS_ERR, "%s: Unable to find parent device\n", __func__); return; diff --git a/src/soc/intel/common/block/xhci/xhci.c b/src/soc/intel/common/block/xhci/xhci.c index 9cc4211..5c0df54 100644 --- a/src/soc/intel/common/block/xhci/xhci.c +++ b/src/soc/intel/common/block/xhci/xhci.c @@ -92,8 +92,8 @@ return; }
- while ((hub = dev_bus_each_child(xhci->link_list, hub)) != NULL) { - while ((port = dev_bus_each_child(hub->link_list, port)) != NULL) { + while ((hub = dev_bus_each_child(xhci->downstream, hub)) != NULL) { + while ((port = dev_bus_each_child(hub->downstream, port)) != NULL) { enable = true; config = config_of(port); if (config->type == UPC_TYPE_INTERNAL) { diff --git a/src/soc/intel/denverton_ns/lpc.c b/src/soc/intel/denverton_ns/lpc.c index 7ebca1e..ae923d7 100644 --- a/src/soc/intel/denverton_ns/lpc.c +++ b/src/soc/intel/denverton_ns/lpc.c @@ -275,7 +275,7 @@
/* Swizzle this device if needed */ config = targ_dev->chip_info; - parent_bdf = targ_dev->path.pci.devfn | targ_dev->bus->secondary << 8; + parent_bdf = targ_dev->path.pci.devfn | targ_dev->upstream->secondary << 8; if (is_dnv_swizzled_rp(parent_bdf) && irq_dev != targ_dev) { swiz_int_pin = dnv_get_swizzled_pin(config, parent_bdf, new_int_pin); printk(BIOS_DEBUG, "%s: dnv swizzle %s from %c to %c\n", __func__, @@ -387,7 +387,7 @@
int_line = dnv_get_int_line(irq_dev); printk(BIOS_DEBUG, "%s: %02x:%02x.%d pin %d int line %d\n", __func__, - irq_dev->bus->secondary, devfn >> 3, devfn & 0x7, int_pin, int_line); + irq_dev->upstream->secondary, devfn >> 3, devfn & 0x7, int_pin, int_line);
pci_write_config8(irq_dev, PCI_INTERRUPT_LINE, int_line); } diff --git a/src/soc/intel/meteorlake/fsp_params.c b/src/soc/intel/meteorlake/fsp_params.c index 5ec9cf4..cdc8acf 100644 --- a/src/soc/intel/meteorlake/fsp_params.c +++ b/src/soc/intel/meteorlake/fsp_params.c @@ -758,7 +758,7 @@
for (dev = all_devices; dev; dev = dev->next) { if (!(is_dev_enabled(dev) && dev->path.type == DEVICE_PATH_PCI && - dev->bus->secondary == 0)) + dev->upstream->secondary == 0)) continue;
if (dev->path.pci.devfn == PCI_DEVFN_ROOT) { diff --git a/src/soc/intel/skylake/chip.c b/src/soc/intel/skylake/chip.c index 8df1ad3..93a85da 100644 --- a/src/soc/intel/skylake/chip.c +++ b/src/soc/intel/skylake/chip.c @@ -94,7 +94,7 @@ return NULL;
/* Match functions 0 and 1 for possible GPUs on a secondary bus */ - if (dev->bus && dev->bus->secondary > 0) { + if (dev->upstream && dev->upstream->secondary > 0) { switch (PCI_FUNC(dev->path.pci.devfn)) { case 0: return "DEV0"; case 1: return "DEV1"; diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c index 12add8e..8e4533e 100644 --- a/src/soc/intel/xeon_sp/chip_common.c +++ b/src/soc/intel/xeon_sp/chip_common.c @@ -61,19 +61,19 @@ void iio_pci_domain_scan_bus(struct device *dev) { const STACK_RES *sr = domain_to_stack_res(dev); - if (!dev->link_list) { - dev->link_list = calloc(1, sizeof(struct bus)); - if (!dev->link_list) + if (!dev->downstream) { + dev->downstream = calloc(1, sizeof(struct bus)); + if (!dev->downstream) die("%s: out of memory.\n", __func__); }
- struct bus *bus = dev->link_list; + struct bus *bus = dev->downstream; bus->secondary = sr->BusBase; bus->subordinate = sr->BusBase; bus->max_subordinate = sr->BusLimit;
printk(BIOS_SPEW, "Scanning IIO stack %d: busses %x-%x\n", dev->path.domain.domain, - dev->link_list->secondary, dev->link_list->max_subordinate); + dev->downstream->secondary, dev->downstream->max_subordinate); pci_host_bridge_scan_bus(dev); }
@@ -86,7 +86,7 @@ bus->secondary = sr->BusBase; bus->subordinate = sr->BusBase; bus->max_subordinate = sr->BusLimit; - dev->link_list = bus; + dev->downstream = bus;
/* Add host_bridge devices for each PCI BUS */ for (int i = sr->BusBase; i <= sr->BusLimit; i++) { @@ -96,7 +96,7 @@ dev->path.domain.domain, i); struct device *host_bridge = alloc_pci_host_bridge(dev, i); /* We only expect bridges on IIO stacks so set this to secondary */ - host_bridge->link_list->max_subordinate = i; + host_bridge->downstream->max_subordinate = i; } }
@@ -127,7 +127,7 @@ struct device_path path; path.type = DEVICE_PATH_DOMAIN; path.domain.domain = s * MAX_IIO_STACK + x; - struct device *iio_domain = alloc_dev(dev->bus, &path); + struct device *iio_domain = alloc_dev(dev->upstream, &path); if (iio_domain == NULL) die("%s: out of memory.\n", __func__); iio_domain->ops = is_iio_stack_res(ri) ? &iiostack_pci_domain_ops : &non_iiostack_pci_domain_ops; diff --git a/src/soc/intel/xeon_sp/cpx/soc_acpi.c b/src/soc/intel/xeon_sp/cpx/soc_acpi.c index 52afe45..b43ecb2 100644 --- a/src/soc/intel/xeon_sp/cpx/soc_acpi.c +++ b/src/soc/intel/xeon_sp/cpx/soc_acpi.c @@ -46,7 +46,7 @@ struct iiostack_resource stack_info = {0};
/* Only add RTxx entries once. */ - if (device->bus->secondary != 0) + if (device->upstream->secondary != 0) return;
get_iiostack_info(&stack_info); diff --git a/src/soc/intel/xeon_sp/skx/soc_acpi.c b/src/soc/intel/xeon_sp/skx/soc_acpi.c index 35e3ea1..9c02161 100644 --- a/src/soc/intel/xeon_sp/skx/soc_acpi.c +++ b/src/soc/intel/xeon_sp/skx/soc_acpi.c @@ -59,7 +59,7 @@ const IIO_UDS *hob = get_iio_uds();
/* Only add RTxx entries once. */ - if (device->bus->secondary != 0) + if (device->upstream->secondary != 0) return;
acpigen_write_scope("\_SB"); diff --git a/src/soc/intel/xeon_sp/spr/soc_acpi.c b/src/soc/intel/xeon_sp/spr/soc_acpi.c index 193b859..137bb19 100644 --- a/src/soc/intel/xeon_sp/spr/soc_acpi.c +++ b/src/soc/intel/xeon_sp/spr/soc_acpi.c @@ -338,7 +338,7 @@ bool stack_enabled;
/* Only add RTxx entries once. */ - if (device->bus->secondary != 0) + if (device->upstream->secondary != 0) return;
/* @@ -501,7 +501,7 @@
for (cpu = all_devices; cpu; cpu = cpu->next) { if ((cpu->path.type != DEVICE_PATH_APIC) - || (cpu->bus->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) { + || (cpu->upstream->dev->path.type != DEVICE_PATH_CPU_CLUSTER)) { continue; } if (!cpu->enabled) diff --git a/src/soc/intel/xeon_sp/uncore.c b/src/soc/intel/xeon_sp/uncore.c index 66f63d5..a69cfb2 100644 --- a/src/soc/intel/xeon_sp/uncore.c +++ b/src/soc/intel/xeon_sp/uncore.c @@ -192,7 +192,7 @@ struct range_entry fsp_mem;
/* Only add dram resources once. */ - if (dev->bus->secondary != 0) + if (dev->upstream->secondary != 0) return;
/* Read in the MAP registers and report their values. */ diff --git a/src/soc/intel/xeon_sp/uncore_acpi.c b/src/soc/intel/xeon_sp/uncore_acpi.c index e2b47329..75b281b 100644 --- a/src/soc/intel/xeon_sp/uncore_acpi.c +++ b/src/soc/intel/xeon_sp/uncore_acpi.c @@ -225,7 +225,7 @@ uint32_t pcie_seg, bool is_atsr, bool *first) { - const uint32_t bus = bridge_dev->bus->secondary; + const uint32_t bus = bridge_dev->upstream->secondary; const uint32_t dev = PCI_SLOT(bridge_dev->path.pci.devfn); const uint32_t func = PCI_FUNC(bridge_dev->path.pci.devfn);
diff --git a/src/southbridge/amd/pi/hudson/lpc.c b/src/southbridge/amd/pi/hudson/lpc.c index 7246fe1..d5193c2 100644 --- a/src/southbridge/amd/pi/hudson/lpc.c +++ b/src/southbridge/amd/pi/hudson/lpc.c @@ -171,8 +171,8 @@ reg_var[0] = pci_read_config16(dev, 0x64);
struct device *child; - if (dev->link_list) { - for (child = dev->link_list->children; child; child = child->sibling) { + if (dev->downstream) { + for (child = dev->downstream->children; child; child = child->sibling) { if (child->enabled && (child->path.type == DEVICE_PATH_PNP)) { struct resource *res; for (res = child->resource_list; res; res = res->next) { diff --git a/src/superio/common/generic.c b/src/superio/common/generic.c index c690340..e4e2042 100644 --- a/src/superio/common/generic.c +++ b/src/superio/common/generic.c @@ -13,8 +13,8 @@ if (!dev) return;
- if (dev->link_list) - assign_resources(dev->link_list); + if (dev->downstream) + assign_resources(dev->downstream);
for (res = dev->resource_list; res; res = res->next) { if (!(res->flags & IORESOURCE_ASSIGNED)) @@ -159,8 +159,8 @@ acpigen_write_acquire(mutex, 0xffff);
/* Pick one of the children as the generic SIO doesn't have config mode */ - if (dev->link_list && dev->link_list->children) - pnp_ssdt_enter_conf_mode(dev->link_list->children, "^INDX", "^DATA"); + if (dev->downstream && dev->downstream->children) + pnp_ssdt_enter_conf_mode(dev->downstream->children, "^INDX", "^DATA");
/* Backup LDN */ acpigen_write_store(); @@ -178,8 +178,8 @@ acpigen_emit_namestring("^LDN");
/* Pick one of the children as the generic SIO doesn't have config mode */ - if (dev->link_list && dev->link_list->children) - pnp_ssdt_exit_conf_mode(dev->link_list->children, "^INDX", "^DATA"); + if (dev->downstream && dev->downstream->children) + pnp_ssdt_exit_conf_mode(dev->downstream->children, "^INDX", "^DATA");
acpigen_write_release(mutex); } diff --git a/src/superio/common/ssdt.c b/src/superio/common/ssdt.c index 47fbf0c..fd55792 100644 --- a/src/superio/common/ssdt.c +++ b/src/superio/common/ssdt.c @@ -161,7 +161,7 @@
void superio_common_fill_ssdt_generator(const struct device *dev) { - if (!dev || !dev->bus || !dev->bus->dev) { + if (!dev || !dev->upstream || !dev->upstream->dev) { printk(BIOS_CRIT, "BUG: Invalid argument in %s!\n", __func__); return; } @@ -174,11 +174,11 @@
/* Validate devicetree settings */ bool bug = false; - if (dev->bus->dev->path.type != DEVICE_PATH_PNP) { + if (dev->upstream->dev->path.type != DEVICE_PATH_PNP) { bug = true; printk(BIOS_CRIT, "BUG: Parent of device %s is not a PNP device\n", dev_path(dev)); - } else if (dev->bus->dev->path.pnp.port != dev->path.pnp.port) { + } else if (dev->upstream->dev->path.pnp.port != dev->path.pnp.port) { bug = true; printk(BIOS_CRIT, "BUG: Parent of device %s has wrong I/O port\n", dev_path(dev)); diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 7befb1e..591593d 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -1226,7 +1226,7 @@ else fprintf(fil, "\t.ops = NULL,\n"); fprintf(fil, "#endif\n"); - fprintf(fil, "\t.bus = &%s_bus,\n", ptr->parent->dev->name); + fprintf(fil, "\t.upstream = &%s_bus,\n", ptr->parent->dev->name); fprintf(fil, "\t.path = {"); fprintf(fil, ptr->path, ptr->path_a, ptr->path_b); fprintf(fil, "},\n"); @@ -1247,10 +1247,10 @@ ptr->name); } if (has_children) - fprintf(fil, "\t.link_list = &%s_bus,\n", + fprintf(fil, "\t.downstream = &%s_bus,\n", ptr->name); else - fprintf(fil, "\t.link_list = NULL,\n"); + fprintf(fil, "\t.downstream = NULL,\n"); if (ptr->sibling) fprintf(fil, "\t.sibling = &%s,\n", ptr->sibling->name); else