| .. | .. |
|---|
| 52 | 52 | EXPORT_SYMBOL(rtas); |
|---|
| 53 | 53 | |
|---|
| 54 | 54 | DEFINE_SPINLOCK(rtas_data_buf_lock); |
|---|
| 55 | | -EXPORT_SYMBOL(rtas_data_buf_lock); |
|---|
| 55 | +EXPORT_SYMBOL_GPL(rtas_data_buf_lock); |
|---|
| 56 | 56 | |
|---|
| 57 | | -char rtas_data_buf[RTAS_DATA_BUF_SIZE] __cacheline_aligned; |
|---|
| 58 | | -EXPORT_SYMBOL(rtas_data_buf); |
|---|
| 57 | +char rtas_data_buf[RTAS_DATA_BUF_SIZE] __aligned(SZ_4K); |
|---|
| 58 | +EXPORT_SYMBOL_GPL(rtas_data_buf); |
|---|
| 59 | 59 | |
|---|
| 60 | 60 | unsigned long rtas_rmo_buf; |
|---|
| 61 | 61 | |
|---|
| .. | .. |
|---|
| 64 | 64 | * This is done like this so rtas_flash can be a module. |
|---|
| 65 | 65 | */ |
|---|
| 66 | 66 | void (*rtas_flash_term_hook)(int); |
|---|
| 67 | | -EXPORT_SYMBOL(rtas_flash_term_hook); |
|---|
| 67 | +EXPORT_SYMBOL_GPL(rtas_flash_term_hook); |
|---|
| 68 | 68 | |
|---|
| 69 | 69 | /* RTAS use home made raw locking instead of spin_lock_irqsave |
|---|
| 70 | 70 | * because those can be called from within really nasty contexts |
|---|
| .. | .. |
|---|
| 312 | 312 | |
|---|
| 313 | 313 | spin_unlock(&progress_lock); |
|---|
| 314 | 314 | } |
|---|
| 315 | | -EXPORT_SYMBOL(rtas_progress); /* needed by rtas_flash module */ |
|---|
| 315 | +EXPORT_SYMBOL_GPL(rtas_progress); /* needed by rtas_flash module */ |
|---|
| 316 | 316 | |
|---|
| 317 | 317 | int rtas_token(const char *service) |
|---|
| 318 | 318 | { |
|---|
| .. | .. |
|---|
| 322 | 322 | tokp = of_get_property(rtas.dev, service, NULL); |
|---|
| 323 | 323 | return tokp ? be32_to_cpu(*tokp) : RTAS_UNKNOWN_SERVICE; |
|---|
| 324 | 324 | } |
|---|
| 325 | | -EXPORT_SYMBOL(rtas_token); |
|---|
| 325 | +EXPORT_SYMBOL_GPL(rtas_token); |
|---|
| 326 | 326 | |
|---|
| 327 | 327 | int rtas_service_present(const char *service) |
|---|
| 328 | 328 | { |
|---|
| .. | .. |
|---|
| 399 | 399 | buf = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC); |
|---|
| 400 | 400 | } |
|---|
| 401 | 401 | if (buf) |
|---|
| 402 | | - memcpy(buf, rtas_err_buf, RTAS_ERROR_LOG_MAX); |
|---|
| 402 | + memmove(buf, rtas_err_buf, RTAS_ERROR_LOG_MAX); |
|---|
| 403 | 403 | } |
|---|
| 404 | 404 | |
|---|
| 405 | 405 | return buf; |
|---|
| .. | .. |
|---|
| 482 | 482 | } |
|---|
| 483 | 483 | return ret; |
|---|
| 484 | 484 | } |
|---|
| 485 | | -EXPORT_SYMBOL(rtas_call); |
|---|
| 485 | +EXPORT_SYMBOL_GPL(rtas_call); |
|---|
| 486 | 486 | |
|---|
| 487 | 487 | /* For RTAS_BUSY (-2), delay for 1 millisecond. For an extended busy status |
|---|
| 488 | 488 | * code of 990n, perform the hinted delay of 10^n (last digit) milliseconds. |
|---|
| .. | .. |
|---|
| 517 | 517 | |
|---|
| 518 | 518 | return ms; |
|---|
| 519 | 519 | } |
|---|
| 520 | | -EXPORT_SYMBOL(rtas_busy_delay); |
|---|
| 520 | +EXPORT_SYMBOL_GPL(rtas_busy_delay); |
|---|
| 521 | 521 | |
|---|
| 522 | 522 | static int rtas_error_rc(int rtas_rc) |
|---|
| 523 | 523 | { |
|---|
| .. | .. |
|---|
| 563 | 563 | return rtas_error_rc(rc); |
|---|
| 564 | 564 | return rc; |
|---|
| 565 | 565 | } |
|---|
| 566 | | -EXPORT_SYMBOL(rtas_get_power_level); |
|---|
| 566 | +EXPORT_SYMBOL_GPL(rtas_get_power_level); |
|---|
| 567 | 567 | |
|---|
| 568 | 568 | int rtas_set_power_level(int powerdomain, int level, int *setlevel) |
|---|
| 569 | 569 | { |
|---|
| .. | .. |
|---|
| 581 | 581 | return rtas_error_rc(rc); |
|---|
| 582 | 582 | return rc; |
|---|
| 583 | 583 | } |
|---|
| 584 | | -EXPORT_SYMBOL(rtas_set_power_level); |
|---|
| 584 | +EXPORT_SYMBOL_GPL(rtas_set_power_level); |
|---|
| 585 | 585 | |
|---|
| 586 | 586 | int rtas_get_sensor(int sensor, int index, int *state) |
|---|
| 587 | 587 | { |
|---|
| .. | .. |
|---|
| 599 | 599 | return rtas_error_rc(rc); |
|---|
| 600 | 600 | return rc; |
|---|
| 601 | 601 | } |
|---|
| 602 | | -EXPORT_SYMBOL(rtas_get_sensor); |
|---|
| 602 | +EXPORT_SYMBOL_GPL(rtas_get_sensor); |
|---|
| 603 | 603 | |
|---|
| 604 | 604 | int rtas_get_sensor_fast(int sensor, int index, int *state) |
|---|
| 605 | 605 | { |
|---|
| .. | .. |
|---|
| 660 | 660 | return rtas_error_rc(rc); |
|---|
| 661 | 661 | return rc; |
|---|
| 662 | 662 | } |
|---|
| 663 | | -EXPORT_SYMBOL(rtas_set_indicator); |
|---|
| 663 | +EXPORT_SYMBOL_GPL(rtas_set_indicator); |
|---|
| 664 | 664 | |
|---|
| 665 | 665 | /* |
|---|
| 666 | 666 | * Ignoring RTAS extended delay |
|---|
| .. | .. |
|---|
| 715 | 715 | |
|---|
| 716 | 716 | /* Must be in the RMO region, so we place it here */ |
|---|
| 717 | 717 | static char rtas_os_term_buf[2048]; |
|---|
| 718 | +static s32 ibm_os_term_token = RTAS_UNKNOWN_SERVICE; |
|---|
| 718 | 719 | |
|---|
| 719 | 720 | void rtas_os_term(char *str) |
|---|
| 720 | 721 | { |
|---|
| .. | .. |
|---|
| 726 | 727 | * this property may terminate the partition which we want to avoid |
|---|
| 727 | 728 | * since it interferes with panic_timeout. |
|---|
| 728 | 729 | */ |
|---|
| 729 | | - if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term") || |
|---|
| 730 | | - RTAS_UNKNOWN_SERVICE == rtas_token("ibm,extended-os-term")) |
|---|
| 730 | + if (ibm_os_term_token == RTAS_UNKNOWN_SERVICE) |
|---|
| 731 | 731 | return; |
|---|
| 732 | 732 | |
|---|
| 733 | 733 | snprintf(rtas_os_term_buf, 2048, "OS panic: %s", str); |
|---|
| 734 | 734 | |
|---|
| 735 | + /* |
|---|
| 736 | + * Keep calling as long as RTAS returns a "try again" status, |
|---|
| 737 | + * but don't use rtas_busy_delay(), which potentially |
|---|
| 738 | + * schedules. |
|---|
| 739 | + */ |
|---|
| 735 | 740 | do { |
|---|
| 736 | | - status = rtas_call(rtas_token("ibm,os-term"), 1, 1, NULL, |
|---|
| 741 | + status = rtas_call(ibm_os_term_token, 1, 1, NULL, |
|---|
| 737 | 742 | __pa(rtas_os_term_buf)); |
|---|
| 738 | | - } while (rtas_busy_delay(status)); |
|---|
| 743 | + } while (rtas_busy_delay_time(status)); |
|---|
| 739 | 744 | |
|---|
| 740 | 745 | if (status != 0) |
|---|
| 741 | 746 | printk(KERN_EMERG "ibm,os-term call failed %d\n", status); |
|---|
| .. | .. |
|---|
| 1267 | 1272 | no_entry = of_property_read_u32(rtas.dev, "linux,rtas-entry", &entry); |
|---|
| 1268 | 1273 | rtas.entry = no_entry ? rtas.base : entry; |
|---|
| 1269 | 1274 | |
|---|
| 1275 | + /* |
|---|
| 1276 | + * Discover these now to avoid device tree lookups in the |
|---|
| 1277 | + * panic path. |
|---|
| 1278 | + */ |
|---|
| 1279 | + if (of_property_read_bool(rtas.dev, "ibm,extended-os-term")) |
|---|
| 1280 | + ibm_os_term_token = rtas_token("ibm,os-term"); |
|---|
| 1281 | + |
|---|
| 1270 | 1282 | /* If RTAS was found, allocate the RMO buffer for it and look for |
|---|
| 1271 | 1283 | * the stop-self token if any |
|---|
| 1272 | 1284 | */ |
|---|