[U-Boot] [PATCH v2 10/27] x86: Initial import from Intel FSP release for Queensbay platform

Bin Meng bmeng.cn at gmail.com
Tue Dec 9 15:49:56 CET 2014


This is the initial import from Intel FSP release for Queensbay
platform (Tunnel Creek processor and Topcliff Platform Controller
Hub), which can be downloaded from Intel website.

For more details, check http://www.intel.com/fsp.

Note: U-Boot coding convention was applied to these codes, so it
looks completely different from the original Intel release.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>

---

Changes in v2:
- Apply U-Boot coding convention to the FSP support codes

 arch/x86/cpu/queensbay/fsp_configs.c               |  51 +++
 arch/x86/cpu/queensbay/fsp_support.c               | 428 +++++++++++++++++++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h  |  79 ++++
 .../include/asm/arch-queensbay/fsp/fsp_bootmode.h  |  47 +++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_ffs.h  | 189 +++++++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_fv.h   | 213 ++++++++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h  | 341 ++++++++++++++++
 .../asm/arch-queensbay/fsp/fsp_infoheader.h        |  59 +++
 .../include/asm/arch-queensbay/fsp/fsp_platform.h  |  42 ++
 .../include/asm/arch-queensbay/fsp/fsp_support.h   | 219 +++++++++++
 .../x86/include/asm/arch-queensbay/fsp/fsp_types.h | 171 ++++++++
 arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h  |  81 ++++
 12 files changed, 1920 insertions(+)
 create mode 100644 arch/x86/cpu/queensbay/fsp_configs.c
 create mode 100644 arch/x86/cpu/queensbay/fsp_support.c
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_bootmode.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_ffs.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_fv.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_infoheader.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_platform.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_types.h
 create mode 100644 arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h

