diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/cache.h | 3 | ||||
-rw-r--r-- | arch/powerpc/include/asm/opal.h | 2 | ||||
-rw-r--r-- | arch/powerpc/lib/copy_32.S | 127 | ||||
-rw-r--r-- | arch/powerpc/lib/locks.c | 1 | ||||
-rw-r--r-- | arch/powerpc/lib/ppc_ksyms.c | 4 | ||||
-rw-r--r-- | arch/powerpc/mm/ppc_mmu_32.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/bootx_init.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/powermac/pic.c | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal-flash.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/opal.c | 49 |
10 files changed, 54 insertions, 145 deletions
diff --git a/arch/powerpc/include/asm/cache.h b/arch/powerpc/include/asm/cache.h index 34a05a1a990b..0dc42c5082b7 100644 --- a/arch/powerpc/include/asm/cache.h +++ b/arch/powerpc/include/asm/cache.h | |||
@@ -76,9 +76,6 @@ extern void _set_L3CR(unsigned long); | |||
76 | #define _set_L3CR(val) do { } while(0) | 76 | #define _set_L3CR(val) do { } while(0) |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | extern void cacheable_memzero(void *p, unsigned int nb); | ||
80 | extern void *cacheable_memcpy(void *, const void *, unsigned int); | ||
81 | |||
82 | #endif /* !__ASSEMBLY__ */ | 79 | #endif /* !__ASSEMBLY__ */ |
83 | #endif /* __KERNEL__ */ | 80 | #endif /* __KERNEL__ */ |
84 | #endif /* _ASM_POWERPC_CACHE_H */ | 81 | #endif /* _ASM_POWERPC_CACHE_H */ |
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 0ef0fd660ac6..c08de77f398a 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h | |||
@@ -210,6 +210,8 @@ extern int opal_notifier_unregister(struct notifier_block *nb); | |||
210 | 210 | ||
211 | extern int opal_message_notifier_register(enum opal_msg_type msg_type, | 211 | extern int opal_message_notifier_register(enum opal_msg_type msg_type, |
212 | struct notifier_block *nb); | 212 | struct notifier_block *nb); |
213 | extern int opal_message_notifier_unregister(enum opal_msg_type msg_type, | ||
214 | struct notifier_block *nb); | ||
213 | extern void opal_notifier_enable(void); | 215 | extern void opal_notifier_enable(void); |
214 | extern void opal_notifier_disable(void); | 216 | extern void opal_notifier_disable(void); |
215 | extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val); | 217 | extern void opal_notifier_update_evt(uint64_t evt_mask, uint64_t evt_val); |
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S index 55f19f9fd708..6813f80d1eec 100644 --- a/arch/powerpc/lib/copy_32.S +++ b/arch/powerpc/lib/copy_32.S | |||
@@ -69,54 +69,6 @@ CACHELINE_BYTES = L1_CACHE_BYTES | |||
69 | LG_CACHELINE_BYTES = L1_CACHE_SHIFT | 69 | LG_CACHELINE_BYTES = L1_CACHE_SHIFT |
70 | CACHELINE_MASK = (L1_CACHE_BYTES-1) | 70 | CACHELINE_MASK = (L1_CACHE_BYTES-1) |
71 | 71 | ||
72 | /* | ||
73 | * Use dcbz on the complete cache lines in the destination | ||
74 | * to set them to zero. This requires that the destination | ||
75 | * area is cacheable. -- paulus | ||
76 | */ | ||
77 | _GLOBAL(cacheable_memzero) | ||
78 | mr r5,r4 | ||
79 | li r4,0 | ||
80 | addi r6,r3,-4 | ||
81 | cmplwi 0,r5,4 | ||
82 | blt 7f | ||
83 | stwu r4,4(r6) | ||
84 | beqlr | ||
85 | andi. r0,r6,3 | ||
86 | add r5,r0,r5 | ||
87 | subf r6,r0,r6 | ||
88 | clrlwi r7,r6,32-LG_CACHELINE_BYTES | ||
89 | add r8,r7,r5 | ||
90 | srwi r9,r8,LG_CACHELINE_BYTES | ||
91 | addic. r9,r9,-1 /* total number of complete cachelines */ | ||
92 | ble 2f | ||
93 | xori r0,r7,CACHELINE_MASK & ~3 | ||
94 | srwi. r0,r0,2 | ||
95 | beq 3f | ||
96 | mtctr r0 | ||
97 | 4: stwu r4,4(r6) | ||
98 | bdnz 4b | ||
99 | 3: mtctr r9 | ||
100 | li r7,4 | ||
101 | 10: dcbz r7,r6 | ||
102 | addi r6,r6,CACHELINE_BYTES | ||
103 | bdnz 10b | ||
104 | clrlwi r5,r8,32-LG_CACHELINE_BYTES | ||
105 | addi r5,r5,4 | ||
106 | 2: srwi r0,r5,2 | ||
107 | mtctr r0 | ||
108 | bdz 6f | ||
109 | 1: stwu r4,4(r6) | ||
110 | bdnz 1b | ||
111 | 6: andi. r5,r5,3 | ||
112 | 7: cmpwi 0,r5,0 | ||
113 | beqlr | ||
114 | mtctr r5 | ||
115 | addi r6,r6,3 | ||
116 | 8: stbu r4,1(r6) | ||
117 | bdnz 8b | ||
118 | blr | ||
119 | |||
120 | _GLOBAL(memset) | 72 | _GLOBAL(memset) |
121 | rlwimi r4,r4,8,16,23 | 73 | rlwimi r4,r4,8,16,23 |
122 | rlwimi r4,r4,16,0,15 | 74 | rlwimi r4,r4,16,0,15 |
@@ -142,85 +94,6 @@ _GLOBAL(memset) | |||
142 | bdnz 8b | 94 | bdnz 8b |
143 | blr | 95 | blr |
144 | 96 | ||
145 | /* | ||
146 | * This version uses dcbz on the complete cache lines in the | ||
147 | * destination area to reduce memory traffic. This requires that | ||
148 | * the destination area is cacheable. | ||
149 | * We only use this version if the source and dest don't overlap. | ||
150 | * -- paulus. | ||
151 | */ | ||
152 | _GLOBAL(cacheable_memcpy) | ||
153 | add r7,r3,r5 /* test if the src & dst overlap */ | ||
154 | add r8,r4,r5 | ||
155 | cmplw 0,r4,r7 | ||
156 | cmplw 1,r3,r8 | ||
157 | crand 0,0,4 /* cr0.lt &= cr1.lt */ | ||
158 | blt memcpy /* if regions overlap */ | ||
159 | |||
160 | addi r4,r4,-4 | ||
161 | addi r6,r3,-4 | ||
162 | neg r0,r3 | ||
163 | andi. r0,r0,CACHELINE_MASK /* # bytes to start of cache line */ | ||
164 | beq 58f | ||
165 | |||
166 | cmplw 0,r5,r0 /* is this more than total to do? */ | ||
167 | blt 63f /* if not much to do */ | ||
168 | andi. r8,r0,3 /* get it word-aligned first */ | ||
169 | subf r5,r0,r5 | ||
170 | mtctr r8 | ||
171 | beq+ 61f | ||
172 | 70: lbz r9,4(r4) /* do some bytes */ | ||
173 | stb r9,4(r6) | ||
174 | addi r4,r4,1 | ||
175 | addi r6,r6,1 | ||
176 | bdnz 70b | ||
177 | 61: srwi. r0,r0,2 | ||
178 | mtctr r0 | ||
179 | beq 58f | ||
180 | 72: lwzu r9,4(r4) /* do some words */ | ||
181 | stwu r9,4(r6) | ||
182 | bdnz 72b | ||
183 | |||
184 | 58: srwi. r0,r5,LG_CACHELINE_BYTES /* # complete cachelines */ | ||
185 | clrlwi r5,r5,32-LG_CACHELINE_BYTES | ||
186 | li r11,4 | ||
187 | mtctr r0 | ||
188 | beq 63f | ||
189 | 53: | ||
190 | dcbz r11,r6 | ||
191 | COPY_16_BYTES | ||
192 | #if L1_CACHE_BYTES >= 32 | ||
193 | COPY_16_BYTES | ||
194 | #if L1_CACHE_BYTES >= 64 | ||
195 | COPY_16_BYTES | ||
196 | COPY_16_BYTES | ||
197 | #if L1_CACHE_BYTES >= 128 | ||
198 | COPY_16_BYTES | ||
199 | COPY_16_BYTES | ||
200 | COPY_16_BYTES | ||
201 | COPY_16_BYTES | ||
202 | #endif | ||
203 | #endif | ||
204 | #endif | ||
205 | bdnz 53b | ||
206 | |||
207 | 63: srwi. r0,r5,2 | ||
208 | mtctr r0 | ||
209 | beq 64f | ||
210 | 30: lwzu r0,4(r4) | ||
211 | stwu r0,4(r6) | ||
212 | bdnz 30b | ||
213 | |||
214 | 64: andi. r0,r5,3 | ||
215 | mtctr r0 | ||
216 | beq+ 65f | ||
217 | 40: lbz r0,4(r4) | ||
218 | stb r0,4(r6) | ||
219 | addi r4,r4,1 | ||
220 | addi r6,r6,1 | ||
221 | bdnz 40b | ||
222 | 65: blr | ||
223 | |||
224 | _GLOBAL(memmove) | 97 | _GLOBAL(memmove) |
225 | cmplw 0,r3,r4 | 98 | cmplw 0,r3,r4 |
226 | bgt backwards_memcpy | 99 | bgt backwards_memcpy |
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c index 170a0346f756..f7deebdf3365 100644 --- a/arch/powerpc/lib/locks.c +++ b/arch/powerpc/lib/locks.c | |||
@@ -41,6 +41,7 @@ void __spin_yield(arch_spinlock_t *lock) | |||
41 | plpar_hcall_norets(H_CONFER, | 41 | plpar_hcall_norets(H_CONFER, |
42 | get_hard_smp_processor_id(holder_cpu), yield_count); | 42 | get_hard_smp_processor_id(holder_cpu), yield_count); |
43 | } | 43 | } |
44 | EXPORT_SYMBOL_GPL(__spin_yield); | ||
44 | 45 | ||
45 | /* | 46 | /* |
46 | * Waiting for a read lock or a write lock on a rwlock... | 47 | * Waiting for a read lock or a write lock on a rwlock... |
diff --git a/arch/powerpc/lib/ppc_ksyms.c b/arch/powerpc/lib/ppc_ksyms.c index f993959647b5..c7f8e9586316 100644 --- a/arch/powerpc/lib/ppc_ksyms.c +++ b/arch/powerpc/lib/ppc_ksyms.c | |||
@@ -8,10 +8,6 @@ EXPORT_SYMBOL(memset); | |||
8 | EXPORT_SYMBOL(memmove); | 8 | EXPORT_SYMBOL(memmove); |
9 | EXPORT_SYMBOL(memcmp); | 9 | EXPORT_SYMBOL(memcmp); |
10 | EXPORT_SYMBOL(memchr); | 10 | EXPORT_SYMBOL(memchr); |
11 | #ifdef CONFIG_PPC32 | ||
12 | EXPORT_SYMBOL(cacheable_memcpy); | ||
13 | EXPORT_SYMBOL(cacheable_memzero); | ||
14 | #endif | ||
15 | 11 | ||
16 | EXPORT_SYMBOL(strcpy); | 12 | EXPORT_SYMBOL(strcpy); |
17 | EXPORT_SYMBOL(strncpy); | 13 | EXPORT_SYMBOL(strncpy); |
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c index 5029dc19b517..eb0e489b1bb7 100644 --- a/arch/powerpc/mm/ppc_mmu_32.c +++ b/arch/powerpc/mm/ppc_mmu_32.c | |||
@@ -224,7 +224,7 @@ void __init MMU_init_hw(void) | |||
224 | */ | 224 | */ |
225 | if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322); | 225 | if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322); |
226 | Hash = __va(memblock_alloc(Hash_size, Hash_size)); | 226 | Hash = __va(memblock_alloc(Hash_size, Hash_size)); |
227 | cacheable_memzero(Hash, Hash_size); | 227 | memset(Hash, 0, Hash_size); |
228 | _SDR1 = __pa(Hash) | SDR1_LOW_BITS; | 228 | _SDR1 = __pa(Hash) | SDR1_LOW_BITS; |
229 | 229 | ||
230 | Hash_end = (struct hash_pte *) ((unsigned long)Hash + Hash_size); | 230 | Hash_end = (struct hash_pte *) ((unsigned long)Hash + Hash_size); |
diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c index 3e91ef538114..76f5013c35e5 100644 --- a/arch/powerpc/platforms/powermac/bootx_init.c +++ b/arch/powerpc/platforms/powermac/bootx_init.c | |||
@@ -246,7 +246,7 @@ static void __init bootx_scan_dt_build_strings(unsigned long base, | |||
246 | DBG(" detected display ! adding properties names !\n"); | 246 | DBG(" detected display ! adding properties names !\n"); |
247 | bootx_dt_add_string("linux,boot-display", mem_end); | 247 | bootx_dt_add_string("linux,boot-display", mem_end); |
248 | bootx_dt_add_string("linux,opened", mem_end); | 248 | bootx_dt_add_string("linux,opened", mem_end); |
249 | strncpy(bootx_disp_path, namep, 255); | 249 | strlcpy(bootx_disp_path, namep, sizeof(bootx_disp_path)); |
250 | } | 250 | } |
251 | 251 | ||
252 | /* get and store all property names */ | 252 | /* get and store all property names */ |
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 4c24bf60d39d..59cfc9d63c2d 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c | |||
@@ -321,6 +321,9 @@ static void __init pmac_pic_probe_oldstyle(void) | |||
321 | max_irqs = max_real_irqs = 64; | 321 | max_irqs = max_real_irqs = 64; |
322 | 322 | ||
323 | /* We might have a second cascaded heathrow */ | 323 | /* We might have a second cascaded heathrow */ |
324 | |||
325 | /* Compensate for of_node_put() in of_find_node_by_name() */ | ||
326 | of_node_get(master); | ||
324 | slave = of_find_node_by_name(master, "mac-io"); | 327 | slave = of_find_node_by_name(master, "mac-io"); |
325 | 328 | ||
326 | /* Check ordering of master & slave */ | 329 | /* Check ordering of master & slave */ |
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c index 5c21d9c07f45..0ff07ff891f0 100644 --- a/arch/powerpc/platforms/powernv/opal-flash.c +++ b/arch/powerpc/platforms/powernv/opal-flash.c | |||
@@ -120,7 +120,11 @@ static struct image_header_t image_header; | |||
120 | static struct image_data_t image_data; | 120 | static struct image_data_t image_data; |
121 | static struct validate_flash_t validate_flash_data; | 121 | static struct validate_flash_t validate_flash_data; |
122 | static struct manage_flash_t manage_flash_data; | 122 | static struct manage_flash_t manage_flash_data; |
123 | static struct update_flash_t update_flash_data; | 123 | |
124 | /* Initialize update_flash_data status to No Operation */ | ||
125 | static struct update_flash_t update_flash_data = { | ||
126 | .status = FLASH_NO_OP, | ||
127 | }; | ||
124 | 128 | ||
125 | static DEFINE_MUTEX(image_data_mutex); | 129 | static DEFINE_MUTEX(image_data_mutex); |
126 | 130 | ||
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 142a08a61bd1..d403b2b08626 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/kobject.h> | 23 | #include <linux/kobject.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/memblock.h> | 25 | #include <linux/memblock.h> |
26 | #include <linux/kthread.h> | ||
27 | #include <linux/freezer.h> | ||
26 | 28 | ||
27 | #include <asm/machdep.h> | 29 | #include <asm/machdep.h> |
28 | #include <asm/opal.h> | 30 | #include <asm/opal.h> |
@@ -58,6 +60,7 @@ static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX]; | |||
58 | static DEFINE_SPINLOCK(opal_notifier_lock); | 60 | static DEFINE_SPINLOCK(opal_notifier_lock); |
59 | static uint64_t last_notified_mask = 0x0ul; | 61 | static uint64_t last_notified_mask = 0x0ul; |
60 | static atomic_t opal_notifier_hold = ATOMIC_INIT(0); | 62 | static atomic_t opal_notifier_hold = ATOMIC_INIT(0); |
63 | static uint32_t opal_heartbeat; | ||
61 | 64 | ||
62 | static void opal_reinit_cores(void) | 65 | static void opal_reinit_cores(void) |
63 | { | 66 | { |
@@ -305,20 +308,23 @@ void opal_notifier_disable(void) | |||
305 | int opal_message_notifier_register(enum opal_msg_type msg_type, | 308 | int opal_message_notifier_register(enum opal_msg_type msg_type, |
306 | struct notifier_block *nb) | 309 | struct notifier_block *nb) |
307 | { | 310 | { |
308 | if (!nb) { | 311 | if (!nb || msg_type >= OPAL_MSG_TYPE_MAX) { |
309 | pr_warning("%s: Invalid argument (%p)\n", | 312 | pr_warning("%s: Invalid arguments, msg_type:%d\n", |
310 | __func__, nb); | ||
311 | return -EINVAL; | ||
312 | } | ||
313 | if (msg_type > OPAL_MSG_TYPE_MAX) { | ||
314 | pr_warning("%s: Invalid message type argument (%d)\n", | ||
315 | __func__, msg_type); | 313 | __func__, msg_type); |
316 | return -EINVAL; | 314 | return -EINVAL; |
317 | } | 315 | } |
316 | |||
318 | return atomic_notifier_chain_register( | 317 | return atomic_notifier_chain_register( |
319 | &opal_msg_notifier_head[msg_type], nb); | 318 | &opal_msg_notifier_head[msg_type], nb); |
320 | } | 319 | } |
321 | 320 | ||
321 | int opal_message_notifier_unregister(enum opal_msg_type msg_type, | ||
322 | struct notifier_block *nb) | ||
323 | { | ||
324 | return atomic_notifier_chain_unregister( | ||
325 | &opal_msg_notifier_head[msg_type], nb); | ||
326 | } | ||
327 | |||
322 | static void opal_message_do_notify(uint32_t msg_type, void *msg) | 328 | static void opal_message_do_notify(uint32_t msg_type, void *msg) |
323 | { | 329 | { |
324 | /* notify subscribers */ | 330 | /* notify subscribers */ |
@@ -351,7 +357,7 @@ static void opal_handle_message(void) | |||
351 | type = be32_to_cpu(msg.msg_type); | 357 | type = be32_to_cpu(msg.msg_type); |
352 | 358 | ||
353 | /* Sanity check */ | 359 | /* Sanity check */ |
354 | if (type > OPAL_MSG_TYPE_MAX) { | 360 | if (type >= OPAL_MSG_TYPE_MAX) { |
355 | pr_warning("%s: Unknown message type: %u\n", __func__, type); | 361 | pr_warning("%s: Unknown message type: %u\n", __func__, type); |
356 | return; | 362 | return; |
357 | } | 363 | } |
@@ -744,6 +750,29 @@ static void __init opal_irq_init(struct device_node *dn) | |||
744 | } | 750 | } |
745 | } | 751 | } |
746 | 752 | ||
753 | static int kopald(void *unused) | ||
754 | { | ||
755 | set_freezable(); | ||
756 | do { | ||
757 | try_to_freeze(); | ||
758 | opal_poll_events(NULL); | ||
759 | msleep_interruptible(opal_heartbeat); | ||
760 | } while (!kthread_should_stop()); | ||
761 | |||
762 | return 0; | ||
763 | } | ||
764 | |||
765 | static void opal_init_heartbeat(void) | ||
766 | { | ||
767 | /* Old firwmware, we assume the HVC heartbeat is sufficient */ | ||
768 | if (of_property_read_u32(opal_node, "ibm,heartbeat-ms", | ||
769 | &opal_heartbeat) != 0) | ||
770 | opal_heartbeat = 0; | ||
771 | |||
772 | if (opal_heartbeat) | ||
773 | kthread_run(kopald, NULL, "kopald"); | ||
774 | } | ||
775 | |||
747 | static int __init opal_init(void) | 776 | static int __init opal_init(void) |
748 | { | 777 | { |
749 | struct device_node *np, *consoles; | 778 | struct device_node *np, *consoles; |
@@ -772,6 +801,9 @@ static int __init opal_init(void) | |||
772 | /* Create i2c platform devices */ | 801 | /* Create i2c platform devices */ |
773 | opal_i2c_create_devs(); | 802 | opal_i2c_create_devs(); |
774 | 803 | ||
804 | /* Setup a heatbeat thread if requested by OPAL */ | ||
805 | opal_init_heartbeat(); | ||
806 | |||
775 | /* Find all OPAL interrupts and request them */ | 807 | /* Find all OPAL interrupts and request them */ |
776 | opal_irq_init(opal_node); | 808 | opal_irq_init(opal_node); |
777 | 809 | ||
@@ -794,6 +826,7 @@ static int __init opal_init(void) | |||
794 | opal_msglog_init(); | 826 | opal_msglog_init(); |
795 | } | 827 | } |
796 | 828 | ||
829 | /* Initialize OPAL IPMI backend */ | ||
797 | opal_ipmi_init(opal_node); | 830 | opal_ipmi_init(opal_node); |
798 | 831 | ||
799 | return 0; | 832 | return 0; |