TianoCore EDK2 master
Loading...
Searching...
No Matches
Reset.c
Go to the documentation of this file.
1
10#include "Snp.h"
11
23 SNP_DRIVER *Snp
24 )
25{
26 Snp->Cdb.OpCode = PXE_OPCODE_RESET;
27 Snp->Cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
28 Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
29 Snp->Cdb.DBsize = PXE_DBSIZE_NOT_USED;
30 Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
31 Snp->Cdb.DBaddr = PXE_DBADDR_NOT_USED;
32 Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
33 Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
34 Snp->Cdb.IFnum = Snp->IfNum;
35 Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
36
37 //
38 // Issue UNDI command and check result.
39 //
40 DEBUG ((DEBUG_NET, "\nsnp->undi.reset() "));
41
42 (*Snp->IssueUndi32Command)((UINT64)(UINTN)&Snp->Cdb);
43
44 if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {
45 DEBUG (
46 (DEBUG_WARN,
47 "\nsnp->undi32.reset() %xh:%xh\n",
48 Snp->Cdb.StatFlags,
49 Snp->Cdb.StatCode)
50 );
51
52 //
53 // UNDI could not be reset. Return UNDI error.
54 //
55 return EFI_DEVICE_ERROR;
56 }
57
58 return EFI_SUCCESS;
59}
60
86EFIAPI
89 IN BOOLEAN ExtendedVerification
90 )
91{
92 SNP_DRIVER *Snp;
93 EFI_TPL OldTpl;
94 EFI_STATUS Status;
95
96 //
97 // There is no support when ExtendedVerification is set to FALSE.
98 //
99 if (!ExtendedVerification) {
100 DEBUG ((DEBUG_WARN, "ExtendedVerification = %d is not implemented!\n", ExtendedVerification));
101 return EFI_INVALID_PARAMETER;
102 }
103
104 if (This == NULL) {
105 return EFI_INVALID_PARAMETER;
106 }
107
108 Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);
109
110 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
111
112 switch (Snp->Mode.State) {
113 case EfiSimpleNetworkInitialized:
114 break;
115
116 case EfiSimpleNetworkStopped:
117 Status = EFI_NOT_STARTED;
118 goto ON_EXIT;
119
120 default:
121 Status = EFI_DEVICE_ERROR;
122 goto ON_EXIT;
123 }
124
125 Status = PxeReset (Snp);
126
127ON_EXIT:
128 gBS->RestoreTPL (OldTpl);
129
130 return Status;
131}
UINT64 UINTN
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_STATUS PxeReset(SNP_DRIVER *Snp)
Definition: Reset.c:22
EFI_STATUS EFIAPI SnpUndi32Reset(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
Definition: Reset.c:87
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINTN EFI_TPL
Definition: UefiBaseType.h:41
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
#define PXE_CPBSIZE_NOT_USED
zero
Definition: UefiPxe.h:57
#define PXE_DBSIZE_NOT_USED
zero
Definition: UefiPxe.h:58
#define PXE_CPBADDR_NOT_USED
zero
Definition: UefiPxe.h:59
#define PXE_OPCODE_RESET
Definition: UefiPxe.h:115
#define PXE_DBADDR_NOT_USED
zero
Definition: UefiPxe.h:60
#define PXE_STATCODE_SUCCESS
Definition: UefiPxe.h:602
Definition: Snp.h:55