diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-09-30 17:49:04 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-10-02 12:15:25 +0000 |
commit | 04ebf598de6d8b8152c99ebe181de084e0b5b242 (patch) | |
tree | d8a0c3ff9d7988ffb9011d2afb5df137e3712866 | |
parent | 923b4d5c581e7f4499e957fc1f042ee776c365a1 (diff) |
fsp1_1: move relocation algorithm to commonlib
In order to support FSP 1.1 relocation within cbfstool
the relocation code needs to be moved into commonlib.
To that end, move it. The FSP 1.1 relocation code binds
to edk2 UEFI 2.4 types unconditionally which is separate
from the FSP's version binding.
BUG=chrome-os-partner:44827
BRANCH=None
TEST=Built and booted glados.
Change-Id: Ib2627d02af99092875ff885f7cb048f70ea73856
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/11772
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
-rw-r--r-- | src/commonlib/Makefile.inc | 2 | ||||
-rw-r--r-- | src/commonlib/fsp1_1_relocate.c (renamed from src/drivers/intel/fsp1_1/fsp1_1_relocate.c) | 0 | ||||
-rw-r--r-- | src/commonlib/include/commonlib/fsp1_1.h | 48 | ||||
-rw-r--r-- | src/drivers/intel/fsp1_1/Makefile.inc | 1 | ||||
-rw-r--r-- | src/drivers/intel/fsp1_1/fsp_relocate.c | 1 | ||||
-rw-r--r-- | src/drivers/intel/fsp1_1/include/fsp/api.h | 2 | ||||
-rw-r--r-- | src/drivers/intel/fsp1_1/include/fsp/util.h | 6 | ||||
-rw-r--r-- | src/vendorcode/intel/fsp/fsp1_1/IntelFspPkg/Include/FspInfoHeader.h | 2 |
8 files changed, 53 insertions, 9 deletions
diff --git a/src/commonlib/Makefile.inc b/src/commonlib/Makefile.inc index 70a9b1ad7b..929bf8edc0 100644 --- a/src/commonlib/Makefile.inc +++ b/src/commonlib/Makefile.inc @@ -8,3 +8,5 @@ verstage-y += region.c romstage-y += region.c ramstage-y += region.c smm-y += region.c + +ramstage-$(CONFIG_PLATFORM_USES_FSP1_1) += fsp1_1_relocate.c diff --git a/src/drivers/intel/fsp1_1/fsp1_1_relocate.c b/src/commonlib/fsp1_1_relocate.c index 994da09409..994da09409 100644 --- a/src/drivers/intel/fsp1_1/fsp1_1_relocate.c +++ b/src/commonlib/fsp1_1_relocate.c diff --git a/src/commonlib/include/commonlib/fsp1_1.h b/src/commonlib/include/commonlib/fsp1_1.h new file mode 100644 index 0000000000..8d8dcf03a6 --- /dev/null +++ b/src/commonlib/include/commonlib/fsp1_1.h @@ -0,0 +1,48 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2015 Google Inc. + * + * 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; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc. + */ + +#ifndef _COMMONLIB_FSP1_1_H_ +#define _COMMONLIB_FSP1_1_H_ + +#include <stddef.h> +#include <stdint.h> + +/* + * Intel's code does not have a handle on changing global packing state. + * Therefore, one needs to protect against packing policies that are set + * globally for a compliation unit just by including a header file. + */ +#pragma pack(push) + +/* Default bind FSP 1.1 API to edk2 UEFI 2.4 types. */ +#include <vendorcode/intel/edk2/uefi_2.4/uefi_types.h> + +#include <vendorcode/intel/fsp/fsp1_1/IntelFspPkg/Include/FspApi.h> +#include <vendorcode/intel/fsp/fsp1_1/IntelFspPkg/Include/FspInfoHeader.h> + +/* Restore original packing policy. */ +#pragma pack(pop) + +/* + * Relocate FSP held within buffer defined by size to new_addr. Returns < 0 + * on error, offset to FSP_INFO_HEADER on success. + */ +ssize_t fsp1_1_relocate(uintptr_t new_addr, void *fsp, size_t size); + +#endif diff --git a/src/drivers/intel/fsp1_1/Makefile.inc b/src/drivers/intel/fsp1_1/Makefile.inc index dffb6d2079..bab68e142d 100644 --- a/src/drivers/intel/fsp1_1/Makefile.inc +++ b/src/drivers/intel/fsp1_1/Makefile.inc @@ -23,7 +23,6 @@ romstage-y += hob.c ramstage-$(CONFIG_GOP_SUPPORT) += fsp_gop.c ramstage-y += fsp_relocate.c -ramstage-y += fsp1_1_relocate.c ramstage-y += fsp_util.c ramstage-y += hob.c diff --git a/src/drivers/intel/fsp1_1/fsp_relocate.c b/src/drivers/intel/fsp1_1/fsp_relocate.c index da0b341491..80dc82592b 100644 --- a/src/drivers/intel/fsp1_1/fsp_relocate.c +++ b/src/drivers/intel/fsp1_1/fsp_relocate.c @@ -19,6 +19,7 @@ #include <console/console.h> #include <cbmem.h> +#include <commonlib/fsp1_1.h> #include <fsp/util.h> int fsp_relocate(struct prog *fsp_relocd, const struct region_device *fsp_src) diff --git a/src/drivers/intel/fsp1_1/include/fsp/api.h b/src/drivers/intel/fsp1_1/include/fsp/api.h index 414532c09b..ec227b5e5b 100644 --- a/src/drivers/intel/fsp1_1/include/fsp/api.h +++ b/src/drivers/intel/fsp1_1/include/fsp/api.h @@ -20,8 +20,6 @@ #ifndef _FSP1_1_API_H_ #define _FSP1_1_API_H_ -#define FSP_SIG 0x48505346 /* 'FSPH' */ - /* All the FSP headers need to have UEFI types provided before inclusion. */ #include <fsp/uefi_binding.h> diff --git a/src/drivers/intel/fsp1_1/include/fsp/util.h b/src/drivers/intel/fsp1_1/include/fsp/util.h index 79c348ac53..b3772a2598 100644 --- a/src/drivers/intel/fsp1_1/include/fsp/util.h +++ b/src/drivers/intel/fsp1_1/include/fsp/util.h @@ -53,12 +53,6 @@ void *get_first_resource_hob(const EFI_GUID *guid); */ int fsp_relocate(struct prog *fsp_relocd, const struct region_device *fsp_src); -/* - * Relocate FSP held within buffer defined by size to new_addr. Returns < 0 - * on error, offset to FSP_INFO_HEADER on success. - */ -ssize_t fsp1_1_relocate(uintptr_t new_addr, void *fsp, size_t size); - /* Additional HOB types not included in the FSP: * #define EFI_HOB_TYPE_HANDOFF 0x0001 * #define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002 diff --git a/src/vendorcode/intel/fsp/fsp1_1/IntelFspPkg/Include/FspInfoHeader.h b/src/vendorcode/intel/fsp/fsp1_1/IntelFspPkg/Include/FspInfoHeader.h index 47d463c11e..04d6d64bd4 100644 --- a/src/vendorcode/intel/fsp/fsp1_1/IntelFspPkg/Include/FspInfoHeader.h +++ b/src/vendorcode/intel/fsp/fsp1_1/IntelFspPkg/Include/FspInfoHeader.h @@ -22,6 +22,8 @@ #define FSPE_HEADER_REVISION_1 1 #define FSPP_HEADER_REVISION_1 1 +#define FSP_SIG 0x48505346 /* 'FSPH' */ + /// /// Fixed FSP header offset in the FSP image /// |