Add hotplug_buses to device struct to allow removal of hack
This commit is contained in:
@@ -1217,13 +1217,15 @@ static void pci_bridge_route(struct bus *link, scan_state state)
|
|||||||
|
|
||||||
if (state == PCI_ROUTE_SCAN) {
|
if (state == PCI_ROUTE_SCAN) {
|
||||||
link->secondary = parent->subordinate + 1;
|
link->secondary = parent->subordinate + 1;
|
||||||
link->subordinate = link->secondary;
|
link->subordinate = link->secondary + dev->hotplug_buses;
|
||||||
|
printk(
|
||||||
if (dev->vendor == 0x8086 && dev->device == 0x15e7 && PCI_SLOT(dev->path.pci.devfn) == 1) {
|
BIOS_DEBUG,
|
||||||
printk(BIOS_DEBUG, "system76: HACK: add 32 to subordinate\n");
|
"system76: %s: %s: assigning link secondary %d subordinate %d\n",
|
||||||
link->subordinate += 32;
|
__func__,
|
||||||
}
|
dev_path(dev),
|
||||||
printk(BIOS_DEBUG, "system76: pci_bridge_route: assigning link secondary %d subordinate %d\n", link->secondary, link->subordinate);
|
link->secondary,
|
||||||
|
link->subordinate
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state == PCI_ROUTE_CLOSE) {
|
if (state == PCI_ROUTE_CLOSE) {
|
||||||
@@ -1259,7 +1261,13 @@ static void pci_bridge_route(struct bus *link, scan_state state)
|
|||||||
if (state == PCI_ROUTE_FINAL) {
|
if (state == PCI_ROUTE_FINAL) {
|
||||||
pci_write_config16(dev, PCI_COMMAND, link->bridge_cmd);
|
pci_write_config16(dev, PCI_COMMAND, link->bridge_cmd);
|
||||||
parent->subordinate = link->subordinate;
|
parent->subordinate = link->subordinate;
|
||||||
printk(BIOS_DEBUG, "system76: pci_bridge_route: assigning link subordinate %d\n", link->subordinate);
|
printk(
|
||||||
|
BIOS_DEBUG,
|
||||||
|
"system76: %s: %s: assigning parent subordinate %d\n",
|
||||||
|
__func__,
|
||||||
|
dev_path(dev),
|
||||||
|
parent->subordinate
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,15 +52,26 @@ static struct device_operations slot_dev_ops = {
|
|||||||
.read_resources = slot_dev_read_resources,
|
.read_resources = slot_dev_read_resources,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool tbt_is_hotplug_bridge(struct device *dev) {
|
||||||
|
return PCI_SLOT(dev->path.pci.devfn) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void tbt_pciexp_scan_bridge(struct device *dev) {
|
static void tbt_pciexp_scan_bridge(struct device *dev) {
|
||||||
printk(BIOS_DEBUG, "tbt_pciexp_scan_bridge %s: scan bridge\n", dev_path(dev));
|
printk(BIOS_DEBUG, "%s: %s: scan bridge\n", __func__, dev_path(dev));
|
||||||
|
|
||||||
|
bool is_hotplug = tbt_is_hotplug_bridge(dev);
|
||||||
|
if (is_hotplug) {
|
||||||
|
/* Add hotplug buses, must happen before bus scan */
|
||||||
|
printk(BIOS_DEBUG, "%s: %s: add hotplug buses\n", __func__, dev_path(dev));
|
||||||
|
dev->hotplug_buses = 32;
|
||||||
|
}
|
||||||
|
|
||||||
/* Normal PCIe Scan */
|
/* Normal PCIe Scan */
|
||||||
pciexp_scan_bridge(dev);
|
pciexp_scan_bridge(dev);
|
||||||
|
|
||||||
/* Add dummy slot to preserve resources */
|
if (is_hotplug) {
|
||||||
if (PCI_SLOT(dev->path.pci.devfn) == 1) {
|
/* Add dummy slot to preserve resources, must happen after bus scan */
|
||||||
printk(BIOS_DEBUG, "tbt_pciexp_scan_bridge %s: add dummy device\n", dev_path(dev));
|
printk(BIOS_DEBUG, "%s: %s: add dummy device\n", __func__, dev_path(dev));
|
||||||
struct device *slot;
|
struct device *slot;
|
||||||
struct device_path slot_path = { .type = DEVICE_PATH_NONE };
|
struct device_path slot_path = { .type = DEVICE_PATH_NONE };
|
||||||
slot = alloc_dev(dev->link_list, &slot_path);
|
slot = alloc_dev(dev->link_list, &slot_path);
|
||||||
|
@@ -129,6 +129,7 @@ struct device {
|
|||||||
unsigned int disable_pcie_aspm : 1;
|
unsigned int disable_pcie_aspm : 1;
|
||||||
unsigned int hidden : 1; /* set if we should hide from UI */
|
unsigned int hidden : 1; /* set if we should hide from UI */
|
||||||
u8 command;
|
u8 command;
|
||||||
|
uint16_t hotplug_buses; /* hotplug buses to allocate */
|
||||||
|
|
||||||
/* Base registers for this device. I/O, MEM and Expansion ROM */
|
/* Base registers for this device. I/O, MEM and Expansion ROM */
|
||||||
DEVTREE_CONST struct resource *resource_list;
|
DEVTREE_CONST struct resource *resource_list;
|
||||||
|
Reference in New Issue
Block a user