Skip to content

Commit

Permalink
[efi] Improve efi_wrap debugging
Browse files Browse the repository at this point in the history
Add debug wrappers for more boot services functions, and print
symbolic values rather than raw numbers where possible.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Aug 27, 2015
1 parent e08d7cc commit c522c11
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 13 deletions.
4 changes: 4 additions & 0 deletions src/include/ipxe/efi/efi.h
Expand Up @@ -202,6 +202,10 @@ extern EFI_SYSTEM_TABLE *efi_systab;

extern const __attribute__ (( pure )) char * efi_guid_ntoa ( EFI_GUID *guid );
extern const __attribute__ (( pure )) char *
efi_locate_search_type_name ( EFI_LOCATE_SEARCH_TYPE search_type );
extern const __attribute__ (( pure )) char *
efi_open_attributes_name ( unsigned int attributes );
extern const __attribute__ (( pure )) char *
efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path );
extern const __attribute__ (( pure )) char *
efi_handle_name ( EFI_HANDLE handle );
Expand Down
23 changes: 22 additions & 1 deletion src/interface/efi/efi_debug.c
Expand Up @@ -189,6 +189,26 @@ const __attribute__ (( pure )) char * efi_guid_ntoa ( EFI_GUID *guid ) {
return uuid_ntoa ( &u.uuid );
}

/**
* Name locate search type
*
* @v search_type Locate search type
* @ret name Locate search type name
*/
const __attribute__ (( pure )) char *
efi_locate_search_type_name ( EFI_LOCATE_SEARCH_TYPE search_type ) {
static char buf[16];

switch ( search_type ) {
case AllHandles : return "AllHandles";
case ByRegisterNotify: return "ByRegisterNotify";
case ByProtocol: return "ByProtocol";
default:
snprintf ( buf, sizeof ( buf ), "UNKNOWN<%d>", search_type );
return buf;
}
}

/**
* Name protocol open attributes
*
Expand All @@ -200,7 +220,8 @@ const __attribute__ (( pure )) char * efi_guid_ntoa ( EFI_GUID *guid ) {
* (T)EST_PROTOCOL, BY_(C)HILD_CONTROLLER, BY_(D)RIVER, and
* E(X)CLUSIVE.
*/
static const char * efi_open_attributes_name ( unsigned int attributes ) {
const __attribute__ (( pure )) char *
efi_open_attributes_name ( unsigned int attributes ) {
static char attribute_chars[] = "HGTCDX";
static char name[ sizeof ( attribute_chars ) ];
char *tmp = name;
Expand Down

0 comments on commit c522c11

Please sign in to comment.