2 Implementation of stopping a network interface.
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
12 Call UNDI to stop the interface and changes the snp state.
14 @param Snp Pointer to snp driver structure
16 @retval EFI_SUCCESS The network interface was stopped.
17 @retval EFI_DEVICE_ERROR SNP is not initialized.
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
;
39 DEBUG ((DEBUG_NET
, "\nsnp->undi.stop() "));
41 (*Snp
->IssueUndi32Command
)((UINT64
)(UINTN
)&Snp
->Cdb
);
43 if (Snp
->Cdb
.StatCode
!= PXE_STATCODE_SUCCESS
) {
46 "\nsnp->undi.stop() %xh:%xh\n",
51 return EFI_DEVICE_ERROR
;
55 // Set simple network state to Started and return success.
57 Snp
->Mode
.State
= EfiSimpleNetworkStopped
;
62 Changes the state of a network interface from "started" to "stopped."
64 This function stops a network interface. This call is only valid if the network
65 interface is in the started state. If the network interface was successfully
66 stopped, then EFI_SUCCESS will be returned.
68 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL
72 @retval EFI_SUCCESS The network interface was stopped.
73 @retval EFI_NOT_STARTED The network interface has not been started.
74 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a
75 valid EFI_SIMPLE_NETWORK_PROTOCOL structure.
76 @retval EFI_DEVICE_ERROR The command could not be sent to the network
78 @retval EFI_UNSUPPORTED This function is not supported by the network
85 IN EFI_SIMPLE_NETWORK_PROTOCOL
*This
93 return EFI_INVALID_PARAMETER
;
96 Snp
= EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This
);
98 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
100 switch (Snp
->Mode
.State
) {
101 case EfiSimpleNetworkStarted
:
104 case EfiSimpleNetworkStopped
:
105 Status
= EFI_NOT_STARTED
;
109 Status
= EFI_DEVICE_ERROR
;
113 Status
= PxeStop (Snp
);
116 gBS
->RestoreTPL (OldTpl
);