diff options
Diffstat (limited to 'src/northbridge/amd')
-rw-r--r-- | src/northbridge/amd/pi/agesawrapper.c | 25 | ||||
-rw-r--r-- | src/northbridge/amd/pi/agesawrapper.h | 6 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/northbridge/amd/pi/agesawrapper.c b/src/northbridge/amd/pi/agesawrapper.c index efdfdbd6bc..8bcd8ac372 100644 --- a/src/northbridge/amd/pi/agesawrapper.c +++ b/src/northbridge/amd/pi/agesawrapper.c @@ -18,6 +18,7 @@ */ #include <AGESA.h> +#include <cbfs.h> #include <cpu/amd/pi/s3_resume.h> #include <cpu/x86/mtrr.h> #include <cpuRegisters.h> @@ -589,3 +590,27 @@ AGESA_STATUS agesawrapper_amdreadeventlog (UINT8 HeapStatus) return Status; } + +const void *agesawrapper_locate_module (const CHAR8 name[8]) +{ + struct cbfs_media media; + struct cbfs_file* file; + const void* agesa; + const AMD_IMAGE_HEADER* image; + const AMD_MODULE_HEADER* module; + size_t file_size; + + if (init_default_cbfs_media(&media)) + return NULL; + file = cbfs_get_file(&media, (const char*)CONFIG_CBFS_AGESA_NAME); + if (!file) + return NULL; + agesa = cbfs_get_file_content(&media, (const char*)CONFIG_CBFS_AGESA_NAME, + ntohl(file->type), &file_size); + if (!agesa) + return NULL; + image = LibAmdLocateImage(agesa, agesa + file_size - 1, 4096, name); + module = (AMD_MODULE_HEADER*)image->ModuleInfoOffset; + + return module; +} diff --git a/src/northbridge/amd/pi/agesawrapper.h b/src/northbridge/amd/pi/agesawrapper.h index adcc75529b..b77e04ce9e 100644 --- a/src/northbridge/amd/pi/agesawrapper.h +++ b/src/northbridge/amd/pi/agesawrapper.h @@ -24,6 +24,11 @@ #include "Porting.h" #include "AGESA.h" +/* TODO: Add a kconfig option to name the AGESA ROM file in CBFS */ +#ifndef CONFIG_CBFS_AGESA_NAME +#define CONFIG_CBFS_AGESA_NAME "AGESA" +#endif + enum { PICK_DMI, /* DMI Interface */ PICK_PSTATE, /* Acpi Pstate SSDT Table */ @@ -55,5 +60,6 @@ AGESA_STATUS agesawrapper_fchs3laterestore(void); VOID OemCustomizeInitEarly (IN OUT AMD_EARLY_PARAMS *InitEarly); VOID amd_initcpuio(void); VOID amd_initmmio(void); +const void *agesawrapper_locate_module (const CHAR8 name[8]); #endif /* _AGESAWRAPPER_H_ */ |