summaryrefslogtreecommitdiff
path: root/src/mainboard/prodrive/hermes
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2022-09-09 15:15:22 +0200
committerMartin Roth <martin.roth@amd.corp-partner.google.com>2022-10-08 21:07:46 +0000
commit373517cdeb5d97caa4585880b4fd74a3669ffd7f (patch)
treec944556c513315a8c92f5562b5ac56a48dccdac7 /src/mainboard/prodrive/hermes
parentc96056481115fd6656be87d62d039dfd5f0f591f (diff)
mb/prodrive/hermes: Write reset cause regs to EEPROM
Write the value for reset cause registers to the EEPROM for debugging. Change-Id: I827f38731fd868aac72103957e01aac8263f1cd3 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67483 Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/prodrive/hermes')
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.c2
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.h13
-rw-r--r--src/mainboard/prodrive/hermes/mainboard.c28
3 files changed, 41 insertions, 2 deletions
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c
index 4d671332ce..5defff6fc1 100644
--- a/src/mainboard/prodrive/hermes/eeprom.c
+++ b/src/mainboard/prodrive/hermes/eeprom.c
@@ -153,7 +153,7 @@ void report_eeprom_error(const size_t off)
* Write a single byte into the EEPROM at specified offset.
* Returns true on error, false on success.
*/
-static bool eeprom_write_byte(const uint8_t data, const uint16_t write_offset)
+bool eeprom_write_byte(const uint8_t data, const uint16_t write_offset)
{
int ret = 0;
diff --git a/src/mainboard/prodrive/hermes/eeprom.h b/src/mainboard/prodrive/hermes/eeprom.h
index 97a1f48dbe..6befd8e333 100644
--- a/src/mainboard/prodrive/hermes/eeprom.h
+++ b/src/mainboard/prodrive/hermes/eeprom.h
@@ -38,6 +38,12 @@ struct __packed eeprom_board_layout {
_Static_assert(sizeof(struct eeprom_board_layout) == (617 + sizeof(uint32_t)),
"struct eeprom_board_layout has invalid size!");
+struct __packed eeprom_reset_cause_regs {
+ uint32_t gblrst_cause0;
+ uint32_t gblrst_cause1;
+ uint32_t hpr_cause0;
+};
+
struct __packed eeprom_board_settings {
uint32_t signature;
union {
@@ -89,7 +95,11 @@ struct __packed eeprom_layout {
uint8_t boot_order[0x200];
char board_part_number[HERMES_SN_PN_LENGTH];
char product_part_number[HERMES_SN_PN_LENGTH];
- uint8_t unused[0x680];
+ union {
+ struct eeprom_reset_cause_regs reset_cause_regs;
+ uint8_t raw_reset_cause_registers[0x80];
+ };
+ uint8_t unused[0x600];
union {
uint8_t raw_board_settings[0xf8];
struct eeprom_board_settings board_settings;
@@ -111,6 +121,7 @@ struct eeprom_bmc_settings *get_bmc_settings(void);
const char *eeprom_read_serial(size_t offset, const char *fallback);
uint8_t get_bmc_hsi(void);
void report_eeprom_error(const size_t off);
+bool eeprom_write_byte(const uint8_t data, const uint16_t write_offset);
bool write_board_settings(const struct eeprom_board_layout *new_layout);
#define READ_EEPROM(section_type, section_name, dest, opt_name) \
diff --git a/src/mainboard/prodrive/hermes/mainboard.c b/src/mainboard/prodrive/hermes/mainboard.c
index c2f8b63e10..e94a8bc90c 100644
--- a/src/mainboard/prodrive/hermes/mainboard.c
+++ b/src/mainboard/prodrive/hermes/mainboard.c
@@ -14,6 +14,7 @@
#include <intelblocks/pmclib.h>
#include <smbios.h>
#include <soc/gpio.h>
+#include <soc/pm.h>
#include <string.h>
#include <types.h>
@@ -249,6 +250,31 @@ struct chip_operations mainboard_ops = {
.enable_dev = mainboard_enable,
};
+static void log_reset_causes(void)
+{
+ struct chipset_power_state *ps = pmc_get_power_state();
+
+ if (!ps) {
+ printk(BIOS_ERR, "chipset_power_state not found!\n");
+ return;
+ }
+
+ union {
+ struct eeprom_reset_cause_regs regs;
+ uint8_t raw[sizeof(struct eeprom_reset_cause_regs)];
+ } reset_cause = {
+ .regs = {
+ .gblrst_cause0 = ps->gblrst_cause[0],
+ .gblrst_cause1 = ps->gblrst_cause[1],
+ .hpr_cause0 = ps->hpr_cause0,
+ },
+ };
+
+ const size_t base = offsetof(struct eeprom_layout, reset_cause_regs);
+ for (size_t i = 0; i < ARRAY_SIZE(reset_cause.raw); i++)
+ eeprom_write_byte(reset_cause.raw[i], base + i);
+}
+
/* Must happen before MPinit */
static void mainboard_early(void *unused)
{
@@ -273,6 +299,8 @@ static void mainboard_early(void *unused)
READ_EEPROM_FSP_S((&supd), FspsConfig.TurboMode);
config->cpu_turbo_disable = !supd.FspsConfig.TurboMode;
}
+
+ log_reset_causes();
}
BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_EXIT, mainboard_early, NULL);