diff options
Diffstat (limited to 'arch/powerpc')
42 files changed, 966 insertions, 505 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 1189d8d6170d..3651355b6ad7 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -91,6 +91,7 @@ config PPC | |||
91 | select HAVE_OPROFILE | 91 | select HAVE_OPROFILE |
92 | select HAVE_KPROBES | 92 | select HAVE_KPROBES |
93 | select HAVE_KRETPROBES | 93 | select HAVE_KRETPROBES |
94 | select HAVE_LMB | ||
94 | 95 | ||
95 | config EARLY_PRINTK | 96 | config EARLY_PRINTK |
96 | bool | 97 | bool |
@@ -307,6 +308,16 @@ config CRASH_DUMP | |||
307 | 308 | ||
308 | Don't change this unless you know what you are doing. | 309 | Don't change this unless you know what you are doing. |
309 | 310 | ||
311 | config PHYP_DUMP | ||
312 | bool "Hypervisor-assisted dump (EXPERIMENTAL)" | ||
313 | depends on PPC_PSERIES && EXPERIMENTAL | ||
314 | help | ||
315 | Hypervisor-assisted dump is meant to be a kdump replacement | ||
316 | offering robustness and speed not possible without system | ||
317 | hypervisor assistence. | ||
318 | |||
319 | If unsure, say "N" | ||
320 | |||
310 | config PPCBUG_NVRAM | 321 | config PPCBUG_NVRAM |
311 | bool "Enable reading PPCBUG NVRAM during boot" if PPLUS || LOPEC | 322 | bool "Enable reading PPCBUG NVRAM during boot" if PPLUS || LOPEC |
312 | default y if PPC_PREP | 323 | default y if PPC_PREP |
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig index 8b810d056440..7a166a39d92d 100644 --- a/arch/powerpc/configs/maple_defconfig +++ b/arch/powerpc/configs/maple_defconfig | |||
@@ -333,7 +333,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
333 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 333 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
334 | CONFIG_STANDALONE=y | 334 | CONFIG_STANDALONE=y |
335 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 335 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
336 | # CONFIG_FW_LOADER is not set | 336 | CONFIG_FW_LOADER=y |
337 | # CONFIG_DEBUG_DRIVER is not set | 337 | # CONFIG_DEBUG_DRIVER is not set |
338 | # CONFIG_DEBUG_DEVRES is not set | 338 | # CONFIG_DEBUG_DEVRES is not set |
339 | # CONFIG_SYS_HYPERVISOR is not set | 339 | # CONFIG_SYS_HYPERVISOR is not set |
@@ -374,6 +374,7 @@ CONFIG_BLK_DEV_IDEDISK=y | |||
374 | CONFIG_BLK_DEV_IDECD=y | 374 | CONFIG_BLK_DEV_IDECD=y |
375 | # CONFIG_BLK_DEV_IDETAPE is not set | 375 | # CONFIG_BLK_DEV_IDETAPE is not set |
376 | # CONFIG_BLK_DEV_IDEFLOPPY is not set | 376 | # CONFIG_BLK_DEV_IDEFLOPPY is not set |
377 | # CONFIG_BLK_DEV_IDESCSI is not set | ||
377 | CONFIG_IDE_TASK_IOCTL=y | 378 | CONFIG_IDE_TASK_IOCTL=y |
378 | CONFIG_IDE_PROC_FS=y | 379 | CONFIG_IDE_PROC_FS=y |
379 | 380 | ||
@@ -427,10 +428,129 @@ CONFIG_IDE_ARCH_OBSOLETE_INIT=y | |||
427 | # SCSI device support | 428 | # SCSI device support |
428 | # | 429 | # |
429 | # CONFIG_RAID_ATTRS is not set | 430 | # CONFIG_RAID_ATTRS is not set |
430 | # CONFIG_SCSI is not set | 431 | CONFIG_SCSI=y |
431 | # CONFIG_SCSI_DMA is not set | 432 | CONFIG_SCSI_DMA=y |
433 | # CONFIG_SCSI_TGT is not set | ||
432 | # CONFIG_SCSI_NETLINK is not set | 434 | # CONFIG_SCSI_NETLINK is not set |
433 | # CONFIG_ATA is not set | 435 | # CONFIG_SCSI_PROC_FS is not set |
436 | |||
437 | # | ||
438 | # SCSI support type (disk, tape, CD-ROM) | ||
439 | # | ||
440 | CONFIG_BLK_DEV_SD=y | ||
441 | # CONFIG_CHR_DEV_ST is not set | ||
442 | # CONFIG_CHR_DEV_OSST is not set | ||
443 | # CONFIG_BLK_DEV_SR is not set | ||
444 | CONFIG_CHR_DEV_SG=y | ||
445 | # CONFIG_CHR_DEV_SCH is not set | ||
446 | |||
447 | # | ||
448 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | ||
449 | # | ||
450 | # CONFIG_SCSI_MULTI_LUN is not set | ||
451 | # CONFIG_SCSI_CONSTANTS is not set | ||
452 | # CONFIG_SCSI_LOGGING is not set | ||
453 | # CONFIG_SCSI_SCAN_ASYNC is not set | ||
454 | CONFIG_SCSI_WAIT_SCAN=m | ||
455 | |||
456 | # | ||
457 | # SCSI Transports | ||
458 | # | ||
459 | # CONFIG_SCSI_SPI_ATTRS is not set | ||
460 | # CONFIG_SCSI_FC_ATTRS is not set | ||
461 | # CONFIG_SCSI_ISCSI_ATTRS is not set | ||
462 | # CONFIG_SCSI_SAS_LIBSAS is not set | ||
463 | # CONFIG_SCSI_SRP_ATTRS is not set | ||
464 | CONFIG_SCSI_LOWLEVEL=y | ||
465 | # CONFIG_ISCSI_TCP is not set | ||
466 | # CONFIG_BLK_DEV_3W_XXXX_RAID is not set | ||
467 | # CONFIG_SCSI_3W_9XXX is not set | ||
468 | # CONFIG_SCSI_ACARD is not set | ||
469 | # CONFIG_SCSI_AACRAID is not set | ||
470 | # CONFIG_SCSI_AIC7XXX is not set | ||
471 | # CONFIG_SCSI_AIC7XXX_OLD is not set | ||
472 | # CONFIG_SCSI_AIC79XX is not set | ||
473 | # CONFIG_SCSI_AIC94XX is not set | ||
474 | # CONFIG_SCSI_ARCMSR is not set | ||
475 | # CONFIG_MEGARAID_NEWGEN is not set | ||
476 | # CONFIG_MEGARAID_LEGACY is not set | ||
477 | # CONFIG_MEGARAID_SAS is not set | ||
478 | # CONFIG_SCSI_HPTIOP is not set | ||
479 | # CONFIG_SCSI_DMX3191D is not set | ||
480 | # CONFIG_SCSI_EATA is not set | ||
481 | # CONFIG_SCSI_FUTURE_DOMAIN is not set | ||
482 | # CONFIG_SCSI_GDTH is not set | ||
483 | # CONFIG_SCSI_IPS is not set | ||
484 | # CONFIG_SCSI_INITIO is not set | ||
485 | # CONFIG_SCSI_INIA100 is not set | ||
486 | # CONFIG_SCSI_STEX is not set | ||
487 | # CONFIG_SCSI_SYM53C8XX_2 is not set | ||
488 | CONFIG_SCSI_IPR=y | ||
489 | CONFIG_SCSI_IPR_TRACE=y | ||
490 | CONFIG_SCSI_IPR_DUMP=y | ||
491 | # CONFIG_SCSI_QLOGIC_1280 is not set | ||
492 | # CONFIG_SCSI_QLA_FC is not set | ||
493 | # CONFIG_SCSI_QLA_ISCSI is not set | ||
494 | # CONFIG_SCSI_LPFC is not set | ||
495 | # CONFIG_SCSI_DC395x is not set | ||
496 | # CONFIG_SCSI_DC390T is not set | ||
497 | # CONFIG_SCSI_DEBUG is not set | ||
498 | # CONFIG_SCSI_SRP is not set | ||
499 | CONFIG_ATA=y | ||
500 | CONFIG_ATA_NONSTANDARD=y | ||
501 | # CONFIG_SATA_AHCI is not set | ||
502 | # CONFIG_SATA_SVW is not set | ||
503 | # CONFIG_ATA_PIIX is not set | ||
504 | # CONFIG_SATA_MV is not set | ||
505 | # CONFIG_SATA_NV is not set | ||
506 | # CONFIG_PDC_ADMA is not set | ||
507 | # CONFIG_SATA_QSTOR is not set | ||
508 | # CONFIG_SATA_PROMISE is not set | ||
509 | # CONFIG_SATA_SX4 is not set | ||
510 | # CONFIG_SATA_SIL is not set | ||
511 | # CONFIG_SATA_SIL24 is not set | ||
512 | # CONFIG_SATA_SIS is not set | ||
513 | # CONFIG_SATA_ULI is not set | ||
514 | # CONFIG_SATA_VIA is not set | ||
515 | # CONFIG_SATA_VITESSE is not set | ||
516 | # CONFIG_SATA_INIC162X is not set | ||
517 | # CONFIG_PATA_ALI is not set | ||
518 | # CONFIG_PATA_AMD is not set | ||
519 | # CONFIG_PATA_ARTOP is not set | ||
520 | # CONFIG_PATA_ATIIXP is not set | ||
521 | # CONFIG_PATA_CMD640_PCI is not set | ||
522 | # CONFIG_PATA_CMD64X is not set | ||
523 | # CONFIG_PATA_CS5520 is not set | ||
524 | # CONFIG_PATA_CS5530 is not set | ||
525 | # CONFIG_PATA_CYPRESS is not set | ||
526 | # CONFIG_PATA_EFAR is not set | ||
527 | # CONFIG_ATA_GENERIC is not set | ||
528 | # CONFIG_PATA_HPT366 is not set | ||
529 | # CONFIG_PATA_HPT37X is not set | ||
530 | # CONFIG_PATA_HPT3X2N is not set | ||
531 | # CONFIG_PATA_HPT3X3 is not set | ||
532 | # CONFIG_PATA_IT821X is not set | ||
533 | # CONFIG_PATA_IT8213 is not set | ||
534 | # CONFIG_PATA_JMICRON is not set | ||
535 | # CONFIG_PATA_TRIFLEX is not set | ||
536 | # CONFIG_PATA_MARVELL is not set | ||
537 | # CONFIG_PATA_MPIIX is not set | ||
538 | # CONFIG_PATA_OLDPIIX is not set | ||
539 | # CONFIG_PATA_NETCELL is not set | ||
540 | # CONFIG_PATA_NS87410 is not set | ||
541 | # CONFIG_PATA_NS87415 is not set | ||
542 | # CONFIG_PATA_OPTI is not set | ||
543 | # CONFIG_PATA_OPTIDMA is not set | ||
544 | # CONFIG_PATA_PDC_OLD is not set | ||
545 | # CONFIG_PATA_RADISYS is not set | ||
546 | # CONFIG_PATA_RZ1000 is not set | ||
547 | # CONFIG_PATA_SC1200 is not set | ||
548 | # CONFIG_PATA_SERVERWORKS is not set | ||
549 | # CONFIG_PATA_PDC2027X is not set | ||
550 | # CONFIG_PATA_SIL680 is not set | ||
551 | # CONFIG_PATA_SIS is not set | ||
552 | # CONFIG_PATA_VIA is not set | ||
553 | # CONFIG_PATA_WINBOND is not set | ||
434 | # CONFIG_MD is not set | 554 | # CONFIG_MD is not set |
435 | # CONFIG_FUSION is not set | 555 | # CONFIG_FUSION is not set |
436 | 556 | ||
@@ -536,6 +656,7 @@ CONFIG_USB_PEGASUS=y | |||
536 | # CONFIG_HIPPI is not set | 656 | # CONFIG_HIPPI is not set |
537 | # CONFIG_PPP is not set | 657 | # CONFIG_PPP is not set |
538 | # CONFIG_SLIP is not set | 658 | # CONFIG_SLIP is not set |
659 | # CONFIG_NET_FC is not set | ||
539 | # CONFIG_SHAPER is not set | 660 | # CONFIG_SHAPER is not set |
540 | # CONFIG_NETCONSOLE is not set | 661 | # CONFIG_NETCONSOLE is not set |
541 | # CONFIG_NETPOLL is not set | 662 | # CONFIG_NETPOLL is not set |
@@ -783,12 +904,14 @@ CONFIG_USB_UHCI_HCD=y | |||
783 | # | 904 | # |
784 | # may also be needed; see USB_STORAGE Help for more information | 905 | # may also be needed; see USB_STORAGE Help for more information |
785 | # | 906 | # |
907 | # CONFIG_USB_STORAGE is not set | ||
786 | # CONFIG_USB_LIBUSUAL is not set | 908 | # CONFIG_USB_LIBUSUAL is not set |
787 | 909 | ||
788 | # | 910 | # |
789 | # USB Imaging devices | 911 | # USB Imaging devices |
790 | # | 912 | # |
791 | # CONFIG_USB_MDC800 is not set | 913 | # CONFIG_USB_MDC800 is not set |
914 | # CONFIG_USB_MICROTEK is not set | ||
792 | CONFIG_USB_MON=y | 915 | CONFIG_USB_MON=y |
793 | 916 | ||
794 | # | 917 | # |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 4b749c416464..e932b43bd82f 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -26,8 +26,6 @@ | |||
26 | #ifdef CONFIG_PPC64 | 26 | #ifdef CONFIG_PPC64 |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/hardirq.h> | 28 | #include <linux/hardirq.h> |
29 | #else | ||
30 | #include <linux/ptrace.h> | ||
31 | #endif | 29 | #endif |
32 | 30 | ||
33 | #include <asm/io.h> | 31 | #include <asm/io.h> |
@@ -60,7 +58,6 @@ int main(void) | |||
60 | DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context)); | 58 | DEFINE(AUDITCONTEXT, offsetof(struct task_struct, audit_context)); |
61 | #else | 59 | #else |
62 | DEFINE(THREAD_INFO, offsetof(struct task_struct, stack)); | 60 | DEFINE(THREAD_INFO, offsetof(struct task_struct, stack)); |
63 | DEFINE(PTRACE, offsetof(struct task_struct, ptrace)); | ||
64 | #endif /* CONFIG_PPC64 */ | 61 | #endif /* CONFIG_PPC64 */ |
65 | 62 | ||
66 | DEFINE(KSP, offsetof(struct thread_struct, ksp)); | 63 | DEFINE(KSP, offsetof(struct thread_struct, ksp)); |
@@ -80,7 +77,6 @@ int main(void) | |||
80 | DEFINE(PGDIR, offsetof(struct thread_struct, pgdir)); | 77 | DEFINE(PGDIR, offsetof(struct thread_struct, pgdir)); |
81 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) | 78 | #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) |
82 | DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0)); | 79 | DEFINE(THREAD_DBCR0, offsetof(struct thread_struct, dbcr0)); |
83 | DEFINE(PT_PTRACED, PT_PTRACED); | ||
84 | #endif | 80 | #endif |
85 | #ifdef CONFIG_SPE | 81 | #ifdef CONFIG_SPE |
86 | DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0])); | 82 | DEFINE(THREAD_EVR0, offsetof(struct thread_struct, evr[0])); |
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index 80e2eef05b2e..9f9377745490 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/string.h> | 7 | #include <linux/string.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/lmb.h> | ||
10 | 11 | ||
11 | #include <asm/sections.h> | 12 | #include <asm/sections.h> |
12 | #include <asm/prom.h> | 13 | #include <asm/prom.h> |
@@ -15,7 +16,7 @@ | |||
15 | #include <asm/mmu.h> | 16 | #include <asm/mmu.h> |
16 | #include <asm/pgtable.h> | 17 | #include <asm/pgtable.h> |
17 | #include <asm/io.h> | 18 | #include <asm/io.h> |
18 | #include <asm/lmb.h> | 19 | #include <asm/prom.h> |
19 | #include <asm/processor.h> | 20 | #include <asm/processor.h> |
20 | #include <asm/udbg.h> | 21 | #include <asm/udbg.h> |
21 | 22 | ||
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index 571132ed12c1..eae401de3f76 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c | |||
@@ -24,12 +24,13 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/lmb.h> | ||
27 | 28 | ||
28 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
29 | #include <asm/machdep.h> | 30 | #include <asm/machdep.h> |
30 | #include <asm/kexec.h> | 31 | #include <asm/kexec.h> |
31 | #include <asm/kdump.h> | 32 | #include <asm/kdump.h> |
32 | #include <asm/lmb.h> | 33 | #include <asm/prom.h> |
33 | #include <asm/firmware.h> | 34 | #include <asm/firmware.h> |
34 | #include <asm/smp.h> | 35 | #include <asm/smp.h> |
35 | #include <asm/system.h> | 36 | #include <asm/system.h> |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 29ff77c468ac..9ee3c5278db0 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -13,8 +13,9 @@ | |||
13 | 13 | ||
14 | #include <linux/crash_dump.h> | 14 | #include <linux/crash_dump.h> |
15 | #include <linux/bootmem.h> | 15 | #include <linux/bootmem.h> |
16 | #include <linux/lmb.h> | ||
16 | #include <asm/kdump.h> | 17 | #include <asm/kdump.h> |
17 | #include <asm/lmb.h> | 18 | #include <asm/prom.h> |
18 | #include <asm/firmware.h> | 19 | #include <asm/firmware.h> |
19 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
20 | 21 | ||
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index 0f4fac512020..c16d1354b19d 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S | |||
@@ -763,23 +763,6 @@ load_up_altivec: | |||
763 | b fast_exception_return | 763 | b fast_exception_return |
764 | 764 | ||
765 | /* | 765 | /* |
766 | * AltiVec unavailable trap from kernel - print a message, but let | ||
767 | * the task use AltiVec in the kernel until it returns to user mode. | ||
768 | */ | ||
769 | KernelAltiVec: | ||
770 | lwz r3,_MSR(r1) | ||
771 | oris r3,r3,MSR_VEC@h | ||
772 | stw r3,_MSR(r1) /* enable use of AltiVec after return */ | ||
773 | lis r3,87f@h | ||
774 | ori r3,r3,87f@l | ||
775 | mr r4,r2 /* current */ | ||
776 | lwz r5,_NIP(r1) | ||
777 | bl printk | ||
778 | b ret_from_except | ||
779 | 87: .string "AltiVec used in kernel (task=%p, pc=%x) \n" | ||
780 | .align 4,0 | ||
781 | |||
782 | /* | ||
783 | * giveup_altivec(tsk) | 766 | * giveup_altivec(tsk) |
784 | * Disable AltiVec for the task given as the argument, | 767 | * Disable AltiVec for the task given as the argument, |
785 | * and save the AltiVec registers in its thread_struct. | 768 | * and save the AltiVec registers in its thread_struct. |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index c0c8e8c3ced9..2d202f274e73 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -12,8 +12,9 @@ | |||
12 | #include <linux/kexec.h> | 12 | #include <linux/kexec.h> |
13 | #include <linux/reboot.h> | 13 | #include <linux/reboot.h> |
14 | #include <linux/threads.h> | 14 | #include <linux/threads.h> |
15 | #include <linux/lmb.h> | ||
15 | #include <asm/machdep.h> | 16 | #include <asm/machdep.h> |
16 | #include <asm/lmb.h> | 17 | #include <asm/prom.h> |
17 | 18 | ||
18 | void machine_crash_shutdown(struct pt_regs *regs) | 19 | void machine_crash_shutdown(struct pt_regs *regs) |
19 | { | 20 | { |
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 9c98424277a8..a722ede726db 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -58,7 +58,6 @@ extern void program_check_exception(struct pt_regs *regs); | |||
58 | extern void single_step_exception(struct pt_regs *regs); | 58 | extern void single_step_exception(struct pt_regs *regs); |
59 | extern int sys_sigreturn(struct pt_regs *regs); | 59 | extern int sys_sigreturn(struct pt_regs *regs); |
60 | 60 | ||
61 | EXPORT_SYMBOL(empty_zero_page); | ||
62 | EXPORT_SYMBOL(clear_pages); | 61 | EXPORT_SYMBOL(clear_pages); |
63 | EXPORT_SYMBOL(copy_page); | 62 | EXPORT_SYMBOL(copy_page); |
64 | EXPORT_SYMBOL(ISA_DMA_THRESHOLD); | 63 | EXPORT_SYMBOL(ISA_DMA_THRESHOLD); |
@@ -192,3 +191,4 @@ EXPORT_SYMBOL(intercept_table); | |||
192 | EXPORT_SYMBOL(__mtdcr); | 191 | EXPORT_SYMBOL(__mtdcr); |
193 | EXPORT_SYMBOL(__mfdcr); | 192 | EXPORT_SYMBOL(__mfdcr); |
194 | #endif | 193 | #endif |
194 | EXPORT_SYMBOL(empty_zero_page); | ||
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 59311ec0d422..8d506d86e2df 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -868,11 +868,6 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, | |||
868 | flush_spe_to_thread(current); | 868 | flush_spe_to_thread(current); |
869 | error = do_execve(filename, (char __user * __user *) a1, | 869 | error = do_execve(filename, (char __user * __user *) a1, |
870 | (char __user * __user *) a2, regs); | 870 | (char __user * __user *) a2, regs); |
871 | if (error == 0) { | ||
872 | task_lock(current); | ||
873 | current->ptrace &= ~PT_DTRACE; | ||
874 | task_unlock(current); | ||
875 | } | ||
876 | putname(filename); | 871 | putname(filename); |
877 | out: | 872 | out: |
878 | return error; | 873 | return error; |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index eac97f48b9b8..9330920265f3 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -31,10 +31,10 @@ | |||
31 | #include <linux/kexec.h> | 31 | #include <linux/kexec.h> |
32 | #include <linux/debugfs.h> | 32 | #include <linux/debugfs.h> |
33 | #include <linux/irq.h> | 33 | #include <linux/irq.h> |
34 | #include <linux/lmb.h> | ||
34 | 35 | ||
35 | #include <asm/prom.h> | 36 | #include <asm/prom.h> |
36 | #include <asm/rtas.h> | 37 | #include <asm/rtas.h> |
37 | #include <asm/lmb.h> | ||
38 | #include <asm/page.h> | 38 | #include <asm/page.h> |
39 | #include <asm/processor.h> | 39 | #include <asm/processor.h> |
40 | #include <asm/irq.h> | 40 | #include <asm/irq.h> |
@@ -51,6 +51,7 @@ | |||
51 | #include <asm/machdep.h> | 51 | #include <asm/machdep.h> |
52 | #include <asm/pSeries_reconfig.h> | 52 | #include <asm/pSeries_reconfig.h> |
53 | #include <asm/pci-bridge.h> | 53 | #include <asm/pci-bridge.h> |
54 | #include <asm/phyp_dump.h> | ||
54 | #include <asm/kexec.h> | 55 | #include <asm/kexec.h> |
55 | 56 | ||
56 | #ifdef DEBUG | 57 | #ifdef DEBUG |
@@ -1040,6 +1041,56 @@ static void __init early_reserve_mem(void) | |||
1040 | #endif | 1041 | #endif |
1041 | } | 1042 | } |
1042 | 1043 | ||
1044 | #ifdef CONFIG_PHYP_DUMP | ||
1045 | /** | ||
1046 | * phyp_dump_reserve_mem() - reserve all not-yet-dumped mmemory | ||
1047 | * | ||
1048 | * This routine may reserve memory regions in the kernel only | ||
1049 | * if the system is supported and a dump was taken in last | ||
1050 | * boot instance or if the hardware is supported and the | ||
1051 | * scratch area needs to be setup. In other instances it returns | ||
1052 | * without reserving anything. The memory in case of dump being | ||
1053 | * active is freed when the dump is collected (by userland tools). | ||
1054 | */ | ||
1055 | static void __init phyp_dump_reserve_mem(void) | ||
1056 | { | ||
1057 | unsigned long base, size; | ||
1058 | if (!phyp_dump_info->phyp_dump_configured) { | ||
1059 | printk(KERN_ERR "Phyp-dump not supported on this hardware\n"); | ||
1060 | return; | ||
1061 | } | ||
1062 | |||
1063 | if (!phyp_dump_info->phyp_dump_at_boot) { | ||
1064 | printk(KERN_INFO "Phyp-dump disabled at boot time\n"); | ||
1065 | return; | ||
1066 | } | ||
1067 | |||
1068 | if (phyp_dump_info->phyp_dump_is_active) { | ||
1069 | /* Reserve *everything* above RMR.Area freed by userland tools*/ | ||
1070 | base = PHYP_DUMP_RMR_END; | ||
1071 | size = lmb_end_of_DRAM() - base; | ||
1072 | |||
1073 | /* XXX crashed_ram_end is wrong, since it may be beyond | ||
1074 | * the memory_limit, it will need to be adjusted. */ | ||
1075 | lmb_reserve(base, size); | ||
1076 | |||
1077 | phyp_dump_info->init_reserve_start = base; | ||
1078 | phyp_dump_info->init_reserve_size = size; | ||
1079 | } else { | ||
1080 | size = phyp_dump_info->cpu_state_size + | ||
1081 | phyp_dump_info->hpte_region_size + | ||
1082 | PHYP_DUMP_RMR_END; | ||
1083 | base = lmb_end_of_DRAM() - size; | ||
1084 | lmb_reserve(base, size); | ||
1085 | phyp_dump_info->init_reserve_start = base; | ||
1086 | phyp_dump_info->init_reserve_size = size; | ||
1087 | } | ||
1088 | } | ||
1089 | #else | ||
1090 | static inline void __init phyp_dump_reserve_mem(void) {} | ||
1091 | #endif /* CONFIG_PHYP_DUMP && CONFIG_PPC_RTAS */ | ||
1092 | |||
1093 | |||
1043 | void __init early_init_devtree(void *params) | 1094 | void __init early_init_devtree(void *params) |
1044 | { | 1095 | { |
1045 | DBG(" -> early_init_devtree(%p)\n", params); | 1096 | DBG(" -> early_init_devtree(%p)\n", params); |
@@ -1052,6 +1103,11 @@ void __init early_init_devtree(void *params) | |||
1052 | of_scan_flat_dt(early_init_dt_scan_rtas, NULL); | 1103 | of_scan_flat_dt(early_init_dt_scan_rtas, NULL); |
1053 | #endif | 1104 | #endif |
1054 | 1105 | ||
1106 | #ifdef CONFIG_PHYP_DUMP | ||
1107 | /* scan tree to see if dump occured during last boot */ | ||
1108 | of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL); | ||
1109 | #endif | ||
1110 | |||
1055 | /* Retrieve various informations from the /chosen node of the | 1111 | /* Retrieve various informations from the /chosen node of the |
1056 | * device-tree, including the platform type, initrd location and | 1112 | * device-tree, including the platform type, initrd location and |
1057 | * size, TCE reserve, and more ... | 1113 | * size, TCE reserve, and more ... |
@@ -1072,6 +1128,7 @@ void __init early_init_devtree(void *params) | |||
1072 | reserve_kdump_trampoline(); | 1128 | reserve_kdump_trampoline(); |
1073 | reserve_crashkernel(); | 1129 | reserve_crashkernel(); |
1074 | early_reserve_mem(); | 1130 | early_reserve_mem(); |
1131 | phyp_dump_reserve_mem(); | ||
1075 | 1132 | ||
1076 | lmb_enforce_memory_limit(memory_limit); | 1133 | lmb_enforce_memory_limit(memory_limit); |
1077 | lmb_analyze(); | 1134 | lmb_analyze(); |
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 52e95c2158c0..e2e78d967f31 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/smp.h> | 22 | #include <linux/smp.h> |
23 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
24 | #include <linux/cpumask.h> | 24 | #include <linux/cpumask.h> |
25 | #include <linux/lmb.h> | ||
25 | 26 | ||
26 | #include <asm/prom.h> | 27 | #include <asm/prom.h> |
27 | #include <asm/rtas.h> | 28 | #include <asm/rtas.h> |
@@ -34,7 +35,6 @@ | |||
34 | #include <asm/system.h> | 35 | #include <asm/system.h> |
35 | #include <asm/delay.h> | 36 | #include <asm/delay.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | #include <asm/lmb.h> | ||
38 | #include <asm/udbg.h> | 38 | #include <asm/udbg.h> |
39 | #include <asm/syscalls.h> | 39 | #include <asm/syscalls.h> |
40 | #include <asm/smp.h> | 40 | #include <asm/smp.h> |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 6adb5a1e98bb..db540eab09f4 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/serial_8250.h> | 34 | #include <linux/serial_8250.h> |
35 | #include <linux/debugfs.h> | 35 | #include <linux/debugfs.h> |
36 | #include <linux/percpu.h> | 36 | #include <linux/percpu.h> |
37 | #include <linux/lmb.h> | ||
37 | #include <asm/io.h> | 38 | #include <asm/io.h> |
38 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
39 | #include <asm/processor.h> | 40 | #include <asm/processor.h> |
@@ -56,7 +57,6 @@ | |||
56 | #include <asm/cache.h> | 57 | #include <asm/cache.h> |
57 | #include <asm/page.h> | 58 | #include <asm/page.h> |
58 | #include <asm/mmu.h> | 59 | #include <asm/mmu.h> |
59 | #include <asm/lmb.h> | ||
60 | #include <asm/xmon.h> | 60 | #include <asm/xmon.h> |
61 | #include <asm/cputhreads.h> | 61 | #include <asm/cputhreads.h> |
62 | 62 | ||
@@ -167,6 +167,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
167 | unsigned short min; | 167 | unsigned short min; |
168 | 168 | ||
169 | if (cpu_id == NR_CPUS) { | 169 | if (cpu_id == NR_CPUS) { |
170 | struct device_node *root; | ||
171 | const char *model = NULL; | ||
170 | #if defined(CONFIG_SMP) && defined(CONFIG_PPC32) | 172 | #if defined(CONFIG_SMP) && defined(CONFIG_PPC32) |
171 | unsigned long bogosum = 0; | 173 | unsigned long bogosum = 0; |
172 | int i; | 174 | int i; |
@@ -178,6 +180,13 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
178 | seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq); | 180 | seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq); |
179 | if (ppc_md.name) | 181 | if (ppc_md.name) |
180 | seq_printf(m, "platform\t: %s\n", ppc_md.name); | 182 | seq_printf(m, "platform\t: %s\n", ppc_md.name); |
183 | root = of_find_node_by_path("/"); | ||
184 | if (root) | ||
185 | model = of_get_property(root, "model", NULL); | ||
186 | if (model) | ||
187 | seq_printf(m, "model\t\t: %s\n", model); | ||
188 | of_node_put(root); | ||
189 | |||
181 | if (ppc_md.show_cpuinfo != NULL) | 190 | if (ppc_md.show_cpuinfo != NULL) |
182 | ppc_md.show_cpuinfo(m); | 191 | ppc_md.show_cpuinfo(m); |
183 | 192 | ||
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 3b1529c103ef..2c2d8315193c 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/serial_8250.h> | 33 | #include <linux/serial_8250.h> |
34 | #include <linux/bootmem.h> | 34 | #include <linux/bootmem.h> |
35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
36 | #include <linux/lmb.h> | ||
36 | #include <asm/io.h> | 37 | #include <asm/io.h> |
37 | #include <asm/kdump.h> | 38 | #include <asm/kdump.h> |
38 | #include <asm/prom.h> | 39 | #include <asm/prom.h> |
@@ -55,7 +56,6 @@ | |||
55 | #include <asm/cache.h> | 56 | #include <asm/cache.h> |
56 | #include <asm/page.h> | 57 | #include <asm/page.h> |
57 | #include <asm/mmu.h> | 58 | #include <asm/mmu.h> |
58 | #include <asm/lmb.h> | ||
59 | #include <asm/firmware.h> | 59 | #include <asm/firmware.h> |
60 | #include <asm/xmon.h> | 60 | #include <asm/xmon.h> |
61 | #include <asm/udbg.h> | 61 | #include <asm/udbg.h> |
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index 4a4f5c6b560b..9c3371e6958e 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c | |||
@@ -368,11 +368,6 @@ long compat_sys_execve(unsigned long a0, unsigned long a1, unsigned long a2, | |||
368 | 368 | ||
369 | error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs); | 369 | error = compat_do_execve(filename, compat_ptr(a1), compat_ptr(a2), regs); |
370 | 370 | ||
371 | if (error == 0) { | ||
372 | task_lock(current); | ||
373 | current->ptrace &= ~PT_DTRACE; | ||
374 | task_unlock(current); | ||
375 | } | ||
376 | putname(filename); | 371 | putname(filename); |
377 | 372 | ||
378 | out: | 373 | out: |
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c index d3437c4c4a6f..c21a626af676 100644 --- a/arch/powerpc/kernel/vdso.c +++ b/arch/powerpc/kernel/vdso.c | |||
@@ -21,13 +21,14 @@ | |||
21 | #include <linux/elf.h> | 21 | #include <linux/elf.h> |
22 | #include <linux/security.h> | 22 | #include <linux/security.h> |
23 | #include <linux/bootmem.h> | 23 | #include <linux/bootmem.h> |
24 | #include <linux/lmb.h> | ||
24 | 25 | ||
25 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
26 | #include <asm/system.h> | 27 | #include <asm/system.h> |
27 | #include <asm/processor.h> | 28 | #include <asm/processor.h> |
28 | #include <asm/mmu.h> | 29 | #include <asm/mmu.h> |
29 | #include <asm/mmu_context.h> | 30 | #include <asm/mmu_context.h> |
30 | #include <asm/lmb.h> | 31 | #include <asm/prom.h> |
31 | #include <asm/machdep.h> | 32 | #include <asm/machdep.h> |
32 | #include <asm/cputable.h> | 33 | #include <asm/cputable.h> |
33 | #include <asm/sections.h> | 34 | #include <asm/sections.h> |
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index 41649a5d3602..1c00e0196f6c 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile | |||
@@ -6,7 +6,7 @@ ifeq ($(CONFIG_PPC64),y) | |||
6 | EXTRA_CFLAGS += -mno-minimal-toc | 6 | EXTRA_CFLAGS += -mno-minimal-toc |
7 | endif | 7 | endif |
8 | 8 | ||
9 | obj-y := fault.o mem.o lmb.o \ | 9 | obj-y := fault.o mem.o \ |
10 | init_$(CONFIG_WORD_SIZE).o \ | 10 | init_$(CONFIG_WORD_SIZE).o \ |
11 | pgtable_$(CONFIG_WORD_SIZE).o \ | 11 | pgtable_$(CONFIG_WORD_SIZE).o \ |
12 | mmu_context_$(CONFIG_WORD_SIZE).o | 12 | mmu_context_$(CONFIG_WORD_SIZE).o |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index a83dfa3cf40c..c2e5f61788b0 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/cache.h> | 31 | #include <linux/cache.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/signal.h> | 33 | #include <linux/signal.h> |
34 | #include <linux/lmb.h> | ||
34 | 35 | ||
35 | #include <asm/processor.h> | 36 | #include <asm/processor.h> |
36 | #include <asm/pgtable.h> | 37 | #include <asm/pgtable.h> |
@@ -41,7 +42,7 @@ | |||
41 | #include <asm/system.h> | 42 | #include <asm/system.h> |
42 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
43 | #include <asm/machdep.h> | 44 | #include <asm/machdep.h> |
44 | #include <asm/lmb.h> | 45 | #include <asm/prom.h> |
45 | #include <asm/abs_addr.h> | 46 | #include <asm/abs_addr.h> |
46 | #include <asm/tlbflush.h> | 47 | #include <asm/tlbflush.h> |
47 | #include <asm/io.h> | 48 | #include <asm/io.h> |
@@ -191,6 +192,24 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend, | |||
191 | return ret < 0 ? ret : 0; | 192 | return ret < 0 ? ret : 0; |
192 | } | 193 | } |
193 | 194 | ||
195 | static void htab_remove_mapping(unsigned long vstart, unsigned long vend, | ||
196 | int psize, int ssize) | ||
197 | { | ||
198 | unsigned long vaddr; | ||
199 | unsigned int step, shift; | ||
200 | |||
201 | shift = mmu_psize_defs[psize].shift; | ||
202 | step = 1 << shift; | ||
203 | |||
204 | if (!ppc_md.hpte_removebolted) { | ||
205 | printk("Sub-arch doesn't implement hpte_removebolted\n"); | ||
206 | return; | ||
207 | } | ||
208 | |||
209 | for (vaddr = vstart; vaddr < vend; vaddr += step) | ||
210 | ppc_md.hpte_removebolted(vaddr, psize, ssize); | ||
211 | } | ||
212 | |||
194 | static int __init htab_dt_scan_seg_sizes(unsigned long node, | 213 | static int __init htab_dt_scan_seg_sizes(unsigned long node, |
195 | const char *uname, int depth, | 214 | const char *uname, int depth, |
196 | void *data) | 215 | void *data) |
@@ -434,6 +453,11 @@ void create_section_mapping(unsigned long start, unsigned long end) | |||
434 | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX, | 453 | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX, |
435 | mmu_linear_psize, mmu_kernel_ssize)); | 454 | mmu_linear_psize, mmu_kernel_ssize)); |
436 | } | 455 | } |
456 | |||
457 | void remove_section_mapping(unsigned long start, unsigned long end) | ||
458 | { | ||
459 | htab_remove_mapping(start, end, mmu_linear_psize, mmu_kernel_ssize); | ||
460 | } | ||
437 | #endif /* CONFIG_MEMORY_HOTPLUG */ | 461 | #endif /* CONFIG_MEMORY_HOTPLUG */ |
438 | 462 | ||
439 | static inline void make_bl(unsigned int *insn_addr, void *func) | 463 | static inline void make_bl(unsigned int *insn_addr, void *func) |
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index 977cb1ee5e72..59a725b8ece9 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/highmem.h> | 30 | #include <linux/highmem.h> |
31 | #include <linux/initrd.h> | 31 | #include <linux/initrd.h> |
32 | #include <linux/pagemap.h> | 32 | #include <linux/pagemap.h> |
33 | #include <linux/lmb.h> | ||
33 | 34 | ||
34 | #include <asm/pgalloc.h> | 35 | #include <asm/pgalloc.h> |
35 | #include <asm/prom.h> | 36 | #include <asm/prom.h> |
@@ -41,7 +42,6 @@ | |||
41 | #include <asm/machdep.h> | 42 | #include <asm/machdep.h> |
42 | #include <asm/btext.h> | 43 | #include <asm/btext.h> |
43 | #include <asm/tlb.h> | 44 | #include <asm/tlb.h> |
44 | #include <asm/lmb.h> | ||
45 | #include <asm/sections.h> | 45 | #include <asm/sections.h> |
46 | 46 | ||
47 | #include "mmu_decl.h" | 47 | #include "mmu_decl.h" |
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index c0f5cff77035..abeb0eb79313 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -38,11 +38,11 @@ | |||
38 | #include <linux/nodemask.h> | 38 | #include <linux/nodemask.h> |
39 | #include <linux/module.h> | 39 | #include <linux/module.h> |
40 | #include <linux/poison.h> | 40 | #include <linux/poison.h> |
41 | #include <linux/lmb.h> | ||
41 | 42 | ||
42 | #include <asm/pgalloc.h> | 43 | #include <asm/pgalloc.h> |
43 | #include <asm/page.h> | 44 | #include <asm/page.h> |
44 | #include <asm/prom.h> | 45 | #include <asm/prom.h> |
45 | #include <asm/lmb.h> | ||
46 | #include <asm/rtas.h> | 46 | #include <asm/rtas.h> |
47 | #include <asm/io.h> | 47 | #include <asm/io.h> |
48 | #include <asm/mmu_context.h> | 48 | #include <asm/mmu_context.h> |
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c deleted file mode 100644 index 4ce23bcf8a57..000000000000 --- a/arch/powerpc/mm/lmb.c +++ /dev/null | |||
@@ -1,357 +0,0 @@ | |||
1 | /* | ||
2 | * Procedures for maintaining information about logical memory blocks. | ||
3 | * | ||
4 | * Peter Bergner, IBM Corp. June 2001. | ||
5 | * Copyright (C) 2001 Peter Bergner. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/bitops.h> | ||
16 | #include <asm/types.h> | ||
17 | #include <asm/page.h> | ||
18 | #include <asm/prom.h> | ||
19 | #include <asm/lmb.h> | ||
20 | #ifdef CONFIG_PPC32 | ||
21 | #include "mmu_decl.h" /* for __max_low_memory */ | ||
22 | #endif | ||
23 | |||
24 | #undef DEBUG | ||
25 | |||
26 | #ifdef DEBUG | ||
27 | #include <asm/udbg.h> | ||
28 | #define DBG(fmt...) udbg_printf(fmt) | ||
29 | #else | ||
30 | #define DBG(fmt...) | ||
31 | #endif | ||
32 | |||
33 | #define LMB_ALLOC_ANYWHERE 0 | ||
34 | |||
35 | struct lmb lmb; | ||
36 | |||
37 | void lmb_dump_all(void) | ||
38 | { | ||
39 | #ifdef DEBUG | ||
40 | unsigned long i; | ||
41 | |||
42 | DBG("lmb_dump_all:\n"); | ||
43 | DBG(" memory.cnt = 0x%lx\n", lmb.memory.cnt); | ||
44 | DBG(" memory.size = 0x%lx\n", lmb.memory.size); | ||
45 | for (i=0; i < lmb.memory.cnt ;i++) { | ||
46 | DBG(" memory.region[0x%x].base = 0x%lx\n", | ||
47 | i, lmb.memory.region[i].base); | ||
48 | DBG(" .size = 0x%lx\n", | ||
49 | lmb.memory.region[i].size); | ||
50 | } | ||
51 | |||
52 | DBG("\n reserved.cnt = 0x%lx\n", lmb.reserved.cnt); | ||
53 | DBG(" reserved.size = 0x%lx\n", lmb.reserved.size); | ||
54 | for (i=0; i < lmb.reserved.cnt ;i++) { | ||
55 | DBG(" reserved.region[0x%x].base = 0x%lx\n", | ||
56 | i, lmb.reserved.region[i].base); | ||
57 | DBG(" .size = 0x%lx\n", | ||
58 | lmb.reserved.region[i].size); | ||
59 | } | ||
60 | #endif /* DEBUG */ | ||
61 | } | ||
62 | |||
63 | static unsigned long __init lmb_addrs_overlap(unsigned long base1, | ||
64 | unsigned long size1, unsigned long base2, unsigned long size2) | ||
65 | { | ||
66 | return ((base1 < (base2+size2)) && (base2 < (base1+size1))); | ||
67 | } | ||
68 | |||
69 | static long __init lmb_addrs_adjacent(unsigned long base1, unsigned long size1, | ||
70 | unsigned long base2, unsigned long size2) | ||
71 | { | ||
72 | if (base2 == base1 + size1) | ||
73 | return 1; | ||
74 | else if (base1 == base2 + size2) | ||
75 | return -1; | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static long __init lmb_regions_adjacent(struct lmb_region *rgn, | ||
81 | unsigned long r1, unsigned long r2) | ||
82 | { | ||
83 | unsigned long base1 = rgn->region[r1].base; | ||
84 | unsigned long size1 = rgn->region[r1].size; | ||
85 | unsigned long base2 = rgn->region[r2].base; | ||
86 | unsigned long size2 = rgn->region[r2].size; | ||
87 | |||
88 | return lmb_addrs_adjacent(base1, size1, base2, size2); | ||
89 | } | ||
90 | |||
91 | static void __init lmb_remove_region(struct lmb_region *rgn, unsigned long r) | ||
92 | { | ||
93 | unsigned long i; | ||
94 | |||
95 | for (i = r; i < rgn->cnt - 1; i++) { | ||
96 | rgn->region[i].base = rgn->region[i + 1].base; | ||
97 | rgn->region[i].size = rgn->region[i + 1].size; | ||
98 | } | ||
99 | rgn->cnt--; | ||
100 | } | ||
101 | |||
102 | /* Assumption: base addr of region 1 < base addr of region 2 */ | ||
103 | static void __init lmb_coalesce_regions(struct lmb_region *rgn, | ||
104 | unsigned long r1, unsigned long r2) | ||
105 | { | ||
106 | rgn->region[r1].size += rgn->region[r2].size; | ||
107 | lmb_remove_region(rgn, r2); | ||
108 | } | ||
109 | |||
110 | /* This routine called with relocation disabled. */ | ||
111 | void __init lmb_init(void) | ||
112 | { | ||
113 | /* Create a dummy zero size LMB which will get coalesced away later. | ||
114 | * This simplifies the lmb_add() code below... | ||
115 | */ | ||
116 | lmb.memory.region[0].base = 0; | ||
117 | lmb.memory.region[0].size = 0; | ||
118 | lmb.memory.cnt = 1; | ||
119 | |||
120 | /* Ditto. */ | ||
121 | lmb.reserved.region[0].base = 0; | ||
122 | lmb.reserved.region[0].size = 0; | ||
123 | lmb.reserved.cnt = 1; | ||
124 | } | ||
125 | |||
126 | /* This routine may be called with relocation disabled. */ | ||
127 | void __init lmb_analyze(void) | ||
128 | { | ||
129 | int i; | ||
130 | |||
131 | lmb.memory.size = 0; | ||
132 | |||
133 | for (i = 0; i < lmb.memory.cnt; i++) | ||
134 | lmb.memory.size += lmb.memory.region[i].size; | ||
135 | } | ||
136 | |||
137 | /* This routine called with relocation disabled. */ | ||
138 | static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base, | ||
139 | unsigned long size) | ||
140 | { | ||
141 | unsigned long coalesced = 0; | ||
142 | long adjacent, i; | ||
143 | |||
144 | /* First try and coalesce this LMB with another. */ | ||
145 | for (i=0; i < rgn->cnt; i++) { | ||
146 | unsigned long rgnbase = rgn->region[i].base; | ||
147 | unsigned long rgnsize = rgn->region[i].size; | ||
148 | |||
149 | if ((rgnbase == base) && (rgnsize == size)) | ||
150 | /* Already have this region, so we're done */ | ||
151 | return 0; | ||
152 | |||
153 | adjacent = lmb_addrs_adjacent(base,size,rgnbase,rgnsize); | ||
154 | if ( adjacent > 0 ) { | ||
155 | rgn->region[i].base -= size; | ||
156 | rgn->region[i].size += size; | ||
157 | coalesced++; | ||
158 | break; | ||
159 | } | ||
160 | else if ( adjacent < 0 ) { | ||
161 | rgn->region[i].size += size; | ||
162 | coalesced++; | ||
163 | break; | ||
164 | } | ||
165 | } | ||
166 | |||
167 | if ((i < rgn->cnt-1) && lmb_regions_adjacent(rgn, i, i+1) ) { | ||
168 | lmb_coalesce_regions(rgn, i, i+1); | ||
169 | coalesced++; | ||
170 | } | ||
171 | |||
172 | if (coalesced) | ||
173 | return coalesced; | ||
174 | if (rgn->cnt >= MAX_LMB_REGIONS) | ||
175 | return -1; | ||
176 | |||
177 | /* Couldn't coalesce the LMB, so add it to the sorted table. */ | ||
178 | for (i = rgn->cnt-1; i >= 0; i--) { | ||
179 | if (base < rgn->region[i].base) { | ||
180 | rgn->region[i+1].base = rgn->region[i].base; | ||
181 | rgn->region[i+1].size = rgn->region[i].size; | ||
182 | } else { | ||
183 | rgn->region[i+1].base = base; | ||
184 | rgn->region[i+1].size = size; | ||
185 | break; | ||
186 | } | ||
187 | } | ||
188 | rgn->cnt++; | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | /* This routine may be called with relocation disabled. */ | ||
194 | long __init lmb_add(unsigned long base, unsigned long size) | ||
195 | { | ||
196 | struct lmb_region *_rgn = &(lmb.memory); | ||
197 | |||
198 | /* On pSeries LPAR systems, the first LMB is our RMO region. */ | ||
199 | if (base == 0) | ||
200 | lmb.rmo_size = size; | ||
201 | |||
202 | return lmb_add_region(_rgn, base, size); | ||
203 | |||
204 | } | ||
205 | |||
206 | long __init lmb_reserve(unsigned long base, unsigned long size) | ||
207 | { | ||
208 | struct lmb_region *_rgn = &(lmb.reserved); | ||
209 | |||
210 | BUG_ON(0 == size); | ||
211 | |||
212 | return lmb_add_region(_rgn, base, size); | ||
213 | } | ||
214 | |||
215 | long __init lmb_overlaps_region(struct lmb_region *rgn, unsigned long base, | ||
216 | unsigned long size) | ||
217 | { | ||
218 | unsigned long i; | ||
219 | |||
220 | for (i=0; i < rgn->cnt; i++) { | ||
221 | unsigned long rgnbase = rgn->region[i].base; | ||
222 | unsigned long rgnsize = rgn->region[i].size; | ||
223 | if ( lmb_addrs_overlap(base,size,rgnbase,rgnsize) ) { | ||
224 | break; | ||
225 | } | ||
226 | } | ||
227 | |||
228 | return (i < rgn->cnt) ? i : -1; | ||
229 | } | ||
230 | |||
231 | unsigned long __init lmb_alloc(unsigned long size, unsigned long align) | ||
232 | { | ||
233 | return lmb_alloc_base(size, align, LMB_ALLOC_ANYWHERE); | ||
234 | } | ||
235 | |||
236 | unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align, | ||
237 | unsigned long max_addr) | ||
238 | { | ||
239 | unsigned long alloc; | ||
240 | |||
241 | alloc = __lmb_alloc_base(size, align, max_addr); | ||
242 | |||
243 | if (alloc == 0) | ||
244 | panic("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n", | ||
245 | size, max_addr); | ||
246 | |||
247 | return alloc; | ||
248 | } | ||
249 | |||
250 | unsigned long __init __lmb_alloc_base(unsigned long size, unsigned long align, | ||
251 | unsigned long max_addr) | ||
252 | { | ||
253 | long i, j; | ||
254 | unsigned long base = 0; | ||
255 | |||
256 | BUG_ON(0 == size); | ||
257 | |||
258 | #ifdef CONFIG_PPC32 | ||
259 | /* On 32-bit, make sure we allocate lowmem */ | ||
260 | if (max_addr == LMB_ALLOC_ANYWHERE) | ||
261 | max_addr = __max_low_memory; | ||
262 | #endif | ||
263 | for (i = lmb.memory.cnt-1; i >= 0; i--) { | ||
264 | unsigned long lmbbase = lmb.memory.region[i].base; | ||
265 | unsigned long lmbsize = lmb.memory.region[i].size; | ||
266 | |||
267 | if (max_addr == LMB_ALLOC_ANYWHERE) | ||
268 | base = _ALIGN_DOWN(lmbbase + lmbsize - size, align); | ||
269 | else if (lmbbase < max_addr) { | ||
270 | base = min(lmbbase + lmbsize, max_addr); | ||
271 | base = _ALIGN_DOWN(base - size, align); | ||
272 | } else | ||
273 | continue; | ||
274 | |||
275 | while ((lmbbase <= base) && | ||
276 | ((j = lmb_overlaps_region(&lmb.reserved, base, size)) >= 0) ) | ||
277 | base = _ALIGN_DOWN(lmb.reserved.region[j].base - size, | ||
278 | align); | ||
279 | |||
280 | if ((base != 0) && (lmbbase <= base)) | ||
281 | break; | ||
282 | } | ||
283 | |||
284 | if (i < 0) | ||
285 | return 0; | ||
286 | |||
287 | lmb_add_region(&lmb.reserved, base, size); | ||
288 | |||
289 | return base; | ||
290 | } | ||
291 | |||
292 | /* You must call lmb_analyze() before this. */ | ||
293 | unsigned long __init lmb_phys_mem_size(void) | ||
294 | { | ||
295 | return lmb.memory.size; | ||
296 | } | ||
297 | |||
298 | unsigned long __init lmb_end_of_DRAM(void) | ||
299 | { | ||
300 | int idx = lmb.memory.cnt - 1; | ||
301 | |||
302 | return (lmb.memory.region[idx].base + lmb.memory.region[idx].size); | ||
303 | } | ||
304 | |||
305 | /* You must call lmb_analyze() after this. */ | ||
306 | void __init lmb_enforce_memory_limit(unsigned long memory_limit) | ||
307 | { | ||
308 | unsigned long i, limit; | ||
309 | struct lmb_property *p; | ||
310 | |||
311 | if (! memory_limit) | ||
312 | return; | ||
313 | |||
314 | /* Truncate the lmb regions to satisfy the memory limit. */ | ||
315 | limit = memory_limit; | ||
316 | for (i = 0; i < lmb.memory.cnt; i++) { | ||
317 | if (limit > lmb.memory.region[i].size) { | ||
318 | limit -= lmb.memory.region[i].size; | ||
319 | continue; | ||
320 | } | ||
321 | |||
322 | lmb.memory.region[i].size = limit; | ||
323 | lmb.memory.cnt = i + 1; | ||
324 | break; | ||
325 | } | ||
326 | |||
327 | if (lmb.memory.region[0].size < lmb.rmo_size) | ||
328 | lmb.rmo_size = lmb.memory.region[0].size; | ||
329 | |||
330 | /* And truncate any reserves above the limit also. */ | ||
331 | for (i = 0; i < lmb.reserved.cnt; i++) { | ||
332 | p = &lmb.reserved.region[i]; | ||
333 | |||
334 | if (p->base > memory_limit) | ||
335 | p->size = 0; | ||
336 | else if ((p->base + p->size) > memory_limit) | ||
337 | p->size = memory_limit - p->base; | ||
338 | |||
339 | if (p->size == 0) { | ||
340 | lmb_remove_region(&lmb.reserved, i); | ||
341 | i--; | ||
342 | } | ||
343 | } | ||
344 | } | ||
345 | |||
346 | int __init lmb_is_reserved(unsigned long addr) | ||
347 | { | ||
348 | int i; | ||
349 | |||
350 | for (i = 0; i < lmb.reserved.cnt; i++) { | ||
351 | unsigned long upper = lmb.reserved.region[i].base + | ||
352 | lmb.reserved.region[i].size - 1; | ||
353 | if ((addr >= lmb.reserved.region[i].base) && (addr <= upper)) | ||
354 | return 1; | ||
355 | } | ||
356 | return 0; | ||
357 | } | ||
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index be5c506779a7..60c019cdc69f 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/initrd.h> | 31 | #include <linux/initrd.h> |
32 | #include <linux/pagemap.h> | 32 | #include <linux/pagemap.h> |
33 | #include <linux/suspend.h> | 33 | #include <linux/suspend.h> |
34 | #include <linux/lmb.h> | ||
34 | 35 | ||
35 | #include <asm/pgalloc.h> | 36 | #include <asm/pgalloc.h> |
36 | #include <asm/prom.h> | 37 | #include <asm/prom.h> |
@@ -42,7 +43,6 @@ | |||
42 | #include <asm/machdep.h> | 43 | #include <asm/machdep.h> |
43 | #include <asm/btext.h> | 44 | #include <asm/btext.h> |
44 | #include <asm/tlb.h> | 45 | #include <asm/tlb.h> |
45 | #include <asm/lmb.h> | ||
46 | #include <asm/sections.h> | 46 | #include <asm/sections.h> |
47 | #include <asm/vdso.h> | 47 | #include <asm/vdso.h> |
48 | 48 | ||
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index a300d254aac6..1efd631211ef 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -17,8 +17,9 @@ | |||
17 | #include <linux/nodemask.h> | 17 | #include <linux/nodemask.h> |
18 | #include <linux/cpu.h> | 18 | #include <linux/cpu.h> |
19 | #include <linux/notifier.h> | 19 | #include <linux/notifier.h> |
20 | #include <linux/lmb.h> | ||
20 | #include <asm/sparsemem.h> | 21 | #include <asm/sparsemem.h> |
21 | #include <asm/lmb.h> | 22 | #include <asm/prom.h> |
22 | #include <asm/system.h> | 23 | #include <asm/system.h> |
23 | #include <asm/smp.h> | 24 | #include <asm/smp.h> |
24 | 25 | ||
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c index 5c45d474cfcc..72de3c79210a 100644 --- a/arch/powerpc/mm/ppc_mmu_32.c +++ b/arch/powerpc/mm/ppc_mmu_32.c | |||
@@ -26,11 +26,11 @@ | |||
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
29 | #include <linux/lmb.h> | ||
29 | 30 | ||
30 | #include <asm/prom.h> | 31 | #include <asm/prom.h> |
31 | #include <asm/mmu.h> | 32 | #include <asm/mmu.h> |
32 | #include <asm/machdep.h> | 33 | #include <asm/machdep.h> |
33 | #include <asm/lmb.h> | ||
34 | 34 | ||
35 | #include "mmu_decl.h" | 35 | #include "mmu_decl.h" |
36 | 36 | ||
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c index 50448d5de9d2..efbbd13d93e5 100644 --- a/arch/powerpc/mm/stab.c +++ b/arch/powerpc/mm/stab.c | |||
@@ -12,12 +12,14 @@ | |||
12 | * 2 of the License, or (at your option) any later version. | 12 | * 2 of the License, or (at your option) any later version. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/lmb.h> | ||
16 | |||
15 | #include <asm/pgtable.h> | 17 | #include <asm/pgtable.h> |
16 | #include <asm/mmu.h> | 18 | #include <asm/mmu.h> |
17 | #include <asm/mmu_context.h> | 19 | #include <asm/mmu_context.h> |
18 | #include <asm/paca.h> | 20 | #include <asm/paca.h> |
19 | #include <asm/cputable.h> | 21 | #include <asm/cputable.h> |
20 | #include <asm/lmb.h> | 22 | #include <asm/prom.h> |
21 | #include <asm/abs_addr.h> | 23 | #include <asm/abs_addr.h> |
22 | #include <asm/firmware.h> | 24 | #include <asm/firmware.h> |
23 | #include <asm/iseries/hv_call.h> | 25 | #include <asm/iseries/hv_call.h> |
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 184f998d1be2..0d9f75c74f8c 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c | |||
@@ -111,17 +111,12 @@ void __init mpc8xx_calibrate_decr(void) | |||
111 | 111 | ||
112 | /* Processor frequency is MHz. | 112 | /* Processor frequency is MHz. |
113 | */ | 113 | */ |
114 | ppc_tb_freq = 50000000; | ||
115 | if (!get_freq("bus-frequency", &ppc_tb_freq)) { | ||
116 | printk(KERN_ERR "WARNING: Estimating decrementer frequency " | ||
117 | "(not found)\n"); | ||
118 | } | ||
119 | ppc_tb_freq /= 16; | ||
120 | ppc_proc_freq = 50000000; | 114 | ppc_proc_freq = 50000000; |
121 | if (!get_freq("clock-frequency", &ppc_proc_freq)) | 115 | if (!get_freq("clock-frequency", &ppc_proc_freq)) |
122 | printk(KERN_ERR "WARNING: Estimating processor frequency " | 116 | printk(KERN_ERR "WARNING: Estimating processor frequency " |
123 | "(not found)\n"); | 117 | "(not found)\n"); |
124 | 118 | ||
119 | ppc_tb_freq = ppc_proc_freq / 16; | ||
125 | printk("Decrementer Frequency = 0x%lx\n", ppc_tb_freq); | 120 | printk("Decrementer Frequency = 0x%lx\n", ppc_tb_freq); |
126 | 121 | ||
127 | /* Perform some more timer/timebase initialization. This used | 122 | /* Perform some more timer/timebase initialization. This used |
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index d75ccded7f10..49fe641d4345 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -28,13 +28,13 @@ | |||
28 | #include <linux/notifier.h> | 28 | #include <linux/notifier.h> |
29 | #include <linux/of.h> | 29 | #include <linux/of.h> |
30 | #include <linux/of_platform.h> | 30 | #include <linux/of_platform.h> |
31 | #include <linux/lmb.h> | ||
31 | 32 | ||
32 | #include <asm/prom.h> | 33 | #include <asm/prom.h> |
33 | #include <asm/iommu.h> | 34 | #include <asm/iommu.h> |
34 | #include <asm/machdep.h> | 35 | #include <asm/machdep.h> |
35 | #include <asm/pci-bridge.h> | 36 | #include <asm/pci-bridge.h> |
36 | #include <asm/udbg.h> | 37 | #include <asm/udbg.h> |
37 | #include <asm/lmb.h> | ||
38 | #include <asm/firmware.h> | 38 | #include <asm/firmware.h> |
39 | #include <asm/cell-regs.h> | 39 | #include <asm/cell-regs.h> |
40 | 40 | ||
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c index cc562e4c2f32..02a634faedbe 100644 --- a/arch/powerpc/platforms/iseries/pci.c +++ b/arch/powerpc/platforms/iseries/pci.c | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #undef DEBUG | 24 | #undef DEBUG |
25 | 25 | ||
26 | #include <linux/jiffies.h> | ||
26 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
27 | #include <linux/list.h> | 28 | #include <linux/list.h> |
28 | #include <linux/string.h> | 29 | #include <linux/string.h> |
@@ -586,7 +587,7 @@ static inline struct device_node *xlate_iomm_address( | |||
586 | static unsigned long last_jiffies; | 587 | static unsigned long last_jiffies; |
587 | static int num_printed; | 588 | static int num_printed; |
588 | 589 | ||
589 | if ((jiffies - last_jiffies) > 60 * HZ) { | 590 | if (time_after(jiffies, last_jiffies + 60 * HZ)) { |
590 | last_jiffies = jiffies; | 591 | last_jiffies = jiffies; |
591 | num_printed = 0; | 592 | num_printed = 0; |
592 | } | 593 | } |
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c index 3ffa0ac170ee..301855263b81 100644 --- a/arch/powerpc/platforms/maple/pci.c +++ b/arch/powerpc/platforms/maple/pci.c | |||
@@ -592,50 +592,3 @@ int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel) | |||
592 | } | 592 | } |
593 | return irq; | 593 | return irq; |
594 | } | 594 | } |
595 | |||
596 | /* XXX: To remove once all firmwares are ok */ | ||
597 | static void fixup_maple_ide(struct pci_dev* dev) | ||
598 | { | ||
599 | if (!machine_is(maple)) | ||
600 | return; | ||
601 | |||
602 | #if 0 /* Enable this to enable IDE port 0 */ | ||
603 | { | ||
604 | u8 v; | ||
605 | |||
606 | pci_read_config_byte(dev, 0x40, &v); | ||
607 | v |= 2; | ||
608 | pci_write_config_byte(dev, 0x40, v); | ||
609 | } | ||
610 | #endif | ||
611 | #if 0 /* fix bus master base */ | ||
612 | pci_write_config_dword(dev, 0x20, 0xcc01); | ||
613 | printk("old ide resource: %lx -> %lx \n", | ||
614 | dev->resource[4].start, dev->resource[4].end); | ||
615 | dev->resource[4].start = 0xcc00; | ||
616 | dev->resource[4].end = 0xcc10; | ||
617 | #endif | ||
618 | #if 0 /* Enable this to fixup IDE sense/polarity of irqs in IO-APICs */ | ||
619 | { | ||
620 | struct pci_dev *apicdev; | ||
621 | u32 v; | ||
622 | |||
623 | apicdev = pci_get_slot (dev->bus, PCI_DEVFN(5,0)); | ||
624 | if (apicdev == NULL) | ||
625 | printk("IDE Fixup IRQ: Can't find IO-APIC !\n"); | ||
626 | else { | ||
627 | pci_write_config_byte(apicdev, 0xf2, 0x10 + 2*14); | ||
628 | pci_read_config_dword(apicdev, 0xf4, &v); | ||
629 | v &= ~0x00000022; | ||
630 | pci_write_config_dword(apicdev, 0xf4, v); | ||
631 | pci_write_config_byte(apicdev, 0xf2, 0x10 + 2*15); | ||
632 | pci_read_config_dword(apicdev, 0xf4, &v); | ||
633 | v &= ~0x00000022; | ||
634 | pci_write_config_dword(apicdev, 0xf4, v); | ||
635 | pci_dev_put(apicdev); | ||
636 | } | ||
637 | } | ||
638 | #endif | ||
639 | } | ||
640 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_IDE, | ||
641 | fixup_maple_ide); | ||
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index 3ce2d73b4177..364714757cf1 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/smp.h> | 43 | #include <linux/smp.h> |
44 | #include <linux/bitops.h> | 44 | #include <linux/bitops.h> |
45 | #include <linux/of_device.h> | 45 | #include <linux/of_device.h> |
46 | #include <linux/lmb.h> | ||
46 | 47 | ||
47 | #include <asm/processor.h> | 48 | #include <asm/processor.h> |
48 | #include <asm/sections.h> | 49 | #include <asm/sections.h> |
@@ -57,7 +58,6 @@ | |||
57 | #include <asm/dma.h> | 58 | #include <asm/dma.h> |
58 | #include <asm/cputable.h> | 59 | #include <asm/cputable.h> |
59 | #include <asm/time.h> | 60 | #include <asm/time.h> |
60 | #include <asm/lmb.h> | ||
61 | #include <asm/mpic.h> | 61 | #include <asm/mpic.h> |
62 | #include <asm/rtas.h> | 62 | #include <asm/rtas.h> |
63 | #include <asm/udbg.h> | 63 | #include <asm/udbg.h> |
@@ -319,7 +319,7 @@ static int __init maple_probe(void) | |||
319 | return 1; | 319 | return 1; |
320 | } | 320 | } |
321 | 321 | ||
322 | define_machine(maple_md) { | 322 | define_machine(maple) { |
323 | .name = "Maple", | 323 | .name = "Maple", |
324 | .probe = maple_probe, | 324 | .probe = maple_probe, |
325 | .setup_arch = maple_setup_arch, | 325 | .setup_arch = maple_setup_arch, |
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c index c529d8dff395..217af321b0ca 100644 --- a/arch/powerpc/platforms/pasemi/dma_lib.c +++ b/arch/powerpc/platforms/pasemi/dma_lib.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
@@ -26,6 +27,8 @@ | |||
26 | 27 | ||
27 | #define MAX_TXCH 64 | 28 | #define MAX_TXCH 64 |
28 | #define MAX_RXCH 64 | 29 | #define MAX_RXCH 64 |
30 | #define MAX_FLAGS 64 | ||
31 | #define MAX_FUN 8 | ||
29 | 32 | ||
30 | static struct pasdma_status *dma_status; | 33 | static struct pasdma_status *dma_status; |
31 | 34 | ||
@@ -43,6 +46,8 @@ static struct pci_dev *dma_pdev; | |||
43 | 46 | ||
44 | static DECLARE_BITMAP(txch_free, MAX_TXCH); | 47 | static DECLARE_BITMAP(txch_free, MAX_TXCH); |
45 | static DECLARE_BITMAP(rxch_free, MAX_RXCH); | 48 | static DECLARE_BITMAP(rxch_free, MAX_RXCH); |
49 | static DECLARE_BITMAP(flags_free, MAX_FLAGS); | ||
50 | static DECLARE_BITMAP(fun_free, MAX_FUN); | ||
46 | 51 | ||
47 | /* pasemi_read_iob_reg - read IOB register | 52 | /* pasemi_read_iob_reg - read IOB register |
48 | * @reg: Register to read (offset into PCI CFG space) | 53 | * @reg: Register to read (offset into PCI CFG space) |
@@ -373,6 +378,106 @@ void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size, | |||
373 | } | 378 | } |
374 | EXPORT_SYMBOL(pasemi_dma_free_buf); | 379 | EXPORT_SYMBOL(pasemi_dma_free_buf); |
375 | 380 | ||
381 | /* pasemi_dma_alloc_flag - Allocate a flag (event) for channel syncronization | ||
382 | * | ||
383 | * Allocates a flag for use with channel syncronization (event descriptors). | ||
384 | * Returns allocated flag (0-63), < 0 on error. | ||
385 | */ | ||
386 | int pasemi_dma_alloc_flag(void) | ||
387 | { | ||
388 | int bit; | ||
389 | |||
390 | retry: | ||
391 | bit = find_next_bit(flags_free, MAX_FLAGS, 0); | ||
392 | if (bit >= MAX_FLAGS) | ||
393 | return -ENOSPC; | ||
394 | if (!test_and_clear_bit(bit, flags_free)) | ||
395 | goto retry; | ||
396 | |||
397 | return bit; | ||
398 | } | ||
399 | EXPORT_SYMBOL(pasemi_dma_alloc_flag); | ||
400 | |||
401 | |||
402 | /* pasemi_dma_free_flag - Deallocates a flag (event) | ||
403 | * @flag: Flag number to deallocate | ||
404 | * | ||
405 | * Frees up a flag so it can be reused for other purposes. | ||
406 | */ | ||
407 | void pasemi_dma_free_flag(int flag) | ||
408 | { | ||
409 | BUG_ON(test_bit(flag, flags_free)); | ||
410 | BUG_ON(flag >= MAX_FLAGS); | ||
411 | set_bit(flag, flags_free); | ||
412 | } | ||
413 | EXPORT_SYMBOL(pasemi_dma_free_flag); | ||
414 | |||
415 | |||
416 | /* pasemi_dma_set_flag - Sets a flag (event) to 1 | ||
417 | * @flag: Flag number to set active | ||
418 | * | ||
419 | * Sets the flag provided to 1. | ||
420 | */ | ||
421 | void pasemi_dma_set_flag(int flag) | ||
422 | { | ||
423 | BUG_ON(flag >= MAX_FLAGS); | ||
424 | if (flag < 32) | ||
425 | pasemi_write_dma_reg(PAS_DMA_TXF_SFLG0, 1 << flag); | ||
426 | else | ||
427 | pasemi_write_dma_reg(PAS_DMA_TXF_SFLG1, 1 << flag); | ||
428 | } | ||
429 | EXPORT_SYMBOL(pasemi_dma_set_flag); | ||
430 | |||
431 | /* pasemi_dma_clear_flag - Sets a flag (event) to 0 | ||
432 | * @flag: Flag number to set inactive | ||
433 | * | ||
434 | * Sets the flag provided to 0. | ||
435 | */ | ||
436 | void pasemi_dma_clear_flag(int flag) | ||
437 | { | ||
438 | BUG_ON(flag >= MAX_FLAGS); | ||
439 | if (flag < 32) | ||
440 | pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 1 << flag); | ||
441 | else | ||
442 | pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 1 << flag); | ||
443 | } | ||
444 | EXPORT_SYMBOL(pasemi_dma_clear_flag); | ||
445 | |||
446 | /* pasemi_dma_alloc_fun - Allocate a function engine | ||
447 | * | ||
448 | * Allocates a function engine to use for crypto/checksum offload | ||
449 | * Returns allocated engine (0-8), < 0 on error. | ||
450 | */ | ||
451 | int pasemi_dma_alloc_fun(void) | ||
452 | { | ||
453 | int bit; | ||
454 | |||
455 | retry: | ||
456 | bit = find_next_bit(fun_free, MAX_FLAGS, 0); | ||
457 | if (bit >= MAX_FLAGS) | ||
458 | return -ENOSPC; | ||
459 | if (!test_and_clear_bit(bit, fun_free)) | ||
460 | goto retry; | ||
461 | |||
462 | return bit; | ||
463 | } | ||
464 | EXPORT_SYMBOL(pasemi_dma_alloc_fun); | ||
465 | |||
466 | |||
467 | /* pasemi_dma_free_fun - Deallocates a function engine | ||
468 | * @flag: Engine number to deallocate | ||
469 | * | ||
470 | * Frees up a function engine so it can be used for other purposes. | ||
471 | */ | ||
472 | void pasemi_dma_free_fun(int fun) | ||
473 | { | ||
474 | BUG_ON(test_bit(fun, fun_free)); | ||
475 | BUG_ON(fun >= MAX_FLAGS); | ||
476 | set_bit(fun, fun_free); | ||
477 | } | ||
478 | EXPORT_SYMBOL(pasemi_dma_free_fun); | ||
479 | |||
480 | |||
376 | static void *map_onedev(struct pci_dev *p, int index) | 481 | static void *map_onedev(struct pci_dev *p, int index) |
377 | { | 482 | { |
378 | struct device_node *dn; | 483 | struct device_node *dn; |
@@ -410,6 +515,7 @@ int pasemi_dma_init(void) | |||
410 | struct resource res; | 515 | struct resource res; |
411 | struct device_node *dn; | 516 | struct device_node *dn; |
412 | int i, intf, err = 0; | 517 | int i, intf, err = 0; |
518 | unsigned long timeout; | ||
413 | u32 tmp; | 519 | u32 tmp; |
414 | 520 | ||
415 | if (!machine_is(pasemi)) | 521 | if (!machine_is(pasemi)) |
@@ -478,6 +584,44 @@ int pasemi_dma_init(void) | |||
478 | for (i = 0; i < MAX_RXCH; i++) | 584 | for (i = 0; i < MAX_RXCH; i++) |
479 | __set_bit(i, rxch_free); | 585 | __set_bit(i, rxch_free); |
480 | 586 | ||
587 | timeout = jiffies + HZ; | ||
588 | pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0); | ||
589 | while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) { | ||
590 | if (time_after(jiffies, timeout)) { | ||
591 | pr_warning("Warning: Could not disable RX section\n"); | ||
592 | break; | ||
593 | } | ||
594 | } | ||
595 | |||
596 | timeout = jiffies + HZ; | ||
597 | pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0); | ||
598 | while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) { | ||
599 | if (time_after(jiffies, timeout)) { | ||
600 | pr_warning("Warning: Could not disable TX section\n"); | ||
601 | break; | ||
602 | } | ||
603 | } | ||
604 | |||
605 | /* setup resource allocations for the different DMA sections */ | ||
606 | tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG); | ||
607 | pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000); | ||
608 | |||
609 | /* enable tx section */ | ||
610 | pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN); | ||
611 | |||
612 | /* enable rx section */ | ||
613 | pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN); | ||
614 | |||
615 | for (i = 0; i < MAX_FLAGS; i++) | ||
616 | __set_bit(i, flags_free); | ||
617 | |||
618 | for (i = 0; i < MAX_FUN; i++) | ||
619 | __set_bit(i, fun_free); | ||
620 | |||
621 | /* clear all status flags */ | ||
622 | pasemi_write_dma_reg(PAS_DMA_TXF_CFLG0, 0xffffffff); | ||
623 | pasemi_write_dma_reg(PAS_DMA_TXF_CFLG1, 0xffffffff); | ||
624 | |||
481 | printk(KERN_INFO "PA Semi PWRficient DMA library initialized " | 625 | printk(KERN_INFO "PA Semi PWRficient DMA library initialized " |
482 | "(%d tx, %d rx channels)\n", num_txch, num_rxch); | 626 | "(%d tx, %d rx channels)\n", num_txch, num_rxch); |
483 | 627 | ||
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 36ff1b6b7fac..59404baf911f 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/suspend.h> | 53 | #include <linux/suspend.h> |
54 | #include <linux/of_device.h> | 54 | #include <linux/of_device.h> |
55 | #include <linux/of_platform.h> | 55 | #include <linux/of_platform.h> |
56 | #include <linux/lmb.h> | ||
56 | 57 | ||
57 | #include <asm/reg.h> | 58 | #include <asm/reg.h> |
58 | #include <asm/sections.h> | 59 | #include <asm/sections.h> |
@@ -74,7 +75,6 @@ | |||
74 | #include <asm/iommu.h> | 75 | #include <asm/iommu.h> |
75 | #include <asm/smu.h> | 76 | #include <asm/smu.h> |
76 | #include <asm/pmc.h> | 77 | #include <asm/pmc.h> |
77 | #include <asm/lmb.h> | ||
78 | #include <asm/udbg.h> | 78 | #include <asm/udbg.h> |
79 | 79 | ||
80 | #include "pmac.h" | 80 | #include "pmac.h" |
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c index 7382f195c4f8..1cf901fa9031 100644 --- a/arch/powerpc/platforms/ps3/htab.c +++ b/arch/powerpc/platforms/ps3/htab.c | |||
@@ -19,9 +19,10 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/lmb.h> | ||
22 | 23 | ||
23 | #include <asm/machdep.h> | 24 | #include <asm/machdep.h> |
24 | #include <asm/lmb.h> | 25 | #include <asm/prom.h> |
25 | #include <asm/udbg.h> | 26 | #include <asm/udbg.h> |
26 | #include <asm/lv1call.h> | 27 | #include <asm/lv1call.h> |
27 | #include <asm/ps3fb.h> | 28 | #include <asm/ps3fb.h> |
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 68900476c842..5b3fb2b321ab 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c | |||
@@ -21,9 +21,10 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/memory_hotplug.h> | 23 | #include <linux/memory_hotplug.h> |
24 | #include <linux/lmb.h> | ||
24 | 25 | ||
25 | #include <asm/firmware.h> | 26 | #include <asm/firmware.h> |
26 | #include <asm/lmb.h> | 27 | #include <asm/prom.h> |
27 | #include <asm/udbg.h> | 28 | #include <asm/udbg.h> |
28 | #include <asm/lv1call.h> | 29 | #include <asm/lv1call.h> |
29 | 30 | ||
diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c index b9ea09d9d2fb..c73379ec9141 100644 --- a/arch/powerpc/platforms/ps3/os-area.c +++ b/arch/powerpc/platforms/ps3/os-area.c | |||
@@ -24,8 +24,9 @@ | |||
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/syscalls.h> | 25 | #include <linux/syscalls.h> |
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/lmb.h> | ||
27 | 28 | ||
28 | #include <asm/lmb.h> | 29 | #include <asm/prom.h> |
29 | 30 | ||
30 | #include "platform.h" | 31 | #include "platform.h" |
31 | 32 | ||
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 992ba6753cf2..bdae04bb7a01 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile | |||
@@ -18,3 +18,4 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o | |||
18 | obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o | 18 | obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o |
19 | obj-$(CONFIG_HVCS) += hvcserver.o | 19 | obj-$(CONFIG_HVCS) += hvcserver.o |
20 | obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o | 20 | obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o |
21 | obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o | ||
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 9a455d46379d..233d9be25f49 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -520,6 +520,20 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va, | |||
520 | BUG_ON(lpar_rc != H_SUCCESS); | 520 | BUG_ON(lpar_rc != H_SUCCESS); |
521 | } | 521 | } |
522 | 522 | ||
523 | static void pSeries_lpar_hpte_removebolted(unsigned long ea, | ||
524 | int psize, int ssize) | ||
525 | { | ||
526 | unsigned long slot, vsid, va; | ||
527 | |||
528 | vsid = get_kernel_vsid(ea, ssize); | ||
529 | va = hpt_va(ea, vsid, ssize); | ||
530 | |||
531 | slot = pSeries_lpar_hpte_find(va, psize, ssize); | ||
532 | BUG_ON(slot == -1); | ||
533 | |||
534 | pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0); | ||
535 | } | ||
536 | |||
523 | /* Flag bits for H_BULK_REMOVE */ | 537 | /* Flag bits for H_BULK_REMOVE */ |
524 | #define HBR_REQUEST 0x4000000000000000UL | 538 | #define HBR_REQUEST 0x4000000000000000UL |
525 | #define HBR_RESPONSE 0x8000000000000000UL | 539 | #define HBR_RESPONSE 0x8000000000000000UL |
@@ -597,6 +611,7 @@ void __init hpte_init_lpar(void) | |||
597 | ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp; | 611 | ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp; |
598 | ppc_md.hpte_insert = pSeries_lpar_hpte_insert; | 612 | ppc_md.hpte_insert = pSeries_lpar_hpte_insert; |
599 | ppc_md.hpte_remove = pSeries_lpar_hpte_remove; | 613 | ppc_md.hpte_remove = pSeries_lpar_hpte_remove; |
614 | ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted; | ||
600 | ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; | 615 | ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range; |
601 | ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear; | 616 | ppc_md.hpte_clear_all = pSeries_lpar_hptab_clear; |
602 | } | 617 | } |
diff --git a/arch/powerpc/platforms/pseries/phyp_dump.c b/arch/powerpc/platforms/pseries/phyp_dump.c new file mode 100644 index 000000000000..7ddd10526cea --- /dev/null +++ b/arch/powerpc/platforms/pseries/phyp_dump.c | |||
@@ -0,0 +1,498 @@ | |||
1 | /* | ||
2 | * Hypervisor-assisted dump | ||
3 | * | ||
4 | * Linas Vepstas, Manish Ahuja 2008 | ||
5 | * Copyright 2008 IBM Corp. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU General Public License | ||
9 | * as published by the Free Software Foundation; either version | ||
10 | * 2 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/kobject.h> | ||
16 | #include <linux/mm.h> | ||
17 | #include <linux/of.h> | ||
18 | #include <linux/pfn.h> | ||
19 | #include <linux/swap.h> | ||
20 | #include <linux/sysfs.h> | ||
21 | |||
22 | #include <asm/page.h> | ||
23 | #include <asm/phyp_dump.h> | ||
24 | #include <asm/machdep.h> | ||
25 | #include <asm/prom.h> | ||
26 | #include <asm/rtas.h> | ||
27 | |||
28 | /* Variables, used to communicate data between early boot and late boot */ | ||
29 | static struct phyp_dump phyp_dump_vars; | ||
30 | struct phyp_dump *phyp_dump_info = &phyp_dump_vars; | ||
31 | |||
32 | static int ibm_configure_kernel_dump; | ||
33 | /* ------------------------------------------------- */ | ||
34 | /* RTAS interfaces to declare the dump regions */ | ||
35 | |||
36 | struct dump_section { | ||
37 | u32 dump_flags; | ||
38 | u16 source_type; | ||
39 | u16 error_flags; | ||
40 | u64 source_address; | ||
41 | u64 source_length; | ||
42 | u64 length_copied; | ||
43 | u64 destination_address; | ||
44 | }; | ||
45 | |||
46 | struct phyp_dump_header { | ||
47 | u32 version; | ||
48 | u16 num_of_sections; | ||
49 | u16 status; | ||
50 | |||
51 | u32 first_offset_section; | ||
52 | u32 dump_disk_section; | ||
53 | u64 block_num_dd; | ||
54 | u64 num_of_blocks_dd; | ||
55 | u32 offset_dd; | ||
56 | u32 maxtime_to_auto; | ||
57 | /* No dump disk path string used */ | ||
58 | |||
59 | struct dump_section cpu_data; | ||
60 | struct dump_section hpte_data; | ||
61 | struct dump_section kernel_data; | ||
62 | }; | ||
63 | |||
64 | /* The dump header *must be* in low memory, so .bss it */ | ||
65 | static struct phyp_dump_header phdr; | ||
66 | |||
67 | #define NUM_DUMP_SECTIONS 3 | ||
68 | #define DUMP_HEADER_VERSION 0x1 | ||
69 | #define DUMP_REQUEST_FLAG 0x1 | ||
70 | #define DUMP_SOURCE_CPU 0x0001 | ||
71 | #define DUMP_SOURCE_HPTE 0x0002 | ||
72 | #define DUMP_SOURCE_RMO 0x0011 | ||
73 | #define DUMP_ERROR_FLAG 0x2000 | ||
74 | #define DUMP_TRIGGERED 0x4000 | ||
75 | #define DUMP_PERFORMED 0x8000 | ||
76 | |||
77 | |||
78 | /** | ||
79 | * init_dump_header() - initialize the header declaring a dump | ||
80 | * Returns: length of dump save area. | ||
81 | * | ||
82 | * When the hypervisor saves crashed state, it needs to put | ||
83 | * it somewhere. The dump header tells the hypervisor where | ||
84 | * the data can be saved. | ||
85 | */ | ||
86 | static unsigned long init_dump_header(struct phyp_dump_header *ph) | ||
87 | { | ||
88 | unsigned long addr_offset = 0; | ||
89 | |||
90 | /* Set up the dump header */ | ||
91 | ph->version = DUMP_HEADER_VERSION; | ||
92 | ph->num_of_sections = NUM_DUMP_SECTIONS; | ||
93 | ph->status = 0; | ||
94 | |||
95 | ph->first_offset_section = | ||
96 | (u32)offsetof(struct phyp_dump_header, cpu_data); | ||
97 | ph->dump_disk_section = 0; | ||
98 | ph->block_num_dd = 0; | ||
99 | ph->num_of_blocks_dd = 0; | ||
100 | ph->offset_dd = 0; | ||
101 | |||
102 | ph->maxtime_to_auto = 0; /* disabled */ | ||
103 | |||
104 | /* The first two sections are mandatory */ | ||
105 | ph->cpu_data.dump_flags = DUMP_REQUEST_FLAG; | ||
106 | ph->cpu_data.source_type = DUMP_SOURCE_CPU; | ||
107 | ph->cpu_data.source_address = 0; | ||
108 | ph->cpu_data.source_length = phyp_dump_info->cpu_state_size; | ||
109 | ph->cpu_data.destination_address = addr_offset; | ||
110 | addr_offset += phyp_dump_info->cpu_state_size; | ||
111 | |||
112 | ph->hpte_data.dump_flags = DUMP_REQUEST_FLAG; | ||
113 | ph->hpte_data.source_type = DUMP_SOURCE_HPTE; | ||
114 | ph->hpte_data.source_address = 0; | ||
115 | ph->hpte_data.source_length = phyp_dump_info->hpte_region_size; | ||
116 | ph->hpte_data.destination_address = addr_offset; | ||
117 | addr_offset += phyp_dump_info->hpte_region_size; | ||
118 | |||
119 | /* This section describes the low kernel region */ | ||
120 | ph->kernel_data.dump_flags = DUMP_REQUEST_FLAG; | ||
121 | ph->kernel_data.source_type = DUMP_SOURCE_RMO; | ||
122 | ph->kernel_data.source_address = PHYP_DUMP_RMR_START; | ||
123 | ph->kernel_data.source_length = PHYP_DUMP_RMR_END; | ||
124 | ph->kernel_data.destination_address = addr_offset; | ||
125 | addr_offset += ph->kernel_data.source_length; | ||
126 | |||
127 | return addr_offset; | ||
128 | } | ||
129 | |||
130 | static void print_dump_header(const struct phyp_dump_header *ph) | ||
131 | { | ||
132 | #ifdef DEBUG | ||
133 | printk(KERN_INFO "dump header:\n"); | ||
134 | /* setup some ph->sections required */ | ||
135 | printk(KERN_INFO "version = %d\n", ph->version); | ||
136 | printk(KERN_INFO "Sections = %d\n", ph->num_of_sections); | ||
137 | printk(KERN_INFO "Status = 0x%x\n", ph->status); | ||
138 | |||
139 | /* No ph->disk, so all should be set to 0 */ | ||
140 | printk(KERN_INFO "Offset to first section 0x%x\n", | ||
141 | ph->first_offset_section); | ||
142 | printk(KERN_INFO "dump disk sections should be zero\n"); | ||
143 | printk(KERN_INFO "dump disk section = %d\n", ph->dump_disk_section); | ||
144 | printk(KERN_INFO "block num = %ld\n", ph->block_num_dd); | ||
145 | printk(KERN_INFO "number of blocks = %ld\n", ph->num_of_blocks_dd); | ||
146 | printk(KERN_INFO "dump disk offset = %d\n", ph->offset_dd); | ||
147 | printk(KERN_INFO "Max auto time= %d\n", ph->maxtime_to_auto); | ||
148 | |||
149 | /*set cpu state and hpte states as well scratch pad area */ | ||
150 | printk(KERN_INFO " CPU AREA \n"); | ||
151 | printk(KERN_INFO "cpu dump_flags =%d\n", ph->cpu_data.dump_flags); | ||
152 | printk(KERN_INFO "cpu source_type =%d\n", ph->cpu_data.source_type); | ||
153 | printk(KERN_INFO "cpu error_flags =%d\n", ph->cpu_data.error_flags); | ||
154 | printk(KERN_INFO "cpu source_address =%lx\n", | ||
155 | ph->cpu_data.source_address); | ||
156 | printk(KERN_INFO "cpu source_length =%lx\n", | ||
157 | ph->cpu_data.source_length); | ||
158 | printk(KERN_INFO "cpu length_copied =%lx\n", | ||
159 | ph->cpu_data.length_copied); | ||
160 | |||
161 | printk(KERN_INFO " HPTE AREA \n"); | ||
162 | printk(KERN_INFO "HPTE dump_flags =%d\n", ph->hpte_data.dump_flags); | ||
163 | printk(KERN_INFO "HPTE source_type =%d\n", ph->hpte_data.source_type); | ||
164 | printk(KERN_INFO "HPTE error_flags =%d\n", ph->hpte_data.error_flags); | ||
165 | printk(KERN_INFO "HPTE source_address =%lx\n", | ||
166 | ph->hpte_data.source_address); | ||
167 | printk(KERN_INFO "HPTE source_length =%lx\n", | ||
168 | ph->hpte_data.source_length); | ||
169 | printk(KERN_INFO "HPTE length_copied =%lx\n", | ||
170 | ph->hpte_data.length_copied); | ||
171 | |||
172 | printk(KERN_INFO " SRSD AREA \n"); | ||
173 | printk(KERN_INFO "SRSD dump_flags =%d\n", ph->kernel_data.dump_flags); | ||
174 | printk(KERN_INFO "SRSD source_type =%d\n", ph->kernel_data.source_type); | ||
175 | printk(KERN_INFO "SRSD error_flags =%d\n", ph->kernel_data.error_flags); | ||
176 | printk(KERN_INFO "SRSD source_address =%lx\n", | ||
177 | ph->kernel_data.source_address); | ||
178 | printk(KERN_INFO "SRSD source_length =%lx\n", | ||
179 | ph->kernel_data.source_length); | ||
180 | printk(KERN_INFO "SRSD length_copied =%lx\n", | ||
181 | ph->kernel_data.length_copied); | ||
182 | #endif | ||
183 | } | ||
184 | |||
185 | static ssize_t show_phyp_dump_active(struct kobject *kobj, | ||
186 | struct kobj_attribute *attr, char *buf) | ||
187 | { | ||
188 | |||
189 | /* create filesystem entry so kdump is phyp-dump aware */ | ||
190 | return sprintf(buf, "%lx\n", phyp_dump_info->phyp_dump_at_boot); | ||
191 | } | ||
192 | |||
193 | static struct kobj_attribute pdl = __ATTR(phyp_dump_active, 0600, | ||
194 | show_phyp_dump_active, | ||
195 | NULL); | ||
196 | |||
197 | static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr) | ||
198 | { | ||
199 | int rc; | ||
200 | |||
201 | /* Add addr value if not initialized before */ | ||
202 | if (ph->cpu_data.destination_address == 0) { | ||
203 | ph->cpu_data.destination_address += addr; | ||
204 | ph->hpte_data.destination_address += addr; | ||
205 | ph->kernel_data.destination_address += addr; | ||
206 | } | ||
207 | |||
208 | /* ToDo Invalidate kdump and free memory range. */ | ||
209 | |||
210 | do { | ||
211 | rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL, | ||
212 | 1, ph, sizeof(struct phyp_dump_header)); | ||
213 | } while (rtas_busy_delay(rc)); | ||
214 | |||
215 | if (rc) { | ||
216 | printk(KERN_ERR "phyp-dump: unexpected error (%d) on " | ||
217 | "register\n", rc); | ||
218 | print_dump_header(ph); | ||
219 | return; | ||
220 | } | ||
221 | |||
222 | rc = sysfs_create_file(kernel_kobj, &pdl.attr); | ||
223 | if (rc) | ||
224 | printk(KERN_ERR "phyp-dump: unable to create sysfs" | ||
225 | " file (%d)\n", rc); | ||
226 | } | ||
227 | |||
228 | static | ||
229 | void invalidate_last_dump(struct phyp_dump_header *ph, unsigned long addr) | ||
230 | { | ||
231 | int rc; | ||
232 | |||
233 | /* Add addr value if not initialized before */ | ||
234 | if (ph->cpu_data.destination_address == 0) { | ||
235 | ph->cpu_data.destination_address += addr; | ||
236 | ph->hpte_data.destination_address += addr; | ||
237 | ph->kernel_data.destination_address += addr; | ||
238 | } | ||
239 | |||
240 | do { | ||
241 | rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL, | ||
242 | 2, ph, sizeof(struct phyp_dump_header)); | ||
243 | } while (rtas_busy_delay(rc)); | ||
244 | |||
245 | if (rc) { | ||
246 | printk(KERN_ERR "phyp-dump: unexpected error (%d) " | ||
247 | "on invalidate\n", rc); | ||
248 | print_dump_header(ph); | ||
249 | } | ||
250 | } | ||
251 | |||
252 | /* ------------------------------------------------- */ | ||
253 | /** | ||
254 | * release_memory_range -- release memory previously lmb_reserved | ||
255 | * @start_pfn: starting physical frame number | ||
256 | * @nr_pages: number of pages to free. | ||
257 | * | ||
258 | * This routine will release memory that had been previously | ||
259 | * lmb_reserved in early boot. The released memory becomes | ||
260 | * available for genreal use. | ||
261 | */ | ||
262 | static void release_memory_range(unsigned long start_pfn, | ||
263 | unsigned long nr_pages) | ||
264 | { | ||
265 | struct page *rpage; | ||
266 | unsigned long end_pfn; | ||
267 | long i; | ||
268 | |||
269 | end_pfn = start_pfn + nr_pages; | ||
270 | |||
271 | for (i = start_pfn; i <= end_pfn; i++) { | ||
272 | rpage = pfn_to_page(i); | ||
273 | if (PageReserved(rpage)) { | ||
274 | ClearPageReserved(rpage); | ||
275 | init_page_count(rpage); | ||
276 | __free_page(rpage); | ||
277 | totalram_pages++; | ||
278 | } | ||
279 | } | ||
280 | } | ||
281 | |||
282 | /** | ||
283 | * track_freed_range -- Counts the range being freed. | ||
284 | * Once the counter goes to zero, it re-registers dump for | ||
285 | * future use. | ||
286 | */ | ||
287 | static void | ||
288 | track_freed_range(unsigned long addr, unsigned long length) | ||
289 | { | ||
290 | static unsigned long scratch_area_size, reserved_area_size; | ||
291 | |||
292 | if (addr < phyp_dump_info->init_reserve_start) | ||
293 | return; | ||
294 | |||
295 | if ((addr >= phyp_dump_info->init_reserve_start) && | ||
296 | (addr <= phyp_dump_info->init_reserve_start + | ||
297 | phyp_dump_info->init_reserve_size)) | ||
298 | reserved_area_size += length; | ||
299 | |||
300 | if ((addr >= phyp_dump_info->reserved_scratch_addr) && | ||
301 | (addr <= phyp_dump_info->reserved_scratch_addr + | ||
302 | phyp_dump_info->reserved_scratch_size)) | ||
303 | scratch_area_size += length; | ||
304 | |||
305 | if ((reserved_area_size == phyp_dump_info->init_reserve_size) && | ||
306 | (scratch_area_size == phyp_dump_info->reserved_scratch_size)) { | ||
307 | |||
308 | invalidate_last_dump(&phdr, | ||
309 | phyp_dump_info->reserved_scratch_addr); | ||
310 | register_dump_area(&phdr, | ||
311 | phyp_dump_info->reserved_scratch_addr); | ||
312 | } | ||
313 | } | ||
314 | |||
315 | /* ------------------------------------------------- */ | ||
316 | /** | ||
317 | * sysfs_release_region -- sysfs interface to release memory range. | ||
318 | * | ||
319 | * Usage: | ||
320 | * "echo <start addr> <length> > /sys/kernel/release_region" | ||
321 | * | ||
322 | * Example: | ||
323 | * "echo 0x40000000 0x10000000 > /sys/kernel/release_region" | ||
324 | * | ||
325 | * will release 256MB starting at 1GB. | ||
326 | */ | ||
327 | static ssize_t store_release_region(struct kobject *kobj, | ||
328 | struct kobj_attribute *attr, | ||
329 | const char *buf, size_t count) | ||
330 | { | ||
331 | unsigned long start_addr, length, end_addr; | ||
332 | unsigned long start_pfn, nr_pages; | ||
333 | ssize_t ret; | ||
334 | |||
335 | ret = sscanf(buf, "%lx %lx", &start_addr, &length); | ||
336 | if (ret != 2) | ||
337 | return -EINVAL; | ||
338 | |||
339 | track_freed_range(start_addr, length); | ||
340 | |||
341 | /* Range-check - don't free any reserved memory that | ||
342 | * wasn't reserved for phyp-dump */ | ||
343 | if (start_addr < phyp_dump_info->init_reserve_start) | ||
344 | start_addr = phyp_dump_info->init_reserve_start; | ||
345 | |||
346 | end_addr = phyp_dump_info->init_reserve_start + | ||
347 | phyp_dump_info->init_reserve_size; | ||
348 | if (start_addr+length > end_addr) | ||
349 | length = end_addr - start_addr; | ||
350 | |||
351 | /* Release the region of memory assed in by user */ | ||
352 | start_pfn = PFN_DOWN(start_addr); | ||
353 | nr_pages = PFN_DOWN(length); | ||
354 | release_memory_range(start_pfn, nr_pages); | ||
355 | |||
356 | return count; | ||
357 | } | ||
358 | |||
359 | static ssize_t show_release_region(struct kobject *kobj, | ||
360 | struct kobj_attribute *attr, char *buf) | ||
361 | { | ||
362 | u64 second_addr_range; | ||
363 | |||
364 | /* total reserved size - start of scratch area */ | ||
365 | second_addr_range = phyp_dump_info->init_reserve_size - | ||
366 | phyp_dump_info->reserved_scratch_size; | ||
367 | return sprintf(buf, "CPU:0x%lx-0x%lx: HPTE:0x%lx-0x%lx:" | ||
368 | " DUMP:0x%lx-0x%lx, 0x%lx-0x%lx:\n", | ||
369 | phdr.cpu_data.destination_address, | ||
370 | phdr.cpu_data.length_copied, | ||
371 | phdr.hpte_data.destination_address, | ||
372 | phdr.hpte_data.length_copied, | ||
373 | phdr.kernel_data.destination_address, | ||
374 | phdr.kernel_data.length_copied, | ||
375 | phyp_dump_info->init_reserve_start, | ||
376 | second_addr_range); | ||
377 | } | ||
378 | |||
379 | static struct kobj_attribute rr = __ATTR(release_region, 0600, | ||
380 | show_release_region, | ||
381 | store_release_region); | ||
382 | |||
383 | static int __init phyp_dump_setup(void) | ||
384 | { | ||
385 | struct device_node *rtas; | ||
386 | const struct phyp_dump_header *dump_header = NULL; | ||
387 | unsigned long dump_area_start; | ||
388 | unsigned long dump_area_length; | ||
389 | int header_len = 0; | ||
390 | int rc; | ||
391 | |||
392 | /* If no memory was reserved in early boot, there is nothing to do */ | ||
393 | if (phyp_dump_info->init_reserve_size == 0) | ||
394 | return 0; | ||
395 | |||
396 | /* Return if phyp dump not supported */ | ||
397 | if (!phyp_dump_info->phyp_dump_configured) | ||
398 | return -ENOSYS; | ||
399 | |||
400 | /* Is there dump data waiting for us? If there isn't, | ||
401 | * then register a new dump area, and release all of | ||
402 | * the rest of the reserved ram. | ||
403 | * | ||
404 | * The /rtas/ibm,kernel-dump rtas node is present only | ||
405 | * if there is dump data waiting for us. | ||
406 | */ | ||
407 | rtas = of_find_node_by_path("/rtas"); | ||
408 | if (rtas) { | ||
409 | dump_header = of_get_property(rtas, "ibm,kernel-dump", | ||
410 | &header_len); | ||
411 | of_node_put(rtas); | ||
412 | } | ||
413 | |||
414 | print_dump_header(dump_header); | ||
415 | dump_area_length = init_dump_header(&phdr); | ||
416 | /* align down */ | ||
417 | dump_area_start = phyp_dump_info->init_reserve_start & PAGE_MASK; | ||
418 | |||
419 | if (dump_header == NULL) { | ||
420 | register_dump_area(&phdr, dump_area_start); | ||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | /* re-register the dump area, if old dump was invalid */ | ||
425 | if ((dump_header) && (dump_header->status & DUMP_ERROR_FLAG)) { | ||
426 | invalidate_last_dump(&phdr, dump_area_start); | ||
427 | register_dump_area(&phdr, dump_area_start); | ||
428 | return 0; | ||
429 | } | ||
430 | |||
431 | if (dump_header) { | ||
432 | phyp_dump_info->reserved_scratch_addr = | ||
433 | dump_header->cpu_data.destination_address; | ||
434 | phyp_dump_info->reserved_scratch_size = | ||
435 | dump_header->cpu_data.source_length + | ||
436 | dump_header->hpte_data.source_length + | ||
437 | dump_header->kernel_data.source_length; | ||
438 | } | ||
439 | |||
440 | /* Should we create a dump_subsys, analogous to s390/ipl.c ? */ | ||
441 | rc = sysfs_create_file(kernel_kobj, &rr.attr); | ||
442 | if (rc) | ||
443 | printk(KERN_ERR "phyp-dump: unable to create sysfs file (%d)\n", | ||
444 | rc); | ||
445 | |||
446 | /* ToDo: re-register the dump area, for next time. */ | ||
447 | return 0; | ||
448 | } | ||
449 | machine_subsys_initcall(pseries, phyp_dump_setup); | ||
450 | |||
451 | int __init early_init_dt_scan_phyp_dump(unsigned long node, | ||
452 | const char *uname, int depth, void *data) | ||
453 | { | ||
454 | const unsigned int *sizes; | ||
455 | |||
456 | phyp_dump_info->phyp_dump_configured = 0; | ||
457 | phyp_dump_info->phyp_dump_is_active = 0; | ||
458 | |||
459 | if (depth != 1 || strcmp(uname, "rtas") != 0) | ||
460 | return 0; | ||
461 | |||
462 | if (of_get_flat_dt_prop(node, "ibm,configure-kernel-dump", NULL)) | ||
463 | phyp_dump_info->phyp_dump_configured++; | ||
464 | |||
465 | if (of_get_flat_dt_prop(node, "ibm,dump-kernel", NULL)) | ||
466 | phyp_dump_info->phyp_dump_is_active++; | ||
467 | |||
468 | sizes = of_get_flat_dt_prop(node, "ibm,configure-kernel-dump-sizes", | ||
469 | NULL); | ||
470 | if (!sizes) | ||
471 | return 0; | ||
472 | |||
473 | if (sizes[0] == 1) | ||
474 | phyp_dump_info->cpu_state_size = *((unsigned long *)&sizes[1]); | ||
475 | |||
476 | if (sizes[3] == 2) | ||
477 | phyp_dump_info->hpte_region_size = | ||
478 | *((unsigned long *)&sizes[4]); | ||
479 | return 1; | ||
480 | } | ||
481 | |||
482 | /* Look for phyp_dump= cmdline option */ | ||
483 | static int __init early_phyp_dump_enabled(char *p) | ||
484 | { | ||
485 | phyp_dump_info->phyp_dump_at_boot = 1; | ||
486 | |||
487 | if (!p) | ||
488 | return 0; | ||
489 | |||
490 | if (strncmp(p, "1", 1) == 0) | ||
491 | phyp_dump_info->phyp_dump_at_boot = 1; | ||
492 | else if (strncmp(p, "0", 1) == 0) | ||
493 | phyp_dump_info->phyp_dump_at_boot = 0; | ||
494 | |||
495 | return 0; | ||
496 | } | ||
497 | early_param("phyp_dump", early_phyp_dump_enabled); | ||
498 | |||
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c index 8e1ef168e2dd..e5b0ea870164 100644 --- a/arch/powerpc/platforms/pseries/scanlog.c +++ b/arch/powerpc/platforms/pseries/scanlog.c | |||
@@ -195,31 +195,30 @@ const struct file_operations scanlog_fops = { | |||
195 | static int __init scanlog_init(void) | 195 | static int __init scanlog_init(void) |
196 | { | 196 | { |
197 | struct proc_dir_entry *ent; | 197 | struct proc_dir_entry *ent; |
198 | void *data; | ||
199 | int err = -ENOMEM; | ||
198 | 200 | ||
199 | ibm_scan_log_dump = rtas_token("ibm,scan-log-dump"); | 201 | ibm_scan_log_dump = rtas_token("ibm,scan-log-dump"); |
200 | if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE) { | 202 | if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE) |
201 | printk(KERN_ERR "scan-log-dump not implemented on this system\n"); | 203 | return -ENODEV; |
202 | return -EIO; | ||
203 | } | ||
204 | 204 | ||
205 | ent = create_proc_entry("ppc64/rtas/scan-log-dump", S_IRUSR, NULL); | 205 | /* Ideally we could allocate a buffer < 4G */ |
206 | if (ent) { | 206 | data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); |
207 | ent->proc_fops = &scanlog_fops; | 207 | if (!data) |
208 | /* Ideally we could allocate a buffer < 4G */ | 208 | goto err; |
209 | ent->data = kmalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL); | 209 | |
210 | if (!ent->data) { | 210 | ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, |
211 | printk(KERN_ERR "Failed to allocate a buffer\n"); | 211 | &scanlog_fops); |
212 | remove_proc_entry("scan-log-dump", ent->parent); | 212 | if (!ent) |
213 | return -ENOMEM; | 213 | goto err; |
214 | } | 214 | |
215 | ((unsigned int *)ent->data)[0] = 0; | 215 | ent->data = data; |
216 | } else { | ||
217 | printk(KERN_ERR "Failed to create ppc64/scan-log-dump proc entry\n"); | ||
218 | return -EIO; | ||
219 | } | ||
220 | proc_ppc64_scan_log_dump = ent; | 216 | proc_ppc64_scan_log_dump = ent; |
221 | 217 | ||
222 | return 0; | 218 | return 0; |
219 | err: | ||
220 | kfree(data); | ||
221 | return err; | ||
223 | } | 222 | } |
224 | 223 | ||
225 | static void __exit scanlog_cleanup(void) | 224 | static void __exit scanlog_cleanup(void) |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index fdb9b1c8f977..90555a39fe62 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -393,6 +393,7 @@ static void pseries_dedicated_idle_sleep(void) | |||
393 | { | 393 | { |
394 | unsigned int cpu = smp_processor_id(); | 394 | unsigned int cpu = smp_processor_id(); |
395 | unsigned long start_snooze; | 395 | unsigned long start_snooze; |
396 | unsigned long in_purr, out_purr; | ||
396 | 397 | ||
397 | /* | 398 | /* |
398 | * Indicate to the HV that we are idle. Now would be | 399 | * Indicate to the HV that we are idle. Now would be |
@@ -400,6 +401,7 @@ static void pseries_dedicated_idle_sleep(void) | |||
400 | */ | 401 | */ |
401 | get_lppaca()->idle = 1; | 402 | get_lppaca()->idle = 1; |
402 | get_lppaca()->donate_dedicated_cpu = 1; | 403 | get_lppaca()->donate_dedicated_cpu = 1; |
404 | in_purr = mfspr(SPRN_PURR); | ||
403 | 405 | ||
404 | /* | 406 | /* |
405 | * We come in with interrupts disabled, and need_resched() | 407 | * We come in with interrupts disabled, and need_resched() |
@@ -432,6 +434,8 @@ static void pseries_dedicated_idle_sleep(void) | |||
432 | 434 | ||
433 | out: | 435 | out: |
434 | HMT_medium(); | 436 | HMT_medium(); |
437 | out_purr = mfspr(SPRN_PURR); | ||
438 | get_lppaca()->wait_state_cycles += out_purr - in_purr; | ||
435 | get_lppaca()->donate_dedicated_cpu = 0; | 439 | get_lppaca()->donate_dedicated_cpu = 0; |
436 | get_lppaca()->idle = 0; | 440 | get_lppaca()->idle = 0; |
437 | } | 441 | } |
diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index e0e24b01e3a6..005c2ecf976f 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/dma-mapping.h> | 37 | #include <linux/dma-mapping.h> |
38 | #include <linux/vmalloc.h> | 38 | #include <linux/vmalloc.h> |
39 | #include <linux/suspend.h> | 39 | #include <linux/suspend.h> |
40 | #include <linux/lmb.h> | ||
40 | #include <asm/io.h> | 41 | #include <asm/io.h> |
41 | #include <asm/prom.h> | 42 | #include <asm/prom.h> |
42 | #include <asm/iommu.h> | 43 | #include <asm/iommu.h> |
@@ -44,7 +45,6 @@ | |||
44 | #include <asm/machdep.h> | 45 | #include <asm/machdep.h> |
45 | #include <asm/abs_addr.h> | 46 | #include <asm/abs_addr.h> |
46 | #include <asm/cacheflush.h> | 47 | #include <asm/cacheflush.h> |
47 | #include <asm/lmb.h> | ||
48 | #include <asm/ppc-pci.h> | 48 | #include <asm/ppc-pci.h> |
49 | 49 | ||
50 | #include "dart.h" | 50 | #include "dart.h" |
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 6ffdda244bb1..6131fd2b6619 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -175,13 +175,16 @@ static inline void _mpic_write(enum mpic_reg_type type, | |||
175 | switch(type) { | 175 | switch(type) { |
176 | #ifdef CONFIG_PPC_DCR | 176 | #ifdef CONFIG_PPC_DCR |
177 | case mpic_access_dcr: | 177 | case mpic_access_dcr: |
178 | return dcr_write(rb->dhost, reg, value); | 178 | dcr_write(rb->dhost, reg, value); |
179 | break; | ||
179 | #endif | 180 | #endif |
180 | case mpic_access_mmio_be: | 181 | case mpic_access_mmio_be: |
181 | return out_be32(rb->base + (reg >> 2), value); | 182 | out_be32(rb->base + (reg >> 2), value); |
183 | break; | ||
182 | case mpic_access_mmio_le: | 184 | case mpic_access_mmio_le: |
183 | default: | 185 | default: |
184 | return out_le32(rb->base + (reg >> 2), value); | 186 | out_le32(rb->base + (reg >> 2), value); |
187 | break; | ||
185 | } | 188 | } |
186 | } | 189 | } |
187 | 190 | ||
@@ -1000,7 +1003,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1000 | const char *name) | 1003 | const char *name) |
1001 | { | 1004 | { |
1002 | struct mpic *mpic; | 1005 | struct mpic *mpic; |
1003 | u32 reg; | 1006 | u32 greg_feature; |
1004 | const char *vers; | 1007 | const char *vers; |
1005 | int i; | 1008 | int i; |
1006 | int intvec_top; | 1009 | int intvec_top; |
@@ -1064,7 +1067,8 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1064 | 1067 | ||
1065 | /* Look for protected sources */ | 1068 | /* Look for protected sources */ |
1066 | if (node) { | 1069 | if (node) { |
1067 | unsigned int psize, bits, mapsize; | 1070 | int psize; |
1071 | unsigned int bits, mapsize; | ||
1068 | const u32 *psrc = | 1072 | const u32 *psrc = |
1069 | of_get_property(node, "protected-sources", &psize); | 1073 | of_get_property(node, "protected-sources", &psize); |
1070 | if (psrc) { | 1074 | if (psrc) { |
@@ -1107,8 +1111,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1107 | * in, try to obtain one | 1111 | * in, try to obtain one |
1108 | */ | 1112 | */ |
1109 | if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) { | 1113 | if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) { |
1110 | const u32 *reg; | 1114 | const u32 *reg = of_get_property(node, "reg", NULL); |
1111 | reg = of_get_property(node, "reg", NULL); | ||
1112 | BUG_ON(reg == NULL); | 1115 | BUG_ON(reg == NULL); |
1113 | paddr = of_translate_address(node, reg); | 1116 | paddr = of_translate_address(node, reg); |
1114 | BUG_ON(paddr == OF_BAD_ADDR); | 1117 | BUG_ON(paddr == OF_BAD_ADDR); |
@@ -1137,12 +1140,13 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1137 | * MPICs, num sources as well. On ISU MPICs, sources are counted | 1140 | * MPICs, num sources as well. On ISU MPICs, sources are counted |
1138 | * as ISUs are added | 1141 | * as ISUs are added |
1139 | */ | 1142 | */ |
1140 | reg = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0)); | 1143 | greg_feature = mpic_read(mpic->gregs, MPIC_INFO(GREG_FEATURE_0)); |
1141 | mpic->num_cpus = ((reg & MPIC_GREG_FEATURE_LAST_CPU_MASK) | 1144 | mpic->num_cpus = ((greg_feature & MPIC_GREG_FEATURE_LAST_CPU_MASK) |
1142 | >> MPIC_GREG_FEATURE_LAST_CPU_SHIFT) + 1; | 1145 | >> MPIC_GREG_FEATURE_LAST_CPU_SHIFT) + 1; |
1143 | if (isu_size == 0) | 1146 | if (isu_size == 0) |
1144 | mpic->num_sources = ((reg & MPIC_GREG_FEATURE_LAST_SRC_MASK) | 1147 | mpic->num_sources = |
1145 | >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1; | 1148 | ((greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK) |
1149 | >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT) + 1; | ||
1146 | 1150 | ||
1147 | /* Map the per-CPU registers */ | 1151 | /* Map the per-CPU registers */ |
1148 | for (i = 0; i < mpic->num_cpus; i++) { | 1152 | for (i = 0; i < mpic->num_cpus; i++) { |
@@ -1161,7 +1165,7 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1161 | mpic->isu_mask = (1 << mpic->isu_shift) - 1; | 1165 | mpic->isu_mask = (1 << mpic->isu_shift) - 1; |
1162 | 1166 | ||
1163 | /* Display version */ | 1167 | /* Display version */ |
1164 | switch (reg & MPIC_GREG_FEATURE_VERSION_MASK) { | 1168 | switch (greg_feature & MPIC_GREG_FEATURE_VERSION_MASK) { |
1165 | case 1: | 1169 | case 1: |
1166 | vers = "1.0"; | 1170 | vers = "1.0"; |
1167 | break; | 1171 | break; |
@@ -1321,7 +1325,7 @@ void __init mpic_set_serial_int(struct mpic *mpic, int enable) | |||
1321 | 1325 | ||
1322 | void mpic_irq_set_priority(unsigned int irq, unsigned int pri) | 1326 | void mpic_irq_set_priority(unsigned int irq, unsigned int pri) |
1323 | { | 1327 | { |
1324 | int is_ipi; | 1328 | unsigned int is_ipi; |
1325 | struct mpic *mpic = mpic_find(irq, &is_ipi); | 1329 | struct mpic *mpic = mpic_find(irq, &is_ipi); |
1326 | unsigned int src = mpic_irq_to_hw(irq); | 1330 | unsigned int src = mpic_irq_to_hw(irq); |
1327 | unsigned long flags; | 1331 | unsigned long flags; |
@@ -1344,7 +1348,7 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri) | |||
1344 | 1348 | ||
1345 | unsigned int mpic_irq_get_priority(unsigned int irq) | 1349 | unsigned int mpic_irq_get_priority(unsigned int irq) |
1346 | { | 1350 | { |
1347 | int is_ipi; | 1351 | unsigned int is_ipi; |
1348 | struct mpic *mpic = mpic_find(irq, &is_ipi); | 1352 | struct mpic *mpic = mpic_find(irq, &is_ipi); |
1349 | unsigned int src = mpic_irq_to_hw(irq); | 1353 | unsigned int src = mpic_irq_to_hw(irq); |
1350 | unsigned long flags; | 1354 | unsigned long flags; |