xref: /haiku/headers/private/kernel/platform/efi/protocol/managed-network.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 // Copyright 2016 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <efi/types.h>
8 #include <efi/protocol/simple-network.h>
9 
10 #define EFI_MANAGED_NETWORK_PROTOCOL_GUID \
11     {0x7ab33a91, 0xace5, 0x4326,{0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16}}
12 extern efi_guid ManagedNetworkProtocol;
13 
14 typedef struct {
15     efi_time  Timestamp;
16     efi_event RecycleEvent;
17     uint32_t PacketLength;
18     uint32_t HeaderLength;
19     uint32_t AddressLength;
20     uint32_t DataLength;
21     bool BroadcastFlag;
22     bool MulticastFlag;
23     bool PromiscuousFlag;
24     uint16_t  ProtocolType;
25     void* DestinationAddress;
26     void* SourceAddress;
27     void* MediaHeader;
28     void* PacketData;
29 } efi_managed_network_receive_data;
30 
31 typedef struct {
32     uint32_t FragmentLength;
33     void* FragmentBuffer;
34 } efi_managed_network_fragment_data;
35 
36 typedef struct {
37     efi_mac_addr* DestinationAddress;
38     efi_mac_addr* SourceAddress;
39     uint16_t ProtocolType;
40     uint32_t DataLength;
41     uint16_t HeaderLength;
42     uint16_t FragmentCount;
43     efi_managed_network_fragment_data FragmentTable[1];
44 } efi_managed_network_transmit_data;
45 
46 typedef struct {
47     uint32_t ReceivedQueueTimeoutValue;
48     uint32_t TransmitQueueTimeoutValue;
49     uint16_t ProtocolTypeFilter;
50     bool EnableUnicastReceive;
51     bool EnableMulticastReceive;
52     bool EnableBroadcastReceive;
53     bool EnablePromiscuousReceive;
54     bool FlushQueuesOnReset;
55     bool EnableReceiveTimestamps;
56     bool DisableBackgroundPolling;
57 } efi_managed_network_config_data;
58 
59 typedef struct {
60     efi_event Event;
61     efi_status Status;
62     union {
63         efi_managed_network_receive_data* RxData;
64         efi_managed_network_transmit_data* TxData;
65     } Packet;
66 } efi_managed_network_sync_completion_token;
67 
68 typedef struct efi_managed_network_protocol {
69     efi_status (*GetModeData) (struct efi_managed_network_protocol* self,
70                                efi_managed_network_config_data* mnp_config_data,
71                                efi_simple_network_mode* snp_mode_data) EFIAPI;
72 
73     efi_status (*Configure) (struct efi_managed_network_protocol* self,
74                              efi_managed_network_config_data* mnp_config_data) EFIAPI;
75 
76     efi_status (*McastIpToMac) (struct efi_managed_network_protocol* self,
77                                 bool ipv6_flag, efi_ip_addr* ip_addr, efi_mac_addr* mac_addr) EFIAPI;
78 
79     efi_status (*Groups) (struct efi_managed_network_protocol* self, bool join_flag,
80                           efi_mac_addr* mac_addr) EFIAPI;
81 
82     efi_status (*Transmit) (struct efi_managed_network_protocol* self,
83                             efi_managed_network_sync_completion_token* token) EFIAPI;
84 
85     efi_status (*Receive) (struct efi_managed_network_protocol* self,
86                            efi_managed_network_sync_completion_token* token) EFIAPI;
87 
88     efi_status (*Cancel) (struct efi_managed_network_protocol* self,
89                           efi_managed_network_sync_completion_token* token) EFIAPI;
90 
91     efi_status (*Poll) (struct efi_managed_network_protocol* self) EFIAPI;
92 } efi_managed_network_protocol;
93