2 Copyright (c) 2006, 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.
24 SnpWaitForPacketNotify (
38 PXE_DB_GET_STATUS PxeDbGetStatus
;
41 // Do nothing if either parameter is a NULL pointer.
43 if (Event
== NULL
|| SnpPtr
== NULL
) {
47 // Do nothing if the SNP interface is not initialized.
49 switch (((SNP_DRIVER
*) SnpPtr
)->mode
.State
) {
50 case EfiSimpleNetworkInitialized
:
53 case EfiSimpleNetworkStopped
:
54 case EfiSimpleNetworkStarted
:
59 // Fill in CDB for UNDI GetStatus().
61 ((SNP_DRIVER
*) SnpPtr
)->cdb
.OpCode
= PXE_OPCODE_GET_STATUS
;
62 ((SNP_DRIVER
*) SnpPtr
)->cdb
.OpFlags
= 0;
63 ((SNP_DRIVER
*) SnpPtr
)->cdb
.CPBsize
= PXE_CPBSIZE_NOT_USED
;
64 ((SNP_DRIVER
*) SnpPtr
)->cdb
.CPBaddr
= PXE_CPBADDR_NOT_USED
;
65 ((SNP_DRIVER
*) SnpPtr
)->cdb
.DBsize
= sizeof (UINT32
) * 2;
66 ((SNP_DRIVER
*) SnpPtr
)->cdb
.DBaddr
= (UINT64
) (UINTN
) (((SNP_DRIVER
*) SnpPtr
)->db
);
67 ((SNP_DRIVER
*) SnpPtr
)->cdb
.StatCode
= PXE_STATCODE_INITIALIZE
;
68 ((SNP_DRIVER
*) SnpPtr
)->cdb
.StatFlags
= PXE_STATFLAGS_INITIALIZE
;
69 ((SNP_DRIVER
*) SnpPtr
)->cdb
.IFnum
= ((SNP_DRIVER
*) SnpPtr
)->if_num
;
70 ((SNP_DRIVER
*) SnpPtr
)->cdb
.Control
= PXE_CONTROL_LAST_CDB_IN_LIST
;
73 // Clear contents of DB buffer.
75 ZeroMem (((SNP_DRIVER
*) SnpPtr
)->db
, sizeof (UINT32
) * 2);
78 // Issue UNDI command and check result.
80 (*((SNP_DRIVER
*) SnpPtr
)->issue_undi32_command
) ((UINT64
) (UINTN
) &((SNP_DRIVER
*) SnpPtr
)->cdb
);
82 if (((SNP_DRIVER
*) SnpPtr
)->cdb
.StatCode
!= EFI_SUCCESS
) {
86 // We might have a packet. Check the receive length and signal
87 // the event if the length is not zero.
91 ((SNP_DRIVER
*) SnpPtr
)->db
,
95 if (PxeDbGetStatus
.RxFrameLen
!= 0) {
96 gBS
->SignalEvent (Event
);
100 /* eof - WaitForPacket.c */