TianoCore EDK2 master
Loading...
Searching...
No Matches
Stop.c
Go to the documentation of this file.
1
9#include "Snp.h"
10
22 SNP_DRIVER *Snp
23 )
24{
25 Snp->Cdb.OpCode = PXE_OPCODE_STOP;
26 Snp->Cdb.OpFlags = PXE_OPFLAGS_NOT_USED;
27 Snp->Cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
28 Snp->Cdb.DBsize = PXE_DBSIZE_NOT_USED;
29 Snp->Cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
30 Snp->Cdb.DBaddr = PXE_DBADDR_NOT_USED;
31 Snp->Cdb.StatCode = PXE_STATCODE_INITIALIZE;
32 Snp->Cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
33 Snp->Cdb.IFnum = Snp->IfNum;
34 Snp->Cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
35
36 //
37 // Issue UNDI command
38 //
39 DEBUG ((DEBUG_NET, "\nsnp->undi.stop() "));
40
41 (*Snp->IssueUndi32Command)((UINT64)(UINTN)&Snp->Cdb);
42
43 if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {
44 DEBUG (
45 (DEBUG_WARN,
46 "\nsnp->undi.stop() %xh:%xh\n",
47 Snp->Cdb.StatFlags,
48 Snp->Cdb.StatCode)
49 );
50
51 return EFI_DEVICE_ERROR;
52 }
53
54 //
55 // Set simple network state to Started and return success.
56 //
57 Snp->Mode.State = EfiSimpleNetworkStopped;
58 return EFI_SUCCESS;
59}
60
83EFIAPI
86 )
87{
88 SNP_DRIVER *Snp;
89 EFI_TPL OldTpl;
90 EFI_STATUS Status;
91
92 if (This == NULL) {
93 return EFI_INVALID_PARAMETER;
94 }
95
96 Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);
97
98 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
99
100 switch (Snp->Mode.State) {
101 case EfiSimpleNetworkStarted:
102 break;
103
104 case EfiSimpleNetworkStopped:
105 Status = EFI_NOT_STARTED;
106 goto ON_EXIT;
107
108 default:
109 Status = EFI_DEVICE_ERROR;
110 goto ON_EXIT;
111 }
112
113 Status = PxeStop (Snp);
114
115ON_EXIT:
116 gBS->RestoreTPL (OldTpl);
117
118 return Status;
119}
UINT64 UINTN
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_STATUS PxeStop(SNP_DRIVER *Snp)
Definition: Stop.c:21
EFI_STATUS EFIAPI SnpUndi32Stop(IN EFI_SIMPLE_NETWORK_PROTOCOL *This)
Definition: Stop.c:84
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_OPCODE_STOP
Definition: UefiPxe.h:95
#define PXE_DBSIZE_NOT_USED
zero
Definition: UefiPxe.h:58
#define PXE_CPBADDR_NOT_USED
zero
Definition: UefiPxe.h:59
#define PXE_DBADDR_NOT_USED
zero
Definition: UefiPxe.h:60
#define PXE_STATCODE_SUCCESS
Definition: UefiPxe.h:602
Definition: Snp.h:55