[coreboot-gerrit] Patch set updated for coreboot: drivers/fsp2_0: Implements FspNotify API

Alexandru Gagniuc (mr.nuke.me@gmail.com) gerrit at coreboot.org
Mon Jan 25 06:39:45 CET 2016


Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13358

-gerrit

commit 33d563f808bfb704b97287e22bf4b47bc38cd2c5
Author: Andrey Petrov <andrey.petrov at intel.com>
Date:   Fri Nov 6 17:26:20 2015 -0800

    drivers/fsp2_0: Implements FspNotify API
    
    This adds FspNotify implementation. Please note, FSP blobset
    assumes FspNotify is called after SiliconInit. As result, this
    implementation relies on this fact and assumes SiliconInit is
    called first.
    
    Change-Id: I75ede529403d54b78caeca0517e139c3d81090e7
    Signed-off-by: Andrey Petrov <andrey.petrov at intel.com>
---
 src/drivers/intel/fsp2_0/Makefile.inc      |  1 +
 src/drivers/intel/fsp2_0/include/fsp/api.h |  8 +++++-
 src/drivers/intel/fsp2_0/notify.c          | 41 ++++++++++++++++++++++++++++++
 src/drivers/intel/fsp2_0/silicon_init.c    |  6 ++++-
 4 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc
index e7081a7..adb5a7d 100644
--- a/src/drivers/intel/fsp2_0/Makefile.inc
+++ b/src/drivers/intel/fsp2_0/Makefile.inc
@@ -3,6 +3,7 @@ romstage-y += hand_off_block.c
 romstage-y += util.c
 romstage-y += memory_init.c
 
+ramstage-y += notify.c
 ramstage-y += silicon_init.c
 ramstage-y += util.c
 
diff --git a/src/drivers/intel/fsp2_0/include/fsp/api.h b/src/drivers/intel/fsp2_0/include/fsp/api.h
index f51174f..6d2efd8 100644
--- a/src/drivers/intel/fsp2_0/include/fsp/api.h
+++ b/src/drivers/intel/fsp2_0/include/fsp/api.h
@@ -32,10 +32,16 @@ enum fsp_status {
 	FSP_CRC_ERROR = 0x8000001b,
 };
 
+enum fsp_notify_phase {
+	AFTER_PCI_ENUM = 0x20,
+	READY_TO_BOOT = 0x40
+};
+
+
 /* Main FSP stages */
 enum fsp_status fsp_memory_init(void **hob_list);
 enum fsp_status fsp_silicon_init(void);
-enum fsp_status fsp_notify(void);
+enum fsp_status fsp_notify(enum fsp_notify_phase phase);
 
 /* Callbacks for updating stage-specific parameters */
 void platform_fsp_memory_init_params_cb(struct MEMORY_INIT_UPD *memupd);
diff --git a/src/drivers/intel/fsp2_0/notify.c b/src/drivers/intel/fsp2_0/notify.c
new file mode 100644
index 0000000..6148bc4
--- /dev/null
+++ b/src/drivers/intel/fsp2_0/notify.c
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2015 Intel Corp.
+ * (Written by Andrey Petrov <andrey.petrov at intel.com> for Intel Corp.)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <arch/cpu.h>
+#include <console/console.h>
+#include <fsp/api.h>
+#include <fsp/util.h>
+#include <string.h>
+
+typedef struct fsp_notify_params {
+  enum fsp_notify_phase phase;
+} NOTIFY_PHASE_PARAMS;
+
+typedef asmlinkage enum fsp_status (*fsp_notify_fn)
+				   (struct fsp_notify_params *);
+
+struct fsp_header *fsps_hdr = NULL;
+
+enum fsp_status fsp_notify(enum fsp_notify_phase phase)
+{
+	fsp_notify_fn fspnotify = NULL;
+
+	if (!fsps_hdr)
+		return FSP_NOT_FOUND;
+
+	fspnotify = (void*) (fsps_hdr->image_base +
+			    fsps_hdr->notify_phase_entry_offset);
+
+	printk(BIOS_DEBUG, "FspNotify %x\n", (uint32_t) phase);
+
+	return fspnotify((struct fsp_notify_params *) &phase);
+}
diff --git a/src/drivers/intel/fsp2_0/silicon_init.c b/src/drivers/intel/fsp2_0/silicon_init.c
index d600635..575c2eb 100644
--- a/src/drivers/intel/fsp2_0/silicon_init.c
+++ b/src/drivers/intel/fsp2_0/silicon_init.c
@@ -19,6 +19,7 @@
 typedef asmlinkage enum fsp_status (*fsp_silicon_init_fn)
 				   (struct SILICON_INIT_UPD *upd);
 
+extern struct fsp_header *fsps_hdr;
 
 static enum fsp_status do_silicon_init(struct fsp_header *hdr)
 {
@@ -43,11 +44,14 @@ static enum fsp_status do_silicon_init(struct fsp_header *hdr)
 
 enum fsp_status fsp_silicon_init(void)
 {
-	struct fsp_header hdr;
+	static struct fsp_header hdr;
 
 	if (fsp_load_binary(&hdr, "blobs/fsp-s.bin") != CB_SUCCESS)
 		return FSP_NOT_FOUND;
 
+	/* save the FSPS header, it will come in handy during notify */
+	fsps_hdr = &hdr;
+
 	return do_silicon_init(&hdr);
 }
 



More information about the coreboot-gerrit mailing list