aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2007-02-08 01:41:56 -0500
committerKumar Gala <galak@kernel.crashing.org>2007-02-08 01:41:56 -0500
commit135637aa781a0480ba4ef2d3ad18fae408ace874 (patch)
treed28d3765b2cb135968b14a0fd75ef2c2b4f1e248 /arch
parent97c5a20ae68774b4c9246c4657be0d88317f103f (diff)
parentd003e7a1a569501cbe9a5ca14748177498c4893a (diff)
Merge branch 'master' into 83xx
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/Kconfig19
-rw-r--r--arch/powerpc/kernel/irq.c6
-rw-r--r--arch/powerpc/kernel/kprobes.c8
-rw-r--r--arch/powerpc/kernel/lparcfg.c11
-rw-r--r--arch/powerpc/kernel/setup_32.c1
-rw-r--r--arch/powerpc/kernel/traps.c109
-rw-r--r--arch/powerpc/lib/Makefile2
-rw-r--r--arch/powerpc/lib/rheap.c3
-rw-r--r--arch/powerpc/mm/mem.c4
-rw-r--r--arch/powerpc/platforms/52xx/Makefile1
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c6
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pci.c412
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c1
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c22
-rw-r--r--arch/powerpc/xmon/ppc-opc.c7
-rw-r--r--arch/powerpc/xmon/spu-opc.c4
-rw-r--r--arch/ppc/8xx_io/cs4218_tdm.c1
-rw-r--r--arch/ppc/lib/rheap.c3
-rw-r--r--arch/ppc/syslib/m8260_pci_erratum9.c3
-rw-r--r--arch/ppc/syslib/m8xx_setup.c2
-rw-r--r--arch/ppc/xmon/ppc-opc.c7
21 files changed, 558 insertions, 74 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index aeb53096acf7..abc6bd2f858e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -436,6 +436,21 @@ config PPC_MPC52xx
436 bool 436 bool
437 default n 437 default n
438 438
439config PPC_MPC5200
440 bool
441 select PPC_MPC52xx
442 default n
443
444config PPC_MPC5200_BUGFIX
445 bool "MPC5200 (L25R) bugfix support"
446 depends on PPC_MPC5200
447 default n
448 help
449 Enable workarounds for original MPC5200 errata. This is not required
450 for MPC5200B based boards.
451
452 It is safe to say 'Y' here
453
439config PPC_EFIKA 454config PPC_EFIKA
440 bool "bPlan Efika 5k2. MPC5200B based computer" 455 bool "bPlan Efika 5k2. MPC5200B based computer"
441 depends on PPC_MULTIPLATFORM && PPC32 456 depends on PPC_MULTIPLATFORM && PPC32
@@ -448,7 +463,7 @@ config PPC_EFIKA
448config PPC_LITE5200 463config PPC_LITE5200
449 bool "Freescale Lite5200 Eval Board" 464 bool "Freescale Lite5200 Eval Board"
450 depends on PPC_MULTIPLATFORM && PPC32 465 depends on PPC_MULTIPLATFORM && PPC32
451 select PPC_MPC52xx 466 select PPC_MPC5200
452 default n 467 default n
453 468
454config PPC_PMAC 469config PPC_PMAC
@@ -1206,7 +1221,7 @@ source "arch/powerpc/oprofile/Kconfig"
1206 1221
1207config KPROBES 1222config KPROBES
1208 bool "Kprobes (EXPERIMENTAL)" 1223 bool "Kprobes (EXPERIMENTAL)"
1209 depends on PPC64 && KALLSYMS && EXPERIMENTAL && MODULES 1224 depends on !BOOKE && !4xx && KALLSYMS && EXPERIMENTAL && MODULES
1210 help 1225 help
1211 Kprobes allows you to trap at almost any kernel address and 1226 Kprobes allows you to trap at almost any kernel address and
1212 execute a callback function. register_kprobe() establishes 1227 execute a callback function. register_kprobe() establishes
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 34dc37e0e369..919fbf568495 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -281,10 +281,10 @@ void do_IRQ(struct pt_regs *regs)
281 281
282 /* 282 /*
283 * Every platform is required to implement ppc_md.get_irq. 283 * Every platform is required to implement ppc_md.get_irq.
284 * This function will either return an irq number or -1 to 284 * This function will either return an irq number or NO_IRQ to
285 * indicate there are no more pending. 285 * indicate there are no more pending.
286 * The value -2 is for buggy hardware and means that this IRQ 286 * The value NO_IRQ_IGNORE is for buggy hardware and means that this
287 * has already been handled. -- Tom 287 * IRQ has already been handled. -- Tom
288 */ 288 */
289 irq = ppc_md.get_irq(); 289 irq = ppc_md.get_irq();
290 290
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 4657563f8813..dd2886f97e98 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -46,8 +46,8 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
46 if ((unsigned long)p->addr & 0x03) { 46 if ((unsigned long)p->addr & 0x03) {
47 printk("Attempt to register kprobe at an unaligned address\n"); 47 printk("Attempt to register kprobe at an unaligned address\n");
48 ret = -EINVAL; 48 ret = -EINVAL;
49 } else if (IS_MTMSRD(insn) || IS_RFID(insn)) { 49 } else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) {
50 printk("Cannot register a kprobe on rfid or mtmsrd\n"); 50 printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n");
51 ret = -EINVAL; 51 ret = -EINVAL;
52 } 52 }
53 53
@@ -483,8 +483,12 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
483 memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs)); 483 memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs));
484 484
485 /* setup return addr to the jprobe handler routine */ 485 /* setup return addr to the jprobe handler routine */
486#ifdef CONFIG_PPC64
486 regs->nip = (unsigned long)(((func_descr_t *)jp->entry)->entry); 487 regs->nip = (unsigned long)(((func_descr_t *)jp->entry)->entry);
487 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc); 488 regs->gpr[2] = (unsigned long)(((func_descr_t *)jp->entry)->toc);
489#else
490 regs->nip = (unsigned long)jp->entry;
491#endif
488 492
489 return 1; 493 return 1;
490} 494}
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 41c05dcd68f4..0de5a08cf9b0 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -439,6 +439,10 @@ static ssize_t lparcfg_write(struct file *file, const char __user * buf,
439 439
440 ssize_t retval = -ENOMEM; 440 ssize_t retval = -ENOMEM;
441 441
442 if (!firmware_has_feature(FW_FEATURE_SPLPAR) ||
443 firmware_has_feature(FW_FEATURE_ISERIES))
444 return -EINVAL;
445
442 kbuf = kmalloc(count, GFP_KERNEL); 446 kbuf = kmalloc(count, GFP_KERNEL);
443 if (!kbuf) 447 if (!kbuf)
444 goto out; 448 goto out;
@@ -517,7 +521,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
517static ssize_t lparcfg_write(struct file *file, const char __user * buf, 521static ssize_t lparcfg_write(struct file *file, const char __user * buf,
518 size_t count, loff_t * off) 522 size_t count, loff_t * off)
519{ 523{
520 return count; 524 return -EINVAL;
521} 525}
522 526
523#endif /* CONFIG_PPC_PSERIES */ 527#endif /* CONFIG_PPC_PSERIES */
@@ -570,6 +574,7 @@ static int lparcfg_open(struct inode *inode, struct file *file)
570struct file_operations lparcfg_fops = { 574struct file_operations lparcfg_fops = {
571 .owner = THIS_MODULE, 575 .owner = THIS_MODULE,
572 .read = seq_read, 576 .read = seq_read,
577 .write = lparcfg_write,
573 .open = lparcfg_open, 578 .open = lparcfg_open,
574 .release = single_release, 579 .release = single_release,
575}; 580};
@@ -581,10 +586,8 @@ int __init lparcfg_init(void)
581 586
582 /* Allow writing if we have FW_FEATURE_SPLPAR */ 587 /* Allow writing if we have FW_FEATURE_SPLPAR */
583 if (firmware_has_feature(FW_FEATURE_SPLPAR) && 588 if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
584 !firmware_has_feature(FW_FEATURE_ISERIES)) { 589 !firmware_has_feature(FW_FEATURE_ISERIES))
585 lparcfg_fops.write = lparcfg_write;
586 mode |= S_IWUSR; 590 mode |= S_IWUSR;
587 }
588 591
589 ent = create_proc_entry("ppc64/lparcfg", mode, NULL); 592 ent = create_proc_entry("ppc64/lparcfg", mode, NULL);
590 if (ent) { 593 if (ent) {
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 61c65d19ef06..6a19fa40dcee 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -65,6 +65,7 @@ int have_of = 1;
65 65
66#ifdef CONFIG_VGA_CONSOLE 66#ifdef CONFIG_VGA_CONSOLE
67unsigned long vgacon_remap_base; 67unsigned long vgacon_remap_base;
68EXPORT_SYMBOL(vgacon_remap_base);
68#endif 69#endif
69 70
70/* 71/*
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 6915b91868b8..dcc6f159fd94 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -535,34 +535,40 @@ static void emulate_single_step(struct pt_regs *regs)
535 } 535 }
536} 536}
537 537
538static void parse_fpe(struct pt_regs *regs) 538static inline int __parse_fpscr(unsigned long fpscr)
539{ 539{
540 int code = 0; 540 int ret = 0;
541 unsigned long fpscr;
542
543 flush_fp_to_thread(current);
544
545 fpscr = current->thread.fpscr.val;
546 541
547 /* Invalid operation */ 542 /* Invalid operation */
548 if ((fpscr & FPSCR_VE) && (fpscr & FPSCR_VX)) 543 if ((fpscr & FPSCR_VE) && (fpscr & FPSCR_VX))
549 code = FPE_FLTINV; 544 ret = FPE_FLTINV;
550 545
551 /* Overflow */ 546 /* Overflow */
552 else if ((fpscr & FPSCR_OE) && (fpscr & FPSCR_OX)) 547 else if ((fpscr & FPSCR_OE) && (fpscr & FPSCR_OX))
553 code = FPE_FLTOVF; 548 ret = FPE_FLTOVF;
554 549
555 /* Underflow */ 550 /* Underflow */
556 else if ((fpscr & FPSCR_UE) && (fpscr & FPSCR_UX)) 551 else if ((fpscr & FPSCR_UE) && (fpscr & FPSCR_UX))
557 code = FPE_FLTUND; 552 ret = FPE_FLTUND;
558 553
559 /* Divide by zero */ 554 /* Divide by zero */
560 else if ((fpscr & FPSCR_ZE) && (fpscr & FPSCR_ZX)) 555 else if ((fpscr & FPSCR_ZE) && (fpscr & FPSCR_ZX))
561 code = FPE_FLTDIV; 556 ret = FPE_FLTDIV;
562 557
563 /* Inexact result */ 558 /* Inexact result */
564 else if ((fpscr & FPSCR_XE) && (fpscr & FPSCR_XX)) 559 else if ((fpscr & FPSCR_XE) && (fpscr & FPSCR_XX))
565 code = FPE_FLTRES; 560 ret = FPE_FLTRES;
561
562 return ret;
563}
564
565static void parse_fpe(struct pt_regs *regs)
566{
567 int code = 0;
568
569 flush_fp_to_thread(current);
570
571 code = __parse_fpscr(current->thread.fpscr.val);
566 572
567 _exception(SIGFPE, regs, code, regs->nip); 573 _exception(SIGFPE, regs, code, regs->nip);
568} 574}
@@ -739,20 +745,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
739 extern int do_mathemu(struct pt_regs *regs); 745 extern int do_mathemu(struct pt_regs *regs);
740 746
741 /* We can now get here via a FP Unavailable exception if the core 747 /* We can now get here via a FP Unavailable exception if the core
742 * has no FPU, in that case no reason flags will be set */ 748 * has no FPU, in that case the reason flags will be 0 */
743#ifdef CONFIG_MATH_EMULATION
744 /* (reason & REASON_ILLEGAL) would be the obvious thing here,
745 * but there seems to be a hardware bug on the 405GP (RevD)
746 * that means ESR is sometimes set incorrectly - either to
747 * ESR_DST (!?) or 0. In the process of chasing this with the
748 * hardware people - not sure if it can happen on any illegal
749 * instruction or only on FP instructions, whether there is a
750 * pattern to occurences etc. -dgibson 31/Mar/2003 */
751 if (!(reason & REASON_TRAP) && do_mathemu(regs) == 0) {
752 emulate_single_step(regs);
753 return;
754 }
755#endif /* CONFIG_MATH_EMULATION */
756 749
757 if (reason & REASON_FP) { 750 if (reason & REASON_FP) {
758 /* IEEE FP exception */ 751 /* IEEE FP exception */
@@ -778,6 +771,31 @@ void __kprobes program_check_exception(struct pt_regs *regs)
778 771
779 local_irq_enable(); 772 local_irq_enable();
780 773
774#ifdef CONFIG_MATH_EMULATION
775 /* (reason & REASON_ILLEGAL) would be the obvious thing here,
776 * but there seems to be a hardware bug on the 405GP (RevD)
777 * that means ESR is sometimes set incorrectly - either to
778 * ESR_DST (!?) or 0. In the process of chasing this with the
779 * hardware people - not sure if it can happen on any illegal
780 * instruction or only on FP instructions, whether there is a
781 * pattern to occurences etc. -dgibson 31/Mar/2003 */
782 switch (do_mathemu(regs)) {
783 case 0:
784 emulate_single_step(regs);
785 return;
786 case 1: {
787 int code = 0;
788 code = __parse_fpscr(current->thread.fpscr.val);
789 _exception(SIGFPE, regs, code, regs->nip);
790 return;
791 }
792 case -EFAULT:
793 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
794 return;
795 }
796 /* fall through on any other errors */
797#endif /* CONFIG_MATH_EMULATION */
798
781 /* Try to emulate it if we should. */ 799 /* Try to emulate it if we should. */
782 if (reason & (REASON_ILLEGAL | REASON_PRIVILEGED)) { 800 if (reason & (REASON_ILLEGAL | REASON_PRIVILEGED)) {
783 switch (emulate_instruction(regs)) { 801 switch (emulate_instruction(regs)) {
@@ -891,18 +909,39 @@ void SoftwareEmulation(struct pt_regs *regs)
891 909
892#ifdef CONFIG_MATH_EMULATION 910#ifdef CONFIG_MATH_EMULATION
893 errcode = do_mathemu(regs); 911 errcode = do_mathemu(regs);
912
913 switch (errcode) {
914 case 0:
915 emulate_single_step(regs);
916 return;
917 case 1: {
918 int code = 0;
919 code = __parse_fpscr(current->thread.fpscr.val);
920 _exception(SIGFPE, regs, code, regs->nip);
921 return;
922 }
923 case -EFAULT:
924 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
925 return;
926 default:
927 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
928 return;
929 }
930
894#else 931#else
895 errcode = Soft_emulate_8xx(regs); 932 errcode = Soft_emulate_8xx(regs);
896#endif 933 switch (errcode) {
897 if (errcode) { 934 case 0:
898 if (errcode > 0)
899 _exception(SIGFPE, regs, 0, 0);
900 else if (errcode == -EFAULT)
901 _exception(SIGSEGV, regs, 0, 0);
902 else
903 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
904 } else
905 emulate_single_step(regs); 935 emulate_single_step(regs);
936 return;
937 case 1:
938 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
939 return;
940 case -EFAULT:
941 _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
942 return;
943 }
944#endif
906} 945}
907#endif /* CONFIG_8xx */ 946#endif /* CONFIG_8xx */
908 947
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index e2d414160c83..4b1ba49fbd9e 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -16,11 +16,11 @@ obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \
16 strcase.o 16 strcase.o
17obj-$(CONFIG_QUICC_ENGINE) += rheap.o 17obj-$(CONFIG_QUICC_ENGINE) += rheap.o
18obj-$(CONFIG_XMON) += sstep.o 18obj-$(CONFIG_XMON) += sstep.o
19obj-$(CONFIG_KPROBES) += sstep.o
19obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o 20obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
20 21
21ifeq ($(CONFIG_PPC64),y) 22ifeq ($(CONFIG_PPC64),y)
22obj-$(CONFIG_SMP) += locks.o 23obj-$(CONFIG_SMP) += locks.o
23obj-$(CONFIG_DEBUG_KERNEL) += sstep.o
24endif 24endif
25 25
26# Temporary hack until we have migrated to asm-powerpc 26# Temporary hack until we have migrated to asm-powerpc
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index 4bbda6b2be45..6c5c5dd183ee 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -14,6 +14,7 @@
14 */ 14 */
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/kernel.h>
17#include <linux/mm.h> 18#include <linux/mm.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19 20
@@ -671,7 +672,7 @@ void rh_dump(rh_info_t * info)
671 int maxnr; 672 int maxnr;
672 int i, nr; 673 int i, nr;
673 674
674 maxnr = sizeof(st) / sizeof(st[0]); 675 maxnr = ARRAY_SIZE(st);
675 676
676 printk(KERN_INFO 677 printk(KERN_INFO
677 "info @0x%p (%d slots empty / %d max)\n", 678 "info @0x%p (%d slots empty / %d max)\n",
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index c85eda63d2b3..77b4637097e9 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -61,10 +61,6 @@ unsigned long memory_limit;
61extern void hash_preload(struct mm_struct *mm, unsigned long ea, 61extern void hash_preload(struct mm_struct *mm, unsigned long ea,
62 unsigned long access, unsigned long trap); 62 unsigned long access, unsigned long trap);
63 63
64/*
65 * This is called by /dev/mem to know if a given address has to
66 * be mapped non-cacheable or not
67 */
68int page_is_ram(unsigned long pfn) 64int page_is_ram(unsigned long pfn)
69{ 65{
70 unsigned long paddr = (pfn << PAGE_SHIFT); 66 unsigned long paddr = (pfn << PAGE_SHIFT);
diff --git a/arch/powerpc/platforms/52xx/Makefile b/arch/powerpc/platforms/52xx/Makefile
index a46184a0c750..795b713ec9ee 100644
--- a/arch/powerpc/platforms/52xx/Makefile
+++ b/arch/powerpc/platforms/52xx/Makefile
@@ -3,6 +3,7 @@
3# 3#
4ifeq ($(CONFIG_PPC_MERGE),y) 4ifeq ($(CONFIG_PPC_MERGE),y)
5obj-y += mpc52xx_pic.o mpc52xx_common.o 5obj-y += mpc52xx_pic.o mpc52xx_common.o
6obj-$(CONFIG_PCI) += mpc52xx_pci.o
6endif 7endif
7 8
8obj-$(CONFIG_PPC_EFIKA) += efika-setup.o efika-pci.o 9obj-$(CONFIG_PPC_EFIKA) += efika-setup.o efika-pci.o
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 0f21bab33f6c..cdb16bfa6ca6 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -107,6 +107,12 @@ static void __init lite52xx_setup_arch(void)
107 mpc52xx_setup_cpu(); /* Generic */ 107 mpc52xx_setup_cpu(); /* Generic */
108 lite52xx_setup_cpu(); /* Platorm specific */ 108 lite52xx_setup_cpu(); /* Platorm specific */
109 109
110#ifdef CONFIG_PCI
111 np = of_find_node_by_type(np, "pci");
112 if (np)
113 mpc52xx_add_bridge(np);
114#endif
115
110#ifdef CONFIG_BLK_DEV_INITRD 116#ifdef CONFIG_BLK_DEV_INITRD
111 if (initrd_start) 117 if (initrd_start)
112 ROOT_DEV = Root_RAM0; 118 ROOT_DEV = Root_RAM0;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
new file mode 100644
index 000000000000..faf161bdbc1c
--- /dev/null
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c
@@ -0,0 +1,412 @@
1/*
2 * PCI code for the Freescale MPC52xx embedded CPU.
3 *
4 * Copyright (C) 2006 Secret Lab Technologies Ltd.
5 * Grant Likely <grant.likely@secretlab.ca>
6 * Copyright (C) 2004 Sylvain Munaut <tnt@246tNt.com>
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 */
12
13#undef DEBUG
14
15#include <asm/pci.h>
16#include <asm/mpc52xx.h>
17#include <asm/delay.h>
18#include <asm/machdep.h>
19#include <linux/kernel.h>
20
21
22/* ======================================================================== */
23/* PCI windows config */
24/* ======================================================================== */
25
26#define MPC52xx_PCI_TARGET_IO 0xf0000000
27#define MPC52xx_PCI_TARGET_MEM 0x00000000
28
29
30/* ======================================================================== */
31/* Structures mapping & Defines for PCI Unit */
32/* ======================================================================== */
33
34#define MPC52xx_PCI_GSCR_BM 0x40000000
35#define MPC52xx_PCI_GSCR_PE 0x20000000
36#define MPC52xx_PCI_GSCR_SE 0x10000000
37#define MPC52xx_PCI_GSCR_XLB2PCI_MASK 0x07000000
38#define MPC52xx_PCI_GSCR_XLB2PCI_SHIFT 24
39#define MPC52xx_PCI_GSCR_IPG2PCI_MASK 0x00070000
40#define MPC52xx_PCI_GSCR_IPG2PCI_SHIFT 16
41#define MPC52xx_PCI_GSCR_BME 0x00004000
42#define MPC52xx_PCI_GSCR_PEE 0x00002000
43#define MPC52xx_PCI_GSCR_SEE 0x00001000
44#define MPC52xx_PCI_GSCR_PR 0x00000001
45
46
47#define MPC52xx_PCI_IWBTAR_TRANSLATION(proc_ad,pci_ad,size) \
48 ( ( (proc_ad) & 0xff000000 ) | \
49 ( (((size) - 1) >> 8) & 0x00ff0000 ) | \
50 ( ((pci_ad) >> 16) & 0x0000ff00 ) )
51
52#define MPC52xx_PCI_IWCR_PACK(win0,win1,win2) (((win0) << 24) | \
53 ((win1) << 16) | \
54 ((win2) << 8))
55
56#define MPC52xx_PCI_IWCR_DISABLE 0x0
57#define MPC52xx_PCI_IWCR_ENABLE 0x1
58#define MPC52xx_PCI_IWCR_READ 0x0
59#define MPC52xx_PCI_IWCR_READ_LINE 0x2
60#define MPC52xx_PCI_IWCR_READ_MULTI 0x4
61#define MPC52xx_PCI_IWCR_MEM 0x0
62#define MPC52xx_PCI_IWCR_IO 0x8
63
64#define MPC52xx_PCI_TCR_P 0x01000000
65#define MPC52xx_PCI_TCR_LD 0x00010000
66
67#define MPC52xx_PCI_TBATR_DISABLE 0x0
68#define MPC52xx_PCI_TBATR_ENABLE 0x1
69
70struct mpc52xx_pci {
71 u32 idr; /* PCI + 0x00 */
72 u32 scr; /* PCI + 0x04 */
73 u32 ccrir; /* PCI + 0x08 */
74 u32 cr1; /* PCI + 0x0C */
75 u32 bar0; /* PCI + 0x10 */
76 u32 bar1; /* PCI + 0x14 */
77 u8 reserved1[16]; /* PCI + 0x18 */
78 u32 ccpr; /* PCI + 0x28 */
79 u32 sid; /* PCI + 0x2C */
80 u32 erbar; /* PCI + 0x30 */
81 u32 cpr; /* PCI + 0x34 */
82 u8 reserved2[4]; /* PCI + 0x38 */
83 u32 cr2; /* PCI + 0x3C */
84 u8 reserved3[32]; /* PCI + 0x40 */
85 u32 gscr; /* PCI + 0x60 */
86 u32 tbatr0; /* PCI + 0x64 */
87 u32 tbatr1; /* PCI + 0x68 */
88 u32 tcr; /* PCI + 0x6C */
89 u32 iw0btar; /* PCI + 0x70 */
90 u32 iw1btar; /* PCI + 0x74 */
91 u32 iw2btar; /* PCI + 0x78 */
92 u8 reserved4[4]; /* PCI + 0x7C */
93 u32 iwcr; /* PCI + 0x80 */
94 u32 icr; /* PCI + 0x84 */
95 u32 isr; /* PCI + 0x88 */
96 u32 arb; /* PCI + 0x8C */
97 u8 reserved5[104]; /* PCI + 0x90 */
98 u32 car; /* PCI + 0xF8 */
99 u8 reserved6[4]; /* PCI + 0xFC */
100};
101
102
103/* ======================================================================== */
104/* PCI configuration acess */
105/* ======================================================================== */
106
107static int
108mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
109 int offset, int len, u32 *val)
110{
111 struct pci_controller *hose = bus->sysdata;
112 u32 value;
113
114 if (ppc_md.pci_exclude_device)
115 if (ppc_md.pci_exclude_device(bus->number, devfn))
116 return PCIBIOS_DEVICE_NOT_FOUND;
117
118 out_be32(hose->cfg_addr,
119 (1 << 31) |
120 ((bus->number - hose->bus_offset) << 16) |
121 (devfn << 8) |
122 (offset & 0xfc));
123 mb();
124
125#if defined(CONFIG_PPC_MPC5200_BUGFIX)
126 if (bus->number != hose->bus_offset) {
127 /* workaround for the bug 435 of the MPC5200 (L25R);
128 * Don't do 32 bits config access during type-1 cycles */
129 switch (len) {
130 case 1:
131 value = in_8(((u8 __iomem *)hose->cfg_data) +
132 (offset & 3));
133 break;
134 case 2:
135 value = in_le16(((u16 __iomem *)hose->cfg_data) +
136 ((offset>>1) & 1));
137 break;
138
139 default:
140 value = in_le16((u16 __iomem *)hose->cfg_data) |
141 (in_le16(((u16 __iomem *)hose->cfg_data) + 1) << 16);
142 break;
143 }
144 }
145 else
146#endif
147 {
148 value = in_le32(hose->cfg_data);
149
150 if (len != 4) {
151 value >>= ((offset & 0x3) << 3);
152 value &= 0xffffffff >> (32 - (len << 3));
153 }
154 }
155
156 *val = value;
157
158 out_be32(hose->cfg_addr, 0);
159 mb();
160
161 return PCIBIOS_SUCCESSFUL;
162}
163
164static int
165mpc52xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
166 int offset, int len, u32 val)
167{
168 struct pci_controller *hose = bus->sysdata;
169 u32 value, mask;
170
171 if (ppc_md.pci_exclude_device)
172 if (ppc_md.pci_exclude_device(bus->number, devfn))
173 return PCIBIOS_DEVICE_NOT_FOUND;
174
175 out_be32(hose->cfg_addr,
176 (1 << 31) |
177 ((bus->number - hose->bus_offset) << 16) |
178 (devfn << 8) |
179 (offset & 0xfc));
180 mb();
181
182#if defined(CONFIG_PPC_MPC5200_BUGFIX)
183 if (bus->number != hose->bus_offset) {
184 /* workaround for the bug 435 of the MPC5200 (L25R);
185 * Don't do 32 bits config access during type-1 cycles */
186 switch (len) {
187 case 1:
188 out_8(((u8 __iomem *)hose->cfg_data) +
189 (offset & 3), val);
190 break;
191 case 2:
192 out_le16(((u16 __iomem *)hose->cfg_data) +
193 ((offset>>1) & 1), val);
194 break;
195
196 default:
197 out_le16((u16 __iomem *)hose->cfg_data,
198 (u16)val);
199 out_le16(((u16 __iomem *)hose->cfg_data) + 1,
200 (u16)(val>>16));
201 break;
202 }
203 }
204 else
205#endif
206 {
207 if (len != 4) {
208 value = in_le32(hose->cfg_data);
209
210 offset = (offset & 0x3) << 3;
211 mask = (0xffffffff >> (32 - (len << 3)));
212 mask <<= offset;
213
214 value &= ~mask;
215 val = value | ((val << offset) & mask);
216 }
217
218 out_le32(hose->cfg_data, val);
219 }
220 mb();
221
222 out_be32(hose->cfg_addr, 0);
223 mb();
224
225 return PCIBIOS_SUCCESSFUL;
226}
227
228static struct pci_ops mpc52xx_pci_ops = {
229 .read = mpc52xx_pci_read_config,
230 .write = mpc52xx_pci_write_config
231};
232
233
234/* ======================================================================== */
235/* PCI setup */
236/* ======================================================================== */
237
238static void __init
239mpc52xx_pci_setup(struct pci_controller *hose,
240 struct mpc52xx_pci __iomem *pci_regs)
241{
242 struct resource *res;
243 u32 tmp;
244 int iwcr0 = 0, iwcr1 = 0, iwcr2 = 0;
245
246 pr_debug("mpc52xx_pci_setup(hose=%p, pci_regs=%p)\n", hose, pci_regs);
247
248 /* pci_process_bridge_OF_ranges() found all our addresses for us;
249 * now store them in the right places */
250 hose->cfg_addr = &pci_regs->car;
251 hose->cfg_data = hose->io_base_virt;
252
253 /* Control regs */
254 tmp = in_be32(&pci_regs->scr);
255 tmp |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
256 out_be32(&pci_regs->scr, tmp);
257
258 /* Memory windows */
259 res = &hose->mem_resources[0];
260 if (res->flags) {
261 pr_debug("mem_resource[0] = {.start=%x, .end=%x, .flags=%lx}\n",
262 res->start, res->end, res->flags);
263 out_be32(&pci_regs->iw0btar,
264 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
265 res->end - res->start + 1));
266 iwcr0 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM;
267 if (res->flags & IORESOURCE_PREFETCH)
268 iwcr0 |= MPC52xx_PCI_IWCR_READ_MULTI;
269 else
270 iwcr0 |= MPC52xx_PCI_IWCR_READ;
271 }
272
273 res = &hose->mem_resources[1];
274 if (res->flags) {
275 pr_debug("mem_resource[1] = {.start=%x, .end=%x, .flags=%lx}\n",
276 res->start, res->end, res->flags);
277 out_be32(&pci_regs->iw1btar,
278 MPC52xx_PCI_IWBTAR_TRANSLATION(res->start, res->start,
279 res->end - res->start + 1));
280 iwcr1 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_MEM;
281 if (res->flags & IORESOURCE_PREFETCH)
282 iwcr1 |= MPC52xx_PCI_IWCR_READ_MULTI;
283 else
284 iwcr1 |= MPC52xx_PCI_IWCR_READ;
285 }
286
287 /* IO resources */
288 res = &hose->io_resource;
289 if (!res) {
290 printk(KERN_ERR "%s: Didn't find IO resources\n", __FILE__);
291 return;
292 }
293 pr_debug(".io_resource={.start=%x,.end=%x,.flags=%lx} "
294 ".io_base_phys=0x%p\n",
295 res->start, res->end, res->flags, (void*)hose->io_base_phys);
296 out_be32(&pci_regs->iw2btar,
297 MPC52xx_PCI_IWBTAR_TRANSLATION(hose->io_base_phys,
298 res->start,
299 res->end - res->start + 1));
300 iwcr2 = MPC52xx_PCI_IWCR_ENABLE | MPC52xx_PCI_IWCR_IO;
301
302 /* Set all the IWCR fields at once; they're in the same reg */
303 out_be32(&pci_regs->iwcr, MPC52xx_PCI_IWCR_PACK(iwcr0, iwcr1, iwcr2));
304
305 out_be32(&pci_regs->tbatr0,
306 MPC52xx_PCI_TBATR_ENABLE | MPC52xx_PCI_TARGET_IO );
307 out_be32(&pci_regs->tbatr1,
308 MPC52xx_PCI_TBATR_ENABLE | MPC52xx_PCI_TARGET_MEM );
309
310 out_be32(&pci_regs->tcr, MPC52xx_PCI_TCR_LD);
311
312 tmp = in_be32(&pci_regs->gscr);
313#if 0
314 /* Reset the exteral bus ( internal PCI controller is NOT resetted ) */
315 /* Not necessary and can be a bad thing if for example the bootloader
316 is displaying a splash screen or ... Just left here for
317 documentation purpose if anyone need it */
318 out_be32(&pci_regs->gscr, tmp | MPC52xx_PCI_GSCR_PR);
319 udelay(50);
320#endif
321
322 /* Make sure the PCI bridge is out of reset */
323 out_be32(&pci_regs->gscr, tmp & ~MPC52xx_PCI_GSCR_PR);
324}
325
326static void
327mpc52xx_pci_fixup_resources(struct pci_dev *dev)
328{
329 int i;
330
331 pr_debug("mpc52xx_pci_fixup_resources() %.4x:%.4x\n",
332 dev->vendor, dev->device);
333
334 /* We don't rely on boot loader for PCI and resets all
335 devices */
336 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
337 struct resource *res = &dev->resource[i];
338 if (res->end > res->start) { /* Only valid resources */
339 res->end -= res->start;
340 res->start = 0;
341 res->flags |= IORESOURCE_UNSET;
342 }
343 }
344
345 /* The PCI Host bridge of MPC52xx has a prefetch memory resource
346 fixed to 1Gb. Doesn't fit in the resource system so we remove it */
347 if ( (dev->vendor == PCI_VENDOR_ID_MOTOROLA) &&
348 ( dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200
349 || dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200B) ) {
350 struct resource *res = &dev->resource[1];
351 res->start = res->end = res->flags = 0;
352 }
353}
354
355int __init
356mpc52xx_add_bridge(struct device_node *node)
357{
358 int len;
359 struct mpc52xx_pci __iomem *pci_regs;
360 struct pci_controller *hose;
361 const int *bus_range;
362 struct resource rsrc;
363
364 pr_debug("Adding MPC52xx PCI host bridge %s\n", node->full_name);
365
366 pci_assign_all_buses = 1;
367
368 if (of_address_to_resource(node, 0, &rsrc) != 0) {
369 printk(KERN_ERR "Can't get %s resources\n", node->full_name);
370 return -EINVAL;
371 }
372
373 bus_range = get_property(node, "bus-range", &len);
374 if (bus_range == NULL || len < 2 * sizeof(int)) {
375 printk(KERN_WARNING "Can't get %s bus-range, assume bus 0\n",
376 node->full_name);
377 bus_range = NULL;
378 }
379
380 /* There are some PCI quirks on the 52xx, register the hook to
381 * fix them. */
382 ppc_md.pcibios_fixup_resources = mpc52xx_pci_fixup_resources;
383
384 /* Alloc and initialize the pci controller. Values in the device
385 * tree are needed to configure the 52xx PCI controller. Rather
386 * than parse the tree here, let pci_process_bridge_OF_ranges()
387 * do it for us and extract the values after the fact */
388 hose = pcibios_alloc_controller();
389 if (!hose)
390 return -ENOMEM;
391
392 hose->arch_data = node;
393 hose->set_cfg_type = 1;
394
395 hose->first_busno = bus_range ? bus_range[0] : 0;
396 hose->last_busno = bus_range ? bus_range[1] : 0xff;
397
398 hose->bus_offset = 0;
399 hose->ops = &mpc52xx_pci_ops;
400
401 pci_regs = ioremap(rsrc.start, rsrc.end - rsrc.start + 1);
402 if (!pci_regs)
403 return -ENOMEM;
404
405 pci_process_bridge_OF_ranges(hose, node, 1);
406
407 /* Finish setting up PCI using values obtained by
408 * pci_proces_bridge_OF_ranges */
409 mpc52xx_pci_setup(hose, pci_regs);
410
411 return 0;
412}
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 1c7b2baa5f73..90522e3c9d46 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -59,6 +59,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = {
59 {FW_FEATURE_XDABR, "hcall-xdabr"}, 59 {FW_FEATURE_XDABR, "hcall-xdabr"},
60 {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, 60 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
61 {FW_FEATURE_SPLPAR, "hcall-splpar"}, 61 {FW_FEATURE_SPLPAR, "hcall-splpar"},
62 {FW_FEATURE_BULK_REMOVE, "hcall-bulk"},
62}; 63};
63 64
64/* Build up the firmware features bitmask using the contents of 65/* Build up the firmware features bitmask using the contents of
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 5a684fbd8f27..7496005566ef 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -516,7 +516,7 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
516static void pSeries_lpar_flush_hash_range(unsigned long number, int local) 516static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
517{ 517{
518 unsigned long i, pix, rc; 518 unsigned long i, pix, rc;
519 unsigned long flags; 519 unsigned long flags = 0;
520 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 520 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
521 int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE); 521 int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
522 unsigned long param[9]; 522 unsigned long param[9];
@@ -540,16 +540,22 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)
540 hash = ~hash; 540 hash = ~hash;
541 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 541 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
542 slot += hidx & _PTEIDX_GROUP_IX; 542 slot += hidx & _PTEIDX_GROUP_IX;
543 param[pix] = HBR_REQUEST | HBR_AVPN | slot; 543 if (!firmware_has_feature(FW_FEATURE_BULK_REMOVE)) {
544 param[pix+1] = hpte_encode_v(va, psize) & HPTE_V_AVPN; 544 pSeries_lpar_hpte_invalidate(slot, va, psize,
545 pix += 2; 545 local);
546 if (pix == 8) { 546 } else {
547 rc = plpar_hcall9(H_BULK_REMOVE, param, 547 param[pix] = HBR_REQUEST | HBR_AVPN | slot;
548 param[pix+1] = hpte_encode_v(va, psize) &
549 HPTE_V_AVPN;
550 pix += 2;
551 if (pix == 8) {
552 rc = plpar_hcall9(H_BULK_REMOVE, param,
548 param[0], param[1], param[2], 553 param[0], param[1], param[2],
549 param[3], param[4], param[5], 554 param[3], param[4], param[5],
550 param[6], param[7]); 555 param[6], param[7]);
551 BUG_ON(rc != H_SUCCESS); 556 BUG_ON(rc != H_SUCCESS);
552 pix = 0; 557 pix = 0;
558 }
553 } 559 }
554 } pte_iterate_hashed_end(); 560 } pte_iterate_hashed_end();
555 } 561 }
diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c
index 5d841f4b3530..af3780e52e76 100644
--- a/arch/powerpc/xmon/ppc-opc.c
+++ b/arch/powerpc/xmon/ppc-opc.c
@@ -21,6 +21,7 @@
21 02110-1301, USA. */ 21 02110-1301, USA. */
22 22
23#include <linux/stddef.h> 23#include <linux/stddef.h>
24#include <linux/kernel.h>
24#include "nonstdio.h" 25#include "nonstdio.h"
25#include "ppc.h" 26#include "ppc.h"
26 27
@@ -4932,8 +4933,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
4932 4933
4933}; 4934};
4934 4935
4935const int powerpc_num_opcodes = 4936const int powerpc_num_opcodes = ARRAY_SIZE(powerpc_opcodes);
4936 sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]);
4937 4937
4938/* The macro table. This is only used by the assembler. */ 4938/* The macro table. This is only used by the assembler. */
4939 4939
@@ -4989,5 +4989,4 @@ const struct powerpc_macro powerpc_macros[] = {
4989{ "clrlslwi.",4, PPCCOM, "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" }, 4989{ "clrlslwi.",4, PPCCOM, "rlwinm. %0,%1,%3,(%2)-(%3),31-(%3)" },
4990}; 4990};
4991 4991
4992const int powerpc_num_macros = 4992const int powerpc_num_macros = ARRAY_SIZE(powerpc_macros);
4993 sizeof (powerpc_macros) / sizeof (powerpc_macros[0]);
diff --git a/arch/powerpc/xmon/spu-opc.c b/arch/powerpc/xmon/spu-opc.c
index efffde9edc6e..530df3d6d7b2 100644
--- a/arch/powerpc/xmon/spu-opc.c
+++ b/arch/powerpc/xmon/spu-opc.c
@@ -18,6 +18,7 @@
18 with this program; if not, write to the Free Software Foundation, Inc., 18 with this program; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 19 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
20 20
21#include <linux/kernel.h>
21#include "spu.h" 22#include "spu.h"
22 23
23/* This file holds the Spu opcode table */ 24/* This file holds the Spu opcode table */
@@ -40,5 +41,4 @@ const struct spu_opcode spu_opcodes[] = {
40#undef APUOPFB 41#undef APUOPFB
41}; 42};
42 43
43const int spu_num_opcodes = 44const int spu_num_opcodes = ARRAY_SIZE(spu_opcodes);
44 sizeof (spu_opcodes) / sizeof (spu_opcodes[0]);
diff --git a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c
index b7bb5f0b3c5f..684ed04eb8b8 100644
--- a/arch/ppc/8xx_io/cs4218_tdm.c
+++ b/arch/ppc/8xx_io/cs4218_tdm.c
@@ -1379,7 +1379,6 @@ static void cs_nosound(unsigned long xx)
1379} 1379}
1380 1380
1381static DEFINE_TIMER(beep_timer, cs_nosound, 0, 0); 1381static DEFINE_TIMER(beep_timer, cs_nosound, 0, 0);
1382};
1383 1382
1384static void cs_mksound(unsigned int hz, unsigned int ticks) 1383static void cs_mksound(unsigned int hz, unsigned int ticks)
1385{ 1384{
diff --git a/arch/ppc/lib/rheap.c b/arch/ppc/lib/rheap.c
index 31e511856dc5..d40700795a9c 100644
--- a/arch/ppc/lib/rheap.c
+++ b/arch/ppc/lib/rheap.c
@@ -14,6 +14,7 @@
14 */ 14 */
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/kernel.h>
17#include <linux/mm.h> 18#include <linux/mm.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19 20
@@ -654,7 +655,7 @@ void rh_dump(rh_info_t * info)
654 int maxnr; 655 int maxnr;
655 int i, nr; 656 int i, nr;
656 657
657 maxnr = sizeof(st) / sizeof(st[0]); 658 maxnr = ARRAY_SIZE(st);
658 659
659 printk(KERN_INFO 660 printk(KERN_INFO
660 "info @0x%p (%d slots empty / %d max)\n", 661 "info @0x%p (%d slots empty / %d max)\n",
diff --git a/arch/ppc/syslib/m8260_pci_erratum9.c b/arch/ppc/syslib/m8260_pci_erratum9.c
index 5475709ce07b..ebb8c8f8f30c 100644
--- a/arch/ppc/syslib/m8260_pci_erratum9.c
+++ b/arch/ppc/syslib/m8260_pci_erratum9.c
@@ -105,7 +105,8 @@ void idma_pci9_init(void)
105 idma_reg[IDMA_CHAN].idmr = 0; /* mask all IDMA interrupts */ 105 idma_reg[IDMA_CHAN].idmr = 0; /* mask all IDMA interrupts */
106 idma_reg[IDMA_CHAN].idsr = 0xff; /* clear all event flags */ 106 idma_reg[IDMA_CHAN].idsr = 0xff; /* clear all event flags */
107 107
108 printk("<4>Using IDMA%d for MPC8260 device erratum PCI 9 workaround\n", 108 printk(KERN_WARNING
109 "Using IDMA%d for MPC8260 device erratum PCI 9 workaround\n",
109 IDMA_CHAN + 1); 110 IDMA_CHAN + 1);
110 111
111 return; 112 return;
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
index d8d299bd1a12..01e48d88f22d 100644
--- a/arch/ppc/syslib/m8xx_setup.c
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -77,7 +77,7 @@ static struct mtd_partition mpc8xxads_partitions[] = {
77 } 77 }
78}; 78};
79 79
80#define mpc8xxads_part_num (sizeof (mpc8xxads_partitions) / sizeof (mpc8xxads_partitions[0])) 80#define mpc8xxads_part_num ARRAY_SIZE(mpc8xxads_partitions)
81 81
82#endif 82#endif
83 83
diff --git a/arch/ppc/xmon/ppc-opc.c b/arch/ppc/xmon/ppc-opc.c
index 533a6c9973d4..034313cef6e7 100644
--- a/arch/ppc/xmon/ppc-opc.c
+++ b/arch/ppc/xmon/ppc-opc.c
@@ -19,6 +19,7 @@ along with this file; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20 20
21#include <linux/posix_types.h> 21#include <linux/posix_types.h>
22#include <linux/kernel.h>
22#include "ansidecl.h" 23#include "ansidecl.h"
23#include "ppc.h" 24#include "ppc.h"
24 25
@@ -2669,8 +2670,7 @@ const struct powerpc_opcode powerpc_opcodes[] = {
2669 2670
2670}; 2671};
2671 2672
2672const int powerpc_num_opcodes = 2673const int powerpc_num_opcodes = ARRAY_SIZE(powerpc_opcodes);
2673 sizeof (powerpc_opcodes) / sizeof (powerpc_opcodes[0]);
2674 2674
2675/* The macro table. This is only used by the assembler. */ 2675/* The macro table. This is only used by the assembler. */
2676 2676
@@ -2717,5 +2717,4 @@ const struct powerpc_macro powerpc_macros[] = {
2717 2717
2718}; 2718};
2719 2719
2720const int powerpc_num_macros = 2720const int powerpc_num_macros = ARRAY_SIZE(powerpc_macros);
2721 sizeof (powerpc_macros) / sizeof (powerpc_macros[0]);