aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci_32.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-19 22:54:46 -0500
committerPaul Mackerras <paulus@samba.org>2007-12-20 00:18:07 -0500
commitfc3fb71c3e1850a6a1099dd1cb7bcd7e69ac7b73 (patch)
treec9885bd47237c6e09b42a3c42496b5865c0caa02 /arch/powerpc/kernel/pci_32.c
parentb9baa20b0a50947f2e86d7775c9dba87c0d946ef (diff)
[POWERPC] pci32: Add flags modifying the PCI code behaviour
This adds to the 32 bits PCI code some flags, replacing the old pci_assign_all_busses global, that allow us to control various aspects of the PCI probing, such as whether to re-assign all resources or not, or to not try to assign anything at all. This also adds the flag x86 already has to avoid ISA alignment on bridges that don't have ISA forwarding enabled (no legacy devices on the top level bus) and sets it for PowerMacs. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/pci_32.c')
-rw-r--r--arch/powerpc/kernel/pci_32.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index dfb165802529..beb6f0447d16 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -35,6 +35,9 @@ unsigned long isa_io_base = 0;
35unsigned long pci_dram_offset = 0; 35unsigned long pci_dram_offset = 0;
36int pcibios_assign_bus_offset = 1; 36int pcibios_assign_bus_offset = 1;
37 37
38/* Default PCI flags is 0 */
39unsigned int ppc_pci_flags;
40
38void pcibios_make_OF_bus_map(void); 41void pcibios_make_OF_bus_map(void);
39 42
40static void pcibios_fixup_resources(struct pci_dev* dev); 43static void pcibios_fixup_resources(struct pci_dev* dev);
@@ -48,7 +51,7 @@ static u8* pci_to_OF_bus_map;
48/* By default, we don't re-assign bus numbers. We do this only on 51/* By default, we don't re-assign bus numbers. We do this only on
49 * some pmacs 52 * some pmacs
50 */ 53 */
51int pci_assign_all_buses; 54static int pci_assign_all_buses;
52 55
53LIST_HEAD(hose_list); 56LIST_HEAD(hose_list);
54 57
@@ -174,6 +177,14 @@ void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
174} 177}
175EXPORT_SYMBOL(pcibios_bus_to_resource); 178EXPORT_SYMBOL(pcibios_bus_to_resource);
176 179
180static int skip_isa_ioresource_align(struct pci_dev *dev)
181{
182 if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) &&
183 !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA))
184 return 1;
185 return 0;
186}
187
177/* 188/*
178 * We need to avoid collisions with `mirrored' VGA ports 189 * We need to avoid collisions with `mirrored' VGA ports
179 * and other strange ISA hardware, so we always want the 190 * and other strange ISA hardware, so we always want the
@@ -195,6 +206,8 @@ void pcibios_align_resource(void *data, struct resource *res,
195 if (res->flags & IORESOURCE_IO) { 206 if (res->flags & IORESOURCE_IO) {
196 resource_size_t start = res->start; 207 resource_size_t start = res->start;
197 208
209 if (skip_isa_ioresource_align(dev))
210 return;
198 if (start & 0x300) { 211 if (start & 0x300) {
199 start = (start + 0x3ff) & ~0x3ff; 212 start = (start + 0x3ff) & ~0x3ff;
200 res->start = start; 213 res->start = start;
@@ -251,8 +264,13 @@ pcibios_allocate_bus_resources(struct list_head *bus_list)
251 continue; 264 continue;
252 if (bus->parent == NULL) 265 if (bus->parent == NULL)
253 pr = (res->flags & IORESOURCE_IO)? 266 pr = (res->flags & IORESOURCE_IO)?
254 &ioport_resource: &iomem_resource; 267 &ioport_resource : &iomem_resource;
255 else { 268 else {
269 /* Don't bother with non-root busses when
270 * re-assigning all resources.
271 */
272 if (ppc_pci_flags & PPC_PCI_REASSIGN_ALL_RSRC)
273 continue;
256 pr = pci_find_parent_resource(bus->self, res); 274 pr = pci_find_parent_resource(bus->self, res);
257 if (pr == res) { 275 if (pr == res) {
258 /* this happens when the generic PCI 276 /* this happens when the generic PCI
@@ -720,6 +738,9 @@ pcibios_init(void)
720 738
721 printk(KERN_INFO "PCI: Probing PCI hardware\n"); 739 printk(KERN_INFO "PCI: Probing PCI hardware\n");
722 740
741 if (ppc_pci_flags & PPC_PCI_REASSIGN_ALL_BUS)
742 pci_assign_all_buses = 1;
743
723 /* Scan all of the recorded PCI controllers. */ 744 /* Scan all of the recorded PCI controllers. */
724 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 745 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
725 if (pci_assign_all_buses) 746 if (pci_assign_all_buses)
@@ -746,13 +767,18 @@ pcibios_init(void)
746 if (ppc_md.pcibios_fixup) 767 if (ppc_md.pcibios_fixup)
747 ppc_md.pcibios_fixup(); 768 ppc_md.pcibios_fixup();
748 769
749 /* Allocate and assign resources */ 770 /* Allocate and assign resources. If we re-assign everything, then
771 * we skip the allocate phase
772 */
750 pcibios_allocate_bus_resources(&pci_root_buses); 773 pcibios_allocate_bus_resources(&pci_root_buses);
751 pcibios_allocate_resources(0); 774 if (!(ppc_pci_flags & PPC_PCI_REASSIGN_ALL_RSRC)) {
752 pcibios_allocate_resources(1); 775 pcibios_allocate_resources(0);
753 776 pcibios_allocate_resources(1);
754 DBG("PCI: Assigning unassigned resouces...\n"); 777 }
755 pci_assign_unassigned_resources(); 778 if (!(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) {
779 DBG("PCI: Assigning unassigned resouces...\n");
780 pci_assign_unassigned_resources();
781 }
756 782
757 /* Call machine dependent post-init code */ 783 /* Call machine dependent post-init code */
758 if (ppc_md.pcibios_after_init) 784 if (ppc_md.pcibios_after_init)