blob: 65499adaecff2a1e2367612ece5e051028e38634 [file] [log] [blame]
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +00001/*
2 * PowerNV OPAL high level interfaces
3 *
4 * Copyright 2011 IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#undef DEBUG
13
14#include <linux/types.h>
15#include <linux/of.h>
Rob Herring26a20562013-09-26 07:40:04 -050016#include <linux/of_fdt.h>
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +000017#include <linux/of_platform.h>
Benjamin Herrenschmidta125e092011-09-19 17:45:03 +000018#include <linux/interrupt.h>
Gavin Shan1bc98de2013-06-20 18:13:22 +080019#include <linux/notifier.h>
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +100020#include <linux/slab.h>
Mahesh Salgaonkarb63a0ff2013-10-30 20:06:13 +053021#include <linux/sched.h>
Vasant Hegde6f68b5e2013-08-27 15:09:52 +053022#include <linux/kobject.h>
Vasant Hegdef7d98d12014-01-15 17:02:04 +110023#include <linux/delay.h>
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +000024#include <asm/opal.h>
25#include <asm/firmware.h>
Mahesh Salgaonkar36df96f2013-10-30 20:05:40 +053026#include <asm/mce.h>
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +000027
28#include "powernv.h"
29
Vasant Hegde6f68b5e2013-08-27 15:09:52 +053030/* /sys/firmware/opal */
31struct kobject *opal_kobj;
32
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +000033struct opal {
34 u64 base;
35 u64 entry;
36} opal;
37
38static struct device_node *opal_node;
39static DEFINE_SPINLOCK(opal_write_lock);
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +000040extern u64 opal_mc_secondary_handler[];
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +100041static unsigned int *opal_irqs;
42static unsigned int opal_irq_count;
Gavin Shan1bc98de2013-06-20 18:13:22 +080043static ATOMIC_NOTIFIER_HEAD(opal_notifier_head);
Mahesh Salgaonkar24366362013-11-18 15:35:58 +053044static struct atomic_notifier_head opal_msg_notifier_head[OPAL_MSG_TYPE_MAX];
Gavin Shan1bc98de2013-06-20 18:13:22 +080045static DEFINE_SPINLOCK(opal_notifier_lock);
46static uint64_t last_notified_mask = 0x0ul;
47static atomic_t opal_notifier_hold = ATOMIC_INIT(0);
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +000048
49int __init early_init_dt_scan_opal(unsigned long node,
50 const char *uname, int depth, void *data)
51{
52 const void *basep, *entryp;
53 unsigned long basesz, entrysz;
54
55 if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
56 return 0;
57
58 basep = of_get_flat_dt_prop(node, "opal-base-address", &basesz);
59 entryp = of_get_flat_dt_prop(node, "opal-entry-address", &entrysz);
60
61 if (!basep || !entryp)
62 return 1;
63
64 opal.base = of_read_number(basep, basesz/4);
65 opal.entry = of_read_number(entryp, entrysz/4);
66
67 pr_debug("OPAL Base = 0x%llx (basep=%p basesz=%ld)\n",
68 opal.base, basep, basesz);
69 pr_debug("OPAL Entry = 0x%llx (entryp=%p basesz=%ld)\n",
70 opal.entry, entryp, entrysz);
71
72 powerpc_firmware_features |= FW_FEATURE_OPAL;
Benjamin Herrenschmidt75b93da2013-05-14 15:10:02 +100073 if (of_flat_dt_is_compatible(node, "ibm,opal-v3")) {
74 powerpc_firmware_features |= FW_FEATURE_OPALv2;
75 powerpc_firmware_features |= FW_FEATURE_OPALv3;
76 printk("OPAL V3 detected !\n");
77 } else if (of_flat_dt_is_compatible(node, "ibm,opal-v2")) {
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +000078 powerpc_firmware_features |= FW_FEATURE_OPALv2;
79 printk("OPAL V2 detected !\n");
80 } else {
81 printk("OPAL V1 detected !\n");
82 }
83
Jeremy Kerrc4463b32013-05-01 22:31:50 +000084 return 1;
85}
86
87static int __init opal_register_exception_handlers(void)
88{
Benjamin Herrenschmidt29186092013-09-23 12:05:04 +100089#ifdef __BIG_ENDIAN__
Jeremy Kerrc4463b32013-05-01 22:31:50 +000090 u64 glue;
91
92 if (!(powerpc_firmware_features & FW_FEATURE_OPAL))
93 return -ENODEV;
94
Mahesh Salgaonkar28446de2013-10-30 20:05:58 +053095 /* Hookup some exception handlers except machine check. We use the
96 * fwnmi area at 0x7000 to provide the glue space to OPAL
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +000097 */
98 glue = 0x7000;
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +000099 opal_register_exception_handler(OPAL_HYPERVISOR_MAINTENANCE_HANDLER,
100 0, glue);
101 glue += 128;
102 opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue);
Benjamin Herrenschmidt29186092013-09-23 12:05:04 +1000103#endif
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +0000104
Jeremy Kerrc4463b32013-05-01 22:31:50 +0000105 return 0;
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000106}
107
Jeremy Kerrc4463b32013-05-01 22:31:50 +0000108early_initcall(opal_register_exception_handlers);
109
Gavin Shan1bc98de2013-06-20 18:13:22 +0800110int opal_notifier_register(struct notifier_block *nb)
111{
112 if (!nb) {
113 pr_warning("%s: Invalid argument (%p)\n",
114 __func__, nb);
115 return -EINVAL;
116 }
117
118 atomic_notifier_chain_register(&opal_notifier_head, nb);
119 return 0;
120}
121
122static void opal_do_notifier(uint64_t events)
123{
124 unsigned long flags;
125 uint64_t changed_mask;
126
127 if (atomic_read(&opal_notifier_hold))
128 return;
129
130 spin_lock_irqsave(&opal_notifier_lock, flags);
131 changed_mask = last_notified_mask ^ events;
132 last_notified_mask = events;
133 spin_unlock_irqrestore(&opal_notifier_lock, flags);
134
135 /*
136 * We feed with the event bits and changed bits for
137 * enough information to the callback.
138 */
139 atomic_notifier_call_chain(&opal_notifier_head,
140 events, (void *)changed_mask);
141}
142
143void opal_notifier_update_evt(uint64_t evt_mask,
144 uint64_t evt_val)
145{
146 unsigned long flags;
147
148 spin_lock_irqsave(&opal_notifier_lock, flags);
149 last_notified_mask &= ~evt_mask;
150 last_notified_mask |= evt_val;
151 spin_unlock_irqrestore(&opal_notifier_lock, flags);
152}
153
154void opal_notifier_enable(void)
155{
156 int64_t rc;
157 uint64_t evt = 0;
158
159 atomic_set(&opal_notifier_hold, 0);
160
161 /* Process pending events */
162 rc = opal_poll_events(&evt);
163 if (rc == OPAL_SUCCESS && evt)
164 opal_do_notifier(evt);
165}
166
167void opal_notifier_disable(void)
168{
169 atomic_set(&opal_notifier_hold, 1);
170}
171
Mahesh Salgaonkar24366362013-11-18 15:35:58 +0530172/*
173 * Opal message notifier based on message type. Allow subscribers to get
174 * notified for specific messgae type.
175 */
176int opal_message_notifier_register(enum OpalMessageType msg_type,
177 struct notifier_block *nb)
178{
179 if (!nb) {
180 pr_warning("%s: Invalid argument (%p)\n",
181 __func__, nb);
182 return -EINVAL;
183 }
184 if (msg_type > OPAL_MSG_TYPE_MAX) {
185 pr_warning("%s: Invalid message type argument (%d)\n",
186 __func__, msg_type);
187 return -EINVAL;
188 }
189 return atomic_notifier_chain_register(
190 &opal_msg_notifier_head[msg_type], nb);
191}
192
193static void opal_message_do_notify(uint32_t msg_type, void *msg)
194{
195 /* notify subscribers */
196 atomic_notifier_call_chain(&opal_msg_notifier_head[msg_type],
197 msg_type, msg);
198}
199
200static void opal_handle_message(void)
201{
202 s64 ret;
203 /*
204 * TODO: pre-allocate a message buffer depending on opal-msg-size
205 * value in /proc/device-tree.
206 */
207 static struct opal_msg msg;
208
209 ret = opal_get_msg(__pa(&msg), sizeof(msg));
210 /* No opal message pending. */
211 if (ret == OPAL_RESOURCE)
212 return;
213
214 /* check for errors. */
215 if (ret) {
216 pr_warning("%s: Failed to retrive opal message, err=%lld\n",
217 __func__, ret);
218 return;
219 }
220
221 /* Sanity check */
222 if (msg.msg_type > OPAL_MSG_TYPE_MAX) {
223 pr_warning("%s: Unknown message type: %u\n",
224 __func__, msg.msg_type);
225 return;
226 }
227 opal_message_do_notify(msg.msg_type, (void *)&msg);
228}
229
230static int opal_message_notify(struct notifier_block *nb,
231 unsigned long events, void *change)
232{
233 if (events & OPAL_EVENT_MSG_PENDING)
234 opal_handle_message();
235 return 0;
236}
237
238static struct notifier_block opal_message_nb = {
239 .notifier_call = opal_message_notify,
240 .next = NULL,
241 .priority = 0,
242};
243
244static int __init opal_message_init(void)
245{
246 int ret, i;
247
248 for (i = 0; i < OPAL_MSG_TYPE_MAX; i++)
249 ATOMIC_INIT_NOTIFIER_HEAD(&opal_msg_notifier_head[i]);
250
251 ret = opal_notifier_register(&opal_message_nb);
252 if (ret) {
253 pr_err("%s: Can't register OPAL event notifier (%d)\n",
254 __func__, ret);
255 return ret;
256 }
257 return 0;
258}
259early_initcall(opal_message_init);
260
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000261int opal_get_chars(uint32_t vtermno, char *buf, int count)
262{
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000263 s64 rc;
264 __be64 evt, len;
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000265
266 if (!opal.entry)
Benjamin Herrenschmidtdaea1172011-09-19 17:44:59 +0000267 return -ENODEV;
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000268 opal_poll_events(&evt);
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000269 if ((be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_INPUT) == 0)
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000270 return 0;
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000271 len = cpu_to_be64(count);
272 rc = opal_console_read(vtermno, &len, buf);
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000273 if (rc == OPAL_SUCCESS)
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000274 return be64_to_cpu(len);
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000275 return 0;
276}
277
278int opal_put_chars(uint32_t vtermno, const char *data, int total_len)
279{
280 int written = 0;
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000281 __be64 olen;
Benjamin Herrenschmidtdaea1172011-09-19 17:44:59 +0000282 s64 len, rc;
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000283 unsigned long flags;
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000284 __be64 evt;
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000285
286 if (!opal.entry)
Benjamin Herrenschmidtdaea1172011-09-19 17:44:59 +0000287 return -ENODEV;
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000288
289 /* We want put_chars to be atomic to avoid mangling of hvsi
290 * packets. To do that, we first test for room and return
Benjamin Herrenschmidtdaea1172011-09-19 17:44:59 +0000291 * -EAGAIN if there isn't enough.
292 *
293 * Unfortunately, opal_console_write_buffer_space() doesn't
294 * appear to work on opal v1, so we just assume there is
295 * enough room and be done with it
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000296 */
297 spin_lock_irqsave(&opal_write_lock, flags);
Benjamin Herrenschmidtdaea1172011-09-19 17:44:59 +0000298 if (firmware_has_feature(FW_FEATURE_OPALv2)) {
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000299 rc = opal_console_write_buffer_space(vtermno, &olen);
300 len = be64_to_cpu(olen);
Benjamin Herrenschmidtdaea1172011-09-19 17:44:59 +0000301 if (rc || len < total_len) {
302 spin_unlock_irqrestore(&opal_write_lock, flags);
303 /* Closed -> drop characters */
304 if (rc)
305 return total_len;
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000306 opal_poll_events(NULL);
Benjamin Herrenschmidtdaea1172011-09-19 17:44:59 +0000307 return -EAGAIN;
308 }
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000309 }
310
311 /* We still try to handle partial completions, though they
312 * should no longer happen.
313 */
Benjamin Herrenschmidtdaea1172011-09-19 17:44:59 +0000314 rc = OPAL_BUSY;
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000315 while(total_len > 0 && (rc == OPAL_BUSY ||
316 rc == OPAL_BUSY_EVENT || rc == OPAL_SUCCESS)) {
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000317 olen = cpu_to_be64(total_len);
318 rc = opal_console_write(vtermno, &olen, data);
319 len = be64_to_cpu(olen);
Benjamin Herrenschmidt1de14552013-05-08 14:14:26 +1000320
321 /* Closed or other error drop */
322 if (rc != OPAL_SUCCESS && rc != OPAL_BUSY &&
323 rc != OPAL_BUSY_EVENT) {
324 written = total_len;
325 break;
326 }
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000327 if (rc == OPAL_SUCCESS) {
328 total_len -= len;
329 data += len;
330 written += len;
331 }
332 /* This is a bit nasty but we need that for the console to
333 * flush when there aren't any interrupts. We will clean
334 * things a bit later to limit that to synchronous path
335 * such as the kernel console and xmon/udbg
336 */
337 do
338 opal_poll_events(&evt);
Benjamin Herrenschmidt4f893632013-09-23 12:05:02 +1000339 while(rc == OPAL_SUCCESS &&
340 (be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_OUTPUT));
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000341 }
342 spin_unlock_irqrestore(&opal_write_lock, flags);
343 return written;
344}
345
Mahesh Salgaonkarb63a0ff2013-10-30 20:06:13 +0530346static int opal_recover_mce(struct pt_regs *regs,
347 struct machine_check_event *evt)
348{
349 int recovered = 0;
350 uint64_t ea = get_mce_fault_addr(evt);
351
352 if (!(regs->msr & MSR_RI)) {
353 /* If MSR_RI isn't set, we cannot recover */
354 recovered = 0;
355 } else if (evt->disposition == MCE_DISPOSITION_RECOVERED) {
356 /* Platform corrected itself */
357 recovered = 1;
358 } else if (ea && !is_kernel_addr(ea)) {
359 /*
360 * Faulting address is not in kernel text. We should be fine.
361 * We need to find which process uses this address.
362 * For now, kill the task if we have received exception when
363 * in userspace.
364 *
365 * TODO: Queue up this address for hwpoisioning later.
366 */
367 if (user_mode(regs) && !is_global_init(current)) {
368 _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
369 recovered = 1;
370 } else
371 recovered = 0;
372 } else if (user_mode(regs) && !is_global_init(current) &&
373 evt->severity == MCE_SEV_ERROR_SYNC) {
374 /*
375 * If we have received a synchronous error when in userspace
376 * kill the task.
377 */
378 _exception(SIGBUS, regs, BUS_MCEERR_AR, regs->nip);
379 recovered = 1;
380 }
381 return recovered;
382}
383
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +0000384int opal_machine_check(struct pt_regs *regs)
385{
Mahesh Salgaonkar36df96f2013-10-30 20:05:40 +0530386 struct machine_check_event evt;
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +0000387
Mahesh Salgaonkar36df96f2013-10-30 20:05:40 +0530388 if (!get_mce_event(&evt, MCE_EVENT_RELEASE))
389 return 0;
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +0000390
391 /* Print things out */
Mahesh Salgaonkar36df96f2013-10-30 20:05:40 +0530392 if (evt.version != MCE_V1) {
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +0000393 pr_err("Machine Check Exception, Unknown event version %d !\n",
394 evt.version);
395 return 0;
396 }
Mahesh Salgaonkarb5ff4212013-10-30 20:05:49 +0530397 machine_check_print_event_info(&evt);
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +0000398
Mahesh Salgaonkarb63a0ff2013-10-30 20:06:13 +0530399 if (opal_recover_mce(regs, &evt))
400 return 1;
401 return 0;
Benjamin Herrenschmidted79ba92011-09-19 17:45:04 +0000402}
403
Benjamin Herrenschmidta125e092011-09-19 17:45:03 +0000404static irqreturn_t opal_interrupt(int irq, void *data)
405{
Anton Blanchard5e4da532013-09-23 12:05:06 +1000406 __be64 events;
Benjamin Herrenschmidta125e092011-09-19 17:45:03 +0000407
408 opal_handle_interrupt(virq_to_hw(irq), &events);
409
Gavin Shan1bc98de2013-06-20 18:13:22 +0800410 opal_do_notifier(events);
Benjamin Herrenschmidta125e092011-09-19 17:45:03 +0000411
412 return IRQ_HANDLED;
413}
414
Vasant Hegde6f68b5e2013-08-27 15:09:52 +0530415static int opal_sysfs_init(void)
416{
417 opal_kobj = kobject_create_and_add("opal", firmware_kobj);
418 if (!opal_kobj) {
419 pr_warn("kobject_create_and_add opal failed\n");
420 return -ENOMEM;
421 }
422
423 return 0;
424}
425
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000426static int __init opal_init(void)
427{
428 struct device_node *np, *consoles;
Alistair Popple1cc79bc2013-09-23 12:04:54 +1000429 const __be32 *irqs;
Benjamin Herrenschmidta125e092011-09-19 17:45:03 +0000430 int rc, i, irqlen;
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000431
432 opal_node = of_find_node_by_path("/ibm,opal");
433 if (!opal_node) {
434 pr_warn("opal: Node not found\n");
435 return -ENODEV;
436 }
Benjamin Herrenschmidt2db29d22013-07-15 13:03:14 +1000437
438 /* Register OPAL consoles if any ports */
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000439 if (firmware_has_feature(FW_FEATURE_OPALv2))
440 consoles = of_find_node_by_path("/ibm,opal/consoles");
441 else
442 consoles = of_node_get(opal_node);
Benjamin Herrenschmidt2db29d22013-07-15 13:03:14 +1000443 if (consoles) {
444 for_each_child_of_node(consoles, np) {
445 if (strcmp(np->name, "serial"))
446 continue;
447 of_platform_device_create(np, NULL, NULL);
448 }
449 of_node_put(consoles);
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000450 }
Benjamin Herrenschmidta125e092011-09-19 17:45:03 +0000451
452 /* Find all OPAL interrupts and request them */
453 irqs = of_get_property(opal_node, "opal-interrupts", &irqlen);
454 pr_debug("opal: Found %d interrupts reserved for OPAL\n",
455 irqs ? (irqlen / 4) : 0);
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +1000456 opal_irq_count = irqlen / 4;
457 opal_irqs = kzalloc(opal_irq_count * sizeof(unsigned int), GFP_KERNEL);
Benjamin Herrenschmidta125e092011-09-19 17:45:03 +0000458 for (i = 0; irqs && i < (irqlen / 4); i++, irqs++) {
459 unsigned int hwirq = be32_to_cpup(irqs);
460 unsigned int irq = irq_create_mapping(NULL, hwirq);
461 if (irq == NO_IRQ) {
462 pr_warning("opal: Failed to map irq 0x%x\n", hwirq);
463 continue;
464 }
465 rc = request_irq(irq, opal_interrupt, 0, "opal", NULL);
466 if (rc)
467 pr_warning("opal: Error %d requesting irq %d"
468 " (0x%x)\n", rc, irq, hwirq);
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +1000469 opal_irqs[i] = irq;
Benjamin Herrenschmidta125e092011-09-19 17:45:03 +0000470 }
Vasant Hegde6f68b5e2013-08-27 15:09:52 +0530471
472 /* Create "opal" kobject under /sys/firmware */
473 rc = opal_sysfs_init();
Vasant Hegde50bd6152013-10-24 16:04:58 +0530474 if (rc == 0) {
475 /* Setup code update interface */
476 opal_flash_init();
477 }
Vasant Hegde6f68b5e2013-08-27 15:09:52 +0530478
Benjamin Herrenschmidt14a43e62011-09-19 17:44:57 +0000479 return 0;
480}
481subsys_initcall(opal_init);
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +1000482
483void opal_shutdown(void)
484{
485 unsigned int i;
Vasant Hegdef7d98d12014-01-15 17:02:04 +1100486 long rc = OPAL_BUSY;
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +1000487
Vasant Hegdef7d98d12014-01-15 17:02:04 +1100488 /* First free interrupts, which will also mask them */
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +1000489 for (i = 0; i < opal_irq_count; i++) {
490 if (opal_irqs[i])
Anton Blanchardb0d436c2013-08-07 02:01:24 +1000491 free_irq(opal_irqs[i], NULL);
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +1000492 opal_irqs[i] = 0;
493 }
Vasant Hegdef7d98d12014-01-15 17:02:04 +1100494
495 /*
496 * Then sync with OPAL which ensure anything that can
497 * potentially write to our memory has completed such
498 * as an ongoing dump retrieval
499 */
500 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
501 rc = opal_sync_host_reboot();
502 if (rc == OPAL_BUSY)
503 opal_poll_events(NULL);
504 else
505 mdelay(10);
506 }
Benjamin Herrenschmidt73ed1482013-05-10 16:59:18 +1000507}