lib: uefi: add EfiDebugImageInfoTable for debug

EfiDebugImageInfoTable is used to store EfiLoadedImage for
debug purpose. This commit adds the table to the EfiConfigurationTable.

This feature is described in UEFI Spec version 2.10. Section 18.4.
The implementation ensures support for hardware-assisted debugging and
provides a standardized mechanism for debuggers to discover and interact
with system-level debug resources.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paulliu@debian.org>
This commit is contained in:
Ying-Chun Liu (PaulLiu)
2025-07-26 03:18:01 +01:00
committed by Kelvin Zhang
parent ea327d7242
commit 1ffb54dace
3 changed files with 41 additions and 1 deletions

View File

@@ -23,6 +23,7 @@
#include "memory_protocols.h"
#include "platform.h"
#include "debug_support.h"
void setup_configuration_table(EfiSystemTable *table) {
auto &rng = table->configuration_table[table->number_of_table_entries++];
@@ -40,4 +41,8 @@ void setup_configuration_table(EfiSystemTable *table) {
dtb.vendor_table = alloc_page(fdt_size);
memcpy(dtb.vendor_table, fdt, fdt_size);
}
}
auto &debug_image_info_table = table->configuration_table[table->number_of_table_entries++];
debug_image_info_table.vendor_guid = EFI_DEBUG_IMAGE_INFO_TABLE_GUID;
debug_image_info_table.vendor_table = &efi_m_debug_info_table_header;
}

View File

@@ -29,6 +29,12 @@ namespace {
struct EfiSystemTablePointer *efi_systab_pointer = nullptr;
}
struct EfiDebugImageInfoTableHeader efi_m_debug_info_table_header = {
0,
0,
nullptr
};
EfiStatus efi_initialize_system_table_pointer(struct EfiSystemTable *system_table) {
uint32_t crc = 0;
constexpr auto EFI_SYSTEM_TABLE_SIGNATURE =

View File

@@ -20,6 +20,16 @@
#include <uefi/system_table.h>
#include <uefi/types.h>
#include <uefi/protocols/loaded_image_protocol.h>
static constexpr auto EFI_DEBUG_IMAGE_INFO_TABLE_GUID =
EfiGuid{0x49152e77,
0x1ada,
0x4764,
{0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b}};
static constexpr size_t EFI_DEBUG_IMAGE_INFO_UPDATE_IN_PROGRESS = 0x01;
static constexpr size_t EFI_DEBUG_IMAGE_INFO_TABLE_MODIFIED = 0x02;
struct EfiSystemTablePointer {
uint64_t signature;
@@ -27,6 +37,25 @@ struct EfiSystemTablePointer {
uint32_t crc32;
};
struct EfiDebugImageInfoNormal {
uint32_t image_info_type;
EfiLoadedImageProtocol *loaded_image_protocol_instance;
EfiHandle image_handle;
};
union EfiDebugImageInfo {
uint32_t *image_info_type;
struct EfiDebugImageInfoNormal *normal_image;
};
struct EfiDebugImageInfoTableHeader {
volatile uint32_t update_status;
uint32_t table_size;
union EfiDebugImageInfo *efi_debug_image_info_table;
};
EfiStatus efi_initialize_system_table_pointer(struct EfiSystemTable *system_table);
extern struct EfiDebugImageInfoTableHeader efi_m_debug_info_table_header;
#endif