Commit 708b59bf authored by Bjorn Helgaas's avatar Bjorn Helgaas
Browse files

Merge branch 'pci/rafael-set-root-bridge-handle' into next

* pci/rafael-set-root-bridge-handle:
  ACPI / PCI: Set root bridge ACPI handle in advance
parents b7040469 6c0cc950
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -396,6 +396,14 @@ out1:
	return NULL;
}

int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
{
	struct pci_controller *controller = bridge->bus->sysdata;

	ACPI_HANDLE_SET(&bridge->dev, controller->acpi_handle);
	return 0;
}

static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
{
	unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
+3 −0
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@
struct pci_sysdata {
	int		domain;		/* PCI domain */
	int		node;		/* NUMA node */
#ifdef CONFIG_ACPI
	void		*acpi;		/* ACPI-specific data */
#endif
#ifdef CONFIG_X86_64
	void		*iommu;		/* IOMMU private data */
#endif
+9 −0
Original line number Diff line number Diff line
@@ -522,6 +522,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
	sd = &info->sd;
	sd->domain = domain;
	sd->node = node;
	sd->acpi = device->handle;
	/*
	 * Maybe the desired pci bus has been already scanned. In such case
	 * it is unnecessary to scan the pci bus with the given domain,busnum.
@@ -593,6 +594,14 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_pci_root *root)
	return bus;
}

int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
{
	struct pci_sysdata *sd = bridge->bus->sysdata;

	ACPI_HANDLE_SET(&bridge->dev, sd->acpi);
	return 0;
}

int __init pci_acpi_init(void)
{
	struct pci_dev *dev = NULL;
+0 −18
Original line number Diff line number Diff line
@@ -107,24 +107,6 @@ void acpi_pci_unregister_driver(struct acpi_pci_driver *driver)
}
EXPORT_SYMBOL(acpi_pci_unregister_driver);

acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus)
{
	struct acpi_pci_root *root;
	acpi_handle handle = NULL;
	
	mutex_lock(&acpi_pci_root_lock);
	list_for_each_entry(root, &acpi_pci_roots, node)
		if ((root->segment == (u16) seg) &&
		    (root->secondary.start == (u16) bus)) {
			handle = root->device->handle;
			break;
		}
	mutex_unlock(&acpi_pci_root_lock);
	return handle;
}

EXPORT_SYMBOL_GPL(acpi_get_pci_rootbridge_handle);

/**
 * acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge
 * @handle - the ACPI CA node in question.
+0 −19
Original line number Diff line number Diff line
@@ -302,24 +302,6 @@ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
	return 0;
}

static int acpi_pci_find_root_bridge(struct device *dev, acpi_handle *handle)
{
	int num;
	unsigned int seg, bus;

	/*
	 * The string should be the same as root bridge's name
	 * Please look at 'pci_scan_bus_parented'
	 */
	num = sscanf(dev_name(dev), "pci%04x:%02x", &seg, &bus);
	if (num != 2)
		return -ENODEV;
	*handle = acpi_get_pci_rootbridge_handle(seg, bus);
	if (!*handle)
		return -ENODEV;
	return 0;
}

static void pci_acpi_setup(struct device *dev)
{
	struct pci_dev *pci_dev = to_pci_dev(dev);
@@ -378,7 +360,6 @@ static void pci_acpi_cleanup(struct device *dev)
static struct acpi_bus_type acpi_pci_bus = {
	.bus = &pci_bus_type,
	.find_device = acpi_pci_find_device,
	.find_bridge = acpi_pci_find_root_bridge,
	.setup = pci_acpi_setup,
	.cleanup = pci_acpi_cleanup,
};
Loading