2 Copyright (c) 2004, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 Event handler to check for available packet.
30 SnpWaitForPacketNotify (
35 PXE_DB_GET_STATUS PxeDbGetStatus
;
38 // Do nothing if either parameter is a NULL pointer.
40 if (Event
== NULL
|| SnpPtr
== NULL
) {
44 // Do nothing if the SNP interface is not initialized.
46 switch (((SNP_DRIVER
*) SnpPtr
)->mode
.State
) {
47 case EfiSimpleNetworkInitialized
:
50 case EfiSimpleNetworkStopped
:
51 case EfiSimpleNetworkStarted
:
56 // Fill in CDB for UNDI GetStatus().
58 ((SNP_DRIVER
*) SnpPtr
)->cdb
.OpCode
= PXE_OPCODE_GET_STATUS
;
59 ((SNP_DRIVER
*) SnpPtr
)->cdb
.OpFlags
= 0;
60 ((SNP_DRIVER
*) SnpPtr
)->cdb
.CPBsize
= PXE_CPBSIZE_NOT_USED
;
61 ((SNP_DRIVER
*) SnpPtr
)->cdb
.CPBaddr
= PXE_CPBADDR_NOT_USED
;
62 ((SNP_DRIVER
*) SnpPtr
)->cdb
.DBsize
= sizeof (UINT32
) * 2;
63 ((SNP_DRIVER
*) SnpPtr
)->cdb
.DBaddr
= (UINT64
)(UINTN
) (((SNP_DRIVER
*) SnpPtr
)->db
);
64 ((SNP_DRIVER
*) SnpPtr
)->cdb
.StatCode
= PXE_STATCODE_INITIALIZE
;
65 ((SNP_DRIVER
*) SnpPtr
)->cdb
.StatFlags
= PXE_STATFLAGS_INITIALIZE
;
66 ((SNP_DRIVER
*) SnpPtr
)->cdb
.IFnum
= ((SNP_DRIVER
*) SnpPtr
)->if_num
;
67 ((SNP_DRIVER
*) SnpPtr
)->cdb
.Control
= PXE_CONTROL_LAST_CDB_IN_LIST
;
70 // Clear contents of DB buffer.
72 ZeroMem (((SNP_DRIVER
*) SnpPtr
)->db
, sizeof (UINT32
) * 2);
75 // Issue UNDI command and check result.
77 (*((SNP_DRIVER
*) SnpPtr
)->issue_undi32_command
) ((UINT64
)(UINTN
) &((SNP_DRIVER
*) SnpPtr
)->cdb
);
79 if (((SNP_DRIVER
*) SnpPtr
)->cdb
.StatCode
!= EFI_SUCCESS
) {
83 // We might have a packet. Check the receive length and signal
84 // the event if the length is not zero.
88 ((SNP_DRIVER
*) SnpPtr
)->db
,
92 if (PxeDbGetStatus
.RxFrameLen
!= 0) {
93 gBS
->SignalEvent (Event
);
97 /* eof - WaitForPacket.c */