efi: Unify the names for use_uart and ebs_called

The x86 and ARM implementations use a different variable for the same
thing, just inverted.

Invent a third name for this, adjust both files to use it and store it
in the common stub.c file.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-06-12 07:45:46 -06:00
parent baee46f95b
commit 4df2a3f4a1
4 changed files with 17 additions and 9 deletions

View File

@@ -13,6 +13,15 @@
#include <efi_api.h>
#include <efi_stub.h>
/*
* true if we must use the hardware UART directory (EFI not available). This
* is normally false, meaning that character output is sent to the efi_putc()
* routine. Once exit-boot-services is called, we must either not use character
* output at all, or use a hardware UART directly, if there is a driver
* available.
*/
bool use_hw_uart;
int efi_stub_exit_boot_services(void)
{
struct efi_priv *priv = efi_get_priv();

View File

@@ -18,8 +18,6 @@
#include <linux/err.h>
#include <linux/types.h>
static bool ebs_called;
void _debug_uart_putc(int ch)
{
struct efi_priv *priv = efi_get_priv();
@@ -31,7 +29,7 @@ void _debug_uart_putc(int ch)
* NOTE: for development it is possible to re-implement
* your boards debug uart here like in efi_stub.c for x86.
*/
if (!ebs_called)
if (!use_hw_uart)
efi_putc(priv, ch);
}
@@ -68,7 +66,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
efi_status_t ret;
ebs_called = false;
use_hw_uart = false;
ret = efi_init(priv, "Payload", image, sys_table);
if (ret) {
@@ -117,7 +115,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
return ret;
/* The EFI console won't work now :( */
ebs_called = true;
use_hw_uart = true;
map.version = priv->memmap_version;
map.desc_size = priv->memmap_desc_size;

View File

@@ -31,8 +31,6 @@
#error "This file needs to be ported for use on architectures"
#endif
static bool use_uart;
struct __packed desctab_info {
uint16_t limit;
uint64_t addr;
@@ -67,7 +65,7 @@ void putc(const char ch)
if (ch == '\n')
putc('\r');
if (use_uart) {
if (use_hw_uart) {
struct ns16550 *com_port = (struct ns16550 *)0x3f8;
while ((inb((ulong)&com_port->lsr) & UART_LSR_THRE) == 0)
@@ -262,7 +260,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
return ret;
/* The EFI UART won't work now, switch to a debug one */
use_uart = true;
use_hw_uart = true;
map.version = priv->memmap_version;
map.desc_size = priv->memmap_desc_size;