Skip to content

Commit

Permalink
Add post code ring-buffer support
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 authored and crawfxrd committed Jul 24, 2024
1 parent 384b916 commit e6385f9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/board/system76/common/pnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <board/pnp.h>
#include <common/macro.h>
#include <common/debug.h>
#include <ec/bram.h>
#include <ec/espi.h>

volatile uint8_t __xdata __at(0x1200) IHIOA;
Expand Down Expand Up @@ -80,4 +81,14 @@ void pnp_enable(void) {
// 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
}
11 changes: 11 additions & 0 deletions src/ec/ite/ec.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <ec/bram.h>
#include <ec/ec.h>
#include <ec/gctrl.h>
#include <common/debug.h>
Expand All @@ -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
}

0 comments on commit e6385f9

Please sign in to comment.