From c17f116572bef7f1b2ef36c47da2dd5b19c2ee2c Mon Sep 17 00:00:00 2001 From: Patrick Wildt Date: Sat, 25 Nov 2017 19:02:08 +0000 Subject: Implement network boot support in efiboot(8). This changes efiboot(8) to recognize if it has been booted via PXE. The new TFTP file system layer will then use the matching PXE base code protocol handle to load the files. Since this uses the PXE base code protocol for abstraction instead of the raw Simple Network protocol this will at this point not work on u-boot based machines as needed on ARM. Feedback and ok tom@ Also tested by afresh1@ --- sys/arch/amd64/stand/efiboot/efiboot.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'sys/arch/amd64/stand/efiboot/efiboot.c') diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c index 90bd85576fd..4e2f63aa9fc 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.27 2017/11/06 09:08:53 yasuoka Exp $ */ +/* $OpenBSD: efiboot.c,v 1.28 2017/11/25 19:02:07 patrick Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -52,9 +52,8 @@ static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL; static EFI_GUID devp_guid = DEVICE_PATH_PROTOCOL; u_long efi_loadaddr; -static int efi_device_path_depth(EFI_DEVICE_PATH *dp, int); -static int efi_device_path_ncmp(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *, - int); +int efi_device_path_depth(EFI_DEVICE_PATH *dp, int); +int efi_device_path_ncmp(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *, int); static void efi_heap_init(void); static void efi_memprobe_internal(void); static void efi_video_init(void); @@ -101,6 +100,11 @@ efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) ? 0x1e0 : 0x80; efi_bootdp = dp0; break; + } else if (DevicePathType(dp) == MESSAGING_DEVICE_PATH&& + DevicePathSubType(dp) == MSG_MAC_ADDR_DP) { + bios_bootdev = 0x0; + efi_bootdp = dp0; + break; } } } @@ -233,7 +237,7 @@ next: * Determine the number of nodes up to, but not including, the first * node of the specified type. */ -static int +int efi_device_path_depth(EFI_DEVICE_PATH *dp, int dptype) { int i; @@ -246,7 +250,7 @@ efi_device_path_depth(EFI_DEVICE_PATH *dp, int dptype) return (-1); } -static int +int efi_device_path_ncmp(EFI_DEVICE_PATH *dpa, EFI_DEVICE_PATH *dpb, int deptn) { int i, cmp; -- cgit v1.2.3