]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/acpi/spcr.c
Merge tag 'mips_fixes_4.16_2' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan...
[linux.git] / drivers / acpi / spcr.c
index 324b35bfe781d42ad83e70d2f95d4ed56ab0854c..9d52743080a4f65200ea6e33f0d0d2fefdb881ea 100644 (file)
@@ -21,7 +21,7 @@
  * occasionally getting stuck as 1. To avoid the potential for a hang, check
  * TXFE == 0 instead of BUSY == 1. This may not be suitable for all UART
  * implementations, so only do so if an affected platform is detected in
- * parse_spcr().
+ * acpi_parse_spcr().
  */
 bool qdf2400_e44_present;
 EXPORT_SYMBOL(qdf2400_e44_present);
@@ -74,19 +74,21 @@ static bool xgene_8250_erratum_present(struct acpi_table_spcr *tb)
 }
 
 /**
- * parse_spcr() - parse ACPI SPCR table and add preferred console
+ * acpi_parse_spcr() - parse ACPI SPCR table and add preferred console
  *
- * @earlycon: set up earlycon for the console specified by the table
+ * @enable_earlycon: set up earlycon for the console specified by the table
+ * @enable_console: setup the console specified by the table.
  *
  * For the architectures with support for ACPI, CONFIG_ACPI_SPCR_TABLE may be
  * defined to parse ACPI SPCR table.  As a result of the parsing preferred
- * console is registered and if @earlycon is true, earlycon is set up.
+ * console is registered and if @enable_earlycon is true, earlycon is set up.
+ * If @enable_console is true the system console is also configured.
  *
  * When CONFIG_ACPI_SPCR_TABLE is defined, this function should be called
  * from arch initialization code as soon as the DT/ACPI decision is made.
  *
  */
-int __init parse_spcr(bool earlycon)
+int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
 {
        static char opts[64];
        struct acpi_table_spcr *table;
@@ -105,17 +107,15 @@ int __init parse_spcr(bool earlycon)
        if (ACPI_FAILURE(status))
                return -ENOENT;
 
-       if (table->header.revision < 2) {
-               err = -ENOENT;
-               pr_err("wrong table version\n");
-               goto done;
-       }
+       if (table->header.revision < 2)
+               pr_info("SPCR table version %d\n", table->header.revision);
 
        if (table->serial_port.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
                switch (ACPI_ACCESS_BIT_WIDTH((
                        table->serial_port.access_width))) {
                default:
                        pr_err("Unexpected SPCR Access Width.  Defaulting to byte size\n");
+                       /* fall through */
                case 8:
                        iotype = "mmio";
                        break;
@@ -185,7 +185,7 @@ int __init parse_spcr(bool earlycon)
         */
        if (qdf2400_erratum_44_present(&table->header)) {
                qdf2400_e44_present = true;
-               if (earlycon)
+               if (enable_earlycon)
                        uart = "qdf2400_e44";
        }
 
@@ -205,11 +205,13 @@ int __init parse_spcr(bool earlycon)
 
        pr_info("console: %s\n", opts);
 
-       if (earlycon)
+       if (enable_earlycon)
                setup_earlycon(opts);
 
-       err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
-
+       if (enable_console)
+               err = add_preferred_console(uart, 0, opts + strlen(uart) + 1);
+       else
+               err = 0;
 done:
        acpi_put_table((struct acpi_table_header *)table);
        return err;