From 395578c94f1fe2a5bcb40a6daf6c10eb411eda5a Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 2 Nov 2021 13:45:38 -0600 Subject: [PATCH] Add post code ring-buffer support --- src/board/system76/common/pnp.c | 11 +++++++++++ src/ec/ite/ec.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/board/system76/common/pnp.c b/src/board/system76/common/pnp.c index 7dff19aa9..fe0b5db9c 100644 --- a/src/board/system76/common/pnp.c +++ b/src/board/system76/common/pnp.c @@ -5,6 +5,7 @@ #include #include #include +#include #include volatile uint8_t __xdata __at(0x1200) IHIOA; @@ -73,4 +74,14 @@ void pnp_enable() { // Enable SWUC pnp_write(0x07, 0x04); pnp_write(0x30, 0x01); + +#ifdef POST_CODE_RING_BUFFER + // Set up ring-buffer for POST codes + for (uint8_t i = 0x80; i <= 0xBF; i++) { + BRAM[i] = 0; + } + pnp_write(0x07, 0x10); + pnp_write(0xF3, 0x00); + pnp_write(0xF4, 0x3F); +#endif // POST_CODE_RING_BUFFER } diff --git a/src/ec/ite/ec.c b/src/ec/ite/ec.c index a8d077ec5..9e241eae3 100644 --- a/src/ec/ite/ec.c +++ b/src/ec/ite/ec.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only +#include #include #include #include @@ -23,7 +24,17 @@ void ec_read_post_codes(void) { uint8_t p81h = P81HD; P80H81HS |= 1; +#ifdef POST_CODE_RING_BUFFER + DEBUG("POST %02X%02X:", p81h, p80h); + + // Also dump ring-buffer + for (uint8_t i = 0x80; i <= 0xBF; i+=2) { + DEBUG(" %02X%02X", BRAM[i + 1], BRAM[i]); + } + DEBUG("\n"); +#else // POST_CODE_RING_BUFFER DEBUG("POST %02X%02X\n", p81h, p80h); +#endif // POST_CODE_RING_BUFFER } #endif }