TianoCore EDK2 master
Loading...
Searching...
No Matches
MnpImpl.h
Go to the documentation of this file.
1
9#ifndef _MNP_IMPL_H_
10#define _MNP_IMPL_H_
11
12#include "MnpDriver.h"
13
14#define NET_ETHER_FCS_SIZE 4
15
16#define MNP_SYS_POLL_INTERVAL (10 * TICKS_PER_MS) // 10 milliseconds
17#define MNP_TIMEOUT_CHECK_INTERVAL (50 * TICKS_PER_MS) // 50 milliseconds
18#define MNP_MEDIA_DETECT_INTERVAL (500 * TICKS_PER_MS) // 500 milliseconds
19#define MNP_TX_TIMEOUT_TIME (500 * TICKS_PER_MS) // 500 milliseconds
20#define MNP_INIT_NET_BUFFER_NUM 512
21#define MNP_NET_BUFFER_INCREASEMENT 64
22#define MNP_MAX_NET_BUFFER_NUM 65536
23#define MNP_TX_BUFFER_INCREASEMENT 32 // Same as the recycling Q length for xmit_done in UNDI command.
24#define MNP_MAX_TX_BUFFER_NUM 65536
25
26#define MNP_MAX_RCVD_PACKET_QUE_SIZE 256
27
28#define MNP_RECEIVE_UNICAST 0x01
29#define MNP_RECEIVE_BROADCAST 0x02
30
31#define UNICAST_PACKET MNP_RECEIVE_UNICAST
32#define BROADCAST_PACKET MNP_RECEIVE_BROADCAST
33
34#define MNP_INSTANCE_DATA_SIGNATURE SIGNATURE_32 ('M', 'n', 'p', 'I')
35
36#define MNP_INSTANCE_DATA_FROM_THIS(a) \
37 CR ( \
38 (a), \
39 MNP_INSTANCE_DATA, \
40 ManagedNetwork, \
41 MNP_INSTANCE_DATA_SIGNATURE \
42 )
43
44typedef struct {
45 UINT32 Signature;
46
47 MNP_SERVICE_DATA *MnpServiceData;
48
49 EFI_HANDLE Handle;
50
51 LIST_ENTRY InstEntry;
52
53 EFI_MANAGED_NETWORK_PROTOCOL ManagedNetwork;
54
55 BOOLEAN Configured;
56 BOOLEAN Destroyed;
57
58 LIST_ENTRY GroupCtrlBlkList;
59
60 NET_MAP RxTokenMap;
61
62 LIST_ENTRY RxDeliveredPacketQueue;
63 LIST_ENTRY RcvdPacketQueue;
64 UINTN RcvdPacketQueueSize;
65
67
68 UINT8 ReceiveFilter;
70
71typedef struct {
72 LIST_ENTRY AddrEntry;
73 EFI_MAC_ADDRESS Address;
74 INTN RefCnt;
76
77typedef struct {
78 LIST_ENTRY CtrlBlkEntry;
79 MNP_GROUP_ADDRESS *GroupAddress;
81
82typedef struct {
83 LIST_ENTRY WrapEntry;
84 MNP_INSTANCE_DATA *Instance;
86 NET_BUF *Nbuf;
87 UINT64 TimeoutTick;
89
90#define MNP_TX_BUF_WRAP_SIGNATURE SIGNATURE_32 ('M', 'T', 'B', 'W')
91
92typedef struct {
93 UINT32 Signature;
94 LIST_ENTRY WrapEntry; // Link to FreeTxBufList
95 LIST_ENTRY AllEntry; // Link to AllTxBufList
96 BOOLEAN InUse;
97 UINT8 TxBuf[1];
99
114 IN OUT MNP_DEVICE_DATA *MnpDeviceData,
115 IN EFI_HANDLE ImageHandle,
116 IN EFI_HANDLE ControllerHandle
117 );
118
126VOID
128 IN OUT MNP_DEVICE_DATA *MnpDeviceData,
129 IN EFI_HANDLE ImageHandle
130 );
131
145 IN MNP_DEVICE_DATA *MnpDeviceData,
146 IN UINT16 VlanId,
147 IN UINT8 Priority OPTIONAL
148 );
149
164 IN OUT MNP_SERVICE_DATA *MnpServiceData,
165 IN EFI_HANDLE ImageHandle,
166 IN EFI_HANDLE ControllerHandle
167 );
168
180 IN OUT MNP_SERVICE_DATA *MnpServiceData
181 );
182
194 IN OUT MNP_SERVICE_DATA *MnpServiceData
195 );
196
208 IN MNP_DEVICE_DATA *MnpDeviceData,
209 IN UINT16 VlanId
210 );
211
220VOID
222 IN MNP_SERVICE_DATA *MnpServiceData,
223 IN OUT MNP_INSTANCE_DATA *Instance
224 );
225
241EFIAPI
243 IN NET_MAP *Map,
244 IN NET_MAP_ITEM *Item,
245 IN VOID *Arg
246 );
247
264EFIAPI
266 IN OUT NET_MAP *Map,
267 IN OUT NET_MAP_ITEM *Item,
268 IN VOID *Arg
269 );
270
277VOID
279 IN OUT MNP_INSTANCE_DATA *Instance
280 );
281
297 IN OUT MNP_INSTANCE_DATA *Instance,
298 IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL
299 );
300
318 IN OUT MNP_INSTANCE_DATA *Instance,
319 IN BOOLEAN JoinFlag,
320 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL,
321 IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL
322 );
323
333BOOLEAN
335 IN MNP_INSTANCE_DATA *Instance,
337 );
338
355 IN MNP_SERVICE_DATA *MnpServiceData,
357 OUT UINT8 **PktBuf,
358 OUT UINT32 *PktLen
359 );
360
380 IN MNP_SERVICE_DATA *MnpServiceData,
381 IN UINT8 *Packet,
382 IN UINT32 Length,
384 );
385
399 IN OUT MNP_INSTANCE_DATA *Instance
400 );
401
410VOID
411EFIAPI
413 IN EFI_EVENT Event,
414 IN VOID *Context
415 );
416
430 IN OUT MNP_DEVICE_DATA *MnpDeviceData
431 );
432
444NET_BUF *
446 IN OUT MNP_DEVICE_DATA *MnpDeviceData
447 );
448
456VOID
458 IN OUT MNP_DEVICE_DATA *MnpDeviceData,
459 IN OUT NET_BUF *Nbuf
460 );
461
473UINT8 *
475 IN OUT MNP_DEVICE_DATA *MnpDeviceData
476 );
477
489 IN OUT MNP_DEVICE_DATA *MnpDeviceData
490 );
491
499VOID
500EFIAPI
502 IN EFI_EVENT Event,
503 IN VOID *Context
504 );
505
513VOID
514EFIAPI
516 IN EFI_EVENT Event,
517 IN VOID *Context
518 );
519
528VOID
529EFIAPI
531 IN EFI_EVENT Event,
532 IN VOID *Context
533 );
534
561EFIAPI
564 OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL,
565 OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL
566 );
567
621EFIAPI
624 IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL
625 );
626
658EFIAPI
661 IN BOOLEAN Ipv6Flag,
662 IN EFI_IP_ADDRESS *IpAddress,
663 OUT EFI_MAC_ADDRESS *MacAddress
664 );
665
703EFIAPI
704MnpGroups (
706 IN BOOLEAN JoinFlag,
707 IN EFI_MAC_ADDRESS *MacAddress OPTIONAL
708 );
709
766EFIAPI
770 );
771
802EFIAPI
803MnpCancel (
806 );
807
844EFIAPI
848 );
849
877EFIAPI
878MnpPoll (
880 );
881
895 IN MNP_DEVICE_DATA *MnpDeviceData
896 );
897
898#endif
UINT64 UINTN
INT64 INTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS EFIAPI MnpMcastIpToMac(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN BOOLEAN Ipv6Flag, IN EFI_IP_ADDRESS *IpAddress, OUT EFI_MAC_ADDRESS *MacAddress)
Definition: MnpMain.c:217
VOID EFIAPI MnpCheckMediaStatus(IN EFI_EVENT Event, IN VOID *Context)
Definition: MnpIo.c:1064
EFI_STATUS EFIAPI MnpCancelTokens(IN OUT NET_MAP *Map, IN OUT NET_MAP_ITEM *Item, IN VOID *Arg)
Definition: MnpConfig.c:1063
EFI_STATUS MnpSyncSendPacket(IN MNP_SERVICE_DATA *MnpServiceData, IN UINT8 *Packet, IN UINT32 Length, IN OUT EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
Definition: MnpIo.c:206
EFI_STATUS MnpGroupOp(IN OUT MNP_INSTANCE_DATA *Instance, IN BOOLEAN JoinFlag, IN EFI_MAC_ADDRESS *MacAddress OPTIONAL, IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk OPTIONAL)
Definition: MnpConfig.c:1816
EFI_STATUS MnpReceivePacket(IN OUT MNP_DEVICE_DATA *MnpDeviceData)
Definition: MnpIo.c:828
MNP_SERVICE_DATA * MnpFindServiceData(IN MNP_DEVICE_DATA *MnpDeviceData, IN UINT16 VlanId)
Definition: MnpConfig.c:936
EFI_STATUS MnpInstanceDeliverPacket(IN OUT MNP_INSTANCE_DATA *Instance)
Definition: MnpIo.c:306
EFI_STATUS MnpDestroyServiceChild(IN OUT MNP_SERVICE_DATA *MnpServiceData)
Definition: MnpConfig.c:903
EFI_STATUS EFIAPI MnpTransmit(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
Definition: MnpMain.c:508
UINT8 * MnpAllocTxBuf(IN OUT MNP_DEVICE_DATA *MnpDeviceData)
Definition: MnpConfig.c:260
EFI_STATUS MnpInitializeServiceData(IN OUT MNP_SERVICE_DATA *MnpServiceData, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle)
EFI_STATUS EFIAPI MnpGetModeData(IN EFI_MANAGED_NETWORK_PROTOCOL *This, OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL)
Definition: MnpMain.c:38
EFI_STATUS EFIAPI MnpConfigure(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL)
Definition: MnpMain.c:144
VOID EFIAPI MnpRecycleRxData(IN EFI_EVENT Event, IN VOID *Context)
Definition: MnpIo.c:424
EFI_STATUS MnpDestroyServiceData(IN OUT MNP_SERVICE_DATA *MnpServiceData)
Definition: MnpConfig.c:807
BOOLEAN MnpIsValidTxToken(IN MNP_INSTANCE_DATA *Instance, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
Definition: MnpIo.c:22
EFI_STATUS EFIAPI MnpTokenExist(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg)
Definition: MnpConfig.c:1023
VOID EFIAPI MnpSystemPoll(IN EFI_EVENT Event, IN VOID *Context)
Definition: MnpIo.c:1096
EFI_STATUS MnpConfigReceiveFilters(IN MNP_DEVICE_DATA *MnpDeviceData)
Definition: MnpConfig.c:1538
EFI_STATUS EFIAPI MnpReceive(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token)
Definition: MnpMain.c:600
EFI_STATUS MnpBuildTxPacket(IN MNP_SERVICE_DATA *MnpServiceData, IN EFI_MANAGED_NETWORK_TRANSMIT_DATA *TxData, OUT UINT8 **PktBuf, OUT UINT32 *PktLen)
Definition: MnpIo.c:112
EFI_STATUS EFIAPI MnpCancel(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN EFI_MANAGED_NETWORK_COMPLETION_TOKEN *Token OPTIONAL)
Definition: MnpMain.c:683
VOID MnpDestroyDeviceData(IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN EFI_HANDLE ImageHandle)
Definition: MnpConfig.c:614
EFI_STATUS EFIAPI MnpPoll(IN EFI_MANAGED_NETWORK_PROTOCOL *This)
Definition: MnpMain.c:752
EFI_STATUS EFIAPI MnpGroups(IN EFI_MANAGED_NETWORK_PROTOCOL *This, IN BOOLEAN JoinFlag, IN EFI_MAC_ADDRESS *MacAddress OPTIONAL)
Definition: MnpMain.c:343
VOID EFIAPI MnpCheckPacketTimeout(IN EFI_EVENT Event, IN VOID *Context)
Definition: MnpIo.c:997
EFI_STATUS MnpInitializeDeviceData(IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle)
Definition: MnpConfig.c:420
EFI_STATUS MnpConfigureInstance(IN OUT MNP_INSTANCE_DATA *Instance, IN EFI_MANAGED_NETWORK_CONFIG_DATA *ConfigData OPTIONAL)
Definition: MnpConfig.c:1404
VOID MnpFreeNbuf(IN OUT MNP_DEVICE_DATA *MnpDeviceData, IN OUT NET_BUF *Nbuf)
Definition: MnpConfig.c:170
MNP_SERVICE_DATA * MnpCreateServiceData(IN MNP_DEVICE_DATA *MnpDeviceData, IN UINT16 VlanId, IN UINT8 Priority OPTIONAL)
Definition: MnpConfig.c:690
EFI_STATUS MnpRecycleTxBuf(IN OUT MNP_DEVICE_DATA *MnpDeviceData)
Definition: MnpConfig.c:381
NET_BUF * MnpAllocNbuf(IN OUT MNP_DEVICE_DATA *MnpDeviceData)
Definition: MnpConfig.c:103
VOID MnpInitializeInstanceData(IN MNP_SERVICE_DATA *MnpServiceData, IN OUT MNP_INSTANCE_DATA *Instance)
Definition: MnpConfig.c:966
VOID MnpFlushRcvdDataQueue(IN OUT MNP_INSTANCE_DATA *Instance)
Definition: MnpConfig.c:1361
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33