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>
diff --git a/arch/x86/cpu/queensbay/tnc_dram.c b/arch/x86/cpu/queensbay/tnc_dram.c
index dbc1710..8e97c9b 100644
--- a/arch/x86/cpu/queensbay/tnc_dram.c
+++ b/arch/x86/cpu/queensbay/tnc_dram.c
@@ -14,17 +14,17 @@
int dram_init(void)
{
phys_size_t ram_size = 0;
- union hob_pointers_t hob;
+ union hob_pointers hob;
hob.raw = gd->arch.hob_list;
- while (!END_OF_HOB(hob)) {
- if (hob.hdr->type == HOB_TYPE_RES_DESC) {
+ while (!end_of_hob(hob)) {
+ if (get_hob_type(hob) == HOB_TYPE_RES_DESC) {
if (hob.res_desc->type == RES_SYS_MEM ||
hob.res_desc->type == RES_MEM_RESERVED) {
ram_size += hob.res_desc->len;
}
}
- hob.raw = GET_NEXT_HOB(hob);
+ hob.raw = get_next_hob(hob);
}
gd->ram_size = ram_size;
@@ -49,19 +49,19 @@
*/
ulong board_get_usable_ram_top(ulong total_size)
{
- return get_usable_lowmem_top(gd->arch.hob_list);
+ return fsp_get_usable_lowmem_top(gd->arch.hob_list);
}
unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
{
unsigned num_entries = 0;
- union hob_pointers_t hob;
+ union hob_pointers hob;
hob.raw = gd->arch.hob_list;
- while (!END_OF_HOB(hob)) {
- if (hob.hdr->type == HOB_TYPE_RES_DESC) {
+ while (!end_of_hob(hob)) {
+ if (get_hob_type(hob) == HOB_TYPE_RES_DESC) {
entries[num_entries].addr = hob.res_desc->phys_start;
entries[num_entries].size = hob.res_desc->len;
@@ -70,7 +70,7 @@
else if (hob.res_desc->type == RES_MEM_RESERVED)
entries[num_entries].type = E820_RESERVED;
}
- hob.raw = GET_NEXT_HOB(hob);
+ hob.raw = get_next_hob(hob);
num_entries++;
}