diff --git a/arch/x86/cpu/queensbay/fsp_configs.c b/arch/x86/cpu/queensbay/fsp_configs.c
new file mode 100644
index 0000000..1d1f43b
--- /dev/null
+++ b/arch/x86/cpu/queensbay/fsp_configs.c
@@ -0,0 +1,51 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include <types.h>
+#include <string.h>
+#include "fsp_support.h"
+
+/**
+ * This function overrides the default configurations in the UPD data region.
+ *
+ * @fsp_upd: A pointer to the UPD_DATA_REGION data strcture
+ *
+ * @return:  None
+ */
+void update_fsp_upd(UPD_DATA_REGION *fsp_upd)
+{
+	/* Override any UPD setting if required */
+
+	/* Uncomment the line below to enable DEBUG message */
+	/* fsp_upd->serial_dbgport_type = 1; */
+
+	/* Examples on how to initialize the pointers in UPD region */
+	/* fsp_upd->pcd_example = (EXAMPLE_DATA *)&example; */
+}
diff --git a/arch/x86/cpu/queensbay/fsp_support.c b/arch/x86/cpu/queensbay/fsp_support.c
new file mode 100644
index 0000000..804a63d
--- /dev/null
+++ b/arch/x86/cpu/queensbay/fsp_support.c
@@ -0,0 +1,428 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include <types.h>
+#include <string.h>
+#include "fsp_support.h"
+
+/**
+ * Reads a 64-bit value from memory that may be unaligned.
+ *
+ * This function returns the 64-bit value pointed to by buf. The function
+ * guarantees that the read operation does not produce an alignment fault.
+ *
+ * If the buf is NULL, then ASSERT().
+ *
+ * @buf: Pointer to a 64-bit value that may be unaligned.
+ *
+ * @return: The 64-bit value read from buf.
+ */
+static UINT64 EFIAPI read_unaligned64(const UINT64 *buf)
+{
+	ASSERT(buf != NULL);
+
+	return *buf;
+}
+
+/**
+ * Compares two GUIDs
+ *
+ * If the GUIDs are identical then TRUE is returned.
+ * If there are any bit differences in the two GUIDs, then FALSE is returned.
+ *
+ * If guid1 is NULL, then ASSERT().
+ * If guid2 is NULL, then ASSERT().
+ *
+ * @guid1:        A pointer to a 128 bit GUID.
+ * @guid2:        A pointer to a 128 bit GUID.
+ *
+ * @retval TRUE:  guid1 and guid2 are identical.
+ * @retval FALSE: guid1 and guid2 are not identical.
+ */
+static BOOLEAN EFIAPI compare_guid(const EFI_GUID * guid1,
+				   const EFI_GUID * guid2)
+{
+	UINT64 guid1_low;
+	UINT64 guid2_low;
+	UINT64 guid1_high;
+	UINT64 guid2_high;
+
+	guid1_low  = read_unaligned64((const UINT64 *)guid1);
+	guid2_low  = read_unaligned64((const UINT64 *)guid2);
+	guid1_high = read_unaligned64((const UINT64 *)guid1 + 1);
+	guid2_high = read_unaligned64((const UINT64 *)guid2 + 1);
+
+	return (BOOLEAN)(guid1_low == guid2_low && guid1_high == guid2_high);
+}
+
+UINT32 __attribute__((optimize("O0"))) find_fsp_header(void)
+{
+	volatile register UINT8 * fsp asm("eax");
+
+	/* Initalize the FSP base */
+	fsp = (UINT8 *)CONFIG_FSP_LOCATION;
+
+	/* Check the FV signature, _FVH */
+	if (((EFI_FIRMWARE_VOLUME_HEADER *)fsp)->signature == 0x4856465F) {
+		/* Go to the end of the FV header and align the address */
+		fsp += ((EFI_FIRMWARE_VOLUME_HEADER *)fsp)->ext_hdr_off;
+		fsp += ((EFI_FIRMWARE_VOLUME_EXT_HEADER *)fsp)->ext_hdr_size;
+		fsp  = (UINT8 *)(((UINT32)fsp + 7) & 0xFFFFFFF8);
+	} else {
+		fsp  = 0;
+	}
+
+	/* Check the FFS GUID */
+	if (fsp &&
+	    (((UINT32 *)&(((EFI_FFS_FILE_HEADER *)fsp)->name))[0] == 0x912740BE) &&
+	    (((UINT32 *)&(((EFI_FFS_FILE_HEADER *)fsp)->name))[1] == 0x47342284) &&
+	    (((UINT32 *)&(((EFI_FFS_FILE_HEADER *)fsp)->name))[2] == 0xB08471B9) &&
+	    (((UINT32 *)&(((EFI_FFS_FILE_HEADER *)fsp)->name))[3] == 0x0C3F3527)) {
+		/* Add the FFS header size to find the raw section header */
+		fsp += sizeof(EFI_FFS_FILE_HEADER);
+	} else {
+		fsp = 0;
+	}
+
+	if (fsp &&
+	    ((EFI_RAW_SECTION *)fsp)->type == EFI_SECTION_RAW) {
+		/* Add the raw section header size to find the FSP header */
+		fsp += sizeof(EFI_RAW_SECTION);
+	} else {
+		fsp = 0;
+	}
+
+	return (UINT32)fsp;
+}
+
+#ifdef __PRE_RAM__
+void fsp_continue(SHARED_DATA *shared_data, EFI_STATUS status, void *hob_list)
+{
+	UINT32 stack_len;
+	UINT32 stack_base;
+	UINT32 stack_top;
+
+	ASSERT(status == 0);
+
+	/* Get the migrated stack in normal memory */
+	stack_base = (UINT32)get_bootloader_tmp_mem(hob_list, &stack_len);
+	ASSERT(stack_base != 0);
+	stack_top  = stack_base + stack_len - sizeof(UINT32);
+
+	/*
+	 * Old stack base is stored at the very end of the stack top,
+	 * use it to calculate the migrated shared data base
+	 */
+	shared_data = (SHARED_DATA *)(stack_base +
+			((UINT32)shared_data - *(UINT32 *)stack_top));
+
+	/* The boot loader main function entry */
+	bl_main_continue(hob_list, shared_data);
+}
+
+void fsp_init(UINT32 stack_top, UINT32 boot_mode, void *nvs_buf)
+{
+	SHARED_DATA shared_data;
+	FSP_INIT fsp_init;
+	FSP_INIT_PARAMS params;
+	FSP_INIT_RT_BUFFER rt_buf;
+	VPD_DATA_REGION *fsp_vpd;
+	FSP_HEADER *fsp_hdr;
+	FSP_INIT_PARAMS *params_ptr;
+	UPD_DATA_REGION *fsp_upd;
+
+	fsp_hdr = (FSP_HEADER *)find_fsp_header();
+	if (fsp_hdr == NULL) {
+		/* No valid FSP info header was found */
+		ASSERT(FALSE);
+	}
+
+	fsp_upd = (UPD_DATA_REGION *)&shared_data.fsp_upd;
+	memset((void *)&rt_buf, 0, sizeof(FSP_INIT_RT_BUFFER));
+
+	/* Reserve a gap in stack top */
+	rt_buf.common.stack_top = (UINT32 *)stack_top - 32;
+	rt_buf.common.boot_mode = boot_mode;
+	rt_buf.common.upd_data = (UPD_DATA_REGION *)fsp_upd;
+
+	/* Get VPD region start */
+	fsp_vpd = (VPD_DATA_REGION *)(fsp_hdr->img_base +
+			fsp_hdr->cfg_region_off);
+
+	/* Verifify the VPD data region is valid */
+	ASSERT((fsp_vpd->img_rev == VPD_IMAGE_REV) &&
+	       (fsp_vpd->vpd_sign == VPD_IMAGE_ID));
+
+	/* Copy default data from Flash */
+	memcpy(fsp_upd, (void *)(fsp_hdr->img_base + fsp_vpd->upd_offset),
+	       sizeof(UPD_DATA_REGION));
+
+	/* Verifify the UPD data region is valid */
+	ASSERT(fsp_upd->terminator == 0x55AA);
+
+	/* Override any UPD setting if required */
+	update_fsp_upd(fsp_upd);
+
+	memset((void *)&params, 0, sizeof(FSP_INIT_PARAMS));
+	params.nvs_buf = nvs_buf;
+	params.rt_buf = (FSP_INIT_RT_BUFFER *)&rt_buf;
+	params.continuation = (CONTINUE_PROC)asm_continuation;
+
+	fsp_init = (FSP_INIT)(fsp_hdr->img_base + fsp_hdr->fsp_init);
+	params_ptr  = ¶ms;
+
+	shared_data.fsp_hdr = fsp_hdr;
+	shared_data.stack_top = (UINT32 *)stack_top;
+
+	/*
+	 * Use ASM code to ensure the register value in EAX & ECX
+	 * will be passed into BlContinuationFunc
+	 */
+	asm volatile (
+		"pushl	%0;"
+		"call	*%%eax;"
+		".global asm_continuation;"
+		"asm_continuation:;"
+		"popl	%%eax;"	/* pop out return address */
+		"pushl	%%ecx;"	/* push shared_data pointer */
+		"pushl	%%eax;"	/* push back return address */
+		"jmp	fsp_continue;"
+		: : "m"(params_ptr), "a"(fsp_init), "c"(&shared_data)
+	);
+
+	/*
+	 * Should never get here.
+	 * Control will continue from romstage_main_continue_asm.
+	 * This line below is to prevent the compiler from optimizing
+	 * structure intialization.
+	 */
+	fsp_init(&params);
+
+	/*
+	 * Should never return.
+	 * Control will continue from ContinuationFunc
+	 */
+	ASSERT(FALSE);
+}
+
+#else
+
+EFI_STATUS fsp_notify(FSP_HEADER *fsp_hdr, UINT32 phase)
+{
+	FSP_NOTFY notify;
+	FSP_NOTIFY_PARAMS params;
+	EFI_STATUS status;
+
+	if (!fsp_hdr)
+		fsp_hdr = (FSP_HEADER *)find_fsp_header();
+
+	if (fsp_hdr == NULL) {
+		/* No valid FSP info header */
+		ASSERT(FALSE);
+	}
+
+	notify = (FSP_NOTFY)(fsp_hdr->img_base + fsp_hdr->fsp_notify);
+	params.phase = phase;
+	status = notify(&params);
+
+	return status;
+}
+
+#endif  /* __PRE_RAM__ */
+
+UINT32 get_usable_lowmem_top(const void *hob_list)
+{
+	EFI_PEI_HOB_POINTERS hob;
+	EFI_PHY_ADDR phys_start;
+	UINT32 top;
+
+	/* Get the HOB list for processing */
+	hob.raw = (void *)hob_list;
+
+	/* * Collect memory ranges */
+	top = 0x100000;
+	while (!END_OF_HOB(hob)) {
+		if (hob.hdr->type == HOB_TYPE_RES_DESC) {
+			if (hob.res_desc->type == RES_SYS_MEM) {
+				phys_start = hob.res_desc->phys_start;
+				/* Need memory above 1MB to be collected here */
+				if (phys_start >= 0x100000 &&
+				    phys_start < (EFI_PHY_ADDR)0x100000000)
+					top += (UINT32)(hob.res_desc->len);
+			}
+		}
+		hob.raw = GET_NEXT_HOB(hob);
+	}
+
+	return top;
+}
+
+UINT64 get_usable_highmem_top(const void *hob_list)
+{
+	EFI_PEI_HOB_POINTERS hob;
+	EFI_PHY_ADDR phys_start;
+	UINT64 top;
+
+	/* Get the HOB list for processing */
+	hob.raw = (void *)hob_list;
+
+	/* Collect memory ranges */
+	top = 0x100000000;
+	while (!END_OF_HOB(hob)) {
+		if (hob.hdr->type == HOB_TYPE_RES_DESC) {
+			if (hob.res_desc->type == RES_SYS_MEM) {
+				phys_start = hob.res_desc->phys_start;
+				/* Need memory above 1MB to be collected here */
+				if (phys_start >= (EFI_PHY_ADDR)0x100000000)
+					top += (UINT32)(hob.res_desc->len);
+			}
+		}
+		hob.raw = GET_NEXT_HOB(hob);
+	}
+
+	return top;
+}
+
+UINT64 get_fsp_reserved_mem_from_guid(const void *hob_list, UINT64 *len,
+				      EFI_GUID * guid)
+{
+	EFI_PEI_HOB_POINTERS hob;
+
+	/* Get the HOB list for processing */
+	hob.raw = (void *)hob_list;
+
+	/* Collect memory ranges */
+	while (!END_OF_HOB(hob)) {
+		if (hob.hdr->type == HOB_TYPE_RES_DESC) {
+			if (hob.res_desc->type == RES_MEM_RESERVED) {
+				if (compare_guid(&hob.res_desc->owner, guid)) {
+					if (len)
+						*len = (UINT32)(hob.res_desc->len);
+
+					return (UINT64)(hob.res_desc->phys_start);
+				}
+			}
+		}
+		hob.raw = GET_NEXT_HOB(hob);
+	}
+
+	return 0;
+}
+
+UINT32 get_fsp_reserved_mem(const void *hob_list, UINT32 *len)
+{
+	const EFI_GUID guid = FSP_HOB_RESOURCE_OWNER_FSP_GUID;
+	UINT64 length;
+	UINT32 base;
+
+	base = (UINT32)get_fsp_reserved_mem_from_guid(hob_list,
+			&length, (EFI_GUID *)&guid);
+	if ((len != 0) && (base != 0))
+		*len = (UINT32)length;
+
+	return base;
+}
+
+UINT32 get_tseg_reserved_mem(const void *hob_list, UINT32 *len)
+{
+	const EFI_GUID guid = FSP_HOB_RESOURCE_OWNER_TSEG_GUID;
+	UINT64 length;
+	UINT32 base;
+
+	base = (UINT32)get_fsp_reserved_mem_from_guid(hob_list,
+			&length, (EFI_GUID *)&guid);
+	if ((len != 0) && (base != 0))
+		*len = (UINT32)length;
+
+	return base;
+}
+
+void * EFIAPI get_next_hob(UINT16 type, const void *hob_list)
+{
+	EFI_PEI_HOB_POINTERS hob;
+
+	ASSERT(hob_list != NULL);
+
+	hob.raw = (UINT8 *)hob_list;
+
+	/* Parse the HOB list until end of list or matching type is found */
+	while (!END_OF_HOB(hob)) {
+		if (hob.hdr->type == type)
+			return hob.raw;
+
+		hob.raw = GET_NEXT_HOB(hob);
+	}
+
+	return NULL;
+}
+
+void * EFIAPI get_next_guid_hob(const EFI_GUID *guid, const void *hob_list)
+{
+	EFI_PEI_HOB_POINTERS hob;
+
+	hob.raw = (UINT8 *)hob_list;
+	while ((hob.raw = get_next_hob(HOB_TYPE_GUID_EXT,
+			hob.raw)) != NULL) {
+		if (compare_guid(guid, &hob.guid->name))
+			break;
+		hob.raw = GET_NEXT_HOB(hob);
+	}
+
+	return hob.raw;
+}
+
+void *get_guid_hob_data(const void *hob_list, UINT32 *len, EFI_GUID *guid)
+{
+	UINT8 *guid_hob;
+
+	guid_hob = get_next_guid_hob(guid, hob_list);
+	if (guid_hob == NULL) {
+		return NULL;
+	} else {
+		if (len)
+			*len = GET_GUID_HOB_DATA_SIZE(guid_hob);
+
+		return GET_GUID_HOB_DATA(guid_hob);
+	}
+}
+
+void *get_fsp_nvs_data(const void *hob_list, UINT32 *len)
+{
+	const EFI_GUID guid = FSP_NON_VOLATILE_STORAGE_HOB_GUID;
+
+	return get_guid_hob_data(hob_list, len, (EFI_GUID *)&guid);
+}
+
+void *get_bootloader_tmp_mem(const void *hob_list, UINT32 *len)
+{
+	const EFI_GUID guid = FSP_BOOTLOADER_TEMP_MEM_HOB_GUID;
+
+	return get_guid_hob_data(hob_list, len, (EFI_GUID *)&guid);
+}
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h
new file mode 100644
index 0000000..d2fade0
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h
@@ -0,0 +1,79 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __FSP_API_H__
+#define __FSP_API_H__
+
+/*
+ * FspInit continuation function prototype.
+ * Control will be returned to this callback function after FspInit API call.
+ */
+typedef void (FSPAPI * CONTINUE_PROC)(EFI_STATUS status, void *hob_list);
+
+#pragma pack(1)
+
+typedef struct {
+	void	*nvs_buf;	/* Non-volatile storage buffer pointer */
+	void	*rt_buf;	/* Runtime buffer pointer */
+	CONTINUE_PROC	continuation;	/* Continuation function address */
+} FSP_INIT_PARAMS;
+
+typedef struct {
+	/*
+	 * Stack top pointer used by the bootloader. The new stack frame will be
+	 * set up at this location after FspInit API call.
+	 */
+	UINT32	*stack_top;
+	UINT32	boot_mode;	/* Current system boot mode */
+	void	*upd_data;	/* User platform configuraiton data region */
+	UINT32	reserved[7];	/* Reserved */
+} COMMON_BUF;
+
+typedef enum {
+	/* Notification code for post PCI enuermation */
+	INIT_PHASE_PCI	= 0x20,
+	/* Notification code before transfering control to the payload */
+	INIT_PHASE_BOOT	= 0x40
+} FSP_INIT_PHASE;
+
+typedef struct {
+	/* Notification phase used for NotifyPhase API */
+	FSP_INIT_PHASE		phase;
+} FSP_NOTIFY_PARAMS;
+
+#pragma pack()
+
+/* FspInit API function prototype */
+typedef FSP_STATUS (FSPAPI * FSP_INIT)(FSP_INIT_PARAMS *param);
+
+/* FspNotify API function prototype */
+typedef FSP_STATUS (FSPAPI * FSP_NOTFY)(FSP_NOTIFY_PARAMS *param);
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_bootmode.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_bootmode.h
new file mode 100644
index 0000000..10a0352
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_bootmode.h
@@ -0,0 +1,47 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __FSP_BOOT_MODE_H__
+#define __FSP_BOOT_MODE_H__
+
+/* 0x21 - 0xf..f are reserved */
+#define BOOT_FULL_CONFIG		0x00
+#define BOOT_MINIMAL_CONFIG		0x01
+#define BOOT_NO_CONFIG_CHANGES		0x02
+#define BOOT_FULL_CONFIG_PLUS_DIAG	0x03
+#define BOOT_DEFAULT_SETTINGS		0x04
+#define BOOT_ON_S4_RESUME		0x05
+#define BOOT_ON_S5_RESUME		0x06
+#define BOOT_ON_S2_RESUME		0x10
+#define BOOT_ON_S3_RESUME		0x11
+#define BOOT_ON_FLASH_UPDATE		0x12
+#define BOOT_IN_RECOVERY_MODE		0x20
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_ffs.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_ffs.h
new file mode 100644
index 0000000..e1ee297
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_ffs.h
@@ -0,0 +1,189 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __FSP_FFS_H__
+#define __FSP_FFS_H__
+
+#pragma pack(1)
+
+/* Used to verify the integrity of the file */
+typedef union {
+	struct {
+		/*
+		 * The IntegrityCheck.checksum.header field is an 8-bit
+		 * checksum of the file header. The State and
+		 * IntegrityCheck.checksum.file fields are assumed to be zero
+		 * and the checksum is calculated such that the entire header
+		 * sums to zero.
+		 */
+		UINT8	header;
+		/*
+		 * If the FFS_ATTRIB_CHECKSUM (see definition below) bit of
+		 * the Attributes field is set to one, the
+		 * IntegrityCheck.checksum.file field is an 8-bit checksum of
+		 * the file data. If the FFS_ATTRIB_CHECKSUM bit of the
+		 * Attributes field is cleared to zero, the
+		 * IntegrityCheck.checksum.file field must be initialized with
+		 * a value of 0xAA. The IntegrityCheck.checksum.file field is
+		 * valid any time the EFI_FILE_DATA_VALID bit is set in the
+		 * State field.
+		 */
+		UINT8	file;
+	} checksum;
+
+	/* This is the full 16 bits of the IntegrityCheck field */
+	UINT16	checksum16;
+} EFI_FFS_INTEGRITY;
+
+typedef UINT8	EFI_FV_FILE_TYPE;
+typedef UINT8	EFI_FFS_FILE_ATTR;
+typedef UINT8	EFI_FFS_FILE_STATE;
+
+/*
+ * Each file begins with the header that describe the
+ * contents and state of the files.
+ */
+typedef struct {
+	/*
+	 * This GUID is the file name.
+	 * It is used to uniquely identify the file.
+	 */
+	EFI_GUID		name;
+	/* Used to verify the integrity of the file */
+	EFI_FFS_INTEGRITY	integrity;
+	/* Identifies the type of file */
+	EFI_FV_FILE_TYPE	type;
+	/* Declares various file attribute bits */
+	EFI_FFS_FILE_ATTR	attr;
+	/* The length of the file in bytes, including the FFS header */
+	UINT8			size[3];
+	/*
+	 * Used to track the state of the file throughout the life of
+	 * the file from creation to deletion.
+	 */
+	EFI_FFS_FILE_STATE	state;
+} EFI_FFS_FILE_HEADER;
+
+typedef struct {
+	/*
+	 * This GUID is the file name. It is used to uniquely identify the file.
+	 * There may be only one instance of a file with the file name GUID of
+	 * Name in any given firmware volume, except if the file type is
+	 * EFI_FV_FILE_TYPE_FFS_PAD.
+	 */
+	EFI_GUID		name;
+	/* Used to verify the integrity of the file */
+	EFI_FFS_INTEGRITY	integrity;
+	/* Identifies the type of file */
+	EFI_FV_FILE_TYPE	type;
+	/* Declares various file attribute bits */
+	EFI_FFS_FILE_ATTR	attr;
+	/*
+	 * The length of the file in bytes, including the FFS header.
+	 * The length of the file data is either
+	 * (size - sizeof(EFI_FFS_FILE_HEADER)). This calculation means a
+	 * zero-length file has a size of 24 bytes, which is
+	 * sizeof(EFI_FFS_FILE_HEADER). Size is not required to be a multiple
+	 * of 8 bytes. Given a file F, the next file header is located at the
+	 * next 8-byte aligned firmware volume offset following the last byte
+	 * of the file F.
+	 */
+	UINT8			size[3];
+	/*
+	 * Used to track the state of the file throughout the life of
+	 * the file from creation to deletion.
+	 */
+	EFI_FFS_FILE_STATE	state;
+	/*
+	 * If FFS_ATTRIB_LARGE_FILE is set in attr, then ext_size exists
+	 * and size must be set to zero.
+	 * If FFS_ATTRIB_LARGE_FILE is not set then EFI_FFS_FILE_HEADER is used.
+	 */
+	UINT32			ext_size;
+} EFI_FFS_FILE_HEADER2;
+
+typedef UINT8	EFI_SECTION_TYPE;
+
+/*
+ * Pseudo type. It is used as a wild card when retrieving sections.
+ * The section type EFI_SECTION_ALL matches all section types.
+ */
+#define EFI_SECTION_ALL				0x00
+
+/* Encapsulation section Type values */
+#define EFI_SECTION_COMPRESSION			0x01
+#define EFI_SECTION_GUID_DEFINED		0x02
+#define EFI_SECTION_DISPOSABLE			0x03
+
+/* Leaf section Type values */
+#define EFI_SECTION_PE32			0x10
+#define EFI_SECTION_PIC				0x11
+#define EFI_SECTION_TE				0x12
+#define EFI_SECTION_DXE_DEPEX			0x13
+#define EFI_SECTION_VERSION			0x14
+#define EFI_SECTION_USER_INTERFACE		0x15
+#define EFI_SECTION_COMPATIBILITY16		0x16
+#define EFI_SECTION_FIRMWARE_VOLUME_IMAGE	0x17
+#define EFI_SECTION_FREEFORM_SUBTYPE_GUID	0x18
+#define EFI_SECTION_RAW				0x19
+#define EFI_SECTION_PEI_DEPEX			0x1B
+#define EFI_SECTION_SMM_DEPEX			0x1C
+
+/* Common section header */
+typedef struct {
+	/*
+	 * A 24-bit unsigned integer that contains the total size of
+	 * the section in bytes, including the EFI_COMMON_SECTION_HEADER.
+	 */
+	UINT8			size[3];
+	EFI_SECTION_TYPE	type;
+} EFI_COMMON_SECTION_HEADER;
+
+typedef struct {
+	/*
+	 * A 24-bit unsigned integer that contains the total size of
+	 * the section in bytes, including the EFI_COMMON_SECTION_HEADER.
+	 */
+	UINT8			size[3];
+	EFI_SECTION_TYPE	type;
+	/*
+	 * If size is 0xFFFFFF, then ext_size contains the size of
+	 * the section. If size is not equal to 0xFFFFFF, then this
+	 * field does not exist.
+	 */
+	UINT32			ext_size;
+} EFI_COMMON_SECTION_HEADER2;
+
+typedef EFI_COMMON_SECTION_HEADER	EFI_RAW_SECTION;
+typedef EFI_COMMON_SECTION_HEADER2	EFI_RAW_SECTION2;
+
+#pragma pack()
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_fv.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_fv.h
new file mode 100644
index 0000000..e133083
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_fv.h
@@ -0,0 +1,213 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __FSP_FV___
+#define __FSP_FV___
+
+/* EFI_FV_FILE_ATTRIBUTES */
+typedef UINT32	EFI_FV_FILE_ATTRIBUTES;
+
+/* Value of EFI_FV_FILE_ATTRIBUTES */
+#define EFI_FV_FILE_ATTR_ALIGNMENT	0x0000001F
+#define EFI_FV_FILE_ATTR_FIXED		0x00000100
+#define EFI_FV_FILE_ATTR_MEMORY_MAPPED	0x00000200
+
+/* type of EFI FVB attribute */
+typedef UINT32	EFI_FVB_ATTRIBUTES_2;
+
+/* Attributes bit definitions */
+#define EFI_FVB2_READ_DISABLED_CAP	0x00000001
+#define EFI_FVB2_READ_ENABLED_CAP	0x00000002
+#define EFI_FVB2_READ_STATUS		0x00000004
+#define EFI_FVB2_WRITE_DISABLED_CAP	0x00000008
+#define EFI_FVB2_WRITE_ENABLED_CAP	0x00000010
+#define EFI_FVB2_WRITE_STATUS		0x00000020
+#define EFI_FVB2_LOCK_CAP		0x00000040
+#define EFI_FVB2_LOCK_STATUS		0x00000080
+#define EFI_FVB2_STICKY_WRITE		0x00000200
+#define EFI_FVB2_MEMORY_MAPPED		0x00000400
+#define EFI_FVB2_ERASE_POLARITY		0x00000800
+#define EFI_FVB2_READ_LOCK_CAP		0x00001000
+#define EFI_FVB2_READ_LOCK_STATUS	0x00002000
+#define EFI_FVB2_WRITE_LOCK_CAP		0x00004000
+#define EFI_FVB2_WRITE_LOCK_STATUS	0x00008000
+#define EFI_FVB2_ALIGNMENT		0x001F0000
+#define EFI_FVB2_ALIGNMENT_1		0x00000000
+#define EFI_FVB2_ALIGNMENT_2		0x00010000
+#define EFI_FVB2_ALIGNMENT_4		0x00020000
+#define EFI_FVB2_ALIGNMENT_8		0x00030000
+#define EFI_FVB2_ALIGNMENT_16		0x00040000
+#define EFI_FVB2_ALIGNMENT_32		0x00050000
+#define EFI_FVB2_ALIGNMENT_64		0x00060000
+#define EFI_FVB2_ALIGNMENT_128		0x00070000
+#define EFI_FVB2_ALIGNMENT_256		0x00080000
+#define EFI_FVB2_ALIGNMENT_512		0x00090000
+#define EFI_FVB2_ALIGNMENT_1K		0x000A0000
+#define EFI_FVB2_ALIGNMENT_2K		0x000B0000
+#define EFI_FVB2_ALIGNMENT_4K		0x000C0000
+#define EFI_FVB2_ALIGNMENT_8K		0x000D0000
+#define EFI_FVB2_ALIGNMENT_16K		0x000E0000
+#define EFI_FVB2_ALIGNMENT_32K		0x000F0000
+#define EFI_FVB2_ALIGNMENT_64K		0x00100000
+#define EFI_FVB2_ALIGNMENT_128K		0x00110000
+#define EFI_FVB2_ALIGNMENT_256K		0x00120000
+#define EFI_FVB2_ALIGNMENT_512K		0x00130000
+#define EFI_FVB2_ALIGNMENT_1M		0x00140000
+#define EFI_FVB2_ALIGNMENT_2M		0x00150000
+#define EFI_FVB2_ALIGNMENT_4M		0x00160000
+#define EFI_FVB2_ALIGNMENT_8M		0x00170000
+#define EFI_FVB2_ALIGNMENT_16M		0x00180000
+#define EFI_FVB2_ALIGNMENT_32M		0x00190000
+#define EFI_FVB2_ALIGNMENT_64M		0x001A0000
+#define EFI_FVB2_ALIGNMENT_128M		0x001B0000
+#define EFI_FVB2_ALIGNMENT_256M		0x001C0000
+#define EFI_FVB2_ALIGNMENT_512M		0x001D0000
+#define EFI_FVB2_ALIGNMENT_1G		0x001E0000
+#define EFI_FVB2_ALIGNMENT_2G		0x001F0000
+
+typedef struct {
+	/* The number of sequential blocks which are of the same size */
+	UINT32	num_blocks;
+	/* The size of the blocks */
+	UINT32	length;
+} EFI_FV_BLOCK_MAP_ENTRY;
+
+/* Describes the features and layout of the firmware volume */
+typedef struct {
+	/*
+	 * The first 16 bytes are reserved to allow for the reset vector of
+	 * processors whose reset vector is at address 0.
+	 */
+	UINT8			zero_vec[16];
+	/*
+	 * Declares the file system with which the firmware volume
+	 * is formatted.
+	 */
+	EFI_GUID		fs_guid;
+	/*
+	 * Length in bytes of the complete firmware volume, including
+	 * the header.
+	 */
+	UINT64			fv_len;
+	/* Set to EFI_FVH_SIGNATURE */
+	UINT32			signature;
+	/*
+	 * Declares capabilities and power-on defaults for the firmware
+	 * volume.
+	 */
+	EFI_FVB_ATTRIBUTES_2	attr;
+	/* Length in bytes of the complete firmware volume header */
+	UINT16			hdr_len;
+	/*
+	 * A 16-bit checksum of the firmware volume header.
+	 * A valid header sums to zero.
+	 */
+	UINT16			checksum;
+	/*
+	 * Offset, relative to the start of the header, of the extended
+	 * header (EFI_FIRMWARE_VOLUME_EXT_HEADER) or zero if there is
+	 * no extended header.
+	 */
+	UINT16			ext_hdr_off;
+	/* This field must always be set to zero */
+	UINT8			reserved[1];
+	/*
+	 * Set to 2. Future versions of this specification may define new
+	 * header fields and will increment the Revision field accordingly.
+	 */
+	UINT8			rev;
+	/*
+	 * An array of run-length encoded FvBlockMapEntry structures.
+	 * The array is terminated with an entry of {0,0}.
+	 */
+	EFI_FV_BLOCK_MAP_ENTRY	block_map[1];
+} EFI_FIRMWARE_VOLUME_HEADER;
+
+#define EFI_FVH_SIGNATURE SIGNATURE_32('_', 'F', 'V', 'H')
+
+/* Firmware Volume Header Revision definition */
+#define EFI_FVH_REVISION	0x02
+
+/* Extension header pointed by ExtHeaderOffset of volume header */
+typedef struct {
+	/* firmware volume name */
+	EFI_GUID	fv_name;
+	/* Size of the rest of the extension header including this structure */
+	UINT32		ext_hdr_size;
+} EFI_FIRMWARE_VOLUME_EXT_HEADER;
+
+/* Entry struture for describing FV extension header */
+typedef struct {
+	UINT16	ext_entry_size;	/* Size of this header extension */
+	UINT16	ext_entry_type;	/* Type of the header */
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY;
+
+#define EFI_FV_EXT_TYPE_OEM_TYPE	0x01
+
+/*
+ * This extension header provides a mapping between a GUID and
+ * an OEM file type
+ */
+typedef struct {
+	/* Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE */
+	EFI_FIRMWARE_VOLUME_EXT_ENTRY	hdr;
+	/*
+	 * A bit mask, one bit for each file type between 0xC0 (bit 0) and
+	 * 0xDF (bit 31). If a bit is '1', then the GUID entry exists in Types.
+	 * If a bit is '0' then no GUID entry exists in Types.
+	 */
+	UINT32				type_mask;
+	/*
+	 * An array of GUIDs, each GUID representing an OEM file type.
+	 *
+	 * EFI_GUID			types[1];
+	 */
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY_OEM_TYPE;
+
+#define EFI_FV_EXT_TYPE_GUID_TYPE	0x02
+
+/*
+ * This extension header EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE provides
+ * a vendor specific GUID FormatType type which includes a length and
+ * a successive series of data bytes.
+ */
+typedef struct {
+	/* Standard extension entry, with the type EFI_FV_EXT_TYPE_OEM_TYPE */
+	EFI_FIRMWARE_VOLUME_EXT_ENTRY	hdr;
+	/* Vendor-specific GUID */
+	EFI_GUID			format_type;
+	/*
+	 * An arry of bytes of length Length.
+	 *
+	 * UINT8			data[1];
+	 */
+} EFI_FIRMWARE_VOLUME_EXT_ENTRY_GUID_TYPE;
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h
new file mode 100644
index 0000000..098fc73
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h
@@ -0,0 +1,341 @@
+/**
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __FSP_HOB_H__
+#define __FSP_HOB_H__
+
+/* Type of HOB_GEN_HEADER */
+#define HOB_TYPE_MEM_ALLOC	0x0002
+#define HOB_TYPE_RES_DESC	0x0003
+#define HOB_TYPE_GUID_EXT	0x0004
+#define HOB_TYPE_UNUSED		0xFFFE
+#define HOB_TYPE_EOH		0xFFFF
+
+/*
+ * Describes the format and size of the data inside the HOB.
+ * All HOBs must contain this generic HOB header.
+ */
+typedef struct {
+	UINT16	type;		/* HOB type */
+	UINT16	len;		/* HOB length */
+	UINT32	reserved;	/* always zero */
+} HOB_GEN_HEADER;
+
+/* Enumeration of memory types introduced in UEFI */
+typedef enum {
+	EFI_RESERVED_MEMORY_TYPE,
+	/*
+	 * The code portions of a loaded application.
+	 * (Note that UEFI OS loaders are UEFI applications.)
+	 */
+	EFI_LOADER_CODE,
+	/*
+	 * The data portions of a loaded application and
+	 * the default data allocation type used by an application
+	 * to allocate pool memory.
+	 */
+	EFI_LOADER_DATA,
+	/* The code portions of a loaded Boot Services Driver */
+	EFI_BOOT_SERVICES_CODE,
+	/*
+	 * The data portions of a loaded Boot Serves Driver and
+	 * the default data allocation type used by a Boot Services
+	 * Driver to allocate pool memory.
+	 */
+	EFI_BOOT_SERVICES_DATA,
+	/* The code portions of a loaded Runtime Services Driver */
+	EFI_RUNTIME_SERVICES_CODE,
+	/*
+	 * The data portions of a loaded Runtime Services Driver and
+	 * the default data allocation type used by a Runtime Services
+	 * Driver to allocate pool memory.
+	 */
+	EFI_RUNTIME_SERVICES_DATA,
+	/* Free (unallocated) memory */
+	EFI_CONVENTIONAL_MEMORY,
+	/* Memory in which errors have been detected */
+	EFI_UNUSABLE_MEMORY,
+	/* Memory that holds the ACPI tables */
+	EFI_ACPI_RECLAIM_MEMORY,
+	/* Address space reserved for use by the firmware */
+	EFI_ACPI_MEMORY_NVS,
+	/*
+	 * Used by system firmware to request that a memory-mapped IO region
+	 * be mapped by the OS to a virtual address so it can be accessed by
+	 * EFI runtime services.
+	 */
+	EFI_MMAP_IO,
+	/*
+	 * System memory-mapped IO region that is used to translate
+	 * memory cycles to IO cycles by the processor.
+	 */
+	EFI_MMAP_IO_PORT,
+	/*
+	 * Address space reserved by the firmware for code that is
+	 * part of the processor.
+	 */
+	EFI_PAL_CODE,
+	EFI_MAX_MEMORY_TYPE
+} EFI_MEMORY_TYPE;
+
+/*
+ * Describes all memory ranges used during the HOB producer phase that
+ * exist outside the HOB list. This HOB type describes how memory is used,
+ * not the physical attributes of memory.
+ */
+typedef struct {
+	HOB_GEN_HEADER	hdr;
+	/*
+	 * A GUID that defines the memory allocation region's type and purpose,
+	 * as well as other fields within the memory allocation HOB. This GUID
+	 * is used to define the additional data within the HOB that may be
+	 * present for the memory allocation HOB. Type EFI_GUID is defined in
+	 * InstallProtocolInterface() in the UEFI 2.0 specification.
+	 */
+	EFI_GUID	name;
+	/*
+	 * The base address of memory allocated by this HOB.
+	 * Type EFI_PHY_ADDR is defined in AllocatePages() in the UEFI 2.0
+	 * specification.
+	 */
+	EFI_PHY_ADDR	mem_base;
+	/* The length in bytes of memory allocated by this HOB */
+	UINT64		mem_len;
+	/*
+	 * Defines the type of memory allocated by this HOB.
+	 * The memory type definition follows the EFI_MEMORY_TYPE definition.
+	 * Type EFI_MEMORY_TYPE is defined in AllocatePages() in the UEFI 2.0
+	 * specification.
+	 */
+	EFI_MEMORY_TYPE	mem_type;
+	/* padding */
+	UINT8		reserved[4];
+} HOB_MEM_ALLOC;
+
+/* The resource type */
+typedef UINT32	EFI_RES_TYPE;
+
+/* Value of ResourceType in HOB_RES_DESC */
+#define RES_SYS_MEM		0x00000000
+#define RES_MMAP_IO		0x00000001
+#define RES_IO			0x00000002
+#define RES_FW_DEVICE		0x00000003
+#define RES_MMAP_IO_PORT	0x00000004
+#define RES_MEM_RESERVED	0x00000005
+#define RES_IO_RESERVED		0x00000006
+#define RES_MAX_MEM_TYPE	0x00000007
+
+/* A type of recount attribute type */
+typedef UINT32	EFI_RES_ATTR_TYPE;
+
+/*
+ * These types can be ORed together as needed.
+ *
+ * The first three enumerations describe settings
+ * The rest of the settings describe capabilities
+ */
+#define RES_ATTR_PRESENT			0x00000001
+#define RES_ATTR_INITIALIZED			0x00000002
+#define RES_ATTR_TESTED				0x00000004
+#define RES_ATTR_SINGLE_BIT_ECC			0x00000008
+#define RES_ATTR_MULTIPLE_BIT_ECC		0x00000010
+#define RES_ATTR_ECC_RESERVED_1			0x00000020
+#define RES_ATTR_ECC_RESERVED_2			0x00000040
+#define RES_ATTR_READ_PROTECTED			0x00000080
+#define RES_ATTR_WRITE_PROTECTED		0x00000100
+#define RES_ATTR_EXECUTION_PROTECTED		0x00000200
+#define RES_ATTR_UNCACHEABLE			0x00000400
+#define RES_ATTR_WRITE_COMBINEABLE		0x00000800
+#define RES_ATTR_WRITE_THROUGH_CACHEABLE	0x00001000
+#define RES_ATTR_WRITE_BACK_CACHEABLE		0x00002000
+#define RES_ATTR_16_BIT_IO			0x00004000
+#define RES_ATTR_32_BIT_IO			0x00008000
+#define RES_ATTR_64_BIT_IO			0x00010000
+#define RES_ATTR_UNCACHED_EXPORTED		0x00020000
+
+/*
+ * Describes the resource properties of all fixed, nonrelocatable resource
+ * ranges found on the processor host bus during the HOB producer phase.
+ */
+typedef struct {
+	HOB_GEN_HEADER		hdr;
+	/*
+	 * A GUID representing the owner of the resource. This GUID is
+	 * used by HOB consumer phase components to correlate device
+	 * ownership of a resource.
+	 */
+	EFI_GUID		owner;
+	/* The resource type enumeration as defined by EFI_RES_TYPE */
+	EFI_RES_TYPE		type;
+	/* Resource attributes as defined by EFI_RES_ATTR_TYPE */
+	EFI_RES_ATTR_TYPE	attr;
+	/* The physical start address of the resource region */
+	EFI_PHY_ADDR		phys_start;
+	/* The number of bytes of the resource region */
+	UINT64			len;
+} HOB_RES_DESC;
+
+/*
+ * Allows writers of executable content in the HOB producer phase to
+ * maintain and manage HOBs with specific GUID.
+ */
+typedef struct {
+	HOB_GEN_HEADER	hdr;
+	/* A GUID that defines the contents of this HOB */
+	EFI_GUID	name;
+	/* GUID specific data goes here */
+} HOB_GUID;
+
+/* Union of all the possible HOB Types */
+typedef union {
+	HOB_GEN_HEADER	*hdr;
+	HOB_MEM_ALLOC	*mem_alloc;
+	HOB_RES_DESC	*res_desc;
+	HOB_GUID	*guid;
+	UINT8		*raw;
+} EFI_PEI_HOB_POINTERS;
+
+/**
+ * Returns the type of a HOB.
+ *
+ * This macro returns the type field from the HOB header for the
+ * HOB specified by hob.
+ *
+ * @hob:    A pointer to a HOB.
+ *
+ * @return: HOB type.
+ */
+#define GET_HOB_TYPE(hob) \
+	((*(HOB_GEN_HEADER **)&(hob))->type)
+
+/**
+ * Returns the length, in bytes, of a HOB.
+ *
+ * This macro returns the len field from the HOB header for the
+ * HOB specified by hob.
+ *
+ * @hob:    A pointer to a HOB.
+ *
+ * @return: HOB length.
+ */
+#define GET_HOB_LENGTH(hob) \
+	((*(HOB_GEN_HEADER **)&(hob))->len)
+
+/**
+ * Returns a pointer to the next HOB in the HOB list.
+ *
+ * This macro returns a pointer to HOB that follows the HOB specified by hob
+ * in the HOB List.
+ *
+ * @hob:    A pointer to a HOB.
+ *
+ * @return: A pointer to the next HOB in the HOB list.
+ */
+#define GET_NEXT_HOB(hob)	\
+	(void *)(*(UINT8 **)&(hob) + GET_HOB_LENGTH(hob))
+
+/**
+ * Determines if a HOB is the last HOB in the HOB list.
+ *
+ * This macro determine if the HOB specified by hob is the last HOB in the
+ * HOB list.  If hob is last HOB in the HOB list, then TRUE is returned.
+ * Otherwise, FALSE is returned.
+ *
+ * @hob:          A pointer to a HOB.
+ *
+ * @retval TRUE:  The HOB specified by hob is the last HOB in the HOB list.
+ * @retval FALSE: The HOB specified by hob is not the last HOB in the HOB list.
+ */
+#define END_OF_HOB(hob)	(GET_HOB_TYPE(hob) == (UINT16)HOB_TYPE_EOH)
+
+/**
+ * Returns a pointer to data buffer from a HOB of type HOB_TYPE_GUID_EXT.
+ *
+ * This macro returns a pointer to the data buffer in a HOB specified by hob.
+ * hob is assumed to be a HOB of type HOB_TYPE_GUID_EXT.
+ *
+ * @hob:    A pointer to a HOB.
+ *
+ * @return: A pointer to the data buffer in a HOB.
+ */
+#define GET_GUID_HOB_DATA(hob)	\
+	(void *)(*(UINT8 **)&(hob) + sizeof(HOB_GUID))
+
+/**
+ * Returns the size of the data buffer from a HOB of type HOB_TYPE_GUID_EXT.
+ *
+ * This macro returns the size, in bytes, of the data buffer in a HOB
+ * specified by hob. hob is assumed to be a HOB of type HOB_TYPE_GUID_EXT.
+ *
+ * @hob:    A pointer to a HOB.
+ *
+ * @return: The size of the data buffer.
+ */
+#define GET_GUID_HOB_DATA_SIZE(hob)	\
+	(UINT16)(GET_HOB_LENGTH(hob) - sizeof(HOB_GUID))
+
+/* FSP specific GUID HOB definitions */
+#define FSP_HEADER_GUID \
+	{ \
+	0x912740be, 0x2284, 0x4734, \
+	{0xb9, 0x71, 0x84, 0xb0, 0x27, 0x35, 0x3f, 0x0c} \
+	}
+
+#define FSP_NON_VOLATILE_STORAGE_HOB_GUID \
+	{ \
+	0x721acf02, 0x4d77, 0x4c2a, \
+	{ 0xb3, 0xdc, 0x27, 0xb, 0x7b, 0xa9, 0xe4, 0xb0 } \
+	}
+
+#define FSP_BOOTLOADER_TEMP_MEM_HOB_GUID \
+	{ \
+	0xbbcff46c, 0xc8d3, 0x4113, \
+	{ 0x89, 0x85, 0xb9, 0xd4, 0xf3, 0xb3, 0xf6, 0x4e } \
+	}
+
+#define FSP_HOB_RESOURCE_OWNER_FSP_GUID \
+	{ \
+	0x69a79759, 0x1373, 0x4367, \
+	{ 0xa6, 0xc4, 0xc7, 0xf5, 0x9e, 0xfd, 0x98, 0x6e } \
+	}
+
+#define FSP_HOB_RESOURCE_OWNER_TSEG_GUID \
+	{ \
+	0xd038747c, 0xd00c, 0x4980, \
+	{ 0xb3, 0x19, 0x49, 0x01, 0x99, 0xa4, 0x7d, 0x55 } \
+	}
+
+#define FSP_HOB_RESOURCE_OWNER_GRAPHICS_GUID \
+	{ \
+	0x9c7c3aa7, 0x5332, 0x4917, \
+	{ 0x82, 0xb9, 0x56, 0xa5, 0xf3, 0xe6, 0x2a, 0x07 } \
+	}
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_infoheader.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_infoheader.h
new file mode 100644
index 0000000..81daeeb
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_infoheader.h
@@ -0,0 +1,59 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef _FSP_HEADER_H_
+#define _FSP_HEADER_H_
+
+#define FSP_HEADER_OFF	0x94	/* Fixed FSP header offset in the FSP image */
+
+#pragma pack(1)
+
+typedef struct  {
+	UINT32	signature;		/* 'FSPH' */
+	UINT32	header_len;		/* header length */
+	UINT8	reserved1[3];
+	UINT8	header_rev;		/* header rev */
+	UINT32	img_rev;		/* image rev */
+	CHAR8	img_id[8];		/* signature string */
+	UINT32	img_size;		/* image size */
+	UINT32	img_base;		/* image base */
+	UINT32	img_attr;		/* image attribute */
+	UINT32	cfg_region_off;		/* configuration region offset */
+	UINT32	cfg_region_size;	/* configuration region size */
+	UINT32	api_num;		/* number of API entries */
+	UINT32	fsp_tempram_init;	/* tempram_init offset */
+	UINT32	fsp_init;		/* fsp_init offset */
+	UINT32	fsp_notify;		/* fsp_notify offset */
+	UINT32	reserved2;
+} FSP_HEADER;
+
+#pragma pack()
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_platform.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_platform.h
new file mode 100644
index 0000000..77fe79c
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_platform.h
@@ -0,0 +1,42 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __FSP_PLATFORM_H__
+#define __FSP_PLATFORM_H__
+
+#pragma pack(1)
+
+typedef struct {
+	COMMON_BUF	common;	/* FSP common runtime data structure */
+} FSP_INIT_RT_BUFFER;
+
+#pragma pack()
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h
new file mode 100644
index 0000000..ed9e02f
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h
@@ -0,0 +1,219 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __FSP_SUPPORT_H__
+#define __FSP_SUPPORT_H__
+
+#include "fsp_types.h"
+#include "fsp_fv.h"
+#include "fsp_ffs.h"
+#include "fsp_api.h"
+#include "fsp_hob.h"
+#include "fsp_platform.h"
+#include "fsp_infoheader.h"
+#include "fsp_bootmode.h"
+#include "fsp_vpd.h"
+
+typedef struct {
+	FSP_HEADER	*fsp_hdr;
+	UINT32		*stack_top;
+	UPD_DATA_REGION	fsp_upd;
+} SHARED_DATA;
+
+void asm_continuation(void);
+
+void bl_main_continue(void *hob_list, SHARED_DATA *shared_data);
+
+/**
+ * FSP Continuation function
+ *
+ * @shared_data: Shared data base before stack migration
+ * @status:      Always 0
+ * @hob_list:    HOB list pointer
+ *
+ * @retval:      Never returns
+ */
+void fsp_continue(SHARED_DATA *shared_data, EFI_STATUS status, void *hob_list);
+
+/**
+ * Find FSP header offset in FSP image
+ *
+ * If this function is called before the a stack is established, special care
+ * must be taken. First, it cannot declare any local variable using stack.
+ * Only register variable can be used here. Secondly, some compiler version
+ * will add prolog or epilog code for the C function. If so the function call
+ * may not work before stack is ready. GCC 4.8.1 has been verified to be
+ * working for the following code.
+ *
+ * @retval: the offset of FSP header. If signature is invalid, returns 0.
+ */
+UINT32 find_fsp_header(void);
+
+/**
+ * FSP initialization wrapper function.
+ *
+ * @stack_top: bootloader stack top address
+ * @boot_mode: boot mode defined in fsp_bootmode.h
+ * @nvs_buf:   Non-volatile memory buffer pointer
+ */
+void fsp_init(UINT32 stack_top, UINT32 boot_mode, void *nvs_buf);
+
+/**
+ * FSP notification wrapper function
+ *
+ * @fsp_hdr: Pointer to FSP information header
+ * @phase:   FSP initialization phase defined in enum FSP_INIT_PHASE
+ *
+ * @retval:  compatible status code with EFI_STATUS defined in PI spec
+ */
+EFI_STATUS fsp_notify(FSP_HEADER *fsp_hdr, UINT32 phase);
+
+/**
+ * This function retrieves the top of usable low memory.
+ *
+ * @hob_list: A HOB list pointer.
+ *
+ * @retval:   Usable low memory top.
+ */
+UINT32 get_usable_lowmem_top(const void *hob_list);
+
+/**
+ * This function retrieves the top of usable high memory.
+ *
+ * @hob_list: A HOB list pointer.
+ *
+ * @retval:   Usable high memory top.
+ */
+UINT64 get_usable_highmem_top(const void *hob_list);
+
+/**
+ * This function retrieves a special reserved memory region.
+ *
+ * @hob_list: A HOB list pointer.
+ * @len:      A pointer to the GUID HOB data buffer length.
+ *            If the GUID HOB is located, the length will be updated.
+ * @guid:     A pointer to the owner guild.
+ *
+ * @retval:   Reserved region start address.
+ *            0 if this region does not exist.
+ */
+UINT64 get_fsp_reserved_mem_from_guid(const void *hob_list,
+					UINT64 *len, EFI_GUID *guid);
+
+/**
+ * This function retrieves the FSP reserved normal memory.
+ *
+ * @hob_list: A HOB list pointer.
+ * @len:      A pointer to the FSP reserved memory length buffer.
+ *            If the GUID HOB is located, the length will be updated.
+ * @retval:   FSP reserved memory base
+ *            0 if this region does not exist.
+ */
+UINT32 get_fsp_reserved_mem(const void *hob_list, UINT32 *len);
+
+/**
+ * This function retrieves the TSEG reserved normal memory.
+ *
+ * @hob_list:      A HOB list pointer.
+ * @len:           A pointer to the TSEG reserved memory length buffer.
+ *                 If the GUID HOB is located, the length will be updated.
+ *
+ * @retval NULL:   Failed to find the TSEG reserved memory.
+ * @retval others: TSEG reserved memory base.
+ */
+UINT32 get_tseg_reserved_mem(const void *hob_list, UINT32 *len);
+
+/**
+ * Returns the next instance of a HOB type from the starting HOB.
+ *
+ * @type:     HOB type to search
+ * @hob_list: A pointer to the HOB list
+ *
+ * @retval:   A HOB object with matching type; Otherwise NULL.
+ */
+void * EFIAPI get_next_hob(UINT16 type, const void *hob_list);
+
+/**
+ * Returns the next instance of the matched GUID HOB from the starting HOB.
+ *
+ * @guid:     GUID to search
+ * @hob_list: A pointer to the HOB list
+ *
+ * @retval:   A HOB object with matching GUID; Otherwise NULL.
+ */
+void * EFIAPI get_next_guid_hob(const EFI_GUID *guid, const void *hob_list);
+
+/**
+ * This function retrieves a GUID HOB data buffer and size.
+ *
+ * @hob_list:      A HOB list pointer.
+ * @len:           A pointer to the GUID HOB data buffer length.
+ *                 If the GUID HOB is located, the length will be updated.
+ * @guid           A pointer to HOB GUID.
+ *
+ * @retval NULL:   Failed to find the GUID HOB.
+ * @retval others: GUID HOB data buffer pointer.
+ */
+void *get_guid_hob_data(const void *hob_list, UINT32 *len, EFI_GUID *guid);
+
+/**
+ * This function retrieves FSP Non-volatile Storage HOB buffer and size.
+ *
+ * @hob_list:      A HOB list pointer.
+ * @len:           A pointer to the NVS data buffer length.
+ *                 If the HOB is located, the length will be updated.
+ *
+ * @retval NULL:   Failed to find the NVS HOB.
+ * @retval others: FSP NVS data buffer pointer.
+ */
+void *get_fsp_nvs_data(const void *hob_list, UINT32 *len);
+
+/**
+ * This function retrieves Bootloader temporary stack buffer and size.
+ *
+ * @hob_list:      A HOB list pointer.
+ * @len:           A pointer to the bootloader temporary stack length.
+ *                 If the HOB is located, the length will be updated.
+ *
+ * @retval NULL:   Failed to find the bootloader temporary stack HOB.
+ * @retval others: Bootloader temporary stackbuffer pointer.
+ */
+void *get_bootloader_tmp_mem(const void *hob_list, UINT32 *len);
+
+/**
+ * This function overrides the default configurations in the UPD data region.
+ *
+ * @fsp_upd: A pointer to the UPD_DATA_REGION data strcture
+ *
+ * @return:  None
+ */
+void update_fsp_upd(UPD_DATA_REGION *fsp_upd);
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_types.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_types.h
new file mode 100644
index 0000000..129a2f8
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_types.h
@@ -0,0 +1,171 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __FSP_TYPES_H__
+#define __FSP_TYPES_H__
+
+/* 8-byte unsigned value */
+typedef unsigned long long	UINT64;
+
+/* 8-byte signed value */
+typedef long long		INT64;
+
+/* 4-byte unsigned value */
+typedef unsigned int		UINT32;
+
+/* 4-byte signed value */
+typedef int			INT32;
+
+/* 2-byte unsigned value */
+typedef unsigned short		UINT16;
+
+/* 2-byte character */
+typedef unsigned short		CHAR16;
+
+/* 2-byte signed value */
+typedef short			INT16;
+
+/*
+ * Logical Boolean.
+ * 1-byte value containing 0 for FALSE or a 1 for TRUE.
+ * Other values are undefined.
+ */
+typedef unsigned char		BOOLEAN;
+
+/* 1-byte unsigned value */
+typedef unsigned char		UINT8;
+
+/* 1-byte character */
+typedef char			CHAR8;
+
+/* 1-byte signed value */
+typedef char			INT8;
+
+/* 64-bit physical memory address */
+typedef UINT64			EFI_PHY_ADDR;
+
+/* UEFI and FSP defined status */
+typedef UINT32			EFI_STATUS;
+#define FSP_STATUS		EFI_STATUS
+
+/*
+ * Boolean true value.  UEFI Specification defines this value to be 1,
+ * but this form is more portable.
+ */
+#define TRUE			((BOOLEAN)(1 == 1))
+
+/*
+ * Boolean false value.  UEFI Specification defines this value to be 0,
+ * but this form is more portable.
+ */
+#define FALSE			((BOOLEAN)(0 == 1))
+
+/*
+ * Modifier to ensure that all API functions use the correct C calling
+ * convention.
+ */
+#define EFIAPI			__attribute__((cdecl))
+#define FSPAPI			EFIAPI
+
+/* 128 bit buffer containing a unique identifier value */
+typedef struct {
+	UINT32	data1;
+	UINT16	data2;
+	UINT16	data3;
+	UINT8	data4[8];
+} EFI_GUID;
+
+/**
+ * Returns a 16-bit signature built from 2 ASCII characters.
+ *
+ * This macro returns a 16-bit value built from the two ASCII characters
+ * specified by A and B.
+ *
+ * @A: The first ASCII character.
+ * @B: The second ASCII character.
+ *
+ * @return: A 16-bit value built from the two ASCII characters specified by
+ *          A and B.
+ */
+#define SIGNATURE_16(A, B)	((A) | (B << 8))
+
+/**
+ * Returns a 32-bit signature built from 4 ASCII characters.
+ *
+ * This macro returns a 32-bit value built from the four ASCII characters
+ * specified by A, B, C, and D.
+ *
+ * @A: The first ASCII character.
+ * @B: The second ASCII character.
+ * @C: The third ASCII character.
+ * @D: The fourth ASCII character.
+ *
+ * @return: A 32-bit value built from the two ASCII characters specified by
+ *          A, B, C and D.
+ */
+#define SIGNATURE_32(A, B, C, D)	\
+	(SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
+
+/**
+ * Returns a 64-bit signature built from 8 ASCII characters.
+ *
+ * This macro returns a 64-bit value built from the eight ASCII characters
+ * specified by A, B, C, D, E, F, G,and H.
+ *
+ * @A: The first ASCII character.
+ * @B: The second ASCII character.
+ * @C: The third ASCII character.
+ * @D: The fourth ASCII character.
+ * @E: The fifth ASCII character.
+ * @F: The sixth ASCII character.
+ * @G: The seventh ASCII character.
+ * @H: The eighth ASCII character.
+ *
+ * @return: A 64-bit value built from the two ASCII characters specified by
+ *          A, B, C, D, E, F, G and H.
+ */
+#define SIGNATURE_64(A, B, C, D, E, F, G, H)	\
+	(SIGNATURE_32(A, B, C, D) | ((UINT64)(SIGNATURE_32(E, F, G, H)) << 32))
+
+/* Assertion for debug */
+#define ASSERT(exp)	do { if (!(exp)) for (;;); } while (FALSE)
+
+/*
+ * Define FSP API return status code.
+ * Compatiable with EFI_STATUS defined in PI Spec.
+ */
+#define FSP_SUCCESS		0
+#define FSP_INVALID_PARAM	0x80000002
+#define FSP_UNSUPPORTED		0x80000003
+#define FSP_DEVICE_ERROR	0x80000007
+#define FSP_NOT_FOUND		0x8000000E
+#define FSP_ALREADY_STARTED	0x80000014
+
+#endif
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h
new file mode 100644
index 0000000..40a9044
--- /dev/null
+++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h
@@ -0,0 +1,81 @@
+/** @file
+
+Copyright (C) 2013, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this
+  list of conditions and the following disclaimer in the documentation and/or
+  other materials provided with the distribution.
+* Neither the name of Intel Corporation nor the names of its contributors may
+  be used to endorse or promote products derived from this software without
+  specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+  THE POSSIBILITY OF SUCH DAMAGE.
+
+  This file is automatically generated. Please do NOT modify !!!
+
+**/
+
+#ifndef __VPDHEADER_H__
+#define __VPDHEADER_H__
+
+#pragma pack(1)
+
+typedef struct _UPD_DATA_REGION {
+	UINT64	sign;			/* Offset 0x0000 */
+	UINT64	reserved;		/* Offset 0x0008 */
+	UINT8	dummy[240];		/* Offset 0x0010 */
+	UINT8	hda_verb_header[12];	/* Offset 0x0100 */
+	UINT32	hda_verb_length;	/* Offset 0x010C */
+	UINT8	hda_verb_data0[16];	/* Offset 0x0110 */
+	UINT8	hda_verb_data1[16];	/* Offset 0x0120 */
+	UINT8	hda_verb_data2[16];	/* Offset 0x0130 */
+	UINT8	hda_verb_data3[16];	/* Offset 0x0140 */
+	UINT8	hda_verb_data4[16];	/* Offset 0x0150 */
+	UINT8	hda_verb_data5[16];	/* Offset 0x0160 */
+	UINT8	hda_verb_data6[16];	/* Offset 0x0170 */
+	UINT8	hda_verb_data7[16];	/* Offset 0x0180 */
+	UINT8	hda_verb_data8[16];	/* Offset 0x0190 */
+	UINT8	hda_verb_data9[16];	/* Offset 0x01A0 */
+	UINT8	hda_verb_data10[16];	/* Offset 0x01B0 */
+	UINT8	hda_verb_data11[16];	/* Offset 0x01C0 */
+	UINT8	hda_verb_data12[16];	/* Offset 0x01D0 */
+	UINT8	hda_verb_data13[16];	/* Offset 0x01E0 */
+	UINT8	hda_verb_pad[47];	/* Offset 0x01F0 */
+	UINT16	terminator;		/* Offset 0x021F */
+} UPD_DATA_REGION;
+
+#define VPD_IMAGE_ID	0x445056574F4E4E4D	/* 'MNNOWVPD' */
+#define VPD_IMAGE_REV	0x00000301
+
+typedef struct _VPD_DATA_REGION {
+	UINT64	vpd_sign;		/* Offset 0x0000 */
+	UINT32	img_rev;		/* Offset 0x0008 */
+	UINT32	upd_offset;		/* Offset 0x000C */
+	UINT8	unused[16];		/* Offset 0x0010 */
+	UINT32	fsp_res_memlen;		/* Offset 0x0020 */
+	UINT8	disable_pcie1;		/* Offset 0x0024 */
+	UINT8	disable_pcie2;		/* Offset 0x0025 */
+	UINT8	disable_pcie3;		/* Offset 0x0026 */
+	UINT8	enable_azalia;		/* Offset 0x0027 */
+	UINT8	legacy_seg_decode;	/* Offset 0x0028 */
+	UINT8	pcie_port_ioh;		/* Offset 0x0029 */
+} VPD_DATA_REGION;
+
+#pragma pack()
+
+#endif
-- 
1.8.2.1



More information about the U-Boot mailing list