aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-10-10 08:25:26 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-10 08:25:26 -0400
commitdaec962e27490be4fae9ab5a51d0c17f6e638715 (patch)
tree86044d794f5406dcdcca5e6827607782d7c27ab1 /arch
parentb3b8dc6c07cecc1f8d52d03f677206bdf9f794c9 (diff)
powerpc: Use arch/powerpc/mm and arch/powerpc/lib for 64-bit
This also puts a copy of indirect_pci.c in arch/powerpc/sysdev so that we don't need to build in arch/ppc/syslib. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Makefile15
-rw-r--r--arch/powerpc/sysdev/Makefile4
-rw-r--r--arch/powerpc/sysdev/indirect_pci.c134
-rw-r--r--arch/ppc/syslib/Makefile14
4 files changed, 143 insertions, 24 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 064864065753..a4c605f469d4 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -124,15 +124,12 @@ head-$(CONFIG_6xx) += arch/powerpc/kernel/idle_6xx.o
124head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o 124head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o
125endif 125endif
126 126
127core-y += arch/powerpc/kernel/ 127core-y += arch/powerpc/kernel/ \
128core-y += arch/$(OLDARCH)/kernel/ 128 arch/$(OLDARCH)/kernel/ \
129core-$(CONFIG_PPC32) += arch/powerpc/mm/ 129 arch/powerpc/mm/ \
130core-$(CONFIG_PPC64) += arch/$(OLDARCH)/mm/ 130 arch/powerpc/lib/ \
131core-$(CONFIG_PPC32) += arch/powerpc/lib/ 131 arch/powerpc/sysdev/ \
132libs-$(CONFIG_PPC64) += arch/$(OLDARCH)/lib/ 132 arch/powerpc/platforms/
133core-y += arch/powerpc/sysdev/
134core-y += arch/powerpc/platforms/
135core-$(CONFIG_PPC32) += arch/ppc/syslib/
136core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/ 133core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/
137core-$(CONFIG_XMON) += arch/powerpc/xmon/ 134core-$(CONFIG_XMON) += arch/powerpc/xmon/
138core-$(CONFIG_APUS) += arch/ppc/amiga/ 135core-$(CONFIG_APUS) += arch/ppc/amiga/
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 26bdcd9a2a43..c649f03acf68 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -1 +1,3 @@
1obj-$(CONFIG_MPIC) += mpic.o 1obj-$(CONFIG_MPIC) += mpic.o
2indirectpci-$(CONFIG_PPC_PMAC) = indirect_pci.o
3obj-$(CONFIG_PPC32) += $(indirectpci-y)
diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c
new file mode 100644
index 000000000000..e71488469704
--- /dev/null
+++ b/arch/powerpc/sysdev/indirect_pci.c
@@ -0,0 +1,134 @@
1/*
2 * Support for indirect PCI bridges.
3 *
4 * Copyright (C) 1998 Gabriel Paubert.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/pci.h>
14#include <linux/delay.h>
15#include <linux/string.h>
16#include <linux/init.h>
17
18#include <asm/io.h>
19#include <asm/prom.h>
20#include <asm/pci-bridge.h>
21#include <asm/machdep.h>
22
23#ifdef CONFIG_PPC_INDIRECT_PCI_BE
24#define PCI_CFG_OUT out_be32
25#else
26#define PCI_CFG_OUT out_le32
27#endif
28
29static int
30indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
31 int len, u32 *val)
32{
33 struct pci_controller *hose = bus->sysdata;
34 volatile void __iomem *cfg_data;
35 u8 cfg_type = 0;
36
37 if (ppc_md.pci_exclude_device)
38 if (ppc_md.pci_exclude_device(bus->number, devfn))
39 return PCIBIOS_DEVICE_NOT_FOUND;
40
41 if (hose->set_cfg_type)
42 if (bus->number != hose->first_busno)
43 cfg_type = 1;
44
45 PCI_CFG_OUT(hose->cfg_addr,
46 (0x80000000 | ((bus->number - hose->bus_offset) << 16)
47 | (devfn << 8) | ((offset & 0xfc) | cfg_type)));
48
49 /*
50 * Note: the caller has already checked that offset is
51 * suitably aligned and that len is 1, 2 or 4.
52 */
53 cfg_data = hose->cfg_data + (offset & 3);
54 switch (len) {
55 case 1:
56 *val = in_8(cfg_data);
57 break;
58 case 2:
59 *val = in_le16(cfg_data);
60 break;
61 default:
62 *val = in_le32(cfg_data);
63 break;
64 }
65 return PCIBIOS_SUCCESSFUL;
66}
67
68static int
69indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
70 int len, u32 val)
71{
72 struct pci_controller *hose = bus->sysdata;
73 volatile void __iomem *cfg_data;
74 u8 cfg_type = 0;
75
76 if (ppc_md.pci_exclude_device)
77 if (ppc_md.pci_exclude_device(bus->number, devfn))
78 return PCIBIOS_DEVICE_NOT_FOUND;
79
80 if (hose->set_cfg_type)
81 if (bus->number != hose->first_busno)
82 cfg_type = 1;
83
84 PCI_CFG_OUT(hose->cfg_addr,
85 (0x80000000 | ((bus->number - hose->bus_offset) << 16)
86 | (devfn << 8) | ((offset & 0xfc) | cfg_type)));
87
88 /*
89 * Note: the caller has already checked that offset is
90 * suitably aligned and that len is 1, 2 or 4.
91 */
92 cfg_data = hose->cfg_data + (offset & 3);
93 switch (len) {
94 case 1:
95 out_8(cfg_data, val);
96 break;
97 case 2:
98 out_le16(cfg_data, val);
99 break;
100 default:
101 out_le32(cfg_data, val);
102 break;
103 }
104 return PCIBIOS_SUCCESSFUL;
105}
106
107static struct pci_ops indirect_pci_ops =
108{
109 indirect_read_config,
110 indirect_write_config
111};
112
113void __init
114setup_indirect_pci_nomap(struct pci_controller* hose, void __iomem * cfg_addr,
115 void __iomem * cfg_data)
116{
117 hose->cfg_addr = cfg_addr;
118 hose->cfg_data = cfg_data;
119 hose->ops = &indirect_pci_ops;
120}
121
122void __init
123setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data)
124{
125 unsigned long base = cfg_addr & PAGE_MASK;
126 void __iomem *mbase, *addr, *data;
127
128 mbase = ioremap(base, PAGE_SIZE);
129 addr = mbase + (cfg_addr & ~PAGE_MASK);
130 if ((cfg_data & PAGE_MASK) != base)
131 mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE);
132 data = mbase + (cfg_data & ~PAGE_MASK);
133 setup_indirect_pci_nomap(hose, addr, data);
134}
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
index 1b0a84931afc..b8d08f33f7ee 100644
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -5,7 +5,6 @@
5CFLAGS_prom_init.o += -fPIC 5CFLAGS_prom_init.o += -fPIC
6CFLAGS_btext.o += -fPIC 6CFLAGS_btext.o += -fPIC
7 7
8ifneq ($(CONFIG_PPC_MERGE),y)
9wdt-mpc8xx-$(CONFIG_8xx_WDT) += m8xx_wdt.o 8wdt-mpc8xx-$(CONFIG_8xx_WDT) += m8xx_wdt.o
10 9
11obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o 10obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o
@@ -110,16 +109,3 @@ obj-$(CONFIG_PPC_MPC52xx) += mpc52xx_setup.o mpc52xx_pic.o \
110ifeq ($(CONFIG_PPC_MPC52xx),y) 109ifeq ($(CONFIG_PPC_MPC52xx),y)
111obj-$(CONFIG_PCI) += mpc52xx_pci.o 110obj-$(CONFIG_PCI) += mpc52xx_pci.o
112endif 111endif
113
114else
115# Stuff still needed by the merged powerpc sources
116
117obj-$(CONFIG_PPCBUG_NVRAM) += prep_nvram.o
118obj-$(CONFIG_PPC_OF) += prom_init.o prom.o of_device.o
119obj-$(CONFIG_PPC_PMAC) += indirect_pci.o
120obj-$(CONFIG_PPC_CHRP) += indirect_pci.o i8259.o
121obj-$(CONFIG_PPC_PREP) += indirect_pci.o i8259.o todc_time.o
122obj-$(CONFIG_BOOTX_TEXT) += btext.o
123obj-$(CONFIG_MPC10X_BRIDGE) += mpc10x_common.o indirect_pci.o ppc_sys.o
124
125endif