diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2017-07-16 16:08:58 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2017-08-02 05:05:27 +0000 |
commit | dbd64953aeac482976a63a8d56adb9562d5a00e4 (patch) | |
tree | fd43583d57b5d12a7003d7e2e5a399790f0e8d82 /src/northbridge/amd | |
parent | bf201d58ebef8a037c44534a45357de157b92642 (diff) |
binaryPI: Add dispatcher for PI blob
Change-Id: I622d155fce3fa56cd5e24282e22de060fed560c3
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/20624
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/northbridge/amd')
-rw-r--r-- | src/northbridge/amd/agesa/state_machine.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/northbridge/amd/agesa/state_machine.c b/src/northbridge/amd/agesa/state_machine.c index d16e9adbae..3f61c584aa 100644 --- a/src/northbridge/amd/agesa/state_machine.c +++ b/src/northbridge/amd/agesa/state_machine.c @@ -19,6 +19,7 @@ #include <arch/acpi.h> #include <bootstate.h> +#include <cbfs.h> #include <cbmem.h> #include <northbridge/amd/agesa/state_machine.h> @@ -29,25 +30,64 @@ #include "AMD.h" #include "heapManager.h" -#include "Dispatcher.h" +#if IS_ENABLED(CONFIG_CPU_AMD_AGESA_OPENSOURCE) +#include "Dispatcher.h" +#endif #if ENV_ROMSTAGE #include <PlatformMemoryConfiguration.h> CONST PSO_ENTRY ROMDATA DefaultPlatformMemoryConfiguration[] = {PSO_END}; #endif +static void agesa_locate_image(AMD_CONFIG_PARAMS *StdHeader) +{ +#if IS_ENABLED(CONFIG_CPU_AMD_AGESA_BINARY_PI) + const char ModuleIdentifier[] = AGESA_ID; + const void *agesa, *image; + size_t file_size; + + agesa = cbfs_boot_map_with_leak((const char *)CONFIG_AGESA_CBFS_NAME, + CBFS_TYPE_RAW, &file_size); + if (agesa == NULL) + return; + + image = LibAmdLocateImage(agesa, agesa + file_size, 4096, + ModuleIdentifier); + StdHeader->ImageBasePtr = (void*) image; +#endif +} + void agesa_set_interface(struct sysinfo *cb) { memset(&cb->StdHeader, 0, sizeof(AMD_CONFIG_PARAMS)); cb->StdHeader.CalloutPtr = GetBiosCallout; + + if (IS_ENABLED(CONFIG_CPU_AMD_AGESA_BINARY_PI)) { + agesa_locate_image(&cb->StdHeader); + AMD_IMAGE_HEADER *image = + (void*)(uintptr_t)cb->StdHeader.ImageBasePtr; + ASSERT(image); + AMD_MODULE_HEADER *module = + (void*)(uintptr_t)image->ModuleInfoOffset; + ASSERT(module && module->ModuleDispatcher); + } } AGESA_STATUS module_dispatch(AGESA_STRUCT_NAME func, AMD_CONFIG_PARAMS *StdHeader) { - MODULE_ENTRY dispatcher = AmdAgesaDispatcher; + MODULE_ENTRY dispatcher; + +#if IS_ENABLED(CONFIG_CPU_AMD_AGESA_OPENSOURCE) + dispatcher = AmdAgesaDispatcher; +#endif +#if IS_ENABLED(CONFIG_CPU_AMD_AGESA_BINARY_PI) + AMD_IMAGE_HEADER *image = (void*)(uintptr_t)StdHeader->ImageBasePtr; + AMD_MODULE_HEADER *module = (void*)(uintptr_t)image->ModuleInfoOffset; + dispatcher = module->ModuleDispatcher; +#endif StdHeader->Func = func; return dispatcher(StdHeader); |