[PATCH] set pci_io_base dynamically if necessary

John Rose johnrose at austin.ibm.com
Sat Feb 26 09:37:17 EST 2005


Upon DLPAR addition of a PCI Host Brige to a system with purely virtual
I/O, set pci_io_base as necessary.

Please apply, if appropriate.

Thanks-
John

Signed-off-by: John Rose <johnrose at austin.ibm.com>

diff -puN arch/ppc64/kernel/pSeries_pci.c~01_ppc64_pci_iobase arch/ppc64/kernel/pSeries_pci.c
--- 2_6_linus_2/arch/ppc64/kernel/pSeries_pci.c~01_ppc64_pci_iobase	2005-02-25 16:26:20.000000000 -0600
+++ 2_6_linus_2-johnrose/arch/ppc64/kernel/pSeries_pci.c	2005-02-25 16:26:20.000000000 -0600
@@ -413,16 +413,18 @@ struct pci_controller * __devinit init_p
 	unsigned int root_size_cells = 0;
 	struct pci_controller *phb;
 	struct pci_bus *bus;
+	int primary;
 
 	root_size_cells = prom_n_size_cells(root);
 
+	primary = list_empty(&hose_list);
 	phb = alloc_phb_dynamic(dn, root_size_cells);
 	if (!phb)
 		return NULL;
 
 	pci_process_bridge_OF_ranges(phb, dn);
 
-	pci_setup_phb_io_dynamic(phb);
+	pci_setup_phb_io_dynamic(phb, primary);
 	of_node_put(root);
 
 	pci_devs_phb_init_dynamic(phb);
diff -puN arch/ppc64/kernel/pci.c~01_ppc64_pci_iobase arch/ppc64/kernel/pci.c
--- 2_6_linus_2/arch/ppc64/kernel/pci.c~01_ppc64_pci_iobase	2005-02-25 16:26:20.000000000 -0600
+++ 2_6_linus_2-johnrose/arch/ppc64/kernel/pci.c	2005-02-25 16:26:20.000000000 -0600
@@ -621,7 +621,8 @@ void __init pci_setup_phb_io(struct pci_
 	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 io_virt_offset;
@@ -633,6 +634,9 @@ void __devinit pci_setup_phb_io_dynamic(
 		hose->global_number, hose->io_base_phys,
 		(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;
 	res = &hose->io_resource;
 	res->start += io_virt_offset;
diff -puN arch/ppc64/kernel/pci.h~01_ppc64_pci_iobase arch/ppc64/kernel/pci.h
--- 2_6_linus_2/arch/ppc64/kernel/pci.h~01_ppc64_pci_iobase	2005-02-25 16:26:20.000000000 -0600
+++ 2_6_linus_2-johnrose/arch/ppc64/kernel/pci.h	2005-02-25 16:26:20.000000000 -0600
@@ -16,9 +16,9 @@ extern unsigned long isa_io_base;
 
 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_dynamic(struct pci_controller *hose, int primary);
 
 extern struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node);
-extern void pci_setup_phb_io_dynamic(struct pci_controller *hose);
 
 
 extern struct list_head hose_list;

_




More information about the Linuxppc64-dev mailing list