sb/intel/lynxpoint: Add SerialIO UART console support
Derived from Broadwell and adapted to follow what soc/intel does. Note that SERIALIO_UART_CONSOLE is meant to be selected from the mainboards which expose a SerialIO UART. UART_FOR_CONSOLE also needs to be set in mainboard Kconfig accordingly. It is possible that some of the UART configuration steps in bootblock are unnecessary. However, some of the steps turn off power management features and others are undocumented: omitting them could cause weird issues. Finally, add a config file to ensure the code gets build-tested. Tested on out-of-tree Compal LA-A992P, SerialIO UART 0 can be used to receive coreboot and SeaBIOS logs. Change-Id: Ifb3460dd50ed03421a38f03c80f91ae9fd604022 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52489 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
committed by
Patrick Georgi
parent
fc096888e1
commit
aced1f02cf
@@ -8,6 +8,7 @@
|
||||
#include <device/pci.h>
|
||||
#include <device/pci_ids.h>
|
||||
#include <soc/nvs.h>
|
||||
#include <types.h>
|
||||
#include "chip.h"
|
||||
#include "iobp.h"
|
||||
#include "pch.h"
|
||||
@@ -20,6 +21,19 @@ static void serialio_enable_clock(struct resource *bar0)
|
||||
write32(res2mmio(bar0, SIO_REG_PPR_CLOCK, 0), reg32);
|
||||
}
|
||||
|
||||
static bool serialio_uart_is_debug(struct device *dev)
|
||||
{
|
||||
if (CONFIG(SERIALIO_UART_CONSOLE)) {
|
||||
switch (dev->path.pci.devfn) {
|
||||
case PCH_DEVFN_UART0:
|
||||
return CONFIG_UART_FOR_CONSOLE == 0;
|
||||
case PCH_DEVFN_UART1:
|
||||
return CONFIG_UART_FOR_CONSOLE == 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Put Serial IO D21:F0-F6 device into desired mode. */
|
||||
static void serialio_d21_mode(int sio_index, int int_pin, int acpi_mode)
|
||||
{
|
||||
@@ -197,13 +211,15 @@ static void serialio_init(struct device *dev)
|
||||
break;
|
||||
case PCH_DEVFN_UART0: /* UART0 */
|
||||
sio_index = SIO_ID_UART0;
|
||||
serialio_d21_ltr(bar0);
|
||||
if (!serialio_uart_is_debug(dev))
|
||||
serialio_d21_ltr(bar0);
|
||||
serialio_d21_mode(sio_index, SIO_PIN_INTD,
|
||||
config->sio_acpi_mode);
|
||||
break;
|
||||
case PCH_DEVFN_UART1: /* UART1 */
|
||||
sio_index = SIO_ID_UART1;
|
||||
serialio_d21_ltr(bar0);
|
||||
if (!serialio_uart_is_debug(dev))
|
||||
serialio_d21_ltr(bar0);
|
||||
serialio_d21_mode(sio_index, SIO_PIN_INTD,
|
||||
config->sio_acpi_mode);
|
||||
break;
|
||||
@@ -221,8 +237,21 @@ static void serialio_init(struct device *dev)
|
||||
update_bars(sio_index, (u32)bar0->base, (u32)bar1->base);
|
||||
}
|
||||
|
||||
static void serialio_read_resources(struct device *dev)
|
||||
{
|
||||
pci_dev_read_resources(dev);
|
||||
|
||||
/* Set the configured UART base address for the debug port */
|
||||
if (CONFIG(SERIALIO_UART_CONSOLE) && serialio_uart_is_debug(dev)) {
|
||||
struct resource *res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
||||
res->base = CONFIG_CONSOLE_UART_BASE_ADDRESS;
|
||||
res->size = 0x1000;
|
||||
res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
|
||||
}
|
||||
}
|
||||
|
||||
static struct device_operations device_ops = {
|
||||
.read_resources = pci_dev_read_resources,
|
||||
.read_resources = serialio_read_resources,
|
||||
.set_resources = pci_dev_set_resources,
|
||||
.enable_resources = pci_dev_enable_resources,
|
||||
.init = serialio_init,
|
||||
|
Reference in New Issue
Block a user