Lines Matching +full:display +full:- +full:hint
1 // SPDX-License-Identifier: GPL-2.0-or-later
41 #include <asm/rtas-work-area.h>
48 /* Indexes into the args buffer, -1 if not used */
61 * struct rtas_function - Descriptor for RTAS functions.
65 * @filter: If non-NULL, invoking this function via the rtas syscall is
74 * @lock: Pointer to an optional dedicated per-function mutex. This
91 * Per-function locks for sequence-based RTAS functions.
103 .name = "check-exception",
106 .name = "display-character",
108 .buf_idx1 = -1, .size_idx1 = -1,
109 .buf_idx2 = -1, .size_idx2 = -1,
113 .name = "event-scan",
116 .name = "freeze-time-base",
119 .name = "get-power-level",
121 .buf_idx1 = -1, .size_idx1 = -1,
122 .buf_idx2 = -1, .size_idx2 = -1,
126 .name = "get-sensor-state",
128 .buf_idx1 = -1, .size_idx1 = -1,
129 .buf_idx2 = -1, .size_idx2 = -1,
133 .name = "get-term-char",
136 .name = "get-time-of-day",
138 .buf_idx1 = -1, .size_idx1 = -1,
139 .buf_idx2 = -1, .size_idx2 = -1,
143 .name = "ibm,activate-firmware",
145 .buf_idx1 = -1, .size_idx1 = -1,
146 .buf_idx2 = -1, .size_idx2 = -1,
157 .name = "ibm,cbe-start-ptcal",
160 .name = "ibm,cbe-stop-ptcal",
163 .name = "ibm,change-msi",
166 .name = "ibm,close-errinjct",
168 .buf_idx1 = -1, .size_idx1 = -1,
169 .buf_idx2 = -1, .size_idx2 = -1,
173 .name = "ibm,configure-bridge",
176 .name = "ibm,configure-connector",
178 .buf_idx1 = 0, .size_idx1 = -1,
179 .buf_idx2 = 1, .size_idx2 = -1,
184 .name = "ibm,configure-kernel-dump",
187 .name = "ibm,configure-pe",
190 .name = "ibm,create-pe-dma-window",
193 .name = "ibm,display-message",
195 .buf_idx1 = 0, .size_idx1 = -1,
196 .buf_idx2 = -1, .size_idx2 = -1,
202 .buf_idx1 = 2, .size_idx1 = -1,
203 .buf_idx2 = -1, .size_idx2 = -1,
211 .name = "ibm,get-config-addr-info",
214 .name = "ibm,get-config-addr-info2",
216 .buf_idx1 = -1, .size_idx1 = -1,
217 .buf_idx2 = -1, .size_idx2 = -1,
221 .name = "ibm,get-dynamic-sensor-state",
223 .buf_idx1 = 1, .size_idx1 = -1,
224 .buf_idx2 = -1, .size_idx2 = -1,
228 * must not call ibm,get-dynamic-sensor-state with
229 * different inputs until a non-retry status has been
235 .name = "ibm,get-indices",
238 .buf_idx2 = -1, .size_idx2 = -1,
242 * interleave ibm,get-indices call sequences with
248 .name = "ibm,get-rio-topology",
251 .name = "ibm,get-system-parameter",
254 .buf_idx2 = -1, .size_idx2 = -1,
258 .name = "ibm,get-vpd",
260 .buf_idx1 = 0, .size_idx1 = -1,
270 .name = "ibm,get-xive",
273 .name = "ibm,int-off",
276 .name = "ibm,int-on",
279 .name = "ibm,io-quiesce-ack",
282 .name = "ibm,lpar-perftools",
285 .buf_idx2 = -1, .size_idx2 = -1,
294 .name = "ibm,manage-flash-image",
297 .name = "ibm,manage-storage-preservation",
300 .name = "ibm,nmi-interlock",
303 .name = "ibm,nmi-register",
306 .name = "ibm,open-errinjct",
308 .buf_idx1 = -1, .size_idx1 = -1,
309 .buf_idx2 = -1, .size_idx2 = -1,
313 .name = "ibm,open-sriov-allow-unfreeze",
316 .name = "ibm,open-sriov-map-pe-number",
319 .name = "ibm,os-term",
322 .name = "ibm,partner-control",
325 .name = "ibm,physical-attestation",
328 .buf_idx2 = -1, .size_idx2 = -1,
331 * This follows a sequence-based pattern similar to
332 * ibm,get-vpd et al. Since PAPR+ restricts
340 .name = "ibm,platform-dump",
343 .buf_idx2 = -1, .size_idx2 = -1,
347 * sequences of ibm,platform-dump are allowed if they
350 * reconsideration if kernel-internal users appear.
354 .name = "ibm,power-off-ups",
357 .name = "ibm,query-interrupt-source-number",
360 .name = "ibm,query-pe-dma-window",
363 .name = "ibm,read-pci-config",
366 .name = "ibm,read-slot-reset-state",
368 .buf_idx1 = -1, .size_idx1 = -1,
369 .buf_idx2 = -1, .size_idx2 = -1,
373 .name = "ibm,read-slot-reset-state2",
376 .name = "ibm,remove-pe-dma-window",
381 * "ibm,reset-pe-dma-windows" (plural), but RTAS
384 .name = "ibm,reset-pe-dma-window",
387 .name = "ibm,scan-log-dump",
390 .buf_idx2 = -1, .size_idx2 = -1,
394 .name = "ibm,set-dynamic-indicator",
396 .buf_idx1 = 2, .size_idx1 = -1,
397 .buf_idx2 = -1, .size_idx2 = -1,
402 * non-retry status has been returned.
407 .name = "ibm,set-eeh-option",
409 .buf_idx1 = -1, .size_idx1 = -1,
410 .buf_idx2 = -1, .size_idx2 = -1,
414 .name = "ibm,set-slot-reset",
417 .name = "ibm,set-system-parameter",
419 .buf_idx1 = 1, .size_idx1 = -1,
420 .buf_idx2 = -1, .size_idx2 = -1,
424 .name = "ibm,set-xive",
427 .name = "ibm,slot-error-detail",
430 .name = "ibm,suspend-me",
433 .buf_idx1 = -1, .size_idx1 = -1,
434 .buf_idx2 = -1, .size_idx2 = -1,
438 .name = "ibm,tune-dma-parms",
441 .name = "ibm,update-flash-64-and-reboot",
444 .name = "ibm,update-nodes",
447 .buf_idx1 = 0, .size_idx1 = -1,
448 .buf_idx2 = -1, .size_idx2 = -1,
453 .name = "ibm,update-properties",
456 .buf_idx1 = 0, .size_idx1 = -1,
457 .buf_idx2 = -1, .size_idx2 = -1,
462 .name = "ibm,validate-flash-image",
465 .name = "ibm,write-pci-config",
468 .name = "nvram-fetch",
471 .name = "nvram-store",
474 .name = "power-off",
477 .name = "put-term-char",
480 .name = "query-cpu-stopped-state",
483 .name = "read-pci-config",
486 .name = "rtas-last-error",
489 .name = "set-indicator",
491 .buf_idx1 = -1, .size_idx1 = -1,
492 .buf_idx2 = -1, .size_idx2 = -1,
496 .name = "set-power-level",
498 .buf_idx1 = -1, .size_idx1 = -1,
499 .buf_idx2 = -1, .size_idx2 = -1,
503 .name = "set-time-for-power-on",
505 .buf_idx1 = -1, .size_idx1 = -1,
506 .buf_idx2 = -1, .size_idx2 = -1,
510 .name = "set-time-of-day",
512 .buf_idx1 = -1, .size_idx1 = -1,
513 .buf_idx2 = -1, .size_idx2 = -1,
517 .name = "start-cpu",
520 .name = "stop-self",
523 .name = "system-reboot",
526 .name = "thaw-time-base",
529 .name = "write-pci-config",
542 * Exceptions to the RTAS serialization requirement (e.g. stop-self)
549 * rtas_function_token() - RTAS function token lookup.
564 * Various drivers attempt token lookups on non-RTAS in rtas_function_token()
579 return strcmp(f1->name, f2->name); in rtas_function_cmp()
583 * Boot-time initialization of the function table needs the lookup to
584 * return a non-const-qualified object. Use rtas_name_to_function()
613 const s32 token = func->token; in rtas_token_to_function_xarray_init()
639 * known-good token value in contexts where the former is not already
659 if (func->token == token) in rtas_token_to_function()
679 const struct rtas_function *func = rtas_token_to_function(be32_to_cpu(args->token)); in __do_enter_rtas_trace()
682 * If there is a per-function lock, it must be held by the in __do_enter_rtas_trace()
685 if (func->lock) in __do_enter_rtas_trace()
686 lockdep_assert_held(func->lock); in __do_enter_rtas_trace()
691 trace_rtas_input(args, func->name); in __do_enter_rtas_trace()
697 trace_rtas_output(args, func->name); in __do_enter_rtas_trace()
708 * i.e. we're about to call stop-self. The tracepoints' in do_enter_rtas()
713 * 2. In real mode, as when invoking ibm,nmi-interlock from in do_enter_rtas()
748 * If non-NULL, this gets called when the kernel terminates.
756 * are designed only for very early low-level debugging, which
757 * is why the token is hard-coded to 10.
777 while (width-- > 0) in call_rtas_display_status_delay()
788 if (width--) { in call_rtas_display_status_delay()
833 return -1; in udbg_rtascon_getc_poll()
836 return -1; in udbg_rtascon_getc_poll()
845 while ((c = udbg_rtascon_getc_poll()) == -1) in udbg_rtascon_getc()
880 "ibm,display-line-length", NULL))) in rtas_progress()
883 "ibm,form-feed", NULL))) in rtas_progress()
886 "ibm,display-number-of-lines", NULL))) in rtas_progress()
889 "ibm,display-truncation-length", NULL); in rtas_progress()
897 /* use hex display if available */ in rtas_progress()
911 * display with a form feed; otherwise, print a CR to start output in rtas_progress()
936 * display output. in rtas_progress()
941 if (current_line > display_lines-1) in rtas_progress()
942 current_line = display_lines-1; in rtas_progress()
947 /* RTAS wants CR-LF, not just LF */ in rtas_progress()
953 /* CR might be used to re-draw a line, so we'll in rtas_progress()
964 width--; in rtas_progress()
990 return func->token; in rtas_token()
995 * access non-function properties of the /rtas node. Warn and in rtas_token()
1011 * Return the firmware-specified size of the error log buffer
1013 * This includes 'check-exception' and 'rtas-last-error'.
1022 static const char propname[] __initconst = "rtas-error-log-max"; in init_error_log_max()
1058 if (token == -1) in __fetch_rtas_last_error()
1109 args->token = cpu_to_be32(token); in va_rtas_call_unlocked()
1110 args->nargs = cpu_to_be32(nargs); in va_rtas_call_unlocked()
1111 args->nret = cpu_to_be32(nret); in va_rtas_call_unlocked()
1112 args->rets = &(args->args[nargs]); in va_rtas_call_unlocked()
1115 args->args[i] = cpu_to_be32(va_arg(list, __u32)); in va_rtas_call_unlocked()
1118 args->rets[i] = 0; in va_rtas_call_unlocked()
1124 * rtas_call_unlocked() - Invoke an RTAS firmware function without synchronization.
1138 * time. Examples include stop-self and ibm,nmi-interlock.
1156 * rtas_call() - Invoke an RTAS firmware function.
1172 * -2 or 990x should use rtas_busy_delay() to correctly handle those
1183 * * 0 - RTAS function call succeeded.
1184 * * -1 - RTAS function encountered a hardware or
1187 * * -2 - Specs say "A necessary hardware device was busy,
1197 * * -3 - Parameter error.
1198 * * -7 - Unexpected state change.
1199 * * 9000...9899 - Vendor-specific success codes.
1200 * * 9900...9905 - Advisory extended delay. Caller should try
1202 * the last digit of the status [0-5]. Again going
1204 * contention for RTAS-internal resources. Other
1208 * * -9000 - Multi-level isolation error.
1209 * * -9999...-9004 - Vendor-specific error codes.
1210 * * Additional negative values - Function-specific error.
1211 * * Additional positive values - Function-specific success.
1224 return -1; in rtas_call()
1233 return -1; in rtas_call()
1238 return -1; in rtas_call()
1251 /* A -1 return code indicates that the last command couldn't in rtas_call()
1253 if (be32_to_cpu(args->rets[0]) == -1) in rtas_call()
1257 for (i = 0; i < nret-1; ++i) in rtas_call()
1258 outputs[i] = be32_to_cpu(args->rets[i + 1]); in rtas_call()
1259 ret = (nret > 0) ? be32_to_cpu(args->rets[0]) : 0; in rtas_call()
1274 * rtas_busy_delay_time() - From an RTAS status value, calculate the
1283 * * 100000 - If @status is 9905.
1284 * * 10000 - If @status is 9904.
1285 * * 1000 - If @status is 9903.
1286 * * 100 - If @status is 9902.
1287 * * 10 - If @status is 9901.
1288 * * 1 - If @status is either 9900 or -2. This is "wrong" for -2, but
1291 * * 0 - If @status is not a busy or extended delay value.
1302 order = status - RTAS_EXTENDED_DELAY_MIN; in rtas_busy_delay_time()
1303 for (ms = 1; order > 0; order--) in rtas_busy_delay_time()
1352 * rtas_busy_delay() - helper for RTAS busy and extended delay statuses
1360 * * true - @status is RTAS_BUSY or an extended delay hint. The
1366 * * false - @status is not @RTAS_BUSY nor an extended delay hint. The
1385 * The extended delay hint can be as high as 100 seconds. in rtas_busy_delay()
1392 * The delay hint is an order-of-magnitude suggestion, not in rtas_busy_delay()
1398 * See Documentation/timers/timers-howto.rst for in rtas_busy_delay()
1401 * 9902-9905. in rtas_busy_delay()
1437 rc = -EIO; in rtas_error_rc()
1440 rc = -EINVAL; in rtas_error_rc()
1442 case -9000: /* Isolation error */ in rtas_error_rc()
1443 rc = -EFAULT; in rtas_error_rc()
1445 case -9001: /* Outstanding TCE/PTE */ in rtas_error_rc()
1446 rc = -EEXIST; in rtas_error_rc()
1448 case -9002: /* No usable slot */ in rtas_error_rc()
1449 rc = -ENODEV; in rtas_error_rc()
1453 rc = -ERANGE; in rtas_error_rc()
1466 return -ENOENT; in rtas_get_power_level()
1483 return -ENOENT; in rtas_set_power_level()
1501 return -ENOENT; in rtas_get_sensor()
1519 return -ENOENT; in rtas_get_sensor_fast()
1538 indicators = of_get_property(rtas.dev, "rtas-indicators", &proplen); in rtas_indicator_present()
1561 return -ENOENT; in rtas_set_indicator()
1582 return -ENOENT; in rtas_set_indicator_fast()
1596 * rtas_ibm_suspend_me() - Call ibm,suspend-me to suspend the LPAR.
1612 * 0 - The partition has resumed from suspend, possibly after
1614 * -ECANCELED - The operation was aborted.
1615 * -EAGAIN - There were other CPUs not in H_JOIN at the time of the call.
1616 * -EBUSY - Some other condition prevented the suspend from succeeding.
1617 * -EIO - Hardware/platform error.
1632 ret = -ECANCELED; in rtas_ibm_suspend_me()
1635 ret = -EAGAIN; in rtas_ibm_suspend_me()
1639 ret = -EBUSY; in rtas_ibm_suspend_me()
1641 case -1: in rtas_ibm_suspend_me()
1643 ret = -EIO; in rtas_ibm_suspend_me()
1657 pr_emerg("system-reboot returned %d\n", in rtas_restart()
1667 pr_emerg("power-off returned %d\n", in rtas_power_off()
1668 rtas_call(rtas_function_token(RTAS_FN_POWER_OFF), 2, 1, NULL, -1, -1)); in rtas_power_off()
1677 pr_emerg("power-off returned %d\n", in rtas_halt()
1678 rtas_call(rtas_function_token(RTAS_FN_POWER_OFF), 2, 1, NULL, -1, -1)); in rtas_halt()
1693 * Firmware with the ibm,extended-os-term property is guaranteed in rtas_os_term()
1694 * to always return from an ibm,os-term call. Earlier versions without in rtas_os_term()
1715 pr_emerg("ibm,os-term call failed %d\n", status); in rtas_os_term()
1719 * rtas_activate_firmware() - Activate a new version of firmware.
1735 pr_notice("ibm,activate-firmware method unavailable\n"); in rtas_activate_firmware()
1748 pr_err("ibm,activate-firmware failed (%i)\n", fwrc); in rtas_activate_firmware()
1752 * get_pseries_errorlog() - Find a specific pseries error log in an RTAS
1763 (struct rtas_ext_event_log_v6 *)log->buffer; in get_pseries_errorlog()
1776 log_end = log->buffer + ext_log_length; in get_pseries_errorlog()
1777 p = ext_log->vendor_log; in get_pseries_errorlog()
1831 f = func->filter; in block_rtas_call()
1837 if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) && func->banned_for_syscall_on_le) in block_rtas_call()
1840 if (f->buf_idx1 != -1) { in block_rtas_call()
1841 base = be32_to_cpu(args->args[f->buf_idx1]); in block_rtas_call()
1842 if (f->size_idx1 != -1) in block_rtas_call()
1843 size = be32_to_cpu(args->args[f->size_idx1]); in block_rtas_call()
1844 else if (f->fixed_size) in block_rtas_call()
1845 size = f->fixed_size; in block_rtas_call()
1849 end = base + size - 1; in block_rtas_call()
1852 * Special case for ibm,platform-dump - NULL buffer in block_rtas_call()
1862 if (f->buf_idx2 != -1) { in block_rtas_call()
1863 base = be32_to_cpu(args->args[f->buf_idx2]); in block_rtas_call()
1864 if (f->size_idx2 != -1) in block_rtas_call()
1865 size = be32_to_cpu(args->args[f->size_idx2]); in block_rtas_call()
1866 else if (f->fixed_size) in block_rtas_call()
1867 size = f->fixed_size; in block_rtas_call()
1870 end = base + size - 1; in block_rtas_call()
1873 * Special case for ibm,configure-connector where the in block_rtas_call()
1885 pr_err_ratelimited("sys_rtas: RTAS call blocked - exploit attempt?\n"); in block_rtas_call()
1887 func->name, nargs, current->comm); in block_rtas_call()
1902 return -EPERM; in SYSCALL_DEFINE1()
1905 return -EINVAL; in SYSCALL_DEFINE1()
1908 return -EFAULT; in SYSCALL_DEFINE1()
1917 return -EINVAL; in SYSCALL_DEFINE1()
1920 if (copy_from_user(args.args, uargs->args, in SYSCALL_DEFINE1()
1922 return -EFAULT; in SYSCALL_DEFINE1()
1930 return -EINVAL; in SYSCALL_DEFINE1()
1936 return -EINVAL; in SYSCALL_DEFINE1()
1957 if (rc == -EAGAIN) in SYSCALL_DEFINE1()
1959 else if (rc == -EIO) in SYSCALL_DEFINE1()
1960 args.rets[0] = cpu_to_be32(-1); in SYSCALL_DEFINE1()
1970 * acquire it to avoid interleaving with any kernel-based uses in SYSCALL_DEFINE1()
1971 * of the same function. Kernel-based sequences acquire the in SYSCALL_DEFINE1()
1974 if (func->lock) in SYSCALL_DEFINE1()
1975 mutex_lock(func->lock); in SYSCALL_DEFINE1()
1984 /* A -1 return code indicates that the last command couldn't in SYSCALL_DEFINE1()
1986 if (be32_to_cpu(args.rets[0]) == -1) in SYSCALL_DEFINE1()
1992 if (func->lock) in SYSCALL_DEFINE1()
1993 mutex_unlock(func->lock); in SYSCALL_DEFINE1()
2003 if (copy_to_user(uargs->args + nargs, in SYSCALL_DEFINE1()
2006 return -EFAULT; in SYSCALL_DEFINE1()
2020 curr->token = RTAS_UNKNOWN_SERVICE; in rtas_function_table_init()
2028 prior = &rtas_function_table[i - 1]; in rtas_function_table_init()
2030 cmp = strcmp(prior->name, curr->name); in rtas_function_table_init()
2036 curr->name); in rtas_function_table_init()
2039 prior->name, curr->name); in rtas_function_table_init()
2046 if (prop->length != sizeof(u32)) in rtas_function_table_init()
2049 func = __rtas_name_to_function(prop->name); in rtas_function_table_init()
2053 func->token = be32_to_cpup((__be32 *)prop->value); in rtas_function_table_init()
2055 pr_debug("function %s has token %u\n", func->name, func->token); in rtas_function_table_init()
2061 * information from the device-tree and allocate the RMO buffer for userland
2077 no_base = of_property_read_u32(rtas.dev, "linux,rtas-base", &base); in rtas_initialize()
2078 no_size = of_property_read_u32(rtas.dev, "rtas-size", &size); in rtas_initialize()
2087 no_entry = of_property_read_u32(rtas.dev, "linux,rtas-entry", &entry); in rtas_initialize()
2099 ibm_extended_os_term = of_property_read_bool(rtas.dev, "ibm,extended-os-term"); in rtas_initialize()
2102 * the stop-self token if any in rtas_initialize()
2125 basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL); in early_init_dt_scan_rtas()
2126 entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL); in early_init_dt_scan_rtas()
2127 sizep = of_get_flat_dt_prop(node, "rtas-size", NULL); in early_init_dt_scan_rtas()
2131 if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL)) in early_init_dt_scan_rtas()
2142 basep = of_get_flat_dt_prop(node, "put-term-char", NULL); in early_init_dt_scan_rtas()
2146 basep = of_get_flat_dt_prop(node, "get-term-char", NULL); in early_init_dt_scan_rtas()