From: Mate Kukri Date: Wed, 7 Feb 2024 08:29:34 +0000 (+0000) Subject: Revert "term/ns8250: Use ACPI SPCR table when available to configure serial" X-Git-Tag: archive/raspbian/2.12-8+rpi1~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7088a1922eac5c76bed3fd1d92353b34ee3ce118;p=grub2.git Revert "term/ns8250: Use ACPI SPCR table when available to configure serial" This reverts commit 7b192ec4cd7c4b3207db010202349dd283e72041. Gbp-Pq: Name revert-term-ns8250-spcr.patch --- diff --git a/docs/grub.texi b/docs/grub.texi index b4825b7..990d8c7 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2730,10 +2730,6 @@ speed 9600bps. The serial unit 0 is usually called @samp{COM1}, so, if you want to use COM2, you must specify @samp{--unit=1} instead. This command accepts many other options, @pxref{serial} for more details. -Without argument or with @samp{--port=auto}, GRUB will attempt to use -ACPI when available to auto-detect the default serial port and its -configuration. - The commands @command{terminal_input} (@pxref{terminal_input}) and @command{terminal_output} (@pxref{terminal_output}) choose which type of terminal you want to use. In the case above, the terminal will be a @@ -4257,11 +4253,6 @@ be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd}, @samp{even} and defaults to @samp{no}. -If passed no @var{unit} nor @var{port}, or if @var{port} is set to -@samp{auto} then GRUB will attempt to use ACPI to automatically detect -the system default serial port and its configuration. If this information -is not available, it will default to @var{unit} 0. - The serial port is not used as a communication channel unless the @command{terminal_input} or @command{terminal_output} command is used (@pxref{terminal_input}, @pxref{terminal_output}). diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def index 7e7e360..f580ef7 100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@ -2106,7 +2106,6 @@ module = { name = serial; common = term/serial.c; x86 = term/ns8250.c; - x86 = term/ns8250-spcr.c; ieee1275 = term/ieee1275/serial.c; mips_arc = term/arc/serial.c; efi = term/efi/serial.c; diff --git a/grub-core/term/ns8250-spcr.c b/grub-core/term/ns8250-spcr.c deleted file mode 100644 index d52b52c..0000000 --- a/grub-core/term/ns8250-spcr.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2022 Free Software Foundation, Inc. - * - * GRUB is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GRUB is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GRUB. If not, see . - */ - -#if !defined(GRUB_MACHINE_IEEE1275) && !defined(GRUB_MACHINE_QEMU) - -#include -#include -#include -#include -#include -#include - -struct grub_serial_port * -grub_ns8250_spcr_init (void) -{ - struct grub_acpi_spcr *spcr; - struct grub_serial_config config; - - spcr = grub_acpi_find_table (GRUB_ACPI_SPCR_SIGNATURE); - if (spcr == NULL) - return NULL; - if (spcr->hdr.revision < 2) - grub_dprintf ("serial", "SPCR table revision %d < 2, continuing anyway\n", - (int) spcr->hdr.revision); - if (spcr->intf_type != GRUB_ACPI_SPCR_INTF_TYPE_16550 && - spcr->intf_type != GRUB_ACPI_SPCR_INTF_TYPE_16550X) - return NULL; - /* For now, we only support byte accesses. */ - if (spcr->base_addr.access_size != GRUB_ACPI_GENADDR_SIZE_BYTE && - spcr->base_addr.access_size != GRUB_ACPI_GENADDR_SIZE_LGCY) - return NULL; - config.word_len = 8; - config.parity = GRUB_SERIAL_PARITY_NONE; - config.stop_bits = GRUB_SERIAL_STOP_BITS_1; - config.base_clock = UART_DEFAULT_BASE_CLOCK; - if (spcr->flow_control & GRUB_ACPI_SPCR_FC_RTSCTS) - config.rtscts = 1; - else - config.rtscts = 0; - switch (spcr->baud_rate) - { - case GRUB_ACPI_SPCR_BAUD_9600: - config.speed = 9600; - break; - case GRUB_ACPI_SPCR_BAUD_19200: - config.speed = 19200; - break; - case GRUB_ACPI_SPCR_BAUD_57600: - config.speed = 57600; - break; - case GRUB_ACPI_SPCR_BAUD_115200: - config.speed = 115200; - break; - case GRUB_ACPI_SPCR_BAUD_CURRENT: - default: - /* - * We don't (yet) have a way to read the currently - * configured speed in HW, so let's use a sane default. - */ - config.speed = 115200; - break; - }; - switch (spcr->base_addr.space_id) - { - case GRUB_ACPI_GENADDR_MEM_SPACE: - return grub_serial_ns8250_add_mmio (spcr->base_addr.addr, - spcr->base_addr.access_size, &config); - case GRUB_ACPI_GENADDR_IO_SPACE: - return grub_serial_ns8250_add_port (spcr->base_addr.addr, &config); - default: - return NULL; - }; -} - -#endif diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c index 8260dcb..c49c2e8 100644 --- a/grub-core/term/serial.c +++ b/grub-core/term/serial.c @@ -209,19 +209,6 @@ grub_serial_find (const char *name) if (port != NULL) return port; } - -#if (defined(__i386__) || defined(__x86_64__)) && !defined(GRUB_MACHINE_IEEE1275) && !defined(GRUB_MACHINE_QEMU) - if (grub_strcmp (name, "auto") == 0) - { - /* Look for an SPCR if any. If not, default to com0. */ - port = grub_ns8250_spcr_init (); - if (port != NULL) - return port; - FOR_SERIAL_PORTS (port) - if (grub_strcmp (port->name, "com0") == 0) - return port; - } -#endif #endif #ifdef GRUB_MACHINE_IEEE1275 @@ -271,7 +258,7 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) name = args[0]; if (!name) - name = "auto"; + name = "com0"; port = grub_serial_find (name); if (!port) diff --git a/include/grub/serial.h b/include/grub/serial.h index d7e0635..2d930c9 100644 --- a/include/grub/serial.h +++ b/include/grub/serial.h @@ -190,7 +190,6 @@ grub_serial_config_defaults (struct grub_serial_port *port) #if defined(__mips__) || defined (__i386__) || defined (__x86_64__) void grub_ns8250_init (void); -struct grub_serial_port *grub_ns8250_spcr_init (void); struct grub_serial_port *grub_serial_ns8250_add_port (grub_port_t port, struct grub_serial_config *config); struct grub_serial_port *grub_serial_ns8250_add_mmio (grub_addr_t addr,