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>
This commit is contained in:
Arthur Heymans
2023-08-24 15:12:19 +02:00
committed by Felix Held
parent 3138faa7cf
commit 7fcd4d58ec
104 changed files with 343 additions and 348 deletions

View File

@@ -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);

View File

@@ -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)

View File

@@ -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"));

View File

@@ -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"));

View File

@@ -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)

View File

@@ -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)

View File

@@ -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))) {

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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. */

View File

@@ -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. */

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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. */