mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
efi: Use device device path type Messaging for network interface node
When adding network interface node use Messaging device path with subtype MAC Address and device's MAC address as a value instead of Media Device path type with subtype File Path and path "Net" Signed-off-by: Oleksandr Tymoshenko <gonzo@bluezbox.com> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
456ca6ba04
commit
d7608aba38
2 changed files with 22 additions and 8 deletions
|
@ -268,6 +268,19 @@ struct efi_device_path {
|
|||
u16 length;
|
||||
};
|
||||
|
||||
struct efi_mac_addr {
|
||||
u8 addr[32];
|
||||
};
|
||||
|
||||
#define DEVICE_PATH_TYPE_MESSAGING_DEVICE 0x03
|
||||
# define DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR 0x0b
|
||||
|
||||
struct efi_device_path_mac_addr {
|
||||
struct efi_device_path dp;
|
||||
struct efi_mac_addr mac;
|
||||
u8 if_type;
|
||||
};
|
||||
|
||||
#define DEVICE_PATH_TYPE_MEDIA_DEVICE 0x04
|
||||
# define DEVICE_PATH_SUB_TYPE_FILE_PATH 0x04
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ struct efi_net_obj {
|
|||
struct efi_simple_network net;
|
||||
struct efi_simple_network_mode net_mode;
|
||||
/* Device path to the network adapter */
|
||||
struct efi_device_path_file_path dp[2];
|
||||
struct efi_device_path_mac_addr dp_mac;
|
||||
struct efi_device_path_file_path dp_end;
|
||||
/* PXE struct to transmit dhcp data */
|
||||
struct efi_pxe pxe;
|
||||
struct efi_pxe_mode pxe_mode;
|
||||
|
@ -205,7 +206,7 @@ static efi_status_t EFIAPI efi_net_open_dp(void *handle, efi_guid_t *protocol,
|
|||
struct efi_simple_network *net = handle;
|
||||
struct efi_net_obj *netobj = container_of(net, struct efi_net_obj, net);
|
||||
|
||||
*protocol_interface = netobj->dp;
|
||||
*protocol_interface = &netobj->dp_mac;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -236,11 +237,10 @@ void efi_net_set_dhcp_ack(void *pkt, int len)
|
|||
int efi_net_register(void **handle)
|
||||
{
|
||||
struct efi_net_obj *netobj;
|
||||
struct efi_device_path_file_path dp_net = {
|
||||
.dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE,
|
||||
.dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH,
|
||||
struct efi_device_path_mac_addr dp_net = {
|
||||
.dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE,
|
||||
.dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR,
|
||||
.dp.length = sizeof(dp_net),
|
||||
.str = { 'N', 'e', 't' },
|
||||
};
|
||||
struct efi_device_path_file_path dp_end = {
|
||||
.dp.type = DEVICE_PATH_TYPE_END,
|
||||
|
@ -279,8 +279,9 @@ int efi_net_register(void **handle)
|
|||
netobj->net.receive = efi_net_receive;
|
||||
netobj->net.mode = &netobj->net_mode;
|
||||
netobj->net_mode.state = EFI_NETWORK_STARTED;
|
||||
netobj->dp[0] = dp_net;
|
||||
netobj->dp[1] = dp_end;
|
||||
netobj->dp_mac = dp_net;
|
||||
netobj->dp_end = dp_end;
|
||||
memcpy(netobj->dp_mac.mac.addr, eth_get_ethaddr(), 6);
|
||||
memcpy(netobj->net_mode.current_address.mac_addr, eth_get_ethaddr(), 6);
|
||||
netobj->net_mode.max_packet_size = PKTSIZE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue