diff options
Diffstat (limited to 'arch/powerpc/kernel/paca.c')
-rw-r--r-- | arch/powerpc/kernel/paca.c | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c new file mode 100644 index 000000000000..a7b68f911eb1 --- /dev/null +++ b/arch/powerpc/kernel/paca.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * c 2001 PPC 64 Team, IBM Corp | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/config.h> | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/threads.h> | ||
13 | #include <linux/module.h> | ||
14 | |||
15 | #include <asm/processor.h> | ||
16 | #include <asm/ptrace.h> | ||
17 | #include <asm/page.h> | ||
18 | #include <asm/lppaca.h> | ||
19 | #include <asm/iseries/it_lp_queue.h> | ||
20 | #include <asm/paca.h> | ||
21 | |||
22 | |||
23 | /* This symbol is provided by the linker - let it fill in the paca | ||
24 | * field correctly */ | ||
25 | extern unsigned long __toc_start; | ||
26 | |||
27 | /* The Paca is an array with one entry per processor. Each contains an | ||
28 | * lppaca, which contains the information shared between the | ||
29 | * hypervisor and Linux. Each also contains an ItLpRegSave area which | ||
30 | * is used by the hypervisor to save registers. | ||
31 | * On systems with hardware multi-threading, there are two threads | ||
32 | * per processor. The Paca array must contain an entry for each thread. | ||
33 | * The VPD Areas will give a max logical processors = 2 * max physical | ||
34 | * processors. The processor VPD array needs one entry per physical | ||
35 | * processor (not thread). | ||
36 | */ | ||
37 | #define PACA_INIT_COMMON(number, start, asrr, asrv) \ | ||
38 | .lock_token = 0x8000, \ | ||
39 | .paca_index = (number), /* Paca Index */ \ | ||
40 | .default_decr = 0x00ff0000, /* Initial Decr */ \ | ||
41 | .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ | ||
42 | .stab_real = (asrr), /* Real pointer to segment table */ \ | ||
43 | .stab_addr = (asrv), /* Virt pointer to segment table */ \ | ||
44 | .cpu_start = (start), /* Processor start */ \ | ||
45 | .hw_cpu_id = 0xffff, \ | ||
46 | .lppaca = { \ | ||
47 | .desc = 0xd397d781, /* "LpPa" */ \ | ||
48 | .size = sizeof(struct lppaca), \ | ||
49 | .dyn_proc_status = 2, \ | ||
50 | .decr_val = 0x00ff0000, \ | ||
51 | .fpregs_in_use = 1, \ | ||
52 | .end_of_quantum = 0xfffffffffffffffful, \ | ||
53 | .slb_count = 64, \ | ||
54 | .vmxregs_in_use = 0, \ | ||
55 | }, \ | ||
56 | |||
57 | #ifdef CONFIG_PPC_ISERIES | ||
58 | #define PACA_INIT_ISERIES(number) \ | ||
59 | .lppaca_ptr = &paca[number].lppaca, \ | ||
60 | .reg_save_ptr = &paca[number].reg_save, \ | ||
61 | .reg_save = { \ | ||
62 | .xDesc = 0xd397d9e2, /* "LpRS" */ \ | ||
63 | .xSize = sizeof(struct ItLpRegSave) \ | ||
64 | } | ||
65 | |||
66 | #define PACA_INIT(number) \ | ||
67 | { \ | ||
68 | PACA_INIT_COMMON(number, 0, 0, 0) \ | ||
69 | PACA_INIT_ISERIES(number) \ | ||
70 | } | ||
71 | |||
72 | #define BOOTCPU_PACA_INIT(number) \ | ||
73 | { \ | ||
74 | PACA_INIT_COMMON(number, 1, 0, (u64)&initial_stab) \ | ||
75 | PACA_INIT_ISERIES(number) \ | ||
76 | } | ||
77 | |||
78 | #else | ||
79 | #define PACA_INIT(number) \ | ||
80 | { \ | ||
81 | PACA_INIT_COMMON(number, 0, 0, 0) \ | ||
82 | } | ||
83 | |||
84 | #define BOOTCPU_PACA_INIT(number) \ | ||
85 | { \ | ||
86 | PACA_INIT_COMMON(number, 1, STAB0_PHYS_ADDR, (u64)&initial_stab) \ | ||
87 | } | ||
88 | #endif | ||
89 | |||
90 | struct paca_struct paca[] = { | ||
91 | BOOTCPU_PACA_INIT(0), | ||
92 | #if NR_CPUS > 1 | ||
93 | PACA_INIT( 1), PACA_INIT( 2), PACA_INIT( 3), | ||
94 | #if NR_CPUS > 4 | ||
95 | PACA_INIT( 4), PACA_INIT( 5), PACA_INIT( 6), PACA_INIT( 7), | ||
96 | #if NR_CPUS > 8 | ||
97 | PACA_INIT( 8), PACA_INIT( 9), PACA_INIT( 10), PACA_INIT( 11), | ||
98 | PACA_INIT( 12), PACA_INIT( 13), PACA_INIT( 14), PACA_INIT( 15), | ||
99 | PACA_INIT( 16), PACA_INIT( 17), PACA_INIT( 18), PACA_INIT( 19), | ||
100 | PACA_INIT( 20), PACA_INIT( 21), PACA_INIT( 22), PACA_INIT( 23), | ||
101 | PACA_INIT( 24), PACA_INIT( 25), PACA_INIT( 26), PACA_INIT( 27), | ||
102 | PACA_INIT( 28), PACA_INIT( 29), PACA_INIT( 30), PACA_INIT( 31), | ||
103 | #if NR_CPUS > 32 | ||
104 | PACA_INIT( 32), PACA_INIT( 33), PACA_INIT( 34), PACA_INIT( 35), | ||
105 | PACA_INIT( 36), PACA_INIT( 37), PACA_INIT( 38), PACA_INIT( 39), | ||
106 | PACA_INIT( 40), PACA_INIT( 41), PACA_INIT( 42), PACA_INIT( 43), | ||
107 | PACA_INIT( 44), PACA_INIT( 45), PACA_INIT( 46), PACA_INIT( 47), | ||
108 | PACA_INIT( 48), PACA_INIT( 49), PACA_INIT( 50), PACA_INIT( 51), | ||
109 | PACA_INIT( 52), PACA_INIT( 53), PACA_INIT( 54), PACA_INIT( 55), | ||
110 | PACA_INIT( 56), PACA_INIT( 57), PACA_INIT( 58), PACA_INIT( 59), | ||
111 | PACA_INIT( 60), PACA_INIT( 61), PACA_INIT( 62), PACA_INIT( 63), | ||
112 | #if NR_CPUS > 64 | ||
113 | PACA_INIT( 64), PACA_INIT( 65), PACA_INIT( 66), PACA_INIT( 67), | ||
114 | PACA_INIT( 68), PACA_INIT( 69), PACA_INIT( 70), PACA_INIT( 71), | ||
115 | PACA_INIT( 72), PACA_INIT( 73), PACA_INIT( 74), PACA_INIT( 75), | ||
116 | PACA_INIT( 76), PACA_INIT( 77), PACA_INIT( 78), PACA_INIT( 79), | ||
117 | PACA_INIT( 80), PACA_INIT( 81), PACA_INIT( 82), PACA_INIT( 83), | ||
118 | PACA_INIT( 84), PACA_INIT( 85), PACA_INIT( 86), PACA_INIT( 87), | ||
119 | PACA_INIT( 88), PACA_INIT( 89), PACA_INIT( 90), PACA_INIT( 91), | ||
120 | PACA_INIT( 92), PACA_INIT( 93), PACA_INIT( 94), PACA_INIT( 95), | ||
121 | PACA_INIT( 96), PACA_INIT( 97), PACA_INIT( 98), PACA_INIT( 99), | ||
122 | PACA_INIT(100), PACA_INIT(101), PACA_INIT(102), PACA_INIT(103), | ||
123 | PACA_INIT(104), PACA_INIT(105), PACA_INIT(106), PACA_INIT(107), | ||
124 | PACA_INIT(108), PACA_INIT(109), PACA_INIT(110), PACA_INIT(111), | ||
125 | PACA_INIT(112), PACA_INIT(113), PACA_INIT(114), PACA_INIT(115), | ||
126 | PACA_INIT(116), PACA_INIT(117), PACA_INIT(118), PACA_INIT(119), | ||
127 | PACA_INIT(120), PACA_INIT(121), PACA_INIT(122), PACA_INIT(123), | ||
128 | PACA_INIT(124), PACA_INIT(125), PACA_INIT(126), PACA_INIT(127), | ||
129 | #endif | ||
130 | #endif | ||
131 | #endif | ||
132 | #endif | ||
133 | #endif | ||
134 | }; | ||
135 | EXPORT_SYMBOL(paca); | ||