Lines Matching +full:short +full:- +full:press +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0-or-later
63 * If non-NULL, this gets called when the kernel terminates.
93 * are designed only for very early low-level debugging, which
94 * is why the token is hard-coded to 10.
114 while (width-- > 0) in call_rtas_display_status_delay()
125 if (width--) { in call_rtas_display_status_delay()
170 return -1; in udbg_rtascon_getc_poll()
173 return -1; in udbg_rtascon_getc_poll()
182 while ((c = udbg_rtascon_getc_poll()) == -1) in udbg_rtascon_getc()
197 void rtas_progress(char *s, unsigned short hex) in rtas_progress()
217 "ibm,display-line-length", NULL))) in rtas_progress()
220 "ibm,form-feed", NULL))) in rtas_progress()
223 "ibm,display-number-of-lines", NULL))) in rtas_progress()
226 "ibm,display-truncation-length", NULL); in rtas_progress()
229 display_character = rtas_token("display-character"); in rtas_progress()
230 set_indicator = rtas_token("set-indicator"); in rtas_progress()
278 if (current_line > display_lines-1) in rtas_progress()
279 current_line = display_lines-1; in rtas_progress()
284 /* RTAS wants CR-LF, not just LF */ in rtas_progress()
290 /* CR might be used to re-draw a line, so we'll in rtas_progress()
301 width--; in rtas_progress()
335 * Return the firmware-specified size of the error log buffer
337 * This includes 'check-exception' and 'rtas-last-error'.
345 rtas_error_log_max = rtas_token ("rtas-error-log-max"); in rtas_get_error_log_max()
372 if (rtas_last_error_token == -1) in __fetch_rtas_last_error()
422 args->token = cpu_to_be32(token); in va_rtas_call_unlocked()
423 args->nargs = cpu_to_be32(nargs); in va_rtas_call_unlocked()
424 args->nret = cpu_to_be32(nret); in va_rtas_call_unlocked()
425 args->rets = &(args->args[nargs]); in va_rtas_call_unlocked()
428 args->args[i] = cpu_to_be32(va_arg(list, __u32)); in va_rtas_call_unlocked()
431 args->rets[i] = 0; in va_rtas_call_unlocked()
455 return -1; in rtas_call()
466 /* A -1 return code indicates that the last command couldn't in rtas_call()
468 if (be32_to_cpu(rtas_args->rets[0]) == -1) in rtas_call()
472 for (i = 0; i < nret-1; ++i) in rtas_call()
473 outputs[i] = be32_to_cpu(rtas_args->rets[i+1]); in rtas_call()
474 ret = (nret > 0)? be32_to_cpu(rtas_args->rets[0]): 0; in rtas_call()
487 /* For RTAS_BUSY (-2), delay for 1 millisecond. For an extended busy status
493 unsigned int ms = 0; in rtas_busy_delay_time() local
496 ms = 1; in rtas_busy_delay_time()
499 order = status - RTAS_EXTENDED_DELAY_MIN; in rtas_busy_delay_time()
500 for (ms = 1; order > 0; order--) in rtas_busy_delay_time()
501 ms *= 10; in rtas_busy_delay_time()
504 return ms; in rtas_busy_delay_time()
511 unsigned int ms; in rtas_busy_delay() local
514 ms = rtas_busy_delay_time(status); in rtas_busy_delay()
515 if (ms && need_resched()) in rtas_busy_delay()
516 msleep(ms); in rtas_busy_delay()
518 return ms; in rtas_busy_delay()
527 case -1: /* Hardware Error */ in rtas_error_rc()
528 rc = -EIO; in rtas_error_rc()
530 case -3: /* Bad indicator/domain/etc */ in rtas_error_rc()
531 rc = -EINVAL; in rtas_error_rc()
533 case -9000: /* Isolation error */ in rtas_error_rc()
534 rc = -EFAULT; in rtas_error_rc()
536 case -9001: /* Outstanding TCE/PTE */ in rtas_error_rc()
537 rc = -EEXIST; in rtas_error_rc()
539 case -9002: /* No usable slot */ in rtas_error_rc()
540 rc = -ENODEV; in rtas_error_rc()
545 rc = -ERANGE; in rtas_error_rc()
553 int token = rtas_token("get-power-level"); in rtas_get_power_level()
557 return -ENOENT; in rtas_get_power_level()
570 int token = rtas_token("set-power-level"); in rtas_set_power_level()
574 return -ENOENT; in rtas_set_power_level()
588 int token = rtas_token("get-sensor-state"); in rtas_get_sensor()
592 return -ENOENT; in rtas_get_sensor()
606 int token = rtas_token("get-sensor-state"); in rtas_get_sensor_fast()
610 return -ENOENT; in rtas_get_sensor_fast()
629 indicators = of_get_property(rtas.dev, "rtas-indicators", &proplen); in rtas_indicator_present()
649 int token = rtas_token("set-indicator"); in rtas_set_indicator()
653 return -ENOENT; in rtas_set_indicator()
671 int token = rtas_token("set-indicator"); in rtas_set_indicator_fast()
674 return -ENOENT; in rtas_set_indicator_fast()
691 printk("RTAS system-reboot returned %d\n", in rtas_restart()
692 rtas_call(rtas_token("system-reboot"), 0, 1, NULL)); in rtas_restart()
700 /* allow power on only with power button press */ in rtas_power_off()
701 printk("RTAS power-off returned %d\n", in rtas_power_off()
702 rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1)); in rtas_power_off()
710 /* allow power on only with power button press */ in rtas_halt()
711 printk("RTAS power-off returned %d\n", in rtas_halt()
712 rtas_call(rtas_token("power-off"), 2, 1, NULL, -1, -1)); in rtas_halt()
725 * Firmware with the ibm,extended-os-term property is guaranteed in rtas_os_term()
726 * to always return from an ibm,os-term call. Earlier versions without in rtas_os_term()
746 printk(KERN_EMERG "ibm,os-term call failed %d\n", status); in rtas_os_term()
758 printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n", smp_processor_id()); in __rtas_suspend_last_cpu()
760 while (rc == H_MULTI_THREADS_ACTIVE && !atomic_read(&data->done) && in __rtas_suspend_last_cpu()
761 !atomic_read(&data->error)) in __rtas_suspend_last_cpu()
762 rc = rtas_call(data->token, 0, 1, NULL); in __rtas_suspend_last_cpu()
764 if (rc || atomic_read(&data->error)) { in __rtas_suspend_last_cpu()
765 printk(KERN_DEBUG "ibm,suspend-me returned %d\n", rc); in __rtas_suspend_last_cpu()
769 if (atomic_read(&data->error)) in __rtas_suspend_last_cpu()
770 rc = atomic_read(&data->error); in __rtas_suspend_last_cpu()
772 atomic_set(&data->error, rc); in __rtas_suspend_last_cpu()
776 atomic_set(&data->done, 1); in __rtas_suspend_last_cpu()
782 if (atomic_dec_return(&data->working) == 0) in __rtas_suspend_last_cpu()
783 complete(data->complete); in __rtas_suspend_last_cpu()
790 atomic_inc(&data->working); in rtas_suspend_last_cpu()
800 atomic_inc(&data->working); in __rtas_suspend_cpu()
806 while (rc == H_SUCCESS && !atomic_read(&data->done) && !atomic_read(&data->error)) in __rtas_suspend_cpu()
822 atomic_set(&data->error, rc); in __rtas_suspend_cpu()
826 atomic_set(&data->done, 1); in __rtas_suspend_cpu()
836 if (atomic_dec_return(&data->working) == 0) in __rtas_suspend_cpu()
837 complete(data->complete); in __rtas_suspend_cpu()
859 if (!rtas_service_present("ibm,suspend-me")) in rtas_ibm_suspend_me()
860 return -ENOSYS; in rtas_ibm_suspend_me()
871 return -EAGAIN; in rtas_ibm_suspend_me()
875 return -EIO; in rtas_ibm_suspend_me()
881 data.token = rtas_token("ibm,suspend-me"); in rtas_ibm_suspend_me()
907 * rtas_call_reentrant() - Used for reentrant rtas calls
914 * According to LoPAR documentation, only "ibm,int-on", "ibm,int-off",
915 * "ibm,get-xive" and "ibm,set-xive" are currently reentrant.
919 * Return: -1 on error,
931 return -1; in rtas_call_reentrant()
936 /* We use the per-cpu (PACA) rtas args buffer */ in rtas_call_reentrant()
937 args = local_paca->rtas_args_reentrant; in rtas_call_reentrant()
944 for (i = 0; i < nret - 1; ++i) in rtas_call_reentrant()
945 outputs[i] = be32_to_cpu(args->rets[i + 1]); in rtas_call_reentrant()
948 ret = be32_to_cpu(args->rets[0]); in rtas_call_reentrant()
959 return -ENOSYS; in rtas_ibm_suspend_me()
974 (struct rtas_ext_event_log_v6 *)log->buffer; in get_pseries_errorlog()
987 log_end = log->buffer + ext_log_length; in get_pseries_errorlog()
988 p = ext_log->vendor_log; in get_pseries_errorlog()
1022 /* Indexes into the args buffer, -1 if not used */
1032 { "ibm,activate-firmware", -1, -1, -1, -1, -1 },
1033 { "ibm,configure-connector", -1, 0, -1, 1, -1, 4096 }, /* Special cased */
1034 { "display-character", -1, -1, -1, -1, -1 },
1035 { "ibm,display-message", -1, 0, -1, -1, -1 },
1036 { "ibm,errinjct", -1, 2, -1, -1, -1, 1024 },
1037 { "ibm,close-errinjct", -1, -1, -1, -1, -1 },
1038 { "ibm,open-errinjct", -1, -1, -1, -1, -1 },
1039 { "ibm,get-config-addr-info2", -1, -1, -1, -1, -1 },
1040 { "ibm,get-dynamic-sensor-state", -1, 1, -1, -1, -1 },
1041 { "ibm,get-indices", -1, 2, 3, -1, -1 },
1042 { "get-power-level", -1, -1, -1, -1, -1 },
1043 { "get-sensor-state", -1, -1, -1, -1, -1 },
1044 { "ibm,get-system-parameter", -1, 1, 2, -1, -1 },
1045 { "get-time-of-day", -1, -1, -1, -1, -1 },
1046 { "ibm,get-vpd", -1, 0, -1, 1, 2 },
1047 { "ibm,lpar-perftools", -1, 2, 3, -1, -1 },
1048 { "ibm,platform-dump", -1, 4, 5, -1, -1 }, /* Special cased */
1049 { "ibm,read-slot-reset-state", -1, -1, -1, -1, -1 },
1050 { "ibm,scan-log-dump", -1, 0, 1, -1, -1 },
1051 { "ibm,set-dynamic-indicator", -1, 2, -1, -1, -1 },
1052 { "ibm,set-eeh-option", -1, -1, -1, -1, -1 },
1053 { "set-indicator", -1, -1, -1, -1, -1 },
1054 { "set-power-level", -1, -1, -1, -1, -1 },
1055 { "set-time-for-power-on", -1, -1, -1, -1, -1 },
1056 { "ibm,set-system-parameter", -1, 1, -1, -1, -1 },
1057 { "set-time-of-day", -1, -1, -1, -1, -1 },
1058 { "ibm,suspend-me", -1, -1, -1, -1, -1 },
1059 { "ibm,update-nodes", -1, 0, -1, -1, -1, 4096 },
1060 { "ibm,update-properties", -1, 0, -1, -1, -1, 4096 },
1061 { "ibm,physical-attestation", -1, 0, 1, -1, -1 },
1082 if (token != f->token) in block_rtas_call()
1085 if (f->buf_idx1 != -1) { in block_rtas_call()
1086 base = be32_to_cpu(args->args[f->buf_idx1]); in block_rtas_call()
1087 if (f->size_idx1 != -1) in block_rtas_call()
1088 size = be32_to_cpu(args->args[f->size_idx1]); in block_rtas_call()
1089 else if (f->fixed_size) in block_rtas_call()
1090 size = f->fixed_size; in block_rtas_call()
1094 end = base + size - 1; in block_rtas_call()
1097 * Special case for ibm,platform-dump - NULL buffer in block_rtas_call()
1100 if (!strcmp(f->name, "ibm,platform-dump") && in block_rtas_call()
1108 if (f->buf_idx2 != -1) { in block_rtas_call()
1109 base = be32_to_cpu(args->args[f->buf_idx2]); in block_rtas_call()
1110 if (f->size_idx2 != -1) in block_rtas_call()
1111 size = be32_to_cpu(args->args[f->size_idx2]); in block_rtas_call()
1112 else if (f->fixed_size) in block_rtas_call()
1113 size = f->fixed_size; in block_rtas_call()
1116 end = base + size - 1; in block_rtas_call()
1119 * Special case for ibm,configure-connector where the in block_rtas_call()
1122 if (!strcmp(f->name, "ibm,configure-connector") && in block_rtas_call()
1134 pr_err_ratelimited("sys_rtas: RTAS call blocked - exploit attempt?\n"); in block_rtas_call()
1136 token, nargs, current->comm); in block_rtas_call()
1159 return -EPERM; in SYSCALL_DEFINE1()
1162 return -EINVAL; in SYSCALL_DEFINE1()
1165 return -EFAULT; in SYSCALL_DEFINE1()
1174 return -EINVAL; in SYSCALL_DEFINE1()
1177 if (copy_from_user(args.args, uargs->args, in SYSCALL_DEFINE1()
1179 return -EFAULT; in SYSCALL_DEFINE1()
1182 return -EINVAL; in SYSCALL_DEFINE1()
1188 return -EINVAL; in SYSCALL_DEFINE1()
1201 if (rc == -EAGAIN) in SYSCALL_DEFINE1()
1203 else if (rc == -EIO) in SYSCALL_DEFINE1()
1204 args.rets[0] = cpu_to_be32(-1); in SYSCALL_DEFINE1()
1218 /* A -1 return code indicates that the last command couldn't in SYSCALL_DEFINE1()
1220 if (be32_to_cpu(args.rets[0]) == -1) in SYSCALL_DEFINE1()
1233 if (copy_to_user(uargs->args + nargs, in SYSCALL_DEFINE1()
1236 return -EFAULT; in SYSCALL_DEFINE1()
1243 * information from the device-tree and allocate the RMO buffer for userland
1262 no_base = of_property_read_u32(rtas.dev, "linux,rtas-base", &base); in rtas_initialize()
1263 no_size = of_property_read_u32(rtas.dev, "rtas-size", &size); in rtas_initialize()
1272 no_entry = of_property_read_u32(rtas.dev, "linux,rtas-entry", &entry); in rtas_initialize()
1279 if (of_property_read_bool(rtas.dev, "ibm,extended-os-term")) in rtas_initialize()
1280 ibm_os_term_token = rtas_token("ibm,os-term"); in rtas_initialize()
1283 * the stop-self token if any in rtas_initialize()
1288 ibm_suspend_me_token = rtas_token("ibm,suspend-me"); in rtas_initialize()
1298 rtas_last_error_token = rtas_token("rtas-last-error"); in rtas_initialize()
1316 basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL); in early_init_dt_scan_rtas()
1317 entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL); in early_init_dt_scan_rtas()
1318 sizep = of_get_flat_dt_prop(node, "rtas-size", NULL); in early_init_dt_scan_rtas()
1322 if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL)) in early_init_dt_scan_rtas()
1333 basep = of_get_flat_dt_prop(node, "put-term-char", NULL); in early_init_dt_scan_rtas()
1337 basep = of_get_flat_dt_prop(node, "get-term-char", NULL); in early_init_dt_scan_rtas()
1361 rtas_call(rtas_token("freeze-time-base"), 0, 1, NULL); in rtas_give_timebase()
1367 rtas_call(rtas_token("thaw-time-base"), 0, 1, NULL); in rtas_give_timebase()