summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2019-08-13 09:00:21 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2019-08-13 09:00:21 +0000
commit62f4b393d1b376dfd19fdeaae5f11782ee9682fe (patch)
treeec6a00d5ff26eff01cc9b008d4a5dc0feaf2cacc
parentcc619e08eaa74544ac1447b29b8d6ed2c0e79d2b (diff)
Allow PXE booting using u-boot by relaxing our requirements
of the EFI PXE protocol. This also brings us in line with the GRUB2 implementation. Tested by naddy@ to behave the same Tested by sven falempin on his Pine64
-rw-r--r--sys/arch/amd64/stand/efi32/conf.c4
-rw-r--r--sys/arch/amd64/stand/efi32/efipxe.c28
-rw-r--r--sys/arch/amd64/stand/efi64/conf.c4
-rw-r--r--sys/arch/amd64/stand/efi64/efipxe.c28
-rw-r--r--sys/arch/amd64/stand/efiboot/conf.c4
-rw-r--r--sys/arch/amd64/stand/efiboot/efipxe.c28
-rw-r--r--sys/arch/arm64/stand/efiboot/conf.c4
-rw-r--r--sys/arch/arm64/stand/efiboot/efipxe.c17
-rw-r--r--sys/arch/armv7/stand/efiboot/conf.c4
-rw-r--r--sys/arch/armv7/stand/efiboot/efipxe.c17
10 files changed, 43 insertions, 95 deletions
diff --git a/sys/arch/amd64/stand/efi32/conf.c b/sys/arch/amd64/stand/efi32/conf.c
index 201b2f2d857..e8e52605587 100644
--- a/sys/arch/amd64/stand/efi32/conf.c
+++ b/sys/arch/amd64/stand/efi32/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.4 2019/08/13 08:17:52 patrick Exp $ */
+/* $OpenBSD: conf.c,v 1.5 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -39,7 +39,7 @@
#include "efidev.h"
#include "efipxe.h"
-const char version[] = "3.45";
+const char version[] = "3.46";
#ifdef EFI_DEBUG
int debug = 0;
diff --git a/sys/arch/amd64/stand/efi32/efipxe.c b/sys/arch/amd64/stand/efi32/efipxe.c
index 382a05382a1..817cf8e8f22 100644
--- a/sys/arch/amd64/stand/efi32/efipxe.c
+++ b/sys/arch/amd64/stand/efi32/efipxe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efipxe.c,v 1.1 2019/05/11 02:33:34 mlarkin Exp $ */
+/* $OpenBSD: efipxe.c,v 1.2 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
*
@@ -66,7 +66,7 @@ efi_pxeprobe(void)
return;
for (i = 0; i < nhandles; i++) {
- EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp = NULL;
+ EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp;
status = EFI_CALL(BS->HandleProtocol, handles[i],
&devp_guid, (void **)&dp0);
@@ -85,23 +85,13 @@ efi_pxeprobe(void)
if (pxe->Mode == NULL)
continue;
- if (pxe->Mode->DhcpAckReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->DhcpAck;
- }
- if (pxe->Mode->PxeReplyReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->PxeReply;
- }
-
- if (dhcp) {
- memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
- memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
- memcpy(boothw, dhcp->BootpHwAddr, sizeof(boothw));
- bootmac = boothw;
- PXE = pxe;
- break;
- }
+ dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)&pxe->Mode->DhcpAck;
+ memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
+ memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
+ memcpy(boothw, dhcp->BootpHwAddr, sizeof(boothw));
+ bootmac = boothw;
+ PXE = pxe;
+ break;
}
}
diff --git a/sys/arch/amd64/stand/efi64/conf.c b/sys/arch/amd64/stand/efi64/conf.c
index 87fd97c74ef..7e04209e118 100644
--- a/sys/arch/amd64/stand/efi64/conf.c
+++ b/sys/arch/amd64/stand/efi64/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.3 2019/08/04 13:45:14 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.4 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -39,7 +39,7 @@
#include "efidev.h"
#include "efipxe.h"
-const char version[] = "3.45";
+const char version[] = "3.46";
#ifdef EFI_DEBUG
int debug = 0;
diff --git a/sys/arch/amd64/stand/efi64/efipxe.c b/sys/arch/amd64/stand/efi64/efipxe.c
index b29b7fd162a..817cf8e8f22 100644
--- a/sys/arch/amd64/stand/efi64/efipxe.c
+++ b/sys/arch/amd64/stand/efi64/efipxe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efipxe.c,v 1.1 2019/05/11 02:36:10 mlarkin Exp $ */
+/* $OpenBSD: efipxe.c,v 1.2 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
*
@@ -66,7 +66,7 @@ efi_pxeprobe(void)
return;
for (i = 0; i < nhandles; i++) {
- EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp = NULL;
+ EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp;
status = EFI_CALL(BS->HandleProtocol, handles[i],
&devp_guid, (void **)&dp0);
@@ -85,23 +85,13 @@ efi_pxeprobe(void)
if (pxe->Mode == NULL)
continue;
- if (pxe->Mode->DhcpAckReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->DhcpAck;
- }
- if (pxe->Mode->PxeReplyReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->PxeReply;
- }
-
- if (dhcp) {
- memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
- memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
- memcpy(boothw, dhcp->BootpHwAddr, sizeof(boothw));
- bootmac = boothw;
- PXE = pxe;
- break;
- }
+ dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)&pxe->Mode->DhcpAck;
+ memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
+ memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
+ memcpy(boothw, dhcp->BootpHwAddr, sizeof(boothw));
+ bootmac = boothw;
+ PXE = pxe;
+ break;
}
}
diff --git a/sys/arch/amd64/stand/efiboot/conf.c b/sys/arch/amd64/stand/efiboot/conf.c
index ce8ecfd9478..2a1eadc49f0 100644
--- a/sys/arch/amd64/stand/efiboot/conf.c
+++ b/sys/arch/amd64/stand/efiboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.22 2019/08/04 13:45:14 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.23 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -39,7 +39,7 @@
#include "efidev.h"
#include "efipxe.h"
-const char version[] = "3.45";
+const char version[] = "3.46";
#ifdef EFI_DEBUG
int debug = 0;
diff --git a/sys/arch/amd64/stand/efiboot/efipxe.c b/sys/arch/amd64/stand/efiboot/efipxe.c
index dfaa60d1a29..47bdede487f 100644
--- a/sys/arch/amd64/stand/efiboot/efipxe.c
+++ b/sys/arch/amd64/stand/efiboot/efipxe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efipxe.c,v 1.4 2019/04/25 20:19:30 naddy Exp $ */
+/* $OpenBSD: efipxe.c,v 1.5 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
*
@@ -66,7 +66,7 @@ efi_pxeprobe(void)
return;
for (i = 0; i < nhandles; i++) {
- EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp = NULL;
+ EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp;
status = EFI_CALL(BS->HandleProtocol, handles[i],
&devp_guid, (void **)&dp0);
@@ -85,23 +85,13 @@ efi_pxeprobe(void)
if (pxe->Mode == NULL)
continue;
- if (pxe->Mode->DhcpAckReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->DhcpAck;
- }
- if (pxe->Mode->PxeReplyReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->PxeReply;
- }
-
- if (dhcp) {
- memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
- memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
- memcpy(boothw, dhcp->BootpHwAddr, sizeof(boothw));
- bootmac = boothw;
- PXE = pxe;
- break;
- }
+ dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)&pxe->Mode->DhcpAck;
+ memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
+ memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
+ memcpy(boothw, dhcp->BootpHwAddr, sizeof(boothw));
+ bootmac = boothw;
+ PXE = pxe;
+ break;
}
}
diff --git a/sys/arch/arm64/stand/efiboot/conf.c b/sys/arch/arm64/stand/efiboot/conf.c
index 3cba4d95faa..3b47ff62681 100644
--- a/sys/arch/arm64/stand/efiboot/conf.c
+++ b/sys/arch/arm64/stand/efiboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.22 2019/08/12 19:17:35 kettenis Exp $ */
+/* $OpenBSD: conf.c,v 1.23 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -45,7 +45,7 @@
#include "efipxe.h"
#include "softraid_arm64.h"
-const char version[] = "0.18";
+const char version[] = "0.19";
int debug = 0;
struct fs_ops file_system[] = {
diff --git a/sys/arch/arm64/stand/efiboot/efipxe.c b/sys/arch/arm64/stand/efiboot/efipxe.c
index 176f65b4c0d..9a9af5886fa 100644
--- a/sys/arch/arm64/stand/efiboot/efipxe.c
+++ b/sys/arch/arm64/stand/efiboot/efipxe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efipxe.c,v 1.5 2019/04/25 20:19:30 naddy Exp $ */
+/* $OpenBSD: efipxe.c,v 1.6 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
*
@@ -89,7 +89,7 @@ efi_pxeprobe(void)
return;
for (i = 0; i < nhandles; i++) {
- EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp = NULL;
+ EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp;
status = EFI_CALL(BS->HandleProtocol, handles[i],
&devp_guid, (void **)&dp0);
@@ -113,21 +113,10 @@ efi_pxeprobe(void)
if (pxe->Mode == NULL)
continue;
- if (pxe->Mode->DhcpAckReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->DhcpAck;
- }
- if (pxe->Mode->PxeReplyReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->PxeReply;
- }
-
- if (!dhcp)
- continue;
-
if (pxe->Mtftp != NULL)
use_mtftp = 1;
+ dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)&pxe->Mode->DhcpAck;
memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
memcpy(&gateip, dhcp->BootpSiAddr, sizeof(gateip));
diff --git a/sys/arch/armv7/stand/efiboot/conf.c b/sys/arch/armv7/stand/efiboot/conf.c
index 0cfba5f4115..e0615de7a3a 100644
--- a/sys/arch/armv7/stand/efiboot/conf.c
+++ b/sys/arch/armv7/stand/efiboot/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.18 2019/08/04 13:45:15 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.19 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -36,7 +36,7 @@
#include "efidev.h"
#include "efipxe.h"
-const char version[] = "1.5";
+const char version[] = "1.6";
int debug = 0;
struct fs_ops file_system[] = {
diff --git a/sys/arch/armv7/stand/efiboot/efipxe.c b/sys/arch/armv7/stand/efiboot/efipxe.c
index 7013a5bb7ee..654d3474ab6 100644
--- a/sys/arch/armv7/stand/efiboot/efipxe.c
+++ b/sys/arch/armv7/stand/efiboot/efipxe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efipxe.c,v 1.2 2019/04/25 20:19:30 naddy Exp $ */
+/* $OpenBSD: efipxe.c,v 1.3 2019/08/13 09:00:20 patrick Exp $ */
/*
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
*
@@ -89,7 +89,7 @@ efi_pxeprobe(void)
return;
for (i = 0; i < nhandles; i++) {
- EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp = NULL;
+ EFI_PXE_BASE_CODE_DHCPV4_PACKET *dhcp;
status = EFI_CALL(BS->HandleProtocol, handles[i],
&devp_guid, (void **)&dp0);
@@ -113,21 +113,10 @@ efi_pxeprobe(void)
if (pxe->Mode == NULL)
continue;
- if (pxe->Mode->DhcpAckReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->DhcpAck;
- }
- if (pxe->Mode->PxeReplyReceived) {
- dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)
- &pxe->Mode->PxeReply;
- }
-
- if (!dhcp)
- continue;
-
if (pxe->Mtftp != NULL)
use_mtftp = 1;
+ dhcp = (EFI_PXE_BASE_CODE_DHCPV4_PACKET *)&pxe->Mode->DhcpAck;
memcpy(&bootip, dhcp->BootpYiAddr, sizeof(bootip));
memcpy(&servip, dhcp->BootpSiAddr, sizeof(servip));
memcpy(&gateip, dhcp->BootpSiAddr, sizeof(gateip));