Merge branch 'pci/taku-prt-cleanup' into next
* pci/taku-prt-cleanup: PCI/ACPI: Request _OSC control before scanning PCI root bus PCI: Don't pass pci_dev to pci_ext_cfg_avail() PCI/ACPI: Add _PRT interrupt routing info before enumerating devices ACPI: Pass segment/bus to _PRT add/del so they don't depend on pci_bus
This commit is contained in:
Коммит
0550827006
|
@ -626,7 +626,7 @@ void pcibios_disable_device (struct pci_dev *dev)
|
|||
pcibios_disable_irq(dev);
|
||||
}
|
||||
|
||||
int pci_ext_cfg_avail(struct pci_dev *dev)
|
||||
int pci_ext_cfg_avail(void)
|
||||
{
|
||||
if (raw_pci_ext_ops)
|
||||
return 1;
|
||||
|
|
|
@ -49,7 +49,7 @@ static int acpi_pci_unbind(struct acpi_device *device)
|
|||
if (!dev->subordinate)
|
||||
goto out;
|
||||
|
||||
acpi_pci_irq_del_prt(dev->subordinate);
|
||||
acpi_pci_irq_del_prt(pci_domain_nr(dev->bus), dev->subordinate->number);
|
||||
|
||||
device->ops.bind = NULL;
|
||||
device->ops.unbind = NULL;
|
||||
|
@ -63,7 +63,7 @@ static int acpi_pci_bind(struct acpi_device *device)
|
|||
{
|
||||
acpi_status status;
|
||||
acpi_handle handle;
|
||||
struct pci_bus *bus;
|
||||
unsigned char bus;
|
||||
struct pci_dev *dev;
|
||||
|
||||
dev = acpi_get_pci_dev(device->handle);
|
||||
|
@ -100,11 +100,11 @@ static int acpi_pci_bind(struct acpi_device *device)
|
|||
goto out;
|
||||
|
||||
if (dev->subordinate)
|
||||
bus = dev->subordinate;
|
||||
bus = dev->subordinate->number;
|
||||
else
|
||||
bus = dev->bus;
|
||||
bus = dev->bus->number;
|
||||
|
||||
acpi_pci_irq_add_prt(device->handle, bus);
|
||||
acpi_pci_irq_add_prt(device->handle, pci_domain_nr(dev->bus), bus);
|
||||
|
||||
out:
|
||||
pci_dev_put(dev);
|
||||
|
|
|
@ -184,7 +184,7 @@ static void do_prt_fixups(struct acpi_prt_entry *entry,
|
|||
}
|
||||
}
|
||||
|
||||
static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus,
|
||||
static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus,
|
||||
struct acpi_pci_routing_table *prt)
|
||||
{
|
||||
struct acpi_prt_entry *entry;
|
||||
|
@ -198,8 +198,8 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus,
|
|||
* 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert
|
||||
* it here.
|
||||
*/
|
||||
entry->id.segment = pci_domain_nr(bus);
|
||||
entry->id.bus = bus->number;
|
||||
entry->id.segment = segment;
|
||||
entry->id.bus = bus;
|
||||
entry->id.device = (prt->address >> 16) & 0xFFFF;
|
||||
entry->pin = prt->pin + 1;
|
||||
|
||||
|
@ -244,7 +244,7 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus)
|
||||
int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
|
@ -273,7 +273,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus)
|
|||
|
||||
entry = buffer.pointer;
|
||||
while (entry && (entry->length > 0)) {
|
||||
acpi_pci_irq_add_entry(handle, bus, entry);
|
||||
acpi_pci_irq_add_entry(handle, segment, bus, entry);
|
||||
entry = (struct acpi_pci_routing_table *)
|
||||
((unsigned long)entry + entry->length);
|
||||
}
|
||||
|
@ -282,17 +282,16 @@ int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void acpi_pci_irq_del_prt(struct pci_bus *bus)
|
||||
void acpi_pci_irq_del_prt(int segment, int bus)
|
||||
{
|
||||
struct acpi_prt_entry *entry, *tmp;
|
||||
|
||||
printk(KERN_DEBUG
|
||||
"ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n",
|
||||
pci_domain_nr(bus), bus->number);
|
||||
segment, bus);
|
||||
spin_lock(&acpi_prt_lock);
|
||||
list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) {
|
||||
if (pci_domain_nr(bus) == entry->id.segment
|
||||
&& bus->number == entry->id.bus) {
|
||||
if (segment == entry->id.segment && bus == entry->id.bus) {
|
||||
list_del(&entry->list);
|
||||
kfree(entry);
|
||||
}
|
||||
|
|
|
@ -454,6 +454,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
|
|||
acpi_handle handle;
|
||||
struct acpi_device *child;
|
||||
u32 flags, base_flags;
|
||||
bool is_osc_granted = false;
|
||||
|
||||
root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
|
||||
if (!root)
|
||||
|
@ -501,6 +502,20 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
|
|||
strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
|
||||
device->driver_data = root;
|
||||
|
||||
printk(KERN_INFO PREFIX "%s [%s] (domain %04x %pR)\n",
|
||||
acpi_device_name(device), acpi_device_bid(device),
|
||||
root->segment, &root->secondary);
|
||||
|
||||
/*
|
||||
* PCI Routing Table
|
||||
* -----------------
|
||||
* Evaluate and parse _PRT, if exists.
|
||||
*/
|
||||
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
|
||||
if (ACPI_SUCCESS(status))
|
||||
result = acpi_pci_irq_add_prt(device->handle, root->segment,
|
||||
root->secondary.start);
|
||||
|
||||
root->mcfg_addr = acpi_pci_root_get_mcfg_addr(device->handle);
|
||||
|
||||
/*
|
||||
|
@ -510,6 +525,60 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
|
|||
flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
|
||||
acpi_pci_osc_support(root, flags);
|
||||
|
||||
/* Indicate support for various _OSC capabilities. */
|
||||
if (pci_ext_cfg_avail())
|
||||
flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
|
||||
if (pcie_aspm_support_enabled()) {
|
||||
flags |= OSC_ACTIVE_STATE_PWR_SUPPORT |
|
||||
OSC_CLOCK_PWR_CAPABILITY_SUPPORT;
|
||||
}
|
||||
if (pci_msi_enabled())
|
||||
flags |= OSC_MSI_SUPPORT;
|
||||
if (flags != base_flags) {
|
||||
status = acpi_pci_osc_support(root, flags);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
dev_info(&device->dev, "ACPI _OSC support "
|
||||
"notification failed, disabling PCIe ASPM\n");
|
||||
pcie_no_aspm();
|
||||
flags = base_flags;
|
||||
}
|
||||
}
|
||||
if (!pcie_ports_disabled
|
||||
&& (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
|
||||
flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
|
||||
| OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
|
||||
| OSC_PCI_EXPRESS_PME_CONTROL;
|
||||
|
||||
if (pci_aer_available()) {
|
||||
if (aer_acpi_firmware_first())
|
||||
dev_dbg(&device->dev,
|
||||
"PCIe errors handled by BIOS.\n");
|
||||
else
|
||||
flags |= OSC_PCI_EXPRESS_AER_CONTROL;
|
||||
}
|
||||
|
||||
dev_info(&device->dev,
|
||||
"Requesting ACPI _OSC control (0x%02x)\n", flags);
|
||||
|
||||
status = acpi_pci_osc_control_set(device->handle, &flags,
|
||||
OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
is_osc_granted = true;
|
||||
dev_info(&device->dev,
|
||||
"ACPI _OSC control (0x%02x) granted\n", flags);
|
||||
} else {
|
||||
is_osc_granted = false;
|
||||
dev_info(&device->dev,
|
||||
"ACPI _OSC request failed (%s), "
|
||||
"returned control mask: 0x%02x\n",
|
||||
acpi_format_exception(status), flags);
|
||||
}
|
||||
} else {
|
||||
dev_info(&device->dev,
|
||||
"Unable to request _OSC control "
|
||||
"(_OSC support mask: 0x%02x)\n", flags);
|
||||
}
|
||||
|
||||
/*
|
||||
* TBD: Need PCI interface for enumeration/configuration of roots.
|
||||
*/
|
||||
|
@ -518,10 +587,6 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
|
|||
list_add_tail(&root->node, &acpi_pci_roots);
|
||||
mutex_unlock(&acpi_pci_root_lock);
|
||||
|
||||
printk(KERN_INFO PREFIX "%s [%s] (domain %04x %pR)\n",
|
||||
acpi_device_name(device), acpi_device_bid(device),
|
||||
root->segment, &root->secondary);
|
||||
|
||||
/*
|
||||
* Scan the Root Bridge
|
||||
* --------------------
|
||||
|
@ -547,81 +612,20 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
|
|||
if (result)
|
||||
goto out_del_root;
|
||||
|
||||
/*
|
||||
* PCI Routing Table
|
||||
* -----------------
|
||||
* Evaluate and parse _PRT, if exists.
|
||||
*/
|
||||
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
|
||||
if (ACPI_SUCCESS(status))
|
||||
result = acpi_pci_irq_add_prt(device->handle, root->bus);
|
||||
|
||||
/*
|
||||
* Scan and bind all _ADR-Based Devices
|
||||
*/
|
||||
list_for_each_entry(child, &device->children, node)
|
||||
acpi_pci_bridge_scan(child);
|
||||
|
||||
/* Indicate support for various _OSC capabilities. */
|
||||
if (pci_ext_cfg_avail(root->bus->self))
|
||||
flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
|
||||
if (pcie_aspm_support_enabled())
|
||||
flags |= OSC_ACTIVE_STATE_PWR_SUPPORT |
|
||||
OSC_CLOCK_PWR_CAPABILITY_SUPPORT;
|
||||
if (pci_msi_enabled())
|
||||
flags |= OSC_MSI_SUPPORT;
|
||||
if (flags != base_flags) {
|
||||
status = acpi_pci_osc_support(root, flags);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
dev_info(root->bus->bridge, "ACPI _OSC support "
|
||||
"notification failed, disabling PCIe ASPM\n");
|
||||
pcie_no_aspm();
|
||||
flags = base_flags;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pcie_ports_disabled
|
||||
&& (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
|
||||
flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
|
||||
| OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
|
||||
| OSC_PCI_EXPRESS_PME_CONTROL;
|
||||
|
||||
if (pci_aer_available()) {
|
||||
if (aer_acpi_firmware_first())
|
||||
dev_dbg(root->bus->bridge,
|
||||
"PCIe errors handled by BIOS.\n");
|
||||
else
|
||||
flags |= OSC_PCI_EXPRESS_AER_CONTROL;
|
||||
}
|
||||
|
||||
dev_info(root->bus->bridge,
|
||||
"Requesting ACPI _OSC control (0x%02x)\n", flags);
|
||||
|
||||
status = acpi_pci_osc_control_set(device->handle, &flags,
|
||||
OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
dev_info(root->bus->bridge,
|
||||
"ACPI _OSC control (0x%02x) granted\n", flags);
|
||||
if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
|
||||
/*
|
||||
* We have ASPM control, but the FADT indicates
|
||||
* that it's unsupported. Clear it.
|
||||
*/
|
||||
pcie_clear_aspm(root->bus);
|
||||
}
|
||||
} else {
|
||||
dev_info(root->bus->bridge,
|
||||
"ACPI _OSC request failed (%s), "
|
||||
"returned control mask: 0x%02x\n",
|
||||
acpi_format_exception(status), flags);
|
||||
pr_info("ACPI _OSC control for PCIe not granted, "
|
||||
"disabling ASPM\n");
|
||||
pcie_no_aspm();
|
||||
}
|
||||
/* ASPM setting */
|
||||
if (is_osc_granted) {
|
||||
if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM)
|
||||
pcie_clear_aspm(root->bus);
|
||||
} else {
|
||||
dev_info(root->bus->bridge,
|
||||
"Unable to request _OSC control "
|
||||
"(_OSC support mask: 0x%02x)\n", flags);
|
||||
pr_info("ACPI _OSC control for PCIe not granted, "
|
||||
"disabling ASPM\n");
|
||||
pcie_no_aspm();
|
||||
}
|
||||
|
||||
pci_acpi_add_bus_pm_notifier(device, root->bus);
|
||||
|
@ -634,6 +638,8 @@ out_del_root:
|
|||
mutex_lock(&acpi_pci_root_lock);
|
||||
list_del(&root->node);
|
||||
mutex_unlock(&acpi_pci_root_lock);
|
||||
|
||||
acpi_pci_irq_del_prt(root->segment, root->secondary.start);
|
||||
end:
|
||||
kfree(root);
|
||||
return result;
|
||||
|
@ -682,7 +688,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
|
|||
|
||||
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
|
||||
if (ACPI_SUCCESS(status))
|
||||
acpi_pci_irq_del_prt(root->bus);
|
||||
acpi_pci_irq_del_prt(root->segment, root->secondary.start);
|
||||
|
||||
pci_remove_root_bus(root->bus);
|
||||
|
||||
|
|
|
@ -3843,14 +3843,13 @@ static void __devinit pci_no_domains(void)
|
|||
}
|
||||
|
||||
/**
|
||||
* pci_ext_cfg_enabled - can we access extended PCI config space?
|
||||
* @dev: The PCI device of the root bridge.
|
||||
* pci_ext_cfg_avail - can we access extended PCI config space?
|
||||
*
|
||||
* Returns 1 if we can access PCI extended config space (offsets
|
||||
* greater than 0xff). This is the default implementation. Architecture
|
||||
* implementations can override this.
|
||||
*/
|
||||
int __weak pci_ext_cfg_avail(struct pci_dev *dev)
|
||||
int __weak pci_ext_cfg_avail(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -92,8 +92,8 @@ int acpi_pci_link_free_irq(acpi_handle handle);
|
|||
|
||||
/* ACPI PCI Interrupt Routing (pci_irq.c) */
|
||||
|
||||
int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus);
|
||||
void acpi_pci_irq_del_prt(struct pci_bus *bus);
|
||||
int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus);
|
||||
void acpi_pci_irq_del_prt(int segment, int bus);
|
||||
|
||||
/* ACPI PCI Device Binding (pci_bind.c) */
|
||||
|
||||
|
|
|
@ -1604,7 +1604,7 @@ static inline void pci_mmcfg_early_init(void) { }
|
|||
static inline void pci_mmcfg_late_init(void) { }
|
||||
#endif
|
||||
|
||||
int pci_ext_cfg_avail(struct pci_dev *dev);
|
||||
int pci_ext_cfg_avail(void);
|
||||
|
||||
void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче