x86: fsp: add more debugging

pull/365/head
Marco Oliverio 2023-09-12 15:03:04 +00:00
parent ce90b3b7dc
commit f4411f2fe4
6 changed files with 53 additions and 0 deletions

View File

@ -204,4 +204,7 @@ struct efi_hob_resource_descriptor *
hob_find_fsp_reserved(struct efi_hob *hoblist);
int hob_iterate_memory_map(struct efi_hob *hobList, hob_mem_map_cb cb,
void* ctx);
#ifdef DEBUG
void hob_dump_memory_map(struct efi_hob *hobList);
#endif /* DEBUG */
#endif

View File

@ -33,6 +33,7 @@ int x86_paging_set_page_table();
#if !defined(BUILD_LOADER_STAGE1)
int x86_paging_map_memory(uint64_t va, uint64_t pa, uint32_t size);
int x86_paging_dump_info();
#endif /* !BUILD_LOADER_STAGE1 */
#endif /* WOLFBOOT_64BIT */

View File

@ -528,6 +528,10 @@ void start(uint32_t stack_base, uint32_t stack_top, uint64_t timestamp,
panic();
}
#ifdef DEBUG
hob_dump_memory_map(hobList);
#endif /* DEBUG */
if (top_address > MEMORY_4GB) {
panic();
}

View File

@ -111,10 +111,12 @@ void do_boot(const uint32_t *app)
/* TODO: to remove */
mptable_setup();
x86_paging_dump_info();
r = elf_load_image_mmu((uint8_t *)app, &e, mmu_cb);
wolfBoot_printf("Elf loaded (ret %d), entry 0x%x_%x\r\n", 0,
(uint32_t)(e >> 32),
(uint32_t)(e));
x86_paging_dump_info();
if (r != 0)
panic();

View File

@ -176,4 +176,29 @@ int hob_iterate_memory_map(struct efi_hob *hobList, hob_mem_map_cb cb,
return 0;
}
#ifdef DEBUG_HOB_LIST
typedef int (*hob_mem_map_cb)(uint64_t start, uint64_t length, uint32_t type,
void *ctx);
int hob_print_entry(uint64_t start, uint64_t length, uint32_t type, void *ctx)
{
(void)ctx;
wolfBoot_printf("entry type: %x\r\n", type);
wolfBoot_printf("start: %x_%x\r\n", (uint32_t)(start >> 32),
(uint32_t)start);
wolfBoot_printf("end: %x_%x\r\n", (uint32_t)((start+length) >> 32),
(uint32_t)(start+length));
return 0;
}
void hob_dump_memory_map(struct efi_hob *hobList)
{
hob_iterate_memory_map(hobList, hob_print_entry, NULL);
}
#else
void hob_dump_memory_map(struct efi_hob *hb) {}
#endif /* DEBUG_HOB_LIST */
#endif /* HOB_C */

View File

@ -219,4 +219,22 @@ int x86_paging_map_memory(uint64_t va, uint64_t pa, uint32_t size)
return 0;
}
#ifdef DEBUG_PAGING
void x86_paging_dump_info()
{
wolfBoot_printf("page_table_pages @ %x %xh\r\n",
(uint32_t)((uintptr_t)page_table_pages >> 32),
(uint32_t)(uintptr_t)page_table_pages);
wolfBoot_printf("page_table_pages used: %d\r\n", page_table_page_used);
wolfBoot_printf("mem start @ %x %xh\r\n",
(uint32_t)((uintptr_t)_mem >> 32),
(uint32_t)(uintptr_t)_mem);
wolfBoot_printf("mem curr @ %x %xh\r\n",
(uint32_t)((uintptr_t)mem >> 32),
(uint32_t)(uintptr_t)mem);
}
#else
void x86_paging_dump_info() {}
#endif /* DEBUG_PAGING */
#endif /* !BUILD_LOADER_STAGE1 */