Skip to content

Commit

Permalink
Revert "EFI loader: add support for mmio serial consoles so these are…
Browse files Browse the repository at this point in the history
… detected automatically if no legacy options are available."

This reverts commit 1cfe19d.
New commit in a bit.
  • Loading branch information
fichtner committed Feb 21, 2022
1 parent 1cfe19d commit c1ba3c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 54 deletions.
6 changes: 1 addition & 5 deletions stand/efi/loader/bootinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,6 @@ bi_getboothowto(char *kargs)
NULL, NULL);
}
}
if (getenv("efi_uart_mmio") != NULL && getenv("hw.uart.console") == NULL) {
snprintf(buf, sizeof(buf), "mm:%s,rs:2", getenv("efi_uart_mmio"));
env_setenv("hw.uart.console", EV_VOLATILE, buf, NULL, NULL);
}
#endif
}

Expand Down Expand Up @@ -511,7 +507,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp)
/* Handle device tree blob */
dtbp = addr;
dtb_size = fdt_copy(addr);

/* Pad to a page boundary */
if (dtb_size)
addr += roundup(dtb_size, PAGE_SIZE);
Expand Down
52 changes: 3 additions & 49 deletions stand/efi/loader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* All rights reserved.
*
* Copyright (c) 2016-2019 Netflix, Inc. written by M. Warner Losh
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Expand Down Expand Up @@ -720,16 +720,13 @@ setenv_int(const char *key, int val)
int
parse_uefi_con_out(void)
{
int how, rv, len;
int how, rv;
int vid_seen = 0, com_seen = 0, seen = 0;
int uidx = 0 , token_idx = 0, is_uart =0;
size_t sz;
char buf[4096], *ep, *devpname, *token, *uart_addr, *uart_ref, *rest;
char uart_addr_le[30], mmio_addr[30];
char buf[4096], *ep;
EFI_DEVICE_PATH *node;
ACPI_HID_DEVICE_PATH *acpi;
UART_DEVICE_PATH *uart;
CHAR16 *text;
bool pci_pending;

how = 0;
Expand Down Expand Up @@ -783,49 +780,6 @@ parse_uefi_con_out(void)
node = NextDevicePathNode(node);
}

/*
* When no legacy serial is found, we might be looking at a non-legacy mmio serial device mapping
* In which case the efi_devpath_name() for name ConOutDev looks like this:
* VenHw(XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,0090DCFE00000000)/Uart(115200,8,N,1)/VenVt100()
* Which should tell the kernel to attach a console to fedc9000 (little endian)
*/
if (getenv("efi_8250_uid") == NULL) {
text = efi_devpath_name((EFI_DEVICE_PATH *)buf);
if (text != NULL) {
len = ucs2len(text);
if ((devpname = malloc(len + 1)) != NULL) {
cpy16to8(text, devpname, len+1);
rest = devpname;
while ((token = strtok_r(rest, ",()/", &rest))) {
if (strcmp(token, "Uart") == 0) {
is_uart = 1;
} else if (token_idx == 2) {
uart_addr = token;
}
++token_idx;
}
if (is_uart && uart_addr && strlen(uart_addr) <= 20) {
// big endian to little endian
memset(uart_addr_le, 0, sizeof(uart_addr_le));
for (int i=strlen(uart_addr) -1; i >= 0; i--) {
if ( i%2 == 0) {
uidx = (int)strlen(uart_addr) - i -1;
} else {
uidx = (int)strlen(uart_addr) - i +1;
}
uart_addr_le[uidx-1] = uart_addr[i];
}
uart_ref = uart_addr_le;
while (*uart_ref == '0') uart_ref++;
sprintf(mmio_addr, "0x%s", uart_ref);
setenv("efi_uart_mmio", mmio_addr, 1);
}
free(devpname);
}
efi_free_devpath_name(text);
}
}

/*
* Truth table for RB_MULTIPLE | RB_SERIAL
* Value Result
Expand Down

0 comments on commit c1ba3c6

Please sign in to comment.