mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
193c0d6825
Host bridge hotplug: - Untangle _PRT from struct pci_bus (Bjorn Helgaas) - Request _OSC control before scanning root bus (Taku Izumi) - Assign resources when adding host bridge (Yinghai Lu) - Remove root bus when removing host bridge (Yinghai Lu) - Remove _PRT during hot remove (Yinghai Lu) SRIOV - Add sysfs knobs to control numVFs (Don Dutile) Power management - Notify devices when power resource turned on (Huang Ying) Bug fixes - Work around broken _SEG on HP xw9300 (Bjorn Helgaas) - Keep runtime PM enabled for unbound PCI devices (Huang Ying) - Fix Optimus dual-GPU runtime D3 suspend issue (Dave Airlie) - Fix xen frontend shutdown issue (David Vrabel) - Work around PLX PCI 9050 BAR alignment erratum (Ian Abbott) Miscellaneous - Add GPL license for drivers/pci/ioapic (Andrew Cooks) - Add standard PCI-X, PCIe ASPM register #defines (Bjorn Helgaas) - NumaChip remote PCI support (Daniel Blueman) - Fix PCIe Link Capabilities Supported Link Speed definition (Jingoo Han) - Convert dev_printk() to dev_info(), etc (Joe Perches) - Add support for non PCI BAR ROM data (Matthew Garrett) - Add x86 support for host bridge translation offset (Mike Yoknis) - Report success only when every driver supports AER (Vijay Pandarathil) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAABAgAGBQJQyKwSAAoJEPGMOI97Hn6zScgQAJZK2VDfCv74mKrgSDNokIzH 5nVDrc9AHKJm7CUODs6keJK5d4TD/za3Zao68zrYHsJJKes2ni2Z3W34HP2RXKK2 eOmePXOHYPPZMlimP9r9cVxNu1ZJCyp/yWSBcsPF4zUgWhBWLRaSj85I049gQ0sz +05nZYfLjVd3HNiaXsG4CQyMrNF46XEsLhF9vs+Nr2GHPwrpzhfScgYv63oDS86C 3ICKsjmiRUZcNelxIFYmyxa5u89QdW5XHjzc9eHGQuus24Vxw+TZzsdfc17sUJEE HTyXY+RjDpOVhdtwwUjrCEOiyZYvy3g9+3sKxoxgt/76ghdUaR7fxITwB97qVMFD T0ESlKjSV/Qv5QYdyy5uP4zwNs/PXCWXkTg/L1m71F30BxKWDa7tgiA6uK7Z7fl5 1aokKBdk3mtJJJIDJG1YkxPXx/JItTGCNYrx7CcFj49rSjrUWLQdmrYahersRIsB 3wiD2xTi9e4dXeP/+VGzGOWB/sHk+73jvrvZe/REa1FCnMINDz4+9V9WaGROMqyq MQ8kX0KfYcNVNxy1GOXjU5wLpMN/t/QbvI7gwzRP1DAUCJPoOgFy7AjvSTVG3zuy 8CtdOFttVkUn5dqsbQR0gVbyQVTS3PGSKz5XC/s8kVDWhja0xZTBYwrskM/4zdSD Xf48OyYV5EjpC3FYUSiU =OE3Q -----END PGP SIGNATURE----- Merge tag 'for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci Pull PCI update from Bjorn Helgaas: "Host bridge hotplug: - Untangle _PRT from struct pci_bus (Bjorn Helgaas) - Request _OSC control before scanning root bus (Taku Izumi) - Assign resources when adding host bridge (Yinghai Lu) - Remove root bus when removing host bridge (Yinghai Lu) - Remove _PRT during hot remove (Yinghai Lu) SRIOV - Add sysfs knobs to control numVFs (Don Dutile) Power management - Notify devices when power resource turned on (Huang Ying) Bug fixes - Work around broken _SEG on HP xw9300 (Bjorn Helgaas) - Keep runtime PM enabled for unbound PCI devices (Huang Ying) - Fix Optimus dual-GPU runtime D3 suspend issue (Dave Airlie) - Fix xen frontend shutdown issue (David Vrabel) - Work around PLX PCI 9050 BAR alignment erratum (Ian Abbott) Miscellaneous - Add GPL license for drivers/pci/ioapic (Andrew Cooks) - Add standard PCI-X, PCIe ASPM register #defines (Bjorn Helgaas) - NumaChip remote PCI support (Daniel Blueman) - Fix PCIe Link Capabilities Supported Link Speed definition (Jingoo Han) - Convert dev_printk() to dev_info(), etc (Joe Perches) - Add support for non PCI BAR ROM data (Matthew Garrett) - Add x86 support for host bridge translation offset (Mike Yoknis) - Report success only when every driver supports AER (Vijay Pandarathil)" Fix up trivial conflicts. * tag 'for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (48 commits) PCI: Use phys_addr_t for physical ROM address x86/PCI: Add NumaChip remote PCI support ath9k: Use standard #defines for PCIe Capability ASPM fields iwlwifi: Use standard #defines for PCIe Capability ASPM fields iwlwifi: collapse wrapper for pcie_capability_read_word() iwlegacy: Use standard #defines for PCIe Capability ASPM fields iwlegacy: collapse wrapper for pcie_capability_read_word() cxgb3: Use standard #defines for PCIe Capability ASPM fields PCI: Add standard PCIe Capability Link ASPM field names PCI/portdrv: Use PCI Express Capability accessors PCI: Use standard PCIe Capability Link register field names x86: Use PCI setup data PCI: Add support for non-BAR ROMs PCI: Add pcibios_add_device EFI: Stash ROMs if they're not in the PCI BAR PCI: Add and use standard PCI-X Capability register names PCI/PM: Keep runtime PM enabled for unbound PCI devices xen-pcifront: Handle backend CLOSED without CLOSING PCI: SRIOV control and status via sysfs (documentation) PCI/AER: Report success only when every device has AER-aware driver ...
130 lines
2.8 KiB
C
130 lines
2.8 KiB
C
/*
|
|
* IOAPIC/IOxAPIC/IOSAPIC driver
|
|
*
|
|
* Copyright (C) 2009 Fujitsu Limited.
|
|
* (c) Copyright 2009 Hewlett-Packard Development Company, L.P.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
/*
|
|
* This driver manages PCI I/O APICs added by hotplug after boot. We try to
|
|
* claim all I/O APIC PCI devices, but those present at boot were registered
|
|
* when we parsed the ACPI MADT, so we'll fail when we try to re-register
|
|
* them.
|
|
*/
|
|
|
|
#include <linux/pci.h>
|
|
#include <linux/module.h>
|
|
#include <linux/acpi.h>
|
|
#include <linux/slab.h>
|
|
#include <acpi/acpi_bus.h>
|
|
|
|
struct ioapic {
|
|
acpi_handle handle;
|
|
u32 gsi_base;
|
|
};
|
|
|
|
static int ioapic_probe(struct pci_dev *dev, const struct pci_device_id *ent)
|
|
{
|
|
acpi_handle handle;
|
|
acpi_status status;
|
|
unsigned long long gsb;
|
|
struct ioapic *ioapic;
|
|
int ret;
|
|
char *type;
|
|
struct resource *res;
|
|
|
|
handle = DEVICE_ACPI_HANDLE(&dev->dev);
|
|
if (!handle)
|
|
return -EINVAL;
|
|
|
|
status = acpi_evaluate_integer(handle, "_GSB", NULL, &gsb);
|
|
if (ACPI_FAILURE(status))
|
|
return -EINVAL;
|
|
|
|
/*
|
|
* The previous code in acpiphp evaluated _MAT if _GSB failed, but
|
|
* ACPI spec 4.0 sec 6.2.2 requires _GSB for hot-pluggable I/O APICs.
|
|
*/
|
|
|
|
ioapic = kzalloc(sizeof(*ioapic), GFP_KERNEL);
|
|
if (!ioapic)
|
|
return -ENOMEM;
|
|
|
|
ioapic->handle = handle;
|
|
ioapic->gsi_base = (u32) gsb;
|
|
|
|
if (dev->class == PCI_CLASS_SYSTEM_PIC_IOAPIC)
|
|
type = "IOAPIC";
|
|
else
|
|
type = "IOxAPIC";
|
|
|
|
ret = pci_enable_device(dev);
|
|
if (ret < 0)
|
|
goto exit_free;
|
|
|
|
pci_set_master(dev);
|
|
|
|
if (pci_request_region(dev, 0, type))
|
|
goto exit_disable;
|
|
|
|
res = &dev->resource[0];
|
|
if (acpi_register_ioapic(ioapic->handle, res->start, ioapic->gsi_base))
|
|
goto exit_release;
|
|
|
|
pci_set_drvdata(dev, ioapic);
|
|
dev_info(&dev->dev, "%s at %pR, GSI %u\n", type, res, ioapic->gsi_base);
|
|
return 0;
|
|
|
|
exit_release:
|
|
pci_release_region(dev, 0);
|
|
exit_disable:
|
|
pci_disable_device(dev);
|
|
exit_free:
|
|
kfree(ioapic);
|
|
return -ENODEV;
|
|
}
|
|
|
|
static void ioapic_remove(struct pci_dev *dev)
|
|
{
|
|
struct ioapic *ioapic = pci_get_drvdata(dev);
|
|
|
|
acpi_unregister_ioapic(ioapic->handle, ioapic->gsi_base);
|
|
pci_release_region(dev, 0);
|
|
pci_disable_device(dev);
|
|
kfree(ioapic);
|
|
}
|
|
|
|
|
|
static DEFINE_PCI_DEVICE_TABLE(ioapic_devices) = {
|
|
{ PCI_DEVICE_CLASS(PCI_CLASS_SYSTEM_PIC_IOAPIC, ~0) },
|
|
{ PCI_DEVICE_CLASS(PCI_CLASS_SYSTEM_PIC_IOXAPIC, ~0) },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(pci, ioapic_devices);
|
|
|
|
static struct pci_driver ioapic_driver = {
|
|
.name = "ioapic",
|
|
.id_table = ioapic_devices,
|
|
.probe = ioapic_probe,
|
|
.remove = ioapic_remove,
|
|
};
|
|
|
|
static int __init ioapic_init(void)
|
|
{
|
|
return pci_register_driver(&ioapic_driver);
|
|
}
|
|
|
|
static void __exit ioapic_exit(void)
|
|
{
|
|
pci_unregister_driver(&ioapic_driver);
|
|
}
|
|
|
|
module_init(ioapic_init);
|
|
module_exit(ioapic_exit);
|
|
|
|
MODULE_LICENSE("GPL");
|