summaryrefslogtreecommitdiff
path: root/src/commonlib/include
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-09-30 17:49:04 -0500
committerAaron Durbin <adurbin@chromium.org>2015-10-02 12:15:25 +0000
commit04ebf598de6d8b8152c99ebe181de084e0b5b242 (patch)
treed8a0c3ff9d7988ffb9011d2afb5df137e3712866 /src/commonlib/include
parent923b4d5c581e7f4499e957fc1f042ee776c365a1 (diff)
downloadcoreboot-04ebf598de6d8b8152c99ebe181de084e0b5b242.tar.xz
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>
Diffstat (limited to 'src/commonlib/include')
-rw-r--r--src/commonlib/include/commonlib/fsp1_1.h48
1 files changed, 48 insertions, 0 deletions
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