Commit 01f38644 authored by Andy Grover's avatar Andy Grover

ACPI: Add ACPI PCI Subdriver. This enables acpiphp to work again. (Matthew Wilcox)

parent 556fa9fd
......@@ -146,6 +146,8 @@ extern int acpi_pci_irq_enable(struct pci_dev *dev);
EXPORT_SYMBOL(acpi_pci_irq_enable);
extern int acpi_pci_irq_lookup (int segment, int bus, int device, int pin);
EXPORT_SYMBOL(acpi_pci_irq_lookup);
EXPORT_SYMBOL(acpi_pci_register_driver);
EXPORT_SYMBOL(acpi_pci_unregister_driver);
#endif /*CONFIG_ACPI_PCI */
#ifdef CONFIG_ACPI_EC
......
......@@ -59,17 +59,63 @@ static struct acpi_driver acpi_pci_root_driver = {
},
};
struct acpi_pci_root {
struct acpi_pci_root {
struct list_head node;
acpi_handle handle;
struct acpi_pci_id id;
struct pci_bus *bus;
acpi_handle handle;
struct acpi_pci_id id;
struct pci_bus *bus;
u64 mem_tra;
u64 io_tra;
};
};
struct list_head acpi_pci_roots;
static struct acpi_pci_driver *sub_driver;
int acpi_pci_register_driver(struct acpi_pci_driver *driver)
{
int n = 0;
struct list_head *entry;
struct acpi_pci_driver **pptr = &sub_driver;
while (*pptr)
pptr = &(*pptr)->next;
*pptr = driver;
if (!driver->add)
return 0;
list_for_each(entry, &acpi_pci_roots) {
struct acpi_pci_root *root;
root = list_entry(entry, struct acpi_pci_root, node);
driver->add(root->handle);
n++;
}
return n;
}
void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
{
struct list_head *entry;
struct acpi_pci_driver **pptr = &sub_driver;
while (*pptr) {
if (*pptr != driver)
continue;
*pptr = (*pptr)->next;
break;
}
if (!driver->remove)
return;
list_for_each(entry, &acpi_pci_roots) {
struct acpi_pci_root *root;
root = list_entry(entry, struct acpi_pci_root, node);
driver->remove(root->handle);
}
}
void
acpi_pci_get_translations (
......
......@@ -401,6 +401,15 @@ struct pci_dev;
int acpi_pci_irq_enable (struct pci_dev *dev);
int acpi_pci_irq_init (void);
struct acpi_pci_driver {
struct acpi_pci_driver *next;
int (*add)(acpi_handle *handle);
void (*remove)(acpi_handle *handle);
};
int acpi_pci_register_driver(struct acpi_pci_driver *driver);
void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
#endif /*CONFIG_ACPI_PCI*/
#ifdef CONFIG_ACPI_EC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment