diff options
Diffstat (limited to 'arch/ppc64')
38 files changed, 367 insertions, 254 deletions
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile index 8189953a372c..17d2c1eac3b8 100644 --- a/arch/ppc64/Makefile +++ b/arch/ppc64/Makefile | |||
| @@ -56,7 +56,7 @@ LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) | |||
| 56 | CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \ | 56 | CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \ |
| 57 | -mcall-aixdesc | 57 | -mcall-aixdesc |
| 58 | # Temporary hack until we have migrated to asm-powerpc | 58 | # Temporary hack until we have migrated to asm-powerpc |
| 59 | CPPFLAGS += -Iinclude3 | 59 | CPPFLAGS += -Iarch/$(ARCH)/include |
| 60 | 60 | ||
| 61 | GCC_VERSION := $(call cc-version) | 61 | GCC_VERSION := $(call cc-version) |
| 62 | GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;) | 62 | GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;) |
| @@ -89,11 +89,12 @@ drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/ | |||
| 89 | 89 | ||
| 90 | boot := arch/ppc64/boot | 90 | boot := arch/ppc64/boot |
| 91 | 91 | ||
| 92 | boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd | 92 | boottargets-$(CONFIG_PPC_PSERIES) += zImage zImage.initrd |
| 93 | boottarget-$(CONFIG_PPC_MAPLE) := zImage zImage.initrd | 93 | boottargets-$(CONFIG_PPC_PMAC) += zImage.vmode zImage.initrd.vmode |
| 94 | boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm | 94 | boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd |
| 95 | boottarget-$(CONFIG_PPC_BPA) := zImage zImage.initrd | 95 | boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm |
| 96 | $(boottarget-y): vmlinux | 96 | boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd |
| 97 | $(boottargets-y): vmlinux | ||
| 97 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | 98 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 98 | 99 | ||
| 99 | bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage | 100 | bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage |
| @@ -114,27 +115,21 @@ all: $(KBUILD_IMAGE) | |||
| 114 | 115 | ||
| 115 | archclean: | 116 | archclean: |
| 116 | $(Q)$(MAKE) $(clean)=$(boot) | 117 | $(Q)$(MAKE) $(clean)=$(boot) |
| 117 | $(Q)rm -rf include3 | 118 | # Temporary hack until we have migrated to asm-powerpc |
| 119 | $(Q)rm -rf arch/$(ARCH)/include | ||
| 118 | 120 | ||
| 119 | prepare: include/asm-ppc64/offsets.h | ||
| 120 | |||
| 121 | arch/ppc64/kernel/asm-offsets.s: include/asm include/linux/version.h \ | ||
| 122 | include/config/MARKER | ||
| 123 | |||
| 124 | include/asm-ppc64/offsets.h: arch/ppc64/kernel/asm-offsets.s | ||
| 125 | $(call filechk,gen-asm-offsets) | ||
| 126 | 121 | ||
| 127 | # Temporary hack until we have migrated to asm-powerpc | 122 | # Temporary hack until we have migrated to asm-powerpc |
| 128 | include/asm: include3/asm | 123 | include/asm: arch/$(ARCH)/include/asm |
| 129 | include3/asm: | 124 | arch/$(ARCH)/include/asm: |
| 130 | $(Q)if [ ! -d include3 ]; then mkdir -p include3; fi; | 125 | $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi |
| 131 | $(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm | 126 | $(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm |
| 132 | 127 | ||
| 133 | define archhelp | 128 | define archhelp |
| 134 | echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' | 129 | echo ' zImage.vmode - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)' |
| 135 | echo ' zImage.initrd- Compressed kernel image with initrd attached,' | 130 | echo ' zImage.initrd.vmode - Compressed kernel image with initrd attached,' |
| 136 | echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz' | 131 | echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz' |
| 137 | echo ' (arch/$(ARCH)/boot/zImage.initrd)' | 132 | echo ' (arch/$(ARCH)/boot/zImage.initrd.vmode)' |
| 133 | echo ' zImage - zImage for pSeries machines' | ||
| 134 | echo ' zImage.initrd - zImage with initrd for pSeries machines' | ||
| 138 | endef | 135 | endef |
| 139 | |||
| 140 | CLEAN_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 $@ | |||
| 37 | quiet_cmd_bootas = BOOTAS $@ | 37 | quiet_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 | ||
| 40 | quiet_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))) | |||
| 53 | gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) | 56 | gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) |
| 54 | 57 | ||
| 55 | hostprogs-y := addnote addRamDisk | 58 | hostprogs-y := addnote addRamDisk |
| 56 | targets += zImage zImage.initrd imagesize.c \ | 59 | targets += 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 | |||
| 63 | quiet_cmd_ramdisk = RAMDISK $@ | 66 | quiet_cmd_ramdisk = RAMDISK $@ |
| 64 | cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@ | 67 | cmd_ramdisk = $(obj)/addRamDisk $(obj)/ramdisk.image.gz $< $@ |
| 65 | 68 | ||
| 66 | quiet_cmd_stripvm = STRIP $@ | 69 | quiet_cmd_stripvm = STRIP $@ |
| 67 | cmd_stripvm = $(STRIP) -s $< -o $@ | 70 | cmd_stripvm = $(STRIP) -s $< -o $@ |
| 68 | 71 | ||
| 69 | vmlinux.strip: vmlinux FORCE | 72 | vmlinux.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 | ||
| 74 | addsection = $(CROSS32OBJCOPY) $(1) \ | 77 | quiet_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 | |||
| 82 | quiet_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 | ||
| 78 | quiet_cmd_addnote = ADDNOTE $@ | 89 | quiet_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 | ||
| 111 | install: $(CONFIGURE) $(BOOTIMAGE) | 124 | install: $(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 | ||
| 28 | static char *avail_ram; | 29 | static char *avail_ram; |
| 29 | static char *begin_avail, *end_avail; | 30 | static char *begin_avail, *end_avail; |
| @@ -32,6 +33,7 @@ static unsigned int heap_use; | |||
| 32 | static unsigned int heap_max; | 33 | static unsigned int heap_max; |
| 33 | 34 | ||
| 34 | extern char _start[]; | 35 | extern char _start[]; |
| 36 | extern char _end[]; | ||
| 35 | extern char _vmlinux_start[]; | 37 | extern char _vmlinux_start[]; |
| 36 | extern char _vmlinux_end[]; | 38 | extern char _vmlinux_end[]; |
| 37 | extern char _initrd_start[]; | 39 | extern char _initrd_start[]; |
| @@ -58,13 +60,13 @@ typedef void (*kernel_entry_t)( unsigned long, | |||
| 58 | 60 | ||
| 59 | #undef DEBUG | 61 | #undef DEBUG |
| 60 | 62 | ||
| 61 | static unsigned long claim_base = PROG_START; | 63 | static unsigned long claim_base; |
| 62 | 64 | ||
| 63 | static unsigned long try_claim(unsigned long size) | 65 | static 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 */ | ||
| 210 | static inline int iic_ipi_to_irq(int ipi) | ||
| 211 | { | ||
| 212 | return IIC_IPI_OFFSET + IIC_NUM_IPIS - 1 - ipi; | ||
| 213 | } | ||
| 214 | |||
| 215 | static inline int iic_irq_to_ipi(int irq) | ||
| 216 | { | ||
| 217 | return IIC_NUM_IPIS - 1 - (irq - IIC_IPI_OFFSET); | ||
| 218 | } | ||
| 219 | |||
| 208 | void iic_setup_cpu(void) | 220 | void 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 | ||
| 213 | void iic_cause_IPI(int cpu, int mesg) | 225 | void 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 | ||
| 218 | static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs) | 230 | static 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 | ||
| 225 | static void iic_request_ipi(int irq, const char *name) | 236 | static 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 | ||
| 234 | void iic_request_IPIs(void) | 248 | void 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/cpu_setup_power4.S b/arch/ppc64/kernel/cpu_setup_power4.S index 0482c063c26e..1fb673c511ff 100644 --- a/arch/ppc64/kernel/cpu_setup_power4.S +++ b/arch/ppc64/kernel/cpu_setup_power4.S | |||
| @@ -12,10 +12,9 @@ | |||
| 12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
| 13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
| 14 | #include <asm/page.h> | 14 | #include <asm/page.h> |
| 15 | #include <asm/ppc_asm.h> | ||
| 16 | #include <asm/cputable.h> | 15 | #include <asm/cputable.h> |
| 17 | #include <asm/ppc_asm.h> | 16 | #include <asm/ppc_asm.h> |
| 18 | #include <asm/offsets.h> | 17 | #include <asm/asm-offsets.h> |
| 19 | #include <asm/cache.h> | 18 | #include <asm/cache.h> |
| 20 | 19 | ||
| 21 | _GLOBAL(__970_cpu_preinit) | 20 | _GLOBAL(__970_cpu_preinit) |
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, | |||
| 254 | static void __pci_addr_cache_insert_device(struct pci_dev *dev) | 254 | static 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) | |||
| 415 | static int read_slot_reset_state(struct device_node *dn, int rets[]) | 417 | static 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/entry.S b/arch/ppc64/kernel/entry.S index bf99b4a92f20..d133a49cdf89 100644 --- a/arch/ppc64/kernel/entry.S +++ b/arch/ppc64/kernel/entry.S | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <asm/mmu.h> | 28 | #include <asm/mmu.h> |
| 29 | #include <asm/thread_info.h> | 29 | #include <asm/thread_info.h> |
| 30 | #include <asm/ppc_asm.h> | 30 | #include <asm/ppc_asm.h> |
| 31 | #include <asm/offsets.h> | 31 | #include <asm/asm-offsets.h> |
| 32 | #include <asm/cputable.h> | 32 | #include <asm/cputable.h> |
| 33 | 33 | ||
| 34 | #ifdef CONFIG_PPC_ISERIES | 34 | #ifdef CONFIG_PPC_ISERIES |
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S index b436206e317d..58c314738c99 100644 --- a/arch/ppc64/kernel/head.S +++ b/arch/ppc64/kernel/head.S | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include <asm/mmu.h> | 30 | #include <asm/mmu.h> |
| 31 | #include <asm/systemcfg.h> | 31 | #include <asm/systemcfg.h> |
| 32 | #include <asm/ppc_asm.h> | 32 | #include <asm/ppc_asm.h> |
| 33 | #include <asm/offsets.h> | 33 | #include <asm/asm-offsets.h> |
| 34 | #include <asm/bug.h> | 34 | #include <asm/bug.h> |
| 35 | #include <asm/cputable.h> | 35 | #include <asm/cputable.h> |
| 36 | #include <asm/setup.h> | 36 | #include <asm/setup.h> |
diff --git a/arch/ppc64/kernel/idle_power4.S b/arch/ppc64/kernel/idle_power4.S index 97e4a2655040..ca02afe2a795 100644 --- a/arch/ppc64/kernel/idle_power4.S +++ b/arch/ppc64/kernel/idle_power4.S | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <asm/cputable.h> | 20 | #include <asm/cputable.h> |
| 21 | #include <asm/thread_info.h> | 21 | #include <asm/thread_info.h> |
| 22 | #include <asm/ppc_asm.h> | 22 | #include <asm/ppc_asm.h> |
| 23 | #include <asm/offsets.h> | 23 | #include <asm/asm-offsets.h> |
| 24 | 24 | ||
| 25 | #undef DEBUG | 25 | #undef DEBUG |
| 26 | 26 | ||
diff --git a/arch/ppc64/kernel/iomap.c b/arch/ppc64/kernel/iomap.c index 153cc8b0f136..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 | } |
| 25 | unsigned int fastcall ioread16be(void __iomem *addr) | ||
| 26 | { | ||
| 27 | return in_be16(addr); | ||
| 28 | } | ||
| 25 | unsigned int fastcall ioread32(void __iomem *addr) | 29 | unsigned int fastcall ioread32(void __iomem *addr) |
| 26 | { | 30 | { |
| 27 | return readl(addr); | 31 | return readl(addr); |
| 28 | } | 32 | } |
| 33 | unsigned int fastcall ioread32be(void __iomem *addr) | ||
| 34 | { | ||
| 35 | return in_be32(addr); | ||
| 36 | } | ||
| 29 | EXPORT_SYMBOL(ioread8); | 37 | EXPORT_SYMBOL(ioread8); |
| 30 | EXPORT_SYMBOL(ioread16); | 38 | EXPORT_SYMBOL(ioread16); |
| 39 | EXPORT_SYMBOL(ioread16be); | ||
| 31 | EXPORT_SYMBOL(ioread32); | 40 | EXPORT_SYMBOL(ioread32); |
| 41 | EXPORT_SYMBOL(ioread32be); | ||
| 32 | 42 | ||
| 33 | void fastcall iowrite8(u8 val, void __iomem *addr) | 43 | void 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 | } |
| 51 | void fastcall iowrite16be(u16 val, void __iomem *addr) | ||
| 52 | { | ||
| 53 | out_be16(addr, val); | ||
| 54 | } | ||
| 41 | void fastcall iowrite32(u32 val, void __iomem *addr) | 55 | void fastcall iowrite32(u32 val, void __iomem *addr) |
| 42 | { | 56 | { |
| 43 | writel(val, addr); | 57 | writel(val, addr); |
| 44 | } | 58 | } |
| 59 | void fastcall iowrite32be(u32 val, void __iomem *addr) | ||
| 60 | { | ||
| 61 | out_be32(addr, val); | ||
| 62 | } | ||
| 45 | EXPORT_SYMBOL(iowrite8); | 63 | EXPORT_SYMBOL(iowrite8); |
| 46 | EXPORT_SYMBOL(iowrite16); | 64 | EXPORT_SYMBOL(iowrite16); |
| 65 | EXPORT_SYMBOL(iowrite16be); | ||
| 47 | EXPORT_SYMBOL(iowrite32); | 66 | EXPORT_SYMBOL(iowrite32); |
| 67 | EXPORT_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 |
| @@ -56,15 +76,15 @@ EXPORT_SYMBOL(iowrite32); | |||
| 56 | */ | 76 | */ |
| 57 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) | 77 | void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) |
| 58 | { | 78 | { |
| 59 | _insb((u8 __force *) addr, dst, count); | 79 | _insb((u8 __iomem *) addr, dst, count); |
| 60 | } | 80 | } |
| 61 | void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) | 81 | void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) |
| 62 | { | 82 | { |
| 63 | _insw_ns((u16 __force *) addr, dst, count); | 83 | _insw_ns((u16 __iomem *) addr, dst, count); |
| 64 | } | 84 | } |
| 65 | void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) | 85 | void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) |
| 66 | { | 86 | { |
| 67 | _insl_ns((u32 __force *) addr, dst, count); | 87 | _insl_ns((u32 __iomem *) addr, dst, count); |
| 68 | } | 88 | } |
| 69 | EXPORT_SYMBOL(ioread8_rep); | 89 | EXPORT_SYMBOL(ioread8_rep); |
| 70 | EXPORT_SYMBOL(ioread16_rep); | 90 | EXPORT_SYMBOL(ioread16_rep); |
| @@ -72,15 +92,15 @@ EXPORT_SYMBOL(ioread32_rep); | |||
| 72 | 92 | ||
| 73 | void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) | 93 | void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count) |
| 74 | { | 94 | { |
| 75 | _outsb((u8 __force *) addr, src, count); | 95 | _outsb((u8 __iomem *) addr, src, count); |
| 76 | } | 96 | } |
| 77 | void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) | 97 | void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count) |
| 78 | { | 98 | { |
| 79 | _outsw_ns((u16 __force *) addr, src, count); | 99 | _outsw_ns((u16 __iomem *) addr, src, count); |
| 80 | } | 100 | } |
| 81 | void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) | 101 | void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count) |
| 82 | { | 102 | { |
| 83 | _outsl_ns((u32 __force *) addr, src, count); | 103 | _outsl_ns((u32 __iomem *) addr, src, count); |
| 84 | } | 104 | } |
| 85 | EXPORT_SYMBOL(iowrite8_rep); | 105 | EXPORT_SYMBOL(iowrite8_rep); |
| 86 | EXPORT_SYMBOL(iowrite16_rep); | 106 | EXPORT_SYMBOL(iowrite16_rep); |
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 | ||
| 439 | void iommu_free_table(struct device_node *dn) | 439 | void 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..e7241ad80a08 100644 --- a/arch/ppc64/kernel/misc.S +++ b/arch/ppc64/kernel/misc.S | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #include <asm/page.h> | 26 | #include <asm/page.h> |
| 27 | #include <asm/cache.h> | 27 | #include <asm/cache.h> |
| 28 | #include <asm/ppc_asm.h> | 28 | #include <asm/ppc_asm.h> |
| 29 | #include <asm/offsets.h> | 29 | #include <asm/asm-offsets.h> |
| 30 | #include <asm/cputable.h> | 30 | #include <asm/cputable.h> |
| 31 | 31 | ||
| 32 | .text | 32 | .text |
| @@ -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, | |||
| 311 | static void iommu_bus_setup_pSeries(struct pci_bus *bus) | 311 | static 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 | ||
| 534 | static void iommu_bus_setup_null(struct pci_bus *b) { } | 544 | static 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 | |||
| 996 | long 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 | ||
| 35 | void pci_devs_phb_init(void); | 35 | void pci_devs_phb_init(void); |
| 36 | void pci_devs_phb_init_dynamic(struct pci_controller *phb); | 36 | void pci_devs_phb_init_dynamic(struct pci_controller *phb); |
| 37 | struct device_node *fetch_dev_dn(struct pci_dev *dev); | ||
| 38 | 37 | ||
| 39 | /* PCI address cache management routines */ | 38 | /* PCI address cache management routines */ |
| 40 | void pci_addr_cache_insert_device(struct pci_dev *dev); | 39 | void 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, | |||
| 112 | void __devinit pci_devs_phb_init_dynamic(struct pci_controller *phb) | 124 | void __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 | */ |
| 128 | static void *is_devfn_node(struct device_node *dn, void *data) | 145 | static 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) | |||
| 149 | struct device_node *fetch_dev_dn(struct pci_dev *dev) | 169 | struct 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); | |||
| 165 | static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) | 182 | static 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/pmc.c b/arch/ppc64/kernel/pmc.c index cdfec7438d01..63d9481c3ec2 100644 --- a/arch/ppc64/kernel/pmc.c +++ b/arch/ppc64/kernel/pmc.c | |||
| @@ -26,7 +26,7 @@ static void dummy_perf(struct pt_regs *regs) | |||
| 26 | mtspr(SPRN_MMCR0, mmcr0); | 26 | mtspr(SPRN_MMCR0, mmcr0); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | static spinlock_t pmc_owner_lock = SPIN_LOCK_UNLOCKED; | 29 | static DEFINE_SPINLOCK(pmc_owner_lock); |
| 30 | static void *pmc_owner_caller; /* mostly for debugging */ | 30 | static void *pmc_owner_caller; /* mostly for debugging */ |
| 31 | perf_irq_t perf_irq = dummy_perf; | 31 | perf_irq_t perf_irq = dummy_perf; |
| 32 | 32 | ||
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; | |||
| 48 | static int ibm_read_pci_config; | 48 | static int ibm_read_pci_config; |
| 49 | static int ibm_write_pci_config; | 49 | static int ibm_write_pci_config; |
| 50 | 50 | ||
| 51 | static int config_access_valid(struct device_node *dn, int where) | 51 | static 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 | ||
| 126 | static int rtas_write_config(struct device_node *dn, int where, int size, u32 val) | 130 | int 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 | |||
| 717 | asmlinkage int sys32_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn) | 711 | asmlinkage 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 | ||
| 47 | extern unsigned long wall_jiffies; | 47 | extern unsigned long wall_jiffies; |
| 48 | 48 | ||
| 49 | void | ||
| 50 | check_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 | ||
| 282 | static void iommu_bus_setup_u3(struct pci_bus *bus) | 282 | static 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 | ||
| 297 | static void iommu_dev_setup_null(struct pci_dev *dev) { } | 297 | static 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 | ||
| 161 | static int early_console_initialized; | ||
| 162 | |||
| 161 | void __init disable_early_printk(void) | 163 | void __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 */ |
| 167 | void register_early_udbg_console(void) | 172 | void 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/kernel/vdso32/cacheflush.S b/arch/ppc64/kernel/vdso32/cacheflush.S index 0ed7ea721715..c8db993574ee 100644 --- a/arch/ppc64/kernel/vdso32/cacheflush.S +++ b/arch/ppc64/kernel/vdso32/cacheflush.S | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
| 14 | #include <asm/ppc_asm.h> | 14 | #include <asm/ppc_asm.h> |
| 15 | #include <asm/vdso.h> | 15 | #include <asm/vdso.h> |
| 16 | #include <asm/offsets.h> | 16 | #include <asm/asm-offsets.h> |
| 17 | 17 | ||
| 18 | .text | 18 | .text |
| 19 | 19 | ||
diff --git a/arch/ppc64/kernel/vdso32/datapage.S b/arch/ppc64/kernel/vdso32/datapage.S index 29b6bd32e1f1..4f4eb0be3992 100644 --- a/arch/ppc64/kernel/vdso32/datapage.S +++ b/arch/ppc64/kernel/vdso32/datapage.S | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
| 13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
| 14 | #include <asm/ppc_asm.h> | 14 | #include <asm/ppc_asm.h> |
| 15 | #include <asm/offsets.h> | 15 | #include <asm/asm-offsets.h> |
| 16 | #include <asm/unistd.h> | 16 | #include <asm/unistd.h> |
| 17 | #include <asm/vdso.h> | 17 | #include <asm/vdso.h> |
| 18 | 18 | ||
diff --git a/arch/ppc64/kernel/vdso32/gettimeofday.S b/arch/ppc64/kernel/vdso32/gettimeofday.S index 2b48bf1fb109..07f1c1c650c8 100644 --- a/arch/ppc64/kernel/vdso32/gettimeofday.S +++ b/arch/ppc64/kernel/vdso32/gettimeofday.S | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
| 14 | #include <asm/ppc_asm.h> | 14 | #include <asm/ppc_asm.h> |
| 15 | #include <asm/vdso.h> | 15 | #include <asm/vdso.h> |
| 16 | #include <asm/offsets.h> | 16 | #include <asm/asm-offsets.h> |
| 17 | #include <asm/unistd.h> | 17 | #include <asm/unistd.h> |
| 18 | 18 | ||
| 19 | .text | 19 | .text |
diff --git a/arch/ppc64/kernel/vdso64/cacheflush.S b/arch/ppc64/kernel/vdso64/cacheflush.S index e0725b7b7003..d4a0ad28d534 100644 --- a/arch/ppc64/kernel/vdso64/cacheflush.S +++ b/arch/ppc64/kernel/vdso64/cacheflush.S | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
| 14 | #include <asm/ppc_asm.h> | 14 | #include <asm/ppc_asm.h> |
| 15 | #include <asm/vdso.h> | 15 | #include <asm/vdso.h> |
| 16 | #include <asm/offsets.h> | 16 | #include <asm/asm-offsets.h> |
| 17 | 17 | ||
| 18 | .text | 18 | .text |
| 19 | 19 | ||
diff --git a/arch/ppc64/kernel/vdso64/datapage.S b/arch/ppc64/kernel/vdso64/datapage.S index 18afd971c9d9..ed6e599ae824 100644 --- a/arch/ppc64/kernel/vdso64/datapage.S +++ b/arch/ppc64/kernel/vdso64/datapage.S | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <linux/config.h> | 12 | #include <linux/config.h> |
| 13 | #include <asm/processor.h> | 13 | #include <asm/processor.h> |
| 14 | #include <asm/ppc_asm.h> | 14 | #include <asm/ppc_asm.h> |
| 15 | #include <asm/offsets.h> | 15 | #include <asm/asm-offsets.h> |
| 16 | #include <asm/unistd.h> | 16 | #include <asm/unistd.h> |
| 17 | #include <asm/vdso.h> | 17 | #include <asm/vdso.h> |
| 18 | 18 | ||
diff --git a/arch/ppc64/kernel/vdso64/gettimeofday.S b/arch/ppc64/kernel/vdso64/gettimeofday.S index ed3f970ff05e..f6df8028570a 100644 --- a/arch/ppc64/kernel/vdso64/gettimeofday.S +++ b/arch/ppc64/kernel/vdso64/gettimeofday.S | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include <asm/processor.h> | 14 | #include <asm/processor.h> |
| 15 | #include <asm/ppc_asm.h> | 15 | #include <asm/ppc_asm.h> |
| 16 | #include <asm/vdso.h> | 16 | #include <asm/vdso.h> |
| 17 | #include <asm/offsets.h> | 17 | #include <asm/asm-offsets.h> |
| 18 | 18 | ||
| 19 | .text | 19 | .text |
| 20 | /* | 20 | /* |
diff --git a/arch/ppc64/lib/dec_and_lock.c b/arch/ppc64/lib/dec_and_lock.c index 6e8d8591708c..7b9d4da5cf92 100644 --- a/arch/ppc64/lib/dec_and_lock.c +++ b/arch/ppc64/lib/dec_and_lock.c | |||
| @@ -20,14 +20,7 @@ | |||
| 20 | * has a cmpxchg, and where atomic->value is an int holding | 20 | * has a cmpxchg, and where atomic->value is an int holding |
| 21 | * the value of the atomic (i.e. the high bits aren't used | 21 | * the value of the atomic (i.e. the high bits aren't used |
| 22 | * for a lock or anything like that). | 22 | * for a lock or anything like that). |
| 23 | * | ||
| 24 | * N.B. ATOMIC_DEC_AND_LOCK gets defined in include/linux/spinlock.h | ||
| 25 | * if spinlocks are empty and thus atomic_dec_and_lock is defined | ||
| 26 | * to be atomic_dec_and_test - in that case we don't need it | ||
| 27 | * defined here as well. | ||
| 28 | */ | 23 | */ |
| 29 | |||
| 30 | #ifndef ATOMIC_DEC_AND_LOCK | ||
| 31 | int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock) | 24 | int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock) |
| 32 | { | 25 | { |
| 33 | int counter; | 26 | int counter; |
| @@ -52,4 +45,3 @@ int _atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock) | |||
| 52 | } | 45 | } |
| 53 | 46 | ||
| 54 | EXPORT_SYMBOL(_atomic_dec_and_lock); | 47 | EXPORT_SYMBOL(_atomic_dec_and_lock); |
| 55 | #endif /* ATOMIC_DEC_AND_LOCK */ | ||
diff --git a/arch/ppc64/lib/locks.c b/arch/ppc64/lib/locks.c index ef70ef91abe2..033643ab69e0 100644 --- a/arch/ppc64/lib/locks.c +++ b/arch/ppc64/lib/locks.c | |||
| @@ -23,12 +23,12 @@ | |||
| 23 | /* waiting for a spinlock... */ | 23 | /* waiting for a spinlock... */ |
| 24 | #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) | 24 | #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) |
| 25 | 25 | ||
| 26 | void __spin_yield(spinlock_t *lock) | 26 | void __spin_yield(raw_spinlock_t *lock) |
| 27 | { | 27 | { |
| 28 | unsigned int lock_value, holder_cpu, yield_count; | 28 | unsigned int lock_value, holder_cpu, yield_count; |
| 29 | struct paca_struct *holder_paca; | 29 | struct paca_struct *holder_paca; |
| 30 | 30 | ||
| 31 | lock_value = lock->lock; | 31 | lock_value = lock->slock; |
| 32 | if (lock_value == 0) | 32 | if (lock_value == 0) |
| 33 | return; | 33 | return; |
| 34 | holder_cpu = lock_value & 0xffff; | 34 | holder_cpu = lock_value & 0xffff; |
| @@ -38,7 +38,7 @@ void __spin_yield(spinlock_t *lock) | |||
| 38 | if ((yield_count & 1) == 0) | 38 | if ((yield_count & 1) == 0) |
| 39 | return; /* virtual cpu is currently running */ | 39 | return; /* virtual cpu is currently running */ |
| 40 | rmb(); | 40 | rmb(); |
| 41 | if (lock->lock != lock_value) | 41 | if (lock->slock != lock_value) |
| 42 | return; /* something has changed */ | 42 | return; /* something has changed */ |
| 43 | #ifdef CONFIG_PPC_ISERIES | 43 | #ifdef CONFIG_PPC_ISERIES |
| 44 | HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, | 44 | HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, |
| @@ -54,7 +54,7 @@ void __spin_yield(spinlock_t *lock) | |||
| 54 | * This turns out to be the same for read and write locks, since | 54 | * This turns out to be the same for read and write locks, since |
| 55 | * we only know the holder if it is write-locked. | 55 | * we only know the holder if it is write-locked. |
| 56 | */ | 56 | */ |
| 57 | void __rw_yield(rwlock_t *rw) | 57 | void __rw_yield(raw_rwlock_t *rw) |
| 58 | { | 58 | { |
| 59 | int lock_value; | 59 | int lock_value; |
| 60 | unsigned int holder_cpu, yield_count; | 60 | unsigned int holder_cpu, yield_count; |
| @@ -82,9 +82,9 @@ void __rw_yield(rwlock_t *rw) | |||
| 82 | } | 82 | } |
| 83 | #endif | 83 | #endif |
| 84 | 84 | ||
| 85 | void spin_unlock_wait(spinlock_t *lock) | 85 | void __raw_spin_unlock_wait(raw_spinlock_t *lock) |
| 86 | { | 86 | { |
| 87 | while (lock->lock) { | 87 | while (lock->slock) { |
| 88 | HMT_low(); | 88 | HMT_low(); |
| 89 | if (SHARED_PROCESSOR) | 89 | if (SHARED_PROCESSOR) |
| 90 | __spin_yield(lock); | 90 | __spin_yield(lock); |
| @@ -92,4 +92,4 @@ void spin_unlock_wait(spinlock_t *lock) | |||
| 92 | HMT_medium(); | 92 | HMT_medium(); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | EXPORT_SYMBOL(spin_unlock_wait); | 95 | EXPORT_SYMBOL(__raw_spin_unlock_wait); |
diff --git a/arch/ppc64/mm/hash_low.S b/arch/ppc64/mm/hash_low.S index 35eb49e1b890..ee5a5d36bfa8 100644 --- a/arch/ppc64/mm/hash_low.S +++ b/arch/ppc64/mm/hash_low.S | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <asm/page.h> | 16 | #include <asm/page.h> |
| 17 | #include <asm/types.h> | 17 | #include <asm/types.h> |
| 18 | #include <asm/ppc_asm.h> | 18 | #include <asm/ppc_asm.h> |
| 19 | #include <asm/offsets.h> | 19 | #include <asm/asm-offsets.h> |
| 20 | #include <asm/cputable.h> | 20 | #include <asm/cputable.h> |
| 21 | 21 | ||
| 22 | .text | 22 | .text |
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/arch/ppc64/mm/slb_low.S b/arch/ppc64/mm/slb_low.S index 698d6b9ed6d1..a3a03da503bc 100644 --- a/arch/ppc64/mm/slb_low.S +++ b/arch/ppc64/mm/slb_low.S | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <asm/page.h> | 21 | #include <asm/page.h> |
| 22 | #include <asm/mmu.h> | 22 | #include <asm/mmu.h> |
| 23 | #include <asm/ppc_asm.h> | 23 | #include <asm/ppc_asm.h> |
| 24 | #include <asm/offsets.h> | 24 | #include <asm/asm-offsets.h> |
| 25 | #include <asm/cputable.h> | 25 | #include <asm/cputable.h> |
| 26 | 26 | ||
| 27 | /* void slb_allocate(unsigned long ea); | 27 | /* void slb_allocate(unsigned long ea); |
