Commit 0eb6de78 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Bjorn Helgaas

Merge branch 'pci/sparc'

  - support arbitrary PCI host bridge offsets on sparc (Yinghai Lu)

  - remove System and Video ROM reservations on sparc (Bjorn Helgaas)

* pci/sparc:
  sparc/PCI: Stop reserving System ROM and Video ROM in PCI space
  sparc/PCI: Support arbitrary host bridge address offset
parents 1e1b3201 3758a191
...@@ -664,12 +664,12 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, ...@@ -664,12 +664,12 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
printk("PCI: Scanning PBM %s\n", node->full_name); printk("PCI: Scanning PBM %s\n", node->full_name);
pci_add_resource_offset(&resources, &pbm->io_space, pci_add_resource_offset(&resources, &pbm->io_space,
pbm->io_space.start); pbm->io_offset);
pci_add_resource_offset(&resources, &pbm->mem_space, pci_add_resource_offset(&resources, &pbm->mem_space,
pbm->mem_space.start); pbm->mem_offset);
if (pbm->mem64_space.flags) if (pbm->mem64_space.flags)
pci_add_resource_offset(&resources, &pbm->mem64_space, pci_add_resource_offset(&resources, &pbm->mem64_space,
pbm->mem_space.start); pbm->mem64_offset);
pbm->busn.start = pbm->pci_first_busno; pbm->busn.start = pbm->pci_first_busno;
pbm->busn.end = pbm->pci_last_busno; pbm->busn.end = pbm->pci_last_busno;
pbm->busn.flags = IORESOURCE_BUS; pbm->busn.flags = IORESOURCE_BUS;
......
...@@ -344,26 +344,6 @@ static void pci_register_legacy_regions(struct resource *io_res, ...@@ -344,26 +344,6 @@ static void pci_register_legacy_regions(struct resource *io_res,
p->end = p->start + 0x1ffffUL; p->end = p->start + 0x1ffffUL;
p->flags = IORESOURCE_BUSY; p->flags = IORESOURCE_BUSY;
request_resource(mem_res, p); request_resource(mem_res, p);
p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return;
p->name = "System ROM";
p->start = mem_res->start + 0xf0000UL;
p->end = p->start + 0xffffUL;
p->flags = IORESOURCE_BUSY;
request_resource(mem_res, p);
p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return;
p->name = "Video ROM";
p->start = mem_res->start + 0xc0000UL;
p->end = p->start + 0x7fffUL;
p->flags = IORESOURCE_BUSY;
request_resource(mem_res, p);
} }
static void pci_register_iommu_region(struct pci_pbm_info *pbm) static void pci_register_iommu_region(struct pci_pbm_info *pbm)
...@@ -397,6 +377,8 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) ...@@ -397,6 +377,8 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
int i, saw_mem, saw_io; int i, saw_mem, saw_io;
int num_pbm_ranges; int num_pbm_ranges;
/* Corresponding generic code in of_pci_get_host_bridge_resources() */
saw_mem = saw_io = 0; saw_mem = saw_io = 0;
pbm_ranges = of_get_property(pbm->op->dev.of_node, "ranges", &i); pbm_ranges = of_get_property(pbm->op->dev.of_node, "ranges", &i);
if (!pbm_ranges) { if (!pbm_ranges) {
...@@ -411,13 +393,16 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) ...@@ -411,13 +393,16 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
for (i = 0; i < num_pbm_ranges; i++) { for (i = 0; i < num_pbm_ranges; i++) {
const struct linux_prom_pci_ranges *pr = &pbm_ranges[i]; const struct linux_prom_pci_ranges *pr = &pbm_ranges[i];
unsigned long a, size; unsigned long a, size, region_a;
u32 parent_phys_hi, parent_phys_lo; u32 parent_phys_hi, parent_phys_lo;
u32 child_phys_mid, child_phys_lo;
u32 size_hi, size_lo; u32 size_hi, size_lo;
int type; int type;
parent_phys_hi = pr->parent_phys_hi; parent_phys_hi = pr->parent_phys_hi;
parent_phys_lo = pr->parent_phys_lo; parent_phys_lo = pr->parent_phys_lo;
child_phys_mid = pr->child_phys_mid;
child_phys_lo = pr->child_phys_lo;
if (tlb_type == hypervisor) if (tlb_type == hypervisor)
parent_phys_hi &= 0x0fffffff; parent_phys_hi &= 0x0fffffff;
...@@ -427,6 +412,8 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) ...@@ -427,6 +412,8 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
type = (pr->child_phys_hi >> 24) & 0x3; type = (pr->child_phys_hi >> 24) & 0x3;
a = (((unsigned long)parent_phys_hi << 32UL) | a = (((unsigned long)parent_phys_hi << 32UL) |
((unsigned long)parent_phys_lo << 0UL)); ((unsigned long)parent_phys_lo << 0UL));
region_a = (((unsigned long)child_phys_mid << 32UL) |
((unsigned long)child_phys_lo << 0UL));
size = (((unsigned long)size_hi << 32UL) | size = (((unsigned long)size_hi << 32UL) |
((unsigned long)size_lo << 0UL)); ((unsigned long)size_lo << 0UL));
...@@ -441,6 +428,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) ...@@ -441,6 +428,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
pbm->io_space.start = a; pbm->io_space.start = a;
pbm->io_space.end = a + size - 1UL; pbm->io_space.end = a + size - 1UL;
pbm->io_space.flags = IORESOURCE_IO; pbm->io_space.flags = IORESOURCE_IO;
pbm->io_offset = a - region_a;
saw_io = 1; saw_io = 1;
break; break;
...@@ -449,6 +437,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) ...@@ -449,6 +437,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
pbm->mem_space.start = a; pbm->mem_space.start = a;
pbm->mem_space.end = a + size - 1UL; pbm->mem_space.end = a + size - 1UL;
pbm->mem_space.flags = IORESOURCE_MEM; pbm->mem_space.flags = IORESOURCE_MEM;
pbm->mem_offset = a - region_a;
saw_mem = 1; saw_mem = 1;
break; break;
...@@ -457,6 +446,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) ...@@ -457,6 +446,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
pbm->mem64_space.start = a; pbm->mem64_space.start = a;
pbm->mem64_space.end = a + size - 1UL; pbm->mem64_space.end = a + size - 1UL;
pbm->mem64_space.flags = IORESOURCE_MEM; pbm->mem64_space.flags = IORESOURCE_MEM;
pbm->mem64_offset = a - region_a;
saw_mem = 1; saw_mem = 1;
break; break;
...@@ -472,14 +462,22 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) ...@@ -472,14 +462,22 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
prom_halt(); prom_halt();
} }
printk("%s: PCI IO[%llx] MEM[%llx]", if (pbm->io_space.flags)
pbm->name, printk("%s: PCI IO %pR offset %llx\n",
pbm->io_space.start, pbm->name, &pbm->io_space, pbm->io_offset);
pbm->mem_space.start); if (pbm->mem_space.flags)
printk("%s: PCI MEM %pR offset %llx\n",
pbm->name, &pbm->mem_space, pbm->mem_offset);
if (pbm->mem64_space.flags && pbm->mem_space.flags) {
if (pbm->mem64_space.start <= pbm->mem_space.end)
pbm->mem64_space.start = pbm->mem_space.end + 1;
if (pbm->mem64_space.start > pbm->mem64_space.end)
pbm->mem64_space.flags = 0;
}
if (pbm->mem64_space.flags) if (pbm->mem64_space.flags)
printk(" MEM64[%llx]", printk("%s: PCI MEM64 %pR offset %llx\n",
pbm->mem64_space.start); pbm->name, &pbm->mem64_space, pbm->mem64_offset);
printk("\n");
pbm->io_space.name = pbm->mem_space.name = pbm->name; pbm->io_space.name = pbm->mem_space.name = pbm->name;
pbm->mem64_space.name = pbm->name; pbm->mem64_space.name = pbm->name;
......
...@@ -100,6 +100,10 @@ struct pci_pbm_info { ...@@ -100,6 +100,10 @@ struct pci_pbm_info {
struct resource mem_space; struct resource mem_space;
struct resource mem64_space; struct resource mem64_space;
struct resource busn; struct resource busn;
/* offset */
resource_size_t io_offset;
resource_size_t mem_offset;
resource_size_t mem64_offset;
/* Base of PCI Config space, can be per-PBM or shared. */ /* Base of PCI Config space, can be per-PBM or shared. */
unsigned long config_space; unsigned long config_space;
......
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