diff options
Diffstat (limited to 'arch/powerpc/kernel')
34 files changed, 580 insertions, 628 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 7d32ad0194a4..8b133afbdc20 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -16,7 +16,7 @@ obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ | |||
16 | obj-y += vdso32/ | 16 | obj-y += vdso32/ |
17 | obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ | 17 | obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ |
18 | signal_64.o ptrace32.o \ | 18 | signal_64.o ptrace32.o \ |
19 | paca.o cpu_setup_power4.o \ | 19 | paca.o cpu_setup_ppc970.o \ |
20 | firmware.o sysfs.o | 20 | firmware.o sysfs.o |
21 | obj-$(CONFIG_PPC64) += vdso64/ | 21 | obj-$(CONFIG_PPC64) += vdso64/ |
22 | obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o | 22 | obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o |
@@ -51,7 +51,7 @@ extra-$(CONFIG_8xx) := head_8xx.o | |||
51 | extra-y += vmlinux.lds | 51 | extra-y += vmlinux.lds |
52 | 52 | ||
53 | obj-y += time.o prom.o traps.o setup-common.o \ | 53 | obj-y += time.o prom.o traps.o setup-common.o \ |
54 | udbg.o misc.o | 54 | udbg.o misc.o io.o |
55 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o | 55 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o |
56 | obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o | 56 | obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o |
57 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o | 57 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 7ee84968087b..d06f378597bb 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -40,9 +40,10 @@ | |||
40 | #ifdef CONFIG_PPC64 | 40 | #ifdef CONFIG_PPC64 |
41 | #include <asm/paca.h> | 41 | #include <asm/paca.h> |
42 | #include <asm/lppaca.h> | 42 | #include <asm/lppaca.h> |
43 | #include <asm/iseries/hv_lp_event.h> | ||
44 | #include <asm/cache.h> | 43 | #include <asm/cache.h> |
45 | #include <asm/compat.h> | 44 | #include <asm/compat.h> |
45 | #include <asm/mmu.h> | ||
46 | #include <asm/hvcall.h> | ||
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | #define DEFINE(sym, val) \ | 49 | #define DEFINE(sym, val) \ |
@@ -136,11 +137,18 @@ int main(void) | |||
136 | DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); | 137 | DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); |
137 | DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); | 138 | DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); |
138 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); | 139 | DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); |
140 | DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); | ||
141 | DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); | ||
139 | 142 | ||
143 | DEFINE(SLBSHADOW_STACKVSID, | ||
144 | offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); | ||
145 | DEFINE(SLBSHADOW_STACKESID, | ||
146 | offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].esid)); | ||
140 | DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); | 147 | DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); |
141 | DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1)); | 148 | DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1)); |
142 | DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); | 149 | DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); |
143 | DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); | 150 | DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); |
151 | DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area)); | ||
144 | #endif /* CONFIG_PPC64 */ | 152 | #endif /* CONFIG_PPC64 */ |
145 | 153 | ||
146 | /* RTAS */ | 154 | /* RTAS */ |
@@ -159,6 +167,12 @@ int main(void) | |||
159 | /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */ | 167 | /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */ |
160 | DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); | 168 | DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); |
161 | DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); | 169 | DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); |
170 | |||
171 | /* hcall statistics */ | ||
172 | DEFINE(HCALL_STAT_SIZE, sizeof(struct hcall_stats)); | ||
173 | DEFINE(HCALL_STAT_CALLS, offsetof(struct hcall_stats, num_calls)); | ||
174 | DEFINE(HCALL_STAT_TB, offsetof(struct hcall_stats, tb_total)); | ||
175 | DEFINE(HCALL_STAT_PURR, offsetof(struct hcall_stats, purr_total)); | ||
162 | #endif /* CONFIG_PPC64 */ | 176 | #endif /* CONFIG_PPC64 */ |
163 | DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0])); | 177 | DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0])); |
164 | DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1])); | 178 | DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1])); |
@@ -240,6 +254,7 @@ int main(void) | |||
240 | DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value)); | 254 | DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value)); |
241 | DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); | 255 | DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); |
242 | DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); | 256 | DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); |
257 | DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore)); | ||
243 | 258 | ||
244 | #ifndef CONFIG_PPC64 | 259 | #ifndef CONFIG_PPC64 |
245 | DEFINE(pbe_address, offsetof(struct pbe, address)); | 260 | DEFINE(pbe_address, offsetof(struct pbe, address)); |
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c index f4e5e14ee2b6..995fcef156fd 100644 --- a/arch/powerpc/kernel/btext.c +++ b/arch/powerpc/kernel/btext.c | |||
@@ -158,35 +158,35 @@ int btext_initialize(struct device_node *np) | |||
158 | { | 158 | { |
159 | unsigned int width, height, depth, pitch; | 159 | unsigned int width, height, depth, pitch; |
160 | unsigned long address = 0; | 160 | unsigned long address = 0; |
161 | u32 *prop; | 161 | const u32 *prop; |
162 | 162 | ||
163 | prop = (u32 *)get_property(np, "linux,bootx-width", NULL); | 163 | prop = get_property(np, "linux,bootx-width", NULL); |
164 | if (prop == NULL) | 164 | if (prop == NULL) |
165 | prop = (u32 *)get_property(np, "width", NULL); | 165 | prop = get_property(np, "width", NULL); |
166 | if (prop == NULL) | 166 | if (prop == NULL) |
167 | return -EINVAL; | 167 | return -EINVAL; |
168 | width = *prop; | 168 | width = *prop; |
169 | prop = (u32 *)get_property(np, "linux,bootx-height", NULL); | 169 | prop = get_property(np, "linux,bootx-height", NULL); |
170 | if (prop == NULL) | 170 | if (prop == NULL) |
171 | prop = (u32 *)get_property(np, "height", NULL); | 171 | prop = get_property(np, "height", NULL); |
172 | if (prop == NULL) | 172 | if (prop == NULL) |
173 | return -EINVAL; | 173 | return -EINVAL; |
174 | height = *prop; | 174 | height = *prop; |
175 | prop = (u32 *)get_property(np, "linux,bootx-depth", NULL); | 175 | prop = get_property(np, "linux,bootx-depth", NULL); |
176 | if (prop == NULL) | 176 | if (prop == NULL) |
177 | prop = (u32 *)get_property(np, "depth", NULL); | 177 | prop = get_property(np, "depth", NULL); |
178 | if (prop == NULL) | 178 | if (prop == NULL) |
179 | return -EINVAL; | 179 | return -EINVAL; |
180 | depth = *prop; | 180 | depth = *prop; |
181 | pitch = width * ((depth + 7) / 8); | 181 | pitch = width * ((depth + 7) / 8); |
182 | prop = (u32 *)get_property(np, "linux,bootx-linebytes", NULL); | 182 | prop = get_property(np, "linux,bootx-linebytes", NULL); |
183 | if (prop == NULL) | 183 | if (prop == NULL) |
184 | prop = (u32 *)get_property(np, "linebytes", NULL); | 184 | prop = get_property(np, "linebytes", NULL); |
185 | if (prop) | 185 | if (prop) |
186 | pitch = *prop; | 186 | pitch = *prop; |
187 | if (pitch == 1) | 187 | if (pitch == 1) |
188 | pitch = 0x1000; | 188 | pitch = 0x1000; |
189 | prop = (u32 *)get_property(np, "address", NULL); | 189 | prop = get_property(np, "address", NULL); |
190 | if (prop) | 190 | if (prop) |
191 | address = *prop; | 191 | address = *prop; |
192 | 192 | ||
@@ -214,11 +214,11 @@ int btext_initialize(struct device_node *np) | |||
214 | 214 | ||
215 | int __init btext_find_display(int allow_nonstdout) | 215 | int __init btext_find_display(int allow_nonstdout) |
216 | { | 216 | { |
217 | char *name; | 217 | const char *name; |
218 | struct device_node *np = NULL; | 218 | struct device_node *np = NULL; |
219 | int rc = -ENODEV; | 219 | int rc = -ENODEV; |
220 | 220 | ||
221 | name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 221 | name = get_property(of_chosen, "linux,stdout-path", NULL); |
222 | if (name != NULL) { | 222 | if (name != NULL) { |
223 | np = of_find_node_by_path(name); | 223 | np = of_find_node_by_path(name); |
224 | if (np != NULL) { | 224 | if (np != NULL) { |
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_ppc970.S index 76e97aa71c45..652594891d58 100644 --- a/arch/powerpc/kernel/cpu_setup_power4.S +++ b/arch/powerpc/kernel/cpu_setup_ppc970.S | |||
@@ -16,27 +16,12 @@ | |||
16 | #include <asm/asm-offsets.h> | 16 | #include <asm/asm-offsets.h> |
17 | #include <asm/cache.h> | 17 | #include <asm/cache.h> |
18 | 18 | ||
19 | _GLOBAL(__970_cpu_preinit) | 19 | _GLOBAL(__cpu_preinit_ppc970) |
20 | /* | 20 | /* Do nothing if not running in HV mode */ |
21 | * Do nothing if not running in HV mode | ||
22 | */ | ||
23 | mfmsr r0 | 21 | mfmsr r0 |
24 | rldicl. r0,r0,4,63 | 22 | rldicl. r0,r0,4,63 |
25 | beqlr | 23 | beqlr |
26 | 24 | ||
27 | /* | ||
28 | * Deal only with PPC970 and PPC970FX. | ||
29 | */ | ||
30 | mfspr r0,SPRN_PVR | ||
31 | srwi r0,r0,16 | ||
32 | cmpwi r0,0x39 | ||
33 | beq 1f | ||
34 | cmpwi r0,0x3c | ||
35 | beq 1f | ||
36 | cmpwi r0,0x44 | ||
37 | bnelr | ||
38 | 1: | ||
39 | |||
40 | /* Make sure HID4:rm_ci is off before MMU is turned off, that large | 25 | /* Make sure HID4:rm_ci is off before MMU is turned off, that large |
41 | * pages are enabled with HID4:61 and clear HID5:DCBZ_size and | 26 | * pages are enabled with HID4:61 and clear HID5:DCBZ_size and |
42 | * HID5:DCBZ32_ill | 27 | * HID5:DCBZ32_ill |
@@ -72,23 +57,6 @@ _GLOBAL(__970_cpu_preinit) | |||
72 | isync | 57 | isync |
73 | blr | 58 | blr |
74 | 59 | ||
75 | _GLOBAL(__setup_cpu_ppc970) | ||
76 | mfspr r0,SPRN_HID0 | ||
77 | li r11,5 /* clear DOZE and SLEEP */ | ||
78 | rldimi r0,r11,52,8 /* set NAP and DPM */ | ||
79 | li r11,0 | ||
80 | rldimi r0,r11,32,31 /* clear EN_ATTN */ | ||
81 | mtspr SPRN_HID0,r0 | ||
82 | mfspr r0,SPRN_HID0 | ||
83 | mfspr r0,SPRN_HID0 | ||
84 | mfspr r0,SPRN_HID0 | ||
85 | mfspr r0,SPRN_HID0 | ||
86 | mfspr r0,SPRN_HID0 | ||
87 | mfspr r0,SPRN_HID0 | ||
88 | sync | ||
89 | isync | ||
90 | blr | ||
91 | |||
92 | /* Definitions for the table use to save CPU states */ | 60 | /* Definitions for the table use to save CPU states */ |
93 | #define CS_HID0 0 | 61 | #define CS_HID0 0 |
94 | #define CS_HID1 8 | 62 | #define CS_HID1 8 |
@@ -103,33 +71,30 @@ cpu_state_storage: | |||
103 | .balign L1_CACHE_BYTES,0 | 71 | .balign L1_CACHE_BYTES,0 |
104 | .text | 72 | .text |
105 | 73 | ||
106 | /* Called in normal context to backup CPU 0 state. This | ||
107 | * does not include cache settings. This function is also | ||
108 | * called for machine sleep. This does not include the MMU | ||
109 | * setup, BATs, etc... but rather the "special" registers | ||
110 | * like HID0, HID1, HID4, etc... | ||
111 | */ | ||
112 | _GLOBAL(__save_cpu_setup) | ||
113 | /* Some CR fields are volatile, we back it up all */ | ||
114 | mfcr r7 | ||
115 | |||
116 | /* Get storage ptr */ | ||
117 | LOAD_REG_IMMEDIATE(r5,cpu_state_storage) | ||
118 | 74 | ||
119 | /* We only deal with 970 for now */ | 75 | _GLOBAL(__setup_cpu_ppc970) |
120 | mfspr r0,SPRN_PVR | 76 | /* Do nothing if not running in HV mode */ |
121 | srwi r0,r0,16 | ||
122 | cmpwi r0,0x39 | ||
123 | beq 1f | ||
124 | cmpwi r0,0x3c | ||
125 | beq 1f | ||
126 | cmpwi r0,0x44 | ||
127 | bne 2f | ||
128 | |||
129 | 1: /* skip if not running in HV mode */ | ||
130 | mfmsr r0 | 77 | mfmsr r0 |
131 | rldicl. r0,r0,4,63 | 78 | rldicl. r0,r0,4,63 |
132 | beq 2f | 79 | beqlr |
80 | |||
81 | mfspr r0,SPRN_HID0 | ||
82 | li r11,5 /* clear DOZE and SLEEP */ | ||
83 | rldimi r0,r11,52,8 /* set NAP and DPM */ | ||
84 | li r11,0 | ||
85 | rldimi r0,r11,32,31 /* clear EN_ATTN */ | ||
86 | mtspr SPRN_HID0,r0 | ||
87 | mfspr r0,SPRN_HID0 | ||
88 | mfspr r0,SPRN_HID0 | ||
89 | mfspr r0,SPRN_HID0 | ||
90 | mfspr r0,SPRN_HID0 | ||
91 | mfspr r0,SPRN_HID0 | ||
92 | mfspr r0,SPRN_HID0 | ||
93 | sync | ||
94 | isync | ||
95 | |||
96 | /* Save away cpu state */ | ||
97 | LOAD_REG_IMMEDIATE(r5,cpu_state_storage) | ||
133 | 98 | ||
134 | /* Save HID0,1,4 and 5 */ | 99 | /* Save HID0,1,4 and 5 */ |
135 | mfspr r3,SPRN_HID0 | 100 | mfspr r3,SPRN_HID0 |
@@ -141,35 +106,19 @@ _GLOBAL(__save_cpu_setup) | |||
141 | mfspr r3,SPRN_HID5 | 106 | mfspr r3,SPRN_HID5 |
142 | std r3,CS_HID5(r5) | 107 | std r3,CS_HID5(r5) |
143 | 108 | ||
144 | 2: | ||
145 | mtcr r7 | ||
146 | blr | 109 | blr |
147 | 110 | ||
148 | /* Called with no MMU context (typically MSR:IR/DR off) to | 111 | /* Called with no MMU context (typically MSR:IR/DR off) to |
149 | * restore CPU state as backed up by the previous | 112 | * restore CPU state as backed up by the previous |
150 | * function. This does not include cache setting | 113 | * function. This does not include cache setting |
151 | */ | 114 | */ |
152 | _GLOBAL(__restore_cpu_setup) | 115 | _GLOBAL(__restore_cpu_ppc970) |
153 | /* Get storage ptr (FIXME when using anton reloc as we | 116 | /* Do nothing if not running in HV mode */ |
154 | * are running with translation disabled here | ||
155 | */ | ||
156 | LOAD_REG_IMMEDIATE(r5,cpu_state_storage) | ||
157 | |||
158 | /* We only deal with 970 for now */ | ||
159 | mfspr r0,SPRN_PVR | ||
160 | srwi r0,r0,16 | ||
161 | cmpwi r0,0x39 | ||
162 | beq 1f | ||
163 | cmpwi r0,0x3c | ||
164 | beq 1f | ||
165 | cmpwi r0,0x44 | ||
166 | bnelr | ||
167 | |||
168 | 1: /* skip if not running in HV mode */ | ||
169 | mfmsr r0 | 117 | mfmsr r0 |
170 | rldicl. r0,r0,4,63 | 118 | rldicl. r0,r0,4,63 |
171 | beqlr | 119 | beqlr |
172 | 120 | ||
121 | LOAD_REG_IMMEDIATE(r5,cpu_state_storage) | ||
173 | /* Before accessing memory, we make sure rm_ci is clear */ | 122 | /* Before accessing memory, we make sure rm_ci is clear */ |
174 | li r0,0 | 123 | li r0,0 |
175 | mfspr r3,SPRN_HID4 | 124 | mfspr r3,SPRN_HID4 |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index 272e43622fd6..190a57e20765 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
@@ -39,7 +39,10 @@ extern void __setup_cpu_7400(unsigned long offset, struct cpu_spec* spec); | |||
39 | extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec); | 39 | extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec); |
40 | extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec); | 40 | extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec); |
41 | #endif /* CONFIG_PPC32 */ | 41 | #endif /* CONFIG_PPC32 */ |
42 | #ifdef CONFIG_PPC64 | ||
42 | extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); | 43 | extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); |
44 | extern void __restore_cpu_ppc970(void); | ||
45 | #endif /* CONFIG_PPC64 */ | ||
43 | 46 | ||
44 | /* This table only contains "desktop" CPUs, it need to be filled with embedded | 47 | /* This table only contains "desktop" CPUs, it need to be filled with embedded |
45 | * ones as well... | 48 | * ones as well... |
@@ -55,6 +58,9 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); | |||
55 | #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\ | 58 | #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\ |
56 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \ | 59 | PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \ |
57 | PPC_FEATURE_TRUE_LE) | 60 | PPC_FEATURE_TRUE_LE) |
61 | #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\ | ||
62 | PPC_FEATURE_TRUE_LE | \ | ||
63 | PPC_FEATURE_HAS_ALTIVEC_COMP) | ||
58 | #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ | 64 | #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ |
59 | PPC_FEATURE_BOOKE) | 65 | PPC_FEATURE_BOOKE) |
60 | 66 | ||
@@ -184,6 +190,7 @@ struct cpu_spec cpu_specs[] = { | |||
184 | .dcache_bsize = 128, | 190 | .dcache_bsize = 128, |
185 | .num_pmcs = 8, | 191 | .num_pmcs = 8, |
186 | .cpu_setup = __setup_cpu_ppc970, | 192 | .cpu_setup = __setup_cpu_ppc970, |
193 | .cpu_restore = __restore_cpu_ppc970, | ||
187 | .oprofile_cpu_type = "ppc64/970", | 194 | .oprofile_cpu_type = "ppc64/970", |
188 | .oprofile_type = PPC_OPROFILE_POWER4, | 195 | .oprofile_type = PPC_OPROFILE_POWER4, |
189 | .platform = "ppc970", | 196 | .platform = "ppc970", |
@@ -199,6 +206,7 @@ struct cpu_spec cpu_specs[] = { | |||
199 | .dcache_bsize = 128, | 206 | .dcache_bsize = 128, |
200 | .num_pmcs = 8, | 207 | .num_pmcs = 8, |
201 | .cpu_setup = __setup_cpu_ppc970, | 208 | .cpu_setup = __setup_cpu_ppc970, |
209 | .cpu_restore = __restore_cpu_ppc970, | ||
202 | .oprofile_cpu_type = "ppc64/970", | 210 | .oprofile_cpu_type = "ppc64/970", |
203 | .oprofile_type = PPC_OPROFILE_POWER4, | 211 | .oprofile_type = PPC_OPROFILE_POWER4, |
204 | .platform = "ppc970", | 212 | .platform = "ppc970", |
@@ -214,6 +222,7 @@ struct cpu_spec cpu_specs[] = { | |||
214 | .dcache_bsize = 128, | 222 | .dcache_bsize = 128, |
215 | .num_pmcs = 8, | 223 | .num_pmcs = 8, |
216 | .cpu_setup = __setup_cpu_ppc970, | 224 | .cpu_setup = __setup_cpu_ppc970, |
225 | .cpu_restore = __restore_cpu_ppc970, | ||
217 | .oprofile_cpu_type = "ppc64/970", | 226 | .oprofile_cpu_type = "ppc64/970", |
218 | .oprofile_type = PPC_OPROFILE_POWER4, | 227 | .oprofile_type = PPC_OPROFILE_POWER4, |
219 | .platform = "ppc970", | 228 | .platform = "ppc970", |
@@ -280,6 +289,17 @@ struct cpu_spec cpu_specs[] = { | |||
280 | .dcache_bsize = 128, | 289 | .dcache_bsize = 128, |
281 | .platform = "ppc-cell-be", | 290 | .platform = "ppc-cell-be", |
282 | }, | 291 | }, |
292 | { /* PA Semi PA6T */ | ||
293 | .pvr_mask = 0x7fff0000, | ||
294 | .pvr_value = 0x00900000, | ||
295 | .cpu_name = "PA6T", | ||
296 | .cpu_features = CPU_FTRS_PA6T, | ||
297 | .cpu_user_features = COMMON_USER_PA6T, | ||
298 | .icache_bsize = 64, | ||
299 | .dcache_bsize = 64, | ||
300 | .num_pmcs = 6, | ||
301 | .platform = "pa6t", | ||
302 | }, | ||
283 | { /* default match */ | 303 | { /* default match */ |
284 | .pvr_mask = 0x00000000, | 304 | .pvr_mask = 0x00000000, |
285 | .pvr_value = 0x00000000, | 305 | .pvr_value = 0x00000000, |
@@ -929,6 +949,7 @@ struct cpu_spec cpu_specs[] = { | |||
929 | PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, | 949 | PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, |
930 | .icache_bsize = 32, | 950 | .icache_bsize = 32, |
931 | .dcache_bsize = 32, | 951 | .dcache_bsize = 32, |
952 | .platform = "ppc405", | ||
932 | }, | 953 | }, |
933 | { /* 405EP */ | 954 | { /* 405EP */ |
934 | .pvr_mask = 0xffff0000, | 955 | .pvr_mask = 0xffff0000, |
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c index 371973be8d71..2f6f5a7bc69e 100644 --- a/arch/powerpc/kernel/crash_dump.c +++ b/arch/powerpc/kernel/crash_dump.c | |||
@@ -80,7 +80,7 @@ static int __init parse_savemaxmem(char *p) | |||
80 | } | 80 | } |
81 | __setup("savemaxmem=", parse_savemaxmem); | 81 | __setup("savemaxmem=", parse_savemaxmem); |
82 | 82 | ||
83 | /* | 83 | /** |
84 | * copy_oldmem_page - copy one page from "oldmem" | 84 | * copy_oldmem_page - copy one page from "oldmem" |
85 | * @pfn: page frame number to be copied | 85 | * @pfn: page frame number to be copied |
86 | * @buf: target memory address for the copy; this can be in kernel address | 86 | * @buf: target memory address for the copy; this can be in kernel address |
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c index 36aaa7663f02..6c168f6ea142 100644 --- a/arch/powerpc/kernel/dma_64.c +++ b/arch/powerpc/kernel/dma_64.c | |||
@@ -35,10 +35,9 @@ int dma_supported(struct device *dev, u64 mask) | |||
35 | { | 35 | { |
36 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 36 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
37 | 37 | ||
38 | if (dma_ops) | 38 | BUG_ON(!dma_ops); |
39 | return dma_ops->dma_supported(dev, mask); | 39 | |
40 | BUG(); | 40 | return dma_ops->dma_supported(dev, mask); |
41 | return 0; | ||
42 | } | 41 | } |
43 | EXPORT_SYMBOL(dma_supported); | 42 | EXPORT_SYMBOL(dma_supported); |
44 | 43 | ||
@@ -66,10 +65,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, | |||
66 | { | 65 | { |
67 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 66 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
68 | 67 | ||
69 | if (dma_ops) | 68 | BUG_ON(!dma_ops); |
70 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); | 69 | |
71 | BUG(); | 70 | return dma_ops->alloc_coherent(dev, size, dma_handle, flag); |
72 | return NULL; | ||
73 | } | 71 | } |
74 | EXPORT_SYMBOL(dma_alloc_coherent); | 72 | EXPORT_SYMBOL(dma_alloc_coherent); |
75 | 73 | ||
@@ -78,10 +76,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, | |||
78 | { | 76 | { |
79 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 77 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
80 | 78 | ||
81 | if (dma_ops) | 79 | BUG_ON(!dma_ops); |
82 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); | 80 | |
83 | else | 81 | dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); |
84 | BUG(); | ||
85 | } | 82 | } |
86 | EXPORT_SYMBOL(dma_free_coherent); | 83 | EXPORT_SYMBOL(dma_free_coherent); |
87 | 84 | ||
@@ -90,10 +87,9 @@ dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size, | |||
90 | { | 87 | { |
91 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 88 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
92 | 89 | ||
93 | if (dma_ops) | 90 | BUG_ON(!dma_ops); |
94 | return dma_ops->map_single(dev, cpu_addr, size, direction); | 91 | |
95 | BUG(); | 92 | return dma_ops->map_single(dev, cpu_addr, size, direction); |
96 | return (dma_addr_t)0; | ||
97 | } | 93 | } |
98 | EXPORT_SYMBOL(dma_map_single); | 94 | EXPORT_SYMBOL(dma_map_single); |
99 | 95 | ||
@@ -102,10 +98,9 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
102 | { | 98 | { |
103 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 99 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
104 | 100 | ||
105 | if (dma_ops) | 101 | BUG_ON(!dma_ops); |
106 | dma_ops->unmap_single(dev, dma_addr, size, direction); | 102 | |
107 | else | 103 | dma_ops->unmap_single(dev, dma_addr, size, direction); |
108 | BUG(); | ||
109 | } | 104 | } |
110 | EXPORT_SYMBOL(dma_unmap_single); | 105 | EXPORT_SYMBOL(dma_unmap_single); |
111 | 106 | ||
@@ -115,11 +110,10 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, | |||
115 | { | 110 | { |
116 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 111 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
117 | 112 | ||
118 | if (dma_ops) | 113 | BUG_ON(!dma_ops); |
119 | return dma_ops->map_single(dev, | 114 | |
120 | (page_address(page) + offset), size, direction); | 115 | return dma_ops->map_single(dev, page_address(page) + offset, size, |
121 | BUG(); | 116 | direction); |
122 | return (dma_addr_t)0; | ||
123 | } | 117 | } |
124 | EXPORT_SYMBOL(dma_map_page); | 118 | EXPORT_SYMBOL(dma_map_page); |
125 | 119 | ||
@@ -128,10 +122,9 @@ void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, | |||
128 | { | 122 | { |
129 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 123 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
130 | 124 | ||
131 | if (dma_ops) | 125 | BUG_ON(!dma_ops); |
132 | dma_ops->unmap_single(dev, dma_address, size, direction); | 126 | |
133 | else | 127 | dma_ops->unmap_single(dev, dma_address, size, direction); |
134 | BUG(); | ||
135 | } | 128 | } |
136 | EXPORT_SYMBOL(dma_unmap_page); | 129 | EXPORT_SYMBOL(dma_unmap_page); |
137 | 130 | ||
@@ -140,10 +133,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
140 | { | 133 | { |
141 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 134 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
142 | 135 | ||
143 | if (dma_ops) | 136 | BUG_ON(!dma_ops); |
144 | return dma_ops->map_sg(dev, sg, nents, direction); | 137 | |
145 | BUG(); | 138 | return dma_ops->map_sg(dev, sg, nents, direction); |
146 | return 0; | ||
147 | } | 139 | } |
148 | EXPORT_SYMBOL(dma_map_sg); | 140 | EXPORT_SYMBOL(dma_map_sg); |
149 | 141 | ||
@@ -152,9 +144,8 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, | |||
152 | { | 144 | { |
153 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); | 145 | struct dma_mapping_ops *dma_ops = get_dma_ops(dev); |
154 | 146 | ||
155 | if (dma_ops) | 147 | BUG_ON(!dma_ops); |
156 | dma_ops->unmap_sg(dev, sg, nhwentries, direction); | 148 | |
157 | else | 149 | dma_ops->unmap_sg(dev, sg, nhwentries, direction); |
158 | BUG(); | ||
159 | } | 150 | } |
160 | EXPORT_SYMBOL(dma_unmap_sg); | 151 | EXPORT_SYMBOL(dma_unmap_sg); |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 54d9f5cdaab4..2cd872b5283b 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -375,6 +375,14 @@ BEGIN_FTR_SECTION | |||
375 | ld r7,KSP_VSID(r4) /* Get new stack's VSID */ | 375 | ld r7,KSP_VSID(r4) /* Get new stack's VSID */ |
376 | oris r0,r6,(SLB_ESID_V)@h | 376 | oris r0,r6,(SLB_ESID_V)@h |
377 | ori r0,r0,(SLB_NUM_BOLTED-1)@l | 377 | ori r0,r0,(SLB_NUM_BOLTED-1)@l |
378 | |||
379 | /* Update the last bolted SLB */ | ||
380 | ld r9,PACA_SLBSHADOWPTR(r13) | ||
381 | li r12,0 | ||
382 | std r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */ | ||
383 | std r7,SLBSHADOW_STACKVSID(r9) /* Save VSID */ | ||
384 | std r0,SLBSHADOW_STACKESID(r9) /* Save ESID */ | ||
385 | |||
378 | slbie r6 | 386 | slbie r6 |
379 | slbie r6 /* Workaround POWER5 < DD2.1 issue */ | 387 | slbie r6 /* Workaround POWER5 < DD2.1 issue */ |
380 | slbmte r7,r0 | 388 | slbmte r7,r0 |
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 6ff3cf506088..3065b472b95d 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S | |||
@@ -132,7 +132,7 @@ _GLOBAL(__secondary_hold) | |||
132 | bne 100b | 132 | bne 100b |
133 | 133 | ||
134 | #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) | 134 | #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) |
135 | LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init) | 135 | LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init) |
136 | mtctr r4 | 136 | mtctr r4 |
137 | mr r3,r24 | 137 | mr r3,r24 |
138 | bctr | 138 | bctr |
@@ -1484,19 +1484,17 @@ fwnmi_data_area: | |||
1484 | . = 0x8000 | 1484 | . = 0x8000 |
1485 | 1485 | ||
1486 | /* | 1486 | /* |
1487 | * On pSeries, secondary processors spin in the following code. | 1487 | * On pSeries and most other platforms, secondary processors spin |
1488 | * in the following code. | ||
1488 | * At entry, r3 = this processor's number (physical cpu id) | 1489 | * At entry, r3 = this processor's number (physical cpu id) |
1489 | */ | 1490 | */ |
1490 | _GLOBAL(pSeries_secondary_smp_init) | 1491 | _GLOBAL(generic_secondary_smp_init) |
1491 | mr r24,r3 | 1492 | mr r24,r3 |
1492 | 1493 | ||
1493 | /* turn on 64-bit mode */ | 1494 | /* turn on 64-bit mode */ |
1494 | bl .enable_64b_mode | 1495 | bl .enable_64b_mode |
1495 | isync | 1496 | isync |
1496 | 1497 | ||
1497 | /* Copy some CPU settings from CPU 0 */ | ||
1498 | bl .__restore_cpu_setup | ||
1499 | |||
1500 | /* Set up a paca value for this processor. Since we have the | 1498 | /* Set up a paca value for this processor. Since we have the |
1501 | * physical cpu id in r24, we need to search the pacas to find | 1499 | * physical cpu id in r24, we need to search the pacas to find |
1502 | * which logical id maps to our physical one. | 1500 | * which logical id maps to our physical one. |
@@ -1522,15 +1520,28 @@ _GLOBAL(pSeries_secondary_smp_init) | |||
1522 | /* start. */ | 1520 | /* start. */ |
1523 | sync | 1521 | sync |
1524 | 1522 | ||
1525 | /* Create a temp kernel stack for use before relocation is on. */ | 1523 | #ifndef CONFIG_SMP |
1524 | b 3b /* Never go on non-SMP */ | ||
1525 | #else | ||
1526 | cmpwi 0,r23,0 | ||
1527 | beq 3b /* Loop until told to go */ | ||
1528 | |||
1529 | /* See if we need to call a cpu state restore handler */ | ||
1530 | LOAD_REG_IMMEDIATE(r23, cur_cpu_spec) | ||
1531 | ld r23,0(r23) | ||
1532 | ld r23,CPU_SPEC_RESTORE(r23) | ||
1533 | cmpdi 0,r23,0 | ||
1534 | beq 4f | ||
1535 | ld r23,0(r23) | ||
1536 | mtctr r23 | ||
1537 | bctrl | ||
1538 | |||
1539 | 4: /* Create a temp kernel stack for use before relocation is on. */ | ||
1526 | ld r1,PACAEMERGSP(r13) | 1540 | ld r1,PACAEMERGSP(r13) |
1527 | subi r1,r1,STACK_FRAME_OVERHEAD | 1541 | subi r1,r1,STACK_FRAME_OVERHEAD |
1528 | 1542 | ||
1529 | cmpwi 0,r23,0 | 1543 | b .__secondary_start |
1530 | #ifdef CONFIG_SMP | ||
1531 | bne .__secondary_start | ||
1532 | #endif | 1544 | #endif |
1533 | b 3b /* Loop until told to go */ | ||
1534 | 1545 | ||
1535 | #ifdef CONFIG_PPC_ISERIES | 1546 | #ifdef CONFIG_PPC_ISERIES |
1536 | _STATIC(__start_initialization_iSeries) | 1547 | _STATIC(__start_initialization_iSeries) |
@@ -1611,7 +1622,16 @@ _GLOBAL(__start_initialization_multiplatform) | |||
1611 | bl .enable_64b_mode | 1622 | bl .enable_64b_mode |
1612 | 1623 | ||
1613 | /* Setup some critical 970 SPRs before switching MMU off */ | 1624 | /* Setup some critical 970 SPRs before switching MMU off */ |
1614 | bl .__970_cpu_preinit | 1625 | mfspr r0,SPRN_PVR |
1626 | srwi r0,r0,16 | ||
1627 | cmpwi r0,0x39 /* 970 */ | ||
1628 | beq 1f | ||
1629 | cmpwi r0,0x3c /* 970FX */ | ||
1630 | beq 1f | ||
1631 | cmpwi r0,0x44 /* 970MP */ | ||
1632 | bne 2f | ||
1633 | 1: bl .__cpu_preinit_ppc970 | ||
1634 | 2: | ||
1615 | 1635 | ||
1616 | /* Switch off MMU if not already */ | 1636 | /* Switch off MMU if not already */ |
1617 | LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) | 1637 | LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) |
@@ -1728,7 +1748,7 @@ _STATIC(__after_prom_start) | |||
1728 | _GLOBAL(copy_and_flush) | 1748 | _GLOBAL(copy_and_flush) |
1729 | addi r5,r5,-8 | 1749 | addi r5,r5,-8 |
1730 | addi r6,r6,-8 | 1750 | addi r6,r6,-8 |
1731 | 4: li r0,16 /* Use the least common */ | 1751 | 4: li r0,8 /* Use the smallest common */ |
1732 | /* denominator cache line */ | 1752 | /* denominator cache line */ |
1733 | /* size. This results in */ | 1753 | /* size. This results in */ |
1734 | /* extra cache line flushes */ | 1754 | /* extra cache line flushes */ |
@@ -1782,7 +1802,7 @@ _GLOBAL(pmac_secondary_start) | |||
1782 | isync | 1802 | isync |
1783 | 1803 | ||
1784 | /* Copy some CPU settings from CPU 0 */ | 1804 | /* Copy some CPU settings from CPU 0 */ |
1785 | bl .__restore_cpu_setup | 1805 | bl .__restore_cpu_ppc970 |
1786 | 1806 | ||
1787 | /* pSeries do that early though I don't think we really need it */ | 1807 | /* pSeries do that early though I don't think we really need it */ |
1788 | mfmsr r3 | 1808 | mfmsr r3 |
@@ -1932,12 +1952,6 @@ _STATIC(start_here_multiplatform) | |||
1932 | mr r5,r26 | 1952 | mr r5,r26 |
1933 | bl .identify_cpu | 1953 | bl .identify_cpu |
1934 | 1954 | ||
1935 | /* Save some low level config HIDs of CPU0 to be copied to | ||
1936 | * other CPUs later on, or used for suspend/resume | ||
1937 | */ | ||
1938 | bl .__save_cpu_setup | ||
1939 | sync | ||
1940 | |||
1941 | /* Do very early kernel initializations, including initial hash table, | 1955 | /* Do very early kernel initializations, including initial hash table, |
1942 | * stab and slb setup before we turn on relocation. */ | 1956 | * stab and slb setup before we turn on relocation. */ |
1943 | 1957 | ||
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c index 68e5ab0443d2..124dbcba94a8 100644 --- a/arch/powerpc/kernel/ibmebus.c +++ b/arch/powerpc/kernel/ibmebus.c | |||
@@ -167,7 +167,7 @@ static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name, | |||
167 | NULL); | 167 | NULL); |
168 | 168 | ||
169 | static struct ibmebus_dev* __devinit ibmebus_register_device_common( | 169 | static struct ibmebus_dev* __devinit ibmebus_register_device_common( |
170 | struct ibmebus_dev *dev, char *name) | 170 | struct ibmebus_dev *dev, const char *name) |
171 | { | 171 | { |
172 | int err = 0; | 172 | int err = 0; |
173 | 173 | ||
@@ -194,10 +194,10 @@ static struct ibmebus_dev* __devinit ibmebus_register_device_node( | |||
194 | struct device_node *dn) | 194 | struct device_node *dn) |
195 | { | 195 | { |
196 | struct ibmebus_dev *dev; | 196 | struct ibmebus_dev *dev; |
197 | char *loc_code; | 197 | const char *loc_code; |
198 | int length; | 198 | int length; |
199 | 199 | ||
200 | loc_code = (char *)get_property(dn, "ibm,loc-code", NULL); | 200 | loc_code = get_property(dn, "ibm,loc-code", NULL); |
201 | if (!loc_code) { | 201 | if (!loc_code) { |
202 | printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n", | 202 | printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n", |
203 | __FUNCTION__, dn->name ? dn->name : "<unknown>"); | 203 | __FUNCTION__, dn->name ? dn->name : "<unknown>"); |
diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c new file mode 100644 index 000000000000..e98180686b35 --- /dev/null +++ b/arch/powerpc/kernel/io.c | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | * I/O string operations | ||
3 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) | ||
4 | * Copyright (C) 2006 IBM Corporation | ||
5 | * | ||
6 | * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) | ||
7 | * and Paul Mackerras. | ||
8 | * | ||
9 | * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com) | ||
10 | * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) | ||
11 | * | ||
12 | * Rewritten in C by Stephen Rothwell. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version | ||
17 | * 2 of the License, or (at your option) any later version. | ||
18 | */ | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/compiler.h> | ||
22 | #include <linux/module.h> | ||
23 | |||
24 | #include <asm/io.h> | ||
25 | #include <asm/firmware.h> | ||
26 | #include <asm/bug.h> | ||
27 | |||
28 | void _insb(volatile u8 __iomem *port, void *buf, long count) | ||
29 | { | ||
30 | u8 *tbuf = buf; | ||
31 | u8 tmp; | ||
32 | |||
33 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
34 | |||
35 | if (unlikely(count <= 0)) | ||
36 | return; | ||
37 | asm volatile("sync"); | ||
38 | do { | ||
39 | tmp = *port; | ||
40 | asm volatile("eieio"); | ||
41 | *tbuf++ = tmp; | ||
42 | } while (--count != 0); | ||
43 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
44 | } | ||
45 | EXPORT_SYMBOL(_insb); | ||
46 | |||
47 | void _outsb(volatile u8 __iomem *port, const void *buf, long count) | ||
48 | { | ||
49 | const u8 *tbuf = buf; | ||
50 | |||
51 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
52 | |||
53 | if (unlikely(count <= 0)) | ||
54 | return; | ||
55 | asm volatile("sync"); | ||
56 | do { | ||
57 | *port = *tbuf++; | ||
58 | } while (--count != 0); | ||
59 | asm volatile("sync"); | ||
60 | } | ||
61 | EXPORT_SYMBOL(_outsb); | ||
62 | |||
63 | void _insw_ns(volatile u16 __iomem *port, void *buf, long count) | ||
64 | { | ||
65 | u16 *tbuf = buf; | ||
66 | u16 tmp; | ||
67 | |||
68 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
69 | |||
70 | if (unlikely(count <= 0)) | ||
71 | return; | ||
72 | asm volatile("sync"); | ||
73 | do { | ||
74 | tmp = *port; | ||
75 | asm volatile("eieio"); | ||
76 | *tbuf++ = tmp; | ||
77 | } while (--count != 0); | ||
78 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
79 | } | ||
80 | EXPORT_SYMBOL(_insw_ns); | ||
81 | |||
82 | void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count) | ||
83 | { | ||
84 | const u16 *tbuf = buf; | ||
85 | |||
86 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
87 | |||
88 | if (unlikely(count <= 0)) | ||
89 | return; | ||
90 | asm volatile("sync"); | ||
91 | do { | ||
92 | *port = *tbuf++; | ||
93 | } while (--count != 0); | ||
94 | asm volatile("sync"); | ||
95 | } | ||
96 | EXPORT_SYMBOL(_outsw_ns); | ||
97 | |||
98 | void _insl_ns(volatile u32 __iomem *port, void *buf, long count) | ||
99 | { | ||
100 | u32 *tbuf = buf; | ||
101 | u32 tmp; | ||
102 | |||
103 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
104 | |||
105 | if (unlikely(count <= 0)) | ||
106 | return; | ||
107 | asm volatile("sync"); | ||
108 | do { | ||
109 | tmp = *port; | ||
110 | asm volatile("eieio"); | ||
111 | *tbuf++ = tmp; | ||
112 | } while (--count != 0); | ||
113 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
114 | } | ||
115 | EXPORT_SYMBOL(_insl_ns); | ||
116 | |||
117 | void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count) | ||
118 | { | ||
119 | const u32 *tbuf = buf; | ||
120 | |||
121 | BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); | ||
122 | |||
123 | if (unlikely(count <= 0)) | ||
124 | return; | ||
125 | asm volatile("sync"); | ||
126 | do { | ||
127 | *port = *tbuf++; | ||
128 | } while (--count != 0); | ||
129 | asm volatile("sync"); | ||
130 | } | ||
131 | EXPORT_SYMBOL(_outsl_ns); | ||
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 12c5971d6565..b4432332341f 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/radix-tree.h> | 52 | #include <linux/radix-tree.h> |
53 | #include <linux/mutex.h> | 53 | #include <linux/mutex.h> |
54 | #include <linux/bootmem.h> | 54 | #include <linux/bootmem.h> |
55 | #include <linux/pci.h> | ||
55 | 56 | ||
56 | #include <asm/uaccess.h> | 57 | #include <asm/uaccess.h> |
57 | #include <asm/system.h> | 58 | #include <asm/system.h> |
@@ -875,12 +876,14 @@ int pci_enable_msi(struct pci_dev * pdev) | |||
875 | else | 876 | else |
876 | return -1; | 877 | return -1; |
877 | } | 878 | } |
879 | EXPORT_SYMBOL(pci_enable_msi); | ||
878 | 880 | ||
879 | void pci_disable_msi(struct pci_dev * pdev) | 881 | void pci_disable_msi(struct pci_dev * pdev) |
880 | { | 882 | { |
881 | if (ppc_md.disable_msi) | 883 | if (ppc_md.disable_msi) |
882 | ppc_md.disable_msi(pdev); | 884 | ppc_md.disable_msi(pdev); |
883 | } | 885 | } |
886 | EXPORT_SYMBOL(pci_disable_msi); | ||
884 | 887 | ||
885 | void pci_scan_msi_device(struct pci_dev *dev) {} | 888 | void pci_scan_msi_device(struct pci_dev *dev) {} |
886 | int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) {return -1;} | 889 | int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) {return -1;} |
@@ -888,6 +891,8 @@ void pci_disable_msix(struct pci_dev *dev) {} | |||
888 | void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} | 891 | void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} |
889 | void disable_msi_mode(struct pci_dev *dev, int pos, int type) {} | 892 | void disable_msi_mode(struct pci_dev *dev, int pos, int type) {} |
890 | void pci_no_msi(void) {} | 893 | void pci_no_msi(void) {} |
894 | EXPORT_SYMBOL(pci_enable_msix); | ||
895 | EXPORT_SYMBOL(pci_disable_msix); | ||
891 | 896 | ||
892 | #endif | 897 | #endif |
893 | 898 | ||
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index 40a39291861f..5e6ddfa474c0 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c | |||
@@ -39,16 +39,17 @@ static int __init add_legacy_port(struct device_node *np, int want_index, | |||
39 | phys_addr_t taddr, unsigned long irq, | 39 | phys_addr_t taddr, unsigned long irq, |
40 | upf_t flags, int irq_check_parent) | 40 | upf_t flags, int irq_check_parent) |
41 | { | 41 | { |
42 | u32 *clk, *spd, clock = BASE_BAUD * 16; | 42 | const u32 *clk, *spd; |
43 | u32 clock = BASE_BAUD * 16; | ||
43 | int index; | 44 | int index; |
44 | 45 | ||
45 | /* get clock freq. if present */ | 46 | /* get clock freq. if present */ |
46 | clk = (u32 *)get_property(np, "clock-frequency", NULL); | 47 | clk = get_property(np, "clock-frequency", NULL); |
47 | if (clk && *clk) | 48 | if (clk && *clk) |
48 | clock = *clk; | 49 | clock = *clk; |
49 | 50 | ||
50 | /* get default speed if present */ | 51 | /* get default speed if present */ |
51 | spd = (u32 *)get_property(np, "current-speed", NULL); | 52 | spd = get_property(np, "current-speed", NULL); |
52 | 53 | ||
53 | /* If we have a location index, then try to use it */ | 54 | /* If we have a location index, then try to use it */ |
54 | if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) | 55 | if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) |
@@ -113,7 +114,7 @@ static int __init add_legacy_soc_port(struct device_node *np, | |||
113 | struct device_node *soc_dev) | 114 | struct device_node *soc_dev) |
114 | { | 115 | { |
115 | u64 addr; | 116 | u64 addr; |
116 | u32 *addrp; | 117 | const u32 *addrp; |
117 | upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; | 118 | upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; |
118 | struct device_node *tsi = of_get_parent(np); | 119 | struct device_node *tsi = of_get_parent(np); |
119 | 120 | ||
@@ -144,15 +145,15 @@ static int __init add_legacy_soc_port(struct device_node *np, | |||
144 | static int __init add_legacy_isa_port(struct device_node *np, | 145 | static int __init add_legacy_isa_port(struct device_node *np, |
145 | struct device_node *isa_brg) | 146 | struct device_node *isa_brg) |
146 | { | 147 | { |
147 | u32 *reg; | 148 | const u32 *reg; |
148 | char *typep; | 149 | const char *typep; |
149 | int index = -1; | 150 | int index = -1; |
150 | u64 taddr; | 151 | u64 taddr; |
151 | 152 | ||
152 | DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); | 153 | DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); |
153 | 154 | ||
154 | /* Get the ISA port number */ | 155 | /* Get the ISA port number */ |
155 | reg = (u32 *)get_property(np, "reg", NULL); | 156 | reg = get_property(np, "reg", NULL); |
156 | if (reg == NULL) | 157 | if (reg == NULL) |
157 | return -1; | 158 | return -1; |
158 | 159 | ||
@@ -163,7 +164,7 @@ static int __init add_legacy_isa_port(struct device_node *np, | |||
163 | /* Now look for an "ibm,aix-loc" property that gives us ordering | 164 | /* Now look for an "ibm,aix-loc" property that gives us ordering |
164 | * if any... | 165 | * if any... |
165 | */ | 166 | */ |
166 | typep = (char *)get_property(np, "ibm,aix-loc", NULL); | 167 | typep = get_property(np, "ibm,aix-loc", NULL); |
167 | 168 | ||
168 | /* If we have a location index, then use it */ | 169 | /* If we have a location index, then use it */ |
169 | if (typep && *typep == 'S') | 170 | if (typep && *typep == 'S') |
@@ -188,7 +189,7 @@ static int __init add_legacy_pci_port(struct device_node *np, | |||
188 | struct device_node *pci_dev) | 189 | struct device_node *pci_dev) |
189 | { | 190 | { |
190 | u64 addr, base; | 191 | u64 addr, base; |
191 | u32 *addrp; | 192 | const u32 *addrp; |
192 | unsigned int flags; | 193 | unsigned int flags; |
193 | int iotype, index = -1, lindex = 0; | 194 | int iotype, index = -1, lindex = 0; |
194 | 195 | ||
@@ -227,7 +228,7 @@ static int __init add_legacy_pci_port(struct device_node *np, | |||
227 | * we get to their "reg" property | 228 | * we get to their "reg" property |
228 | */ | 229 | */ |
229 | if (np != pci_dev) { | 230 | if (np != pci_dev) { |
230 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 231 | const u32 *reg = get_property(np, "reg", NULL); |
231 | if (reg && (*reg < 4)) | 232 | if (reg && (*reg < 4)) |
232 | index = lindex = *reg; | 233 | index = lindex = *reg; |
233 | } | 234 | } |
@@ -285,13 +286,13 @@ static void __init setup_legacy_serial_console(int console) | |||
285 | void __init find_legacy_serial_ports(void) | 286 | void __init find_legacy_serial_ports(void) |
286 | { | 287 | { |
287 | struct device_node *np, *stdout = NULL; | 288 | struct device_node *np, *stdout = NULL; |
288 | char *path; | 289 | const char *path; |
289 | int index; | 290 | int index; |
290 | 291 | ||
291 | DBG(" -> find_legacy_serial_port()\n"); | 292 | DBG(" -> find_legacy_serial_port()\n"); |
292 | 293 | ||
293 | /* Now find out if one of these is out firmware console */ | 294 | /* Now find out if one of these is out firmware console */ |
294 | path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 295 | path = get_property(of_chosen, "linux,stdout-path", NULL); |
295 | if (path != NULL) { | 296 | if (path != NULL) { |
296 | stdout = of_find_node_by_path(path); | 297 | stdout = of_find_node_by_path(path); |
297 | if (stdout) | 298 | if (stdout) |
@@ -491,8 +492,8 @@ static int __init check_legacy_serial_console(void) | |||
491 | { | 492 | { |
492 | struct device_node *prom_stdout = NULL; | 493 | struct device_node *prom_stdout = NULL; |
493 | int speed = 0, offset = 0; | 494 | int speed = 0, offset = 0; |
494 | char *name; | 495 | const char *name; |
495 | u32 *spd; | 496 | const u32 *spd; |
496 | 497 | ||
497 | DBG(" -> check_legacy_serial_console()\n"); | 498 | DBG(" -> check_legacy_serial_console()\n"); |
498 | 499 | ||
@@ -513,7 +514,7 @@ static int __init check_legacy_serial_console(void) | |||
513 | } | 514 | } |
514 | /* We are getting a weird phandle from OF ... */ | 515 | /* We are getting a weird phandle from OF ... */ |
515 | /* ... So use the full path instead */ | 516 | /* ... So use the full path instead */ |
516 | name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); | 517 | name = get_property(of_chosen, "linux,stdout-path", NULL); |
517 | if (name == NULL) { | 518 | if (name == NULL) { |
518 | DBG(" no linux,stdout-path !\n"); | 519 | DBG(" no linux,stdout-path !\n"); |
519 | return -ENODEV; | 520 | return -ENODEV; |
@@ -525,12 +526,12 @@ static int __init check_legacy_serial_console(void) | |||
525 | } | 526 | } |
526 | DBG("stdout is %s\n", prom_stdout->full_name); | 527 | DBG("stdout is %s\n", prom_stdout->full_name); |
527 | 528 | ||
528 | name = (char *)get_property(prom_stdout, "name", NULL); | 529 | name = get_property(prom_stdout, "name", NULL); |
529 | if (!name) { | 530 | if (!name) { |
530 | DBG(" stdout package has no name !\n"); | 531 | DBG(" stdout package has no name !\n"); |
531 | goto not_found; | 532 | goto not_found; |
532 | } | 533 | } |
533 | spd = (u32 *)get_property(prom_stdout, "current-speed", NULL); | 534 | spd = get_property(prom_stdout, "current-speed", NULL); |
534 | if (spd) | 535 | if (spd) |
535 | speed = *spd; | 536 | speed = *spd; |
536 | 537 | ||
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index 23f34daa044a..41c05dcd68f4 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <asm/rtas.h> | 32 | #include <asm/rtas.h> |
33 | #include <asm/system.h> | 33 | #include <asm/system.h> |
34 | #include <asm/time.h> | 34 | #include <asm/time.h> |
35 | #include <asm/iseries/it_exp_vpd_panel.h> | ||
36 | #include <asm/prom.h> | 35 | #include <asm/prom.h> |
37 | #include <asm/vdso_datapage.h> | 36 | #include <asm/vdso_datapage.h> |
38 | 37 | ||
@@ -183,8 +182,14 @@ static unsigned int h_get_ppp(unsigned long *entitled, | |||
183 | unsigned long *resource) | 182 | unsigned long *resource) |
184 | { | 183 | { |
185 | unsigned long rc; | 184 | unsigned long rc; |
186 | rc = plpar_hcall_4out(H_GET_PPP, 0, 0, 0, 0, entitled, unallocated, | 185 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
187 | aggregation, resource); | 186 | |
187 | rc = plpar_hcall(H_GET_PPP, retbuf); | ||
188 | |||
189 | *entitled = retbuf[0]; | ||
190 | *unallocated = retbuf[1]; | ||
191 | *aggregation = retbuf[2]; | ||
192 | *resource = retbuf[3]; | ||
188 | 193 | ||
189 | log_plpar_hcall_return(rc, "H_GET_PPP"); | 194 | log_plpar_hcall_return(rc, "H_GET_PPP"); |
190 | 195 | ||
@@ -194,8 +199,12 @@ static unsigned int h_get_ppp(unsigned long *entitled, | |||
194 | static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs) | 199 | static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs) |
195 | { | 200 | { |
196 | unsigned long rc; | 201 | unsigned long rc; |
197 | unsigned long dummy; | 202 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
198 | rc = plpar_hcall(H_PIC, 0, 0, 0, 0, pool_idle_time, num_procs, &dummy); | 203 | |
204 | rc = plpar_hcall(H_PIC, retbuf); | ||
205 | |||
206 | *pool_idle_time = retbuf[0]; | ||
207 | *num_procs = retbuf[1]; | ||
199 | 208 | ||
200 | if (rc != H_AUTHORITY) | 209 | if (rc != H_AUTHORITY) |
201 | log_plpar_hcall_return(rc, "H_PIC"); | 210 | log_plpar_hcall_return(rc, "H_PIC"); |
@@ -310,12 +319,11 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v) | |||
310 | int partition_potential_processors; | 319 | int partition_potential_processors; |
311 | int partition_active_processors; | 320 | int partition_active_processors; |
312 | struct device_node *rtas_node; | 321 | struct device_node *rtas_node; |
313 | int *lrdrp = NULL; | 322 | const int *lrdrp = NULL; |
314 | 323 | ||
315 | rtas_node = find_path_device("/rtas"); | 324 | rtas_node = find_path_device("/rtas"); |
316 | if (rtas_node) | 325 | if (rtas_node) |
317 | lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", | 326 | lrdrp = get_property(rtas_node, "ibm,lrdr-capacity", NULL); |
318 | NULL); | ||
319 | 327 | ||
320 | if (lrdrp == NULL) { | 328 | if (lrdrp == NULL) { |
321 | partition_potential_processors = vdso_data->processorCount; | 329 | partition_potential_processors = vdso_data->processorCount; |
@@ -520,7 +528,8 @@ static int lparcfg_data(struct seq_file *m, void *v) | |||
520 | const char *model = ""; | 528 | const char *model = ""; |
521 | const char *system_id = ""; | 529 | const char *system_id = ""; |
522 | const char *tmp; | 530 | const char *tmp; |
523 | unsigned int *lp_index_ptr, lp_index = 0; | 531 | const unsigned int *lp_index_ptr; |
532 | unsigned int lp_index = 0; | ||
524 | 533 | ||
525 | seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); | 534 | seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); |
526 | 535 | ||
@@ -540,8 +549,7 @@ static int lparcfg_data(struct seq_file *m, void *v) | |||
540 | if (firmware_has_feature(FW_FEATURE_ISERIES)) | 549 | if (firmware_has_feature(FW_FEATURE_ISERIES)) |
541 | system_id += 4; | 550 | system_id += 4; |
542 | } | 551 | } |
543 | lp_index_ptr = (unsigned int *) | 552 | lp_index_ptr = get_property(rootdn, "ibm,partition-no", NULL); |
544 | get_property(rootdn, "ibm,partition-no", NULL); | ||
545 | if (lp_index_ptr) | 553 | if (lp_index_ptr) |
546 | lp_index = *lp_index_ptr; | 554 | lp_index = *lp_index_ptr; |
547 | } | 555 | } |
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index be58985c7681..a24b09c27718 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c | |||
@@ -31,8 +31,8 @@ int default_machine_kexec_prepare(struct kimage *image) | |||
31 | unsigned long begin, end; /* limits of segment */ | 31 | unsigned long begin, end; /* limits of segment */ |
32 | unsigned long low, high; /* limits of blocked memory range */ | 32 | unsigned long low, high; /* limits of blocked memory range */ |
33 | struct device_node *node; | 33 | struct device_node *node; |
34 | unsigned long *basep; | 34 | const unsigned long *basep; |
35 | unsigned int *sizep; | 35 | const unsigned int *sizep; |
36 | 36 | ||
37 | if (!ppc_md.hpte_clear_all) | 37 | if (!ppc_md.hpte_clear_all) |
38 | return -ENOENT; | 38 | return -ENOENT; |
@@ -72,10 +72,8 @@ int default_machine_kexec_prepare(struct kimage *image) | |||
72 | /* We also should not overwrite the tce tables */ | 72 | /* We also should not overwrite the tce tables */ |
73 | for (node = of_find_node_by_type(NULL, "pci"); node != NULL; | 73 | for (node = of_find_node_by_type(NULL, "pci"); node != NULL; |
74 | node = of_find_node_by_type(node, "pci")) { | 74 | node = of_find_node_by_type(node, "pci")) { |
75 | basep = (unsigned long *)get_property(node, "linux,tce-base", | 75 | basep = get_property(node, "linux,tce-base", NULL); |
76 | NULL); | 76 | sizep = get_property(node, "linux,tce-size", NULL); |
77 | sizep = (unsigned int *)get_property(node, "linux,tce-size", | ||
78 | NULL); | ||
79 | if (basep == NULL || sizep == NULL) | 77 | if (basep == NULL || sizep == NULL) |
80 | continue; | 78 | continue; |
81 | 79 | ||
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S index f770805f1215..330c9dc7db86 100644 --- a/arch/powerpc/kernel/misc.S +++ b/arch/powerpc/kernel/misc.S | |||
@@ -43,162 +43,3 @@ _GLOBAL(add_reloc_offset) | |||
43 | add r3,r3,r5 | 43 | add r3,r3,r5 |
44 | mtlr r0 | 44 | mtlr r0 |
45 | blr | 45 | blr |
46 | |||
47 | /* | ||
48 | * I/O string operations | ||
49 | * | ||
50 | * insb(port, buf, len) | ||
51 | * outsb(port, buf, len) | ||
52 | * insw(port, buf, len) | ||
53 | * outsw(port, buf, len) | ||
54 | * insl(port, buf, len) | ||
55 | * outsl(port, buf, len) | ||
56 | * insw_ns(port, buf, len) | ||
57 | * outsw_ns(port, buf, len) | ||
58 | * insl_ns(port, buf, len) | ||
59 | * outsl_ns(port, buf, len) | ||
60 | * | ||
61 | * The *_ns versions don't do byte-swapping. | ||
62 | */ | ||
63 | _GLOBAL(_insb) | ||
64 | sync | ||
65 | cmpwi 0,r5,0 | ||
66 | mtctr r5 | ||
67 | subi r4,r4,1 | ||
68 | blelr- | ||
69 | 00: lbz r5,0(r3) | ||
70 | eieio | ||
71 | stbu r5,1(r4) | ||
72 | bdnz 00b | ||
73 | twi 0,r5,0 | ||
74 | isync | ||
75 | blr | ||
76 | |||
77 | _GLOBAL(_outsb) | ||
78 | cmpwi 0,r5,0 | ||
79 | mtctr r5 | ||
80 | subi r4,r4,1 | ||
81 | blelr- | ||
82 | sync | ||
83 | 00: lbzu r5,1(r4) | ||
84 | stb r5,0(r3) | ||
85 | bdnz 00b | ||
86 | sync | ||
87 | blr | ||
88 | |||
89 | _GLOBAL(_insw) | ||
90 | sync | ||
91 | cmpwi 0,r5,0 | ||
92 | mtctr r5 | ||
93 | subi r4,r4,2 | ||
94 | blelr- | ||
95 | 00: lhbrx r5,0,r3 | ||
96 | eieio | ||
97 | sthu r5,2(r4) | ||
98 | bdnz 00b | ||
99 | twi 0,r5,0 | ||
100 | isync | ||
101 | blr | ||
102 | |||
103 | _GLOBAL(_outsw) | ||
104 | cmpwi 0,r5,0 | ||
105 | mtctr r5 | ||
106 | subi r4,r4,2 | ||
107 | blelr- | ||
108 | sync | ||
109 | 00: lhzu r5,2(r4) | ||
110 | sthbrx r5,0,r3 | ||
111 | bdnz 00b | ||
112 | sync | ||
113 | blr | ||
114 | |||
115 | _GLOBAL(_insl) | ||
116 | sync | ||
117 | cmpwi 0,r5,0 | ||
118 | mtctr r5 | ||
119 | subi r4,r4,4 | ||
120 | blelr- | ||
121 | 00: lwbrx r5,0,r3 | ||
122 | eieio | ||
123 | stwu r5,4(r4) | ||
124 | bdnz 00b | ||
125 | twi 0,r5,0 | ||
126 | isync | ||
127 | blr | ||
128 | |||
129 | _GLOBAL(_outsl) | ||
130 | cmpwi 0,r5,0 | ||
131 | mtctr r5 | ||
132 | subi r4,r4,4 | ||
133 | blelr- | ||
134 | sync | ||
135 | 00: lwzu r5,4(r4) | ||
136 | stwbrx r5,0,r3 | ||
137 | bdnz 00b | ||
138 | sync | ||
139 | blr | ||
140 | |||
141 | #ifdef CONFIG_PPC32 | ||
142 | _GLOBAL(__ide_mm_insw) | ||
143 | #endif | ||
144 | _GLOBAL(_insw_ns) | ||
145 | sync | ||
146 | cmpwi 0,r5,0 | ||
147 | mtctr r5 | ||
148 | subi r4,r4,2 | ||
149 | blelr- | ||
150 | 00: lhz r5,0(r3) | ||
151 | eieio | ||
152 | sthu r5,2(r4) | ||
153 | bdnz 00b | ||
154 | twi 0,r5,0 | ||
155 | isync | ||
156 | blr | ||
157 | |||
158 | #ifdef CONFIG_PPC32 | ||
159 | _GLOBAL(__ide_mm_outsw) | ||
160 | #endif | ||
161 | _GLOBAL(_outsw_ns) | ||
162 | cmpwi 0,r5,0 | ||
163 | mtctr r5 | ||
164 | subi r4,r4,2 | ||
165 | blelr- | ||
166 | sync | ||
167 | 00: lhzu r5,2(r4) | ||
168 | sth r5,0(r3) | ||
169 | bdnz 00b | ||
170 | sync | ||
171 | blr | ||
172 | |||
173 | #ifdef CONFIG_PPC32 | ||
174 | _GLOBAL(__ide_mm_insl) | ||
175 | #endif | ||
176 | _GLOBAL(_insl_ns) | ||
177 | sync | ||
178 | cmpwi 0,r5,0 | ||
179 | mtctr r5 | ||
180 | subi r4,r4,4 | ||
181 | blelr- | ||
182 | 00: lwz r5,0(r3) | ||
183 | eieio | ||
184 | stwu r5,4(r4) | ||
185 | bdnz 00b | ||
186 | twi 0,r5,0 | ||
187 | isync | ||
188 | blr | ||
189 | |||
190 | #ifdef CONFIG_PPC32 | ||
191 | _GLOBAL(__ide_mm_outsl) | ||
192 | #endif | ||
193 | _GLOBAL(_outsl_ns) | ||
194 | cmpwi 0,r5,0 | ||
195 | mtctr r5 | ||
196 | subi r4,r4,4 | ||
197 | blelr- | ||
198 | sync | ||
199 | 00: lwzu r5,4(r4) | ||
200 | stw r5,0(r3) | ||
201 | bdnz 00b | ||
202 | sync | ||
203 | blr | ||
204 | |||
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c index 3262b73a3a68..397c83eda20e 100644 --- a/arch/powerpc/kernel/of_device.c +++ b/arch/powerpc/kernel/of_device.c | |||
@@ -189,27 +189,9 @@ void of_release_dev(struct device *dev) | |||
189 | int of_device_register(struct of_device *ofdev) | 189 | int of_device_register(struct of_device *ofdev) |
190 | { | 190 | { |
191 | int rc; | 191 | int rc; |
192 | struct of_device **odprop; | ||
193 | 192 | ||
194 | BUG_ON(ofdev->node == NULL); | 193 | BUG_ON(ofdev->node == NULL); |
195 | 194 | ||
196 | odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL); | ||
197 | if (!odprop) { | ||
198 | struct property *new_prop; | ||
199 | |||
200 | new_prop = kmalloc(sizeof(struct property) + sizeof(struct of_device *), | ||
201 | GFP_KERNEL); | ||
202 | if (new_prop == NULL) | ||
203 | return -ENOMEM; | ||
204 | new_prop->name = "linux,device"; | ||
205 | new_prop->length = sizeof(sizeof(struct of_device *)); | ||
206 | new_prop->value = (unsigned char *)&new_prop[1]; | ||
207 | odprop = (struct of_device **)new_prop->value; | ||
208 | *odprop = NULL; | ||
209 | prom_add_property(ofdev->node, new_prop); | ||
210 | } | ||
211 | *odprop = ofdev; | ||
212 | |||
213 | rc = device_register(&ofdev->dev); | 195 | rc = device_register(&ofdev->dev); |
214 | if (rc) | 196 | if (rc) |
215 | return rc; | 197 | return rc; |
@@ -221,14 +203,8 @@ int of_device_register(struct of_device *ofdev) | |||
221 | 203 | ||
222 | void of_device_unregister(struct of_device *ofdev) | 204 | void of_device_unregister(struct of_device *ofdev) |
223 | { | 205 | { |
224 | struct of_device **odprop; | ||
225 | |||
226 | device_remove_file(&ofdev->dev, &dev_attr_devspec); | 206 | device_remove_file(&ofdev->dev, &dev_attr_devspec); |
227 | 207 | ||
228 | odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL); | ||
229 | if (odprop) | ||
230 | *odprop = NULL; | ||
231 | |||
232 | device_unregister(&ofdev->dev); | 208 | device_unregister(&ofdev->dev); |
233 | } | 209 | } |
234 | 210 | ||
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index c68741fed14b..55f1a25085cd 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/lppaca.h> | 17 | #include <asm/lppaca.h> |
18 | #include <asm/iseries/it_lp_reg_save.h> | 18 | #include <asm/iseries/it_lp_reg_save.h> |
19 | #include <asm/paca.h> | 19 | #include <asm/paca.h> |
20 | #include <asm/mmu.h> | ||
20 | 21 | ||
21 | 22 | ||
22 | /* This symbol is provided by the linker - let it fill in the paca | 23 | /* This symbol is provided by the linker - let it fill in the paca |
@@ -45,6 +46,17 @@ struct lppaca lppaca[] = { | |||
45 | }, | 46 | }, |
46 | }; | 47 | }; |
47 | 48 | ||
49 | /* | ||
50 | * 3 persistent SLBs are registered here. The buffer will be zero | ||
51 | * initially, hence will all be invaild until we actually write them. | ||
52 | */ | ||
53 | struct slb_shadow slb_shadow[] __cacheline_aligned = { | ||
54 | [0 ... (NR_CPUS-1)] = { | ||
55 | .persistent = SLB_NUM_BOLTED, | ||
56 | .buffer_length = sizeof(struct slb_shadow), | ||
57 | }, | ||
58 | }; | ||
59 | |||
48 | /* The Paca is an array with one entry per processor. Each contains an | 60 | /* The Paca is an array with one entry per processor. Each contains an |
49 | * lppaca, which contains the information shared between the | 61 | * lppaca, which contains the information shared between the |
50 | * hypervisor and Linux. | 62 | * hypervisor and Linux. |
@@ -59,7 +71,8 @@ struct lppaca lppaca[] = { | |||
59 | .lock_token = 0x8000, \ | 71 | .lock_token = 0x8000, \ |
60 | .paca_index = (number), /* Paca Index */ \ | 72 | .paca_index = (number), /* Paca Index */ \ |
61 | .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ | 73 | .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ |
62 | .hw_cpu_id = 0xffff, | 74 | .hw_cpu_id = 0xffff, \ |
75 | .slb_shadow_ptr = &slb_shadow[number], | ||
63 | 76 | ||
64 | #ifdef CONFIG_PPC_ISERIES | 77 | #ifdef CONFIG_PPC_ISERIES |
65 | #define PACA_INIT_ISERIES(number) \ | 78 | #define PACA_INIT_ISERIES(number) \ |
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 09b1e1bbb29b..9b49f8691d29 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c | |||
@@ -633,12 +633,12 @@ pcibios_alloc_controller(void) | |||
633 | static void | 633 | static void |
634 | make_one_node_map(struct device_node* node, u8 pci_bus) | 634 | make_one_node_map(struct device_node* node, u8 pci_bus) |
635 | { | 635 | { |
636 | int *bus_range; | 636 | const int *bus_range; |
637 | int len; | 637 | int len; |
638 | 638 | ||
639 | if (pci_bus >= pci_bus_count) | 639 | if (pci_bus >= pci_bus_count) |
640 | return; | 640 | return; |
641 | bus_range = (int *) get_property(node, "bus-range", &len); | 641 | bus_range = get_property(node, "bus-range", &len); |
642 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 642 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
643 | printk(KERN_WARNING "Can't get bus-range for %s, " | 643 | printk(KERN_WARNING "Can't get bus-range for %s, " |
644 | "assuming it starts at 0\n", node->full_name); | 644 | "assuming it starts at 0\n", node->full_name); |
@@ -648,13 +648,13 @@ make_one_node_map(struct device_node* node, u8 pci_bus) | |||
648 | 648 | ||
649 | for (node=node->child; node != 0;node = node->sibling) { | 649 | for (node=node->child; node != 0;node = node->sibling) { |
650 | struct pci_dev* dev; | 650 | struct pci_dev* dev; |
651 | unsigned int *class_code, *reg; | 651 | const unsigned int *class_code, *reg; |
652 | 652 | ||
653 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 653 | class_code = get_property(node, "class-code", NULL); |
654 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 654 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
655 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | 655 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) |
656 | continue; | 656 | continue; |
657 | reg = (unsigned int *)get_property(node, "reg", NULL); | 657 | reg = get_property(node, "reg", NULL); |
658 | if (!reg) | 658 | if (!reg) |
659 | continue; | 659 | continue; |
660 | dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); | 660 | dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); |
@@ -669,7 +669,7 @@ pcibios_make_OF_bus_map(void) | |||
669 | { | 669 | { |
670 | int i; | 670 | int i; |
671 | struct pci_controller* hose; | 671 | struct pci_controller* hose; |
672 | u8* of_prop_map; | 672 | struct property *map_prop; |
673 | 673 | ||
674 | pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); | 674 | pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); |
675 | if (!pci_to_OF_bus_map) { | 675 | if (!pci_to_OF_bus_map) { |
@@ -691,9 +691,12 @@ pcibios_make_OF_bus_map(void) | |||
691 | continue; | 691 | continue; |
692 | make_one_node_map(node, hose->first_busno); | 692 | make_one_node_map(node, hose->first_busno); |
693 | } | 693 | } |
694 | of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL); | 694 | map_prop = of_find_property(find_path_device("/"), |
695 | if (of_prop_map) | 695 | "pci-OF-bus-map", NULL); |
696 | memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count); | 696 | if (map_prop) { |
697 | BUG_ON(pci_bus_count > map_prop->length); | ||
698 | memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count); | ||
699 | } | ||
697 | #ifdef DEBUG | 700 | #ifdef DEBUG |
698 | printk("PCI->OF bus map:\n"); | 701 | printk("PCI->OF bus map:\n"); |
699 | for (i=0; i<pci_bus_count; i++) { | 702 | for (i=0; i<pci_bus_count; i++) { |
@@ -712,7 +715,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
712 | struct device_node* sub_node; | 715 | struct device_node* sub_node; |
713 | 716 | ||
714 | for (; node != 0;node = node->sibling) { | 717 | for (; node != 0;node = node->sibling) { |
715 | unsigned int *class_code; | 718 | const unsigned int *class_code; |
716 | 719 | ||
717 | if (filter(node, data)) | 720 | if (filter(node, data)) |
718 | return node; | 721 | return node; |
@@ -722,7 +725,7 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
722 | * a fake root for all functions of a multi-function device, | 725 | * a fake root for all functions of a multi-function device, |
723 | * we go down them as well. | 726 | * we go down them as well. |
724 | */ | 727 | */ |
725 | class_code = (unsigned int *) get_property(node, "class-code", NULL); | 728 | class_code = get_property(node, "class-code", NULL); |
726 | if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 729 | if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
727 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && | 730 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && |
728 | strcmp(node->name, "multifunc-device")) | 731 | strcmp(node->name, "multifunc-device")) |
@@ -737,10 +740,10 @@ scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* | |||
737 | static int | 740 | static int |
738 | scan_OF_pci_childs_iterator(struct device_node* node, void* data) | 741 | scan_OF_pci_childs_iterator(struct device_node* node, void* data) |
739 | { | 742 | { |
740 | unsigned int *reg; | 743 | const unsigned int *reg; |
741 | u8* fdata = (u8*)data; | 744 | u8* fdata = (u8*)data; |
742 | 745 | ||
743 | reg = (unsigned int *) get_property(node, "reg", NULL); | 746 | reg = get_property(node, "reg", NULL); |
744 | if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] | 747 | if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] |
745 | && ((reg[0] >> 16) & 0xff) == fdata[0]) | 748 | && ((reg[0] >> 16) & 0xff) == fdata[0]) |
746 | return 1; | 749 | return 1; |
@@ -841,7 +844,7 @@ find_OF_pci_device_filter(struct device_node* node, void* data) | |||
841 | int | 844 | int |
842 | pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) | 845 | pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) |
843 | { | 846 | { |
844 | unsigned int *reg; | 847 | const unsigned int *reg; |
845 | struct pci_controller* hose; | 848 | struct pci_controller* hose; |
846 | struct pci_dev* dev = NULL; | 849 | struct pci_dev* dev = NULL; |
847 | 850 | ||
@@ -854,7 +857,7 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) | |||
854 | if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, | 857 | if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, |
855 | find_OF_pci_device_filter, (void *)node)) | 858 | find_OF_pci_device_filter, (void *)node)) |
856 | return -ENODEV; | 859 | return -ENODEV; |
857 | reg = (unsigned int *) get_property(node, "reg", NULL); | 860 | reg = get_property(node, "reg", NULL); |
858 | if (!reg) | 861 | if (!reg) |
859 | return -ENODEV; | 862 | return -ENODEV; |
860 | *bus = (reg[0] >> 16) & 0xff; | 863 | *bus = (reg[0] >> 16) & 0xff; |
@@ -885,8 +888,8 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
885 | struct device_node *dev, int primary) | 888 | struct device_node *dev, int primary) |
886 | { | 889 | { |
887 | static unsigned int static_lc_ranges[256] __initdata; | 890 | static unsigned int static_lc_ranges[256] __initdata; |
888 | unsigned int *dt_ranges, *lc_ranges, *ranges, *prev; | 891 | const unsigned int *dt_ranges; |
889 | unsigned int size; | 892 | unsigned int *lc_ranges, *ranges, *prev, size; |
890 | int rlen = 0, orig_rlen; | 893 | int rlen = 0, orig_rlen; |
891 | int memno = 0; | 894 | int memno = 0; |
892 | struct resource *res; | 895 | struct resource *res; |
@@ -897,7 +900,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
897 | * that can have more than 3 ranges, fortunately using contiguous | 900 | * that can have more than 3 ranges, fortunately using contiguous |
898 | * addresses -- BenH | 901 | * addresses -- BenH |
899 | */ | 902 | */ |
900 | dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen); | 903 | dt_ranges = get_property(dev, "ranges", &rlen); |
901 | if (!dt_ranges) | 904 | if (!dt_ranges) |
902 | return; | 905 | return; |
903 | /* Sanity check, though hopefully that never happens */ | 906 | /* Sanity check, though hopefully that never happens */ |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 138134c8c17d..c1b1e14775e4 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -185,34 +185,6 @@ static void __devinit pci_setup_pci_controller(struct pci_controller *hose) | |||
185 | spin_unlock(&hose_spinlock); | 185 | spin_unlock(&hose_spinlock); |
186 | } | 186 | } |
187 | 187 | ||
188 | static void add_linux_pci_domain(struct device_node *dev, | ||
189 | struct pci_controller *phb) | ||
190 | { | ||
191 | struct property *of_prop; | ||
192 | unsigned int size; | ||
193 | |||
194 | of_prop = (struct property *) | ||
195 | get_property(dev, "linux,pci-domain", &size); | ||
196 | if (of_prop != NULL) | ||
197 | return; | ||
198 | WARN_ON(of_prop && size < sizeof(int)); | ||
199 | if (of_prop && size < sizeof(int)) | ||
200 | of_prop = NULL; | ||
201 | size = sizeof(struct property) + sizeof(int); | ||
202 | if (of_prop == NULL) { | ||
203 | if (mem_init_done) | ||
204 | of_prop = kmalloc(size, GFP_KERNEL); | ||
205 | else | ||
206 | of_prop = alloc_bootmem(size); | ||
207 | } | ||
208 | memset(of_prop, 0, sizeof(struct property)); | ||
209 | of_prop->name = "linux,pci-domain"; | ||
210 | of_prop->length = sizeof(int); | ||
211 | of_prop->value = (unsigned char *)&of_prop[1]; | ||
212 | *((int *)of_prop->value) = phb->global_number; | ||
213 | prom_add_property(dev, of_prop); | ||
214 | } | ||
215 | |||
216 | struct pci_controller * pcibios_alloc_controller(struct device_node *dev) | 188 | struct pci_controller * pcibios_alloc_controller(struct device_node *dev) |
217 | { | 189 | { |
218 | struct pci_controller *phb; | 190 | struct pci_controller *phb; |
@@ -226,22 +198,13 @@ struct pci_controller * pcibios_alloc_controller(struct device_node *dev) | |||
226 | pci_setup_pci_controller(phb); | 198 | pci_setup_pci_controller(phb); |
227 | phb->arch_data = dev; | 199 | phb->arch_data = dev; |
228 | phb->is_dynamic = mem_init_done; | 200 | phb->is_dynamic = mem_init_done; |
229 | if (dev) { | 201 | if (dev) |
230 | PHB_SET_NODE(phb, of_node_to_nid(dev)); | 202 | PHB_SET_NODE(phb, of_node_to_nid(dev)); |
231 | add_linux_pci_domain(dev, phb); | ||
232 | } | ||
233 | return phb; | 203 | return phb; |
234 | } | 204 | } |
235 | 205 | ||
236 | void pcibios_free_controller(struct pci_controller *phb) | 206 | void pcibios_free_controller(struct pci_controller *phb) |
237 | { | 207 | { |
238 | if (phb->arch_data) { | ||
239 | struct device_node *np = phb->arch_data; | ||
240 | int *domain = (int *)get_property(np, | ||
241 | "linux,pci-domain", NULL); | ||
242 | if (domain) | ||
243 | *domain = -1; | ||
244 | } | ||
245 | if (phb->is_dynamic) | 208 | if (phb->is_dynamic) |
246 | kfree(phb); | 209 | kfree(phb); |
247 | } | 210 | } |
@@ -283,10 +246,10 @@ static void __init pcibios_claim_of_setup(void) | |||
283 | #ifdef CONFIG_PPC_MULTIPLATFORM | 246 | #ifdef CONFIG_PPC_MULTIPLATFORM |
284 | static u32 get_int_prop(struct device_node *np, const char *name, u32 def) | 247 | static u32 get_int_prop(struct device_node *np, const char *name, u32 def) |
285 | { | 248 | { |
286 | u32 *prop; | 249 | const u32 *prop; |
287 | int len; | 250 | int len; |
288 | 251 | ||
289 | prop = (u32 *) get_property(np, name, &len); | 252 | prop = get_property(np, name, &len); |
290 | if (prop && len >= 4) | 253 | if (prop && len >= 4) |
291 | return *prop; | 254 | return *prop; |
292 | return def; | 255 | return def; |
@@ -315,10 +278,11 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev) | |||
315 | u64 base, size; | 278 | u64 base, size; |
316 | unsigned int flags; | 279 | unsigned int flags; |
317 | struct resource *res; | 280 | struct resource *res; |
318 | u32 *addrs, i; | 281 | const u32 *addrs; |
282 | u32 i; | ||
319 | int proplen; | 283 | int proplen; |
320 | 284 | ||
321 | addrs = (u32 *) get_property(node, "assigned-addresses", &proplen); | 285 | addrs = get_property(node, "assigned-addresses", &proplen); |
322 | if (!addrs) | 286 | if (!addrs) |
323 | return; | 287 | return; |
324 | DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); | 288 | DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); |
@@ -418,7 +382,7 @@ void __devinit of_scan_bus(struct device_node *node, | |||
418 | struct pci_bus *bus) | 382 | struct pci_bus *bus) |
419 | { | 383 | { |
420 | struct device_node *child = NULL; | 384 | struct device_node *child = NULL; |
421 | u32 *reg; | 385 | const u32 *reg; |
422 | int reglen, devfn; | 386 | int reglen, devfn; |
423 | struct pci_dev *dev; | 387 | struct pci_dev *dev; |
424 | 388 | ||
@@ -426,7 +390,7 @@ void __devinit of_scan_bus(struct device_node *node, | |||
426 | 390 | ||
427 | while ((child = of_get_next_child(node, child)) != NULL) { | 391 | while ((child = of_get_next_child(node, child)) != NULL) { |
428 | DBG(" * %s\n", child->full_name); | 392 | DBG(" * %s\n", child->full_name); |
429 | reg = (u32 *) get_property(child, "reg", ®len); | 393 | reg = get_property(child, "reg", ®len); |
430 | if (reg == NULL || reglen < 20) | 394 | if (reg == NULL || reglen < 20) |
431 | continue; | 395 | continue; |
432 | devfn = (reg[0] >> 8) & 0xff; | 396 | devfn = (reg[0] >> 8) & 0xff; |
@@ -450,7 +414,7 @@ void __devinit of_scan_pci_bridge(struct device_node *node, | |||
450 | struct pci_dev *dev) | 414 | struct pci_dev *dev) |
451 | { | 415 | { |
452 | struct pci_bus *bus; | 416 | struct pci_bus *bus; |
453 | u32 *busrange, *ranges; | 417 | const u32 *busrange, *ranges; |
454 | int len, i, mode; | 418 | int len, i, mode; |
455 | struct resource *res; | 419 | struct resource *res; |
456 | unsigned int flags; | 420 | unsigned int flags; |
@@ -459,13 +423,13 @@ void __devinit of_scan_pci_bridge(struct device_node *node, | |||
459 | DBG("of_scan_pci_bridge(%s)\n", node->full_name); | 423 | DBG("of_scan_pci_bridge(%s)\n", node->full_name); |
460 | 424 | ||
461 | /* parse bus-range property */ | 425 | /* parse bus-range property */ |
462 | busrange = (u32 *) get_property(node, "bus-range", &len); | 426 | busrange = get_property(node, "bus-range", &len); |
463 | if (busrange == NULL || len != 8) { | 427 | if (busrange == NULL || len != 8) { |
464 | printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", | 428 | printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", |
465 | node->full_name); | 429 | node->full_name); |
466 | return; | 430 | return; |
467 | } | 431 | } |
468 | ranges = (u32 *) get_property(node, "ranges", &len); | 432 | ranges = get_property(node, "ranges", &len); |
469 | if (ranges == NULL) { | 433 | if (ranges == NULL) { |
470 | printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n", | 434 | printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n", |
471 | node->full_name); | 435 | node->full_name); |
@@ -929,13 +893,13 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, | |||
929 | unsigned int size; | 893 | unsigned int size; |
930 | }; | 894 | }; |
931 | 895 | ||
932 | struct isa_range *range; | 896 | const struct isa_range *range; |
933 | unsigned long pci_addr; | 897 | unsigned long pci_addr; |
934 | unsigned int isa_addr; | 898 | unsigned int isa_addr; |
935 | unsigned int size; | 899 | unsigned int size; |
936 | int rlen = 0; | 900 | int rlen = 0; |
937 | 901 | ||
938 | range = (struct isa_range *) get_property(isa_node, "ranges", &rlen); | 902 | range = get_property(isa_node, "ranges", &rlen); |
939 | if (range == NULL || (rlen < sizeof(struct isa_range))) { | 903 | if (range == NULL || (rlen < sizeof(struct isa_range))) { |
940 | printk(KERN_ERR "no ISA ranges or unexpected isa range size," | 904 | printk(KERN_ERR "no ISA ranges or unexpected isa range size," |
941 | "mapping 64k\n"); | 905 | "mapping 64k\n"); |
@@ -976,7 +940,8 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, | |||
976 | void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, | 940 | void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, |
977 | struct device_node *dev, int prim) | 941 | struct device_node *dev, int prim) |
978 | { | 942 | { |
979 | unsigned int *ranges, pci_space; | 943 | const unsigned int *ranges; |
944 | unsigned int pci_space; | ||
980 | unsigned long size; | 945 | unsigned long size; |
981 | int rlen = 0; | 946 | int rlen = 0; |
982 | int memno = 0; | 947 | int memno = 0; |
@@ -994,7 +959,7 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
994 | * (size depending on dev->n_addr_cells) | 959 | * (size depending on dev->n_addr_cells) |
995 | * cells 4+5 or 5+6: the size of the range | 960 | * cells 4+5 or 5+6: the size of the range |
996 | */ | 961 | */ |
997 | ranges = (unsigned int *) get_property(dev, "ranges", &rlen); | 962 | ranges = get_property(dev, "ranges", &rlen); |
998 | if (ranges == NULL) | 963 | if (ranges == NULL) |
999 | return; | 964 | return; |
1000 | hose->io_base_phys = 0; | 965 | hose->io_base_phys = 0; |
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index 1c18953514c3..68df018dae0e 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c | |||
@@ -40,8 +40,8 @@ | |||
40 | static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) | 40 | static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) |
41 | { | 41 | { |
42 | struct pci_controller *phb = data; | 42 | struct pci_controller *phb = data; |
43 | int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL); | 43 | const int *type = get_property(dn, "ibm,pci-config-space-type", NULL); |
44 | u32 *regs; | 44 | const u32 *regs; |
45 | struct pci_dn *pdn; | 45 | struct pci_dn *pdn; |
46 | 46 | ||
47 | if (mem_init_done) | 47 | if (mem_init_done) |
@@ -54,14 +54,14 @@ static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) | |||
54 | dn->data = pdn; | 54 | dn->data = pdn; |
55 | pdn->node = dn; | 55 | pdn->node = dn; |
56 | pdn->phb = phb; | 56 | pdn->phb = phb; |
57 | regs = (u32 *)get_property(dn, "reg", NULL); | 57 | regs = get_property(dn, "reg", NULL); |
58 | if (regs) { | 58 | if (regs) { |
59 | /* First register entry is addr (00BBSS00) */ | 59 | /* First register entry is addr (00BBSS00) */ |
60 | pdn->busno = (regs[0] >> 16) & 0xff; | 60 | pdn->busno = (regs[0] >> 16) & 0xff; |
61 | pdn->devfn = (regs[0] >> 8) & 0xff; | 61 | pdn->devfn = (regs[0] >> 8) & 0xff; |
62 | } | 62 | } |
63 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { | 63 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { |
64 | u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL); | 64 | const u32 *busp = get_property(dn, "linux,subbus", NULL); |
65 | if (busp) | 65 | if (busp) |
66 | pdn->bussubno = *busp; | 66 | pdn->bussubno = *busp; |
67 | } | 67 | } |
@@ -96,10 +96,11 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre, | |||
96 | 96 | ||
97 | /* We started with a phb, iterate all childs */ | 97 | /* We started with a phb, iterate all childs */ |
98 | for (dn = start->child; dn; dn = nextdn) { | 98 | for (dn = start->child; dn; dn = nextdn) { |
99 | u32 *classp, class; | 99 | const u32 *classp; |
100 | u32 class; | ||
100 | 101 | ||
101 | nextdn = NULL; | 102 | nextdn = NULL; |
102 | classp = (u32 *)get_property(dn, "class-code", NULL); | 103 | classp = get_property(dn, "class-code", NULL); |
103 | class = classp ? *classp : 0; | 104 | class = classp ? *classp : 0; |
104 | 105 | ||
105 | if (pre && ((ret = pre(dn, data)) != NULL)) | 106 | if (pre && ((ret = pre(dn, data)) != NULL)) |
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 39d3bfcabcd2..807193a3c784 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -91,25 +91,10 @@ EXPORT_SYMBOL(__copy_tofrom_user); | |||
91 | EXPORT_SYMBOL(__clear_user); | 91 | EXPORT_SYMBOL(__clear_user); |
92 | EXPORT_SYMBOL(__strncpy_from_user); | 92 | EXPORT_SYMBOL(__strncpy_from_user); |
93 | EXPORT_SYMBOL(__strnlen_user); | 93 | EXPORT_SYMBOL(__strnlen_user); |
94 | 94 | #ifdef CONFIG_PPC64 | |
95 | #ifndef __powerpc64__ | 95 | EXPORT_SYMBOL(copy_4K_page); |
96 | EXPORT_SYMBOL(__ide_mm_insl); | ||
97 | EXPORT_SYMBOL(__ide_mm_outsw); | ||
98 | EXPORT_SYMBOL(__ide_mm_insw); | ||
99 | EXPORT_SYMBOL(__ide_mm_outsl); | ||
100 | #endif | 96 | #endif |
101 | 97 | ||
102 | EXPORT_SYMBOL(_insb); | ||
103 | EXPORT_SYMBOL(_outsb); | ||
104 | EXPORT_SYMBOL(_insw); | ||
105 | EXPORT_SYMBOL(_outsw); | ||
106 | EXPORT_SYMBOL(_insl); | ||
107 | EXPORT_SYMBOL(_outsl); | ||
108 | EXPORT_SYMBOL(_insw_ns); | ||
109 | EXPORT_SYMBOL(_outsw_ns); | ||
110 | EXPORT_SYMBOL(_insl_ns); | ||
111 | EXPORT_SYMBOL(_outsl_ns); | ||
112 | |||
113 | #if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) | 98 | #if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) |
114 | EXPORT_SYMBOL(ppc_ide_md); | 99 | EXPORT_SYMBOL(ppc_ide_md); |
115 | #endif | 100 | #endif |
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index a1787ffb6319..eb913f80bfb1 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -757,24 +757,9 @@ static int __init early_init_dt_scan_root(unsigned long node, | |||
757 | static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) | 757 | static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) |
758 | { | 758 | { |
759 | cell_t *p = *cellp; | 759 | cell_t *p = *cellp; |
760 | unsigned long r; | ||
761 | 760 | ||
762 | /* Ignore more than 2 cells */ | 761 | *cellp = p + s; |
763 | while (s > sizeof(unsigned long) / 4) { | 762 | return of_read_ulong(p, s); |
764 | p++; | ||
765 | s--; | ||
766 | } | ||
767 | r = *p++; | ||
768 | #ifdef CONFIG_PPC64 | ||
769 | if (s > 1) { | ||
770 | r <<= 32; | ||
771 | r |= *(p++); | ||
772 | s--; | ||
773 | } | ||
774 | #endif | ||
775 | |||
776 | *cellp = p; | ||
777 | return r; | ||
778 | } | 763 | } |
779 | 764 | ||
780 | 765 | ||
@@ -942,11 +927,11 @@ void __init early_init_devtree(void *params) | |||
942 | int | 927 | int |
943 | prom_n_addr_cells(struct device_node* np) | 928 | prom_n_addr_cells(struct device_node* np) |
944 | { | 929 | { |
945 | int* ip; | 930 | const int *ip; |
946 | do { | 931 | do { |
947 | if (np->parent) | 932 | if (np->parent) |
948 | np = np->parent; | 933 | np = np->parent; |
949 | ip = (int *) get_property(np, "#address-cells", NULL); | 934 | ip = get_property(np, "#address-cells", NULL); |
950 | if (ip != NULL) | 935 | if (ip != NULL) |
951 | return *ip; | 936 | return *ip; |
952 | } while (np->parent); | 937 | } while (np->parent); |
@@ -958,11 +943,11 @@ EXPORT_SYMBOL(prom_n_addr_cells); | |||
958 | int | 943 | int |
959 | prom_n_size_cells(struct device_node* np) | 944 | prom_n_size_cells(struct device_node* np) |
960 | { | 945 | { |
961 | int* ip; | 946 | const int* ip; |
962 | do { | 947 | do { |
963 | if (np->parent) | 948 | if (np->parent) |
964 | np = np->parent; | 949 | np = np->parent; |
965 | ip = (int *) get_property(np, "#size-cells", NULL); | 950 | ip = get_property(np, "#size-cells", NULL); |
966 | if (ip != NULL) | 951 | if (ip != NULL) |
967 | return *ip; | 952 | return *ip; |
968 | } while (np->parent); | 953 | } while (np->parent); |
@@ -1034,7 +1019,7 @@ int device_is_compatible(struct device_node *device, const char *compat) | |||
1034 | const char* cp; | 1019 | const char* cp; |
1035 | int cplen, l; | 1020 | int cplen, l; |
1036 | 1021 | ||
1037 | cp = (char *) get_property(device, "compatible", &cplen); | 1022 | cp = get_property(device, "compatible", &cplen); |
1038 | if (cp == NULL) | 1023 | if (cp == NULL) |
1039 | return 0; | 1024 | return 0; |
1040 | while (cplen > 0) { | 1025 | while (cplen > 0) { |
@@ -1449,7 +1434,7 @@ static int of_finish_dynamic_node(struct device_node *node) | |||
1449 | { | 1434 | { |
1450 | struct device_node *parent = of_get_parent(node); | 1435 | struct device_node *parent = of_get_parent(node); |
1451 | int err = 0; | 1436 | int err = 0; |
1452 | phandle *ibm_phandle; | 1437 | const phandle *ibm_phandle; |
1453 | 1438 | ||
1454 | node->name = get_property(node, "name", NULL); | 1439 | node->name = get_property(node, "name", NULL); |
1455 | node->type = get_property(node, "device_type", NULL); | 1440 | node->type = get_property(node, "device_type", NULL); |
@@ -1466,8 +1451,7 @@ static int of_finish_dynamic_node(struct device_node *node) | |||
1466 | return -ENODEV; | 1451 | return -ENODEV; |
1467 | 1452 | ||
1468 | /* fix up new node's linux_phandle field */ | 1453 | /* fix up new node's linux_phandle field */ |
1469 | if ((ibm_phandle = (unsigned int *)get_property(node, | 1454 | if ((ibm_phandle = get_property(node, "ibm,phandle", NULL))) |
1470 | "ibm,phandle", NULL))) | ||
1471 | node->linux_phandle = *ibm_phandle; | 1455 | node->linux_phandle = *ibm_phandle; |
1472 | 1456 | ||
1473 | out: | 1457 | out: |
@@ -1528,7 +1512,7 @@ struct property *of_find_property(struct device_node *np, const char *name, | |||
1528 | * Find a property with a given name for a given node | 1512 | * Find a property with a given name for a given node |
1529 | * and return the value. | 1513 | * and return the value. |
1530 | */ | 1514 | */ |
1531 | void *get_property(struct device_node *np, const char *name, int *lenp) | 1515 | const void *get_property(struct device_node *np, const char *name, int *lenp) |
1532 | { | 1516 | { |
1533 | struct property *pp = of_find_property(np,name,lenp); | 1517 | struct property *pp = of_find_property(np,name,lenp); |
1534 | return pp ? pp->value : NULL; | 1518 | return pp ? pp->value : NULL; |
@@ -1658,16 +1642,16 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) | |||
1658 | hardid = get_hard_smp_processor_id(cpu); | 1642 | hardid = get_hard_smp_processor_id(cpu); |
1659 | 1643 | ||
1660 | for_each_node_by_type(np, "cpu") { | 1644 | for_each_node_by_type(np, "cpu") { |
1661 | u32 *intserv; | 1645 | const u32 *intserv; |
1662 | unsigned int plen, t; | 1646 | unsigned int plen, t; |
1663 | 1647 | ||
1664 | /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist | 1648 | /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist |
1665 | * fallback to "reg" property and assume no threads | 1649 | * fallback to "reg" property and assume no threads |
1666 | */ | 1650 | */ |
1667 | intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", | 1651 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", |
1668 | &plen); | 1652 | &plen); |
1669 | if (intserv == NULL) { | 1653 | if (intserv == NULL) { |
1670 | u32 *reg = (u32 *)get_property(np, "reg", NULL); | 1654 | const u32 *reg = get_property(np, "reg", NULL); |
1671 | if (reg == NULL) | 1655 | if (reg == NULL) |
1672 | continue; | 1656 | continue; |
1673 | if (*reg == hardid) { | 1657 | if (*reg == hardid) { |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 4394e545f9f7..b91761639d96 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -2033,16 +2033,22 @@ static void __init fixup_device_tree_maple(void) | |||
2033 | #endif | 2033 | #endif |
2034 | 2034 | ||
2035 | #ifdef CONFIG_PPC_CHRP | 2035 | #ifdef CONFIG_PPC_CHRP |
2036 | /* Pegasos lacks the "ranges" property in the isa node */ | 2036 | /* Pegasos and BriQ lacks the "ranges" property in the isa node */ |
2037 | static void __init fixup_device_tree_chrp(void) | 2037 | static void __init fixup_device_tree_chrp(void) |
2038 | { | 2038 | { |
2039 | phandle isa; | 2039 | phandle isa; |
2040 | u32 isa_ranges[6]; | 2040 | u32 isa_ranges[6]; |
2041 | u32 rloc = 0x01006000; /* IO space; PCI device = 12 */ | ||
2041 | char *name; | 2042 | char *name; |
2042 | int rc; | 2043 | int rc; |
2043 | 2044 | ||
2044 | name = "/pci@80000000/isa@c"; | 2045 | name = "/pci@80000000/isa@c"; |
2045 | isa = call_prom("finddevice", 1, 1, ADDR(name)); | 2046 | isa = call_prom("finddevice", 1, 1, ADDR(name)); |
2047 | if (!PHANDLE_VALID(isa)) { | ||
2048 | name = "/pci@ff500000/isa@6"; | ||
2049 | isa = call_prom("finddevice", 1, 1, ADDR(name)); | ||
2050 | rloc = 0x01003000; /* IO space; PCI device = 6 */ | ||
2051 | } | ||
2046 | if (!PHANDLE_VALID(isa)) | 2052 | if (!PHANDLE_VALID(isa)) |
2047 | return; | 2053 | return; |
2048 | 2054 | ||
@@ -2054,7 +2060,7 @@ static void __init fixup_device_tree_chrp(void) | |||
2054 | 2060 | ||
2055 | isa_ranges[0] = 0x1; | 2061 | isa_ranges[0] = 0x1; |
2056 | isa_ranges[1] = 0x0; | 2062 | isa_ranges[1] = 0x0; |
2057 | isa_ranges[2] = 0x01006000; | 2063 | isa_ranges[2] = rloc; |
2058 | isa_ranges[3] = 0x0; | 2064 | isa_ranges[3] = 0x0; |
2059 | isa_ranges[4] = 0x0; | 2065 | isa_ranges[4] = 0x0; |
2060 | isa_ranges[5] = 0x00010000; | 2066 | isa_ranges[5] = 0x00010000; |
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index a10825a5dfe6..603dff3ad62a 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | /* Debug utility */ | 28 | /* Debug utility */ |
29 | #ifdef DEBUG | 29 | #ifdef DEBUG |
30 | static void of_dump_addr(const char *s, u32 *addr, int na) | 30 | static void of_dump_addr(const char *s, const u32 *addr, int na) |
31 | { | 31 | { |
32 | printk("%s", s); | 32 | printk("%s", s); |
33 | while(na--) | 33 | while(na--) |
@@ -35,7 +35,7 @@ static void of_dump_addr(const char *s, u32 *addr, int na) | |||
35 | printk("\n"); | 35 | printk("\n"); |
36 | } | 36 | } |
37 | #else | 37 | #else |
38 | static void of_dump_addr(const char *s, u32 *addr, int na) { } | 38 | static void of_dump_addr(const char *s, const u32 *addr, int na) { } |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | 41 | ||
@@ -46,9 +46,10 @@ struct of_bus { | |||
46 | int (*match)(struct device_node *parent); | 46 | int (*match)(struct device_node *parent); |
47 | void (*count_cells)(struct device_node *child, | 47 | void (*count_cells)(struct device_node *child, |
48 | int *addrc, int *sizec); | 48 | int *addrc, int *sizec); |
49 | u64 (*map)(u32 *addr, u32 *range, int na, int ns, int pna); | 49 | u64 (*map)(u32 *addr, const u32 *range, |
50 | int na, int ns, int pna); | ||
50 | int (*translate)(u32 *addr, u64 offset, int na); | 51 | int (*translate)(u32 *addr, u64 offset, int na); |
51 | unsigned int (*get_flags)(u32 *addr); | 52 | unsigned int (*get_flags)(const u32 *addr); |
52 | }; | 53 | }; |
53 | 54 | ||
54 | 55 | ||
@@ -65,7 +66,8 @@ static void of_bus_default_count_cells(struct device_node *dev, | |||
65 | *sizec = prom_n_size_cells(dev); | 66 | *sizec = prom_n_size_cells(dev); |
66 | } | 67 | } |
67 | 68 | ||
68 | static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna) | 69 | static u64 of_bus_default_map(u32 *addr, const u32 *range, |
70 | int na, int ns, int pna) | ||
69 | { | 71 | { |
70 | u64 cp, s, da; | 72 | u64 cp, s, da; |
71 | 73 | ||
@@ -93,7 +95,7 @@ static int of_bus_default_translate(u32 *addr, u64 offset, int na) | |||
93 | return 0; | 95 | return 0; |
94 | } | 96 | } |
95 | 97 | ||
96 | static unsigned int of_bus_default_get_flags(u32 *addr) | 98 | static unsigned int of_bus_default_get_flags(const u32 *addr) |
97 | { | 99 | { |
98 | return IORESOURCE_MEM; | 100 | return IORESOURCE_MEM; |
99 | } | 101 | } |
@@ -118,7 +120,7 @@ static void of_bus_pci_count_cells(struct device_node *np, | |||
118 | *sizec = 2; | 120 | *sizec = 2; |
119 | } | 121 | } |
120 | 122 | ||
121 | static u64 of_bus_pci_map(u32 *addr, u32 *range, int na, int ns, int pna) | 123 | static u64 of_bus_pci_map(u32 *addr, const u32 *range, int na, int ns, int pna) |
122 | { | 124 | { |
123 | u64 cp, s, da; | 125 | u64 cp, s, da; |
124 | 126 | ||
@@ -143,7 +145,7 @@ static int of_bus_pci_translate(u32 *addr, u64 offset, int na) | |||
143 | return of_bus_default_translate(addr + 1, offset, na - 1); | 145 | return of_bus_default_translate(addr + 1, offset, na - 1); |
144 | } | 146 | } |
145 | 147 | ||
146 | static unsigned int of_bus_pci_get_flags(u32 *addr) | 148 | static unsigned int of_bus_pci_get_flags(const u32 *addr) |
147 | { | 149 | { |
148 | unsigned int flags = 0; | 150 | unsigned int flags = 0; |
149 | u32 w = addr[0]; | 151 | u32 w = addr[0]; |
@@ -178,7 +180,7 @@ static void of_bus_isa_count_cells(struct device_node *child, | |||
178 | *sizec = 1; | 180 | *sizec = 1; |
179 | } | 181 | } |
180 | 182 | ||
181 | static u64 of_bus_isa_map(u32 *addr, u32 *range, int na, int ns, int pna) | 183 | static u64 of_bus_isa_map(u32 *addr, const u32 *range, int na, int ns, int pna) |
182 | { | 184 | { |
183 | u64 cp, s, da; | 185 | u64 cp, s, da; |
184 | 186 | ||
@@ -203,7 +205,7 @@ static int of_bus_isa_translate(u32 *addr, u64 offset, int na) | |||
203 | return of_bus_default_translate(addr + 1, offset, na - 1); | 205 | return of_bus_default_translate(addr + 1, offset, na - 1); |
204 | } | 206 | } |
205 | 207 | ||
206 | static unsigned int of_bus_isa_get_flags(u32 *addr) | 208 | static unsigned int of_bus_isa_get_flags(const u32 *addr) |
207 | { | 209 | { |
208 | unsigned int flags = 0; | 210 | unsigned int flags = 0; |
209 | u32 w = addr[0]; | 211 | u32 w = addr[0]; |
@@ -268,7 +270,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
268 | struct of_bus *pbus, u32 *addr, | 270 | struct of_bus *pbus, u32 *addr, |
269 | int na, int ns, int pna) | 271 | int na, int ns, int pna) |
270 | { | 272 | { |
271 | u32 *ranges; | 273 | const u32 *ranges; |
272 | unsigned int rlen; | 274 | unsigned int rlen; |
273 | int rone; | 275 | int rone; |
274 | u64 offset = OF_BAD_ADDR; | 276 | u64 offset = OF_BAD_ADDR; |
@@ -285,7 +287,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
285 | * to translate addresses that aren't supposed to be translated in | 287 | * to translate addresses that aren't supposed to be translated in |
286 | * the first place. --BenH. | 288 | * the first place. --BenH. |
287 | */ | 289 | */ |
288 | ranges = (u32 *)get_property(parent, "ranges", &rlen); | 290 | ranges = get_property(parent, "ranges", &rlen); |
289 | if (ranges == NULL || rlen == 0) { | 291 | if (ranges == NULL || rlen == 0) { |
290 | offset = of_read_number(addr, na); | 292 | offset = of_read_number(addr, na); |
291 | memset(addr, 0, pna * 4); | 293 | memset(addr, 0, pna * 4); |
@@ -328,7 +330,7 @@ static int of_translate_one(struct device_node *parent, struct of_bus *bus, | |||
328 | * that can be mapped to a cpu physical address). This is not really specified | 330 | * that can be mapped to a cpu physical address). This is not really specified |
329 | * that way, but this is traditionally the way IBM at least do things | 331 | * that way, but this is traditionally the way IBM at least do things |
330 | */ | 332 | */ |
331 | u64 of_translate_address(struct device_node *dev, u32 *in_addr) | 333 | u64 of_translate_address(struct device_node *dev, const u32 *in_addr) |
332 | { | 334 | { |
333 | struct device_node *parent = NULL; | 335 | struct device_node *parent = NULL; |
334 | struct of_bus *bus, *pbus; | 336 | struct of_bus *bus, *pbus; |
@@ -405,10 +407,10 @@ u64 of_translate_address(struct device_node *dev, u32 *in_addr) | |||
405 | } | 407 | } |
406 | EXPORT_SYMBOL(of_translate_address); | 408 | EXPORT_SYMBOL(of_translate_address); |
407 | 409 | ||
408 | u32 *of_get_address(struct device_node *dev, int index, u64 *size, | 410 | const u32 *of_get_address(struct device_node *dev, int index, u64 *size, |
409 | unsigned int *flags) | 411 | unsigned int *flags) |
410 | { | 412 | { |
411 | u32 *prop; | 413 | const u32 *prop; |
412 | unsigned int psize; | 414 | unsigned int psize; |
413 | struct device_node *parent; | 415 | struct device_node *parent; |
414 | struct of_bus *bus; | 416 | struct of_bus *bus; |
@@ -425,7 +427,7 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size, | |||
425 | return NULL; | 427 | return NULL; |
426 | 428 | ||
427 | /* Get "reg" or "assigned-addresses" property */ | 429 | /* Get "reg" or "assigned-addresses" property */ |
428 | prop = (u32 *)get_property(dev, bus->addresses, &psize); | 430 | prop = get_property(dev, bus->addresses, &psize); |
429 | if (prop == NULL) | 431 | if (prop == NULL) |
430 | return NULL; | 432 | return NULL; |
431 | psize /= 4; | 433 | psize /= 4; |
@@ -443,10 +445,10 @@ u32 *of_get_address(struct device_node *dev, int index, u64 *size, | |||
443 | } | 445 | } |
444 | EXPORT_SYMBOL(of_get_address); | 446 | EXPORT_SYMBOL(of_get_address); |
445 | 447 | ||
446 | u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, | 448 | const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, |
447 | unsigned int *flags) | 449 | unsigned int *flags) |
448 | { | 450 | { |
449 | u32 *prop; | 451 | const u32 *prop; |
450 | unsigned int psize; | 452 | unsigned int psize; |
451 | struct device_node *parent; | 453 | struct device_node *parent; |
452 | struct of_bus *bus; | 454 | struct of_bus *bus; |
@@ -467,7 +469,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, | |||
467 | return NULL; | 469 | return NULL; |
468 | 470 | ||
469 | /* Get "reg" or "assigned-addresses" property */ | 471 | /* Get "reg" or "assigned-addresses" property */ |
470 | prop = (u32 *)get_property(dev, bus->addresses, &psize); | 472 | prop = get_property(dev, bus->addresses, &psize); |
471 | if (prop == NULL) | 473 | if (prop == NULL) |
472 | return NULL; | 474 | return NULL; |
473 | psize /= 4; | 475 | psize /= 4; |
@@ -485,7 +487,7 @@ u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, | |||
485 | } | 487 | } |
486 | EXPORT_SYMBOL(of_get_pci_address); | 488 | EXPORT_SYMBOL(of_get_pci_address); |
487 | 489 | ||
488 | static int __of_address_to_resource(struct device_node *dev, u32 *addrp, | 490 | static int __of_address_to_resource(struct device_node *dev, const u32 *addrp, |
489 | u64 size, unsigned int flags, | 491 | u64 size, unsigned int flags, |
490 | struct resource *r) | 492 | struct resource *r) |
491 | { | 493 | { |
@@ -516,7 +518,7 @@ static int __of_address_to_resource(struct device_node *dev, u32 *addrp, | |||
516 | int of_address_to_resource(struct device_node *dev, int index, | 518 | int of_address_to_resource(struct device_node *dev, int index, |
517 | struct resource *r) | 519 | struct resource *r) |
518 | { | 520 | { |
519 | u32 *addrp; | 521 | const u32 *addrp; |
520 | u64 size; | 522 | u64 size; |
521 | unsigned int flags; | 523 | unsigned int flags; |
522 | 524 | ||
@@ -530,7 +532,7 @@ EXPORT_SYMBOL_GPL(of_address_to_resource); | |||
530 | int of_pci_address_to_resource(struct device_node *dev, int bar, | 532 | int of_pci_address_to_resource(struct device_node *dev, int bar, |
531 | struct resource *r) | 533 | struct resource *r) |
532 | { | 534 | { |
533 | u32 *addrp; | 535 | const u32 *addrp; |
534 | u64 size; | 536 | u64 size; |
535 | unsigned int flags; | 537 | unsigned int flags; |
536 | 538 | ||
@@ -541,13 +543,14 @@ int of_pci_address_to_resource(struct device_node *dev, int bar, | |||
541 | } | 543 | } |
542 | EXPORT_SYMBOL_GPL(of_pci_address_to_resource); | 544 | EXPORT_SYMBOL_GPL(of_pci_address_to_resource); |
543 | 545 | ||
544 | void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, | 546 | void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, |
545 | unsigned long *busno, unsigned long *phys, unsigned long *size) | 547 | unsigned long *busno, unsigned long *phys, unsigned long *size) |
546 | { | 548 | { |
547 | u32 *dma_window, cells; | 549 | const u32 *dma_window; |
548 | unsigned char *prop; | 550 | u32 cells; |
551 | const unsigned char *prop; | ||
549 | 552 | ||
550 | dma_window = (u32 *)dma_window_prop; | 553 | dma_window = dma_window_prop; |
551 | 554 | ||
552 | /* busno is always one cell */ | 555 | /* busno is always one cell */ |
553 | *busno = *(dma_window++); | 556 | *busno = *(dma_window++); |
@@ -576,13 +579,13 @@ static struct device_node *of_irq_dflt_pic; | |||
576 | static struct device_node *of_irq_find_parent(struct device_node *child) | 579 | static struct device_node *of_irq_find_parent(struct device_node *child) |
577 | { | 580 | { |
578 | struct device_node *p; | 581 | struct device_node *p; |
579 | phandle *parp; | 582 | const phandle *parp; |
580 | 583 | ||
581 | if (!of_node_get(child)) | 584 | if (!of_node_get(child)) |
582 | return NULL; | 585 | return NULL; |
583 | 586 | ||
584 | do { | 587 | do { |
585 | parp = (phandle *)get_property(child, "interrupt-parent", NULL); | 588 | parp = get_property(child, "interrupt-parent", NULL); |
586 | if (parp == NULL) | 589 | if (parp == NULL) |
587 | p = of_get_parent(child); | 590 | p = of_get_parent(child); |
588 | else { | 591 | else { |
@@ -639,11 +642,11 @@ void of_irq_map_init(unsigned int flags) | |||
639 | 642 | ||
640 | } | 643 | } |
641 | 644 | ||
642 | int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | 645 | int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, |
643 | u32 *addr, struct of_irq *out_irq) | 646 | const u32 *addr, struct of_irq *out_irq) |
644 | { | 647 | { |
645 | struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; | 648 | struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; |
646 | u32 *tmp, *imap, *imask; | 649 | const u32 *tmp, *imap, *imask; |
647 | u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; | 650 | u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; |
648 | int imaplen, match, i; | 651 | int imaplen, match, i; |
649 | 652 | ||
@@ -657,7 +660,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
657 | * is none, we are nice and just walk up the tree | 660 | * is none, we are nice and just walk up the tree |
658 | */ | 661 | */ |
659 | do { | 662 | do { |
660 | tmp = (u32 *)get_property(ipar, "#interrupt-cells", NULL); | 663 | tmp = get_property(ipar, "#interrupt-cells", NULL); |
661 | if (tmp != NULL) { | 664 | if (tmp != NULL) { |
662 | intsize = *tmp; | 665 | intsize = *tmp; |
663 | break; | 666 | break; |
@@ -681,7 +684,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
681 | */ | 684 | */ |
682 | old = of_node_get(ipar); | 685 | old = of_node_get(ipar); |
683 | do { | 686 | do { |
684 | tmp = (u32 *)get_property(old, "#address-cells", NULL); | 687 | tmp = get_property(old, "#address-cells", NULL); |
685 | tnode = of_get_parent(old); | 688 | tnode = of_get_parent(old); |
686 | of_node_put(old); | 689 | of_node_put(old); |
687 | old = tnode; | 690 | old = tnode; |
@@ -708,7 +711,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
708 | } | 711 | } |
709 | 712 | ||
710 | /* Now look for an interrupt-map */ | 713 | /* Now look for an interrupt-map */ |
711 | imap = (u32 *)get_property(ipar, "interrupt-map", &imaplen); | 714 | imap = get_property(ipar, "interrupt-map", &imaplen); |
712 | /* No interrupt map, check for an interrupt parent */ | 715 | /* No interrupt map, check for an interrupt parent */ |
713 | if (imap == NULL) { | 716 | if (imap == NULL) { |
714 | DBG(" -> no map, getting parent\n"); | 717 | DBG(" -> no map, getting parent\n"); |
@@ -718,7 +721,7 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
718 | imaplen /= sizeof(u32); | 721 | imaplen /= sizeof(u32); |
719 | 722 | ||
720 | /* Look for a mask */ | 723 | /* Look for a mask */ |
721 | imask = (u32 *)get_property(ipar, "interrupt-map-mask", NULL); | 724 | imask = get_property(ipar, "interrupt-map-mask", NULL); |
722 | 725 | ||
723 | /* If we were passed no "reg" property and we attempt to parse | 726 | /* If we were passed no "reg" property and we attempt to parse |
724 | * an interrupt-map, then #address-cells must be 0. | 727 | * an interrupt-map, then #address-cells must be 0. |
@@ -765,14 +768,14 @@ int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, | |||
765 | /* Get #interrupt-cells and #address-cells of new | 768 | /* Get #interrupt-cells and #address-cells of new |
766 | * parent | 769 | * parent |
767 | */ | 770 | */ |
768 | tmp = (u32 *)get_property(newpar, "#interrupt-cells", | 771 | tmp = get_property(newpar, "#interrupt-cells", |
769 | NULL); | 772 | NULL); |
770 | if (tmp == NULL) { | 773 | if (tmp == NULL) { |
771 | DBG(" -> parent lacks #interrupt-cells !\n"); | 774 | DBG(" -> parent lacks #interrupt-cells !\n"); |
772 | goto fail; | 775 | goto fail; |
773 | } | 776 | } |
774 | newintsize = *tmp; | 777 | newintsize = *tmp; |
775 | tmp = (u32 *)get_property(newpar, "#address-cells", | 778 | tmp = get_property(newpar, "#address-cells", |
776 | NULL); | 779 | NULL); |
777 | newaddrsize = (tmp == NULL) ? 0 : *tmp; | 780 | newaddrsize = (tmp == NULL) ? 0 : *tmp; |
778 | 781 | ||
@@ -818,14 +821,14 @@ EXPORT_SYMBOL_GPL(of_irq_map_raw); | |||
818 | static int of_irq_map_oldworld(struct device_node *device, int index, | 821 | static int of_irq_map_oldworld(struct device_node *device, int index, |
819 | struct of_irq *out_irq) | 822 | struct of_irq *out_irq) |
820 | { | 823 | { |
821 | u32 *ints; | 824 | const u32 *ints; |
822 | int intlen; | 825 | int intlen; |
823 | 826 | ||
824 | /* | 827 | /* |
825 | * Old machines just have a list of interrupt numbers | 828 | * Old machines just have a list of interrupt numbers |
826 | * and no interrupt-controller nodes. | 829 | * and no interrupt-controller nodes. |
827 | */ | 830 | */ |
828 | ints = (u32 *) get_property(device, "AAPL,interrupts", &intlen); | 831 | ints = get_property(device, "AAPL,interrupts", &intlen); |
829 | if (ints == NULL) | 832 | if (ints == NULL) |
830 | return -EINVAL; | 833 | return -EINVAL; |
831 | intlen /= sizeof(u32); | 834 | intlen /= sizeof(u32); |
@@ -850,7 +853,8 @@ static int of_irq_map_oldworld(struct device_node *device, int index, | |||
850 | int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) | 853 | int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) |
851 | { | 854 | { |
852 | struct device_node *p; | 855 | struct device_node *p; |
853 | u32 *intspec, *tmp, intsize, intlen, *addr; | 856 | const u32 *intspec, *tmp, *addr; |
857 | u32 intsize, intlen; | ||
854 | int res; | 858 | int res; |
855 | 859 | ||
856 | DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); | 860 | DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); |
@@ -860,13 +864,13 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
860 | return of_irq_map_oldworld(device, index, out_irq); | 864 | return of_irq_map_oldworld(device, index, out_irq); |
861 | 865 | ||
862 | /* Get the interrupts property */ | 866 | /* Get the interrupts property */ |
863 | intspec = (u32 *)get_property(device, "interrupts", &intlen); | 867 | intspec = get_property(device, "interrupts", &intlen); |
864 | if (intspec == NULL) | 868 | if (intspec == NULL) |
865 | return -EINVAL; | 869 | return -EINVAL; |
866 | intlen /= sizeof(u32); | 870 | intlen /= sizeof(u32); |
867 | 871 | ||
868 | /* Get the reg property (if any) */ | 872 | /* Get the reg property (if any) */ |
869 | addr = (u32 *)get_property(device, "reg", NULL); | 873 | addr = get_property(device, "reg", NULL); |
870 | 874 | ||
871 | /* Look for the interrupt parent. */ | 875 | /* Look for the interrupt parent. */ |
872 | p = of_irq_find_parent(device); | 876 | p = of_irq_find_parent(device); |
@@ -874,7 +878,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq | |||
874 | return -EINVAL; | 878 | return -EINVAL; |
875 | 879 | ||
876 | /* Get size of interrupt specifier */ | 880 | /* Get size of interrupt specifier */ |
877 | tmp = (u32 *)get_property(p, "#interrupt-cells", NULL); | 881 | tmp = get_property(p, "#interrupt-cells", NULL); |
878 | if (tmp == NULL) { | 882 | if (tmp == NULL) { |
879 | of_node_put(p); | 883 | of_node_put(p); |
880 | return -EINVAL; | 884 | return -EINVAL; |
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c index 9c9ad1fa9cce..2fe82abf1c52 100644 --- a/arch/powerpc/kernel/rtas-proc.c +++ b/arch/powerpc/kernel/rtas-proc.c | |||
@@ -246,12 +246,12 @@ struct file_operations ppc_rtas_rmo_buf_ops = { | |||
246 | 246 | ||
247 | static int ppc_rtas_find_all_sensors(void); | 247 | static int ppc_rtas_find_all_sensors(void); |
248 | static void ppc_rtas_process_sensor(struct seq_file *m, | 248 | static void ppc_rtas_process_sensor(struct seq_file *m, |
249 | struct individual_sensor *s, int state, int error, char *loc); | 249 | struct individual_sensor *s, int state, int error, const char *loc); |
250 | static char *ppc_rtas_process_error(int error); | 250 | static char *ppc_rtas_process_error(int error); |
251 | static void get_location_code(struct seq_file *m, | 251 | static void get_location_code(struct seq_file *m, |
252 | struct individual_sensor *s, char *loc); | 252 | struct individual_sensor *s, const char *loc); |
253 | static void check_location_string(struct seq_file *m, char *c); | 253 | static void check_location_string(struct seq_file *m, const char *c); |
254 | static void check_location(struct seq_file *m, char *c); | 254 | static void check_location(struct seq_file *m, const char *c); |
255 | 255 | ||
256 | static int __init proc_rtas_init(void) | 256 | static int __init proc_rtas_init(void) |
257 | { | 257 | { |
@@ -446,11 +446,11 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v) | |||
446 | for (i=0; i<sensors.quant; i++) { | 446 | for (i=0; i<sensors.quant; i++) { |
447 | struct individual_sensor *p = &sensors.sensor[i]; | 447 | struct individual_sensor *p = &sensors.sensor[i]; |
448 | char rstr[64]; | 448 | char rstr[64]; |
449 | char *loc; | 449 | const char *loc; |
450 | int llen, offs; | 450 | int llen, offs; |
451 | 451 | ||
452 | sprintf (rstr, SENSOR_PREFIX"%04d", p->token); | 452 | sprintf (rstr, SENSOR_PREFIX"%04d", p->token); |
453 | loc = (char *) get_property(rtas_node, rstr, &llen); | 453 | loc = get_property(rtas_node, rstr, &llen); |
454 | 454 | ||
455 | /* A sensor may have multiple instances */ | 455 | /* A sensor may have multiple instances */ |
456 | for (j = 0, offs = 0; j <= p->quant; j++) { | 456 | for (j = 0, offs = 0; j <= p->quant; j++) { |
@@ -474,10 +474,10 @@ static int ppc_rtas_sensors_show(struct seq_file *m, void *v) | |||
474 | 474 | ||
475 | static int ppc_rtas_find_all_sensors(void) | 475 | static int ppc_rtas_find_all_sensors(void) |
476 | { | 476 | { |
477 | unsigned int *utmp; | 477 | const unsigned int *utmp; |
478 | int len, i; | 478 | int len, i; |
479 | 479 | ||
480 | utmp = (unsigned int *) get_property(rtas_node, "rtas-sensors", &len); | 480 | utmp = get_property(rtas_node, "rtas-sensors", &len); |
481 | if (utmp == NULL) { | 481 | if (utmp == NULL) { |
482 | printk (KERN_ERR "error: could not get rtas-sensors\n"); | 482 | printk (KERN_ERR "error: could not get rtas-sensors\n"); |
483 | return 1; | 483 | return 1; |
@@ -530,7 +530,7 @@ static char *ppc_rtas_process_error(int error) | |||
530 | */ | 530 | */ |
531 | 531 | ||
532 | static void ppc_rtas_process_sensor(struct seq_file *m, | 532 | static void ppc_rtas_process_sensor(struct seq_file *m, |
533 | struct individual_sensor *s, int state, int error, char *loc) | 533 | struct individual_sensor *s, int state, int error, const char *loc) |
534 | { | 534 | { |
535 | /* Defined return vales */ | 535 | /* Defined return vales */ |
536 | const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t", | 536 | const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t", |
@@ -682,7 +682,7 @@ static void ppc_rtas_process_sensor(struct seq_file *m, | |||
682 | 682 | ||
683 | /* ****************************************************************** */ | 683 | /* ****************************************************************** */ |
684 | 684 | ||
685 | static void check_location(struct seq_file *m, char *c) | 685 | static void check_location(struct seq_file *m, const char *c) |
686 | { | 686 | { |
687 | switch (c[0]) { | 687 | switch (c[0]) { |
688 | case LOC_PLANAR: | 688 | case LOC_PLANAR: |
@@ -719,7 +719,7 @@ static void check_location(struct seq_file *m, char *c) | |||
719 | * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ] | 719 | * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ] |
720 | * the '.' may be an abbrevation | 720 | * the '.' may be an abbrevation |
721 | */ | 721 | */ |
722 | static void check_location_string(struct seq_file *m, char *c) | 722 | static void check_location_string(struct seq_file *m, const char *c) |
723 | { | 723 | { |
724 | while (*c) { | 724 | while (*c) { |
725 | if (isalpha(*c) || *c == '.') | 725 | if (isalpha(*c) || *c == '.') |
@@ -733,7 +733,8 @@ static void check_location_string(struct seq_file *m, char *c) | |||
733 | 733 | ||
734 | /* ****************************************************************** */ | 734 | /* ****************************************************************** */ |
735 | 735 | ||
736 | static void get_location_code(struct seq_file *m, struct individual_sensor *s, char *loc) | 736 | static void get_location_code(struct seq_file *m, struct individual_sensor *s, |
737 | const char *loc) | ||
737 | { | 738 | { |
738 | if (!loc || !*loc) { | 739 | if (!loc || !*loc) { |
739 | seq_printf(m, "---");/* does not have a location */ | 740 | seq_printf(m, "---");/* does not have a location */ |
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 77f1e06d208d..6ef80d4e38d3 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
@@ -177,10 +177,12 @@ void __init udbg_init_rtas_console(void) | |||
177 | void rtas_progress(char *s, unsigned short hex) | 177 | void rtas_progress(char *s, unsigned short hex) |
178 | { | 178 | { |
179 | struct device_node *root; | 179 | struct device_node *root; |
180 | int width, *p; | 180 | int width; |
181 | const int *p; | ||
181 | char *os; | 182 | char *os; |
182 | static int display_character, set_indicator; | 183 | static int display_character, set_indicator; |
183 | static int display_width, display_lines, *row_width, form_feed; | 184 | static int display_width, display_lines, form_feed; |
185 | const static int *row_width; | ||
184 | static DEFINE_SPINLOCK(progress_lock); | 186 | static DEFINE_SPINLOCK(progress_lock); |
185 | static int current_line; | 187 | static int current_line; |
186 | static int pending_newline = 0; /* did last write end with unprinted newline? */ | 188 | static int pending_newline = 0; /* did last write end with unprinted newline? */ |
@@ -191,16 +193,16 @@ void rtas_progress(char *s, unsigned short hex) | |||
191 | if (display_width == 0) { | 193 | if (display_width == 0) { |
192 | display_width = 0x10; | 194 | display_width = 0x10; |
193 | if ((root = find_path_device("/rtas"))) { | 195 | if ((root = find_path_device("/rtas"))) { |
194 | if ((p = (unsigned int *)get_property(root, | 196 | if ((p = get_property(root, |
195 | "ibm,display-line-length", NULL))) | 197 | "ibm,display-line-length", NULL))) |
196 | display_width = *p; | 198 | display_width = *p; |
197 | if ((p = (unsigned int *)get_property(root, | 199 | if ((p = get_property(root, |
198 | "ibm,form-feed", NULL))) | 200 | "ibm,form-feed", NULL))) |
199 | form_feed = *p; | 201 | form_feed = *p; |
200 | if ((p = (unsigned int *)get_property(root, | 202 | if ((p = get_property(root, |
201 | "ibm,display-number-of-lines", NULL))) | 203 | "ibm,display-number-of-lines", NULL))) |
202 | display_lines = *p; | 204 | display_lines = *p; |
203 | row_width = (unsigned int *)get_property(root, | 205 | row_width = get_property(root, |
204 | "ibm,display-truncation-length", NULL); | 206 | "ibm,display-truncation-length", NULL); |
205 | } | 207 | } |
206 | display_character = rtas_token("display-character"); | 208 | display_character = rtas_token("display-character"); |
@@ -293,10 +295,10 @@ EXPORT_SYMBOL(rtas_progress); /* needed by rtas_flash module */ | |||
293 | 295 | ||
294 | int rtas_token(const char *service) | 296 | int rtas_token(const char *service) |
295 | { | 297 | { |
296 | int *tokp; | 298 | const int *tokp; |
297 | if (rtas.dev == NULL) | 299 | if (rtas.dev == NULL) |
298 | return RTAS_UNKNOWN_SERVICE; | 300 | return RTAS_UNKNOWN_SERVICE; |
299 | tokp = (int *) get_property(rtas.dev, service, NULL); | 301 | tokp = get_property(rtas.dev, service, NULL); |
300 | return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; | 302 | return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; |
301 | } | 303 | } |
302 | EXPORT_SYMBOL(rtas_token); | 304 | EXPORT_SYMBOL(rtas_token); |
@@ -626,6 +628,9 @@ void rtas_os_term(char *str) | |||
626 | { | 628 | { |
627 | int status; | 629 | int status; |
628 | 630 | ||
631 | if (panic_timeout) | ||
632 | return; | ||
633 | |||
629 | if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term")) | 634 | if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term")) |
630 | return; | 635 | return; |
631 | 636 | ||
@@ -687,15 +692,14 @@ static int rtas_ibm_suspend_me(struct rtas_args *args) | |||
687 | int i; | 692 | int i; |
688 | long state; | 693 | long state; |
689 | long rc; | 694 | long rc; |
690 | unsigned long dummy; | 695 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; |
691 | |||
692 | struct rtas_suspend_me_data data; | 696 | struct rtas_suspend_me_data data; |
693 | 697 | ||
694 | /* Make sure the state is valid */ | 698 | /* Make sure the state is valid */ |
695 | rc = plpar_hcall(H_VASI_STATE, | 699 | rc = plpar_hcall(H_VASI_STATE, retbuf, |
696 | ((u64)args->args[0] << 32) | args->args[1], | 700 | ((u64)args->args[0] << 32) | args->args[1]); |
697 | 0, 0, 0, | 701 | |
698 | &state, &dummy, &dummy); | 702 | state = retbuf[0]; |
699 | 703 | ||
700 | if (rc) { | 704 | if (rc) { |
701 | printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc); | 705 | printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc); |
@@ -845,15 +849,15 @@ void __init rtas_initialize(void) | |||
845 | */ | 849 | */ |
846 | rtas.dev = of_find_node_by_name(NULL, "rtas"); | 850 | rtas.dev = of_find_node_by_name(NULL, "rtas"); |
847 | if (rtas.dev) { | 851 | if (rtas.dev) { |
848 | u32 *basep, *entryp; | 852 | const u32 *basep, *entryp, *sizep; |
849 | u32 *sizep; | ||
850 | 853 | ||
851 | basep = (u32 *)get_property(rtas.dev, "linux,rtas-base", NULL); | 854 | basep = get_property(rtas.dev, "linux,rtas-base", NULL); |
852 | sizep = (u32 *)get_property(rtas.dev, "rtas-size", NULL); | 855 | sizep = get_property(rtas.dev, "rtas-size", NULL); |
853 | if (basep != NULL && sizep != NULL) { | 856 | if (basep != NULL && sizep != NULL) { |
854 | rtas.base = *basep; | 857 | rtas.base = *basep; |
855 | rtas.size = *sizep; | 858 | rtas.size = *sizep; |
856 | entryp = (u32 *)get_property(rtas.dev, "linux,rtas-entry", NULL); | 859 | entryp = get_property(rtas.dev, |
860 | "linux,rtas-entry", NULL); | ||
857 | if (entryp == NULL) /* Ugh */ | 861 | if (entryp == NULL) /* Ugh */ |
858 | rtas.entry = rtas.base; | 862 | rtas.entry = rtas.base; |
859 | else | 863 | else |
@@ -909,6 +913,11 @@ int __init early_init_dt_scan_rtas(unsigned long node, | |||
909 | basep = of_get_flat_dt_prop(node, "get-term-char", NULL); | 913 | basep = of_get_flat_dt_prop(node, "get-term-char", NULL); |
910 | if (basep) | 914 | if (basep) |
911 | rtas_getchar_token = *basep; | 915 | rtas_getchar_token = *basep; |
916 | |||
917 | if (rtas_putchar_token != RTAS_UNKNOWN_SERVICE && | ||
918 | rtas_getchar_token != RTAS_UNKNOWN_SERVICE) | ||
919 | udbg_init_rtas_console(); | ||
920 | |||
912 | #endif | 921 | #endif |
913 | 922 | ||
914 | /* break now */ | 923 | /* break now */ |
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c index cda022657324..b4a0de79c060 100644 --- a/arch/powerpc/kernel/rtas_pci.c +++ b/arch/powerpc/kernel/rtas_pci.c | |||
@@ -57,7 +57,7 @@ static inline int config_access_valid(struct pci_dn *dn, int where) | |||
57 | 57 | ||
58 | static int of_device_available(struct device_node * dn) | 58 | static int of_device_available(struct device_node * dn) |
59 | { | 59 | { |
60 | char * status; | 60 | const char *status; |
61 | 61 | ||
62 | status = get_property(dn, "status", NULL); | 62 | status = get_property(dn, "status", NULL); |
63 | 63 | ||
@@ -81,8 +81,7 @@ int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) | |||
81 | if (!config_access_valid(pdn, where)) | 81 | if (!config_access_valid(pdn, where)) |
82 | return PCIBIOS_BAD_REGISTER_NUMBER; | 82 | return PCIBIOS_BAD_REGISTER_NUMBER; |
83 | 83 | ||
84 | addr = ((where & 0xf00) << 20) | (pdn->busno << 16) | | 84 | addr = rtas_config_addr(pdn->busno, pdn->devfn, where); |
85 | (pdn->devfn << 8) | (where & 0xff); | ||
86 | buid = pdn->phb->buid; | 85 | buid = pdn->phb->buid; |
87 | if (buid) { | 86 | if (buid) { |
88 | ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, | 87 | ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, |
@@ -134,8 +133,7 @@ int rtas_write_config(struct pci_dn *pdn, int where, int size, u32 val) | |||
134 | if (!config_access_valid(pdn, where)) | 133 | if (!config_access_valid(pdn, where)) |
135 | return PCIBIOS_BAD_REGISTER_NUMBER; | 134 | return PCIBIOS_BAD_REGISTER_NUMBER; |
136 | 135 | ||
137 | addr = ((where & 0xf00) << 20) | (pdn->busno << 16) | | 136 | addr = rtas_config_addr(pdn->busno, pdn->devfn, where); |
138 | (pdn->devfn << 8) | (where & 0xff); | ||
139 | buid = pdn->phb->buid; | 137 | buid = pdn->phb->buid; |
140 | if (buid) { | 138 | if (buid) { |
141 | ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, | 139 | ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, |
@@ -178,7 +176,7 @@ struct pci_ops rtas_pci_ops = { | |||
178 | 176 | ||
179 | int is_python(struct device_node *dev) | 177 | int is_python(struct device_node *dev) |
180 | { | 178 | { |
181 | char *model = (char *)get_property(dev, "model", NULL); | 179 | const char *model = get_property(dev, "model", NULL); |
182 | 180 | ||
183 | if (model && strstr(model, "Python")) | 181 | if (model && strstr(model, "Python")) |
184 | return 1; | 182 | return 1; |
@@ -234,7 +232,7 @@ void __init init_pci_config_tokens (void) | |||
234 | unsigned long __devinit get_phb_buid (struct device_node *phb) | 232 | unsigned long __devinit get_phb_buid (struct device_node *phb) |
235 | { | 233 | { |
236 | int addr_cells; | 234 | int addr_cells; |
237 | unsigned int *buid_vals; | 235 | const unsigned int *buid_vals; |
238 | unsigned int len; | 236 | unsigned int len; |
239 | unsigned long buid; | 237 | unsigned long buid; |
240 | 238 | ||
@@ -247,7 +245,7 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) | |||
247 | if (phb->parent->parent) | 245 | if (phb->parent->parent) |
248 | return 0; | 246 | return 0; |
249 | 247 | ||
250 | buid_vals = (unsigned int *) get_property(phb, "reg", &len); | 248 | buid_vals = get_property(phb, "reg", &len); |
251 | if (buid_vals == NULL) | 249 | if (buid_vals == NULL) |
252 | return 0; | 250 | return 0; |
253 | 251 | ||
@@ -264,10 +262,10 @@ unsigned long __devinit get_phb_buid (struct device_node *phb) | |||
264 | static int phb_set_bus_ranges(struct device_node *dev, | 262 | static int phb_set_bus_ranges(struct device_node *dev, |
265 | struct pci_controller *phb) | 263 | struct pci_controller *phb) |
266 | { | 264 | { |
267 | int *bus_range; | 265 | const int *bus_range; |
268 | unsigned int len; | 266 | unsigned int len; |
269 | 267 | ||
270 | bus_range = (int *) get_property(dev, "bus-range", &len); | 268 | bus_range = get_property(dev, "bus-range", &len); |
271 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 269 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
272 | return 1; | 270 | return 1; |
273 | } | 271 | } |
@@ -325,15 +323,15 @@ unsigned long __init find_and_init_phbs(void) | |||
325 | * in chosen. | 323 | * in chosen. |
326 | */ | 324 | */ |
327 | if (of_chosen) { | 325 | if (of_chosen) { |
328 | int *prop; | 326 | const int *prop; |
329 | 327 | ||
330 | prop = (int *)get_property(of_chosen, "linux,pci-probe-only", | 328 | prop = get_property(of_chosen, |
331 | NULL); | 329 | "linux,pci-probe-only", NULL); |
332 | if (prop) | 330 | if (prop) |
333 | pci_probe_only = *prop; | 331 | pci_probe_only = *prop; |
334 | 332 | ||
335 | prop = (int *)get_property(of_chosen, | 333 | prop = get_property(of_chosen, |
336 | "linux,pci-assign-all-buses", NULL); | 334 | "linux,pci-assign-all-buses", NULL); |
337 | if (prop) | 335 | if (prop) |
338 | pci_assign_all_buses = *prop; | 336 | pci_assign_all_buses = *prop; |
339 | } | 337 | } |
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 499c3861074f..0af3fc1bdcc9 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -304,19 +304,21 @@ struct seq_operations cpuinfo_op = { | |||
304 | void __init check_for_initrd(void) | 304 | void __init check_for_initrd(void) |
305 | { | 305 | { |
306 | #ifdef CONFIG_BLK_DEV_INITRD | 306 | #ifdef CONFIG_BLK_DEV_INITRD |
307 | unsigned long *prop; | 307 | const unsigned int *prop; |
308 | int len; | ||
308 | 309 | ||
309 | DBG(" -> check_for_initrd()\n"); | 310 | DBG(" -> check_for_initrd()\n"); |
310 | 311 | ||
311 | if (of_chosen) { | 312 | if (of_chosen) { |
312 | prop = (unsigned long *)get_property(of_chosen, | 313 | prop = get_property(of_chosen, "linux,initrd-start", &len); |
313 | "linux,initrd-start", NULL); | ||
314 | if (prop != NULL) { | 314 | if (prop != NULL) { |
315 | initrd_start = (unsigned long)__va(*prop); | 315 | initrd_start = (unsigned long) |
316 | prop = (unsigned long *)get_property(of_chosen, | 316 | __va(of_read_ulong(prop, len / 4)); |
317 | "linux,initrd-end", NULL); | 317 | prop = get_property(of_chosen, |
318 | "linux,initrd-end", &len); | ||
318 | if (prop != NULL) { | 319 | if (prop != NULL) { |
319 | initrd_end = (unsigned long)__va(*prop); | 320 | initrd_end = (unsigned long) |
321 | __va(of_read_ulong(prop, len / 4)); | ||
320 | initrd_below_start_ok = 1; | 322 | initrd_below_start_ok = 1; |
321 | } else | 323 | } else |
322 | initrd_start = 0; | 324 | initrd_start = 0; |
@@ -366,15 +368,14 @@ void __init smp_setup_cpu_maps(void) | |||
366 | int cpu = 0; | 368 | int cpu = 0; |
367 | 369 | ||
368 | while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { | 370 | while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { |
369 | int *intserv; | 371 | const int *intserv; |
370 | int j, len = sizeof(u32), nthreads = 1; | 372 | int j, len = sizeof(u32), nthreads = 1; |
371 | 373 | ||
372 | intserv = (int *)get_property(dn, "ibm,ppc-interrupt-server#s", | 374 | intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len); |
373 | &len); | ||
374 | if (intserv) | 375 | if (intserv) |
375 | nthreads = len / sizeof(int); | 376 | nthreads = len / sizeof(int); |
376 | else { | 377 | else { |
377 | intserv = (int *) get_property(dn, "reg", NULL); | 378 | intserv = get_property(dn, "reg", NULL); |
378 | if (!intserv) | 379 | if (!intserv) |
379 | intserv = &cpu; /* assume logical == phys */ | 380 | intserv = &cpu; /* assume logical == phys */ |
380 | } | 381 | } |
@@ -395,13 +396,12 @@ void __init smp_setup_cpu_maps(void) | |||
395 | if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && | 396 | if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && |
396 | (dn = of_find_node_by_path("/rtas"))) { | 397 | (dn = of_find_node_by_path("/rtas"))) { |
397 | int num_addr_cell, num_size_cell, maxcpus; | 398 | int num_addr_cell, num_size_cell, maxcpus; |
398 | unsigned int *ireg; | 399 | const unsigned int *ireg; |
399 | 400 | ||
400 | num_addr_cell = prom_n_addr_cells(dn); | 401 | num_addr_cell = prom_n_addr_cells(dn); |
401 | num_size_cell = prom_n_size_cells(dn); | 402 | num_size_cell = prom_n_size_cells(dn); |
402 | 403 | ||
403 | ireg = (unsigned int *) | 404 | ireg = get_property(dn, "ibm,lrdr-capacity", NULL); |
404 | get_property(dn, "ibm,lrdr-capacity", NULL); | ||
405 | 405 | ||
406 | if (!ireg) | 406 | if (!ireg) |
407 | goto out; | 407 | goto out; |
@@ -444,6 +444,8 @@ void __init smp_setup_cpu_maps(void) | |||
444 | 444 | ||
445 | int __initdata do_early_xmon; | 445 | int __initdata do_early_xmon; |
446 | #ifdef CONFIG_XMON | 446 | #ifdef CONFIG_XMON |
447 | extern int xmon_no_auto_backtrace; | ||
448 | |||
447 | static int __init early_xmon(char *p) | 449 | static int __init early_xmon(char *p) |
448 | { | 450 | { |
449 | /* ensure xmon is enabled */ | 451 | /* ensure xmon is enabled */ |
@@ -452,6 +454,8 @@ static int __init early_xmon(char *p) | |||
452 | xmon_init(1); | 454 | xmon_init(1); |
453 | if (strncmp(p, "off", 3) == 0) | 455 | if (strncmp(p, "off", 3) == 0) |
454 | xmon_init(0); | 456 | xmon_init(0); |
457 | if (strncmp(p, "nobt", 4) == 0) | ||
458 | xmon_no_auto_backtrace = 1; | ||
455 | if (strncmp(p, "early", 5) != 0) | 459 | if (strncmp(p, "early", 5) != 0) |
456 | return 0; | 460 | return 0; |
457 | } | 461 | } |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index fd1785e4c9bb..00d6b8addd78 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -56,7 +56,6 @@ | |||
56 | #include <asm/page.h> | 56 | #include <asm/page.h> |
57 | #include <asm/mmu.h> | 57 | #include <asm/mmu.h> |
58 | #include <asm/lmb.h> | 58 | #include <asm/lmb.h> |
59 | #include <asm/iseries/it_lp_naca.h> | ||
60 | #include <asm/firmware.h> | 59 | #include <asm/firmware.h> |
61 | #include <asm/xmon.h> | 60 | #include <asm/xmon.h> |
62 | #include <asm/udbg.h> | 61 | #include <asm/udbg.h> |
@@ -79,10 +78,10 @@ u64 ppc64_pft_size; | |||
79 | * before we've read this from the device tree. | 78 | * before we've read this from the device tree. |
80 | */ | 79 | */ |
81 | struct ppc64_caches ppc64_caches = { | 80 | struct ppc64_caches ppc64_caches = { |
82 | .dline_size = 0x80, | 81 | .dline_size = 0x40, |
83 | .log_dline_size = 7, | 82 | .log_dline_size = 6, |
84 | .iline_size = 0x80, | 83 | .iline_size = 0x40, |
85 | .log_iline_size = 7 | 84 | .log_iline_size = 6 |
86 | }; | 85 | }; |
87 | EXPORT_SYMBOL_GPL(ppc64_caches); | 86 | EXPORT_SYMBOL_GPL(ppc64_caches); |
88 | 87 | ||
@@ -107,7 +106,7 @@ static int smt_enabled_cmdline; | |||
107 | static void check_smt_enabled(void) | 106 | static void check_smt_enabled(void) |
108 | { | 107 | { |
109 | struct device_node *dn; | 108 | struct device_node *dn; |
110 | char *smt_option; | 109 | const char *smt_option; |
111 | 110 | ||
112 | /* Allow the command line to overrule the OF option */ | 111 | /* Allow the command line to overrule the OF option */ |
113 | if (smt_enabled_cmdline) | 112 | if (smt_enabled_cmdline) |
@@ -116,7 +115,7 @@ static void check_smt_enabled(void) | |||
116 | dn = of_find_node_by_path("/options"); | 115 | dn = of_find_node_by_path("/options"); |
117 | 116 | ||
118 | if (dn) { | 117 | if (dn) { |
119 | smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL); | 118 | smt_option = get_property(dn, "ibm,smt-enabled", NULL); |
120 | 119 | ||
121 | if (smt_option) { | 120 | if (smt_option) { |
122 | if (!strcmp(smt_option, "on")) | 121 | if (!strcmp(smt_option, "on")) |
@@ -293,7 +292,7 @@ static void __init initialize_cache_info(void) | |||
293 | */ | 292 | */ |
294 | 293 | ||
295 | if ( num_cpus == 1 ) { | 294 | if ( num_cpus == 1 ) { |
296 | u32 *sizep, *lsizep; | 295 | const u32 *sizep, *lsizep; |
297 | u32 size, lsize; | 296 | u32 size, lsize; |
298 | const char *dc, *ic; | 297 | const char *dc, *ic; |
299 | 298 | ||
@@ -308,10 +307,10 @@ static void __init initialize_cache_info(void) | |||
308 | 307 | ||
309 | size = 0; | 308 | size = 0; |
310 | lsize = cur_cpu_spec->dcache_bsize; | 309 | lsize = cur_cpu_spec->dcache_bsize; |
311 | sizep = (u32 *)get_property(np, "d-cache-size", NULL); | 310 | sizep = get_property(np, "d-cache-size", NULL); |
312 | if (sizep != NULL) | 311 | if (sizep != NULL) |
313 | size = *sizep; | 312 | size = *sizep; |
314 | lsizep = (u32 *) get_property(np, dc, NULL); | 313 | lsizep = get_property(np, dc, NULL); |
315 | if (lsizep != NULL) | 314 | if (lsizep != NULL) |
316 | lsize = *lsizep; | 315 | lsize = *lsizep; |
317 | if (sizep == 0 || lsizep == 0) | 316 | if (sizep == 0 || lsizep == 0) |
@@ -325,10 +324,10 @@ static void __init initialize_cache_info(void) | |||
325 | 324 | ||
326 | size = 0; | 325 | size = 0; |
327 | lsize = cur_cpu_spec->icache_bsize; | 326 | lsize = cur_cpu_spec->icache_bsize; |
328 | sizep = (u32 *)get_property(np, "i-cache-size", NULL); | 327 | sizep = get_property(np, "i-cache-size", NULL); |
329 | if (sizep != NULL) | 328 | if (sizep != NULL) |
330 | size = *sizep; | 329 | size = *sizep; |
331 | lsizep = (u32 *)get_property(np, ic, NULL); | 330 | lsizep = get_property(np, ic, NULL); |
332 | if (lsizep != NULL) | 331 | if (lsizep != NULL) |
333 | lsize = *lsizep; | 332 | lsize = *lsizep; |
334 | if (sizep == 0 || lsizep == 0) | 333 | if (sizep == 0 || lsizep == 0) |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index fec228cd0163..406f308ddead 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -60,7 +60,7 @@ static int smt_snooze_cmdline; | |||
60 | static int __init smt_setup(void) | 60 | static int __init smt_setup(void) |
61 | { | 61 | { |
62 | struct device_node *options; | 62 | struct device_node *options; |
63 | unsigned int *val; | 63 | const unsigned int *val; |
64 | unsigned int cpu; | 64 | unsigned int cpu; |
65 | 65 | ||
66 | if (!cpu_has_feature(CPU_FTR_SMT)) | 66 | if (!cpu_has_feature(CPU_FTR_SMT)) |
@@ -70,8 +70,7 @@ static int __init smt_setup(void) | |||
70 | if (!options) | 70 | if (!options) |
71 | return -ENODEV; | 71 | return -ENODEV; |
72 | 72 | ||
73 | val = (unsigned int *)get_property(options, "ibm,smt-snooze-delay", | 73 | val = get_property(options, "ibm,smt-snooze-delay", NULL); |
74 | NULL); | ||
75 | if (!smt_snooze_cmdline && val) { | 74 | if (!smt_snooze_cmdline && val) { |
76 | for_each_possible_cpu(cpu) | 75 | for_each_possible_cpu(cpu) |
77 | per_cpu(smt_snooze_delay, cpu) = *val; | 76 | per_cpu(smt_snooze_delay, cpu) = *val; |
@@ -231,7 +230,7 @@ static void register_cpu_online(unsigned int cpu) | |||
231 | if (cur_cpu_spec->num_pmcs >= 8) | 230 | if (cur_cpu_spec->num_pmcs >= 8) |
232 | sysdev_create_file(s, &attr_pmc8); | 231 | sysdev_create_file(s, &attr_pmc8); |
233 | 232 | ||
234 | if (cpu_has_feature(CPU_FTR_SMT)) | 233 | if (cpu_has_feature(CPU_FTR_PURR)) |
235 | sysdev_create_file(s, &attr_purr); | 234 | sysdev_create_file(s, &attr_purr); |
236 | } | 235 | } |
237 | 236 | ||
@@ -273,7 +272,7 @@ static void unregister_cpu_online(unsigned int cpu) | |||
273 | if (cur_cpu_spec->num_pmcs >= 8) | 272 | if (cur_cpu_spec->num_pmcs >= 8) |
274 | sysdev_remove_file(s, &attr_pmc8); | 273 | sysdev_remove_file(s, &attr_pmc8); |
275 | 274 | ||
276 | if (cpu_has_feature(CPU_FTR_SMT)) | 275 | if (cpu_has_feature(CPU_FTR_PURR)) |
277 | sysdev_remove_file(s, &attr_purr); | 276 | sysdev_remove_file(s, &attr_purr); |
278 | } | 277 | } |
279 | #endif /* CONFIG_HOTPLUG_CPU */ | 278 | #endif /* CONFIG_HOTPLUG_CPU */ |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index a124499e65d9..7a3c3f791ade 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -860,19 +860,17 @@ EXPORT_SYMBOL(do_settimeofday); | |||
860 | static int __init get_freq(char *name, int cells, unsigned long *val) | 860 | static int __init get_freq(char *name, int cells, unsigned long *val) |
861 | { | 861 | { |
862 | struct device_node *cpu; | 862 | struct device_node *cpu; |
863 | unsigned int *fp; | 863 | const unsigned int *fp; |
864 | int found = 0; | 864 | int found = 0; |
865 | 865 | ||
866 | /* The cpu node should have timebase and clock frequency properties */ | 866 | /* The cpu node should have timebase and clock frequency properties */ |
867 | cpu = of_find_node_by_type(NULL, "cpu"); | 867 | cpu = of_find_node_by_type(NULL, "cpu"); |
868 | 868 | ||
869 | if (cpu) { | 869 | if (cpu) { |
870 | fp = (unsigned int *)get_property(cpu, name, NULL); | 870 | fp = get_property(cpu, name, NULL); |
871 | if (fp) { | 871 | if (fp) { |
872 | found = 1; | 872 | found = 1; |
873 | *val = 0; | 873 | *val = of_read_ulong(fp, cells); |
874 | while (cells--) | ||
875 | *val = (*val << 32) | *fp++; | ||
876 | } | 874 | } |
877 | 875 | ||
878 | of_node_put(cpu); | 876 | of_node_put(cpu); |
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c index 9b352bd0a460..d9f10f2fc372 100644 --- a/arch/powerpc/kernel/traps.c +++ b/arch/powerpc/kernel/traps.c | |||
@@ -598,6 +598,9 @@ static void parse_fpe(struct pt_regs *regs) | |||
598 | #define INST_STSWI 0x7c0005aa | 598 | #define INST_STSWI 0x7c0005aa |
599 | #define INST_STSWX 0x7c00052a | 599 | #define INST_STSWX 0x7c00052a |
600 | 600 | ||
601 | #define INST_POPCNTB 0x7c0000f4 | ||
602 | #define INST_POPCNTB_MASK 0xfc0007fe | ||
603 | |||
601 | static int emulate_string_inst(struct pt_regs *regs, u32 instword) | 604 | static int emulate_string_inst(struct pt_regs *regs, u32 instword) |
602 | { | 605 | { |
603 | u8 rT = (instword >> 21) & 0x1f; | 606 | u8 rT = (instword >> 21) & 0x1f; |
@@ -666,6 +669,23 @@ static int emulate_string_inst(struct pt_regs *regs, u32 instword) | |||
666 | return 0; | 669 | return 0; |
667 | } | 670 | } |
668 | 671 | ||
672 | static int emulate_popcntb_inst(struct pt_regs *regs, u32 instword) | ||
673 | { | ||
674 | u32 ra,rs; | ||
675 | unsigned long tmp; | ||
676 | |||
677 | ra = (instword >> 16) & 0x1f; | ||
678 | rs = (instword >> 21) & 0x1f; | ||
679 | |||
680 | tmp = regs->gpr[rs]; | ||
681 | tmp = tmp - ((tmp >> 1) & 0x5555555555555555ULL); | ||
682 | tmp = (tmp & 0x3333333333333333ULL) + ((tmp >> 2) & 0x3333333333333333ULL); | ||
683 | tmp = (tmp + (tmp >> 4)) & 0x0f0f0f0f0f0f0f0fULL; | ||
684 | regs->gpr[ra] = tmp; | ||
685 | |||
686 | return 0; | ||
687 | } | ||
688 | |||
669 | static int emulate_instruction(struct pt_regs *regs) | 689 | static int emulate_instruction(struct pt_regs *regs) |
670 | { | 690 | { |
671 | u32 instword; | 691 | u32 instword; |
@@ -703,6 +723,11 @@ static int emulate_instruction(struct pt_regs *regs) | |||
703 | if ((instword & INST_STRING_GEN_MASK) == INST_STRING) | 723 | if ((instword & INST_STRING_GEN_MASK) == INST_STRING) |
704 | return emulate_string_inst(regs, instword); | 724 | return emulate_string_inst(regs, instword); |
705 | 725 | ||
726 | /* Emulate the popcntb (Population Count Bytes) instruction. */ | ||
727 | if ((instword & INST_POPCNTB_MASK) == INST_POPCNTB) { | ||
728 | return emulate_popcntb_inst(regs, instword); | ||
729 | } | ||
730 | |||
706 | return -EINVAL; | 731 | return -EINVAL; |
707 | } | 732 | } |
708 | 733 | ||
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index fad8580f9081..cb87e71eec66 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c | |||
@@ -77,7 +77,7 @@ static struct iommu_table *vio_build_iommu_table(struct vio_dev *dev) | |||
77 | } else | 77 | } else |
78 | #endif | 78 | #endif |
79 | { | 79 | { |
80 | unsigned char *dma_window; | 80 | const unsigned char *dma_window; |
81 | struct iommu_table *tbl; | 81 | struct iommu_table *tbl; |
82 | unsigned long offset, size; | 82 | unsigned long offset, size; |
83 | 83 | ||
@@ -217,7 +217,7 @@ static void __devinit vio_dev_release(struct device *dev) | |||
217 | struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) | 217 | struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) |
218 | { | 218 | { |
219 | struct vio_dev *viodev; | 219 | struct vio_dev *viodev; |
220 | unsigned int *unit_address; | 220 | const unsigned int *unit_address; |
221 | 221 | ||
222 | /* we need the 'device_type' property, in order to match with drivers */ | 222 | /* we need the 'device_type' property, in order to match with drivers */ |
223 | if (of_node->type == NULL) { | 223 | if (of_node->type == NULL) { |
@@ -227,7 +227,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) | |||
227 | return NULL; | 227 | return NULL; |
228 | } | 228 | } |
229 | 229 | ||
230 | unit_address = (unsigned int *)get_property(of_node, "reg", NULL); | 230 | unit_address = get_property(of_node, "reg", NULL); |
231 | if (unit_address == NULL) { | 231 | if (unit_address == NULL) { |
232 | printk(KERN_WARNING "%s: node %s missing 'reg'\n", | 232 | printk(KERN_WARNING "%s: node %s missing 'reg'\n", |
233 | __FUNCTION__, | 233 | __FUNCTION__, |
@@ -249,7 +249,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) | |||
249 | viodev->type = of_node->type; | 249 | viodev->type = of_node->type; |
250 | viodev->unit_address = *unit_address; | 250 | viodev->unit_address = *unit_address; |
251 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { | 251 | if (firmware_has_feature(FW_FEATURE_ISERIES)) { |
252 | unit_address = (unsigned int *)get_property(of_node, | 252 | unit_address = get_property(of_node, |
253 | "linux,unit_address", NULL); | 253 | "linux,unit_address", NULL); |
254 | if (unit_address != NULL) | 254 | if (unit_address != NULL) |
255 | viodev->unit_address = *unit_address; | 255 | viodev->unit_address = *unit_address; |
@@ -423,7 +423,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, | |||
423 | { | 423 | { |
424 | const struct vio_dev *vio_dev = to_vio_dev(dev); | 424 | const struct vio_dev *vio_dev = to_vio_dev(dev); |
425 | struct device_node *dn = dev->platform_data; | 425 | struct device_node *dn = dev->platform_data; |
426 | char *cp; | 426 | const char *cp; |
427 | int length; | 427 | int length; |
428 | 428 | ||
429 | if (!num_envp) | 429 | if (!num_envp) |
@@ -431,7 +431,7 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, | |||
431 | 431 | ||
432 | if (!dn) | 432 | if (!dn) |
433 | return -ENODEV; | 433 | return -ENODEV; |
434 | cp = (char *)get_property(dn, "compatible", &length); | 434 | cp = get_property(dn, "compatible", &length); |
435 | if (!cp) | 435 | if (!cp) |
436 | return -ENODEV; | 436 | return -ENODEV; |
437 | 437 | ||
@@ -493,11 +493,11 @@ static struct vio_dev *vio_find_name(const char *kobj_name) | |||
493 | */ | 493 | */ |
494 | struct vio_dev *vio_find_node(struct device_node *vnode) | 494 | struct vio_dev *vio_find_node(struct device_node *vnode) |
495 | { | 495 | { |
496 | uint32_t *unit_address; | 496 | const uint32_t *unit_address; |
497 | char kobj_name[BUS_ID_SIZE]; | 497 | char kobj_name[BUS_ID_SIZE]; |
498 | 498 | ||
499 | /* construct the kobject name from the device node */ | 499 | /* construct the kobject name from the device node */ |
500 | unit_address = (uint32_t *)get_property(vnode, "reg", NULL); | 500 | unit_address = get_property(vnode, "reg", NULL); |
501 | if (!unit_address) | 501 | if (!unit_address) |
502 | return NULL; | 502 | return NULL; |
503 | snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); | 503 | snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address); |