diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2014-12-17 15:50:49 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2014-12-18 17:26:08 -0700 |
commit | 255fd5caa5dda7f1028843753562eff58f3855bc (patch) | |
tree | dd181fea0f51800ad68cbbf768e125f143eabb7f /arch/x86/include | |
parent | 5dad97ed61507d96b2f791980f51ee3497a75867 (diff) | |
download | u-boot-imx-255fd5caa5dda7f1028843753562eff58f3855bc.zip u-boot-imx-255fd5caa5dda7f1028843753562eff58f3855bc.tar.gz u-boot-imx-255fd5caa5dda7f1028843753562eff58f3855bc.tar.bz2 |
x86: Clean up the FSP support codes
This is the follow-on patch to clean up the FSP support codes:
- Remove the _t suffix on the structures defines
- Use __packed for structure defines
- Use U-Boot's assert()
- Use standard bool true/false
- Remove read_unaligned64()
- Use memcmp() in the compare_guid()
- Remove the cast in the memset() call
- Replace some magic numbers with macros
- Use panic() when no valid FSP image header is found
- Change some FSP utility routines to use an fsp_ prefix
- Add comment blocks for asm_continuation and fsp_init_done
- Remove some casts in find_fsp_header()
- Change HOB access macros to static inline routines
- Add comments to mention find_fsp_header() may be called in a
stackless environment
- Add comments to mention init(¶ms) in fsp_init() cannot
be removed
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86/include')
9 files changed, 140 insertions, 134 deletions
diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h index 25b938f..a9d7156 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_api.h @@ -14,9 +14,7 @@ */ typedef void (*fsp_continuation_f)(u32 status, void *hob_list); -#pragma pack(1) - -struct fsp_init_params_t { +struct fsp_init_params { /* Non-volatile storage buffer pointer */ void *nvs_buf; /* Runtime buffer pointer */ @@ -25,7 +23,7 @@ struct fsp_init_params_t { fsp_continuation_f continuation; }; -struct common_buf_t { +struct common_buf { /* * Stack top pointer used by the bootloader. The new stack frame will be * set up at this location after FspInit API call. @@ -36,24 +34,22 @@ struct common_buf_t { u32 reserved[7]; /* Reserved */ }; -enum fsp_phase_t { +enum fsp_phase { /* Notification code for post PCI enuermation */ INIT_PHASE_PCI = 0x20, /* Notification code before transfering control to the payload */ INIT_PHASE_BOOT = 0x40 }; -struct fsp_notify_params_t { +struct fsp_notify_params { /* Notification phase used for NotifyPhase API */ - enum fsp_phase_t phase; + enum fsp_phase phase; }; -#pragma pack() - /* FspInit API function prototype */ -typedef u32 (*fsp_init_f)(struct fsp_init_params_t *param); +typedef u32 (*fsp_init_f)(struct fsp_init_params *params); /* FspNotify API function prototype */ -typedef u32 (*fsp_notify_f)(struct fsp_notify_params_t *param); +typedef u32 (*fsp_notify_f)(struct fsp_notify_params *params); #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 index 1f73680..eaec2b4 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_ffs.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_ffs.h @@ -8,10 +8,8 @@ #ifndef __FSP_FFS_H__ #define __FSP_FFS_H__ -#pragma pack(1) - /* Used to verify the integrity of the file */ -union ffs_integrity_t { +union __packed ffs_integrity { struct { /* * The IntegrityCheck.checksum.header field is an 8-bit @@ -43,14 +41,14 @@ union ffs_integrity_t { * Each file begins with the header that describe the * contents and state of the files. */ -struct ffs_file_header_t { +struct __packed ffs_file_header { /* * This GUID is the file name. * It is used to uniquely identify the file. */ - struct efi_guid_t name; + struct efi_guid name; /* Used to verify the integrity of the file */ - union ffs_integrity_t integrity; + union ffs_integrity integrity; /* Identifies the type of file */ u8 type; /* Declares various file attribute bits */ @@ -64,16 +62,16 @@ struct ffs_file_header_t { u8 state; }; -struct ffs_file_header2_t { +struct __packed ffs_file_header2 { /* * 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. */ - struct efi_guid_t name; + struct efi_guid name; /* Used to verify the integrity of the file */ - union ffs_integrity_t integrity; + union ffs_integrity integrity; /* Identifies the type of file */ u8 type; /* Declares various file attribute bits */ @@ -81,9 +79,9 @@ struct ffs_file_header2_t { /* * The length of the file in bytes, including the FFS header. * The length of the file data is either - * (size - sizeof(struct ffs_file_header_t)). This calculation means a + * (size - sizeof(struct ffs_file_header)). This calculation means a * zero-length file has a size of 24 bytes, which is - * sizeof(struct ffs_file_header_t). Size is not required to be a + * sizeof(struct 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. @@ -98,7 +96,7 @@ struct ffs_file_header2_t { * 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 - * struct ffs_file_header_t is used. + * struct ffs_file_header is used. */ u32 ext_size; }; @@ -129,7 +127,7 @@ struct ffs_file_header2_t { #define EFI_SECTION_SMM_DEPEX 0x1C /* Common section header */ -struct raw_section_t { +struct __packed raw_section { /* * A 24-bit unsigned integer that contains the total size of * the section in bytes, including the EFI_COMMON_SECTION_HEADER. @@ -138,7 +136,7 @@ struct raw_section_t { u8 type; }; -struct raw_section2_t { +struct __packed raw_section2 { /* * A 24-bit unsigned integer that contains the total size of * the section in bytes, including the EFI_COMMON_SECTION_HEADER. @@ -153,6 +151,4 @@ struct raw_section2_t { u32 ext_size; }; -#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 index 01300db..a024451 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_fv.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_fv.h @@ -63,7 +63,7 @@ #define EFI_FVB2_ALIGNMENT_1G 0x001E0000 #define EFI_FVB2_ALIGNMENT_2G 0x001F0000 -struct fv_blkmap_entry_t { +struct fv_blkmap_entry { /* The number of sequential blocks which are of the same size */ u32 num_blocks; /* The size of the blocks */ @@ -71,7 +71,7 @@ struct fv_blkmap_entry_t { }; /* Describes the features and layout of the firmware volume */ -struct fv_header_t { +struct fv_header { /* * The first 16 bytes are reserved to allow for the reset vector of * processors whose reset vector is at address 0. @@ -81,7 +81,7 @@ struct fv_header_t { * Declares the file system with which the firmware volume * is formatted. */ - struct efi_guid_t fs_guid; + struct efi_guid fs_guid; /* * Length in bytes of the complete firmware volume, including * the header. @@ -118,18 +118,18 @@ struct fv_header_t { * An array of run-length encoded FvBlockMapEntry structures. * The array is terminated with an entry of {0,0}. */ - struct fv_blkmap_entry_t block_map[1]; + struct fv_blkmap_entry block_map[1]; }; -#define EFI_FVH_SIGNATURE SIGNATURE_32('_', 'F', 'V', 'H') +#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 */ -struct fv_ext_header_t { +struct fv_ext_header { /* firmware volume name */ - struct efi_guid_t fv_name; + struct efi_guid fv_name; /* Size of the rest of the extension header including this structure */ u32 ext_hdr_size; }; diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h index 44c0f90..380b64e 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_hob.h @@ -19,14 +19,14 @@ * Describes the format and size of the data inside the HOB. * All HOBs must contain this generic HOB header. */ -struct hob_header_t { +struct hob_header { u16 type; /* HOB type */ u16 len; /* HOB length */ u32 reserved; /* always zero */ }; /* Enumeration of memory types introduced in UEFI */ -enum efi_mem_type_t { +enum efi_mem_type { EFI_RESERVED_MEMORY_TYPE, /* * The code portions of a loaded application. @@ -87,16 +87,16 @@ enum efi_mem_type_t { * exist outside the HOB list. This HOB type describes how memory is used, * not the physical attributes of memory. */ -struct hob_mem_alloc_t { - struct hob_header_t hdr; +struct hob_mem_alloc { + struct hob_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_t is defined in + * present for the memory allocation HOB. Type efi_guid is defined in * InstallProtocolInterface() in the UEFI 2.0 specification. */ - struct efi_guid_t name; + struct efi_guid name; /* * The base address of memory allocated by this HOB. * Type phys_addr_t is defined in AllocatePages() in the UEFI 2.0 @@ -111,7 +111,7 @@ struct hob_mem_alloc_t { * Type EFI_MEMORY_TYPE is defined in AllocatePages() in the UEFI 2.0 * specification. */ - enum efi_mem_type_t mem_type; + enum efi_mem_type mem_type; /* padding */ u8 reserved[4]; }; @@ -155,14 +155,14 @@ struct hob_mem_alloc_t { * Describes the resource properties of all fixed, nonrelocatable resource * ranges found on the processor host bus during the HOB producer phase. */ -struct hob_res_desc_t { - struct hob_header_t hdr; +struct hob_res_desc { + struct hob_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. */ - struct efi_guid_t owner; + struct efi_guid owner; u32 type; u32 attr; /* The physical start address of the resource region */ @@ -175,24 +175,24 @@ struct hob_res_desc_t { * Allows writers of executable content in the HOB producer phase to * maintain and manage HOBs with specific GUID. */ -struct hob_guid_t { - struct hob_header_t hdr; +struct hob_guid { + struct hob_header hdr; /* A GUID that defines the contents of this HOB */ - struct efi_guid_t name; + struct efi_guid name; /* GUID specific data goes here */ }; /* Union of all the possible HOB Types */ -union hob_pointers_t { - struct hob_header_t *hdr; - struct hob_mem_alloc_t *mem_alloc; - struct hob_res_desc_t *res_desc; - struct hob_guid_t *guid; +union hob_pointers { + struct hob_header *hdr; + struct hob_mem_alloc *mem_alloc; + struct hob_res_desc *res_desc; + struct hob_guid *guid; u8 *raw; }; /** - * Returns the type of a HOB. + * get_hob_type() - return the type of a HOB * * This macro returns the type field from the HOB header for the * HOB specified by hob. @@ -201,11 +201,13 @@ union hob_pointers_t { * * @return: HOB type. */ -#define GET_HOB_TYPE(hob) \ - ((*(struct hob_header_t **)&(hob))->type) +static inline u16 get_hob_type(union hob_pointers hob) +{ + return hob.hdr->type; +} /** - * Returns the length, in bytes, of a HOB. + * get_hob_length() - return the length, in bytes, of a HOB * * This macro returns the len field from the HOB header for the * HOB specified by hob. @@ -214,11 +216,13 @@ union hob_pointers_t { * * @return: HOB length. */ -#define GET_HOB_LENGTH(hob) \ - ((*(struct hob_header_t **)&(hob))->len) +static inline u16 get_hob_length(union hob_pointers hob) +{ + return hob.hdr->len; +} /** - * Returns a pointer to the next HOB in the HOB list. + * get_next_hob() - return 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. @@ -227,25 +231,31 @@ union hob_pointers_t { * * @return: A pointer to the next HOB in the HOB list. */ -#define GET_NEXT_HOB(hob) \ - (void *)(*(u8 **)&(hob) + GET_HOB_LENGTH(hob)) +static inline void *get_next_hob(union hob_pointers hob) +{ + return (void *)(*(u8 **)&(hob) + get_hob_length(hob)); +} /** - * Determines if a HOB is the last HOB in the HOB list. + * end_of_hob() - determine 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 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. + * @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) == (u16)HOB_TYPE_EOH) +static inline bool end_of_hob(union hob_pointers hob) +{ + return get_hob_type(hob) == HOB_TYPE_EOH; +} /** - * Returns a pointer to data buffer from a HOB of type HOB_TYPE_GUID_EXT. + * get_guid_hob_data() - return 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. @@ -254,11 +264,14 @@ union hob_pointers_t { * * @return: A pointer to the data buffer in a HOB. */ -#define GET_GUID_HOB_DATA(hob) \ - (void *)(*(u8 **)&(hob) + sizeof(struct hob_guid_t)) +static inline void *get_guid_hob_data(u8 *hob) +{ + return (void *)(hob + sizeof(struct hob_guid)); +} /** - * Returns the size of the data buffer from a HOB of type HOB_TYPE_GUID_EXT. + * get_guid_hob_data_size() - return 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. @@ -267,14 +280,31 @@ union hob_pointers_t { * * @return: The size of the data buffer. */ -#define GET_GUID_HOB_DATA_SIZE(hob) \ - (u16)(GET_HOB_LENGTH(hob) - sizeof(struct hob_guid_t)) +static inline u16 get_guid_hob_data_size(u8 *hob) +{ + union hob_pointers hob_p = *(union hob_pointers *)hob; + return get_hob_length(hob_p) - sizeof(struct hob_guid); +} /* FSP specific GUID HOB definitions */ +#define FSP_GUID_DATA1 0x912740be +#define FSP_GUID_DATA2 0x2284 +#define FSP_GUID_DATA3 0x4734 +#define FSP_GUID_DATA4_0 0xb9 +#define FSP_GUID_DATA4_1 0x71 +#define FSP_GUID_DATA4_2 0x84 +#define FSP_GUID_DATA4_3 0xb0 +#define FSP_GUID_DATA4_4 0x27 +#define FSP_GUID_DATA4_5 0x35 +#define FSP_GUID_DATA4_6 0x3f +#define FSP_GUID_DATA4_7 0x0c + #define FSP_HEADER_GUID \ { \ - 0x912740be, 0x2284, 0x4734, \ - {0xb9, 0x71, 0x84, 0xb0, 0x27, 0x35, 0x3f, 0x0c} \ + FSP_GUID_DATA1, FSP_GUID_DATA2, FSP_GUID_DATA3, \ + { FSP_GUID_DATA4_0, FSP_GUID_DATA4_1, FSP_GUID_DATA4_2, \ + FSP_GUID_DATA4_3, FSP_GUID_DATA4_4, FSP_GUID_DATA4_5, \ + FSP_GUID_DATA4_6, FSP_GUID_DATA4_7 } \ } #define FSP_NON_VOLATILE_STORAGE_HOB_GUID \ diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_infoheader.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_infoheader.h index ad78bcd..4a4d627 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_infoheader.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_infoheader.h @@ -10,9 +10,7 @@ #define FSP_HEADER_OFF 0x94 /* Fixed FSP header offset in the FSP image */ -#pragma pack(1) - -struct fsp_header_t { +struct __packed fsp_header { u32 sign; /* 'FSPH' */ u32 hdr_len; /* header length */ u8 reserved1[3]; @@ -31,6 +29,4 @@ struct fsp_header_t { u32 reserved2; }; -#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 index a7b6e6b..61286ce 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_platform.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_platform.h @@ -8,12 +8,8 @@ #ifndef __FSP_PLATFORM_H__ #define __FSP_PLATFORM_H__ -#pragma pack(1) - -struct fspinit_rtbuf_t { - struct common_buf_t common; /* FSP common runtime data structure */ +struct fspinit_rtbuf { + struct common_buf common; /* FSP common runtime data structure */ }; -#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 index 3296a2b..3ae1b66 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_support.h @@ -18,14 +18,30 @@ #include "fsp_bootmode.h" #include "fsp_vpd.h" -struct shared_data_t { - struct fsp_header_t *fsp_hdr; +struct shared_data { + struct fsp_header *fsp_hdr; u32 *stack_top; - struct upd_region_t fsp_upd; + struct upd_region fsp_upd; }; +#define FSP_LOWMEM_BASE 0x100000UL +#define FSP_HIGHMEM_BASE 0x100000000ULL + +/** + * FSP Continuation assembly helper routine + * + * This routine jumps to the C version of FSP continuation function + */ void asm_continuation(void); +/** + * FSP initialization complete + * + * This is the function that indicates FSP initialization is complete and jumps + * back to the bootloader with HOB list pointer as the parameter. + * + * @hob_list: HOB list pointer + */ void fsp_init_done(void *hob_list); /** @@ -37,19 +53,12 @@ void fsp_init_done(void *hob_list); * * @retval: Never returns */ -void fsp_continue(struct shared_data_t *shared_data, u32 status, +void fsp_continue(struct shared_data *shared_data, u32 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. */ u32 find_fsp_header(void); @@ -67,11 +76,11 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf); * FSP notification wrapper function * * @fsp_hdr: Pointer to FSP information header - * @phase: FSP initialization phase defined in enum fsp_phase_t + * @phase: FSP initialization phase defined in enum fsp_phase * * @retval: compatible status code with EFI_STATUS defined in PI spec */ -u32 fsp_notify(struct fsp_header_t *fsp_hdr, u32 phase); +u32 fsp_notify(struct fsp_header *fsp_hdr, u32 phase); /** * This function retrieves the top of usable low memory. @@ -80,7 +89,7 @@ u32 fsp_notify(struct fsp_header_t *fsp_hdr, u32 phase); * * @retval: Usable low memory top. */ -u32 get_usable_lowmem_top(const void *hob_list); +u32 fsp_get_usable_lowmem_top(const void *hob_list); /** * This function retrieves the top of usable high memory. @@ -89,7 +98,7 @@ u32 get_usable_lowmem_top(const void *hob_list); * * @retval: Usable high memory top. */ -u64 get_usable_highmem_top(const void *hob_list); +u64 fsp_get_usable_highmem_top(const void *hob_list); /** * This function retrieves a special reserved memory region. @@ -102,8 +111,8 @@ u64 get_usable_highmem_top(const void *hob_list); * @retval: Reserved region start address. * 0 if this region does not exist. */ -u64 get_fsp_reserved_mem_from_guid(const void *hob_list, - u64 *len, struct efi_guid_t *guid); +u64 fsp_get_reserved_mem_from_guid(const void *hob_list, + u64 *len, struct efi_guid *guid); /** * This function retrieves the FSP reserved normal memory. @@ -114,7 +123,7 @@ u64 get_fsp_reserved_mem_from_guid(const void *hob_list, * @retval: FSP reserved memory base * 0 if this region does not exist. */ -u32 get_fsp_reserved_mem(const void *hob_list, u32 *len); +u32 fsp_get_fsp_reserved_mem(const void *hob_list, u32 *len); /** * This function retrieves the TSEG reserved normal memory. @@ -126,7 +135,7 @@ u32 get_fsp_reserved_mem(const void *hob_list, u32 *len); * @retval NULL: Failed to find the TSEG reserved memory. * @retval others: TSEG reserved memory base. */ -u32 get_tseg_reserved_mem(const void *hob_list, u32 *len); +u32 fsp_get_tseg_reserved_mem(const void *hob_list, u32 *len); /** * Returns the next instance of a HOB type from the starting HOB. @@ -136,7 +145,7 @@ u32 get_tseg_reserved_mem(const void *hob_list, u32 *len); * * @retval: A HOB object with matching type; Otherwise NULL. */ -void *get_next_hob(u16 type, const void *hob_list); +void *fsp_get_next_hob(u16 type, const void *hob_list); /** * Returns the next instance of the matched GUID HOB from the starting HOB. @@ -146,7 +155,7 @@ void *get_next_hob(u16 type, const void *hob_list); * * @retval: A HOB object with matching GUID; Otherwise NULL. */ -void *get_next_guid_hob(const struct efi_guid_t *guid, const void *hob_list); +void *fsp_get_next_guid_hob(const struct efi_guid *guid, const void *hob_list); /** * This function retrieves a GUID HOB data buffer and size. @@ -159,8 +168,8 @@ void *get_next_guid_hob(const struct efi_guid_t *guid, const void *hob_list); * @retval NULL: Failed to find the GUID HOB. * @retval others: GUID HOB data buffer pointer. */ -void *get_guid_hob_data(const void *hob_list, u32 *len, - struct efi_guid_t *guid); +void *fsp_get_guid_hob_data(const void *hob_list, u32 *len, + struct efi_guid *guid); /** * This function retrieves FSP Non-volatile Storage HOB buffer and size. @@ -172,7 +181,7 @@ void *get_guid_hob_data(const void *hob_list, u32 *len, * @retval NULL: Failed to find the NVS HOB. * @retval others: FSP NVS data buffer pointer. */ -void *get_fsp_nvs_data(const void *hob_list, u32 *len); +void *fsp_get_nvs_data(const void *hob_list, u32 *len); /** * This function retrieves Bootloader temporary stack buffer and size. @@ -184,15 +193,15 @@ void *get_fsp_nvs_data(const void *hob_list, u32 *len); * @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, u32 *len); +void *fsp_get_bootloader_tmp_mem(const void *hob_list, u32 *len); /** * This function overrides the default configurations in the UPD data region. * - * @fsp_upd: A pointer to the upd_region_t data strcture + * @fsp_upd: A pointer to the upd_region data strcture * * @return: None */ -void update_fsp_upd(struct upd_region_t *fsp_upd); +void update_fsp_upd(struct upd_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 index 12ebbfd..f32d827 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_types.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_types.h @@ -8,20 +8,8 @@ #ifndef __FSP_TYPES_H__ #define __FSP_TYPES_H__ -/* - * Boolean true value. UEFI Specification defines this value to be 1, - * but this form is more portable. - */ -#define TRUE ((unsigned char)(1 == 1)) - -/* - * Boolean false value. UEFI Specification defines this value to be 0, - * but this form is more portable. - */ -#define FALSE ((unsigned char)(0 == 1)) - /* 128 bit buffer containing a unique identifier value */ -struct efi_guid_t { +struct efi_guid { u32 data1; u16 data2; u16 data3; @@ -80,9 +68,6 @@ struct efi_guid_t { #define SIGNATURE_64(A, B, C, D, E, F, G, H) \ (SIGNATURE_32(A, B, C, D) | ((u64)(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. diff --git a/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h b/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h index 11cc32f..bce58b1 100644 --- a/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h +++ b/arch/x86/include/asm/arch-queensbay/fsp/fsp_vpd.h @@ -10,9 +10,9 @@ #ifndef __VPDHEADER_H__ #define __VPDHEADER_H__ -#pragma pack(1) +#define UPD_TERMINATOR 0x55AA -struct upd_region_t { +struct __packed upd_region { u64 sign; /* Offset 0x0000 */ u64 reserved; /* Offset 0x0008 */ u8 dummy[240]; /* Offset 0x0010 */ @@ -39,7 +39,7 @@ struct upd_region_t { #define VPD_IMAGE_ID 0x445056574F4E4E4D /* 'MNNOWVPD' */ #define VPD_IMAGE_REV 0x00000301 -struct vpd_region_t { +struct __packed vpd_region { u64 sign; /* Offset 0x0000 */ u32 img_rev; /* Offset 0x0008 */ u32 upd_offset; /* Offset 0x000C */ @@ -53,6 +53,4 @@ struct vpd_region_t { u8 pcie_port_ioh; /* Offset 0x0029 */ }; -#pragma pack() - #endif |