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>
diff --git a/src/device/cardbus_device.c b/src/device/cardbus_device.c
index 23f24dd..2eb070e 100644
--- a/src/device/cardbus_device.c
+++ b/src/device/cardbus_device.c
@@ -119,7 +119,7 @@
 	u16 ctrl;
 
 	ctrl = pci_read_config16(dev, PCI_CB_BRIDGE_CONTROL);
-	ctrl |= (dev->link_list->bridge_ctrl & (
+	ctrl |= (dev->downstream->bridge_ctrl & (
 			PCI_BRIDGE_CTL_VGA |
 			PCI_BRIDGE_CTL_MASTER_ABORT |
 			PCI_BRIDGE_CTL_BUS_RESET));
diff --git a/src/device/device.c b/src/device/device.c
index 743a3af..72a408e 100644
--- a/src/device/device.c
+++ b/src/device/device.c
@@ -101,7 +101,7 @@
 	dev->enabled = 1;
 
 	/* Add the new device to the list of children of the bus. */
-	dev->bus = parent;
+	dev->upstream = parent;
 	if (child)
 		child->sibling = dev;
 	else
@@ -139,13 +139,13 @@
  */
 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 @@
 		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 @@
 			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 @@
 		/* 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 @@
 		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 @@
 	}
 
 	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 @@
 
 	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 @@
 		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 @@
 	/* 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 @@
 	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 @@
 		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 @@
 	}
 
 	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 @@
 	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 @@
 		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 @@
 	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 c91c009..0521c7e 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -34,8 +34,8 @@
 	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 @@
 	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 @@
 			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 @@
 	if (!pci_domain)
 		return NULL;
 
-	pci_root = pci_domain->link_list;
+	pci_root = pci_domain->downstream;
 	return pci_root;
 }
 
@@ -277,7 +277,7 @@
 		return NULL;
 	}
 
-	return pcidev_path_behind(bridge->link_list, devfn);
+	return pcidev_path_behind(bridge->downstream, devfn);
 }
 
 DEVTREE_CONST struct device *pcidev_path_on_root_debug(pci_devfn_t devfn, const char *func)
@@ -317,7 +317,7 @@
 	result = 0;
 	for (dev = all_devices; dev; dev = dev->next) {
 		if ((dev->path.type == DEVICE_PATH_I2C) &&
-		    (dev->bus->secondary == bus) &&
+		    (dev->upstream->secondary == bus) &&
 		    (dev->path.i2c.device == addr)) {
 			result = dev;
 			break;
diff --git a/src/device/device_util.c b/src/device/device_util.c
index ea4ef27..b5d0d98 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -97,7 +97,7 @@
 	case DEVICE_PATH_ROOT:
 		break;
 	case DEVICE_PATH_PCI:
-		ret |= dev->bus->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 @@
 		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 @@
 			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 @@
 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 @@
 	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 @@
 
 			/* 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 @@
 	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 @@
 	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 @@
 	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 @@
 			  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 @@
 	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 @@
 
 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 @@
 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_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 1d4aa2d..41ef14a 100644
--- a/src/device/i2c_bus.c
+++ b/src/device/i2c_bus.c
@@ -18,10 +18,10 @@
 
 struct bus *i2c_link(const struct device *const dev)
 {
-	if (!dev || !dev->bus)
+	if (!dev || !dev->upstream)
 		return NULL;
 
-	struct bus *link = dev->bus;
+	struct bus *link = dev->upstream;
 	while (link) {
 		struct device *const parent = link->dev;
 
@@ -29,8 +29,8 @@
 		    (parent->ops->ops_i2c_bus || parent->ops->ops_smbus_bus))
 			break;
 
-		if (parent && parent->bus && link != parent->bus)
-			link = parent->bus;
+		if (parent && parent->upstream && link != parent->upstream)
+			link = parent->upstream;
 		else
 			link = NULL;
 	}
diff --git a/src/device/mdio.c b/src/device/mdio.c
index 39ac40b..89da60b 100644
--- a/src/device/mdio.c
+++ b/src/device/mdio.c
@@ -19,7 +19,7 @@
 uint16_t mdio_read(struct device *dev, uint8_t offset)
 {
 	const struct mdio_bus_operations *mdio_ops;
-	struct device *parent = dev->bus->dev;
+	struct device *parent = dev->upstream->dev;
 
 	assert(dev->path.type == DEVICE_PATH_MDIO);
 	mdio_ops = dev_get_mdio_ops(parent);
@@ -30,7 +30,7 @@
 void mdio_write(struct device *dev, uint8_t offset, uint16_t val)
 {
 	const struct mdio_bus_operations *mdio_ops;
-	struct device *parent = dev->bus->dev;
+	struct device *parent = dev->upstream->dev;
 
 	assert(dev->path.type == DEVICE_PATH_MDIO);
 	mdio_ops = dev_get_mdio_ops(parent);
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c
index 367614d..c3adf40 100644
--- a/src/device/oprom/realmode/x86.c
+++ b/src/device/oprom/realmode/x86.c
@@ -415,7 +415,7 @@
 
 void run_bios(struct device *dev, unsigned long addr)
 {
-	u32 num_dev = (dev->bus->secondary << 8) | dev->path.pci.devfn;
+	u32 num_dev = (dev->upstream->secondary << 8) | dev->path.pci.devfn;
 
 	/* Setting up required hardware.
 	 * Removing this will cause random illegal instruction exceptions
diff --git a/src/device/oprom/realmode/x86_interrupts.c b/src/device/oprom/realmode/x86_interrupts.c
index 945052b..71fc1d5 100644
--- a/src/device/oprom/realmode/x86_interrupts.c
+++ b/src/device/oprom/realmode/x86_interrupts.c
@@ -138,7 +138,7 @@
 			X86_EAX |= PCIBIOS_SUCCESSFUL;
 			// busnum is an unsigned char;
 			// devfn is an int, so we mask it off.
-			busdevfn = (dev->bus->secondary << 8)
+			busdevfn = (dev->upstream->secondary << 8)
 			    | (dev->path.pci.devfn & 0xff);
 			printk(BIOS_DEBUG, "0x%x: return 0x%x\n", func, busdevfn);
 			X86_EBX = busdevfn;
diff --git a/src/device/oprom/yabel/device.c b/src/device/oprom/yabel/device.c
index 2c98578..d1dc801 100644
--- a/src/device/oprom/yabel/device.c
+++ b/src/device/oprom/yabel/device.c
@@ -65,7 +65,7 @@
 {
 	int taa_index = 0;
 	struct resource *r;
-	u8 bus = bios_device.dev->bus->secondary;
+	u8 bus = bios_device.dev->upstream->secondary;
 	u16 devfn = bios_device.dev->path.pci.devfn;
 
 	bios_device.bus =  bus;
diff --git a/src/device/oprom/yabel/interrupt.c b/src/device/oprom/yabel/interrupt.c
index 968e471..e78a3cb 100644
--- a/src/device/oprom/yabel/interrupt.c
+++ b/src/device/oprom/yabel/interrupt.c
@@ -375,7 +375,7 @@
 		} else if (CONFIG(YABEL_PCI_ACCESS_OTHER_DEVICES)) {
 			dev = dev_find_device(M.x86.R_DX, M.x86.R_CX, 0);
 			if (dev != NULL) {
-				M.x86.R_BH = dev->bus->secondary;
+				M.x86.R_BH = dev->upstream->secondary;
 				M.x86.R_BL = dev->path.pci.devfn;
 				DEBUG_PRINTF_INTR
 				    ("%s(): function %x: PCI Find Device --> 0x%04x\n",
diff --git a/src/device/pci_device.c b/src/device/pci_device.c
index 24b9523..8ead8a5 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -585,7 +585,7 @@
 
 void pci_domain_set_resources(struct device *dev)
 {
-	assign_resources(dev->link_list);
+	assign_resources(dev->downstream);
 }
 
 static void pci_store_resource(const struct device *const dev,
@@ -718,8 +718,8 @@
 	for (res = dev->resource_list; res; res = res->next)
 		pci_set_resource(dev, res);
 
-	if (dev->link_list && dev->link_list->children)
-		assign_resources(dev->link_list);
+	if (dev->downstream && dev->downstream->children)
+		assign_resources(dev->downstream);
 
 	/* Set a default latency timer. */
 	pci_write_config8(dev, PCI_LATENCY_TIMER, 0x40);
@@ -782,10 +782,10 @@
 	 * Enable I/O in command register if there is VGA card
 	 * connected with (even it does not claim I/O resource).
 	 */
-	if (dev->link_list->bridge_ctrl & PCI_BRIDGE_CTL_VGA)
+	if (dev->downstream->bridge_ctrl & PCI_BRIDGE_CTL_VGA)
 		dev->command |= PCI_COMMAND_IO;
 	ctrl = pci_read_config16(dev, PCI_BRIDGE_CONTROL);
-	ctrl |= dev->link_list->bridge_ctrl;
+	ctrl |= dev->downstream->bridge_ctrl;
 	ctrl |= (PCI_BRIDGE_CTL_PARITY | PCI_BRIDGE_CTL_SERR); /* Error check. */
 	printk(BIOS_DEBUG, "%s bridge ctrl <- %04x\n", dev_path(dev), ctrl);
 	pci_write_config16(dev, PCI_BRIDGE_CONTROL, ctrl);
@@ -843,7 +843,7 @@
 {
 	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 @@
 	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 @@
 	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 @@
  */
 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 @@
  */
 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 @@
 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 @@
 
 	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_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 @@
 
 	/* 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 @@
 	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 cc1e5d1..1e212ab 100644
--- a/src/device/pci_rom.c
+++ b/src/device/pci_rom.c
@@ -230,7 +230,7 @@
 		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 @@
 
 	header->DeviceID = device->device;
 	header->VendorID = device->vendor;
-	header->PCIBus = device->bus->secondary;
+	header->PCIBus = device->upstream->secondary;
 	header->PCIFunction = PCI_FUNC(device->path.pci.devfn);
 	header->PCIDevice = PCI_SLOT(device->path.pci.devfn);
 	header->ImageLength = rom->size * 512;
diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c
index ab8430f..969dbb00 100644
--- a/src/device/pciexp_device.c
+++ b/src/device/pciexp_device.c
@@ -302,7 +302,7 @@
 	struct device *parent = NULL;
 	unsigned int parent_cap = 0;
 	if (!dev->ops->ops_pci || !dev->ops->ops_pci->get_ltr_max_latencies) {
-		parent = dev->bus->dev;
+		parent = dev->upstream->dev;
 		if (parent->path.type != DEVICE_PATH_PCI)
 			return;
 		parent_cap = pci_find_capability(parent, PCI_CAP_ID_PCIE);
@@ -319,9 +319,9 @@
 	do {
 		if (dev->ops->ops_pci && dev->ops->ops_pci->get_ltr_max_latencies)
 			break;
-		if (dev->bus->dev == dev || dev->bus->dev->path.type != DEVICE_PATH_PCI)
+		if (dev->upstream->dev == dev || dev->upstream->dev->path.type != DEVICE_PATH_PCI)
 			return false;
-		dev = dev->bus->dev;
+		dev = dev->upstream->dev;
 	} while (true);
 
 	dev->ops->ops_pci->get_ltr_max_latencies(max_snoop, max_nosnoop);
@@ -627,7 +627,7 @@
 
 static void pciexp_tune_dev(struct device *dev)
 {
-	struct device *root = dev->bus->dev;
+	struct device *root = dev->upstream->dev;
 	unsigned int root_cap, cap;
 
 	cap = pci_find_capability(dev, PCI_CAP_ID_PCIE);
@@ -752,7 +752,7 @@
 	/* Add dummy slot to preserve resources, must happen after bus scan */
 	struct device *dummy;
 	struct device_path dummy_path = { .type = DEVICE_PATH_NONE };
-	dummy = alloc_dev(dev->link_list, &dummy_path);
+	dummy = alloc_dev(dev->downstream, &dummy_path);
 	dummy->ops = &pciexp_hotplug_dummy_ops;
 }
 
diff --git a/src/device/pcix_device.c b/src/device/pcix_device.c
index e40ed3b..7ddc15d 100644
--- a/src/device/pcix_device.c
+++ b/src/device/pcix_device.c
@@ -107,11 +107,11 @@
 	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 dad791c..f799530 100644
--- a/src/device/pnp_device.c
+++ b/src/device/pnp_device.c
@@ -384,7 +384,7 @@
 			continue;
 
 		path.pnp.device = info[i].function;
-		dev = alloc_find_dev(base_dev->bus, &path);
+		dev = alloc_find_dev(base_dev->upstream, &path);
 
 		/* Don't initialize a device multiple times. */
 		if (dev->ops)
diff --git a/src/device/resource_allocator_v4.c b/src/device/resource_allocator_v4.c
index 73ec9c1..c9630bb 100644
--- a/src/device/resource_allocator_v4.c
+++ b/src/device/resource_allocator_v4.c
@@ -78,7 +78,7 @@
 
 static bool dev_has_children(const struct device *dev)
 {
-	const struct bus *bus = dev->link_list;
+	const struct bus *bus = dev->downstream;
 	return bus && bus->children;
 }
 
@@ -122,7 +122,7 @@
 	resource_t base;
 	const unsigned long type_mask = IORESOURCE_TYPE_MASK | IORESOURCE_PREFETCH;
 	const unsigned long type_match = bridge_res->flags & type_mask;
-	struct bus *bus = bridge->link_list;
+	struct bus *bus = bridge->downstream;
 
 	child_res = NULL;
 
@@ -208,7 +208,7 @@
 {
 	const struct device *child;
 	struct resource *res;
-	struct bus *bus = bridge->link_list;
+	struct bus *bus = bridge->downstream;
 	const unsigned long type_mask = IORESOURCE_TYPE_MASK | IORESOURCE_PREFETCH;
 
 	for (res = bridge->resource_list; res; res = res->next) {
@@ -256,10 +256,10 @@
 	const struct device *child;
 	const int print_depth = 1;
 
-	if (domain->link_list == NULL)
+	if (domain->downstream == NULL)
 		return;
 
-	for (child = domain->link_list->children; child; child = child->sibling) {
+	for (child = domain->downstream->children; child; child = child->sibling) {
 
 		/* Skip if this is not a bridge or has no children under it. */
 		if (!dev_has_children(child))
@@ -299,7 +299,7 @@
 		memranges_create_hole(ranges, res->base, res->size);
 	}
 
-	bus = dev->link_list;
+	bus = dev->downstream;
 	if (bus == NULL)
 		return;
 
@@ -399,7 +399,7 @@
 
 	setup_resource_ranges(domain, type, &ranges);
 
-	while ((dev = largest_resource(domain->link_list, &res, type_mask, type))) {
+	while ((dev = largest_resource(domain->downstream, &res, type_mask, type))) {
 
 		if (!res->size)
 			continue;
@@ -441,7 +441,7 @@
 {
 	const unsigned long type_mask =
 		IORESOURCE_TYPE_MASK | IORESOURCE_PREFETCH | IORESOURCE_FIXED;
-	struct bus *const bus = bridge->link_list;
+	struct bus *const bus = bridge->downstream;
 	struct resource *res;
 	struct device *child;
 
@@ -496,7 +496,7 @@
 	allocate_toplevel_resources(domain, IORESOURCE_MEM);
 
 	struct device *child;
-	for (child = domain->link_list->children; child; child = child->sibling) {
+	for (child = domain->downstream->children; child; child = child->sibling) {
 		if (!dev_has_children(child))
 			continue;
 
@@ -553,10 +553,10 @@
 {
 	const struct device *child;
 
-	if ((root == NULL) || (root->link_list == NULL))
+	if ((root == NULL) || (root->downstream == NULL))
 		return;
 
-	for (child = root->link_list->children; child; child = child->sibling) {
+	for (child = root->downstream->children; child; child = child->sibling) {
 
 		if (child->path.type != DEVICE_PATH_DOMAIN)
 			continue;
diff --git a/src/device/root_device.c b/src/device/root_device.c
index 54e82ea..0164b19 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -39,10 +39,10 @@
 {
 	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 @@
 
 	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 @@
 
 	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));
 }