diff options
author | Lijian Zhao <lijian.zhao@intel.com> | 2018-04-13 16:27:38 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-04-20 13:02:46 +0000 |
commit | e6db1895617a50eabf9f1a0b40025e8a74817cc3 (patch) | |
tree | 51a65a63e08f8a68898f231fa60d6ba9f288a6d1 /src | |
parent | 551e1fe06fc59cb2cba7fd38f970cb48fc811086 (diff) |
soc/intel/common: Adjust LPC Generic IO setup
Check same IO ranges get programmed first, if so just skip it to avoid double
programming.
BUG=b:77944335
TEST=Boot up with mewoth board, and check serial log, there's no error
message about "LPC: Cannot Open IO Window: ".
Change-Id: I89f9bb70320f91b16c6084384c4a0a53ede3760c
Signed-off-by: Lijian Zhao <lijian.zhao@intel.com>
Reviewed-on: https://review.coreboot.org/25667
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/soc/intel/common/block/lpc/lpc_lib.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/soc/intel/common/block/lpc/lpc_lib.c b/src/soc/intel/common/block/lpc/lpc_lib.c index aeac441c23..58b588e508 100644 --- a/src/soc/intel/common/block/lpc/lpc_lib.c +++ b/src/soc/intel/common/block/lpc/lpc_lib.c @@ -65,7 +65,7 @@ void lpc_close_pmio_windows(void) void lpc_open_pmio_window(uint16_t base, uint16_t size) { - int lgir_reg_num; + int i, lgir_reg_num; uint32_t lgir_reg_offset, lgir, window_size, alignment; resource_t bridged_size, bridge_base; @@ -76,16 +76,6 @@ void lpc_open_pmio_window(uint16_t base, uint16_t size) bridge_base = base; while (bridged_size < size) { - lgir_reg_num = find_unused_pmio_window(); - if (lgir_reg_num < 0) { - printk(BIOS_ERR, - "LPC: Cannot open IO window: %llx size %llx\n", - bridge_base, size - bridged_size); - printk(BIOS_ERR, "No more IO windows\n"); - return; - } - lgir_reg_offset = LPC_GENERIC_IO_RANGE(lgir_reg_num); - /* Each IO range register can only open a 256-byte window. */ window_size = MIN(size, LPC_LGIR_MAX_WINDOW_SIZE); @@ -97,6 +87,23 @@ void lpc_open_pmio_window(uint16_t base, uint16_t size) lgir = (bridge_base & LPC_LGIR_ADDR_MASK) | LPC_LGIR_EN; lgir |= ((window_size - 1) << 16) & LPC_LGIR_AMASK_MASK; + /* Skip programming if same range already programmed. */ + for (i = 0; i < LPC_NUM_GENERIC_IO_RANGES; i++) { + if (lgir == pci_read_config32(PCH_DEV_LPC, + LPC_GENERIC_IO_RANGE(i))) + return; + } + + lgir_reg_num = find_unused_pmio_window(); + if (lgir_reg_num < 0) { + printk(BIOS_ERR, + "LPC: Cannot open IO window: %llx size %llx\n", + bridge_base, size - bridged_size); + printk(BIOS_ERR, "No more IO windows\n"); + return; + } + lgir_reg_offset = LPC_GENERIC_IO_RANGE(lgir_reg_num); + pci_write_config32(PCH_DEV_LPC, lgir_reg_offset, lgir); printk(BIOS_DEBUG, |