diff options
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/crash.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_32.S | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_64.S | 109 | ||||
-rw-r--r-- | arch/powerpc/kernel/machine_kexec_64.c | 10 | ||||
-rw-r--r-- | arch/powerpc/kernel/process.c | 32 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom.c | 54 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 38 |
7 files changed, 83 insertions, 165 deletions
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c index 8c21d378f5d2..778f22fd85d2 100644 --- a/arch/powerpc/kernel/crash.c +++ b/arch/powerpc/kernel/crash.c | |||
@@ -134,8 +134,10 @@ static void crash_kexec_prepare_cpus(void) | |||
134 | * the crash CPU will send an IPI and wait for other CPUs to | 134 | * the crash CPU will send an IPI and wait for other CPUs to |
135 | * respond. If not, proceed the kexec boot even though we failed to | 135 | * respond. If not, proceed the kexec boot even though we failed to |
136 | * capture other CPU states. | 136 | * capture other CPU states. |
137 | * Delay of at least 10 seconds. | ||
137 | */ | 138 | */ |
138 | msecs = 1000000; | 139 | printk(KERN_ALERT "Sending IPI to other cpus...\n"); |
140 | msecs = 10000; | ||
139 | while ((atomic_read(&waiting_for_crash_ipi) > 0) && (--msecs > 0)) { | 141 | while ((atomic_read(&waiting_for_crash_ipi) > 0) && (--msecs > 0)) { |
140 | barrier(); | 142 | barrier(); |
141 | mdelay(1); | 143 | mdelay(1); |
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index 03b25f9359f8..a0579e859b21 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S | |||
@@ -714,6 +714,7 @@ AltiVecUnavailable: | |||
714 | #ifdef CONFIG_ALTIVEC | 714 | #ifdef CONFIG_ALTIVEC |
715 | bne load_up_altivec /* if from user, just load it up */ | 715 | bne load_up_altivec /* if from user, just load it up */ |
716 | #endif /* CONFIG_ALTIVEC */ | 716 | #endif /* CONFIG_ALTIVEC */ |
717 | addi r3,r1,STACK_FRAME_OVERHEAD | ||
717 | EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) | 718 | EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) |
718 | 719 | ||
719 | PerformanceMonitor: | 720 | PerformanceMonitor: |
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 2b03a09fe5e9..11f2cd5af7dc 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -139,7 +139,7 @@ _GLOBAL(__secondary_hold) | |||
139 | ori r24,r24,MSR_RI | 139 | ori r24,r24,MSR_RI |
140 | mtmsrd r24 /* RI on */ | 140 | mtmsrd r24 /* RI on */ |
141 | 141 | ||
142 | /* Grab our linux cpu number */ | 142 | /* Grab our physical cpu number */ |
143 | mr r24,r3 | 143 | mr r24,r3 |
144 | 144 | ||
145 | /* Tell the master cpu we're here */ | 145 | /* Tell the master cpu we're here */ |
@@ -153,11 +153,7 @@ _GLOBAL(__secondary_hold) | |||
153 | cmpdi 0,r4,1 | 153 | cmpdi 0,r4,1 |
154 | bne 100b | 154 | bne 100b |
155 | 155 | ||
156 | #ifdef CONFIG_HMT | 156 | #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) |
157 | SET_REG_IMMEDIATE(r4, .hmt_init) | ||
158 | mtctr r4 | ||
159 | bctr | ||
160 | #elif defined(CONFIG_SMP) || defined(CONFIG_KEXEC) | ||
161 | LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init) | 157 | LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init) |
162 | mtctr r4 | 158 | mtctr r4 |
163 | mr r3,r24 | 159 | mr r3,r24 |
@@ -319,7 +315,6 @@ exception_marker: | |||
319 | label##_pSeries: \ | 315 | label##_pSeries: \ |
320 | HMT_MEDIUM; \ | 316 | HMT_MEDIUM; \ |
321 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ | 317 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ |
322 | RUNLATCH_ON(r13); \ | ||
323 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) | 318 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) |
324 | 319 | ||
325 | #define STD_EXCEPTION_ISERIES(n, label, area) \ | 320 | #define STD_EXCEPTION_ISERIES(n, label, area) \ |
@@ -327,7 +322,6 @@ label##_pSeries: \ | |||
327 | label##_iSeries: \ | 322 | label##_iSeries: \ |
328 | HMT_MEDIUM; \ | 323 | HMT_MEDIUM; \ |
329 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ | 324 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ |
330 | RUNLATCH_ON(r13); \ | ||
331 | EXCEPTION_PROLOG_ISERIES_1(area); \ | 325 | EXCEPTION_PROLOG_ISERIES_1(area); \ |
332 | EXCEPTION_PROLOG_ISERIES_2; \ | 326 | EXCEPTION_PROLOG_ISERIES_2; \ |
333 | b label##_common | 327 | b label##_common |
@@ -337,7 +331,6 @@ label##_iSeries: \ | |||
337 | label##_iSeries: \ | 331 | label##_iSeries: \ |
338 | HMT_MEDIUM; \ | 332 | HMT_MEDIUM; \ |
339 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ | 333 | mtspr SPRN_SPRG1,r13; /* save r13 */ \ |
340 | RUNLATCH_ON(r13); \ | ||
341 | EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \ | 334 | EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \ |
342 | lbz r10,PACAPROCENABLED(r13); \ | 335 | lbz r10,PACAPROCENABLED(r13); \ |
343 | cmpwi 0,r10,0; \ | 336 | cmpwi 0,r10,0; \ |
@@ -390,6 +383,7 @@ label##_common: \ | |||
390 | label##_common: \ | 383 | label##_common: \ |
391 | EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ | 384 | EXCEPTION_PROLOG_COMMON(trap, PACA_EXGEN); \ |
392 | DISABLE_INTS; \ | 385 | DISABLE_INTS; \ |
386 | bl .ppc64_runlatch_on; \ | ||
393 | addi r3,r1,STACK_FRAME_OVERHEAD; \ | 387 | addi r3,r1,STACK_FRAME_OVERHEAD; \ |
394 | bl hdlr; \ | 388 | bl hdlr; \ |
395 | b .ret_from_except_lite | 389 | b .ret_from_except_lite |
@@ -407,7 +401,6 @@ __start_interrupts: | |||
407 | _machine_check_pSeries: | 401 | _machine_check_pSeries: |
408 | HMT_MEDIUM | 402 | HMT_MEDIUM |
409 | mtspr SPRN_SPRG1,r13 /* save r13 */ | 403 | mtspr SPRN_SPRG1,r13 /* save r13 */ |
410 | RUNLATCH_ON(r13) | ||
411 | EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) | 404 | EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) |
412 | 405 | ||
413 | . = 0x300 | 406 | . = 0x300 |
@@ -434,7 +427,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB) | |||
434 | data_access_slb_pSeries: | 427 | data_access_slb_pSeries: |
435 | HMT_MEDIUM | 428 | HMT_MEDIUM |
436 | mtspr SPRN_SPRG1,r13 | 429 | mtspr SPRN_SPRG1,r13 |
437 | RUNLATCH_ON(r13) | ||
438 | mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ | 430 | mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ |
439 | std r3,PACA_EXSLB+EX_R3(r13) | 431 | std r3,PACA_EXSLB+EX_R3(r13) |
440 | mfspr r3,SPRN_DAR | 432 | mfspr r3,SPRN_DAR |
@@ -460,7 +452,6 @@ data_access_slb_pSeries: | |||
460 | instruction_access_slb_pSeries: | 452 | instruction_access_slb_pSeries: |
461 | HMT_MEDIUM | 453 | HMT_MEDIUM |
462 | mtspr SPRN_SPRG1,r13 | 454 | mtspr SPRN_SPRG1,r13 |
463 | RUNLATCH_ON(r13) | ||
464 | mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ | 455 | mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ |
465 | std r3,PACA_EXSLB+EX_R3(r13) | 456 | std r3,PACA_EXSLB+EX_R3(r13) |
466 | mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ | 457 | mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */ |
@@ -491,7 +482,6 @@ instruction_access_slb_pSeries: | |||
491 | .globl system_call_pSeries | 482 | .globl system_call_pSeries |
492 | system_call_pSeries: | 483 | system_call_pSeries: |
493 | HMT_MEDIUM | 484 | HMT_MEDIUM |
494 | RUNLATCH_ON(r9) | ||
495 | mr r9,r13 | 485 | mr r9,r13 |
496 | mfmsr r10 | 486 | mfmsr r10 |
497 | mfspr r13,SPRN_SPRG3 | 487 | mfspr r13,SPRN_SPRG3 |
@@ -575,7 +565,6 @@ slb_miss_user_pseries: | |||
575 | system_reset_fwnmi: | 565 | system_reset_fwnmi: |
576 | HMT_MEDIUM | 566 | HMT_MEDIUM |
577 | mtspr SPRN_SPRG1,r13 /* save r13 */ | 567 | mtspr SPRN_SPRG1,r13 /* save r13 */ |
578 | RUNLATCH_ON(r13) | ||
579 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) | 568 | EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) |
580 | 569 | ||
581 | .globl machine_check_fwnmi | 570 | .globl machine_check_fwnmi |
@@ -583,7 +572,6 @@ system_reset_fwnmi: | |||
583 | machine_check_fwnmi: | 572 | machine_check_fwnmi: |
584 | HMT_MEDIUM | 573 | HMT_MEDIUM |
585 | mtspr SPRN_SPRG1,r13 /* save r13 */ | 574 | mtspr SPRN_SPRG1,r13 /* save r13 */ |
586 | RUNLATCH_ON(r13) | ||
587 | EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) | 575 | EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) |
588 | 576 | ||
589 | #ifdef CONFIG_PPC_ISERIES | 577 | #ifdef CONFIG_PPC_ISERIES |
@@ -894,7 +882,6 @@ unrecov_fer: | |||
894 | .align 7 | 882 | .align 7 |
895 | .globl data_access_common | 883 | .globl data_access_common |
896 | data_access_common: | 884 | data_access_common: |
897 | RUNLATCH_ON(r10) /* It wont fit in the 0x300 handler */ | ||
898 | mfspr r10,SPRN_DAR | 885 | mfspr r10,SPRN_DAR |
899 | std r10,PACA_EXGEN+EX_DAR(r13) | 886 | std r10,PACA_EXGEN+EX_DAR(r13) |
900 | mfspr r10,SPRN_DSISR | 887 | mfspr r10,SPRN_DSISR |
@@ -1042,6 +1029,7 @@ hardware_interrupt_common: | |||
1042 | EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN) | 1029 | EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN) |
1043 | hardware_interrupt_entry: | 1030 | hardware_interrupt_entry: |
1044 | DISABLE_INTS | 1031 | DISABLE_INTS |
1032 | bl .ppc64_runlatch_on | ||
1045 | addi r3,r1,STACK_FRAME_OVERHEAD | 1033 | addi r3,r1,STACK_FRAME_OVERHEAD |
1046 | bl .do_IRQ | 1034 | bl .do_IRQ |
1047 | b .ret_from_except_lite | 1035 | b .ret_from_except_lite |
@@ -1816,22 +1804,6 @@ _STATIC(start_here_multiplatform) | |||
1816 | ori r6,r6,MSR_RI | 1804 | ori r6,r6,MSR_RI |
1817 | mtmsrd r6 /* RI on */ | 1805 | mtmsrd r6 /* RI on */ |
1818 | 1806 | ||
1819 | #ifdef CONFIG_HMT | ||
1820 | /* Start up the second thread on cpu 0 */ | ||
1821 | mfspr r3,SPRN_PVR | ||
1822 | srwi r3,r3,16 | ||
1823 | cmpwi r3,0x34 /* Pulsar */ | ||
1824 | beq 90f | ||
1825 | cmpwi r3,0x36 /* Icestar */ | ||
1826 | beq 90f | ||
1827 | cmpwi r3,0x37 /* SStar */ | ||
1828 | beq 90f | ||
1829 | b 91f /* HMT not supported */ | ||
1830 | 90: li r3,0 | ||
1831 | bl .hmt_start_secondary | ||
1832 | 91: | ||
1833 | #endif | ||
1834 | |||
1835 | /* The following gets the stack and TOC set up with the regs */ | 1807 | /* The following gets the stack and TOC set up with the regs */ |
1836 | /* pointing to the real addr of the kernel stack. This is */ | 1808 | /* pointing to the real addr of the kernel stack. This is */ |
1837 | /* all done to support the C function call below which sets */ | 1809 | /* all done to support the C function call below which sets */ |
@@ -1945,77 +1917,8 @@ _STATIC(start_here_common) | |||
1945 | 1917 | ||
1946 | bl .start_kernel | 1918 | bl .start_kernel |
1947 | 1919 | ||
1948 | _GLOBAL(hmt_init) | 1920 | /* Not reached */ |
1949 | #ifdef CONFIG_HMT | 1921 | BUG_OPCODE |
1950 | LOAD_REG_IMMEDIATE(r5, hmt_thread_data) | ||
1951 | mfspr r7,SPRN_PVR | ||
1952 | srwi r7,r7,16 | ||
1953 | cmpwi r7,0x34 /* Pulsar */ | ||
1954 | beq 90f | ||
1955 | cmpwi r7,0x36 /* Icestar */ | ||
1956 | beq 91f | ||
1957 | cmpwi r7,0x37 /* SStar */ | ||
1958 | beq 91f | ||
1959 | b 101f | ||
1960 | 90: mfspr r6,SPRN_PIR | ||
1961 | andi. r6,r6,0x1f | ||
1962 | b 92f | ||
1963 | 91: mfspr r6,SPRN_PIR | ||
1964 | andi. r6,r6,0x3ff | ||
1965 | 92: sldi r4,r24,3 | ||
1966 | stwx r6,r5,r4 | ||
1967 | bl .hmt_start_secondary | ||
1968 | b 101f | ||
1969 | |||
1970 | __hmt_secondary_hold: | ||
1971 | LOAD_REG_IMMEDIATE(r5, hmt_thread_data) | ||
1972 | clrldi r5,r5,4 | ||
1973 | li r7,0 | ||
1974 | mfspr r6,SPRN_PIR | ||
1975 | mfspr r8,SPRN_PVR | ||
1976 | srwi r8,r8,16 | ||
1977 | cmpwi r8,0x34 | ||
1978 | bne 93f | ||
1979 | andi. r6,r6,0x1f | ||
1980 | b 103f | ||
1981 | 93: andi. r6,r6,0x3f | ||
1982 | |||
1983 | 103: lwzx r8,r5,r7 | ||
1984 | cmpw r8,r6 | ||
1985 | beq 104f | ||
1986 | addi r7,r7,8 | ||
1987 | b 103b | ||
1988 | |||
1989 | 104: addi r7,r7,4 | ||
1990 | lwzx r9,r5,r7 | ||
1991 | mr r24,r9 | ||
1992 | 101: | ||
1993 | #endif | ||
1994 | mr r3,r24 | ||
1995 | b .pSeries_secondary_smp_init | ||
1996 | |||
1997 | #ifdef CONFIG_HMT | ||
1998 | _GLOBAL(hmt_start_secondary) | ||
1999 | LOAD_REG_IMMEDIATE(r4,__hmt_secondary_hold) | ||
2000 | clrldi r4,r4,4 | ||
2001 | mtspr SPRN_NIADORM, r4 | ||
2002 | mfspr r4, SPRN_MSRDORM | ||
2003 | li r5, -65 | ||
2004 | and r4, r4, r5 | ||
2005 | mtspr SPRN_MSRDORM, r4 | ||
2006 | lis r4,0xffef | ||
2007 | ori r4,r4,0x7403 | ||
2008 | mtspr SPRN_TSC, r4 | ||
2009 | li r4,0x1f4 | ||
2010 | mtspr SPRN_TST, r4 | ||
2011 | mfspr r4, SPRN_HID0 | ||
2012 | ori r4, r4, 0x1 | ||
2013 | mtspr SPRN_HID0, r4 | ||
2014 | mfspr r4, SPRN_CTRLF | ||
2015 | oris r4, r4, 0x40 | ||
2016 | mtspr SPRN_CTRLT, r4 | ||
2017 | blr | ||
2018 | #endif | ||
2019 | 1922 | ||
2020 | /* | 1923 | /* |
2021 | * We put a few things here that have to be page-aligned. | 1924 | * We put a few things here that have to be page-aligned. |
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index d6431440c54f..ee166c586642 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c | |||
@@ -26,8 +26,6 @@ | |||
26 | #include <asm/prom.h> | 26 | #include <asm/prom.h> |
27 | #include <asm/smp.h> | 27 | #include <asm/smp.h> |
28 | 28 | ||
29 | #define HASH_GROUP_SIZE 0x80 /* size of each hash group, asm/mmu.h */ | ||
30 | |||
31 | int default_machine_kexec_prepare(struct kimage *image) | 29 | int default_machine_kexec_prepare(struct kimage *image) |
32 | { | 30 | { |
33 | int i; | 31 | int i; |
@@ -61,7 +59,7 @@ int default_machine_kexec_prepare(struct kimage *image) | |||
61 | */ | 59 | */ |
62 | if (htab_address) { | 60 | if (htab_address) { |
63 | low = __pa(htab_address); | 61 | low = __pa(htab_address); |
64 | high = low + (htab_hash_mask + 1) * HASH_GROUP_SIZE; | 62 | high = low + htab_size_bytes; |
65 | 63 | ||
66 | for (i = 0; i < image->nr_segments; i++) { | 64 | for (i = 0; i < image->nr_segments; i++) { |
67 | begin = image->segment[i].mem; | 65 | begin = image->segment[i].mem; |
@@ -294,7 +292,7 @@ void default_machine_kexec(struct kimage *image) | |||
294 | } | 292 | } |
295 | 293 | ||
296 | /* Values we need to export to the second kernel via the device tree. */ | 294 | /* Values we need to export to the second kernel via the device tree. */ |
297 | static unsigned long htab_base, htab_size, kernel_end; | 295 | static unsigned long htab_base, kernel_end; |
298 | 296 | ||
299 | static struct property htab_base_prop = { | 297 | static struct property htab_base_prop = { |
300 | .name = "linux,htab-base", | 298 | .name = "linux,htab-base", |
@@ -305,7 +303,7 @@ static struct property htab_base_prop = { | |||
305 | static struct property htab_size_prop = { | 303 | static struct property htab_size_prop = { |
306 | .name = "linux,htab-size", | 304 | .name = "linux,htab-size", |
307 | .length = sizeof(unsigned long), | 305 | .length = sizeof(unsigned long), |
308 | .value = (unsigned char *)&htab_size, | 306 | .value = (unsigned char *)&htab_size_bytes, |
309 | }; | 307 | }; |
310 | 308 | ||
311 | static struct property kernel_end_prop = { | 309 | static struct property kernel_end_prop = { |
@@ -331,8 +329,6 @@ static void __init export_htab_values(void) | |||
331 | 329 | ||
332 | htab_base = __pa(htab_address); | 330 | htab_base = __pa(htab_address); |
333 | prom_add_property(node, &htab_base_prop); | 331 | prom_add_property(node, &htab_base_prop); |
334 | |||
335 | htab_size = 1UL << ppc64_pft_size; | ||
336 | prom_add_property(node, &htab_size_prop); | 332 | prom_add_property(node, &htab_size_prop); |
337 | 333 | ||
338 | out: | 334 | out: |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 57703994a063..c225cf154bfe 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -888,3 +888,35 @@ void dump_stack(void) | |||
888 | show_stack(current, NULL); | 888 | show_stack(current, NULL); |
889 | } | 889 | } |
890 | EXPORT_SYMBOL(dump_stack); | 890 | EXPORT_SYMBOL(dump_stack); |
891 | |||
892 | #ifdef CONFIG_PPC64 | ||
893 | void ppc64_runlatch_on(void) | ||
894 | { | ||
895 | unsigned long ctrl; | ||
896 | |||
897 | if (cpu_has_feature(CPU_FTR_CTRL) && !test_thread_flag(TIF_RUNLATCH)) { | ||
898 | HMT_medium(); | ||
899 | |||
900 | ctrl = mfspr(SPRN_CTRLF); | ||
901 | ctrl |= CTRL_RUNLATCH; | ||
902 | mtspr(SPRN_CTRLT, ctrl); | ||
903 | |||
904 | set_thread_flag(TIF_RUNLATCH); | ||
905 | } | ||
906 | } | ||
907 | |||
908 | void ppc64_runlatch_off(void) | ||
909 | { | ||
910 | unsigned long ctrl; | ||
911 | |||
912 | if (cpu_has_feature(CPU_FTR_CTRL) && test_thread_flag(TIF_RUNLATCH)) { | ||
913 | HMT_medium(); | ||
914 | |||
915 | clear_thread_flag(TIF_RUNLATCH); | ||
916 | |||
917 | ctrl = mfspr(SPRN_CTRLF); | ||
918 | ctrl &= ~CTRL_RUNLATCH; | ||
919 | mtspr(SPRN_CTRLT, ctrl); | ||
920 | } | ||
921 | } | ||
922 | #endif | ||
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 294832a7e0a6..6dbd21726770 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -816,8 +816,6 @@ void __init unflatten_device_tree(void) | |||
816 | { | 816 | { |
817 | unsigned long start, mem, size; | 817 | unsigned long start, mem, size; |
818 | struct device_node **allnextp = &allnodes; | 818 | struct device_node **allnextp = &allnodes; |
819 | char *p = NULL; | ||
820 | int l = 0; | ||
821 | 819 | ||
822 | DBG(" -> unflatten_device_tree()\n"); | 820 | DBG(" -> unflatten_device_tree()\n"); |
823 | 821 | ||
@@ -857,19 +855,6 @@ void __init unflatten_device_tree(void) | |||
857 | if (of_chosen == NULL) | 855 | if (of_chosen == NULL) |
858 | of_chosen = of_find_node_by_path("/chosen@0"); | 856 | of_chosen = of_find_node_by_path("/chosen@0"); |
859 | 857 | ||
860 | /* Retreive command line */ | ||
861 | if (of_chosen != NULL) { | ||
862 | p = (char *)get_property(of_chosen, "bootargs", &l); | ||
863 | if (p != NULL && l > 0) | ||
864 | strlcpy(cmd_line, p, min(l, COMMAND_LINE_SIZE)); | ||
865 | } | ||
866 | #ifdef CONFIG_CMDLINE | ||
867 | if (l == 0 || (l == 1 && (*p) == 0)) | ||
868 | strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
869 | #endif /* CONFIG_CMDLINE */ | ||
870 | |||
871 | DBG("Command line is: %s\n", cmd_line); | ||
872 | |||
873 | DBG(" <- unflatten_device_tree()\n"); | 858 | DBG(" <- unflatten_device_tree()\n"); |
874 | } | 859 | } |
875 | 860 | ||
@@ -940,6 +925,8 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
940 | { | 925 | { |
941 | u32 *prop; | 926 | u32 *prop; |
942 | unsigned long *lprop; | 927 | unsigned long *lprop; |
928 | unsigned long l; | ||
929 | char *p; | ||
943 | 930 | ||
944 | DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); | 931 | DBG("search \"chosen\", depth: %d, uname: %s\n", depth, uname); |
945 | 932 | ||
@@ -1004,6 +991,41 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
1004 | crashk_res.end = crashk_res.start + *lprop - 1; | 991 | crashk_res.end = crashk_res.start + *lprop - 1; |
1005 | #endif | 992 | #endif |
1006 | 993 | ||
994 | /* Retreive command line */ | ||
995 | p = of_get_flat_dt_prop(node, "bootargs", &l); | ||
996 | if (p != NULL && l > 0) | ||
997 | strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE)); | ||
998 | |||
999 | #ifdef CONFIG_CMDLINE | ||
1000 | if (l == 0 || (l == 1 && (*p) == 0)) | ||
1001 | strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
1002 | #endif /* CONFIG_CMDLINE */ | ||
1003 | |||
1004 | DBG("Command line is: %s\n", cmd_line); | ||
1005 | |||
1006 | if (strstr(cmd_line, "mem=")) { | ||
1007 | char *p, *q; | ||
1008 | unsigned long maxmem = 0; | ||
1009 | |||
1010 | for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) { | ||
1011 | q = p + 4; | ||
1012 | if (p > cmd_line && p[-1] != ' ') | ||
1013 | continue; | ||
1014 | maxmem = simple_strtoul(q, &q, 0); | ||
1015 | if (*q == 'k' || *q == 'K') { | ||
1016 | maxmem <<= 10; | ||
1017 | ++q; | ||
1018 | } else if (*q == 'm' || *q == 'M') { | ||
1019 | maxmem <<= 20; | ||
1020 | ++q; | ||
1021 | } else if (*q == 'g' || *q == 'G') { | ||
1022 | maxmem <<= 30; | ||
1023 | ++q; | ||
1024 | } | ||
1025 | } | ||
1026 | memory_limit = maxmem; | ||
1027 | } | ||
1028 | |||
1007 | /* break now */ | 1029 | /* break now */ |
1008 | return 1; | 1030 | return 1; |
1009 | } | 1031 | } |
@@ -1124,7 +1146,7 @@ static void __init early_reserve_mem(void) | |||
1124 | size_32 = *(reserve_map_32++); | 1146 | size_32 = *(reserve_map_32++); |
1125 | if (size_32 == 0) | 1147 | if (size_32 == 0) |
1126 | break; | 1148 | break; |
1127 | DBG("reserving: %lx -> %lx\n", base_32, size_32); | 1149 | DBG("reserving: %x -> %x\n", base_32, size_32); |
1128 | lmb_reserve(base_32, size_32); | 1150 | lmb_reserve(base_32, size_32); |
1129 | } | 1151 | } |
1130 | return; | 1152 | return; |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index ec7153f4d47c..d34fe537400e 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -205,14 +205,6 @@ static cell_t __initdata regbuf[1024]; | |||
205 | 205 | ||
206 | #define MAX_CPU_THREADS 2 | 206 | #define MAX_CPU_THREADS 2 |
207 | 207 | ||
208 | /* TO GO */ | ||
209 | #ifdef CONFIG_HMT | ||
210 | struct { | ||
211 | unsigned int pir; | ||
212 | unsigned int threadid; | ||
213 | } hmt_thread_data[NR_CPUS]; | ||
214 | #endif /* CONFIG_HMT */ | ||
215 | |||
216 | /* | 208 | /* |
217 | * Error results ... some OF calls will return "-1" on error, some | 209 | * Error results ... some OF calls will return "-1" on error, some |
218 | * will return 0, some will return either. To simplify, here are | 210 | * will return 0, some will return either. To simplify, here are |
@@ -1319,10 +1311,6 @@ static void __init prom_hold_cpus(void) | |||
1319 | */ | 1311 | */ |
1320 | *spinloop = 0; | 1312 | *spinloop = 0; |
1321 | 1313 | ||
1322 | #ifdef CONFIG_HMT | ||
1323 | for (i = 0; i < NR_CPUS; i++) | ||
1324 | RELOC(hmt_thread_data)[i].pir = 0xdeadbeef; | ||
1325 | #endif | ||
1326 | /* look for cpus */ | 1314 | /* look for cpus */ |
1327 | for (node = 0; prom_next_node(&node); ) { | 1315 | for (node = 0; prom_next_node(&node); ) { |
1328 | type[0] = 0; | 1316 | type[0] = 0; |
@@ -1389,32 +1377,6 @@ static void __init prom_hold_cpus(void) | |||
1389 | /* Reserve cpu #s for secondary threads. They start later. */ | 1377 | /* Reserve cpu #s for secondary threads. They start later. */ |
1390 | cpuid += cpu_threads; | 1378 | cpuid += cpu_threads; |
1391 | } | 1379 | } |
1392 | #ifdef CONFIG_HMT | ||
1393 | /* Only enable HMT on processors that provide support. */ | ||
1394 | if (__is_processor(PV_PULSAR) || | ||
1395 | __is_processor(PV_ICESTAR) || | ||
1396 | __is_processor(PV_SSTAR)) { | ||
1397 | prom_printf(" starting secondary threads\n"); | ||
1398 | |||
1399 | for (i = 0; i < NR_CPUS; i += 2) { | ||
1400 | if (!cpu_online(i)) | ||
1401 | continue; | ||
1402 | |||
1403 | if (i == 0) { | ||
1404 | unsigned long pir = mfspr(SPRN_PIR); | ||
1405 | if (__is_processor(PV_PULSAR)) { | ||
1406 | RELOC(hmt_thread_data)[i].pir = | ||
1407 | pir & 0x1f; | ||
1408 | } else { | ||
1409 | RELOC(hmt_thread_data)[i].pir = | ||
1410 | pir & 0x3ff; | ||
1411 | } | ||
1412 | } | ||
1413 | } | ||
1414 | } else { | ||
1415 | prom_printf("Processor is not HMT capable\n"); | ||
1416 | } | ||
1417 | #endif | ||
1418 | 1380 | ||
1419 | if (cpuid > NR_CPUS) | 1381 | if (cpuid > NR_CPUS) |
1420 | prom_printf("WARNING: maximum CPUs (" __stringify(NR_CPUS) | 1382 | prom_printf("WARNING: maximum CPUs (" __stringify(NR_CPUS) |