2 Event handler to check for available packet.
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
13 Notification call back function for WaitForPacket event.
15 @param Event EFI Event.
16 @param SnpPtr Pointer to SNP_DRIVER structure.
21 SnpWaitForPacketNotify (
26 PXE_DB_GET_STATUS PxeDbGetStatus
;
29 // Do nothing if either parameter is a NULL pointer.
31 if (Event
== NULL
|| SnpPtr
== NULL
) {
35 // Do nothing if the SNP interface is not initialized.
37 switch (((SNP_DRIVER
*) SnpPtr
)->Mode
.State
) {
38 case EfiSimpleNetworkInitialized
:
41 case EfiSimpleNetworkStopped
:
42 case EfiSimpleNetworkStarted
:
47 // Fill in CDB for UNDI GetStatus().
49 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.OpCode
= PXE_OPCODE_GET_STATUS
;
50 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.OpFlags
= 0;
51 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.CPBsize
= PXE_CPBSIZE_NOT_USED
;
52 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.CPBaddr
= PXE_CPBADDR_NOT_USED
;
53 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.DBsize
= (UINT16
) (sizeof (UINT32
) * 2);
54 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.DBaddr
= (UINT64
)(UINTN
) (((SNP_DRIVER
*) SnpPtr
)->Db
);
55 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.StatCode
= PXE_STATCODE_INITIALIZE
;
56 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.StatFlags
= PXE_STATFLAGS_INITIALIZE
;
57 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.IFnum
= ((SNP_DRIVER
*) SnpPtr
)->IfNum
;
58 ((SNP_DRIVER
*) SnpPtr
)->Cdb
.Control
= PXE_CONTROL_LAST_CDB_IN_LIST
;
61 // Clear contents of DB buffer.
63 ZeroMem (((SNP_DRIVER
*) SnpPtr
)->Db
, sizeof (UINT32
) * 2);
66 // Issue UNDI command and check result.
68 (*((SNP_DRIVER
*) SnpPtr
)->IssueUndi32Command
) ((UINT64
)(UINTN
) &((SNP_DRIVER
*) SnpPtr
)->Cdb
);
70 if (((SNP_DRIVER
*) SnpPtr
)->Cdb
.StatCode
!= EFI_SUCCESS
) {
74 // We might have a packet. Check the receive length and signal
75 // the event if the length is not zero.
79 ((SNP_DRIVER
*) SnpPtr
)->Db
,
83 if (PxeDbGetStatus
.RxFrameLen
!= 0) {
84 gBS
->SignalEvent (Event
);