Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56609
b: refs/heads/master
c: de82120
h: refs/heads/master
i:
  56607: 33405a7
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed May 17, 2007
1 parent 3c3fe21 commit e1b87d3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 017e3c53f116d6a0741a21624924528dc9f98418
refs/heads/master: de821204dbd0a967f77213daf7b89070a65e7523
10 changes: 6 additions & 4 deletions trunk/arch/powerpc/kernel/of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,13 @@ static int __devinit of_pci_phb_probe(struct of_device *dev,
/* Process "ranges" property */
pci_process_bridge_OF_ranges(phb, dev->node, 0);

/* Setup IO space.
* This will not work properly for ISA IOs, something needs to be done
* about it if we ever generalize that way of probing PCI brigdes
/* Setup IO space. We use the non-dynamic version of that code here,
* which doesn't quite support unplugging. Next kernel release will
* have a better fix for this.
* Note also that we don't do ISA, this will also be fixed with a
* more massive rework.
*/
pci_setup_phb_io_dynamic(phb, 0);
pci_setup_phb_io(phb, 0);

/* Init pci_dn data structures */
pci_devs_phb_init_dynamic(phb);
Expand Down
23 changes: 22 additions & 1 deletion trunk/arch/powerpc/kernel/pci_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

unsigned long pci_probe_only = 1;
int pci_assign_all_buses = 0;
static int pci_initial_scan_done;

static void fixup_resource(struct resource *res, struct pci_dev *dev);
static void do_bus_setup(struct pci_bus *bus);
Expand Down Expand Up @@ -604,6 +605,8 @@ static int __init pcibios_init(void)
/* map in PCI I/O space */
phbs_remap_io();

pci_initial_scan_done = 1;

printk(KERN_DEBUG "PCI: Probing PCI hardware done\n");

return 0;
Expand Down Expand Up @@ -1042,13 +1045,16 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
}
}

void __init pci_setup_phb_io(struct pci_controller *hose, int primary)
void __devinit pci_setup_phb_io(struct pci_controller *hose, int primary)
{
unsigned long size = hose->pci_io_size;
unsigned long io_virt_offset;
struct resource *res;
struct device_node *isa_dn;

if (size == 0)
return;

hose->io_base_virt = reserve_phb_iospace(size);
DBG("phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n",
hose->global_number, hose->io_base_phys,
Expand All @@ -1069,6 +1075,15 @@ void __init pci_setup_phb_io(struct pci_controller *hose, int primary)
res = &hose->io_resource;
res->start += io_virt_offset;
res->end += io_virt_offset;

/* If this is called after the initial PCI scan, then we need to
* proceed to IO mappings now
*/
if (pci_initial_scan_done)
__ioremap_explicit(hose->io_base_phys,
(unsigned long)hose->io_base_virt,
hose->pci_io_size,
_PAGE_NO_CACHE | _PAGE_GUARDED);
}

void __devinit pci_setup_phb_io_dynamic(struct pci_controller *hose,
Expand All @@ -1078,6 +1093,9 @@ void __devinit pci_setup_phb_io_dynamic(struct pci_controller *hose,
unsigned long io_virt_offset;
struct resource *res;

if (size == 0)
return;

hose->io_base_virt = __ioremap(hose->io_base_phys, size,
_PAGE_NO_CACHE | _PAGE_GUARDED);
DBG("phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n",
Expand Down Expand Up @@ -1106,6 +1124,9 @@ static int get_bus_io_range(struct pci_bus *bus, unsigned long *start_phys,
/* Root Bus */
res = &hose->io_resource;

if (res->end == 0 && res->start == 0)
return 1;

*start_virt = pci_io_base + res->start;
*start_phys = *start_virt + hose->io_base_phys
- (unsigned long) hose->io_base_virt;
Expand Down

0 comments on commit e1b87d3

Please sign in to comment.