summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2015-11-03 10:56:39 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2015-11-03 10:56:39 +0000
commit7da43b77f682d999b2b4a79a970ccc066c22648a (patch)
tree4c377e66259c5da2c8c8234ac63737164d652dd3 /sys/arch/amd64
parentc6197c71e92299fefbea08642195f419f3d37251 (diff)
Use "Loaded Image Protocol" instead of "Loaded Device Path Protocol"
to find the boot device since macbook doesn't support later protocol. reported by Joel Roberts and Bryan Vyhmeister
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/stand/efi/include/efiapi.h2
-rw-r--r--sys/arch/amd64/stand/efiboot/efiboot.c18
2 files changed, 11 insertions, 9 deletions
diff --git a/sys/arch/amd64/stand/efi/include/efiapi.h b/sys/arch/amd64/stand/efi/include/efiapi.h
index 05312e2a2db..e149c2c0ea1 100644
--- a/sys/arch/amd64/stand/efi/include/efiapi.h
+++ b/sys/arch/amd64/stand/efi/include/efiapi.h
@@ -364,7 +364,7 @@ EFI_STATUS
// Image handle
#define LOADED_IMAGE_PROTOCOL \
- { 0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
+ { 0x5B1B31A1, 0x9562, 0x11d2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B } }
#define EFI_LOADED_IMAGE_INFORMATION_REVISION 0x1000
typedef struct {
diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c
index a28818fd55f..373a0eecc13 100644
--- a/sys/arch/amd64/stand/efiboot/efiboot.c
+++ b/sys/arch/amd64/stand/efiboot/efiboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efiboot.c,v 1.6 2015/10/05 22:59:39 yasuoka Exp $ */
+/* $OpenBSD: efiboot.c,v 1.7 2015/11/03 10:56:38 yasuoka Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -46,8 +46,9 @@ EFI_PHYSICAL_ADDRESS heap;
EFI_LOADED_IMAGE *loadedImage;
UINTN heapsiz = 1 * 1024 * 1024;
UINTN mmap_key;
-static EFI_GUID imgdp_guid = { 0xbc62157e, 0x3e33, 0x4fec,
- { 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf }};
+static EFI_GUID imgp_guid = LOADED_IMAGE_PROTOCOL;
+static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL;
+static EFI_GUID devp_guid = DEVICE_PATH_PROTOCOL;
u_long efi_loadaddr;
static void efi_heap_init(void);
@@ -65,6 +66,7 @@ EFI_STATUS
efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
extern char *progname;
+ EFI_LOADED_IMAGE *imgp;
EFI_DEVICE_PATH *dp0 = NULL, *dp;
EFI_STATUS status;
EFI_PHYSICAL_ADDRESS stack;
@@ -77,8 +79,11 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
efi_video_init();
efi_heap_init();
- status = EFI_CALL(BS->HandleProtocol, image, &imgdp_guid,
- (void **)&dp0);
+ status = EFI_CALL(BS->HandleProtocol, image, &imgp_guid,
+ (void **)&imgp);
+ if (status == EFI_SUCCESS)
+ status = EFI_CALL(BS->HandleProtocol, imgp->DeviceHandle,
+ &devp_guid, (void **)&dp0);
if (status == EFI_SUCCESS) {
for (dp = dp0; !IsDevicePathEnd(dp);
dp = NextDevicePathNode(dp)) {
@@ -139,8 +144,6 @@ efi_cleanup(void)
/***********************************************************************
* Disk
***********************************************************************/
-static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL;
-static EFI_GUID devp_guid = DEVICE_PATH_PROTOCOL;
struct disklist_lh efi_disklist;
void
@@ -169,7 +172,6 @@ efi_diskprobe(void)
for (i = 0; i < sz / sizeof(EFI_HANDLE); i++) {
bootdev = 0;
- blkio = handles[i];
status = EFI_CALL(BS->HandleProtocol, handles[i], &blkio_guid,
(void **)&blkio);
if (EFI_ERROR(status))