Commit b638a4c2 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] ppc64: set pci_io_base dynamically if necessary

This patch is from John Rose <johnrose@austin.ibm.com>.

Upon DLPAR addition of a PCI Host Brige to a system with purely virtual I/O,
set pci_io_base as necessary.
Signed-off-by: default avatarJohn Rose <johnrose@austin.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9079a999
...@@ -424,16 +424,18 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn) ...@@ -424,16 +424,18 @@ struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
unsigned int root_size_cells = 0; unsigned int root_size_cells = 0;
struct pci_controller *phb; struct pci_controller *phb;
struct pci_bus *bus; struct pci_bus *bus;
int primary;
root_size_cells = prom_n_size_cells(root); root_size_cells = prom_n_size_cells(root);
primary = list_empty(&hose_list);
phb = alloc_phb_dynamic(dn, root_size_cells); phb = alloc_phb_dynamic(dn, root_size_cells);
if (!phb) if (!phb)
return NULL; return NULL;
pci_process_bridge_OF_ranges(phb, dn); pci_process_bridge_OF_ranges(phb, dn);
pci_setup_phb_io_dynamic(phb); pci_setup_phb_io_dynamic(phb, primary);
of_node_put(root); of_node_put(root);
pci_devs_phb_init_dynamic(phb); pci_devs_phb_init_dynamic(phb);
......
...@@ -619,7 +619,8 @@ void __init pci_setup_phb_io(struct pci_controller *hose, int primary) ...@@ -619,7 +619,8 @@ void __init pci_setup_phb_io(struct pci_controller *hose, int primary)
res->end += io_virt_offset; res->end += io_virt_offset;
} }
void __devinit pci_setup_phb_io_dynamic(struct pci_controller *hose) void __devinit pci_setup_phb_io_dynamic(struct pci_controller *hose,
int primary)
{ {
unsigned long size = hose->pci_io_size; unsigned long size = hose->pci_io_size;
unsigned long io_virt_offset; unsigned long io_virt_offset;
...@@ -631,6 +632,9 @@ void __devinit pci_setup_phb_io_dynamic(struct pci_controller *hose) ...@@ -631,6 +632,9 @@ void __devinit pci_setup_phb_io_dynamic(struct pci_controller *hose)
hose->global_number, hose->io_base_phys, hose->global_number, hose->io_base_phys,
(unsigned long) hose->io_base_virt); (unsigned long) hose->io_base_virt);
if (primary)
pci_io_base = (unsigned long)hose->io_base_virt;
io_virt_offset = (unsigned long)hose->io_base_virt - pci_io_base; io_virt_offset = (unsigned long)hose->io_base_virt - pci_io_base;
res = &hose->io_resource; res = &hose->io_resource;
res->start += io_virt_offset; res->start += io_virt_offset;
......
...@@ -16,8 +16,7 @@ extern unsigned long isa_io_base; ...@@ -16,8 +16,7 @@ extern unsigned long isa_io_base;
extern void pci_setup_pci_controller(struct pci_controller *hose); extern void pci_setup_pci_controller(struct pci_controller *hose);
extern void pci_setup_phb_io(struct pci_controller *hose, int primary); extern void pci_setup_phb_io(struct pci_controller *hose, int primary);
extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary);
extern void pci_setup_phb_io_dynamic(struct pci_controller *hose);
extern struct list_head hose_list; extern struct list_head hose_list;
......
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