summaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-12-08 15:38:59 -0700
committerMartin Roth <martinroth@google.com>2017-12-11 01:07:31 +0000
commita78319ba26c01c3bd5a3573c448ea39394d81eaf (patch)
treef79159a266185a52c8c20b68a7e1b093f3af0483 /src/soc/amd
parentaf32770755211aadcc4e9f578bae38592b61f1cd (diff)
vc/amd/pi/00670F00/binaryPI: cache the AGESA dispatcher
Instead of repeatedly walking cbfs for the AGESA blob and parsing it cache the resulting dispatcher value. There's only one dispatcher table so use it. The resulting change is that this work is done one time per stage. BUG=b:70401101 TEST=Booted and noted only one lookup per stage. Change-Id: Iaa4aecc384108d66d7c68fc5fb9ac1c3f40da905 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/22789 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com> Reviewed-by: Justin TerAvest <teravest@chromium.org>
Diffstat (limited to 'src/soc/amd')
-rw-r--r--src/soc/amd/common/agesawrapper.c22
-rw-r--r--src/soc/amd/common/agesawrapper.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/src/soc/amd/common/agesawrapper.c b/src/soc/amd/common/agesawrapper.c
index b9391836ce..ec76b4d35c 100644
--- a/src/soc/amd/common/agesawrapper.c
+++ b/src/soc/amd/common/agesawrapper.c
@@ -14,6 +14,7 @@
*/
#include "agesawrapper.h"
+#include <arch/early_variables.h>
#include <cbfs.h>
#include <cbmem.h>
#include <delay.h>
@@ -378,3 +379,24 @@ const void *agesawrapper_locate_module (const CHAR8 name[8])
return module;
}
+
+static MODULE_ENTRY agesa_dispatcher CAR_GLOBAL;
+
+MODULE_ENTRY agesa_get_dispatcher(void)
+{
+ const AMD_MODULE_HEADER *module;
+ static const CHAR8 id[8] = AGESA_ID;
+ MODULE_ENTRY val = car_get_var(agesa_dispatcher);
+
+ if (val != NULL)
+ return val;
+
+ module = agesawrapper_locate_module(id);
+ if (!module)
+ return NULL;
+
+ val = module->ModuleDispatcher;
+ car_set_var(agesa_dispatcher, val);
+
+ return val;
+}
diff --git a/src/soc/amd/common/agesawrapper.h b/src/soc/amd/common/agesawrapper.h
index 6ddc658981..08ac5968ca 100644
--- a/src/soc/amd/common/agesawrapper.h
+++ b/src/soc/amd/common/agesawrapper.h
@@ -31,6 +31,9 @@ enum {
PICK_CRAT,
};
+/* Return current dispatcher or NULL on error. */
+MODULE_ENTRY agesa_get_dispatcher(void);
+
AGESA_STATUS agesawrapper_amdinitreset(void);
AGESA_STATUS agesawrapper_amdinitearly(void);
AGESA_STATUS agesawrapper_amdinitenv(void);