/* scan backwards from end of string for first non-numeral */ for (s = name + strlen(name);
s > name && s[-1] >= '0' && s[-1] <= '9';
s--)
; if (*s)
earlycon->index = simple_strtoul(s, NULL, 10);
len = s - name;
strscpy(earlycon->name, name, min(len + 1, sizeof(earlycon->name)));
earlycon->data = &early_console_dev;
}
/** * setup_earlycon - match and register earlycon console * @buf: earlycon param string * * Registers the earlycon console matching the earlycon specified * in the param string @buf. Acceptable param strings are of the form * <name>,io|mmio|mmio32|mmio32be,<addr>,<options> * <name>,0x<addr>,<options> * <name>,<options> * <name> * * Only for the third form does the earlycon setup() method receive the * <options> string in the 'options' parameter; all other forms set * the parameter to NULL. * * Returns 0 if an attempt to register the earlycon was made, * otherwise negative error code
*/ int __init setup_earlycon(char *buf)
{ conststruct earlycon_id *match; bool empty_compatible = true;
if (!buf || !buf[0]) return -EINVAL;
if (console_is_registered(&early_con)) return -EALREADY;
again: for (match = __earlycon_table; match < __earlycon_table_end; match++) {
size_t len = strlen(match->name);
if (strncmp(buf, match->name, len)) continue;
/* prefer entries with empty compatible */ if (empty_compatible && *match->compatible) continue;
if (buf[len]) { if (buf[len] != ',') continue;
buf += len + 1;
} else
buf = NULL;
return register_earlycon(buf, match);
}
if (empty_compatible) {
empty_compatible = false; goto again;
}
return -ENOENT;
}
/* * This defers the initialization of the early console until after ACPI has * been initialized.
*/ bool earlycon_acpi_spcr_enable __initdata;
/* early_param wrapper for setup_earlycon() */ staticint __init param_setup_earlycon(char *buf)
{ int err;
/* Just 'earlycon' is a valid param for devicetree and ACPI SPCR. */ if (!buf || !buf[0]) { if (IS_ENABLED(CONFIG_ACPI_SPCR_TABLE)) {
earlycon_acpi_spcr_enable = true; return 0;
} elseif (!buf) { return early_init_dt_scan_chosen_stdout();
}
}
/* * The `console` parameter is overloaded. It's handled here as an early param * and in `printk.c` as a late param. It's possible to specify an early * `bootconsole` using `earlycon=uartXXXX` (handled above), or via * the `console=uartXXX` alias. See the comment in `8250_early.c`.
*/ staticint __init param_setup_earlycon_console_alias(char *buf)
{ /* * A plain `console` parameter must not enable the SPCR `bootconsole` * like a plain `earlycon` does. * * A `console=` parameter that specifies an empty value is used to * disable the `console`, not the `earlycon` `bootconsole`. The * disabling of the `console` is handled by `printk.c`.
*/ if (!buf || !buf[0]) return 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.