Merge branch 'upstream-35946' into system76
This commit is contained in:
@ -555,6 +555,43 @@ config PCIEXP_HOTPLUG
|
||||
help
|
||||
Allocate resources for PCIe hotplug bridges
|
||||
|
||||
if PCIEXP_HOTPLUG
|
||||
|
||||
config PCIEXP_HOTPLUG_BUSES
|
||||
int "PCI Express Hotplug Buses"
|
||||
default 32
|
||||
help
|
||||
This is the number of buses allocated for hotplug PCI express
|
||||
bridges, for use by hotplugged child devices. The default is 32
|
||||
buses.
|
||||
|
||||
config PCIEXP_HOTPLUG_MEM
|
||||
hex "PCI Express Hotplug Memory"
|
||||
default 0x800000
|
||||
help
|
||||
This is the amount of memory space, in bytes, to allocate to
|
||||
hotplug PCI express bridges, for use by hotplugged child devices.
|
||||
This size should be page-aligned. The default is 8 MiB.
|
||||
|
||||
config PCIEXP_HOTPLUG_PREFETCH_MEM
|
||||
hex "PCI Express Hotplug Prefetch Memory"
|
||||
default 0x10000000
|
||||
help
|
||||
This is the amount of pre-fetchable memory space, in bytes, to
|
||||
allocate to hot-plug PCI express bridges, for use by hotplugged
|
||||
child devices. This size should be page-aligned. The default is
|
||||
256 MiB.
|
||||
|
||||
config PCIEXP_HOTPLUG_IO
|
||||
hex "PCI Express Hotplug I/O Space"
|
||||
default 0x2000
|
||||
help
|
||||
This is the amount of I/O space to allocate to hot-plug PCI
|
||||
express bridges, for use by hotplugged child devices. The default
|
||||
is 8 KiB.
|
||||
|
||||
endif # PCIEXP_HOTPLUG
|
||||
|
||||
endif # PCIEXP_PLUGIN_SUPPORT
|
||||
|
||||
config EARLY_PCI_BRIDGE
|
||||
|
@ -870,10 +870,8 @@ static struct device_operations *get_pci_bridge_ops(struct device *dev)
|
||||
unsigned int pciexpos;
|
||||
pciexpos = pci_find_capability(dev, PCI_CAP_ID_PCIE);
|
||||
if (pciexpos) {
|
||||
u16 flags, sltcap;
|
||||
u16 flags;
|
||||
flags = pci_read_config16(dev, pciexpos + PCI_EXP_FLAGS);
|
||||
sltcap = pci_read_config16(dev, pciexpos + PCI_EXP_SLTCAP);
|
||||
printk(BIOS_DEBUG, "%s sltcap %x\n", dev_path(dev), sltcap);
|
||||
switch ((flags & PCI_EXP_FLAGS_TYPE) >> 4) {
|
||||
case PCI_EXP_TYPE_ROOT_PORT:
|
||||
case PCI_EXP_TYPE_UPSTREAM:
|
||||
@ -881,10 +879,12 @@ static struct device_operations *get_pci_bridge_ops(struct device *dev)
|
||||
printk(BIOS_DEBUG, "%s subordinate bus PCI Express\n",
|
||||
dev_path(dev));
|
||||
#if CONFIG(PCIEXP_HOTPLUG)
|
||||
u16 sltcap;
|
||||
sltcap = pci_read_config16(dev, pciexpos + PCI_EXP_SLTCAP);
|
||||
if (sltcap & PCI_EXP_SLTCAP_HPC) {
|
||||
printk(BIOS_DEBUG, "%s hot-plug capable\n", dev_path(dev));
|
||||
return &default_pciexp_hotplug_ops_bus;
|
||||
} else
|
||||
}
|
||||
#endif /* CONFIG(PCIEXP_HOTPLUG) */
|
||||
return &default_pciexp_ops_bus;
|
||||
case PCI_EXP_TYPE_PCI_BRIDGE:
|
||||
|
@ -476,10 +476,6 @@ struct device_operations default_pciexp_ops_bus = {
|
||||
};
|
||||
|
||||
#if CONFIG(PCIEXP_HOTPLUG)
|
||||
#define PCIEXP_HOTPLUG_BUSES 32
|
||||
#define PCIEXP_HOTPLUG_MEM (8 * 1024 * 1024)
|
||||
#define PCIEXP_HOTPLUG_PREFETCH_MEM (256 * 1024 * 1024)
|
||||
#define PCIEXP_HOTPLUG_IO (8 * 1024)
|
||||
|
||||
static void pciexp_hotplug_dummy_read_resources(struct device *dev)
|
||||
{
|
||||
@ -487,30 +483,27 @@ static void pciexp_hotplug_dummy_read_resources(struct device *dev)
|
||||
|
||||
// Add extra memory space
|
||||
resource = new_resource(dev, 0x10);
|
||||
resource->size = PCIEXP_HOTPLUG_MEM;
|
||||
resource->align = 22;
|
||||
resource->gran = 22;
|
||||
resource->size = CONFIG_PCIEXP_HOTPLUG_MEM;
|
||||
resource->align = 12;
|
||||
resource->gran = 12;
|
||||
resource->limit = 0xffffffff;
|
||||
resource->flags |= IORESOURCE_MEM;
|
||||
printk(BIOS_DEBUG, "%s: add 0x%llx of memory space\n", __func__, resource->size);
|
||||
|
||||
// Add extra prefetchable memory space
|
||||
resource = new_resource(dev, 0x14);
|
||||
resource->size = PCIEXP_HOTPLUG_PREFETCH_MEM;
|
||||
resource->align = 22;
|
||||
resource->gran = 22;
|
||||
resource->size = CONFIG_PCIEXP_HOTPLUG_PREFETCH_MEM;
|
||||
resource->align = 12;
|
||||
resource->gran = 12;
|
||||
resource->limit = 0xffffffffffffffff;
|
||||
resource->flags |= IORESOURCE_MEM | IORESOURCE_PREFETCH;
|
||||
printk(BIOS_DEBUG, "%s: add 0x%llx of prefetch memory space\n", __func__, resource->size);
|
||||
|
||||
// Add extra I/O space
|
||||
resource = new_resource(dev, 0x18);
|
||||
resource->size = PCIEXP_HOTPLUG_IO;
|
||||
resource->size = CONFIG_PCIEXP_HOTPLUG_IO;
|
||||
resource->align = 12;
|
||||
resource->gran = 12;
|
||||
resource->limit = 0xffff;
|
||||
resource->flags |= IORESOURCE_IO;
|
||||
printk(BIOS_DEBUG, "%s: add 0x%llx of I/O space\n", __func__, resource->size);
|
||||
}
|
||||
|
||||
static struct device_operations pciexp_hotplug_dummy_ops = {
|
||||
@ -519,23 +512,12 @@ static struct device_operations pciexp_hotplug_dummy_ops = {
|
||||
|
||||
void pciexp_hotplug_scan_bridge(struct device *dev)
|
||||
{
|
||||
dev->hotplug_buses = PCIEXP_HOTPLUG_BUSES;
|
||||
printk(
|
||||
BIOS_DEBUG,
|
||||
"%s set hotplug_buses to %d\n",
|
||||
dev_path(dev),
|
||||
dev->hotplug_buses
|
||||
);
|
||||
dev->hotplug_buses = CONFIG_PCIEXP_HOTPLUG_BUSES;
|
||||
|
||||
/* Normal PCIe Scan */
|
||||
pciexp_scan_bridge(dev);
|
||||
|
||||
/* Add dummy slot to preserve resources, must happen after bus scan */
|
||||
printk(
|
||||
BIOS_DEBUG,
|
||||
"%s: add hotplug dummy device\n",
|
||||
dev_path(dev)
|
||||
);
|
||||
struct device *dummy;
|
||||
struct device_path dummy_path = { .type = DEVICE_PATH_NONE };
|
||||
dummy = alloc_dev(dev->link_list, &dummy_path);
|
||||
|
Reference in New Issue
Block a user