diff --git a/src/device/pci_device.c b/src/device/pci_device.c index 77f0190b85..b5dd256031 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -1254,6 +1254,7 @@ static void pci_bridge_route(struct bus *link, scan_state state) if (state == PCI_ROUTE_FINAL) { pci_write_config16(dev, PCI_COMMAND, link->bridge_cmd); parent->subordinate = link->subordinate; + printk(BIOS_DEBUG, "system76: pci_bridge_route: assigning link subordinate %d\n", link->subordinate); } } diff --git a/src/drivers/thunderbolt/thunderbolt.c b/src/drivers/thunderbolt/thunderbolt.c index 9527ce1118..c1ef3c7bb3 100644 --- a/src/drivers/thunderbolt/thunderbolt.c +++ b/src/drivers/thunderbolt/thunderbolt.c @@ -22,47 +22,50 @@ #include #include -// static void slot_dev_read_resources(struct device *dev) -// { -// struct resource *resource; -// -// resource = new_resource(dev, 0x10); -// resource->size = 1 << 28; -// resource->align = 22; -// resource->gran = 22; -// resource->limit = 0xffffffff; -// resource->flags |= IORESOURCE_MEM; -// -// resource = new_resource(dev, 0x14); -// resource->size = 1 << 28; -// resource->align = 22; -// resource->gran = 22; -// resource->limit = 0xffffffff; -// resource->flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH; -// -// resource = new_resource(dev, 0x18); -// resource->size = 1 << 13; -// resource->align = 12; -// resource->gran = 12; -// resource->limit = 0xffff; -// resource->flags |= IORESOURCE_IO; -// } -// -// static struct device_operations slot_dev_ops = { -// .read_resources = slot_dev_read_resources, -// }; +static void slot_dev_read_resources(struct device *dev) +{ + struct resource *resource; + + resource = new_resource(dev, 0x10); + resource->size = 1 << 28; + resource->align = 22; + resource->gran = 22; + resource->limit = 0xffffffff; + resource->flags |= IORESOURCE_MEM; + + resource = new_resource(dev, 0x14); + resource->size = 1 << 28; + resource->align = 22; + resource->gran = 22; + resource->limit = 0xffffffff; + resource->flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH; + + resource = new_resource(dev, 0x18); + resource->size = 1 << 13; + resource->align = 12; + resource->gran = 12; + resource->limit = 0xffff; + resource->flags |= IORESOURCE_IO; +} + +static struct device_operations slot_dev_ops = { + .read_resources = slot_dev_read_resources, +}; static void tbt_pciexp_scan_bridge(struct device *dev) { - printk(BIOS_DEBUG, "tbt_pciexp_scan_bridge %s\n", dev_path(dev)); + printk(BIOS_DEBUG, "tbt_pciexp_scan_bridge %s: scan bridge\n", dev_path(dev)); /* Normal PCIe Scan */ pciexp_scan_bridge(dev); /* Add dummy slot to preserve resources */ - // struct device *slot; - // struct device_path slot_path = { .type = DEVICE_PATH_NONE }; - // slot = alloc_dev(dev->link_list, &slot_path); - // slot->ops = &slot_dev_ops; + if (PCI_SLOT(dev->path.pci.devfn) == 1) { + printk(BIOS_DEBUG, "tbt_pciexp_scan_bridge %s: add dummy device\n", dev_path(dev)); + struct device *slot; + struct device_path slot_path = { .type = DEVICE_PATH_NONE }; + slot = alloc_dev(dev->link_list, &slot_path); + slot->ops = &slot_dev_ops; + } } static struct pci_operations pcie_ops = {