diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2023-08-24 15:12:19 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-01-31 10:36:39 +0000 |
commit | 7fcd4d58ec7ea2da31c258ba9d8601f086d7f8d8 (patch) | |
tree | 1bddf10cecf4577fee207e0dbc6f7a5c1b10af13 /src | |
parent | 3138faa7cf1b91e0b56ad0b1be6260cf4251a284 (diff) |
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
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78330
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src')
103 files changed, 340 insertions, 345 deletions
diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 0e4798c448..6bf452e919 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -700,8 +700,8 @@ void acpi_create_ipmi(const struct device *device, if (device->path.type == DEVICE_PATH_PCI) { spmi->pci_device_flag = ACPI_IPMI_PCI_DEVICE_FLAG; - spmi->pci_segment_group = device->bus->segment_group; - spmi->pci_bus = device->bus->secondary; + spmi->pci_segment_group = device->upstream->segment_group; + 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 823cdbeb5a..368b86c576 100644 --- a/src/acpi/device.c +++ b/src/acpi/device.c @@ -83,8 +83,8 @@ const char *acpi_device_name(const struct device *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 (is_root_device(pdev)) @@ -147,8 +147,8 @@ static ssize_t acpi_device_path_fill(const struct device *dev, char *buf, return cur; /* Walk up the tree to the root device */ - if (!is_root_device(dev) && dev->bus && dev->bus->dev) - next = acpi_device_path_fill(dev->bus->dev, buf, buf_len, cur); + if (!is_root_device(dev) && dev->upstream && dev->upstream->dev) + next = acpi_device_path_fill(dev->upstream->dev, buf, buf_len, cur); if (next < 0) return next; @@ -182,10 +182,10 @@ const char *acpi_device_scope(const struct device *dev) { 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 3ddee2f6b9..b8bdb09809 100644 --- a/src/arch/x86/mpspec.c +++ b/src/arch/x86/mpspec.c @@ -284,11 +284,11 @@ void smp_write_intsrc_pci_bridge(struct mp_config_table *mc, 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) @@ -476,7 +476,7 @@ void mptable_write_buses(struct mp_config_table *mc, int *max_pci_bus, 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 83d847cbae..86dcbea177 100644 --- a/src/cpu/intel/haswell/haswell_init.c +++ b/src/cpu/intel/haswell/haswell_init.c @@ -449,7 +449,7 @@ static void configure_c_states(void) 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 3497ae03a6..cb74854346 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 372989cc84..d9340ff95d 100644 --- a/src/cpu/intel/model_206ax/model_206ax_init.c +++ b/src/cpu/intel/model_206ax/model_206ax_init.c @@ -223,7 +223,7 @@ static void configure_c_states(void) 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; if (boot_cpu()) { diff --git a/src/device/cardbus_device.c b/src/device/cardbus_device.c index 23f24ddb79..2eb070e7e1 100644 --- a/src/device/cardbus_device.c +++ b/src/device/cardbus_device.c @@ -119,7 +119,7 @@ void cardbus_enable_resources(struct device *dev) 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 743a3af6c2..72a408e4f5 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -101,7 +101,7 @@ static struct device *__alloc_dev(struct bus *parent, struct device_path *path) 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 @@ -139,13 +139,13 @@ DECLARE_SPIN_LOCK(bus_lock) */ static struct bus *__alloc_bus(struct device *parent) { - if (parent->link_list) - return parent->link_list; + if (parent->downstream) + return parent->downstream; struct bus *bus = calloc(1, sizeof(struct bus)); if (!bus) die("Couldn't allocate downstream bus!\n"); - parent->link_list = bus; + parent->downstream = bus; bus->dev = parent; return bus; @@ -205,8 +205,8 @@ static void read_resources(struct bus *bus) 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 segment group %d bus %d done\n", @@ -236,7 +236,7 @@ static void set_vga_bridge_bits(void) 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!"); } @@ -270,7 +270,7 @@ static void set_vga_bridge_bits(void) /* 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. */ @@ -278,7 +278,7 @@ static void set_vga_bridge_bits(void) 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; } } @@ -343,8 +343,8 @@ static void enable_resources(struct bus *link) } 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(); } @@ -391,7 +391,7 @@ static void scan_bus(struct device *busdev) 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) @@ -399,7 +399,7 @@ static void scan_bus(struct device *busdev) if (reset_bus(link)) do_scan_bus = 1; else - busdev->bus->reset_needed = 1; + busdev->upstream->reset_needed = 1; } scan_time = stopwatch_duration_msecs(&sw); @@ -496,14 +496,14 @@ void dev_configure(void) /* 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."); @@ -521,8 +521,8 @@ void dev_enable(void) 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"); } @@ -546,7 +546,7 @@ static void init_dev(struct device *dev) 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)); @@ -572,8 +572,8 @@ static void init_link(struct bus *link) } for (dev = link->children; dev; dev = dev->sibling) - if (dev->link_list) - init_link(dev->link_list); + if (dev->downstream) + init_link(dev->downstream); } /** @@ -590,8 +590,8 @@ void dev_initialize(void) 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"); @@ -626,8 +626,8 @@ static void final_link(struct bus *link) 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. @@ -643,7 +643,7 @@ void dev_finalize(void) 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 c91c00908d..0521c7e8a4 100644 --- a/src/device/device_const.c +++ b/src/device/device_const.c @@ -34,8 +34,8 @@ static DEVTREE_CONST struct device *dev_find_slot(unsigned int bus, result = 0; for (dev = all_devices; dev; dev = dev->next) { if ((dev->path.type == DEVICE_PATH_PCI) && - (dev->bus->secondary == bus) && - (dev->bus->segment_group == 0) && + (dev->upstream->secondary == bus) && + (dev->upstream->segment_group == 0) && (dev->path.pci.devfn == devfn)) { result = dev; break; @@ -210,7 +210,7 @@ DEVTREE_CONST struct device *find_dev_nested_path( 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( @@ -234,8 +234,8 @@ DEVTREE_CONST struct device *pcidev_path_on_bus(unsigned int bus, pci_devfn_t de dev = dev->next; continue; } - if (dev->bus->secondary == bus && dev->bus->segment_group == 0) - return pcidev_path_behind(dev->bus, devfn); + if (dev->upstream->secondary == bus && dev->upstream->segment_group == 0) + return pcidev_path_behind(dev->upstream, devfn); dev = dev->next; } return NULL; @@ -253,7 +253,7 @@ DEVTREE_CONST struct bus *pci_root_bus(void) if (!pci_domain) return NULL; - pci_root = pci_domain->link_list; + pci_root = pci_domain->downstream; return pci_root; } @@ -277,7 +277,7 @@ DEVTREE_CONST struct device *pcidev_path_behind_pci2pci_bridge( 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) @@ -317,7 +317,7 @@ DEVTREE_CONST struct device *dev_find_slot_on_smbus(unsigned int bus, 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 ea4ef27f9f..b5d0d9866e 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -97,7 +97,7 @@ u32 dev_path_encode(const struct device *dev) case DEVICE_PATH_ROOT: break; case DEVICE_PATH_PCI: - ret |= dev->bus->segment_group << 16 | dev->bus->secondary << 8 | dev->path.pci.devfn; + ret |= dev->upstream->segment_group << 16 | dev->upstream->secondary << 8 | dev->path.pci.devfn; break; case DEVICE_PATH_PNP: ret |= dev->path.pnp.port << 8 | dev->path.pnp.device; @@ -169,8 +169,8 @@ const char *dev_path(const struct device *dev) case DEVICE_PATH_PCI: snprintf(buffer, sizeof(buffer), "PCI: %02x:%02x:%02x.%01x", - dev->bus->segment_group, - dev->bus->secondary, + dev->upstream->segment_group, + dev->upstream->secondary, PCI_SLOT(dev->path.pci.devfn), PCI_FUNC(dev->path.pci.devfn)); break; @@ -180,7 +180,7 @@ const char *dev_path(const struct device *dev) 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: @@ -253,8 +253,8 @@ const char *dev_name(const struct device *dev) struct device *dev_get_pci_domain(struct device *dev) { /* Walk up the tree up to the PCI domain */ - while (dev && dev->bus && !is_root_device(dev)) { - dev = dev->bus->dev; + while (dev && dev->upstream && !is_root_device(dev)) { + dev = dev->upstream->dev; if (dev->path.type == DEVICE_PATH_DOMAIN) return dev; } @@ -529,10 +529,10 @@ void report_resource_stored(struct device *dev, const struct resource *resource, 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), - "seg %02x bus %02x ", dev->link_list->segment_group, - dev->link_list->secondary); + "seg %02x bus %02x ", dev->downstream->segment_group, + 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, @@ -560,8 +560,8 @@ void search_bus_resources(struct bus *bus, unsigned long type_mask, /* If it is a subtractive resource recurse. */ if (res->flags & IORESOURCE_SUBTRACTIVE) { - if (curdev->link_list) - search_bus_resources(curdev->link_list, type_mask, type, + if (curdev->downstream) + search_bus_resources(curdev->downstream, type_mask, type, search, gp); continue; } @@ -617,8 +617,8 @@ void disable_children(struct bus *bus) 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); } } @@ -634,10 +634,10 @@ bool dev_is_active_bridge(struct device *dev) 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) @@ -659,9 +659,9 @@ static void resource_tree(const struct device *root, int debug_level, int depth) 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) { @@ -672,10 +672,10 @@ static void resource_tree(const struct device *root, int debug_level, int depth) 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); } @@ -709,10 +709,10 @@ void show_devs_tree(const struct device *dev, int debug_level, int depth) 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); } @@ -890,7 +890,7 @@ const char *dev_path_name(enum device_path_type type) 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; } @@ -909,7 +909,7 @@ void log_resource(const char *type, const struct device *dev, const struct resou 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) @@ -929,5 +929,6 @@ bool is_enabled_pci(const struct device *pci) bool is_pci_dev_on_bus(const struct device *pci, unsigned int bus) { - return is_pci(pci) && pci->bus->segment_group == 0 && pci->bus->secondary == bus; + return is_pci(pci) && pci->upstream->segment_group == 0 + && pci->upstream->secondary == bus; } diff --git a/src/device/i2c_bus.c b/src/device/i2c_bus.c index 1d4aa2d2b3..41ef14a923 100644 --- a/src/device/i2c_bus.c +++ b/src/device/i2c_bus.c @@ -18,10 +18,10 @@ bool i2c_dev_detect(struct device *dev, unsigned int addr) 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; @@ -29,8 +29,8 @@ struct bus *i2c_link(const struct device *const dev) (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 39ac40bca7..89da60bd6f 100644 --- a/src/device/mdio.c +++ b/src/device/mdio.c @@ -19,7 +19,7 @@ const struct mdio_bus_operations *dev_get_mdio_ops(struct device *dev) 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 @@ uint16_t mdio_read(struct device *dev, uint8_t offset) 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 367614db2b..c3adf401f4 100644 --- a/src/device/oprom/realmode/x86.c +++ b/src/device/oprom/realmode/x86.c @@ -415,7 +415,7 @@ void vbe_textmode_console(void) 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 945052be88..71fc1d52a6 100644 --- a/src/device/oprom/realmode/x86_interrupts.c +++ b/src/device/oprom/realmode/x86_interrupts.c @@ -138,7 +138,7 @@ int int1a_handler(void) 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 2c98578c7d..d1dc8014a3 100644 --- a/src/device/oprom/yabel/device.c +++ b/src/device/oprom/yabel/device.c @@ -65,7 +65,7 @@ biosemu_dev_get_addr_info(void) { 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 968e471992..e78a3cb1b0 100644 --- a/src/device/oprom/yabel/interrupt.c +++ b/src/device/oprom/yabel/interrupt.c @@ -375,7 +375,7 @@ handleInt1a(void) } 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 24b95238f1..8ead8a5b6b 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -585,7 +585,7 @@ void pci_domain_read_resources(struct device *dev) void pci_domain_set_resources(struct device *dev) { - assign_resources(dev->link_list); + assign_resources(dev->downstream); } static void pci_store_resource(const struct device *const dev, @@ -718,8 +718,8 @@ void pci_dev_set_resources(struct device *dev) 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); @@ -782,10 +782,10 @@ void pci_bus_enable_resources(struct device *dev) * 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); @@ -843,7 +843,7 @@ static int should_run_oprom(struct device *dev, struct rom_header *rom) { static int should_run = -1; - if (dev->bus->segment_group) { + if (dev->upstream->segment_group) { printk(BIOS_ERR, "Only option ROMs of devices in first PCI segment group can " "be run.\n"); return 0; @@ -990,7 +990,7 @@ static void pci_bridge_vga_compat(struct bus *const bus) 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; @@ -1215,7 +1215,7 @@ struct device *pci_probe_dev(struct device *dev, struct bus *bus, if (!dev) { struct device dummy; - dummy.bus = bus; + dummy.upstream = bus; dummy.path.type = DEVICE_PATH_PCI; dummy.path.pci.devfn = devfn; @@ -1317,9 +1317,9 @@ struct device *pci_probe_dev(struct device *dev, struct bus *bus, */ unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev) { - return dev->bus->secondary == PCI_DEV2BUS(sdev) && - dev->bus->segment_group == PCI_DEV2SEG(sdev) && - dev->path.pci.devfn == PCI_DEV2DEVFN(sdev); + return dev->upstream->secondary == PCI_DEV2BUS(sdev) && + dev->upstream->segment_group == PCI_DEV2SEG(sdev) && + dev->path.pci.devfn == PCI_DEV2DEVFN(sdev); } /** @@ -1333,14 +1333,14 @@ unsigned int pci_match_simple_dev(struct device *dev, pci_devfn_t sdev) */ 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; } @@ -1546,7 +1546,7 @@ typedef enum { 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) { @@ -1625,17 +1625,17 @@ void do_pci_scan_bridge(struct device *dev, 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); @@ -1670,7 +1670,7 @@ void pci_scan_bridge(struct device *dev) */ 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); } @@ -1733,8 +1733,8 @@ static int swizzle_irq_pins(struct device *dev, struct device **parent_bridge) /* 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; @@ -1798,7 +1798,7 @@ int get_pci_irq_pins(struct device *dev, struct device **parent_bdg) 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 cc1e5d1277..1e212ab216 100644 --- a/src/device/pci_rom.c +++ b/src/device/pci_rom.c @@ -230,7 +230,7 @@ ati_rom_acpi_fill_vfct(const struct device *device, acpi_vfct_t *vfct_struct, printk(BIOS_ERR, "%s failed\n", __func__); return current; } - if (device->bus->segment_group) { + if (device->upstream->segment_group) { printk(BIOS_ERR, "VFCT only supports GPU in first PCI segment group.\n"); return current; } @@ -243,7 +243,7 @@ ati_rom_acpi_fill_vfct(const struct device *device, acpi_vfct_t *vfct_struct, 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 ab8430f6ff..969dbb0017 100644 --- a/src/device/pciexp_device.c +++ b/src/device/pciexp_device.c @@ -302,7 +302,7 @@ static void pciexp_enable_ltr(struct device *dev) 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 @@ bool pciexp_get_ltr_max_latencies(struct device *dev, u16 *max_snoop, u16 *max_n 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 clear_lane_error_status(struct device *dev) 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 @@ void pciexp_hotplug_scan_bridge(struct device *dev) /* 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 e40ed3bf65..7ddc15d4eb 100644 --- a/src/device/pcix_device.c +++ b/src/device/pcix_device.c @@ -107,11 +107,11 @@ void pcix_scan_bridge(struct device *dev) 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:%02x: %s\n", dev->link_list->segment_group, - dev->link_list->secondary, pcix_speed(sstatus)); + printk(BIOS_DEBUG, "PCI: %02x:%02x: %s\n", dev->downstream->segment_group, + dev->downstream->secondary, pcix_speed(sstatus)); } /** Default device operations for PCI-X bridges */ diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c index dad791ce52..f799530d8e 100644 --- a/src/device/pnp_device.c +++ b/src/device/pnp_device.c @@ -384,7 +384,7 @@ void pnp_enable_devices(struct device *base_dev, struct device_operations *ops, 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 73ec9c1dba..c9630bb4b0 100644 --- a/src/device/resource_allocator_v4.c +++ b/src/device/resource_allocator_v4.c @@ -78,7 +78,7 @@ static void print_resource_ranges(const struct device *dev, const struct memrang 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; } @@ -122,7 +122,7 @@ static void update_bridge_resource(const struct device *bridge, struct resource 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; @@ -208,7 +208,7 @@ static void compute_bridge_resources(const struct device *bridge, unsigned long { 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) { @@ -256,10 +256,10 @@ static void compute_domain_resources(const struct device *domain) 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)) @@ -299,7 +299,7 @@ static void avoid_fixed_resources(struct memranges *ranges, const struct device memranges_create_hole(ranges, res->base, res->size); } - bus = dev->link_list; + bus = dev->downstream; if (bus == NULL) return; @@ -399,7 +399,7 @@ static void allocate_toplevel_resources(const struct device *const domain, 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; @@ -441,7 +441,7 @@ static void allocate_bridge_resources(const struct device *bridge) { 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; @@ -496,7 +496,7 @@ static void allocate_domain_resources(const struct device *domain) 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; @@ -553,10 +553,10 @@ void allocate_resources(const struct device *root) { 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 54e82ea602..0164b19e99 100644 --- a/src/device/root_device.c +++ b/src/device/root_device.c @@ -39,10 +39,10 @@ void enable_static_devices(struct device *bus) { struct device *child; - if (!bus->link_list) + if (!bus->downstream) return; - for (child = bus->link_list->children; child; child = child->sibling) + for (child = bus->downstream->children; child; child = child->sibling) enable_static_device(child); } @@ -53,12 +53,12 @@ void scan_generic_bus(struct device *bus) 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)); } } @@ -86,8 +86,8 @@ void scan_static_bus(struct device *bus) enable_static_devices(bus); - if (bus->link_list) - scan_bridges(bus->link_list); + if (bus->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 93acb1834e..76b3bc813b 100644 --- a/src/drivers/i2c/ptn3460/ptn3460.c +++ b/src/drivers/i2c/ptn3460/ptn3460.c @@ -172,8 +172,8 @@ static void ptn3460_early_init(void *unused) 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 bceb0dea4a..f313540d59 100644 --- a/src/drivers/intel/dptf/dptf.c +++ b/src/drivers/intel/dptf/dptf.c @@ -503,7 +503,7 @@ static void write_device_definitions(const struct device *dev) 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 6dba46adc7..0ad0bb86d0 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 77c86eaeb6..4044a26896 100644 --- a/src/drivers/intel/mipi_camera/camera.c +++ b/src/drivers/intel/mipi_camera/camera.c @@ -199,7 +199,7 @@ static void camera_generate_pld(const struct device *dev) 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 @@ static void camera_fill_sensor(const struct device *dev) .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 @@ static void camera_fill_ssdt(const struct device *dev) 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 @@ static void camera_fill_ssdt(const struct device *dev) 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 f9421fc81c..0137dad5b4 100644 --- a/src/drivers/intel/soundwire/soundwire.c +++ b/src/drivers/intel/soundwire/soundwire.c @@ -21,7 +21,7 @@ static bool link_enabled(const struct device *dev, unsigned int link) { 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 07110c630e..7e675001ec 100644 --- a/src/drivers/net/phy/m88e1512/m88e1512.c +++ b/src/drivers/net/phy/m88e1512/m88e1512.c @@ -21,10 +21,10 @@ static void m88e1512_init(struct device *dev) 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 @@ static void m88e1512_init(struct device *dev) /* 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 @@ static void m88e1512_init(struct device *dev) /* 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 @@ static void m88e1512_init(struct device *dev) /* 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 70a0f63d47..6d93ed2dd7 100644 --- a/src/drivers/net/r8168.c +++ b/src/drivers/net/r8168.c @@ -364,7 +364,7 @@ static void r8168_init(struct device *dev) 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 0f5ba47f08..b828657420 100644 --- a/src/drivers/nxp/uwb/uwb.c +++ b/src/drivers/nxp/uwb/uwb.c @@ -15,10 +15,10 @@ static int spi_acpi_get_bus(const struct device *dev) 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 && ops->ops_spi_bus->dev_to_bus) diff --git a/src/drivers/pcie/generic/generic.c b/src/drivers/pcie/generic/generic.c index 1b7976e6ad..e401261579 100644 --- a/src/drivers/pcie/generic/generic.c +++ b/src/drivers/pcie/generic/generic.c @@ -27,13 +27,13 @@ static void pcie_generic_fill_ssdt(const struct device *dev) 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 b58bc2daa8..537c377f7c 100644 --- a/src/drivers/spi/acpi/acpi.c +++ b/src/drivers/spi/acpi/acpi.c @@ -15,10 +15,10 @@ static int spi_acpi_get_bus(const struct device *dev) 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 e26d584a16..3944952eab 100644 --- a/src/drivers/usb/hub/acpi.c +++ b/src/drivers/usb/hub/acpi.c @@ -41,7 +41,7 @@ static void usb_hub_add_ports(const struct device *dev) 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 398595d114..47f69c046c 100644 --- a/src/drivers/usb/pci_xhci/pci_xhci.c +++ b/src/drivers/usb/pci_xhci/pci_xhci.c @@ -76,7 +76,7 @@ static const struct device *get_xhci_dev(const struct device *dev) if (is_root_device(dev)) 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 f37a084b53..6abad83f85 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -610,7 +610,7 @@ void wifi_cnvi_fill_ssdt(const struct device *dev) 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 82c96a52a8..e6ccd5d8a6 100644 --- a/src/drivers/wifi/generic/smbios.c +++ b/src/drivers/wifi/generic/smbios.c @@ -38,5 +38,5 @@ int smbios_write_wifi_pcie(struct device *dev, int *handle, unsigned long *curre 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 77ff085240..564ac03cfc 100644 --- a/src/drivers/wwan/fm/acpi_fm350gl.c +++ b/src/drivers/wwan/fm/acpi_fm350gl.c @@ -317,7 +317,7 @@ static void wwan_fm350gl_acpi_gpio_events(const struct device *dev) 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 3367cfa39f..cf29636e34 100644 --- a/src/ec/google/chromeec/ec_acpi.c +++ b/src/ec/google/chromeec/ec_acpi.c @@ -273,7 +273,7 @@ void google_chromeec_fill_ssdt_generator(const struct device *dev) 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 7e52f41a14..27ef82a8d7 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -95,8 +95,8 @@ struct bus { */ 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 */ @@ -124,11 +124,6 @@ struct device { /* 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; @@ -458,11 +453,11 @@ static inline DEVTREE_CONST void *config_of(const struct device *dev) static inline bool is_root_device(const struct device *dev) { - if (!dev || !dev->bus) + if (!dev || !dev->upstream) return false; return (dev->path.type == DEVICE_PATH_ROOT) || - (dev->bus->dev == dev); + (dev->upstream->dev == dev); } void enable_static_device(struct device *dev); diff --git a/src/include/device/pci_ops.h b/src/include/device/pci_ops.h index de5f913566..90c59fb2a0 100644 --- a/src/include/device/pci_ops.h +++ b/src/include/device/pci_ops.h @@ -12,8 +12,8 @@ void __noreturn pcidev_die(void); static __always_inline pci_devfn_t pcidev_bdf(const struct device *dev) { - return (dev->path.pci.devfn << 12) | (dev->bus->secondary << 20) | - (dev->bus->segment_group << 28); + return (dev->path.pci.devfn << 12) | (dev->upstream->secondary << 20) | + (dev->upstream->segment_group << 28); } 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 c6cfb05869..449e4fd0b5 100644 --- a/src/lib/smbios.c +++ b/src/lib/smbios.c @@ -1114,8 +1114,8 @@ static int smbios_generate_type41_from_devtree(struct device *dev, int *handle, return smbios_write_type41(current, handle, name, // name instance_id, // inst - dev->bus->segment_group, // segment group - dev->bus->secondary, //bus + dev->upstream->segment_group, // segment group + dev->upstream->secondary, //bus PCI_SLOT(dev->path.pci.devfn), // device PCI_FUNC(dev->path.pci.devfn), // func device_type); @@ -1167,8 +1167,8 @@ static int smbios_generate_type9_from_devtree(struct device *dev, int *handle, 0, 1, 0, - dev->bus->segment_group, - dev->bus->secondary, + dev->upstream->segment_group, + 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 e22b454ab5..114068fc41 100644 --- a/src/mainboard/aopen/dxplplusu/acpi_tables.c +++ b/src/mainboard/aopen/dxplplusu/acpi_tables.c @@ -11,7 +11,7 @@ unsigned long acpi_fill_madt(unsigned long current) 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 @@ unsigned long acpi_fill_madt(unsigned long current) /* 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 6c26366ad7..609e389899 100644 --- a/src/mainboard/emulation/qemu-i440fx/northbridge.c +++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c @@ -39,7 +39,7 @@ static void qemu_reserve_ports(struct device *dev, unsigned int idx, 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/brox/mainboard.c b/src/mainboard/google/brox/mainboard.c index f892099be8..5820805a97 100644 --- a/src/mainboard/google/brox/mainboard.c +++ b/src/mainboard/google/brox/mainboard.c @@ -106,7 +106,7 @@ static void mainboard_dev_init(struct device *dev) 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_wwan_shutdown(const struct device *dev) 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/brya/mainboard.c b/src/mainboard/google/brya/mainboard.c index aa332cd806..9cf56b2402 100644 --- a/src/mainboard/google/brya/mainboard.c +++ b/src/mainboard/google/brya/mainboard.c @@ -106,7 +106,7 @@ static void mainboard_dev_init(struct device *dev) 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_wwan_shutdown(const struct device *dev) 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 937a4113ce..c54b5303a5 100644 --- a/src/mainboard/google/kahlee/variants/careena/mainboard.c +++ b/src/mainboard/google/kahlee/variants/careena/mainboard.c @@ -26,7 +26,7 @@ void variant_devtree_update(void) 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 ac7f7a2729..e7a20ea414 100644 --- a/src/mainboard/google/kahlee/variants/treeya/audio.c +++ b/src/mainboard/google/kahlee/variants/treeya/audio.c @@ -25,7 +25,7 @@ void variant_devtree_update(void) } } 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 92b107479d..3392a3c990 100644 --- a/src/mainboard/google/octopus/mainboard.c +++ b/src/mainboard/google/octopus/mainboard.c @@ -179,7 +179,7 @@ static void audio_codec_device_update(void) { 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 3ca85ff77c..bf489ff528 100644 --- a/src/mainboard/google/rex/mainboard.c +++ b/src/mainboard/google/rex/mainboard.c @@ -82,7 +82,7 @@ static void mainboard_generate_s0ix_hook(void) 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 3c203f5442..a544548961 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 @@ void variant_touchscreen_update(void) 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 4ec578a7f2..a9ad7c763e 100644 --- a/src/mainboard/ibase/mb899/mptable.c +++ b/src/mainboard/ibase/mb899/mptable.c @@ -19,7 +19,7 @@ static void *smp_write_config_table(void *v) 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 @@ static void *smp_write_config_table(void *v) 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 605b8d700d..b0bfbe71c5 100644 --- a/src/mainboard/kontron/986lcd-m/mptable.c +++ b/src/mainboard/kontron/986lcd-m/mptable.c @@ -18,7 +18,7 @@ static void *smp_write_config_table(void *v) 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 @@ static void *smp_write_config_table(void *v) 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 a09fa66ee0..ac5c92871f 100644 --- a/src/mainboard/pcengines/apu2/mainboard.c +++ b/src/mainboard/pcengines/apu2/mainboard.c @@ -277,7 +277,7 @@ const char *smbios_mainboard_serial_number(void) 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 3ff339ce00..970e83d818 100644 --- a/src/mainboard/roda/rk9/ti_pci7xx1.c +++ b/src/mainboard/roda/rk9/ti_pci7xx1.c @@ -19,7 +19,7 @@ static void pci7xx1_enable(struct device *const dev) 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/fa_ehl/mainboard.c b/src/mainboard/siemens/fa_ehl/mainboard.c index 7aa0d86453..ac16346f2a 100644 --- a/src/mainboard/siemens/fa_ehl/mainboard.c +++ b/src/mainboard/siemens/fa_ehl/mainboard.c @@ -42,7 +42,7 @@ static uint8_t is_mac_adr_valid(uint8_t mac[MAC_ADDR_LEN]) */ 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 @@ enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[MAC_ADDR_L /* 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/mainboard.c b/src/mainboard/siemens/mc_apl1/mainboard.c index 0593797b11..51427be49e 100644 --- a/src/mainboard/siemens/mc_apl1/mainboard.c +++ b/src/mainboard/siemens/mc_apl1/mainboard.c @@ -55,7 +55,7 @@ static uint8_t is_mac_adr_valid(uint8_t mac[MAC_ADDR_LEN]) */ 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 @@ enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[MAC_ADDR_L /* 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 b61f32df49..c6beff65e5 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 @@ void variant_mainboard_final(void) /* 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 @@ void variant_mainboard_final(void) 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 8eedce6d6c..eda4b1bf74 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 @@ void variant_mainboard_final(void) /* 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 @@ void variant_mainboard_final(void) 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 1856a35b3c..a5fe3d7e03 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 @@ void variant_mainboard_final(void) /* 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 @@ void variant_mainboard_final(void) 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 7aa0d86453..ac16346f2a 100644 --- a/src/mainboard/siemens/mc_ehl/mainboard.c +++ b/src/mainboard/siemens/mc_ehl/mainboard.c @@ -42,7 +42,7 @@ static uint8_t is_mac_adr_valid(uint8_t mac[MAC_ADDR_LEN]) */ 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 @@ enum cb_err mainboard_get_mac_address(struct device *dev, uint8_t mac[MAC_ADDR_L /* 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 7e9cfd8d2a..b318be021d 100644 --- a/src/northbridge/amd/pi/00730F01/northbridge.c +++ b/src/northbridge/amd/pi/00730F01/northbridge.c @@ -186,7 +186,7 @@ static unsigned long add_ivhd_dev_entry(struct device *parent, struct device *de 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) { @@ -195,12 +195,12 @@ static unsigned long add_ivhd_dev_entry(struct device *parent, struct device *de 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); } @@ -243,7 +243,7 @@ static void add_ivhd_device_entries(struct device *parent, struct device *dev, 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; @@ -253,8 +253,8 @@ static void add_ivhd_device_entries(struct device *parent, struct device *dev, } } - 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); } @@ -290,12 +290,12 @@ static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_t *ivrs_a 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; ivhd_11->iommu_base_high = ivrs_agesa->ivhd.iommu_base_high; - ivhd_11->pci_segment_group = nb_dev->bus->segment_group; + ivhd_11->pci_segment_group = nb_dev->upstream->segment_group; ivhd_11->iommu_info = ivrs_agesa->ivhd.iommu_info; ivhd_11->iommu_attributes.perf_counters = (IOMMU_MMIO32(ivhd_11->iommu_base_low + 0x4000) >> 7) & 0xf; @@ -358,12 +358,12 @@ static unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current) 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; ivrs->ivhd.iommu_base_high = ivrs_agesa->ivhd.iommu_base_high; - ivrs->ivhd.pci_segment_group = nb_dev->bus->segment_group; + ivrs->ivhd.pci_segment_group = nb_dev->upstream->segment_group; ivrs->ivhd.iommu_info = ivrs_agesa->ivhd.iommu_info; ivrs->ivhd.iommu_feature_info = ivrs_agesa->ivhd.iommu_feature_info; /* Enable EFR if supported */ diff --git a/src/northbridge/intel/e7505/northbridge.c b/src/northbridge/intel/e7505/northbridge.c index fa29ef58c3..23d60dc6dd 100644 --- a/src/northbridge/intel/e7505/northbridge.c +++ b/src/northbridge/intel/e7505/northbridge.c @@ -52,7 +52,7 @@ static void mch_domain_read_resources(struct device *dev) 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 50d0d89407..dc187911c8 100644 --- a/src/northbridge/intel/gm45/northbridge.c +++ b/src/northbridge/intel/gm45/northbridge.c @@ -122,7 +122,7 @@ static void mch_domain_set_resources(struct device *dev) 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 7fe57e9edd..4eeaa3f415 100644 --- a/src/northbridge/intel/haswell/pcie.c +++ b/src/northbridge/intel/haswell/pcie.c @@ -20,8 +20,8 @@ static const char *pcie_acpi_name(const struct device *dev) 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 @@ static const char *pcie_acpi_name(const struct device *dev) 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 d5881970bf..0a72cb7d60 100644 --- a/src/northbridge/intel/i440bx/northbridge.c +++ b/src/northbridge/intel/i440bx/northbridge.c @@ -34,8 +34,8 @@ static void i440bx_domain_read_resources(struct device *dev) 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 34ebcb2481..79e9ee53b8 100644 --- a/src/northbridge/intel/i945/northbridge.c +++ b/src/northbridge/intel/i945/northbridge.c @@ -26,7 +26,7 @@ static void mch_domain_read_resources(struct device *dev) /* 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 @@ static void mch_domain_set_resources(struct device *dev) 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 d7a6c84bfa..c24493aa2b 100644 --- a/src/northbridge/intel/pineview/northbridge.c +++ b/src/northbridge/intel/pineview/northbridge.c @@ -108,7 +108,7 @@ static void mch_domain_set_resources(struct device *dev) 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 96fb12fd51..244b0f5a40 100644 --- a/src/northbridge/intel/sandybridge/pcie.c +++ b/src/northbridge/intel/sandybridge/pcie.c @@ -13,8 +13,8 @@ static const char *pcie_acpi_name(const struct device *dev) 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"; @@ -26,12 +26,12 @@ static const char *pcie_acpi_name(const struct device *dev) 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 b037cf84eb..4987cae2f1 100644 --- a/src/northbridge/intel/x4x/northbridge.c +++ b/src/northbridge/intel/x4x/northbridge.c @@ -72,7 +72,7 @@ static void mch_domain_set_resources(struct device *dev) 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 b0205c6e2a..fc1c11920e 100644 --- a/src/soc/amd/cezanne/xhci.c +++ b/src/soc/amd/cezanne/xhci.c @@ -26,10 +26,10 @@ static const struct sci_source xhci_sci_sources[] = { 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 57b5974e71..bd52d7ca6f 100644 --- a/src/soc/amd/common/block/acpi/ivrs.c +++ b/src/soc/amd/common/block/acpi/ivrs.c @@ -96,7 +96,7 @@ static unsigned long add_ivhd_dev_entry(struct device *parent, struct device *de 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) { @@ -104,12 +104,12 @@ static unsigned long add_ivhd_dev_entry(struct device *parent, struct device *de 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); } @@ -145,7 +145,7 @@ static void add_ivhd_device_entries(struct device *parent, struct device *dev, 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; @@ -154,9 +154,9 @@ static void add_ivhd_device_entries(struct device *parent, struct device *dev, 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); } @@ -173,21 +173,21 @@ static unsigned long acpi_ivhd_misc(unsigned long current, struct device *dev) * 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 */ @@ -212,11 +212,11 @@ static unsigned long acpi_fill_ivrs40(unsigned long current, acpi_ivrs_ivhd_t *i 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; - ivhd_40->pci_segment_group = nb_dev->bus->segment_group; + ivhd_40->pci_segment_group = nb_dev->upstream->segment_group; ivhd_40->iommu_info = ivhd->iommu_info; /* For type 40h bits 31:28 and 12:0 are reserved */ ivhd_40->iommu_attributes = ivhd->iommu_feature_info & 0xfffe000; @@ -230,9 +230,9 @@ static unsigned long acpi_fill_ivrs40(unsigned long current, acpi_ivrs_ivhd_t *i /* 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 @@ -269,11 +269,11 @@ static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *i 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; - ivhd_11->pci_segment_group = nb_dev->bus->segment_group; + ivhd_11->pci_segment_group = nb_dev->upstream->segment_group; ivhd_11->iommu_info = ivhd->iommu_info; ivhd11_attr_ptr = (ivhd11_iommu_attr_t *)&ivhd->iommu_feature_info; ivhd_11->iommu_attributes.perf_counters = ivhd11_attr_ptr->perf_counters; @@ -289,7 +289,7 @@ static unsigned long acpi_fill_ivrs11(unsigned long current, acpi_ivrs_ivhd_t *i /* 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); @@ -317,8 +317,8 @@ static unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current) 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__); @@ -334,7 +334,7 @@ static unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current) 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); @@ -363,7 +363,7 @@ static unsigned long acpi_fill_ivrs(acpi_ivrs_t *ivrs, unsigned long current) ivhd->flags |= ((mmio_x18_value & MMIO_CTRL_HT_TUN_EN) ? IVHD_FLAG_HT_TUN_EN : 0); - ivhd->pci_segment_group = nb_dev->bus->segment_group; + ivhd->pci_segment_group = nb_dev->upstream->segment_group; ivhd->iommu_info = pci_read_config16(iommu_dev, ivhd->capability_offset + 0x10) & 0x1F; diff --git a/src/soc/amd/common/block/data_fabric/domain.c b/src/soc/amd/common/block/data_fabric/domain.c index b827dd3fad..f17346fedf 100644 --- a/src/soc/amd/common/block/data_fabric/domain.c +++ b/src/soc/amd/common/block/data_fabric/domain.c @@ -34,12 +34,12 @@ void amd_pci_domain_scan_bus(struct device *domain) limit = MIN(limit, PCI_BUSES_PER_SEGMENT_GROUP - 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->link_list->segment_group = segment_group; + domain->downstream->max_subordinate = limit; + domain->downstream->segment_group = segment_group; pci_host_bridge_scan_bus(domain); } @@ -249,12 +249,12 @@ void amd_pci_domain_fill_ssdt(const struct device *domain) /* PCI bus number range in domain */ printk(BIOS_DEBUG, "%s _CRS: adding busses [%x-%x] in segment group %x\n", - acpi_device_name(domain), domain->link_list->secondary, - domain->link_list->max_subordinate, domain->link_list->segment_group); - acpigen_resource_producer_bus_number(domain->link_list->secondary, - domain->link_list->max_subordinate); + acpi_device_name(domain), domain->downstream->secondary, + domain->downstream->max_subordinate, domain->downstream->segment_group); + acpigen_resource_producer_bus_number(domain->downstream->secondary, + domain->downstream->max_subordinate); - if (domain->link_list->secondary == 0 && domain->link_list->segment_group == 0) { + if (domain->downstream->secondary == 0 && domain->downstream->segment_group == 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); @@ -282,7 +282,7 @@ void amd_pci_domain_fill_ssdt(const struct device *domain) } } - 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); @@ -290,9 +290,8 @@ void amd_pci_domain_fill_ssdt(const struct device *domain) acpigen_write_resourcetemplate_footer(); - acpigen_write_SEG(domain->link_list->segment_group); - acpigen_write_BBN(domain->link_list->secondary); - + acpigen_write_SEG(domain->downstream->segment_group); + 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 c076361080..a90fc3e65c 100644 --- a/src/soc/amd/common/block/lpc/lpc.c +++ b/src/soc/amd/common/block/lpc/lpc.c @@ -280,10 +280,10 @@ static void lpc_enable_children_resources(struct device *dev) { 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/genoa_poc/domain.c b/src/soc/amd/genoa_poc/domain.c index dc3745061d..57e020a4b4 100644 --- a/src/soc/amd/genoa_poc/domain.c +++ b/src/soc/amd/genoa_poc/domain.c @@ -18,7 +18,7 @@ static void genoa_domain_read_resources(struct device *domain) amd_pci_domain_read_resources(domain); // We only want to add the DRAM memory map once - if (domain->link_list->secondary == 0 && domain->link_list->segment_group == 0) { + if (domain->downstream->secondary == 0 && domain->downstream->segment_group == 0) { /* 0x1000 is a large enough first index to be sure to not overlap with the resources added by amd_pci_domain_read_resources */ add_opensil_memmap(domain, 0x1000); @@ -27,7 +27,7 @@ static void genoa_domain_read_resources(struct device *domain) static void genoa_domain_set_resources(struct device *domain) { - if (domain->link_list->bridge_ctrl & PCI_BRIDGE_CTL_VGA) { + if (domain->downstream->bridge_ctrl & PCI_BRIDGE_CTL_VGA) { printk(BIOS_DEBUG, "Setting VGA decoding for domain 0x%x\n", domain->path.domain.domain); const union df_vga_en vga_en = { diff --git a/src/soc/amd/glinda/xhci.c b/src/soc/amd/glinda/xhci.c index dad559334d..74e8816e84 100644 --- a/src/soc/amd/glinda/xhci.c +++ b/src/soc/amd/glinda/xhci.c @@ -34,13 +34,13 @@ static const struct sci_source xhci_sci_sources[] = { 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 @@ enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) *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 e5649911f4..8f46374fce 100644 --- a/src/soc/amd/mendocino/xhci.c +++ b/src/soc/amd/mendocino/xhci.c @@ -35,13 +35,13 @@ static const struct sci_source xhci_sci_sources[] = { 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 @@ enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) *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 99033f94c6..79d4d079fe 100644 --- a/src/soc/amd/phoenix/xhci.c +++ b/src/soc/amd/phoenix/xhci.c @@ -39,13 +39,13 @@ static const struct sci_source xhci_sci_sources[] = { 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 @@ enum cb_err pci_xhci_get_wake_gpe(const struct device *dev, int *gpe) } } - 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 84b3a2b82d..a238916b71 100644 --- a/src/soc/amd/picasso/xhci.c +++ b/src/soc/amd/picasso/xhci.c @@ -26,10 +26,10 @@ static const struct sci_source xhci_sci_sources[] = { 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 b95c4cdf2e..a92c3b506d 100644 --- a/src/soc/amd/stoneyridge/northbridge.c +++ b/src/soc/amd/stoneyridge/northbridge.c @@ -52,9 +52,9 @@ static void read_resources(struct device *dev) static void create_vga_resource(struct device *dev) { - 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)); @@ -67,8 +67,8 @@ static void set_resources(struct device *dev) /* do we need this? */ create_vga_resource(dev); - 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 d02e8843f2..ff3e7097ff 100644 --- a/src/soc/cavium/cn81xx/ecam0.c +++ b/src/soc/cavium/cn81xx/ecam0.c @@ -226,12 +226,12 @@ static void ecam0_init(struct device *dev) * 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 @@ static void ecam0_init(struct device *dev) /* 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 @@ static void ecam0_init(struct device *dev) /* 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 @@ static void ecam0_init(struct device *dev) /* 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 469b9be8d1..15780d0971 100644 --- a/src/soc/intel/apollolake/chip.c +++ b/src/soc/intel/apollolake/chip.c @@ -478,7 +478,7 @@ static void parse_devicetree(FSP_S_CONFIG *silconfig) 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 a0df97cdf7..2e3728057d 100644 --- a/src/soc/intel/braswell/southcluster.c +++ b/src/soc/intel/braswell/southcluster.c @@ -117,7 +117,7 @@ static void write_pci_config_irqs(void) 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 @@ static void write_pci_config_irqs(void) 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 39f95425db..a6ae454d06 100644 --- a/src/soc/intel/common/block/acpi/pep.c +++ b/src/soc/intel/common/block/acpi/pep.c @@ -144,7 +144,7 @@ static enum acpi_device_sleep_states get_min_sleep_state( 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 994ef9bcb8..dbd982b593 100644 --- a/src/soc/intel/common/block/lpc/lpc.c +++ b/src/soc/intel/common/block/lpc/lpc.c @@ -102,10 +102,10 @@ static void pch_lpc_set_child_resources(struct device *dev) { 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 39c82b11f2..3a7c8b4afc 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 @@ pcie_rtd3_acpi_method_on(unsigned int pcie_rp, 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 @@ pcie_rtd3_acpi_method_off(int pcie_rp, 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 @@ static void pcie_rtd3_acpi_fill_ssdt(const struct device *dev) 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 f2414ccb12..c066647d1a 100644 --- a/src/soc/intel/common/block/usb4/pcie.c +++ b/src/soc/intel/common/block/usb4/pcie.c @@ -19,7 +19,7 @@ static void usb4_pcie_acpi_fill_ssdt(const struct device *dev) 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 ff6fbf0957..03ed578e27 100644 --- a/src/soc/intel/common/block/xhci/xhci.c +++ b/src/soc/intel/common/block/xhci/xhci.c @@ -92,8 +92,8 @@ void usb_xhci_disable_unused(bool (*ext_usb_xhci_en_cb)(unsigned int port_type, 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 7ebca1eb94..ae923d7c0e 100644 --- a/src/soc/intel/denverton_ns/lpc.c +++ b/src/soc/intel/denverton_ns/lpc.c @@ -275,7 +275,7 @@ static u8 dnv_get_int_line(struct device *irq_dev) /* 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 @@ static void pch_pirq_init(struct device *dev) 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 c3c478544e..971fa3360d 100644 --- a/src/soc/intel/meteorlake/fsp_params.c +++ b/src/soc/intel/meteorlake/fsp_params.c @@ -760,7 +760,7 @@ static void fill_fsps_pci_ssid_params(FSP_S_CONFIG *s_cfg, 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 f471edb960..ea091ce0ac 100644 --- a/src/soc/intel/skylake/chip.c +++ b/src/soc/intel/skylake/chip.c @@ -94,7 +94,7 @@ const char *soc_acpi_name(const struct device *dev) 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 845e968a62..144dba1665 100644 --- a/src/soc/intel/xeon_sp/chip_common.c +++ b/src/soc/intel/xeon_sp/chip_common.c @@ -78,7 +78,7 @@ void iio_pci_domain_scan_bus(struct device *dev) 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); } @@ -116,14 +116,14 @@ void attach_iio_stacks(struct device *dev) if (!is_pcie_iio_stack_res(ri)) { if (CONFIG(HAVE_IOAT_DOMAINS)) - soc_create_ioat_domains(dn, dev->bus, ri); + soc_create_ioat_domains(dn, dev->upstream, ri); continue; } struct device_path path; path.type = DEVICE_PATH_DOMAIN; path.domain.domain = dn.domain_path; - 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 = &iio_pcie_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 2c19ed1198..8b24ba2b52 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 @@ void uncore_fill_ssdt(const struct device *device) struct iiostack_resource stack_info = {0}; /* Only add RTxx entries once. */ - if (device->bus->secondary != 0 || device->bus->segment_group != 0) + if (device->upstream->secondary != 0 || device->upstream->segment_group != 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 dfbd878793..2e2b14a2cc 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 @@ void uncore_fill_ssdt(const struct device *device) const IIO_UDS *hob = get_iio_uds(); /* Only add RTxx entries once. */ - if (device->bus->secondary != 0) + if (device->upstream->secondary != 0) return; for (int socket = 0, iio = 0; iio < hob->PlatformData.numofIIO; ++socket) { diff --git a/src/soc/intel/xeon_sp/spr/soc_acpi.c b/src/soc/intel/xeon_sp/spr/soc_acpi.c index cb7fe1daf1..a48302cf2e 100644 --- a/src/soc/intel/xeon_sp/spr/soc_acpi.c +++ b/src/soc/intel/xeon_sp/spr/soc_acpi.c @@ -341,7 +341,7 @@ void uncore_fill_ssdt(const struct device *device) bool stack_enabled; /* Only add RTxx entries once. */ - if (device->bus->secondary != 0) + if (device->upstream->secondary != 0) return; /* @@ -502,7 +502,7 @@ unsigned long xeonsp_acpi_create_madt_lapics(unsigned long current) 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 1b232ea208..ddc6e8206f 100644 --- a/src/soc/intel/xeon_sp/uncore.c +++ b/src/soc/intel/xeon_sp/uncore.c @@ -192,7 +192,7 @@ static void mc_add_dram_resources(struct device *dev, int *res_count) struct range_entry fsp_mem; /* Only add dram resources once. */ - if (dev->bus->secondary != 0 || dev->bus->segment_group != 0) + if (dev->upstream->secondary != 0 || dev->upstream->segment_group != 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 e2b47329ac..75b281bd8d 100644 --- a/src/soc/intel/xeon_sp/uncore_acpi.c +++ b/src/soc/intel/xeon_sp/uncore_acpi.c @@ -225,7 +225,7 @@ static unsigned long acpi_create_dmar_ds_pci_br_for_port(unsigned long current, 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 266d75c589..66ec82414f 100644 --- a/src/southbridge/amd/pi/hudson/lpc.c +++ b/src/southbridge/amd/pi/hudson/lpc.c @@ -171,8 +171,8 @@ static void hudson_lpc_enable_childrens_resources(struct device *dev) 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/southbridge/intel/bd82x6x/pcie.c b/src/southbridge/intel/bd82x6x/pcie.c index 13f16f874b..a1dd16e8cd 100644 --- a/src/southbridge/intel/bd82x6x/pcie.c +++ b/src/southbridge/intel/bd82x6x/pcie.c @@ -145,8 +145,8 @@ static void pch_pcie_pm_early(struct device *dev) * must be a static device from devicetree.cb. * If one is found assume it's an integrated device and not a PCIe slot. */ - if (dev->link_list) - child = pcidev_path_behind(dev->link_list, PCI_DEVFN(0, 0)); + if (dev->downstream) + child = pcidev_path_behind(dev->downstream, PCI_DEVFN(0, 0)); /* Set slot power limit as configured above */ reg32 = pci_read_config32(dev, cap + PCI_EXP_SLTCAP); diff --git a/src/superio/common/generic.c b/src/superio/common/generic.c index 1758accbff..92d835731e 100644 --- a/src/superio/common/generic.c +++ b/src/superio/common/generic.c @@ -13,8 +13,8 @@ static void generic_set_resources(struct device *dev) 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 @@ static void generic_ssdt(const struct device *dev) 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 @@ static void generic_ssdt(const struct device *dev) 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 47fbf0cb8e..fd55792f0a 100644 --- a/src/superio/common/ssdt.c +++ b/src/superio/common/ssdt.c @@ -161,7 +161,7 @@ static const char *name_from_hid(const char *hid) 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 @@ void superio_common_fill_ssdt_generator(const struct device *dev) /* 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/src/superio/nuvoton/npcd378/superio.c b/src/superio/nuvoton/npcd378/superio.c index a4759fb721..ddf63cdb72 100644 --- a/src/superio/nuvoton/npcd378/superio.c +++ b/src/superio/nuvoton/npcd378/superio.c @@ -356,7 +356,7 @@ static void npcd378_ssdt_pwr(const struct device *dev) /* Method (SIOH, 0, NotSerialized) */ acpigen_write_method("_L08", 0); acpigen_emit_byte(AND_OP); - acpigen_emit_namestring(acpi_device_path_join(dev->bus->dev, "PMFG")); + acpigen_emit_namestring(acpi_device_path_join(dev->upstream->dev, "PMFG")); acpigen_write_integer(0xE8); acpigen_emit_byte(LOCAL0_OP); @@ -366,13 +366,13 @@ static void npcd378_ssdt_pwr(const struct device *dev) acpigen_emit_byte(ZERO_OP); acpigen_emit_byte(NOTIFY_OP); - acpigen_emit_namestring(acpi_device_path_join(dev->bus->dev, "L060")); + acpigen_emit_namestring(acpi_device_path_join(dev->upstream->dev, "L060")); acpigen_write_integer(2); acpigen_pop_len(); /* Pop If */ acpigen_emit_byte(AND_OP); - acpigen_emit_namestring(acpi_device_path_join(dev->bus->dev, "PMFG")); + acpigen_emit_namestring(acpi_device_path_join(dev->upstream->dev, "PMFG")); acpigen_write_integer(0x10); acpigen_emit_byte(LOCAL0_OP); @@ -382,7 +382,7 @@ static void npcd378_ssdt_pwr(const struct device *dev) acpigen_emit_byte(ZERO_OP); acpigen_emit_byte(NOTIFY_OP); - acpigen_emit_namestring(acpi_device_path_join(dev->bus->dev, "L050")); + acpigen_emit_namestring(acpi_device_path_join(dev->upstream->dev, "L050")); acpigen_write_integer(2); acpigen_pop_len(); /* Pop If */ diff --git a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c index 9e9e886034..50e96c99e9 100644 --- a/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c +++ b/src/vendorcode/amd/opensil/genoa_poc/mpio/chip.c @@ -129,7 +129,7 @@ static void per_device_config(MPIOCLASS_INPUT_BLK *mpio_data, struct device *dev struct vendorcode_amd_opensil_genoa_poc_mpio_config *const config) { static uint32_t slot_num; - const uint32_t domain = dev->bus->dev->path.domain.domain; + const uint32_t domain = dev->upstream->dev->path.domain.domain; const uint32_t devfn = dev->path.pci.devfn; printk(BIOS_DEBUG, "Setting MPIO port for domain 0x%x, PCI %d:%d\n", domain, PCI_SLOT(devfn), PCI_FUNC(devfn)); @@ -189,6 +189,6 @@ void configure_mpio(void) /* Find all devices with this chip that are directly below the chip */ for (struct device *dev = &dev_root; dev; dev = dev->next) if (dev->chip_ops == &vendorcode_amd_opensil_genoa_poc_mpio_ops && - dev->chip_info != dev->bus->dev->chip_info) - per_device_config(mpio_data, dev->bus->dev, dev->chip_info); + dev->chip_info != dev->upstream->dev->chip_info) + per_device_config(mpio_data, dev->upstream->dev, dev->chip_info); } |