summaryrefslogtreecommitdiff
path: root/src/soc/intel/apollolake/uart.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-08-05 11:12:44 -0700
committerFurquan Shaikh <furquan@google.com>2017-08-10 16:25:14 +0000
commitea4ece61b6fc787c652a193ecd04c075daca3158 (patch)
tree44ce6dc1af1cd2f7ef61bd4510e3da694fd9119d /src/soc/intel/apollolake/uart.c
parent96024836077d28100035950e517b2ae5ad1ab5d9 (diff)
soc/intel/apollolake: Enable UART debug controller on S3 resume
1. Add a new variable to GNVS to store information during S3 suspend whether UART debug controller is enabled. 2. On resume, read stored GNVS variable to decide if UART debug port controller needs to be initialized. 3. Provide helper functions required by intel/common UARRT driver for enabling controller on S3 resume. BUG=b:64030366 Change-Id: Idd17dd0bd3c644383f273b465a16add184e3b171 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/20888 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/apollolake/uart.c')
-rw-r--r--src/soc/intel/apollolake/uart.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/soc/intel/apollolake/uart.c b/src/soc/intel/apollolake/uart.c
index 3db460a999..673039cbe8 100644
--- a/src/soc/intel/apollolake/uart.c
+++ b/src/soc/intel/apollolake/uart.c
@@ -20,20 +20,38 @@
* shouldn't cause any fragmentation.
*/
+#include <cbmem.h>
#include <device/device.h>
#include <device/pci.h>
#include <intelblocks/uart.h>
+#include <soc/nvs.h>
#include <soc/pci_devs.h>
+#if !ENV_SMM
void pch_uart_read_resources(struct device *dev)
{
pci_dev_read_resources(dev);
- if ((IS_ENABLED(CONFIG_SOC_UART_DEBUG) &&
- dev->path.pci.devfn == _PCH_DEVFN(UART,
- CONFIG_UART_FOR_CONSOLE))) {
+ if (IS_ENABLED(CONFIG_SOC_UART_DEBUG) &&
+ uart_is_debug_controller(dev)) {
/* will override existing resource. */
fixed_mem_resource(dev, PCI_BASE_ADDRESS_0,
CONFIG_CONSOLE_UART_BASE_ADDRESS >> 10, 4, 0);
}
}
+#endif
+
+bool pch_uart_init_debug_controller_on_resume(void)
+{
+ global_nvs_t *gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
+
+ if (gnvs)
+ return !!gnvs->uior;
+
+ return false;
+}
+
+device_t pch_uart_get_debug_controller(void)
+{
+ return _PCH_DEV(UART, CONFIG_UART_FOR_CONSOLE);
+}