|
|
5593c8 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
5593c8 |
From: Michael Chang <mchang@suse.com>
|
|
|
5593c8 |
Date: Wed, 15 Apr 2015 14:48:30 +0800
|
|
|
5593c8 |
Subject: [PATCH] efinet: UEFI IPv6 PXE support
|
|
|
5593c8 |
|
|
|
5593c8 |
When grub2 image is booted from UEFI IPv6 PXE, the DHCPv6 Reply packet is
|
|
|
5593c8 |
cached in firmware buffer which can be obtained by PXE Base Code protocol. The
|
|
|
5593c8 |
network interface can be setup through the parameters in that obtained packet.
|
|
|
5593c8 |
|
|
|
5593c8 |
Signed-off-by: Michael Chang <mchang@suse.com>
|
|
|
5593c8 |
Signed-off-by: Ken Lin <ken.lin@hpe.com>
|
|
|
5593c8 |
---
|
|
|
5593c8 |
grub-core/net/drivers/efi/efinet.c | 2 ++
|
|
|
5593c8 |
include/grub/efi/api.h | 71 +++++++++++++++++++++++---------------
|
|
|
5593c8 |
2 files changed, 46 insertions(+), 27 deletions(-)
|
|
|
5593c8 |
|
|
|
5593c8 |
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
|
|
|
fd0330 |
index 8e25680db0..014e5bf980 100644
|
|
|
5593c8 |
--- a/grub-core/net/drivers/efi/efinet.c
|
|
|
5593c8 |
+++ b/grub-core/net/drivers/efi/efinet.c
|
|
|
5593c8 |
@@ -409,6 +409,8 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
|
|
|
5593c8 |
grub_print_error ();
|
|
|
5593c8 |
if (device && path)
|
|
|
5593c8 |
grub_dprintf ("efinet", "device: `%s' path: `%s'\n", *device, *path);
|
|
|
5593c8 |
+ if (grub_errno)
|
|
|
5593c8 |
+ grub_print_error ();
|
|
|
5593c8 |
}
|
|
|
5593c8 |
else
|
|
|
5593c8 |
{
|
|
|
5593c8 |
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
|
|
fd0330 |
index 7614b58dca..91ab528e4d 100644
|
|
|
5593c8 |
--- a/include/grub/efi/api.h
|
|
|
5593c8 |
+++ b/include/grub/efi/api.h
|
|
|
5593c8 |
@@ -1524,31 +1524,6 @@ typedef union
|
|
|
5593c8 |
grub_efi_pxe_dhcpv6_packet_t dhcpv6;
|
|
|
5593c8 |
} grub_efi_pxe_packet_t;
|
|
|
5593c8 |
|
|
|
5593c8 |
-#define GRUB_EFI_PXE_MAX_IPCNT 8
|
|
|
5593c8 |
-#define GRUB_EFI_PXE_MAX_ARP_ENTRIES 8
|
|
|
5593c8 |
-#define GRUB_EFI_PXE_MAX_ROUTE_ENTRIES 8
|
|
|
5593c8 |
-
|
|
|
5593c8 |
-typedef struct grub_efi_pxe_ip_filter
|
|
|
5593c8 |
-{
|
|
|
5593c8 |
- grub_efi_uint8_t filters;
|
|
|
5593c8 |
- grub_efi_uint8_t ip_count;
|
|
|
5593c8 |
- grub_efi_uint16_t reserved;
|
|
|
5593c8 |
- grub_efi_ip_address_t ip_list[GRUB_EFI_PXE_MAX_IPCNT];
|
|
|
5593c8 |
-} grub_efi_pxe_ip_filter_t;
|
|
|
5593c8 |
-
|
|
|
5593c8 |
-typedef struct grub_efi_pxe_arp_entry
|
|
|
5593c8 |
-{
|
|
|
5593c8 |
- grub_efi_ip_address_t ip_addr;
|
|
|
5593c8 |
- grub_efi_mac_address_t mac_addr;
|
|
|
5593c8 |
-} grub_efi_pxe_arp_entry_t;
|
|
|
5593c8 |
-
|
|
|
5593c8 |
-typedef struct grub_efi_pxe_route_entry
|
|
|
5593c8 |
-{
|
|
|
5593c8 |
- grub_efi_ip_address_t ip_addr;
|
|
|
5593c8 |
- grub_efi_ip_address_t subnet_mask;
|
|
|
5593c8 |
- grub_efi_ip_address_t gateway_addr;
|
|
|
5593c8 |
-} grub_efi_pxe_route_entry_t;
|
|
|
5593c8 |
-
|
|
|
5593c8 |
typedef struct grub_efi_pxe_icmp_error
|
|
|
5593c8 |
{
|
|
|
5593c8 |
grub_efi_uint8_t type;
|
|
|
5593c8 |
@@ -1574,6 +1549,48 @@ typedef struct grub_efi_pxe_tftp_error
|
|
|
5593c8 |
grub_efi_char8_t error_string[127];
|
|
|
5593c8 |
} grub_efi_pxe_tftp_error_t;
|
|
|
5593c8 |
|
|
|
5593c8 |
+typedef struct {
|
|
|
5593c8 |
+ grub_uint8_t addr[4];
|
|
|
5593c8 |
+} grub_efi_pxe_ipv4_address_t;
|
|
|
5593c8 |
+
|
|
|
5593c8 |
+typedef struct {
|
|
|
5593c8 |
+ grub_uint8_t addr[16];
|
|
|
5593c8 |
+} grub_efi_pxe_ipv6_address_t;
|
|
|
5593c8 |
+
|
|
|
5593c8 |
+typedef struct {
|
|
|
5593c8 |
+ grub_uint8_t addr[32];
|
|
|
5593c8 |
+} grub_efi_pxe_mac_address_t;
|
|
|
5593c8 |
+
|
|
|
5593c8 |
+typedef union {
|
|
|
5593c8 |
+ grub_uint32_t addr[4];
|
|
|
5593c8 |
+ grub_efi_pxe_ipv4_address_t v4;
|
|
|
5593c8 |
+ grub_efi_pxe_ipv6_address_t v6;
|
|
|
5593c8 |
+} grub_efi_pxe_ip_address_t;
|
|
|
5593c8 |
+
|
|
|
5593c8 |
+#define GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT 8
|
|
|
5593c8 |
+typedef struct grub_efi_pxe_ip_filter
|
|
|
5593c8 |
+{
|
|
|
5593c8 |
+ grub_efi_uint8_t filters;
|
|
|
5593c8 |
+ grub_efi_uint8_t ip_count;
|
|
|
5593c8 |
+ grub_efi_uint16_t reserved;
|
|
|
5593c8 |
+ grub_efi_ip_address_t ip_list[GRUB_EFI_PXE_BASE_CODE_MAX_IPCNT];
|
|
|
5593c8 |
+} grub_efi_pxe_ip_filter_t;
|
|
|
5593c8 |
+
|
|
|
5593c8 |
+typedef struct {
|
|
|
5593c8 |
+ grub_efi_pxe_ip_address_t ip_addr;
|
|
|
5593c8 |
+ grub_efi_pxe_mac_address_t mac_addr;
|
|
|
5593c8 |
+} grub_efi_pxe_arp_entry_t;
|
|
|
5593c8 |
+
|
|
|
5593c8 |
+typedef struct {
|
|
|
5593c8 |
+ grub_efi_pxe_ip_address_t ip_addr;
|
|
|
5593c8 |
+ grub_efi_pxe_ip_address_t subnet_mask;
|
|
|
5593c8 |
+ grub_efi_pxe_ip_address_t gw_addr;
|
|
|
5593c8 |
+} grub_efi_pxe_route_entry_t;
|
|
|
5593c8 |
+
|
|
|
5593c8 |
+
|
|
|
5593c8 |
+#define GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES 8
|
|
|
5593c8 |
+#define GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES 8
|
|
|
5593c8 |
+
|
|
|
5593c8 |
typedef struct grub_efi_pxe_mode
|
|
|
5593c8 |
{
|
|
|
5593c8 |
grub_efi_boolean_t started;
|
|
|
5593c8 |
@@ -1605,9 +1622,9 @@ typedef struct grub_efi_pxe_mode
|
|
|
5593c8 |
grub_efi_pxe_packet_t pxe_bis_reply;
|
|
|
5593c8 |
grub_efi_pxe_ip_filter_t ip_filter;
|
|
|
5593c8 |
grub_efi_uint32_t arp_cache_entries;
|
|
|
5593c8 |
- grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_MAX_ARP_ENTRIES];
|
|
|
5593c8 |
+ grub_efi_pxe_arp_entry_t arp_cache[GRUB_EFI_PXE_BASE_CODE_MAX_ARP_ENTRIES];
|
|
|
5593c8 |
grub_efi_uint32_t route_table_entries;
|
|
|
5593c8 |
- grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_MAX_ROUTE_ENTRIES];
|
|
|
5593c8 |
+ grub_efi_pxe_route_entry_t route_table[GRUB_EFI_PXE_BASE_CODE_MAX_ROUTE_ENTRIES];
|
|
|
5593c8 |
grub_efi_pxe_icmp_error_t icmp_error;
|
|
|
5593c8 |
grub_efi_pxe_tftp_error_t tftp_error;
|
|
|
5593c8 |
} grub_efi_pxe_mode_t;
|