x86: fsp: Make hob command a sub-command to fsp
[oweals/u-boot.git] / arch / x86 / lib / fsp / fsp_support.c
index f6ae85a8bad4dda28d8947951f674b1c7eb55e02..1d48ff4a8e7a6a5079c97c611d2dafa6ce6724d3 100644 (file)
@@ -30,7 +30,7 @@ static bool compare_guid(const struct efi_guid *guid1,
                return false;
 }
 
-u32 __attribute__((optimize("O0"))) find_fsp_header(void)
+struct fsp_header *__attribute__((optimize("O0"))) find_fsp_header(void)
 {
        /*
         * This function may be called before the a stack is established,
@@ -84,7 +84,7 @@ u32 __attribute__((optimize("O0"))) find_fsp_header(void)
                fsp = 0;
        }
 
-       return (u32)fsp;
+       return (struct fsp_header *)fsp;
 }
 
 void fsp_continue(struct shared_data *shared_data, u32 status, void *hob_list)
@@ -124,33 +124,36 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
        struct fsp_init_params *params_ptr;
        struct upd_region *fsp_upd;
 
-       fsp_hdr = (struct fsp_header *)find_fsp_header();
+#ifdef CONFIG_DEBUG_UART
+       setup_early_uart();
+#endif
+
+       fsp_hdr = find_fsp_header();
        if (fsp_hdr == NULL) {
                /* No valid FSP info header was found */
                panic("Invalid FSP header");
        }
 
-       fsp_upd = (struct upd_region *)&shared_data.fsp_upd;
+       fsp_upd = &shared_data.fsp_upd;
        memset(&rt_buf, 0, sizeof(struct fspinit_rtbuf));
 
        /* Reserve a gap in stack top */
        rt_buf.common.stack_top = (u32 *)stack_top - 32;
        rt_buf.common.boot_mode = boot_mode;
-       rt_buf.common.upd_data = (struct upd_region *)fsp_upd;
+       rt_buf.common.upd_data = fsp_upd;
 
        /* Get VPD region start */
        fsp_vpd = (struct vpd_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->sign == VPD_IMAGE_ID));
+       /* Verify the VPD data region is valid */
+       assert(fsp_vpd->sign == VPD_IMAGE_ID);
 
        /* Copy default data from Flash */
        memcpy(fsp_upd, (void *)(fsp_hdr->img_base + fsp_vpd->upd_offset),
               sizeof(struct upd_region));
 
-       /* Verifify the UPD data region is valid */
+       /* Verify the UPD data region is valid */
        assert(fsp_upd->terminator == UPD_TERMINATOR);
 
        /* Override any UPD setting if required */
@@ -169,6 +172,9 @@ void fsp_init(u32 stack_top, u32 boot_mode, void *nvs_buf)
 
        post_code(POST_PRE_MRC);
 
+       /* Load GDT for FSP */
+       setup_fsp_gdt();
+
        /*
         * Use ASM code to ensure the register value in EAX & ECX
         * will be passed into BlContinuationFunc
@@ -275,7 +281,7 @@ u64 fsp_get_usable_highmem_top(const void *hob_list)
                        res_desc = (struct hob_res_desc *)hdr;
                        if (res_desc->type == RES_SYS_MEM) {
                                phys_start = res_desc->phys_start;
-                               /* Need memory above 1MB to be collected here */
+                               /* Need memory above 4GB to be collected here */
                                if (phys_start >= (phys_addr_t)FSP_HIGHMEM_BASE)
                                        top += (u32)(res_desc->len);
                        }