aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2007-08-21 23:44:58 -0400
committerPaul Mackerras <paulus@samba.org>2007-08-22 02:48:34 -0400
commitfc68e8699f1f987060ef817cff6a13a7cd7d4c8a (patch)
tree1b5735b9669b177815eb8b2aa469b25318254265 /arch
parentdc559f7cd5d6d11a99b6c29402b31fbb3f3a1db0 (diff)
[POWERPC] Move iSeries startup code out of head_64.S
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/head_64.S86
-rw-r--r--arch/powerpc/platforms/iseries/Makefile1
-rw-r--r--arch/powerpc/platforms/iseries/exception.S114
3 files changed, 117 insertions, 84 deletions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 1e6d9cc06ca0..97f089b30316 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -802,56 +802,6 @@ system_call_iSeries:
802 STD_EXCEPTION_ISERIES( 0xe00, trap_0e, PACA_EXGEN) 802 STD_EXCEPTION_ISERIES( 0xe00, trap_0e, PACA_EXGEN)
803 STD_EXCEPTION_ISERIES( 0xf00, performance_monitor, PACA_EXGEN) 803 STD_EXCEPTION_ISERIES( 0xf00, performance_monitor, PACA_EXGEN)
804 804
805 .globl system_reset_iSeries
806system_reset_iSeries:
807 mfspr r13,SPRN_SPRG3 /* Get paca address */
808 mfmsr r24
809 ori r24,r24,MSR_RI
810 mtmsrd r24 /* RI on */
811 lhz r24,PACAPACAINDEX(r13) /* Get processor # */
812 cmpwi 0,r24,0 /* Are we processor 0? */
813 bne 1f
814 b .__start_initialization_iSeries /* Start up the first processor */
8151: mfspr r4,SPRN_CTRLF
816 li r5,CTRL_RUNLATCH /* Turn off the run light */
817 andc r4,r4,r5
818 mtspr SPRN_CTRLT,r4
819
8201:
821 HMT_LOW
822#ifdef CONFIG_SMP
823 lbz r23,PACAPROCSTART(r13) /* Test if this processor
824 * should start */
825 sync
826 LOAD_REG_IMMEDIATE(r3,current_set)
827 sldi r28,r24,3 /* get current_set[cpu#] */
828 ldx r3,r3,r28
829 addi r1,r3,THREAD_SIZE
830 subi r1,r1,STACK_FRAME_OVERHEAD
831
832 cmpwi 0,r23,0
833 beq iSeries_secondary_smp_loop /* Loop until told to go */
834 bne __secondary_start /* Loop until told to go */
835iSeries_secondary_smp_loop:
836 /* Let the Hypervisor know we are alive */
837 /* 8002 is a call to HvCallCfg::getLps, a harmless Hypervisor function */
838 lis r3,0x8002
839 rldicr r3,r3,32,15 /* r0 = (r3 << 32) & 0xffff000000000000 */
840#else /* CONFIG_SMP */
841 /* Yield the processor. This is required for non-SMP kernels
842 which are running on multi-threaded machines. */
843 lis r3,0x8000
844 rldicr r3,r3,32,15 /* r3 = (r3 << 32) & 0xffff000000000000 */
845 addi r3,r3,18 /* r3 = 0x8000000000000012 which is "yield" */
846 li r4,0 /* "yield timed" */
847 li r5,-1 /* "yield forever" */
848#endif /* CONFIG_SMP */
849 li r0,-1 /* r0=-1 indicates a Hypervisor call */
850 sc /* Invoke the hypervisor via a system call */
851 mfspr r13,SPRN_SPRG3 /* Put r13 back ???? */
852 b 1b /* If SMP not configured, secondaries
853 * loop forever */
854
855decrementer_iSeries_masked: 805decrementer_iSeries_masked:
856 /* We may not have a valid TOC pointer in here. */ 806 /* We may not have a valid TOC pointer in here. */
857 li r11,1 807 li r11,1
@@ -1622,39 +1572,6 @@ _GLOBAL(generic_secondary_smp_init)
1622 b __secondary_start 1572 b __secondary_start
1623#endif 1573#endif
1624 1574
1625#ifdef CONFIG_PPC_ISERIES
1626_INIT_STATIC(__start_initialization_iSeries)
1627 /* Clear out the BSS */
1628 LOAD_REG_IMMEDIATE(r11,__bss_stop)
1629 LOAD_REG_IMMEDIATE(r8,__bss_start)
1630 sub r11,r11,r8 /* bss size */
1631 addi r11,r11,7 /* round up to an even double word */
1632 rldicl. r11,r11,61,3 /* shift right by 3 */
1633 beq 4f
1634 addi r8,r8,-8
1635 li r0,0
1636 mtctr r11 /* zero this many doublewords */
16373: stdu r0,8(r8)
1638 bdnz 3b
16394:
1640 LOAD_REG_IMMEDIATE(r1,init_thread_union)
1641 addi r1,r1,THREAD_SIZE
1642 li r0,0
1643 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1644
1645 LOAD_REG_IMMEDIATE(r2,__toc_start)
1646 addi r2,r2,0x4000
1647 addi r2,r2,0x4000
1648
1649 bl .iSeries_early_setup
1650 bl .early_setup
1651
1652 /* relocation is on at this point */
1653
1654 b .start_here_common
1655#endif /* CONFIG_PPC_ISERIES */
1656
1657
1658_STATIC(__mmu_off) 1575_STATIC(__mmu_off)
1659 mfmsr r3 1576 mfmsr r3
1660 andi. r0,r3,MSR_IR|MSR_DR 1577 andi. r0,r3,MSR_IR|MSR_DR
@@ -1902,6 +1819,7 @@ _GLOBAL(pmac_secondary_start)
1902 * r13 = paca virtual address 1819 * r13 = paca virtual address
1903 * SPRG3 = paca virtual address 1820 * SPRG3 = paca virtual address
1904 */ 1821 */
1822 .globl __secondary_start
1905__secondary_start: 1823__secondary_start:
1906 /* Set thread priority to MEDIUM */ 1824 /* Set thread priority to MEDIUM */
1907 HMT_MEDIUM 1825 HMT_MEDIUM
@@ -2032,7 +1950,7 @@ _INIT_STATIC(start_here_multiplatform)
2032 b . /* prevent speculative execution */ 1950 b . /* prevent speculative execution */
2033 1951
2034 /* This is where all platforms converge execution */ 1952 /* This is where all platforms converge execution */
2035_INIT_STATIC(start_here_common) 1953_INIT_GLOBAL(start_here_common)
2036 /* relocation is on at this point */ 1954 /* relocation is on at this point */
2037 1955
2038 /* The following code sets up the SP and TOC now that we are */ 1956 /* The following code sets up the SP and TOC now that we are */
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index 13ac3015d91c..60db509638f1 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -2,6 +2,7 @@ EXTRA_CFLAGS += -mno-minimal-toc
2 2
3extra-y += dt.o 3extra-y += dt.o
4 4
5obj-y += exception.o
5obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \ 6obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o dt_mod.o mf.o lpevents.o \
6 hvcall.o proc.o htab.o iommu.o misc.o irq.o 7 hvcall.o proc.o htab.o iommu.o misc.o irq.o
7obj-$(CONFIG_PCI) += pci.o vpdinfo.o 8obj-$(CONFIG_PCI) += pci.o vpdinfo.o
diff --git a/arch/powerpc/platforms/iseries/exception.S b/arch/powerpc/platforms/iseries/exception.S
new file mode 100644
index 000000000000..b6e2f8c0b093
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/exception.S
@@ -0,0 +1,114 @@
1/*
2 * Low level routines for legacy iSeries support.
3 *
4 * Extracted from head_64.S
5 *
6 * PowerPC version
7 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
8 *
9 * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
10 * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
11 * Adapted for Power Macintosh by Paul Mackerras.
12 * Low-level exception handlers and MMU support
13 * rewritten by Paul Mackerras.
14 * Copyright (C) 1996 Paul Mackerras.
15 *
16 * Adapted for 64bit PowerPC by Dave Engebretsen, Peter Bergner, and
17 * Mike Corrigan {engebret|bergner|mikejc}@us.ibm.com
18 *
19 * This file contains the low-level support and setup for the
20 * PowerPC-64 platform, including trap and interrupt dispatch.
21 *
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * as published by the Free Software Foundation; either version
25 * 2 of the License, or (at your option) any later version.
26 */
27
28#include <asm/reg.h>
29#include <asm/ppc_asm.h>
30#include <asm/asm-offsets.h>
31#include <asm/thread_info.h>
32#include <asm/ptrace.h>
33
34 .text
35
36 .globl system_reset_iSeries
37system_reset_iSeries:
38 mfspr r13,SPRN_SPRG3 /* Get paca address */
39 mfmsr r24
40 ori r24,r24,MSR_RI
41 mtmsrd r24 /* RI on */
42 lhz r24,PACAPACAINDEX(r13) /* Get processor # */
43 cmpwi 0,r24,0 /* Are we processor 0? */
44 bne 1f
45 b .__start_initialization_iSeries /* Start up the first processor */
461: mfspr r4,SPRN_CTRLF
47 li r5,CTRL_RUNLATCH /* Turn off the run light */
48 andc r4,r4,r5
49 mtspr SPRN_CTRLT,r4
50
511:
52 HMT_LOW
53#ifdef CONFIG_SMP
54 lbz r23,PACAPROCSTART(r13) /* Test if this processor
55 * should start */
56 sync
57 LOAD_REG_IMMEDIATE(r3,current_set)
58 sldi r28,r24,3 /* get current_set[cpu#] */
59 ldx r3,r3,r28
60 addi r1,r3,THREAD_SIZE
61 subi r1,r1,STACK_FRAME_OVERHEAD
62
63 cmpwi 0,r23,0
64 beq iSeries_secondary_smp_loop /* Loop until told to go */
65 b __secondary_start /* Loop until told to go */
66iSeries_secondary_smp_loop:
67 /* Let the Hypervisor know we are alive */
68 /* 8002 is a call to HvCallCfg::getLps, a harmless Hypervisor function */
69 lis r3,0x8002
70 rldicr r3,r3,32,15 /* r0 = (r3 << 32) & 0xffff000000000000 */
71#else /* CONFIG_SMP */
72 /* Yield the processor. This is required for non-SMP kernels
73 which are running on multi-threaded machines. */
74 lis r3,0x8000
75 rldicr r3,r3,32,15 /* r3 = (r3 << 32) & 0xffff000000000000 */
76 addi r3,r3,18 /* r3 = 0x8000000000000012 which is "yield" */
77 li r4,0 /* "yield timed" */
78 li r5,-1 /* "yield forever" */
79#endif /* CONFIG_SMP */
80 li r0,-1 /* r0=-1 indicates a Hypervisor call */
81 sc /* Invoke the hypervisor via a system call */
82 mfspr r13,SPRN_SPRG3 /* Put r13 back ???? */
83 b 1b /* If SMP not configured, secondaries
84 * loop forever */
85
86_INIT_STATIC(__start_initialization_iSeries)
87 /* Clear out the BSS */
88 LOAD_REG_IMMEDIATE(r11,__bss_stop)
89 LOAD_REG_IMMEDIATE(r8,__bss_start)
90 sub r11,r11,r8 /* bss size */
91 addi r11,r11,7 /* round up to an even double word */
92 rldicl. r11,r11,61,3 /* shift right by 3 */
93 beq 4f
94 addi r8,r8,-8
95 li r0,0
96 mtctr r11 /* zero this many doublewords */
973: stdu r0,8(r8)
98 bdnz 3b
994:
100 LOAD_REG_IMMEDIATE(r1,init_thread_union)
101 addi r1,r1,THREAD_SIZE
102 li r0,0
103 stdu r0,-STACK_FRAME_OVERHEAD(r1)
104
105 LOAD_REG_IMMEDIATE(r2,__toc_start)
106 addi r2,r2,0x4000
107 addi r2,r2,0x4000
108
109 bl .iSeries_early_setup
110 bl .early_setup
111
112 /* relocation is on at this point */
113
114 b .start_here_common