From 68e936e7f425db42c366e51634e5356affdfbfb9 Mon Sep 17 00:00:00 2001 From: czapek1337 Date: Thu, 6 Oct 2022 05:37:22 +0200 Subject: [PATCH 1/3] readline: Fallback to SystemTable->ConIn --- common/lib/readline.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/lib/readline.c b/common/lib/readline.c index a3e0b59f..3021511c 100644 --- a/common/lib/readline.c +++ b/common/lib/readline.c @@ -267,7 +267,11 @@ int pit_sleep_and_quit_on_keypress(int seconds) { if (gBS->HandleProtocol(gST->ConsoleInHandle, &exproto_guid, (void **)&exproto) != EFI_SUCCESS) { if (gBS->HandleProtocol(gST->ConsoleInHandle, &sproto_guid, (void **)&sproto) != EFI_SUCCESS) { - panic(false, "Your input device doesn't have an input protocol!"); + if (gST->ConIn != NULL) { + sproto = gST->ConIn; + } else { + panic(false, "Your input device doesn't have an input protocol!"); + } } events[0] = sproto->WaitForKey; From 44a3f3f2f7e1c52ad2f6f53ec2991f091a87eb7c Mon Sep 17 00:00:00 2001 From: czapek1337 Date: Thu, 6 Oct 2022 05:38:06 +0200 Subject: [PATCH 2/3] disk: Use BLOCK_IO instead of DISK_IO --- common/drivers/disk.s2.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/common/drivers/disk.s2.c b/common/drivers/disk.s2.c index 51013e39..be838689 100644 --- a/common/drivers/disk.s2.c +++ b/common/drivers/disk.s2.c @@ -504,14 +504,6 @@ fail: break; } - EFI_GUID disk_io_guid = DISK_IO_PROTOCOL; - EFI_DISK_IO *disk_io = NULL; - - status = gBS->HandleProtocol(handles[i], &disk_io_guid, (void **)&disk_io); - if (status) { - continue; - } - EFI_BLOCK_IO *drive = NULL; status = gBS->HandleProtocol(handles[i], &block_io_guid, (void **)&drive); @@ -522,13 +514,12 @@ fail: if (drive->Media->LogicalPartition) continue; - uint64_t orig; - status = disk_io->ReadDisk(disk_io, drive->Media->MediaId, 0, sizeof(uint64_t), &orig); + status = drive->ReadBlocks(drive, drive->Media->MediaId, 0, 4096, unique_sector_pool); if (status) { continue; } - status = disk_io->WriteDisk(disk_io, drive->Media->MediaId, 0, sizeof(uint64_t), &orig); + status = drive->WriteBlocks(drive, drive->Media->MediaId, 0, 4096, unique_sector_pool); struct volume *block = ext_mem_alloc(sizeof(struct volume)); From 02c26a87385db1bef167c3e315c761cd773e9d11 Mon Sep 17 00:00:00 2001 From: czapek1337 Date: Thu, 6 Oct 2022 05:58:39 +0200 Subject: [PATCH 3/3] efi: Fallback to volume scan instead of panicking --- common/entry.s3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/entry.s3.c b/common/entry.s3.c index edd136f9..6750367a 100644 --- a/common/entry.s3.c +++ b/common/entry.s3.c @@ -104,7 +104,7 @@ could_not_match: (void **)&loaded_image); if (status) { - panic(false, "HandleProtocol failure (%x)", status); + goto could_not_match; } boot_volume = disk_volume_from_efi_handle(loaded_image->DeviceHandle);