mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2025-02-25 18:55:23 -06:00
Add code for debugging EFI display problems.
This commit is contained in:
16
boot/efi.h
16
boot/efi.h
@@ -23,6 +23,7 @@
|
||||
#define EFI_INVALID_PARAMETER (NATIVE_MSB | 2)
|
||||
#define EFI_UNSUPPORTED (NATIVE_MSB | 3)
|
||||
#define EFI_BUFFER_TOO_SMALL (NATIVE_MSB | 5)
|
||||
#define EFI_NOT_READY (NATIVE_MSB | 6)
|
||||
#define EFI_NOT_FOUND (NATIVE_MSB | 14)
|
||||
#define EFI_ABORTED (NATIVE_MSB | 21)
|
||||
|
||||
@@ -126,6 +127,17 @@ typedef struct {
|
||||
uint32_t reserved;
|
||||
} efi_table_header_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t scan_code;
|
||||
efi_char16_t ch;
|
||||
} efi_input_key_t;
|
||||
|
||||
typedef struct efi_simple_text_in_s {
|
||||
void *reset;
|
||||
efi_status_t (efiapi *read_key_stroke)(struct efi_simple_text_in_s *, efi_input_key_t *);
|
||||
void *test_string;
|
||||
} efi_simple_text_in_t;
|
||||
|
||||
typedef struct efi_simple_text_out_s {
|
||||
void *reset;
|
||||
efi_status_t (efiapi *output_string)(struct efi_simple_text_out_s *, efi_char16_t *);
|
||||
@@ -233,9 +245,9 @@ typedef struct {
|
||||
efi_char16_t *fw_vendor;
|
||||
uint32_t fw_revision;
|
||||
efi_handle_t con_in_handle;
|
||||
void *con_in;
|
||||
efi_simple_text_in_t *con_in;
|
||||
efi_handle_t con_out_handle;
|
||||
efi_simple_text_out_t *con_out;
|
||||
efi_simple_text_out_t *con_out;
|
||||
efi_handle_t std_err_handle;
|
||||
efi_simple_text_out_t *std_err;
|
||||
void *runtime_services;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "string.h"
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Constants
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -82,7 +84,7 @@ static void print_string(char *str)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
static void print_dec(unsigned value)
|
||||
{
|
||||
char buffer[16];
|
||||
@@ -109,6 +111,13 @@ static void print_hex(uintptr_t value)
|
||||
} while (value > 0);
|
||||
print_string(str);
|
||||
}
|
||||
|
||||
static void wait_for_key(void)
|
||||
{
|
||||
efi_input_key_t input_key;
|
||||
|
||||
while (efi_call_proto(efi_table_attr(sys_table, con_in), read_key_stroke, &input_key) == EFI_NOT_READY) {}
|
||||
}
|
||||
#endif
|
||||
|
||||
static efi_memory_desc_t *get_memory_desc(uintptr_t map_addr, size_t desc_size, size_t n)
|
||||
@@ -269,6 +278,9 @@ static efi_status_t set_screen_info_from_gop(screen_info_t *si, efi_handle_t *ha
|
||||
}
|
||||
}
|
||||
if (!gop) {
|
||||
#if DEBUG
|
||||
print_string("GOP not found\n");
|
||||
#endif
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -337,6 +349,28 @@ static efi_status_t set_screen_info_from_gop(screen_info_t *si, efi_handle_t *ha
|
||||
}
|
||||
si->lfb_size = si->lfb_linelength * si->lfb_height;
|
||||
|
||||
#if DEBUG
|
||||
print_string("FB base : ");
|
||||
print_hex(si->lfb_base);
|
||||
print_string("\n");
|
||||
print_string("FB size : ");
|
||||
print_dec(si->lfb_width);
|
||||
print_string(" x ");
|
||||
print_dec(si->lfb_height);
|
||||
print_string("\n");
|
||||
print_string("FB format :");
|
||||
print_string(" R"); print_dec(si->red_size);
|
||||
print_string(" G"); print_dec(si->green_size);
|
||||
print_string(" B"); print_dec(si->blue_size);
|
||||
print_string(" A"); print_dec(si->rsvd_size);
|
||||
print_string("\n");
|
||||
print_string("FB stride : ");
|
||||
print_dec(si->lfb_linelength);
|
||||
print_string("\n");
|
||||
print_string("Press any key to continue...\n");
|
||||
wait_for_key();
|
||||
#endif
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user