aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 13:38:02 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 13:38:02 -0400
commit3aed77bc84013fced136977b7cc17fff60eddf7a (patch)
tree75ee4060f58f033deb16771a303fb55dd370b6f9
parent0b968d23610d65a46299347b141a687e207bd294 (diff)
parentb2ad7b5e8115582cdf5bbda065aa516c24d62c21 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/paulus/ppc64-2.6
-rw-r--r--arch/ppc/kernel/syscalls.c4
-rw-r--r--arch/ppc64/Makefile21
-rw-r--r--arch/ppc64/boot/Makefile53
-rw-r--r--arch/ppc64/boot/main.c31
-rw-r--r--arch/ppc64/kernel/bpa_iic.c28
-rw-r--r--arch/ppc64/kernel/eeh.c55
-rw-r--r--arch/ppc64/kernel/iomap.c20
-rw-r--r--arch/ppc64/kernel/iommu.c3
-rw-r--r--arch/ppc64/kernel/maple_pci.c4
-rw-r--r--arch/ppc64/kernel/misc.S6
-rw-r--r--arch/ppc64/kernel/pSeries_iommu.c72
-rw-r--r--arch/ppc64/kernel/pci.c66
-rw-r--r--arch/ppc64/kernel/pci.h1
-rw-r--r--arch/ppc64/kernel/pci_dn.c47
-rw-r--r--arch/ppc64/kernel/pci_iommu.c2
-rw-r--r--arch/ppc64/kernel/pmac_feature.c8
-rw-r--r--arch/ppc64/kernel/pmac_pci.c6
-rw-r--r--arch/ppc64/kernel/prom.c1
-rw-r--r--arch/ppc64/kernel/rtas_pci.c39
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c55
-rw-r--r--arch/ppc64/kernel/syscalls.c4
-rw-r--r--arch/ppc64/kernel/u3_iommu.c4
-rw-r--r--arch/ppc64/kernel/udbg.c6
-rw-r--r--arch/ppc64/mm/init.c4
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c20
-rw-r--r--drivers/pci/hotplug/rpaphp_pci.c8
-rw-r--r--drivers/video/offb.c2
-rw-r--r--include/asm-powerpc/8253pit.h8
-rw-r--r--include/asm-powerpc/agp.h8
-rw-r--r--include/asm-powerpc/bugs.h8
-rw-r--r--include/asm-powerpc/errno.h6
-rw-r--r--include/asm-powerpc/ioctl.h6
-rw-r--r--include/asm-powerpc/ioctls.h6
-rw-r--r--include/asm-powerpc/linkage.h6
-rw-r--r--include/asm-powerpc/mc146818rtc.h6
-rw-r--r--include/asm-powerpc/mman.h6
-rw-r--r--include/asm-powerpc/module.h6
-rw-r--r--include/asm-powerpc/msgbuf.h (renamed from include/asm-ppc/msgbuf.h)16
-rw-r--r--include/asm-powerpc/namei.h14
-rw-r--r--include/asm-powerpc/param.h (renamed from include/asm-ppc/param.h)8
-rw-r--r--include/asm-powerpc/poll.h6
-rw-r--r--include/asm-powerpc/sembuf.h6
-rw-r--r--include/asm-powerpc/setup.h9
-rw-r--r--include/asm-powerpc/shmbuf.h14
-rw-r--r--include/asm-powerpc/shmparam.h6
-rw-r--r--include/asm-powerpc/siginfo.h6
-rw-r--r--include/asm-powerpc/socket.h6
-rw-r--r--include/asm-powerpc/sockios.h6
-rw-r--r--include/asm-powerpc/string.h6
-rw-r--r--include/asm-powerpc/termbits.h6
-rw-r--r--include/asm-powerpc/termios.h6
-rw-r--r--include/asm-powerpc/timex.h (renamed from include/asm-ppc/timex.h)37
-rw-r--r--include/asm-powerpc/topology.h (renamed from include/asm-ppc64/topology.h)9
-rw-r--r--include/asm-powerpc/unaligned.h9
-rw-r--r--include/asm-powerpc/user.h (renamed from include/asm-ppc/user.h)15
-rw-r--r--include/asm-ppc/setup.h14
-rw-r--r--include/asm-ppc/topology.h6
-rw-r--r--include/asm-ppc64/msgbuf.h27
-rw-r--r--include/asm-ppc64/param.h31
-rw-r--r--include/asm-ppc64/pci-bridge.h45
-rw-r--r--include/asm-ppc64/prom.h19
-rw-r--r--include/asm-ppc64/segment.h6
-rw-r--r--include/asm-ppc64/setup.h6
-rw-r--r--include/asm-ppc64/timex.h26
-rw-r--r--include/asm-ppc64/user.h58
65 files changed, 530 insertions, 529 deletions
diff --git a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c
index 124313ce3c09..127f040de9de 100644
--- a/arch/ppc/kernel/syscalls.c
+++ b/arch/ppc/kernel/syscalls.c
@@ -41,10 +41,6 @@
41#include <asm/ipc.h> 41#include <asm/ipc.h>
42#include <asm/semaphore.h> 42#include <asm/semaphore.h>
43 43
44void
45check_bugs(void)
46{
47}
48 44
49/* 45/*
50 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 46 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 8189953a372c..a91daa324e88 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -89,11 +89,12 @@ drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/
89 89
90boot := arch/ppc64/boot 90boot := arch/ppc64/boot
91 91
92boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd 92boottargets-$(CONFIG_PPC_PSERIES) += zImage zImage.initrd
93boottarget-$(CONFIG_PPC_MAPLE) := zImage zImage.initrd 93boottargets-$(CONFIG_PPC_PMAC) += zImage.vmode zImage.initrd.vmode
94boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm 94boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd
95boottarget-$(CONFIG_PPC_BPA) := zImage zImage.initrd 95boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm
96$(boottarget-y): vmlinux 96boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd
97$(boottargets-y): vmlinux
97 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 98 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
98 99
99bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage 100bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
@@ -131,10 +132,12 @@ include3/asm:
131 $(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm 132 $(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm
132 133
133define archhelp 134define archhelp
134 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' 135 echo ' zImage.vmode - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)'
135 echo ' zImage.initrd- Compressed kernel image with initrd attached,' 136 echo ' zImage.initrd.vmode - Compressed kernel image with initrd attached,'
136 echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz' 137 echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
137 echo ' (arch/$(ARCH)/boot/zImage.initrd)' 138 echo ' (arch/$(ARCH)/boot/zImage.initrd.vmode)'
139 echo ' zImage - zImage for pSeries machines'
140 echo ' zImage.initrd - zImage with initrd for pSeries machines'
138endef 141endef
139 142
140CLEAN_FILES += include/asm-ppc64/offsets.h 143CLEAN_FILES += include/asm-ppc64/offsets.h
diff --git a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
index 2c5f5e73d00c..33fdc8710891 100644
--- a/arch/ppc64/boot/Makefile
+++ b/arch/ppc64/boot/Makefile
@@ -37,6 +37,9 @@ quiet_cmd_bootcc = BOOTCC $@
37quiet_cmd_bootas = BOOTAS $@ 37quiet_cmd_bootas = BOOTAS $@
38 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 38 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
39 39
40quiet_cmd_bootld = BOOTLD $@
41 cmd_bootld = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(2)
42
40$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c 43$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
41 $(call if_changed_dep,bootcc) 44 $(call if_changed_dep,bootcc)
42$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S 45$(patsubst %.S,%.o, $(filter %.S, $(src-boot))): %.o: %.S
@@ -53,7 +56,7 @@ src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
53gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) 56gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
54 57
55hostprogs-y := addnote addRamDisk 58hostprogs-y := addnote addRamDisk
56targets += zImage zImage.initrd imagesize.c \ 59targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd imagesize.c \
57 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ 60 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
58 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ 61 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
59 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ 62 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
@@ -63,7 +66,7 @@ extra-y := initrd.o
63quiet_cmd_ramdisk = RAMDISK $@ 66quiet_cmd_ramdisk = RAMDISK $@
64 cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@ 67 cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@
65 68
66quiet_cmd_stripvm = STRIP $@ 69quiet_cmd_stripvm = STRIP $@
67 cmd_stripvm = $(STRIP) -s $< -o $@ 70 cmd_stripvm = $(STRIP) -s $< -o $@
68 71
69vmlinux.strip: vmlinux FORCE 72vmlinux.strip: vmlinux FORCE
@@ -71,12 +74,20 @@ vmlinux.strip: vmlinux FORCE
71$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE 74$(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE
72 $(call if_changed,ramdisk) 75 $(call if_changed,ramdisk)
73 76
74addsection = $(CROSS32OBJCOPY) $(1) \ 77quiet_cmd_addsection = ADDSEC $@
75 --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(patsubst %.o,%.gz, $(1)) \ 78 cmd_addsection = $(CROSS32OBJCOPY) $@ \
76 --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(OBJCOPYFLAGS) 79 --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(patsubst %.o,%.gz, $@) \
80 --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $@))=$(OBJCOPYFLAGS)
81
82quiet_cmd_imagesize = GENSIZE $@
83 cmd_imagesize = ls -l vmlinux.strip | \
84 awk '{printf "/* generated -- do not edit! */\n" "unsigned long vmlinux_filesize = %d;\n", $$5}' \
85 > $(obj)/imagesize.c && \
86 $(CROSS_COMPILE)nm -n vmlinux | tail -n 1 | \
87 awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' >> $(obj)/imagesize.c
77 88
78quiet_cmd_addnote = ADDNOTE $@ 89quiet_cmd_addnote = ADDNOTE $@
79 cmd_addnote = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@ 90 cmd_addnote = $(obj)/addnote $@
80 91
81$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE 92$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE
82 $(call if_changed,gzip) 93 $(call if_changed,gzip)
@@ -85,28 +96,30 @@ $(obj)/kernel-initrd.gz: $(obj)/ramdisk.image.gz
85 cp -f $(obj)/ramdisk.image.gz $@ 96 cp -f $(obj)/ramdisk.image.gz $@
86 97
87$(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz FORCE 98$(call src-sec, $(required) $(initrd)): $(obj)/kernel-%.c: $(obj)/kernel-%.gz FORCE
88 touch $@ 99 @touch $@
89 100
90$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c FORCE 101$(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c FORCE
91 $(call if_changed_dep,bootcc) 102 $(call if_changed_dep,bootcc)
92 $(call addsection, $@) 103 $(call cmd,addsection)
104
105$(obj)/zImage.vmode: obj-boot += $(call obj-sec, $(required))
106$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) FORCE
107 $(call cmd,bootld,$(obj-boot))
108
109$(obj)/zImage.initrd.vmode: obj-boot += $(call obj-sec, $(required) $(initrd))
110$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) FORCE
111 $(call cmd,bootld,$(obj-boot))
93 112
94$(obj)/zImage: obj-boot += $(call obj-sec, $(required)) 113$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote FORCE
95$(obj)/zImage: $(call obj-sec, $(required)) $(obj-boot) $(obj)/addnote FORCE 114 @cp -f $< $@
96 $(call if_changed,addnote) 115 $(call if_changed,addnote)
97 116
98$(obj)/zImage.initrd: obj-boot += $(call obj-sec, $(required) $(initrd)) 117$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote FORCE
99$(obj)/zImage.initrd: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/addnote FORCE 118 @cp -f $< $@
100 $(call if_changed,addnote) 119 $(call if_changed,addnote)
101 120
102$(obj)/imagesize.c: vmlinux.strip 121$(obj)/imagesize.c: vmlinux.strip
103 @echo Generating $@ 122 $(call cmd,imagesize)
104 ls -l vmlinux.strip | \
105 awk '{printf "/* generated -- do not edit! */\n" \
106 "unsigned long vmlinux_filesize = %d;\n", $$5}' > $(obj)/imagesize.c
107 $(CROSS_COMPILE)nm -n vmlinux | tail -n 1 | \
108 awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' \
109 >> $(obj)/imagesize.c
110 123
111install: $(CONFIGURE) $(BOOTIMAGE) 124install: $(CONFIGURE) $(BOOTIMAGE)
112 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)" 125 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
diff --git a/arch/ppc64/boot/main.c b/arch/ppc64/boot/main.c
index 99e68cfbe688..f7ec19a2d0b0 100644
--- a/arch/ppc64/boot/main.c
+++ b/arch/ppc64/boot/main.c
@@ -23,7 +23,8 @@ extern void flush_cache(void *, unsigned long);
23 23
24/* Value picked to match that used by yaboot */ 24/* Value picked to match that used by yaboot */
25#define PROG_START 0x01400000 25#define PROG_START 0x01400000
26#define RAM_END (256<<20) // Fixme: use OF */ 26#define RAM_END (512<<20) // Fixme: use OF */
27#define ONE_MB 0x100000
27 28
28static char *avail_ram; 29static char *avail_ram;
29static char *begin_avail, *end_avail; 30static char *begin_avail, *end_avail;
@@ -32,6 +33,7 @@ static unsigned int heap_use;
32static unsigned int heap_max; 33static unsigned int heap_max;
33 34
34extern char _start[]; 35extern char _start[];
36extern char _end[];
35extern char _vmlinux_start[]; 37extern char _vmlinux_start[];
36extern char _vmlinux_end[]; 38extern char _vmlinux_end[];
37extern char _initrd_start[]; 39extern char _initrd_start[];
@@ -58,13 +60,13 @@ typedef void (*kernel_entry_t)( unsigned long,
58 60
59#undef DEBUG 61#undef DEBUG
60 62
61static unsigned long claim_base = PROG_START; 63static unsigned long claim_base;
62 64
63static unsigned long try_claim(unsigned long size) 65static unsigned long try_claim(unsigned long size)
64{ 66{
65 unsigned long addr = 0; 67 unsigned long addr = 0;
66 68
67 for(; claim_base < RAM_END; claim_base += 0x100000) { 69 for(; claim_base < RAM_END; claim_base += ONE_MB) {
68#ifdef DEBUG 70#ifdef DEBUG
69 printf(" trying: 0x%08lx\n\r", claim_base); 71 printf(" trying: 0x%08lx\n\r", claim_base);
70#endif 72#endif
@@ -95,7 +97,26 @@ void start(unsigned long a1, unsigned long a2, void *promptr)
95 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4) 97 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
96 exit(); 98 exit();
97 99
98 printf("\n\rzImage starting: loaded at 0x%x\n\r", (unsigned)_start); 100 printf("\n\rzImage starting: loaded at 0x%lx\n\r", (unsigned long) _start);
101
102 /*
103 * The first available claim_base must be above the end of the
104 * the loaded kernel wrapper file (_start to _end includes the
105 * initrd image if it is present) and rounded up to a nice
106 * 1 MB boundary for good measure.
107 */
108
109 claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
110
111#if defined(PROG_START)
112 /*
113 * Maintain a "magic" minimum address. This keeps some older
114 * firmware platforms running.
115 */
116
117 if (claim_base < PROG_START)
118 claim_base = PROG_START;
119#endif
99 120
100 /* 121 /*
101 * Now we try to claim some memory for the kernel itself 122 * Now we try to claim some memory for the kernel itself
@@ -105,7 +126,7 @@ void start(unsigned long a1, unsigned long a2, void *promptr)
105 * size... In practice we add 1Mb, that is enough, but we should really 126 * size... In practice we add 1Mb, that is enough, but we should really
106 * consider fixing the Makefile to put a _raw_ kernel in there ! 127 * consider fixing the Makefile to put a _raw_ kernel in there !
107 */ 128 */
108 vmlinux_memsize += 0x100000; 129 vmlinux_memsize += ONE_MB;
109 printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux_memsize); 130 printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux_memsize);
110 vmlinux.addr = try_claim(vmlinux_memsize); 131 vmlinux.addr = try_claim(vmlinux_memsize);
111 if (vmlinux.addr == 0) { 132 if (vmlinux.addr == 0) {
diff --git a/arch/ppc64/kernel/bpa_iic.c b/arch/ppc64/kernel/bpa_iic.c
index c8f3dc3fad70..0aaa878e19d3 100644
--- a/arch/ppc64/kernel/bpa_iic.c
+++ b/arch/ppc64/kernel/bpa_iic.c
@@ -205,6 +205,18 @@ static struct iic_regs __iomem *find_iic(int cpu)
205} 205}
206 206
207#ifdef CONFIG_SMP 207#ifdef CONFIG_SMP
208
209/* Use the highest interrupt priorities for IPI */
210static inline int iic_ipi_to_irq(int ipi)
211{
212 return IIC_IPI_OFFSET + IIC_NUM_IPIS - 1 - ipi;
213}
214
215static inline int iic_irq_to_ipi(int irq)
216{
217 return IIC_NUM_IPIS - 1 - (irq - IIC_IPI_OFFSET);
218}
219
208void iic_setup_cpu(void) 220void iic_setup_cpu(void)
209{ 221{
210 out_be64(&__get_cpu_var(iic).regs->prio, 0xff); 222 out_be64(&__get_cpu_var(iic).regs->prio, 0xff);
@@ -212,18 +224,20 @@ void iic_setup_cpu(void)
212 224
213void iic_cause_IPI(int cpu, int mesg) 225void iic_cause_IPI(int cpu, int mesg)
214{ 226{
215 out_be64(&per_cpu(iic, cpu).regs->generate, mesg); 227 out_be64(&per_cpu(iic, cpu).regs->generate, (IIC_NUM_IPIS - 1 - mesg) << 4);
216} 228}
217 229
218static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs) 230static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
219{ 231{
220 232 smp_message_recv(iic_irq_to_ipi(irq), regs);
221 smp_message_recv(irq - IIC_IPI_OFFSET, regs);
222 return IRQ_HANDLED; 233 return IRQ_HANDLED;
223} 234}
224 235
225static void iic_request_ipi(int irq, const char *name) 236static void iic_request_ipi(int ipi, const char *name)
226{ 237{
238 int irq;
239
240 irq = iic_ipi_to_irq(ipi);
227 /* IPIs are marked SA_INTERRUPT as they must run with irqs 241 /* IPIs are marked SA_INTERRUPT as they must run with irqs
228 * disabled */ 242 * disabled */
229 get_irq_desc(irq)->handler = &iic_pic; 243 get_irq_desc(irq)->handler = &iic_pic;
@@ -233,10 +247,10 @@ static void iic_request_ipi(int irq, const char *name)
233 247
234void iic_request_IPIs(void) 248void iic_request_IPIs(void)
235{ 249{
236 iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_CALL_FUNCTION, "IPI-call"); 250 iic_request_ipi(PPC_MSG_CALL_FUNCTION, "IPI-call");
237 iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_RESCHEDULE, "IPI-resched"); 251 iic_request_ipi(PPC_MSG_RESCHEDULE, "IPI-resched");
238#ifdef CONFIG_DEBUGGER 252#ifdef CONFIG_DEBUGGER
239 iic_request_ipi(IIC_IPI_OFFSET + PPC_MSG_DEBUGGER_BREAK, "IPI-debug"); 253 iic_request_ipi(PPC_MSG_DEBUGGER_BREAK, "IPI-debug");
240#endif /* CONFIG_DEBUGGER */ 254#endif /* CONFIG_DEBUGGER */
241} 255}
242#endif /* CONFIG_SMP */ 256#endif /* CONFIG_SMP */
diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
index 4c857a6516fc..ba93fd731222 100644
--- a/arch/ppc64/kernel/eeh.c
+++ b/arch/ppc64/kernel/eeh.c
@@ -254,6 +254,7 @@ pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
254static void __pci_addr_cache_insert_device(struct pci_dev *dev) 254static void __pci_addr_cache_insert_device(struct pci_dev *dev)
255{ 255{
256 struct device_node *dn; 256 struct device_node *dn;
257 struct pci_dn *pdn;
257 int i; 258 int i;
258 int inserted = 0; 259 int inserted = 0;
259 260
@@ -265,8 +266,9 @@ static void __pci_addr_cache_insert_device(struct pci_dev *dev)
265 } 266 }
266 267
267 /* Skip any devices for which EEH is not enabled. */ 268 /* Skip any devices for which EEH is not enabled. */
268 if (!(dn->eeh_mode & EEH_MODE_SUPPORTED) || 269 pdn = dn->data;
269 dn->eeh_mode & EEH_MODE_NOCHECK) { 270 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
271 pdn->eeh_mode & EEH_MODE_NOCHECK) {
270#ifdef DEBUG 272#ifdef DEBUG
271 printk(KERN_INFO "PCI: skip building address cache for=%s\n", 273 printk(KERN_INFO "PCI: skip building address cache for=%s\n",
272 pci_name(dev)); 274 pci_name(dev));
@@ -415,6 +417,7 @@ int eeh_unregister_notifier(struct notifier_block *nb)
415static int read_slot_reset_state(struct device_node *dn, int rets[]) 417static int read_slot_reset_state(struct device_node *dn, int rets[])
416{ 418{
417 int token, outputs; 419 int token, outputs;
420 struct pci_dn *pdn = dn->data;
418 421
419 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) { 422 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
420 token = ibm_read_slot_reset_state2; 423 token = ibm_read_slot_reset_state2;
@@ -424,8 +427,8 @@ static int read_slot_reset_state(struct device_node *dn, int rets[])
424 outputs = 3; 427 outputs = 3;
425 } 428 }
426 429
427 return rtas_call(token, 3, outputs, rets, dn->eeh_config_addr, 430 return rtas_call(token, 3, outputs, rets, pdn->eeh_config_addr,
428 BUID_HI(dn->phb->buid), BUID_LO(dn->phb->buid)); 431 BUID_HI(pdn->phb->buid), BUID_LO(pdn->phb->buid));
429} 432}
430 433
431/** 434/**
@@ -534,6 +537,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
534 unsigned long flags; 537 unsigned long flags;
535 int rc, reset_state; 538 int rc, reset_state;
536 struct eeh_event *event; 539 struct eeh_event *event;
540 struct pci_dn *pdn;
537 541
538 __get_cpu_var(total_mmio_ffs)++; 542 __get_cpu_var(total_mmio_ffs)++;
539 543
@@ -542,14 +546,15 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
542 546
543 if (!dn) 547 if (!dn)
544 return 0; 548 return 0;
549 pdn = dn->data;
545 550
546 /* Access to IO BARs might get this far and still not want checking. */ 551 /* Access to IO BARs might get this far and still not want checking. */
547 if (!(dn->eeh_mode & EEH_MODE_SUPPORTED) || 552 if (!pdn->eeh_capable || !(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
548 dn->eeh_mode & EEH_MODE_NOCHECK) { 553 pdn->eeh_mode & EEH_MODE_NOCHECK) {
549 return 0; 554 return 0;
550 } 555 }
551 556
552 if (!dn->eeh_config_addr) { 557 if (!pdn->eeh_config_addr) {
553 return 0; 558 return 0;
554 } 559 }
555 560
@@ -557,7 +562,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
557 * If we already have a pending isolation event for this 562 * If we already have a pending isolation event for this
558 * slot, we know it's bad already, we don't need to check... 563 * slot, we know it's bad already, we don't need to check...
559 */ 564 */
560 if (dn->eeh_mode & EEH_MODE_ISOLATED) { 565 if (pdn->eeh_mode & EEH_MODE_ISOLATED) {
561 atomic_inc(&eeh_fail_count); 566 atomic_inc(&eeh_fail_count);
562 if (atomic_read(&eeh_fail_count) >= EEH_MAX_FAILS) { 567 if (atomic_read(&eeh_fail_count) >= EEH_MAX_FAILS) {
563 /* re-read the slot reset state */ 568 /* re-read the slot reset state */
@@ -582,7 +587,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
582 } 587 }
583 588
584 /* prevent repeated reports of this failure */ 589 /* prevent repeated reports of this failure */
585 dn->eeh_mode |= EEH_MODE_ISOLATED; 590 pdn->eeh_mode |= EEH_MODE_ISOLATED;
586 591
587 reset_state = rets[0]; 592 reset_state = rets[0];
588 593
@@ -590,9 +595,9 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
590 memset(slot_errbuf, 0, eeh_error_buf_size); 595 memset(slot_errbuf, 0, eeh_error_buf_size);
591 596
592 rc = rtas_call(ibm_slot_error_detail, 597 rc = rtas_call(ibm_slot_error_detail,
593 8, 1, NULL, dn->eeh_config_addr, 598 8, 1, NULL, pdn->eeh_config_addr,
594 BUID_HI(dn->phb->buid), 599 BUID_HI(pdn->phb->buid),
595 BUID_LO(dn->phb->buid), NULL, 0, 600 BUID_LO(pdn->phb->buid), NULL, 0,
596 virt_to_phys(slot_errbuf), 601 virt_to_phys(slot_errbuf),
597 eeh_error_buf_size, 602 eeh_error_buf_size,
598 1 /* Temporary Error */); 603 1 /* Temporary Error */);
@@ -679,8 +684,9 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
679 u32 *device_id = (u32 *)get_property(dn, "device-id", NULL); 684 u32 *device_id = (u32 *)get_property(dn, "device-id", NULL);
680 u32 *regs; 685 u32 *regs;
681 int enable; 686 int enable;
687 struct pci_dn *pdn = dn->data;
682 688
683 dn->eeh_mode = 0; 689 pdn->eeh_mode = 0;
684 690
685 if (status && strcmp(status, "ok") != 0) 691 if (status && strcmp(status, "ok") != 0)
686 return NULL; /* ignore devices with bad status */ 692 return NULL; /* ignore devices with bad status */
@@ -691,7 +697,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
691 697
692 /* There is nothing to check on PCI to ISA bridges */ 698 /* There is nothing to check on PCI to ISA bridges */
693 if (dn->type && !strcmp(dn->type, "isa")) { 699 if (dn->type && !strcmp(dn->type, "isa")) {
694 dn->eeh_mode |= EEH_MODE_NOCHECK; 700 pdn->eeh_mode |= EEH_MODE_NOCHECK;
695 return NULL; 701 return NULL;
696 } 702 }
697 703
@@ -708,7 +714,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
708 enable = 0; 714 enable = 0;
709 715
710 if (!enable) 716 if (!enable)
711 dn->eeh_mode |= EEH_MODE_NOCHECK; 717 pdn->eeh_mode |= EEH_MODE_NOCHECK;
712 718
713 /* Ok... see if this device supports EEH. Some do, some don't, 719 /* Ok... see if this device supports EEH. Some do, some don't,
714 * and the only way to find out is to check each and every one. */ 720 * and the only way to find out is to check each and every one. */
@@ -721,8 +727,8 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
721 EEH_ENABLE); 727 EEH_ENABLE);
722 if (ret == 0) { 728 if (ret == 0) {
723 eeh_subsystem_enabled = 1; 729 eeh_subsystem_enabled = 1;
724 dn->eeh_mode |= EEH_MODE_SUPPORTED; 730 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
725 dn->eeh_config_addr = regs[0]; 731 pdn->eeh_config_addr = regs[0];
726#ifdef DEBUG 732#ifdef DEBUG
727 printk(KERN_DEBUG "EEH: %s: eeh enabled\n", dn->full_name); 733 printk(KERN_DEBUG "EEH: %s: eeh enabled\n", dn->full_name);
728#endif 734#endif
@@ -730,10 +736,11 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
730 736
731 /* This device doesn't support EEH, but it may have an 737 /* This device doesn't support EEH, but it may have an
732 * EEH parent, in which case we mark it as supported. */ 738 * EEH parent, in which case we mark it as supported. */
733 if (dn->parent && (dn->parent->eeh_mode & EEH_MODE_SUPPORTED)) { 739 if (dn->parent && dn->parent->data
740 && (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) {
734 /* Parent supports EEH. */ 741 /* Parent supports EEH. */
735 dn->eeh_mode |= EEH_MODE_SUPPORTED; 742 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
736 dn->eeh_config_addr = dn->parent->eeh_config_addr; 743 pdn->eeh_config_addr = PCI_DN(dn->parent)->eeh_config_addr;
737 return NULL; 744 return NULL;
738 } 745 }
739 } 746 }
@@ -790,11 +797,13 @@ void __init eeh_init(void)
790 for (phb = of_find_node_by_name(NULL, "pci"); phb; 797 for (phb = of_find_node_by_name(NULL, "pci"); phb;
791 phb = of_find_node_by_name(phb, "pci")) { 798 phb = of_find_node_by_name(phb, "pci")) {
792 unsigned long buid; 799 unsigned long buid;
800 struct pci_dn *pci;
793 801
794 buid = get_phb_buid(phb); 802 buid = get_phb_buid(phb);
795 if (buid == 0) 803 if (buid == 0 || phb->data == NULL)
796 continue; 804 continue;
797 805
806 pci = phb->data;
798 info.buid_lo = BUID_LO(buid); 807 info.buid_lo = BUID_LO(buid);
799 info.buid_hi = BUID_HI(buid); 808 info.buid_hi = BUID_HI(buid);
800 traverse_pci_devices(phb, early_enable_eeh, &info); 809 traverse_pci_devices(phb, early_enable_eeh, &info);
@@ -823,9 +832,9 @@ void eeh_add_device_early(struct device_node *dn)
823 struct pci_controller *phb; 832 struct pci_controller *phb;
824 struct eeh_early_enable_info info; 833 struct eeh_early_enable_info info;
825 834
826 if (!dn) 835 if (!dn || !dn->data)
827 return; 836 return;
828 phb = dn->phb; 837 phb = PCI_DN(dn)->phb;
829 if (NULL == phb || 0 == phb->buid) { 838 if (NULL == phb || 0 == phb->buid) {
830 printk(KERN_WARNING "EEH: Expected buid but found none\n"); 839 printk(KERN_WARNING "EEH: Expected buid but found none\n");
831 return; 840 return;
diff --git a/arch/ppc64/kernel/iomap.c b/arch/ppc64/kernel/iomap.c
index 09a3062309e7..6160c8dbb7c5 100644
--- a/arch/ppc64/kernel/iomap.c
+++ b/arch/ppc64/kernel/iomap.c
@@ -22,13 +22,23 @@ unsigned int fastcall ioread16(void __iomem *addr)
22{ 22{
23 return readw(addr); 23 return readw(addr);
24} 24}
25unsigned int fastcall ioread16be(void __iomem *addr)
26{
27 return in_be16(addr);
28}
25unsigned int fastcall ioread32(void __iomem *addr) 29unsigned int fastcall ioread32(void __iomem *addr)
26{ 30{
27 return readl(addr); 31 return readl(addr);
28} 32}
33unsigned int fastcall ioread32be(void __iomem *addr)
34{
35 return in_be32(addr);
36}
29EXPORT_SYMBOL(ioread8); 37EXPORT_SYMBOL(ioread8);
30EXPORT_SYMBOL(ioread16); 38EXPORT_SYMBOL(ioread16);
39EXPORT_SYMBOL(ioread16be);
31EXPORT_SYMBOL(ioread32); 40EXPORT_SYMBOL(ioread32);
41EXPORT_SYMBOL(ioread32be);
32 42
33void fastcall iowrite8(u8 val, void __iomem *addr) 43void fastcall iowrite8(u8 val, void __iomem *addr)
34{ 44{
@@ -38,13 +48,23 @@ void fastcall iowrite16(u16 val, void __iomem *addr)
38{ 48{
39 writew(val, addr); 49 writew(val, addr);
40} 50}
51void fastcall iowrite16be(u16 val, void __iomem *addr)
52{
53 out_be16(addr, val);
54}
41void fastcall iowrite32(u32 val, void __iomem *addr) 55void fastcall iowrite32(u32 val, void __iomem *addr)
42{ 56{
43 writel(val, addr); 57 writel(val, addr);
44} 58}
59void fastcall iowrite32be(u32 val, void __iomem *addr)
60{
61 out_be32(addr, val);
62}
45EXPORT_SYMBOL(iowrite8); 63EXPORT_SYMBOL(iowrite8);
46EXPORT_SYMBOL(iowrite16); 64EXPORT_SYMBOL(iowrite16);
65EXPORT_SYMBOL(iowrite16be);
47EXPORT_SYMBOL(iowrite32); 66EXPORT_SYMBOL(iowrite32);
67EXPORT_SYMBOL(iowrite32be);
48 68
49/* 69/*
50 * These are the "repeat read/write" functions. Note the 70 * These are the "repeat read/write" functions. Note the
diff --git a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c
index 845eebd1e28d..9032b6bfe036 100644
--- a/arch/ppc64/kernel/iommu.c
+++ b/arch/ppc64/kernel/iommu.c
@@ -438,7 +438,8 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl)
438 438
439void iommu_free_table(struct device_node *dn) 439void iommu_free_table(struct device_node *dn)
440{ 440{
441 struct iommu_table *tbl = dn->iommu_table; 441 struct pci_dn *pdn = dn->data;
442 struct iommu_table *tbl = pdn->iommu_table;
442 unsigned long bitmap_sz, i; 443 unsigned long bitmap_sz, i;
443 unsigned int order; 444 unsigned int order;
444 445
diff --git a/arch/ppc64/kernel/maple_pci.c b/arch/ppc64/kernel/maple_pci.c
index 53993999b265..5a8b4d8c2dd6 100644
--- a/arch/ppc64/kernel/maple_pci.c
+++ b/arch/ppc64/kernel/maple_pci.c
@@ -447,9 +447,9 @@ void __init maple_pci_init(void)
447 */ 447 */
448 if (u3_agp) { 448 if (u3_agp) {
449 struct device_node *np = u3_agp->arch_data; 449 struct device_node *np = u3_agp->arch_data;
450 np->busno = 0xf0; 450 PCI_DN(np)->busno = 0xf0;
451 for (np = np->child; np; np = np->sibling) 451 for (np = np->child; np; np = np->sibling)
452 np->busno = 0xf0; 452 PCI_DN(np)->busno = 0xf0;
453 } 453 }
454 454
455 /* Tell pci.c to use the common resource allocation mecanism */ 455 /* Tell pci.c to use the common resource allocation mecanism */
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index 6d860c1d9fa0..c047663eb48d 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -1431,9 +1431,9 @@ _GLOBAL(sys_call_table)
1431 .llong .sys_ni_syscall /* 195 - 32bit only stat64 */ 1431 .llong .sys_ni_syscall /* 195 - 32bit only stat64 */
1432 .llong .sys_ni_syscall /* 32bit only lstat64 */ 1432 .llong .sys_ni_syscall /* 32bit only lstat64 */
1433 .llong .sys_ni_syscall /* 32bit only fstat64 */ 1433 .llong .sys_ni_syscall /* 32bit only fstat64 */
1434 .llong .sys_ni_syscall /* 32bit only pciconfig_read */ 1434 .llong .sys_pciconfig_read
1435 .llong .sys_ni_syscall /* 32bit only pciconfig_write */ 1435 .llong .sys_pciconfig_write
1436 .llong .sys_ni_syscall /* 32bit only pciconfig_iobase */ 1436 .llong .sys_pciconfig_iobase /* 200 - pciconfig_iobase */
1437 .llong .sys_ni_syscall /* reserved for MacOnLinux */ 1437 .llong .sys_ni_syscall /* reserved for MacOnLinux */
1438 .llong .sys_getdents64 1438 .llong .sys_getdents64
1439 .llong .sys_pivot_root 1439 .llong .sys_pivot_root
diff --git a/arch/ppc64/kernel/pSeries_iommu.c b/arch/ppc64/kernel/pSeries_iommu.c
index 9d5e1e7fc389..f0fd7fbd6531 100644
--- a/arch/ppc64/kernel/pSeries_iommu.c
+++ b/arch/ppc64/kernel/pSeries_iommu.c
@@ -295,7 +295,7 @@ static void iommu_table_setparms_lpar(struct pci_controller *phb,
295 struct iommu_table *tbl, 295 struct iommu_table *tbl,
296 unsigned int *dma_window) 296 unsigned int *dma_window)
297{ 297{
298 tbl->it_busno = dn->bussubno; 298 tbl->it_busno = PCI_DN(dn)->bussubno;
299 299
300 /* TODO: Parse field size properties properly. */ 300 /* TODO: Parse field size properties properly. */
301 tbl->it_size = (((unsigned long)dma_window[4] << 32) | 301 tbl->it_size = (((unsigned long)dma_window[4] << 32) |
@@ -311,6 +311,7 @@ static void iommu_table_setparms_lpar(struct pci_controller *phb,
311static void iommu_bus_setup_pSeries(struct pci_bus *bus) 311static void iommu_bus_setup_pSeries(struct pci_bus *bus)
312{ 312{
313 struct device_node *dn, *pdn; 313 struct device_node *dn, *pdn;
314 struct pci_dn *pci;
314 struct iommu_table *tbl; 315 struct iommu_table *tbl;
315 316
316 DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self); 317 DBG("iommu_bus_setup_pSeries, bus %p, bus->self %p\n", bus, bus->self);
@@ -325,6 +326,7 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
325 */ 326 */
326 327
327 dn = pci_bus_to_OF_node(bus); 328 dn = pci_bus_to_OF_node(bus);
329 pci = dn->data;
328 330
329 if (!bus->self) { 331 if (!bus->self) {
330 /* Root bus */ 332 /* Root bus */
@@ -341,18 +343,18 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
341 * alltogether. This leaves 768MB for the window. 343 * alltogether. This leaves 768MB for the window.
342 */ 344 */
343 DBG("PHB has io-hole, reserving 256MB\n"); 345 DBG("PHB has io-hole, reserving 256MB\n");
344 dn->phb->dma_window_size = 3 << 28; 346 pci->phb->dma_window_size = 3 << 28;
345 dn->phb->dma_window_base_cur = 1 << 28; 347 pci->phb->dma_window_base_cur = 1 << 28;
346 } else { 348 } else {
347 /* 1GB window by default */ 349 /* 1GB window by default */
348 dn->phb->dma_window_size = 1 << 30; 350 pci->phb->dma_window_size = 1 << 30;
349 dn->phb->dma_window_base_cur = 0; 351 pci->phb->dma_window_base_cur = 0;
350 } 352 }
351 353
352 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 354 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
353 355
354 iommu_table_setparms(dn->phb, dn, tbl); 356 iommu_table_setparms(pci->phb, dn, tbl);
355 dn->iommu_table = iommu_init_table(tbl); 357 pci->iommu_table = iommu_init_table(tbl);
356 } else { 358 } else {
357 /* Do a 128MB table at root. This is used for the IDE 359 /* Do a 128MB table at root. This is used for the IDE
358 * controller on some SMP-mode POWER4 machines. It 360 * controller on some SMP-mode POWER4 machines. It
@@ -363,16 +365,16 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
363 * Allocate at offset 128MB to avoid having to deal 365 * Allocate at offset 128MB to avoid having to deal
364 * with ISA holes; 128MB table for IDE is plenty. 366 * with ISA holes; 128MB table for IDE is plenty.
365 */ 367 */
366 dn->phb->dma_window_size = 1 << 27; 368 pci->phb->dma_window_size = 1 << 27;
367 dn->phb->dma_window_base_cur = 1 << 27; 369 pci->phb->dma_window_base_cur = 1 << 27;
368 370
369 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 371 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
370 372
371 iommu_table_setparms(dn->phb, dn, tbl); 373 iommu_table_setparms(pci->phb, dn, tbl);
372 dn->iommu_table = iommu_init_table(tbl); 374 pci->iommu_table = iommu_init_table(tbl);
373 375
374 /* All child buses have 256MB tables */ 376 /* All child buses have 256MB tables */
375 dn->phb->dma_window_size = 1 << 28; 377 pci->phb->dma_window_size = 1 << 28;
376 } 378 }
377 } else { 379 } else {
378 pdn = pci_bus_to_OF_node(bus->parent); 380 pdn = pci_bus_to_OF_node(bus->parent);
@@ -386,12 +388,12 @@ static void iommu_bus_setup_pSeries(struct pci_bus *bus)
386 388
387 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL); 389 tbl = kmalloc(sizeof(struct iommu_table), GFP_KERNEL);
388 390
389 iommu_table_setparms(dn->phb, dn, tbl); 391 iommu_table_setparms(pci->phb, dn, tbl);
390 392
391 dn->iommu_table = iommu_init_table(tbl); 393 pci->iommu_table = iommu_init_table(tbl);
392 } else { 394 } else {
393 /* Lower than first child or under python, use parent table */ 395 /* Lower than first child or under python, use parent table */
394 dn->iommu_table = pdn->iommu_table; 396 pci->iommu_table = PCI_DN(pdn)->iommu_table;
395 } 397 }
396 } 398 }
397} 399}
@@ -401,6 +403,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
401{ 403{
402 struct iommu_table *tbl; 404 struct iommu_table *tbl;
403 struct device_node *dn, *pdn; 405 struct device_node *dn, *pdn;
406 struct pci_dn *ppci;
404 unsigned int *dma_window = NULL; 407 unsigned int *dma_window = NULL;
405 408
406 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); 409 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self);
@@ -419,22 +422,24 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
419 return; 422 return;
420 } 423 }
421 424
422 if (!pdn->iommu_table) { 425 ppci = pdn->data;
426 if (!ppci->iommu_table) {
423 /* Bussubno hasn't been copied yet. 427 /* Bussubno hasn't been copied yet.
424 * Do it now because iommu_table_setparms_lpar needs it. 428 * Do it now because iommu_table_setparms_lpar needs it.
425 */ 429 */
426 pdn->bussubno = bus->number; 430
431 ppci->bussubno = bus->number;
427 432
428 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table), 433 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table),
429 GFP_KERNEL); 434 GFP_KERNEL);
430 435
431 iommu_table_setparms_lpar(pdn->phb, pdn, tbl, dma_window); 436 iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window);
432 437
433 pdn->iommu_table = iommu_init_table(tbl); 438 ppci->iommu_table = iommu_init_table(tbl);
434 } 439 }
435 440
436 if (pdn != dn) 441 if (pdn != dn)
437 dn->iommu_table = pdn->iommu_table; 442 PCI_DN(dn)->iommu_table = ppci->iommu_table;
438} 443}
439 444
440 445
@@ -449,11 +454,11 @@ static void iommu_dev_setup_pSeries(struct pci_dev *dev)
449 */ 454 */
450 mydn = dn = pci_device_to_OF_node(dev); 455 mydn = dn = pci_device_to_OF_node(dev);
451 456
452 while (dn && dn->iommu_table == NULL) 457 while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL)
453 dn = dn->parent; 458 dn = dn->parent;
454 459
455 if (dn) { 460 if (dn && dn->data) {
456 mydn->iommu_table = dn->iommu_table; 461 PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table;
457 } else { 462 } else {
458 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, dev->pretty_name); 463 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, dev->pretty_name);
459 } 464 }
@@ -463,10 +468,11 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
463{ 468{
464 int err = NOTIFY_OK; 469 int err = NOTIFY_OK;
465 struct device_node *np = node; 470 struct device_node *np = node;
471 struct pci_dn *pci = np->data;
466 472
467 switch (action) { 473 switch (action) {
468 case PSERIES_RECONFIG_REMOVE: 474 case PSERIES_RECONFIG_REMOVE:
469 if (np->iommu_table && 475 if (pci->iommu_table &&
470 get_property(np, "ibm,dma-window", NULL)) 476 get_property(np, "ibm,dma-window", NULL))
471 iommu_free_table(np); 477 iommu_free_table(np);
472 break; 478 break;
@@ -486,6 +492,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
486 struct device_node *pdn, *dn; 492 struct device_node *pdn, *dn;
487 struct iommu_table *tbl; 493 struct iommu_table *tbl;
488 int *dma_window = NULL; 494 int *dma_window = NULL;
495 struct pci_dn *pci;
489 496
490 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, dev->pretty_name); 497 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, dev->pretty_name);
491 498
@@ -497,8 +504,10 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
497 */ 504 */
498 dn = pci_device_to_OF_node(dev); 505 dn = pci_device_to_OF_node(dev);
499 506
500 for (pdn = dn; pdn && !pdn->iommu_table; pdn = pdn->parent) { 507 for (pdn = dn; pdn && pdn->data && !PCI_DN(pdn)->iommu_table;
501 dma_window = (unsigned int *)get_property(pdn, "ibm,dma-window", NULL); 508 pdn = pdn->parent) {
509 dma_window = (unsigned int *)
510 get_property(pdn, "ibm,dma-window", NULL);
502 if (dma_window) 511 if (dma_window)
503 break; 512 break;
504 } 513 }
@@ -515,20 +524,21 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
515 DBG("Found DMA window, allocating table\n"); 524 DBG("Found DMA window, allocating table\n");
516 } 525 }
517 526
518 if (!pdn->iommu_table) { 527 pci = pdn->data;
528 if (!pci->iommu_table) {
519 /* iommu_table_setparms_lpar needs bussubno. */ 529 /* iommu_table_setparms_lpar needs bussubno. */
520 pdn->bussubno = pdn->phb->bus->number; 530 pci->bussubno = pci->phb->bus->number;
521 531
522 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table), 532 tbl = (struct iommu_table *)kmalloc(sizeof(struct iommu_table),
523 GFP_KERNEL); 533 GFP_KERNEL);
524 534
525 iommu_table_setparms_lpar(pdn->phb, pdn, tbl, dma_window); 535 iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window);
526 536
527 pdn->iommu_table = iommu_init_table(tbl); 537 pci->iommu_table = iommu_init_table(tbl);
528 } 538 }
529 539
530 if (pdn != dn) 540 if (pdn != dn)
531 dn->iommu_table = pdn->iommu_table; 541 PCI_DN(dn)->iommu_table = pci->iommu_table;
532} 542}
533 543
534static void iommu_bus_setup_null(struct pci_bus *b) { } 544static void iommu_bus_setup_null(struct pci_bus *b) { }
diff --git a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
index b5ca7d8347e2..8447dcc2c2b3 100644
--- a/arch/ppc64/kernel/pci.c
+++ b/arch/ppc64/kernel/pci.c
@@ -21,6 +21,7 @@
21#include <linux/bootmem.h> 21#include <linux/bootmem.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/syscalls.h>
24 25
25#include <asm/processor.h> 26#include <asm/processor.h>
26#include <asm/io.h> 27#include <asm/io.h>
@@ -837,9 +838,11 @@ int pcibios_scan_all_fns(struct pci_bus *bus, int devfn)
837 * device tree. If they are then we need to scan all the 838 * device tree. If they are then we need to scan all the
838 * functions of this slot. 839 * functions of this slot.
839 */ 840 */
840 for (dn = busdn->child; dn; dn = dn->sibling) 841 for (dn = busdn->child; dn; dn = dn->sibling) {
841 if ((dn->devfn >> 3) == (devfn >> 3)) 842 struct pci_dn *pdn = dn->data;
843 if (pdn && (pdn->devfn >> 3) == (devfn >> 3))
842 return 1; 844 return 1;
845 }
843 846
844 return 0; 847 return 0;
845} 848}
@@ -982,3 +985,62 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar,
982} 985}
983 986
984#endif /* CONFIG_PPC_MULTIPLATFORM */ 987#endif /* CONFIG_PPC_MULTIPLATFORM */
988
989
990#define IOBASE_BRIDGE_NUMBER 0
991#define IOBASE_MEMORY 1
992#define IOBASE_IO 2
993#define IOBASE_ISA_IO 3
994#define IOBASE_ISA_MEM 4
995
996long sys_pciconfig_iobase(long which, unsigned long in_bus,
997 unsigned long in_devfn)
998{
999 struct pci_controller* hose;
1000 struct list_head *ln;
1001 struct pci_bus *bus = NULL;
1002 struct device_node *hose_node;
1003
1004 /* Argh ! Please forgive me for that hack, but that's the
1005 * simplest way to get existing XFree to not lockup on some
1006 * G5 machines... So when something asks for bus 0 io base
1007 * (bus 0 is HT root), we return the AGP one instead.
1008 */
1009#ifdef CONFIG_PPC_PMAC
1010 if (systemcfg->platform == PLATFORM_POWERMAC &&
1011 machine_is_compatible("MacRISC4"))
1012 if (in_bus == 0)
1013 in_bus = 0xf0;
1014#endif /* CONFIG_PPC_PMAC */
1015
1016 /* That syscall isn't quite compatible with PCI domains, but it's
1017 * used on pre-domains setup. We return the first match
1018 */
1019
1020 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
1021 bus = pci_bus_b(ln);
1022 if (in_bus >= bus->number && in_bus < (bus->number + bus->subordinate))
1023 break;
1024 bus = NULL;
1025 }
1026 if (bus == NULL || bus->sysdata == NULL)
1027 return -ENODEV;
1028
1029 hose_node = (struct device_node *)bus->sysdata;
1030 hose = PCI_DN(hose_node)->phb;
1031
1032 switch (which) {
1033 case IOBASE_BRIDGE_NUMBER:
1034 return (long)hose->first_busno;
1035 case IOBASE_MEMORY:
1036 return (long)hose->pci_mem_offset;
1037 case IOBASE_IO:
1038 return (long)hose->io_base_phys;
1039 case IOBASE_ISA_IO:
1040 return (long)isa_io_base;
1041 case IOBASE_ISA_MEM:
1042 return -EINVAL;
1043 }
1044
1045 return -EOPNOTSUPP;
1046}
diff --git a/arch/ppc64/kernel/pci.h b/arch/ppc64/kernel/pci.h
index 26be78b13af1..5eb2cc320566 100644
--- a/arch/ppc64/kernel/pci.h
+++ b/arch/ppc64/kernel/pci.h
@@ -34,7 +34,6 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
34 34
35void pci_devs_phb_init(void); 35void pci_devs_phb_init(void);
36void pci_devs_phb_init_dynamic(struct pci_controller *phb); 36void pci_devs_phb_init_dynamic(struct pci_controller *phb);
37struct device_node *fetch_dev_dn(struct pci_dev *dev);
38 37
39/* PCI address cache management routines */ 38/* PCI address cache management routines */
40void pci_addr_cache_insert_device(struct pci_dev *dev); 39void pci_addr_cache_insert_device(struct pci_dev *dev);
diff --git a/arch/ppc64/kernel/pci_dn.c b/arch/ppc64/kernel/pci_dn.c
index ec345462afc3..a86389d07d57 100644
--- a/arch/ppc64/kernel/pci_dn.c
+++ b/arch/ppc64/kernel/pci_dn.c
@@ -23,6 +23,8 @@
23#include <linux/pci.h> 23#include <linux/pci.h>
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/slab.h>
27#include <linux/bootmem.h>
26 28
27#include <asm/io.h> 29#include <asm/io.h>
28#include <asm/prom.h> 30#include <asm/prom.h>
@@ -40,16 +42,26 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
40 struct pci_controller *phb = data; 42 struct pci_controller *phb = data;
41 int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL); 43 int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL);
42 u32 *regs; 44 u32 *regs;
43 45 struct pci_dn *pdn;
44 dn->phb = phb; 46
47 if (phb->is_dynamic)
48 pdn = kmalloc(sizeof(*pdn), GFP_KERNEL);
49 else
50 pdn = alloc_bootmem(sizeof(*pdn));
51 if (pdn == NULL)
52 return NULL;
53 memset(pdn, 0, sizeof(*pdn));
54 dn->data = pdn;
55 pdn->node = dn;
56 pdn->phb = phb;
45 regs = (u32 *)get_property(dn, "reg", NULL); 57 regs = (u32 *)get_property(dn, "reg", NULL);
46 if (regs) { 58 if (regs) {
47 /* First register entry is addr (00BBSS00) */ 59 /* First register entry is addr (00BBSS00) */
48 dn->busno = (regs[0] >> 16) & 0xff; 60 pdn->busno = (regs[0] >> 16) & 0xff;
49 dn->devfn = (regs[0] >> 8) & 0xff; 61 pdn->devfn = (regs[0] >> 8) & 0xff;
50 } 62 }
51 63
52 dn->pci_ext_config_space = (type && *type == 1); 64 pdn->pci_ext_config_space = (type && *type == 1);
53 return NULL; 65 return NULL;
54} 66}
55 67
@@ -112,10 +124,15 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
112void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb) 124void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb)
113{ 125{
114 struct device_node * dn = (struct device_node *) phb->arch_data; 126 struct device_node * dn = (struct device_node *) phb->arch_data;
127 struct pci_dn *pdn;
115 128
116 /* PHB nodes themselves must not match */ 129 /* PHB nodes themselves must not match */
117 dn->devfn = dn->busno = -1; 130 update_dn_pci_info(dn, phb);
118 dn->phb = phb; 131 pdn = dn->data;
132 if (pdn) {
133 pdn->devfn = pdn->busno = -1;
134 pdn->phb = phb;
135 }
119 136
120 /* Update dn->phb ptrs for new phb and children devices */ 137 /* Update dn->phb ptrs for new phb and children devices */
121 traverse_pci_devices(dn, update_dn_pci_info, phb); 138 traverse_pci_devices(dn, update_dn_pci_info, phb);
@@ -123,14 +140,17 @@ void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb)
123 140
124/* 141/*
125 * Traversal func that looks for a <busno,devfcn> value. 142 * Traversal func that looks for a <busno,devfcn> value.
126 * If found, the device_node is returned (thus terminating the traversal). 143 * If found, the pci_dn is returned (thus terminating the traversal).
127 */ 144 */
128static void *is_devfn_node(struct device_node *dn, void *data) 145static void *is_devfn_node(struct device_node *dn, void *data)
129{ 146{
130 int busno = ((unsigned long)data >> 8) & 0xff; 147 int busno = ((unsigned long)data >> 8) & 0xff;
131 int devfn = ((unsigned long)data) & 0xff; 148 int devfn = ((unsigned long)data) & 0xff;
149 struct pci_dn *pci = dn->data;
132 150
133 return ((devfn == dn->devfn) && (busno == dn->busno)) ? dn : NULL; 151 if (pci && (devfn == pci->devfn) && (busno == pci->busno))
152 return dn;
153 return NULL;
134} 154}
135 155
136/* 156/*
@@ -149,13 +169,10 @@ static void *is_devfn_node(struct device_node *dn, void *data)
149struct device_node *fetch_dev_dn(struct pci_dev *dev) 169struct device_node *fetch_dev_dn(struct pci_dev *dev)
150{ 170{
151 struct device_node *orig_dn = dev->sysdata; 171 struct device_node *orig_dn = dev->sysdata;
152 struct pci_controller *phb = orig_dn->phb; /* assume same phb as orig_dn */
153 struct device_node *phb_dn;
154 struct device_node *dn; 172 struct device_node *dn;
155 unsigned long searchval = (dev->bus->number << 8) | dev->devfn; 173 unsigned long searchval = (dev->bus->number << 8) | dev->devfn;
156 174
157 phb_dn = phb->arch_data; 175 dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval);
158 dn = traverse_pci_devices(phb_dn, is_devfn_node, (void *)searchval);
159 if (dn) 176 if (dn)
160 dev->sysdata = dn; 177 dev->sysdata = dn;
161 return dn; 178 return dn;
@@ -165,11 +182,13 @@ EXPORT_SYMBOL(fetch_dev_dn);
165static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) 182static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
166{ 183{
167 struct device_node *np = node; 184 struct device_node *np = node;
185 struct pci_dn *pci;
168 int err = NOTIFY_OK; 186 int err = NOTIFY_OK;
169 187
170 switch (action) { 188 switch (action) {
171 case PSERIES_RECONFIG_ADD: 189 case PSERIES_RECONFIG_ADD:
172 update_dn_pci_info(np, np->parent->phb); 190 pci = np->parent->data;
191 update_dn_pci_info(np, pci->phb);
173 break; 192 break;
174 default: 193 default:
175 err = NOTIFY_DONE; 194 err = NOTIFY_DONE;
diff --git a/arch/ppc64/kernel/pci_iommu.c b/arch/ppc64/kernel/pci_iommu.c
index ef0a62b916be..14647e09c9cd 100644
--- a/arch/ppc64/kernel/pci_iommu.c
+++ b/arch/ppc64/kernel/pci_iommu.c
@@ -66,7 +66,7 @@ static inline struct iommu_table *devnode_table(struct device *dev)
66#endif /* CONFIG_PPC_ISERIES */ 66#endif /* CONFIG_PPC_ISERIES */
67 67
68#ifdef CONFIG_PPC_MULTIPLATFORM 68#ifdef CONFIG_PPC_MULTIPLATFORM
69 return PCI_GET_DN(pdev)->iommu_table; 69 return PCI_DN(PCI_GET_DN(pdev))->iommu_table;
70#endif /* CONFIG_PPC_MULTIPLATFORM */ 70#endif /* CONFIG_PPC_MULTIPLATFORM */
71} 71}
72 72
diff --git a/arch/ppc64/kernel/pmac_feature.c b/arch/ppc64/kernel/pmac_feature.c
index 98ed2bccab1a..eb4e6c3f694d 100644
--- a/arch/ppc64/kernel/pmac_feature.c
+++ b/arch/ppc64/kernel/pmac_feature.c
@@ -674,6 +674,7 @@ void __init pmac_check_ht_link(void)
674#if 0 /* Disabled for now */ 674#if 0 /* Disabled for now */
675 u32 ufreq, freq, ucfg, cfg; 675 u32 ufreq, freq, ucfg, cfg;
676 struct device_node *pcix_node; 676 struct device_node *pcix_node;
677 struct pci_dn *pdn;
677 u8 px_bus, px_devfn; 678 u8 px_bus, px_devfn;
678 struct pci_controller *px_hose; 679 struct pci_controller *px_hose;
679 680
@@ -687,9 +688,10 @@ void __init pmac_check_ht_link(void)
687 printk("No PCI-X bridge found\n"); 688 printk("No PCI-X bridge found\n");
688 return; 689 return;
689 } 690 }
690 px_hose = pcix_node->phb; 691 pdn = pcix_node->data;
691 px_bus = pcix_node->busno; 692 px_hose = pdn->phb;
692 px_devfn = pcix_node->devfn; 693 px_bus = pdn->busno;
694 px_devfn = pdn->devfn;
693 695
694 early_read_config_dword(px_hose, px_bus, px_devfn, 0xc4, &cfg); 696 early_read_config_dword(px_hose, px_bus, px_devfn, 0xc4, &cfg);
695 early_read_config_dword(px_hose, px_bus, px_devfn, 0xcc, &freq); 697 early_read_config_dword(px_hose, px_bus, px_devfn, 0xcc, &freq);
diff --git a/arch/ppc64/kernel/pmac_pci.c b/arch/ppc64/kernel/pmac_pci.c
index 71fe911ad183..d37bff2d7d40 100644
--- a/arch/ppc64/kernel/pmac_pci.c
+++ b/arch/ppc64/kernel/pmac_pci.c
@@ -242,7 +242,7 @@ static int u3_ht_skip_device(struct pci_controller *hose,
242 else 242 else
243 busdn = hose->arch_data; 243 busdn = hose->arch_data;
244 for (dn = busdn->child; dn; dn = dn->sibling) 244 for (dn = busdn->child; dn; dn = dn->sibling)
245 if (dn->devfn == devfn) 245 if (dn->data && PCI_DN(dn)->devfn == devfn)
246 break; 246 break;
247 if (dn == NULL) 247 if (dn == NULL)
248 return -1; 248 return -1;
@@ -746,9 +746,9 @@ void __init pmac_pci_init(void)
746 */ 746 */
747 if (u3_agp) { 747 if (u3_agp) {
748 struct device_node *np = u3_agp->arch_data; 748 struct device_node *np = u3_agp->arch_data;
749 np->busno = 0xf0; 749 PCI_DN(np)->busno = 0xf0;
750 for (np = np->child; np; np = np->sibling) 750 for (np = np->child; np; np = np->sibling)
751 np->busno = 0xf0; 751 PCI_DN(np)->busno = 0xf0;
752 } 752 }
753 753
754 pmac_check_ht_link(); 754 pmac_check_ht_link();
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
index 6ad5a8467f87..7035deb6de92 100644
--- a/arch/ppc64/kernel/prom.c
+++ b/arch/ppc64/kernel/prom.c
@@ -1733,6 +1733,7 @@ static void of_node_release(struct kref *kref)
1733 kfree(node->intrs); 1733 kfree(node->intrs);
1734 kfree(node->addrs); 1734 kfree(node->addrs);
1735 kfree(node->full_name); 1735 kfree(node->full_name);
1736 kfree(node->data);
1736 kfree(node); 1737 kfree(node);
1737} 1738}
1738 1739
diff --git a/arch/ppc64/kernel/rtas_pci.c b/arch/ppc64/kernel/rtas_pci.c
index 1dccadaddd1d..4a9719b48abe 100644
--- a/arch/ppc64/kernel/rtas_pci.c
+++ b/arch/ppc64/kernel/rtas_pci.c
@@ -48,7 +48,7 @@ static int write_pci_config;
48static int ibm_read_pci_config; 48static int ibm_read_pci_config;
49static int ibm_write_pci_config; 49static int ibm_write_pci_config;
50 50
51static int config_access_valid(struct device_node *dn, int where) 51static int config_access_valid(struct pci_dn *dn, int where)
52{ 52{
53 if (where < 256) 53 if (where < 256)
54 return 1; 54 return 1;
@@ -78,15 +78,17 @@ static int rtas_read_config(struct device_node *dn, int where, int size, u32 *va
78 int returnval = -1; 78 int returnval = -1;
79 unsigned long buid, addr; 79 unsigned long buid, addr;
80 int ret; 80 int ret;
81 struct pci_dn *pdn;
81 82
82 if (!dn) 83 if (!dn || !dn->data)
83 return PCIBIOS_DEVICE_NOT_FOUND; 84 return PCIBIOS_DEVICE_NOT_FOUND;
84 if (!config_access_valid(dn, where)) 85 pdn = dn->data;
86 if (!config_access_valid(pdn, where))
85 return PCIBIOS_BAD_REGISTER_NUMBER; 87 return PCIBIOS_BAD_REGISTER_NUMBER;
86 88
87 addr = ((where & 0xf00) << 20) | (dn->busno << 16) | 89 addr = ((where & 0xf00) << 20) | (pdn->busno << 16) |
88 (dn->devfn << 8) | (where & 0xff); 90 (pdn->devfn << 8) | (where & 0xff);
89 buid = dn->phb->buid; 91 buid = pdn->phb->buid;
90 if (buid) { 92 if (buid) {
91 ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, 93 ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval,
92 addr, buid >> 32, buid & 0xffffffff, size); 94 addr, buid >> 32, buid & 0xffffffff, size);
@@ -98,8 +100,8 @@ static int rtas_read_config(struct device_node *dn, int where, int size, u32 *va
98 if (ret) 100 if (ret)
99 return PCIBIOS_DEVICE_NOT_FOUND; 101 return PCIBIOS_DEVICE_NOT_FOUND;
100 102
101 if (returnval == EEH_IO_ERROR_VALUE(size) 103 if (returnval == EEH_IO_ERROR_VALUE(size) &&
102 && eeh_dn_check_failure (dn, NULL)) 104 eeh_dn_check_failure (dn, NULL))
103 return PCIBIOS_DEVICE_NOT_FOUND; 105 return PCIBIOS_DEVICE_NOT_FOUND;
104 106
105 return PCIBIOS_SUCCESSFUL; 107 return PCIBIOS_SUCCESSFUL;
@@ -118,24 +120,28 @@ static int rtas_pci_read_config(struct pci_bus *bus,
118 120
119 /* Search only direct children of the bus */ 121 /* Search only direct children of the bus */
120 for (dn = busdn->child; dn; dn = dn->sibling) 122 for (dn = busdn->child; dn; dn = dn->sibling)
121 if (dn->devfn == devfn && of_device_available(dn)) 123 if (dn->data && PCI_DN(dn)->devfn == devfn
124 && of_device_available(dn))
122 return rtas_read_config(dn, where, size, val); 125 return rtas_read_config(dn, where, size, val);
126
123 return PCIBIOS_DEVICE_NOT_FOUND; 127 return PCIBIOS_DEVICE_NOT_FOUND;
124} 128}
125 129
126static int rtas_write_config(struct device_node *dn, int where, int size, u32 val) 130int rtas_write_config(struct device_node *dn, int where, int size, u32 val)
127{ 131{
128 unsigned long buid, addr; 132 unsigned long buid, addr;
129 int ret; 133 int ret;
134 struct pci_dn *pdn;
130 135
131 if (!dn) 136 if (!dn || !dn->data)
132 return PCIBIOS_DEVICE_NOT_FOUND; 137 return PCIBIOS_DEVICE_NOT_FOUND;
133 if (!config_access_valid(dn, where)) 138 pdn = dn->data;
139 if (!config_access_valid(pdn, where))
134 return PCIBIOS_BAD_REGISTER_NUMBER; 140 return PCIBIOS_BAD_REGISTER_NUMBER;
135 141
136 addr = ((where & 0xf00) << 20) | (dn->busno << 16) | 142 addr = ((where & 0xf00) << 20) | (pdn->busno << 16) |
137 (dn->devfn << 8) | (where & 0xff); 143 (pdn->devfn << 8) | (where & 0xff);
138 buid = dn->phb->buid; 144 buid = pdn->phb->buid;
139 if (buid) { 145 if (buid) {
140 ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, buid >> 32, buid & 0xffffffff, size, (ulong) val); 146 ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, buid >> 32, buid & 0xffffffff, size, (ulong) val);
141 } else { 147 } else {
@@ -161,7 +167,8 @@ static int rtas_pci_write_config(struct pci_bus *bus,
161 167
162 /* Search only direct children of the bus */ 168 /* Search only direct children of the bus */
163 for (dn = busdn->child; dn; dn = dn->sibling) 169 for (dn = busdn->child; dn; dn = dn->sibling)
164 if (dn->devfn == devfn && of_device_available(dn)) 170 if (dn->data && PCI_DN(dn)->devfn == devfn
171 && of_device_available(dn))
165 return rtas_write_config(dn, where, size, val); 172 return rtas_write_config(dn, where, size, val);
166 return PCIBIOS_DEVICE_NOT_FOUND; 173 return PCIBIOS_DEVICE_NOT_FOUND;
167} 174}
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 214914a95a50..e93c13458910 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -708,62 +708,9 @@ asmlinkage int sys32_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubu
708 compat_ptr(ubuf)); 708 compat_ptr(ubuf));
709} 709}
710 710
711#define IOBASE_BRIDGE_NUMBER 0
712#define IOBASE_MEMORY 1
713#define IOBASE_IO 2
714#define IOBASE_ISA_IO 3
715#define IOBASE_ISA_MEM 4
716
717asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn) 711asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
718{ 712{
719#ifdef CONFIG_PCI 713 return sys_pciconfig_iobase(which, in_bus, in_devfn);
720 struct pci_controller* hose;
721 struct list_head *ln;
722 struct pci_bus *bus = NULL;
723 struct device_node *hose_node;
724
725 /* Argh ! Please forgive me for that hack, but that's the
726 * simplest way to get existing XFree to not lockup on some
727 * G5 machines... So when something asks for bus 0 io base
728 * (bus 0 is HT root), we return the AGP one instead.
729 */
730#ifdef CONFIG_PPC_PMAC
731 if (systemcfg->platform == PLATFORM_POWERMAC &&
732 machine_is_compatible("MacRISC4"))
733 if (in_bus == 0)
734 in_bus = 0xf0;
735#endif /* CONFIG_PPC_PMAC */
736
737 /* That syscall isn't quite compatible with PCI domains, but it's
738 * used on pre-domains setup. We return the first match
739 */
740
741 for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
742 bus = pci_bus_b(ln);
743 if (in_bus >= bus->number && in_bus < (bus->number + bus->subordinate))
744 break;
745 bus = NULL;
746 }
747 if (bus == NULL || bus->sysdata == NULL)
748 return -ENODEV;
749
750 hose_node = (struct device_node *)bus->sysdata;
751 hose = hose_node->phb;
752
753 switch (which) {
754 case IOBASE_BRIDGE_NUMBER:
755 return (long)hose->first_busno;
756 case IOBASE_MEMORY:
757 return (long)hose->pci_mem_offset;
758 case IOBASE_IO:
759 return (long)hose->io_base_phys;
760 case IOBASE_ISA_IO:
761 return (long)isa_io_base;
762 case IOBASE_ISA_MEM:
763 return -EINVAL;
764 }
765#endif /* CONFIG_PCI */
766 return -EOPNOTSUPP;
767} 714}
768 715
769 716
diff --git a/arch/ppc64/kernel/syscalls.c b/arch/ppc64/kernel/syscalls.c
index a8cbb202b8cd..05f16633bd2c 100644
--- a/arch/ppc64/kernel/syscalls.c
+++ b/arch/ppc64/kernel/syscalls.c
@@ -46,10 +46,6 @@
46 46
47extern unsigned long wall_jiffies; 47extern unsigned long wall_jiffies;
48 48
49void
50check_bugs(void)
51{
52}
53 49
54/* 50/*
55 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 51 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
diff --git a/arch/ppc64/kernel/u3_iommu.c b/arch/ppc64/kernel/u3_iommu.c
index b6e3bca4102d..41ea09cb9ac7 100644
--- a/arch/ppc64/kernel/u3_iommu.c
+++ b/arch/ppc64/kernel/u3_iommu.c
@@ -276,7 +276,7 @@ static void iommu_dev_setup_u3(struct pci_dev *dev)
276 dn = pci_device_to_OF_node(dev); 276 dn = pci_device_to_OF_node(dev);
277 277
278 if (dn) 278 if (dn)
279 dn->iommu_table = &iommu_table_u3; 279 PCI_DN(dn)->iommu_table = &iommu_table_u3;
280} 280}
281 281
282static void iommu_bus_setup_u3(struct pci_bus *bus) 282static void iommu_bus_setup_u3(struct pci_bus *bus)
@@ -291,7 +291,7 @@ static void iommu_bus_setup_u3(struct pci_bus *bus)
291 dn = pci_bus_to_OF_node(bus); 291 dn = pci_bus_to_OF_node(bus);
292 292
293 if (dn) 293 if (dn)
294 dn->iommu_table = &iommu_table_u3; 294 PCI_DN(dn)->iommu_table = &iommu_table_u3;
295} 295}
296 296
297static void iommu_dev_setup_null(struct pci_dev *dev) { } 297static void iommu_dev_setup_null(struct pci_dev *dev) { }
diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
index ed6766e21f5a..d49c3613c8ec 100644
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -158,14 +158,20 @@ static struct console udbg_console = {
158 .index = -1, 158 .index = -1,
159}; 159};
160 160
161static int early_console_initialized;
162
161void __init disable_early_printk(void) 163void __init disable_early_printk(void)
162{ 164{
165 if (!early_console_initialized)
166 return;
163 unregister_console(&udbg_console); 167 unregister_console(&udbg_console);
168 early_console_initialized = 0;
164} 169}
165 170
166/* called by setup_system */ 171/* called by setup_system */
167void register_early_udbg_console(void) 172void register_early_udbg_console(void)
168{ 173{
174 early_console_initialized = 1;
169 register_console(&udbg_console); 175 register_console(&udbg_console);
170} 176}
171 177
diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
index a14ab87df491..c2157c9c3acb 100644
--- a/arch/ppc64/mm/init.c
+++ b/arch/ppc64/mm/init.c
@@ -554,12 +554,12 @@ void __init do_init_bootmem(void)
554 * present. 554 * present.
555 */ 555 */
556 for (i=0; i < lmb.memory.cnt; i++) 556 for (i=0; i < lmb.memory.cnt; i++)
557 free_bootmem(lmb_start_pfn(&lmb.memory, i), 557 free_bootmem(lmb.memory.region[i].base,
558 lmb_size_bytes(&lmb.memory, i)); 558 lmb_size_bytes(&lmb.memory, i));
559 559
560 /* reserve the sections we're already using */ 560 /* reserve the sections we're already using */
561 for (i=0; i < lmb.reserved.cnt; i++) 561 for (i=0; i < lmb.reserved.cnt; i++)
562 reserve_bootmem(lmb_start_pfn(&lmb.reserved, i), 562 reserve_bootmem(lmb.reserved.region[i].base,
563 lmb_size_bytes(&lmb.reserved, i)); 563 lmb_size_bytes(&lmb.reserved, i));
564 564
565 for (i=0; i < lmb.memory.cnt; i++) 565 for (i=0; i < lmb.memory.cnt; i++)
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index 4ada15111af0..ad1017da8656 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -134,7 +134,8 @@ static void rpadlpar_claim_one_bus(struct pci_bus *b)
134static int pci_add_secondary_bus(struct device_node *dn, 134static int pci_add_secondary_bus(struct device_node *dn,
135 struct pci_dev *bridge_dev) 135 struct pci_dev *bridge_dev)
136{ 136{
137 struct pci_controller *hose = dn->phb; 137 struct pci_dn *pdn = dn->data;
138 struct pci_controller *hose = pdn->phb;
138 struct pci_bus *child; 139 struct pci_bus *child;
139 u8 sec_busno; 140 u8 sec_busno;
140 141
@@ -159,7 +160,7 @@ static int pci_add_secondary_bus(struct device_node *dn,
159 if (hose->last_busno < child->number) 160 if (hose->last_busno < child->number)
160 hose->last_busno = child->number; 161 hose->last_busno = child->number;
161 162
162 dn->bussubno = child->number; 163 pdn->bussubno = child->number;
163 164
164 /* ioremap() for child bus, which may or may not succeed */ 165 /* ioremap() for child bus, which may or may not succeed */
165 remap_bus_range(child); 166 remap_bus_range(child);
@@ -183,11 +184,12 @@ static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
183 184
184static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) 185static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
185{ 186{
186 struct pci_controller *hose = dn->phb; 187 struct pci_dn *pdn = dn->data;
188 struct pci_controller *hose = pdn->phb;
187 struct pci_dev *dev = NULL; 189 struct pci_dev *dev = NULL;
188 190
189 /* Scan phb bus for EADS device, adding new one to bus->devices */ 191 /* Scan phb bus for EADS device, adding new one to bus->devices */
190 if (!pci_scan_single_device(hose->bus, dn->devfn)) { 192 if (!pci_scan_single_device(hose->bus, pdn->devfn)) {
191 printk(KERN_ERR "%s: found no device on bus\n", __FUNCTION__); 193 printk(KERN_ERR "%s: found no device on bus\n", __FUNCTION__);
192 return NULL; 194 return NULL;
193 } 195 }
@@ -269,6 +271,7 @@ static int dlpar_remove_root_bus(struct pci_controller *phb)
269static int dlpar_remove_phb(char *drc_name, struct device_node *dn) 271static int dlpar_remove_phb(char *drc_name, struct device_node *dn)
270{ 272{
271 struct slot *slot; 273 struct slot *slot;
274 struct pci_dn *pdn;
272 int rc = 0; 275 int rc = 0;
273 276
274 if (!rpaphp_find_pci_bus(dn)) 277 if (!rpaphp_find_pci_bus(dn))
@@ -285,12 +288,13 @@ static int dlpar_remove_phb(char *drc_name, struct device_node *dn)
285 } 288 }
286 } 289 }
287 290
288 BUG_ON(!dn->phb); 291 pdn = dn->data;
289 rc = dlpar_remove_root_bus(dn->phb); 292 BUG_ON(!pdn || !pdn->phb);
293 rc = dlpar_remove_root_bus(pdn->phb);
290 if (rc < 0) 294 if (rc < 0)
291 return rc; 295 return rc;
292 296
293 dn->phb = NULL; 297 pdn->phb = NULL;
294 298
295 return 0; 299 return 0;
296} 300}
@@ -299,7 +303,7 @@ static int dlpar_add_phb(char *drc_name, struct device_node *dn)
299{ 303{
300 struct pci_controller *phb; 304 struct pci_controller *phb;
301 305
302 if (dn->phb) { 306 if (PCI_DN(dn)->phb) {
303 /* PHB already exists */ 307 /* PHB already exists */
304 return -EINVAL; 308 return -EINVAL;
305 } 309 }
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
index 17a0279ebcb9..49e4d10a6488 100644
--- a/drivers/pci/hotplug/rpaphp_pci.c
+++ b/drivers/pci/hotplug/rpaphp_pci.c
@@ -51,10 +51,12 @@ static struct pci_bus *find_bus_among_children(struct pci_bus *bus,
51 51
52struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn) 52struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn)
53{ 53{
54 if (!dn->phb || !dn->phb->bus) 54 struct pci_dn *pdn = dn->data;
55
56 if (!pdn || !pdn->phb || !pdn->phb->bus)
55 return NULL; 57 return NULL;
56 58
57 return find_bus_among_children(dn->phb->bus, dn); 59 return find_bus_among_children(pdn->phb->bus, dn);
58} 60}
59EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus); 61EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus);
60 62
@@ -229,7 +231,7 @@ rpaphp_pci_config_slot(struct pci_bus *bus)
229 if (!dn || !dn->child) 231 if (!dn || !dn->child)
230 return NULL; 232 return NULL;
231 233
232 slotno = PCI_SLOT(dn->child->devfn); 234 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
233 235
234 /* pci_scan_slot should find all children */ 236 /* pci_scan_slot should find all children */
235 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); 237 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
diff --git a/drivers/video/offb.c b/drivers/video/offb.c
index 42a6591e863f..611922c0b22f 100644
--- a/drivers/video/offb.c
+++ b/drivers/video/offb.c
@@ -363,7 +363,7 @@ static void __init offb_init_nodriver(struct device_node *dp)
363 address = (u_long) dp->addrs[i].address; 363 address = (u_long) dp->addrs[i].address;
364 364
365#ifdef CONFIG_PPC64 365#ifdef CONFIG_PPC64
366 address += dp->phb->pci_mem_offset; 366 address += ((struct pci_dn *)dp->data)->phb->pci_mem_offset;
367#endif 367#endif
368 368
369 /* kludge for valkyrie */ 369 /* kludge for valkyrie */
diff --git a/include/asm-powerpc/8253pit.h b/include/asm-powerpc/8253pit.h
index 862708a749b0..b70d6e53b303 100644
--- a/include/asm-powerpc/8253pit.h
+++ b/include/asm-powerpc/8253pit.h
@@ -1,10 +1,10 @@
1#ifndef _ASM_POWERPC_8253PIT_H
2#define _ASM_POWERPC_8253PIT_H
3
1/* 4/*
2 * 8253/8254 Programmable Interval Timer 5 * 8253/8254 Programmable Interval Timer
3 */ 6 */
4 7
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#define PIT_TICK_RATE 1193182UL 8#define PIT_TICK_RATE 1193182UL
9 9
10#endif 10#endif /* _ASM_POWERPC_8253PIT_H */
diff --git a/include/asm-powerpc/agp.h b/include/asm-powerpc/agp.h
index ca9e423307f4..885b4631a6cf 100644
--- a/include/asm-powerpc/agp.h
+++ b/include/asm-powerpc/agp.h
@@ -1,10 +1,8 @@
1#ifndef AGP_H 1#ifndef _ASM_POWERPC_AGP_H
2#define AGP_H 1 2#define _ASM_POWERPC_AGP_H
3 3
4#include <asm/io.h> 4#include <asm/io.h>
5 5
6/* nothing much needed here */
7
8#define map_page_into_agp(page) 6#define map_page_into_agp(page)
9#define unmap_page_from_agp(page) 7#define unmap_page_from_agp(page)
10#define flush_agp_mappings() 8#define flush_agp_mappings()
@@ -20,4 +18,4 @@
20#define free_gatt_pages(table, order) \ 18#define free_gatt_pages(table, order) \
21 free_pages((unsigned long)(table), (order)) 19 free_pages((unsigned long)(table), (order))
22 20
23#endif 21#endif /* _ASM_POWERPC_AGP_H */
diff --git a/include/asm-powerpc/bugs.h b/include/asm-powerpc/bugs.h
index 310187d0e33a..42fdb73e3068 100644
--- a/include/asm-powerpc/bugs.h
+++ b/include/asm-powerpc/bugs.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_BUGS_H 1#ifndef _ASM_POWERPC_BUGS_H
2#define _POWERPC_BUGS_H 2#define _ASM_POWERPC_BUGS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -13,6 +13,6 @@
13 * architecture-dependent bugs. 13 * architecture-dependent bugs.
14 */ 14 */
15 15
16extern void check_bugs(void); 16static inline void check_bugs(void) { }
17 17
18#endif /* _POWERPC_BUGS_H */ 18#endif /* _ASM_POWERPC_BUGS_H */
diff --git a/include/asm-powerpc/errno.h b/include/asm-powerpc/errno.h
index 19f20bd41ae6..8c145fd17d86 100644
--- a/include/asm-powerpc/errno.h
+++ b/include/asm-powerpc/errno.h
@@ -1,5 +1,5 @@
1#ifndef _PPC_ERRNO_H 1#ifndef _ASM_POWERPC_ERRNO_H
2#define _PPC_ERRNO_H 2#define _ASM_POWERPC_ERRNO_H
3 3
4#include <asm-generic/errno.h> 4#include <asm-generic/errno.h>
5 5
@@ -8,4 +8,4 @@
8 8
9#define _LAST_ERRNO 516 9#define _LAST_ERRNO 516
10 10
11#endif 11#endif /* _ASM_POWERPC_ERRNO_H */
diff --git a/include/asm-powerpc/ioctl.h b/include/asm-powerpc/ioctl.h
index 93c6acfdd0fd..8eb99848c402 100644
--- a/include/asm-powerpc/ioctl.h
+++ b/include/asm-powerpc/ioctl.h
@@ -1,5 +1,5 @@
1#ifndef _PPC_IOCTL_H 1#ifndef _ASM_POWERPC_IOCTL_H
2#define _PPC_IOCTL_H 2#define _ASM_POWERPC_IOCTL_H
3 3
4 4
5/* 5/*
@@ -66,4 +66,4 @@ extern unsigned int __invalid_size_argument_for_IOC;
66#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) 66#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
67#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) 67#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
68 68
69#endif 69#endif /* _ASM_POWERPC_IOCTL_H */
diff --git a/include/asm-powerpc/ioctls.h b/include/asm-powerpc/ioctls.h
index f5b7f2b055e7..5b94ff489b8b 100644
--- a/include/asm-powerpc/ioctls.h
+++ b/include/asm-powerpc/ioctls.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_PPC_IOCTLS_H 1#ifndef _ASM_POWERPC_IOCTLS_H
2#define _ASM_PPC_IOCTLS_H 2#define _ASM_POWERPC_IOCTLS_H
3 3
4#include <asm/ioctl.h> 4#include <asm/ioctl.h>
5 5
@@ -104,4 +104,4 @@
104#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ 104#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
105#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ 105#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
106 106
107#endif /* _ASM_PPC_IOCTLS_H */ 107#endif /* _ASM_POWERPC_IOCTLS_H */
diff --git a/include/asm-powerpc/linkage.h b/include/asm-powerpc/linkage.h
index 291c2d01c44f..e1c4ac1cc4ba 100644
--- a/include/asm-powerpc/linkage.h
+++ b/include/asm-powerpc/linkage.h
@@ -1,6 +1,6 @@
1#ifndef __ASM_LINKAGE_H 1#ifndef _ASM_POWERPC_LINKAGE_H
2#define __ASM_LINKAGE_H 2#define _ASM_POWERPC_LINKAGE_H
3 3
4/* Nothing to see here... */ 4/* Nothing to see here... */
5 5
6#endif 6#endif /* _ASM_POWERPC_LINKAGE_H */
diff --git a/include/asm-powerpc/mc146818rtc.h b/include/asm-powerpc/mc146818rtc.h
index a5619a2a1393..f2741c8b59a1 100644
--- a/include/asm-powerpc/mc146818rtc.h
+++ b/include/asm-powerpc/mc146818rtc.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_MC146818RTC_H 1#ifndef _ASM_POWERPC_MC146818RTC_H
2#define _POWERPC_MC146818RTC_H 2#define _ASM_POWERPC_MC146818RTC_H
3 3
4/* 4/*
5 * Machine dependent access functions for RTC registers. 5 * Machine dependent access functions for RTC registers.
@@ -33,4 +33,4 @@ outb_p((val),RTC_PORT(1)); \
33}) 33})
34 34
35#endif /* __KERNEL__ */ 35#endif /* __KERNEL__ */
36#endif /* _POWERPC_MC146818RTC_H */ 36#endif /* _ASM_POWERPC_MC146818RTC_H */
diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h
index f2d55988d749..f5e5342fcac5 100644
--- a/include/asm-powerpc/mman.h
+++ b/include/asm-powerpc/mman.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_MMAN_H 1#ifndef _ASM_POWERPC_MMAN_H
2#define _POWERPC_MMAN_H 2#define _ASM_POWERPC_MMAN_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -49,4 +49,4 @@
49#define MAP_ANON MAP_ANONYMOUS 49#define MAP_ANON MAP_ANONYMOUS
50#define MAP_FILE 0 50#define MAP_FILE 0
51 51
52#endif /* _POWERPC_MMAN_H */ 52#endif /* _ASM_POWERPC_MMAN_H */
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h
index 4438f4fd6524..7ecd05e03051 100644
--- a/include/asm-powerpc/module.h
+++ b/include/asm-powerpc/module.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_MODULE_H 1#ifndef _ASM_POWERPC_MODULE_H
2#define _POWERPC_MODULE_H 2#define _ASM_POWERPC_MODULE_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -74,4 +74,4 @@ struct exception_table_entry;
74void sort_ex_table(struct exception_table_entry *start, 74void sort_ex_table(struct exception_table_entry *start,
75 struct exception_table_entry *finish); 75 struct exception_table_entry *finish);
76 76
77#endif /* _POWERPC_MODULE_H */ 77#endif /* _ASM_POWERPC_MODULE_H */
diff --git a/include/asm-ppc/msgbuf.h b/include/asm-powerpc/msgbuf.h
index 1053452a9376..dd76743c7537 100644
--- a/include/asm-ppc/msgbuf.h
+++ b/include/asm-powerpc/msgbuf.h
@@ -1,17 +1,25 @@
1#ifndef _PPC_MSGBUF_H 1#ifndef _ASM_POWERPC_MSGBUF_H
2#define _PPC_MSGBUF_H 2#define _ASM_POWERPC_MSGBUF_H
3 3
4/* 4/*
5 * The msqid64_ds structure for the PPC architecture. 5 * The msqid64_ds structure for the PowerPC architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
6 */ 8 */
7 9
8struct msqid64_ds { 10struct msqid64_ds {
9 struct ipc64_perm msg_perm; 11 struct ipc64_perm msg_perm;
12#ifndef __powerpc64__
10 unsigned int __unused1; 13 unsigned int __unused1;
14#endif
11 __kernel_time_t msg_stime; /* last msgsnd time */ 15 __kernel_time_t msg_stime; /* last msgsnd time */
16#ifndef __powerpc64__
12 unsigned int __unused2; 17 unsigned int __unused2;
18#endif
13 __kernel_time_t msg_rtime; /* last msgrcv time */ 19 __kernel_time_t msg_rtime; /* last msgrcv time */
20#ifndef __powerpc64__
14 unsigned int __unused3; 21 unsigned int __unused3;
22#endif
15 __kernel_time_t msg_ctime; /* last change time */ 23 __kernel_time_t msg_ctime; /* last change time */
16 unsigned long msg_cbytes; /* current number of bytes on queue */ 24 unsigned long msg_cbytes; /* current number of bytes on queue */
17 unsigned long msg_qnum; /* number of messages in queue */ 25 unsigned long msg_qnum; /* number of messages in queue */
@@ -22,4 +30,4 @@ struct msqid64_ds {
22 unsigned long __unused5; 30 unsigned long __unused5;
23}; 31};
24 32
25#endif /* _PPC_MSGBUF_H */ 33#endif /* _ASM_POWERPC_MSGBUF_H */
diff --git a/include/asm-powerpc/namei.h b/include/asm-powerpc/namei.h
index 29c9ec832133..657443474a6a 100644
--- a/include/asm-powerpc/namei.h
+++ b/include/asm-powerpc/namei.h
@@ -1,14 +1,14 @@
1#ifndef _ASM_POWERPC_NAMEI_H
2#define _ASM_POWERPC_NAMEI_H
3
4#ifdef __KERNEL__
5
1/* 6/*
2 * include/asm-ppc/namei.h
3 * Adapted from include/asm-alpha/namei.h 7 * Adapted from include/asm-alpha/namei.h
4 * 8 *
5 * Included from fs/namei.c 9 * Included from fs/namei.c
6 */ 10 */
7 11
8#ifdef __KERNEL__
9#ifndef __PPC_NAMEI_H
10#define __PPC_NAMEI_H
11
12/* This dummy routine maybe changed to something useful 12/* This dummy routine maybe changed to something useful
13 * for /usr/gnemul/ emulation stuff. 13 * for /usr/gnemul/ emulation stuff.
14 * Look at asm-sparc/namei.h for details. 14 * Look at asm-sparc/namei.h for details.
@@ -16,5 +16,5 @@
16 16
17#define __emul_prefix() NULL 17#define __emul_prefix() NULL
18 18
19#endif /* __PPC_NAMEI_H */ 19#endif /* __KERNEL__ */
20#endif /* __KERNEL__ */ 20#endif /* _ASM_POWERPC_NAMEI_H */
diff --git a/include/asm-ppc/param.h b/include/asm-powerpc/param.h
index 6198b1657a45..bdc724f70884 100644
--- a/include/asm-ppc/param.h
+++ b/include/asm-powerpc/param.h
@@ -1,10 +1,10 @@
1#ifndef _ASM_PPC_PARAM_H 1#ifndef _ASM_POWERPC_PARAM_H
2#define _ASM_PPC_PARAM_H 2#define _ASM_POWERPC_PARAM_H
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7#define HZ CONFIG_HZ /* internal timer frequency */ 7#define HZ CONFIG_HZ /* internal kernel timer frequency */
8#define USER_HZ 100 /* for user interfaces in "ticks" */ 8#define USER_HZ 100 /* for user interfaces in "ticks" */
9#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ 9#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
10#endif /* __KERNEL__ */ 10#endif /* __KERNEL__ */
@@ -21,4 +21,4 @@
21 21
22#define MAXHOSTNAMELEN 64 /* max length of hostname */ 22#define MAXHOSTNAMELEN 64 /* max length of hostname */
23 23
24#endif 24#endif /* _ASM_POWERPC_PARAM_H */
diff --git a/include/asm-powerpc/poll.h b/include/asm-powerpc/poll.h
index be5024913c62..edd2054da86b 100644
--- a/include/asm-powerpc/poll.h
+++ b/include/asm-powerpc/poll.h
@@ -1,5 +1,5 @@
1#ifndef __PPC_POLL_H 1#ifndef _ASM_POWERPC_POLL_H
2#define __PPC_POLL_H 2#define _ASM_POWERPC_POLL_H
3 3
4#define POLLIN 0x0001 4#define POLLIN 0x0001
5#define POLLPRI 0x0002 5#define POLLPRI 0x0002
@@ -20,4 +20,4 @@ struct pollfd {
20 short revents; 20 short revents;
21}; 21};
22 22
23#endif 23#endif /* _ASM_POWERPC_POLL_H */
diff --git a/include/asm-powerpc/sembuf.h b/include/asm-powerpc/sembuf.h
index c98fc18fe805..99a41938ae3d 100644
--- a/include/asm-powerpc/sembuf.h
+++ b/include/asm-powerpc/sembuf.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SEMBUF_H 1#ifndef _ASM_POWERPC_SEMBUF_H
2#define _POWERPC_SEMBUF_H 2#define _ASM_POWERPC_SEMBUF_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -33,4 +33,4 @@ struct semid64_ds {
33 unsigned long __unused4; 33 unsigned long __unused4;
34}; 34};
35 35
36#endif /* _POWERPC_SEMBUF_H */ 36#endif /* _ASM_POWERPC_SEMBUF_H */
diff --git a/include/asm-powerpc/setup.h b/include/asm-powerpc/setup.h
new file mode 100644
index 000000000000..3d9740aae018
--- /dev/null
+++ b/include/asm-powerpc/setup.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_POWERPC_SETUP_H
2#define _ASM_POWERPC_SETUP_H
3
4#ifdef __KERNEL__
5
6#define COMMAND_LINE_SIZE 512
7
8#endif /* __KERNEL__ */
9#endif /* _ASM_POWERPC_SETUP_H */
diff --git a/include/asm-powerpc/shmbuf.h b/include/asm-powerpc/shmbuf.h
index 29632db3b178..8efa39698b6c 100644
--- a/include/asm-powerpc/shmbuf.h
+++ b/include/asm-powerpc/shmbuf.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SHMBUF_H 1#ifndef _ASM_POWERPC_SHMBUF_H
2#define _POWERPC_SHMBUF_H 2#define _ASM_POWERPC_SHMBUF_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -21,19 +21,19 @@
21 21
22struct shmid64_ds { 22struct shmid64_ds {
23 struct ipc64_perm shm_perm; /* operation perms */ 23 struct ipc64_perm shm_perm; /* operation perms */
24#ifndef __power64__ 24#ifndef __powerpc64__
25 unsigned long __unused1; 25 unsigned long __unused1;
26#endif 26#endif
27 __kernel_time_t shm_atime; /* last attach time */ 27 __kernel_time_t shm_atime; /* last attach time */
28#ifndef __power64__ 28#ifndef __powerpc64__
29 unsigned long __unused2; 29 unsigned long __unused2;
30#endif 30#endif
31 __kernel_time_t shm_dtime; /* last detach time */ 31 __kernel_time_t shm_dtime; /* last detach time */
32#ifndef __power64__ 32#ifndef __powerpc64__
33 unsigned long __unused3; 33 unsigned long __unused3;
34#endif 34#endif
35 __kernel_time_t shm_ctime; /* last change time */ 35 __kernel_time_t shm_ctime; /* last change time */
36#ifndef __power64__ 36#ifndef __powerpc64__
37 unsigned long __unused4; 37 unsigned long __unused4;
38#endif 38#endif
39 size_t shm_segsz; /* size of segment (bytes) */ 39 size_t shm_segsz; /* size of segment (bytes) */
@@ -56,4 +56,4 @@ struct shminfo64 {
56 unsigned long __unused4; 56 unsigned long __unused4;
57}; 57};
58 58
59#endif /* _POWERPC_SHMBUF_H */ 59#endif /* _ASM_POWERPC_SHMBUF_H */
diff --git a/include/asm-powerpc/shmparam.h b/include/asm-powerpc/shmparam.h
index d6250602ae64..5cda42a6d39e 100644
--- a/include/asm-powerpc/shmparam.h
+++ b/include/asm-powerpc/shmparam.h
@@ -1,6 +1,6 @@
1#ifndef _PPC_SHMPARAM_H 1#ifndef _ASM_POWERPC_SHMPARAM_H
2#define _PPC_SHMPARAM_H 2#define _ASM_POWERPC_SHMPARAM_H
3 3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ 4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5 5
6#endif /* _PPC_SHMPARAM_H */ 6#endif /* _ASM_POWERPC_SHMPARAM_H */
diff --git a/include/asm-powerpc/siginfo.h b/include/asm-powerpc/siginfo.h
index ae70b8010b19..538ea8ef509b 100644
--- a/include/asm-powerpc/siginfo.h
+++ b/include/asm-powerpc/siginfo.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SIGINFO_H 1#ifndef _ASM_POWERPC_SIGINFO_H
2#define _POWERPC_SIGINFO_H 2#define _ASM_POWERPC_SIGINFO_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -15,4 +15,4 @@
15 15
16#include <asm-generic/siginfo.h> 16#include <asm-generic/siginfo.h>
17 17
18#endif /* _POWERPC_SIGINFO_H */ 18#endif /* _ASM_POWERPC_SIGINFO_H */
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
index 51a0cf5ee9f0..e4b8177d4acc 100644
--- a/include/asm-powerpc/socket.h
+++ b/include/asm-powerpc/socket.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SOCKET_H 1#ifndef _ASM_POWERPC_SOCKET_H
2#define _POWERPC_SOCKET_H 2#define _ASM_POWERPC_SOCKET_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -56,4 +56,4 @@
56 56
57#define SO_PEERSEC 31 57#define SO_PEERSEC 31
58 58
59#endif /* _POWERPC_SOCKET_H */ 59#endif /* _ASM_POWERPC_SOCKET_H */
diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h
index ef7ff664167e..590078d8ed28 100644
--- a/include/asm-powerpc/sockios.h
+++ b/include/asm-powerpc/sockios.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_SOCKIOS_H 1#ifndef _ASM_POWERPC_SOCKIOS_H
2#define _POWERPC_SOCKIOS_H 2#define _ASM_POWERPC_SOCKIOS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -16,4 +16,4 @@
16#define SIOCATMARK 0x8905 16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */ 17#define SIOCGSTAMP 0x8906 /* Get stamp */
18 18
19#endif /* _POWERPC_SOCKIOS_H */ 19#endif /* _ASM_POWERPC_SOCKIOS_H */
diff --git a/include/asm-powerpc/string.h b/include/asm-powerpc/string.h
index 225575997392..8606a696c088 100644
--- a/include/asm-powerpc/string.h
+++ b/include/asm-powerpc/string.h
@@ -1,5 +1,5 @@
1#ifndef _PPC_STRING_H_ 1#ifndef _ASM_POWERPC_STRING_H
2#define _PPC_STRING_H_ 2#define _ASM_POWERPC_STRING_H
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
@@ -29,4 +29,4 @@ extern void * memchr(const void *,int,__kernel_size_t);
29 29
30#endif /* __KERNEL__ */ 30#endif /* __KERNEL__ */
31 31
32#endif 32#endif /* _ASM_POWERPC_STRING_H */
diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h
index 2c5bf85a8c3c..ebf6055481dc 100644
--- a/include/asm-powerpc/termbits.h
+++ b/include/asm-powerpc/termbits.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_TERMBITS_H 1#ifndef _ASM_POWERPC_TERMBITS_H
2#define _POWERPC_TERMBITS_H 2#define _ASM_POWERPC_TERMBITS_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -188,4 +188,4 @@ struct termios {
188#define TCSADRAIN 1 188#define TCSADRAIN 1
189#define TCSAFLUSH 2 189#define TCSAFLUSH 2
190 190
191#endif /* _POWERPC_TERMBITS_H */ 191#endif /* _ASM_POWERPC_TERMBITS_H */
diff --git a/include/asm-powerpc/termios.h b/include/asm-powerpc/termios.h
index 237533bb0e9f..c5b8e5358f83 100644
--- a/include/asm-powerpc/termios.h
+++ b/include/asm-powerpc/termios.h
@@ -1,5 +1,5 @@
1#ifndef _POWERPC_TERMIOS_H 1#ifndef _ASM_POWERPC_TERMIOS_H
2#define _POWERPC_TERMIOS_H 2#define _ASM_POWERPC_TERMIOS_H
3 3
4/* 4/*
5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[] 5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
@@ -233,4 +233,4 @@ struct termio {
233 233
234#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
235 235
236#endif /* _POWERPC_TERMIOS_H */ 236#endif /* _ASM_POWERPC_TERMIOS_H */
diff --git a/include/asm-ppc/timex.h b/include/asm-powerpc/timex.h
index cffc8712077c..51c5b316be55 100644
--- a/include/asm-ppc/timex.h
+++ b/include/asm-powerpc/timex.h
@@ -1,11 +1,11 @@
1#ifndef _ASM_POWERPC_TIMEX_H
2#define _ASM_POWERPC_TIMEX_H
3
4#ifdef __KERNEL__
5
1/* 6/*
2 * include/asm-ppc/timex.h 7 * PowerPC architecture timex specifications
3 *
4 * ppc architecture timex specifications
5 */ 8 */
6#ifdef __KERNEL__
7#ifndef _ASMppc_TIMEX_H
8#define _ASMppc_TIMEX_H
9 9
10#include <linux/config.h> 10#include <linux/config.h>
11#include <asm/cputable.h> 11#include <asm/cputable.h>
@@ -14,14 +14,21 @@
14 14
15typedef unsigned long cycles_t; 15typedef unsigned long cycles_t;
16 16
17/*
18 * For the "cycle" counter we use the timebase lower half.
19 * Currently only used on SMP.
20 */
21
22static inline cycles_t get_cycles(void) 17static inline cycles_t get_cycles(void)
23{ 18{
24 cycles_t ret = 0; 19 cycles_t ret;
20
21#ifdef __powerpc64__
22
23 __asm__ __volatile__("mftb %0" : "=r" (ret) : );
24
25#else
26 /*
27 * For the "cycle" counter we use the timebase lower half.
28 * Currently only used on SMP.
29 */
30
31 ret = 0;
25 32
26 __asm__ __volatile__( 33 __asm__ __volatile__(
27 "98: mftb %0\n" 34 "98: mftb %0\n"
@@ -33,8 +40,10 @@ static inline cycles_t get_cycles(void)
33 " .long 99b\n" 40 " .long 99b\n"
34 ".previous" 41 ".previous"
35 : "=r" (ret) : "i" (CPU_FTR_601)); 42 : "=r" (ret) : "i" (CPU_FTR_601));
43#endif
44
36 return ret; 45 return ret;
37} 46}
38 47
39#endif 48#endif /* __KERNEL__ */
40#endif /* __KERNEL__ */ 49#endif /* _ASM_POWERPC_TIMEX_H */
diff --git a/include/asm-ppc64/topology.h b/include/asm-powerpc/topology.h
index 1e9b19073230..2512e3836bf4 100644
--- a/include/asm-ppc64/topology.h
+++ b/include/asm-powerpc/topology.h
@@ -1,11 +1,12 @@
1#ifndef _ASM_PPC64_TOPOLOGY_H 1#ifndef _ASM_POWERPC_TOPOLOGY_H
2#define _ASM_PPC64_TOPOLOGY_H 2#define _ASM_POWERPC_TOPOLOGY_H
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <asm/mmzone.h>
6 5
7#ifdef CONFIG_NUMA 6#ifdef CONFIG_NUMA
8 7
8#include <asm/mmzone.h>
9
9static inline int cpu_to_node(int cpu) 10static inline int cpu_to_node(int cpu)
10{ 11{
11 int node; 12 int node;
@@ -66,4 +67,4 @@ static inline int node_to_first_cpu(int node)
66 67
67#endif /* CONFIG_NUMA */ 68#endif /* CONFIG_NUMA */
68 69
69#endif /* _ASM_PPC64_TOPOLOGY_H */ 70#endif /* _ASM_POWERPC_TOPOLOGY_H */
diff --git a/include/asm-powerpc/unaligned.h b/include/asm-powerpc/unaligned.h
index 45520d9b85d1..6c95dfa2652f 100644
--- a/include/asm-powerpc/unaligned.h
+++ b/include/asm-powerpc/unaligned.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_POWERPC_UNALIGNED_H
2#define _ASM_POWERPC_UNALIGNED_H
3
1#ifdef __KERNEL__ 4#ifdef __KERNEL__
2#ifndef __PPC_UNALIGNED_H
3#define __PPC_UNALIGNED_H
4 5
5/* 6/*
6 * The PowerPC can do unaligned accesses itself in big endian mode. 7 * The PowerPC can do unaligned accesses itself in big endian mode.
@@ -14,5 +15,5 @@
14 15
15#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) 16#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
16 17
17#endif 18#endif /* __KERNEL__ */
18#endif /* __KERNEL__ */ 19#endif /* _ASM_POWERPC_UNALIGNED_H */
diff --git a/include/asm-ppc/user.h b/include/asm-powerpc/user.h
index d662b2151370..e59ade4b3dfb 100644
--- a/include/asm-ppc/user.h
+++ b/include/asm-powerpc/user.h
@@ -1,13 +1,14 @@
1#ifdef __KERNEL__ 1#ifndef _ASM_POWERPC_USER_H
2#ifndef _PPC_USER_H 2#define _ASM_POWERPC_USER_H
3#define _PPC_USER_H
4 3
5/* Adapted from <asm-alpha/user.h> */ 4#ifdef __KERNEL__
6 5
7#include <linux/ptrace.h> 6#include <asm/ptrace.h>
8#include <asm/page.h> 7#include <asm/page.h>
9 8
10/* 9/*
10 * Adapted from <asm-alpha/user.h>
11 *
11 * Core file format: The core file is written in such a way that gdb 12 * Core file format: The core file is written in such a way that gdb
12 * can understand it and provide useful information to the user (under 13 * can understand it and provide useful information to the user (under
13 * linux we use the `trad-core' bfd, NOT the osf-core). The file contents 14 * linux we use the `trad-core' bfd, NOT the osf-core). The file contents
@@ -50,5 +51,5 @@ struct user {
50#define HOST_DATA_START_ADDR (u.start_data) 51#define HOST_DATA_START_ADDR (u.start_data)
51#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) 52#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
52 53
53#endif /* _PPC_USER_H */ 54#endif /* __KERNEL__ */
54#endif /* __KERNEL__ */ 55#endif /* _ASM_POWERPC_USER_H */
diff --git a/include/asm-ppc/setup.h b/include/asm-ppc/setup.h
deleted file mode 100644
index d2d19ee103df..000000000000
--- a/include/asm-ppc/setup.h
+++ /dev/null
@@ -1,14 +0,0 @@
1#ifdef __KERNEL__
2#ifndef _PPC_SETUP_H
3#define _PPC_SETUP_H
4
5#define m68k_num_memory num_memory
6#define m68k_memory memory
7
8#include <asm-m68k/setup.h>
9/* We have a bigger command line buffer. */
10#undef COMMAND_LINE_SIZE
11#define COMMAND_LINE_SIZE 512
12
13#endif /* _PPC_SETUP_H */
14#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/topology.h b/include/asm-ppc/topology.h
deleted file mode 100644
index 6a029bbba6e1..000000000000
--- a/include/asm-ppc/topology.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_PPC_TOPOLOGY_H
2#define _ASM_PPC_TOPOLOGY_H
3
4#include <asm-generic/topology.h>
5
6#endif /* _ASM_PPC_TOPOLOGY_H */
diff --git a/include/asm-ppc64/msgbuf.h b/include/asm-ppc64/msgbuf.h
deleted file mode 100644
index 31c1cbf133cc..000000000000
--- a/include/asm-ppc64/msgbuf.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _PPC64_MSGBUF_H
2#define _PPC64_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for the PPC architecture.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13struct msqid64_ds {
14 struct ipc64_perm msg_perm;
15 __kernel_time_t msg_stime; /* last msgsnd time */
16 __kernel_time_t msg_rtime; /* last msgrcv time */
17 __kernel_time_t msg_ctime; /* last change time */
18 unsigned long msg_cbytes; /* current number of bytes on queue */
19 unsigned long msg_qnum; /* number of messages in queue */
20 unsigned long msg_qbytes; /* max number of bytes on queue */
21 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
22 __kernel_pid_t msg_lrpid; /* last receive pid */
23 unsigned long __unused1;
24 unsigned long __unused2;
25};
26
27#endif /* _PPC64_MSGBUF_H */
diff --git a/include/asm-ppc64/param.h b/include/asm-ppc64/param.h
deleted file mode 100644
index 76c212d475b3..000000000000
--- a/include/asm-ppc64/param.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASM_PPC64_PARAM_H
2#define _ASM_PPC64_PARAM_H
3
4#include <linux/config.h>
5
6/*
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifdef __KERNEL__
14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15# define USER_HZ 100 /* .. some user interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#endif
18
19#ifndef HZ
20#define HZ 100
21#endif
22
23#define EXEC_PAGESIZE 4096
24
25#ifndef NOGROUP
26#define NOGROUP (-1)
27#endif
28
29#define MAXHOSTNAMELEN 64 /* max length of hostname */
30
31#endif /* _ASM_PPC64_PARAM_H */
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h
index c4f9023ea5ed..6b4a5b1f695e 100644
--- a/include/asm-ppc64/pci-bridge.h
+++ b/include/asm-ppc64/pci-bridge.h
@@ -48,19 +48,52 @@ struct pci_controller {
48 unsigned long dma_window_size; 48 unsigned long dma_window_size;
49}; 49};
50 50
51/*
52 * PCI stuff, for nodes representing PCI devices, pointed to
53 * by device_node->data.
54 */
55struct pci_controller;
56struct iommu_table;
57
58struct pci_dn {
59 int busno; /* for pci devices */
60 int bussubno; /* for pci devices */
61 int devfn; /* for pci devices */
62 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
63 int eeh_config_addr;
64 int eeh_capable; /* from firmware */
65 int eeh_check_count; /* # times driver ignored error */
66 int eeh_freeze_count; /* # times this device froze up. */
67 int eeh_is_bridge; /* device is pci-to-pci bridge */
68
69 int pci_ext_config_space; /* for pci devices */
70 struct pci_controller *phb; /* for pci devices */
71 struct iommu_table *iommu_table; /* for phb's or bridges */
72 struct pci_dev *pcidev; /* back-pointer to the pci device */
73 struct device_node *node; /* back-pointer to the device_node */
74 u32 config_space[16]; /* saved PCI config space */
75};
76
77/* Get the pointer to a device_node's pci_dn */
78#define PCI_DN(dn) ((struct pci_dn *) (dn)->data)
79
51struct device_node *fetch_dev_dn(struct pci_dev *dev); 80struct device_node *fetch_dev_dn(struct pci_dev *dev);
52 81
53/* Get a device_node from a pci_dev. This code must be fast except in the case 82/* Get a device_node from a pci_dev. This code must be fast except
54 * where the sysdata is incorrect and needs to be fixed up (hopefully just once) 83 * in the case where the sysdata is incorrect and needs to be fixed
84 * up (this will only happen once).
85 * In this case the sysdata will have been inherited from a PCI host
86 * bridge or a PCI-PCI bridge further up the tree, so it will point
87 * to a valid struct pci_dn, just not the one we want.
55 */ 88 */
56static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) 89static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev)
57{ 90{
58 struct device_node *dn = dev->sysdata; 91 struct device_node *dn = dev->sysdata;
92 struct pci_dn *pdn = dn->data;
59 93
60 if (dn->devfn == dev->devfn && dn->busno == dev->bus->number) 94 if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number)
61 return dn; /* fast path. sysdata is good */ 95 return dn; /* fast path. sysdata is good */
62 else 96 return fetch_dev_dn(dev);
63 return fetch_dev_dn(dev);
64} 97}
65 98
66static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) 99static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus)
@@ -83,7 +116,7 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
83 struct device_node *busdn = bus->sysdata; 116 struct device_node *busdn = bus->sysdata;
84 117
85 BUG_ON(busdn == NULL); 118 BUG_ON(busdn == NULL);
86 return busdn->phb; 119 return PCI_DN(busdn)->phb;
87} 120}
88 121
89#endif 122#endif
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h
index dc5330b39509..c02ec1d6b909 100644
--- a/include/asm-ppc64/prom.h
+++ b/include/asm-ppc64/prom.h
@@ -116,14 +116,6 @@ struct property {
116 struct property *next; 116 struct property *next;
117}; 117};
118 118
119/* NOTE: the device_node contains PCI specific info for pci devices.
120 * This perhaps could be hung off the device_node with another struct,
121 * but for now it is directly in the node. The phb ptr is a good
122 * indication of a real PCI node. Other nodes leave these fields zeroed.
123 */
124struct pci_controller;
125struct iommu_table;
126
127struct device_node { 119struct device_node {
128 char *name; 120 char *name;
129 char *type; 121 char *type;
@@ -135,16 +127,6 @@ struct device_node {
135 struct interrupt_info *intrs; 127 struct interrupt_info *intrs;
136 char *full_name; 128 char *full_name;
137 129
138 /* PCI stuff probably doesn't belong here */
139 int busno; /* for pci devices */
140 int bussubno; /* for pci devices */
141 int devfn; /* for pci devices */
142 int eeh_mode; /* See eeh.h for possible EEH_MODEs */
143 int eeh_config_addr;
144 int pci_ext_config_space; /* for pci devices */
145 struct pci_controller *phb; /* for pci devices */
146 struct iommu_table *iommu_table; /* for phb's or bridges */
147
148 struct property *properties; 130 struct property *properties;
149 struct device_node *parent; 131 struct device_node *parent;
150 struct device_node *child; 132 struct device_node *child;
@@ -154,6 +136,7 @@ struct device_node {
154 struct proc_dir_entry *pde; /* this node's proc directory */ 136 struct proc_dir_entry *pde; /* this node's proc directory */
155 struct kref kref; 137 struct kref kref;
156 unsigned long _flags; 138 unsigned long _flags;
139 void *data;
157}; 140};
158 141
159extern struct device_node *of_chosen; 142extern struct device_node *of_chosen;
diff --git a/include/asm-ppc64/segment.h b/include/asm-ppc64/segment.h
deleted file mode 100644
index d80fb68cc79e..000000000000
--- a/include/asm-ppc64/segment.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __PPC64_SEGMENT_H
2#define __PPC64_SEGMENT_H
3
4/* Only here because we have some old header files that expect it.. */
5
6#endif /* __PPC64_SEGMENT_H */
diff --git a/include/asm-ppc64/setup.h b/include/asm-ppc64/setup.h
deleted file mode 100644
index b257b8348c73..000000000000
--- a/include/asm-ppc64/setup.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _PPC_SETUP_H
2#define _PPC_SETUP_H
3
4#define COMMAND_LINE_SIZE 512
5
6#endif /* _PPC_SETUP_H */
diff --git a/include/asm-ppc64/timex.h b/include/asm-ppc64/timex.h
deleted file mode 100644
index 8db4da4064cd..000000000000
--- a/include/asm-ppc64/timex.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * linux/include/asm-ppc/timex.h
3 *
4 * PPC64 architecture timex specifications
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#ifndef _ASMPPC64_TIMEX_H
12#define _ASMPPC64_TIMEX_H
13
14#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
15
16typedef unsigned long cycles_t;
17
18static inline cycles_t get_cycles(void)
19{
20 cycles_t ret;
21
22 __asm__ __volatile__("mftb %0" : "=r" (ret) : );
23 return ret;
24}
25
26#endif
diff --git a/include/asm-ppc64/user.h b/include/asm-ppc64/user.h
deleted file mode 100644
index d7d6554a421f..000000000000
--- a/include/asm-ppc64/user.h
+++ /dev/null
@@ -1,58 +0,0 @@
1#ifndef _PPC_USER_H
2#define _PPC_USER_H
3
4/* Adapted from <asm-alpha/user.h>
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 <asm/ptrace.h>
13#include <asm/page.h>
14
15/*
16 * Core file format: The core file is written in such a way that gdb
17 * can understand it and provide useful information to the user (under
18 * linux we use the `trad-core' bfd, NOT the osf-core). The file contents
19 * are as follows:
20 *
21 * upage: 1 page consisting of a user struct that tells gdb
22 * what is present in the file. Directly after this is a
23 * copy of the task_struct, which is currently not used by gdb,
24 * but it may come in handy at some point. All of the registers
25 * are stored as part of the upage. The upage should always be
26 * only one page long.
27 * data: The data segment follows next. We use current->end_text to
28 * current->brk to pick up all of the user variables, plus any memory
29 * that may have been sbrk'ed. No attempt is made to determine if a
30 * page is demand-zero or if a page is totally unused, we just cover
31 * the entire range. All of the addresses are rounded in such a way
32 * that an integral number of pages is written.
33 * stack: We need the stack information in order to get a meaningful
34 * backtrace. We need to write the data from usp to
35 * current->start_stack, so we round each of these in order to be able
36 * to write an integer number of pages.
37 */
38struct user {
39 struct pt_regs regs; /* entire machine state */
40 size_t u_tsize; /* text size (pages) */
41 size_t u_dsize; /* data size (pages) */
42 size_t u_ssize; /* stack size (pages) */
43 unsigned long start_code; /* text starting address */
44 unsigned long start_data; /* data starting address */
45 unsigned long start_stack; /* stack starting address */
46 long int signal; /* signal causing core dump */
47 struct regs * u_ar0; /* help gdb find registers */
48 unsigned long magic; /* identifies a core file */
49 char u_comm[32]; /* user command name */
50};
51
52#define NBPG PAGE_SIZE
53#define UPAGES 1
54#define HOST_TEXT_START_ADDR (u.start_code)
55#define HOST_DATA_START_ADDR (u.start_data)
56#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
57
58#endif /* _PPC_USER_H */