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/device | |
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/device')
-rw-r--r-- | src/device/cardbus_device.c | 2 | ||||
-rw-r--r-- | src/device/device.c | 50 | ||||
-rw-r--r-- | src/device/device_const.c | 16 | ||||
-rw-r--r-- | src/device/device_util.c | 49 | ||||
-rw-r--r-- | src/device/i2c_bus.c | 8 | ||||
-rw-r--r-- | src/device/mdio.c | 4 | ||||
-rw-r--r-- | src/device/oprom/realmode/x86.c | 2 | ||||
-rw-r--r-- | src/device/oprom/realmode/x86_interrupts.c | 2 | ||||
-rw-r--r-- | src/device/oprom/yabel/device.c | 2 | ||||
-rw-r--r-- | src/device/oprom/yabel/interrupt.c | 2 | ||||
-rw-r--r-- | src/device/pci_device.c | 46 | ||||
-rw-r--r-- | src/device/pci_rom.c | 4 | ||||
-rw-r--r-- | src/device/pciexp_device.c | 10 | ||||
-rw-r--r-- | src/device/pcix_device.c | 6 | ||||
-rw-r--r-- | src/device/pnp_device.c | 2 | ||||
-rw-r--r-- | src/device/resource_allocator_v4.c | 22 | ||||
-rw-r--r-- | src/device/root_device.c | 16 |
17 files changed, 122 insertions, 121 deletions
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)); } |