summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/intel/fsp2_0/include/fsp/util.h6
-rw-r--r--src/drivers/intel/fsp2_0/util.c24
2 files changed, 30 insertions, 0 deletions
diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h
index d9d953940a..d546c11fac 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/util.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/util.h
@@ -14,6 +14,7 @@
#define _FSP2_0_UTIL_H_
#include <boot/coreboot_tables.h>
+#include <fsp/api.h>
#include <fsp/info_header.h>
#include <memrange.h>
@@ -39,4 +40,9 @@ enum cb_err fsp_load_binary(struct fsp_header *hdr, const char *name,
/* Load a vbt.bin file for graphics. Returns 0 if a valid VBT is not found. */
uintptr_t fsp_load_vbt(void);
+/* Trivial handling of reset exit statuses */
+void fsp_handle_reset(enum fsp_status status);
+/* Returns true if the non-success status is a reset request */
+bool fsp_reset_requested(enum fsp_status status);
+
#endif /* _FSP2_0_UTIL_H_ */
diff --git a/src/drivers/intel/fsp2_0/util.c b/src/drivers/intel/fsp2_0/util.c
index 2eb6cf9dbb..b47b898ab8 100644
--- a/src/drivers/intel/fsp2_0/util.c
+++ b/src/drivers/intel/fsp2_0/util.c
@@ -18,6 +18,7 @@
#include <lib.h>
#include <memrange.h>
#include <program_loading.h>
+#include <reset.h>
#include <string.h>
static bool looks_like_fsp_header(const uint8_t *raw_hdr)
@@ -160,3 +161,26 @@ enum cb_err fsp_load_binary(struct fsp_header *hdr,
return CB_SUCCESS;
}
+
+void fsp_handle_reset(enum fsp_status status)
+{
+ switch(status) {
+ case FSP_STATUS_RESET_REQUIRED_COLD:
+ hard_reset();
+ break;
+ case FSP_STATUS_RESET_REQUIRED_WARM:
+ soft_reset();
+ break;
+ case FSP_STATUS_RESET_REQUIRED_GLOBAL_RESET:
+ global_reset();
+ break;
+ default:
+ break;
+ }
+}
+
+bool fsp_reset_requested(enum fsp_status status)
+{
+ return (status >= FSP_STATUS_RESET_REQUIRED_COLD &&
+ status <= FSP_STATUS_RESET_REQUIRED_GLOBAL_RESET);
+}