Commit 7fe519c2 authored by Josh Boyer's avatar Josh Boyer Committed by Paul Mackerras

powerpc: Introduce ppc_pci_flags accessors

Currently there are a number of platforms that open code access to
the ppc_pci_flags global variable.  However, that variable is not
present if CONFIG_PCI is not set, which can lead to a build break.

This introduces a number of accessor functions that are defined
to be empty in the case of CONFIG_PCI being disabled.  The
various platform files in the kernel are updated to use these.
Signed-off-by: default avatarJosh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent edc72ac4
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
struct device_node; struct device_node;
extern unsigned int ppc_pci_flags;
enum { enum {
/* Force re-assigning all resources (ignore firmware /* Force re-assigning all resources (ignore firmware
* setup completely) * setup completely)
...@@ -36,6 +35,31 @@ enum { ...@@ -36,6 +35,31 @@ enum {
/* ... except for domain 0 */ /* ... except for domain 0 */
PPC_PCI_COMPAT_DOMAIN_0 = 0x00000020, PPC_PCI_COMPAT_DOMAIN_0 = 0x00000020,
}; };
#ifdef CONFIG_PCI
extern unsigned int ppc_pci_flags;
static inline void ppc_pci_set_flags(int flags)
{
ppc_pci_flags = flags;
}
static inline void ppc_pci_add_flags(int flags)
{
ppc_pci_flags |= flags;
}
static inline int ppc_pci_has_flag(int flag)
{
return (ppc_pci_flags & flag);
}
#else
static inline void ppc_pci_set_flags(int flags) { }
static inline void ppc_pci_add_flags(int flags) { }
static inline int ppc_pci_has_flag(int flag)
{
return 0;
}
#endif
/* /*
......
...@@ -38,8 +38,8 @@ struct pci_dev; ...@@ -38,8 +38,8 @@ struct pci_dev;
* Set this to 1 if you want the kernel to re-assign all PCI * Set this to 1 if you want the kernel to re-assign all PCI
* bus numbers (don't do that on ppc64 yet !) * bus numbers (don't do that on ppc64 yet !)
*/ */
#define pcibios_assign_all_busses() (ppc_pci_flags & \ #define pcibios_assign_all_busses() \
PPC_PCI_REASSIGN_ALL_BUS) (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS))
#define pcibios_scan_all_fns(a, b) 0 #define pcibios_scan_all_fns(a, b) 0
static inline void pcibios_set_master(struct pci_dev *dev) static inline void pcibios_set_master(struct pci_dev *dev)
......
...@@ -100,7 +100,7 @@ static void __init ep405_setup_arch(void) ...@@ -100,7 +100,7 @@ static void __init ep405_setup_arch(void)
/* Find & init the BCSR CPLD */ /* Find & init the BCSR CPLD */
ep405_init_bcsr(); ep405_init_bcsr();
ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
} }
static int __init ep405_probe(void) static int __init ep405_probe(void)
......
...@@ -44,7 +44,7 @@ static int __init kilauea_probe(void) ...@@ -44,7 +44,7 @@ static int __init kilauea_probe(void)
if (!of_flat_dt_is_compatible(root, "amcc,kilauea")) if (!of_flat_dt_is_compatible(root, "amcc,kilauea"))
return 0; return 0;
ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
return 1; return 1;
} }
......
...@@ -61,7 +61,7 @@ static int __init ppc40x_probe(void) ...@@ -61,7 +61,7 @@ static int __init ppc40x_probe(void)
for (i = 0; i < ARRAY_SIZE(board); i++) { for (i = 0; i < ARRAY_SIZE(board); i++) {
if (of_flat_dt_is_compatible(root, board[i])) { if (of_flat_dt_is_compatible(root, board[i])) {
ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
return 1; return 1;
} }
} }
......
...@@ -54,7 +54,7 @@ static int __init ebony_probe(void) ...@@ -54,7 +54,7 @@ static int __init ebony_probe(void)
if (!of_flat_dt_is_compatible(root, "ibm,ebony")) if (!of_flat_dt_is_compatible(root, "ibm,ebony"))
return 0; return 0;
ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
return 1; return 1;
} }
......
...@@ -69,7 +69,7 @@ static int __init ppc44x_probe(void) ...@@ -69,7 +69,7 @@ static int __init ppc44x_probe(void)
for (i = 0; i < ARRAY_SIZE(board); i++) { for (i = 0; i < ARRAY_SIZE(board); i++) {
if (of_flat_dt_is_compatible(root, board[i])) { if (of_flat_dt_is_compatible(root, board[i])) {
ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
return 1; return 1;
} }
} }
......
...@@ -51,7 +51,7 @@ static int __init sam440ep_probe(void) ...@@ -51,7 +51,7 @@ static int __init sam440ep_probe(void)
if (!of_flat_dt_is_compatible(root, "acube,sam440ep")) if (!of_flat_dt_is_compatible(root, "acube,sam440ep"))
return 0; return 0;
ppc_pci_flags = PPC_PCI_REASSIGN_ALL_RSRC; ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
return 1; return 1;
} }
......
...@@ -375,7 +375,7 @@ mpc52xx_add_bridge(struct device_node *node) ...@@ -375,7 +375,7 @@ mpc52xx_add_bridge(struct device_node *node)
pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name); pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name);
ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
if (of_address_to_resource(node, 0, &rsrc) != 0) { if (of_address_to_resource(node, 0, &rsrc) != 0) {
printk(KERN_ERR "Can't get %s resources\n", node->full_name); printk(KERN_ERR "Can't get %s resources\n", node->full_name);
......
...@@ -53,7 +53,7 @@ static void __init pq2_pci_add_bridge(struct device_node *np) ...@@ -53,7 +53,7 @@ static void __init pq2_pci_add_bridge(struct device_node *np)
if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b) if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b)
goto err; goto err;
ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
hose = pcibios_alloc_controller(np); hose = pcibios_alloc_controller(np);
if (!hose) if (!hose)
......
...@@ -199,7 +199,7 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d ...@@ -199,7 +199,7 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d
printk ("RTAS supporting Pegasos OF not found, please upgrade" printk ("RTAS supporting Pegasos OF not found, please upgrade"
" your firmware\n"); " your firmware\n");
} }
ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
/* keep the reference to the root node */ /* keep the reference to the root node */
} }
......
...@@ -729,7 +729,7 @@ static void __init setup_bandit(struct pci_controller *hose, ...@@ -729,7 +729,7 @@ static void __init setup_bandit(struct pci_controller *hose,
static int __init setup_uninorth(struct pci_controller *hose, static int __init setup_uninorth(struct pci_controller *hose,
struct resource *addr) struct resource *addr)
{ {
ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
has_uninorth = 1; has_uninorth = 1;
hose->ops = &macrisc_pci_ops; hose->ops = &macrisc_pci_ops;
hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000); hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000);
...@@ -996,7 +996,7 @@ void __init pmac_pci_init(void) ...@@ -996,7 +996,7 @@ void __init pmac_pci_init(void)
struct device_node *np, *root; struct device_node *np, *root;
struct device_node *ht = NULL; struct device_node *ht = NULL;
ppc_pci_flags = PPC_PCI_CAN_SKIP_ISA_ALIGN; ppc_pci_set_flags(PPC_PCI_CAN_SKIP_ISA_ALIGN);
root = of_find_node_by_path("/"); root = of_find_node_by_path("/");
if (root == NULL) { if (root == NULL) {
...@@ -1055,7 +1055,7 @@ void __init pmac_pci_init(void) ...@@ -1055,7 +1055,7 @@ void __init pmac_pci_init(void)
* some offset between bus number and domains for now when we * some offset between bus number and domains for now when we
* assign all busses should help for now * assign all busses should help for now
*/ */
if (ppc_pci_flags & PPC_PCI_REASSIGN_ALL_BUS) if (ppc_pci_has_flag(PPC_PCI_REASSIGN_ALL_BUS))
pcibios_assign_bus_offset = 0x10; pcibios_assign_bus_offset = 0x10;
#endif #endif
} }
......
...@@ -187,7 +187,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary) ...@@ -187,7 +187,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
printk(KERN_WARNING "Can't get bus-range for %s, assume" printk(KERN_WARNING "Can't get bus-range for %s, assume"
" bus 0\n", dev->full_name); " bus 0\n", dev->full_name);
ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
hose = pcibios_alloc_controller(dev); hose = pcibios_alloc_controller(dev);
if (!hose) if (!hose)
return -ENOMEM; return -ENOMEM;
...@@ -300,7 +300,7 @@ int __init mpc83xx_add_bridge(struct device_node *dev) ...@@ -300,7 +300,7 @@ int __init mpc83xx_add_bridge(struct device_node *dev)
" bus 0\n", dev->full_name); " bus 0\n", dev->full_name);
} }
ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
hose = pcibios_alloc_controller(dev); hose = pcibios_alloc_controller(dev);
if (!hose) if (!hose)
return -ENOMEM; return -ENOMEM;
......
...@@ -57,7 +57,7 @@ void __init setup_grackle(struct pci_controller *hose) ...@@ -57,7 +57,7 @@ void __init setup_grackle(struct pci_controller *hose)
{ {
setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0); setup_indirect_pci(hose, 0xfec00000, 0xfee00000, 0);
if (machine_is_compatible("PowerMac1,1")) if (machine_is_compatible("PowerMac1,1"))
ppc_pci_flags |= PPC_PCI_REASSIGN_ALL_BUS; ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
if (machine_is_compatible("AAPL,PowerBook1998")) if (machine_is_compatible("AAPL,PowerBook1998"))
grackle_set_loop_snoop(hose, 1); grackle_set_loop_snoop(hose, 1);
#if 0 /* Disabled for now, HW problems ??? */ #if 0 /* Disabled for now, HW problems ??? */
......
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