soc/amd/common/block/lpc: Configure io/mmio windows differently for LPC and eSPI

This change updates lpc_enable_children_resources() to configure IO
and MMIO resources differently depending upon whether the mainboard
wants to setup decode windows for LPC or eSPI.

BUG=b:154445472,b:153675913

Change-Id: Ie8803e934f39388aeb6e3cbd7157664cb357ab23
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41074
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Furquan Shaikh 2020-05-04 23:42:46 -07:00
parent 98bc961ee3
commit 511aa44ee6
1 changed files with 17 additions and 1 deletions

View File

@ -14,6 +14,7 @@
#include <pc80/i8254.h> #include <pc80/i8254.h>
#include <pc80/i8259.h> #include <pc80/i8259.h>
#include <amdblocks/acpimmio.h> #include <amdblocks/acpimmio.h>
#include <amdblocks/espi.h>
#include <amdblocks/lpc.h> #include <amdblocks/lpc.h>
#include <soc/acpi.h> #include <soc/acpi.h>
#include <soc/southbridge.h> #include <soc/southbridge.h>
@ -278,6 +279,18 @@ static void configure_child_lpc_windows(struct device *dev, struct device *child
pci_write_config32(dev, LPC_IO_OR_MEM_DECODE_ENABLE, reg_x); pci_write_config32(dev, LPC_IO_OR_MEM_DECODE_ENABLE, reg_x);
} }
static void configure_child_espi_windows(struct device *child)
{
struct resource *res;
for (res = child->resource_list; res; res = res->next) {
if (res->flags & IORESOURCE_IO)
espi_open_io_window(res->base, res->size);
else if (res->flags & IORESOURCE_MEM)
espi_open_mmio_window(res->base, res->size);
}
}
static void lpc_enable_children_resources(struct device *dev) static void lpc_enable_children_resources(struct device *dev)
{ {
struct bus *link; struct bus *link;
@ -289,7 +302,10 @@ static void lpc_enable_children_resources(struct device *dev)
continue; continue;
if (child->path.type != DEVICE_PATH_PNP) if (child->path.type != DEVICE_PATH_PNP)
continue; continue;
configure_child_lpc_windows(dev, child); if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI))
configure_child_espi_windows(child);
else
configure_child_lpc_windows(dev, child);
} }
} }
} }