|
@@ -624,6 +624,45 @@ static void pci_bus_register_of_sysfs(struct pci_bus *bus)
|
|
|
pci_bus_register_of_sysfs(child_bus);
|
|
|
}
|
|
|
|
|
|
+static void pci_claim_legacy_resources(struct pci_dev *dev)
|
|
|
+{
|
|
|
+ struct pci_bus_region region;
|
|
|
+ struct resource *p, *root, *conflict;
|
|
|
+
|
|
|
+ if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
|
|
|
+ return;
|
|
|
+
|
|
|
+ p = kzalloc(sizeof(*p), GFP_KERNEL);
|
|
|
+ if (!p)
|
|
|
+ return;
|
|
|
+
|
|
|
+ p->name = "Video RAM area";
|
|
|
+ p->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
|
|
|
+
|
|
|
+ region.start = 0xa0000UL;
|
|
|
+ region.end = region.start + 0x1ffffUL;
|
|
|
+ pcibios_bus_to_resource(dev->bus, p, ®ion);
|
|
|
+
|
|
|
+ root = pci_find_parent_resource(dev, p);
|
|
|
+ if (!root) {
|
|
|
+ pci_info(dev, "can't claim VGA legacy %pR: no compatible bridge window\n", p);
|
|
|
+ goto err;
|
|
|
+ }
|
|
|
+
|
|
|
+ conflict = request_resource_conflict(root, p);
|
|
|
+ if (conflict) {
|
|
|
+ pci_info(dev, "can't claim VGA legacy %pR: address conflict with %s %pR\n",
|
|
|
+ p, conflict->name, conflict);
|
|
|
+ goto err;
|
|
|
+ }
|
|
|
+
|
|
|
+ pci_info(dev, "VGA legacy framebuffer %pR\n", p);
|
|
|
+ return;
|
|
|
+
|
|
|
+err:
|
|
|
+ kfree(p);
|
|
|
+}
|
|
|
+
|
|
|
static void pci_claim_bus_resources(struct pci_bus *bus)
|
|
|
{
|
|
|
struct pci_bus *child_bus;
|
|
@@ -648,6 +687,8 @@ static void pci_claim_bus_resources(struct pci_bus *bus)
|
|
|
|
|
|
pci_claim_resource(dev, i);
|
|
|
}
|
|
|
+
|
|
|
+ pci_claim_legacy_resources(dev);
|
|
|
}
|
|
|
|
|
|
list_for_each_entry(child_bus, &bus->children, node)
|
|
@@ -687,6 +728,7 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
|
|
|
pci_bus_register_of_sysfs(bus);
|
|
|
|
|
|
pci_claim_bus_resources(bus);
|
|
|
+
|
|
|
pci_bus_add_devices(bus);
|
|
|
return bus;
|
|
|
}
|