2 Implementation of stopping a network interface.
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed
6 and made available under the terms and conditions of the BSD License which
7 accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Call UNDI to stop the interface and changes the snp state.
21 @param Snp Pointer to snp driver structure
23 @retval EFI_SUCCESS The network interface was stopped.
24 @retval EFI_DEVICE_ERROR SNP is not initialized.
32 Snp
->Cdb
.OpCode
= PXE_OPCODE_STOP
;
33 Snp
->Cdb
.OpFlags
= PXE_OPFLAGS_NOT_USED
;
34 Snp
->Cdb
.CPBsize
= PXE_CPBSIZE_NOT_USED
;
35 Snp
->Cdb
.DBsize
= PXE_DBSIZE_NOT_USED
;
36 Snp
->Cdb
.CPBaddr
= PXE_CPBADDR_NOT_USED
;
37 Snp
->Cdb
.DBaddr
= PXE_DBADDR_NOT_USED
;
38 Snp
->Cdb
.StatCode
= PXE_STATCODE_INITIALIZE
;
39 Snp
->Cdb
.StatFlags
= PXE_STATFLAGS_INITIALIZE
;
40 Snp
->Cdb
.IFnum
= Snp
->IfNum
;
41 Snp
->Cdb
.Control
= PXE_CONTROL_LAST_CDB_IN_LIST
;
46 DEBUG ((EFI_D_NET
, "\nsnp->undi.stop() "));
48 (*Snp
->IssueUndi32Command
) ((UINT64
)(UINTN
) &Snp
->Cdb
);
50 if (Snp
->Cdb
.StatCode
!= PXE_STATCODE_SUCCESS
) {
53 "\nsnp->undi.stop() %xh:%xh\n",
58 return EFI_DEVICE_ERROR
;
61 // Set simple network state to Started and return success.
63 Snp
->Mode
.State
= EfiSimpleNetworkStopped
;
69 Changes the state of a network interface from "started" to "stopped."
71 This function stops a network interface. This call is only valid if the network
72 interface is in the started state. If the network interface was successfully
73 stopped, then EFI_SUCCESS will be returned.
75 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL
79 @retval EFI_SUCCESS The network interface was stopped.
80 @retval EFI_NOT_STARTED The network interface has not been started.
81 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a
82 valid EFI_SIMPLE_NETWORK_PROTOCOL structure.
83 @retval EFI_DEVICE_ERROR The command could not be sent to the network
85 @retval EFI_UNSUPPORTED This function is not supported by the network
92 IN EFI_SIMPLE_NETWORK_PROTOCOL
*This
100 return EFI_INVALID_PARAMETER
;
103 Snp
= EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This
);
105 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
107 switch (Snp
->Mode
.State
) {
108 case EfiSimpleNetworkStarted
:
111 case EfiSimpleNetworkStopped
:
112 Status
= EFI_NOT_STARTED
;
116 Status
= EFI_DEVICE_ERROR
;
120 Status
= PxeStop (Snp
);
123 gBS
->RestoreTPL (OldTpl
);