2 Implementation of stopping a network interface.
4 Copyright (c) 2004 - 2007, Intel Corporation. <BR>
5 All rights reserved. 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 this routine calls undi to stop the interface and changes the snp state.
21 @param Snp pointer to snp driver structure
23 @retval EFI_INVALID_PARAMETER invalid parameter
24 @retval EFI_NOT_STARTED SNP is not started
25 @retval EFI_DEVICE_ERROR SNP is not initialized
26 @retval EFI_UNSUPPORTED operation unsupported
34 Snp
->Cdb
.OpCode
= PXE_OPCODE_STOP
;
35 Snp
->Cdb
.OpFlags
= PXE_OPFLAGS_NOT_USED
;
36 Snp
->Cdb
.CPBsize
= PXE_CPBSIZE_NOT_USED
;
37 Snp
->Cdb
.DBsize
= PXE_DBSIZE_NOT_USED
;
38 Snp
->Cdb
.CPBaddr
= PXE_CPBADDR_NOT_USED
;
39 Snp
->Cdb
.DBaddr
= PXE_DBADDR_NOT_USED
;
40 Snp
->Cdb
.StatCode
= PXE_STATCODE_INITIALIZE
;
41 Snp
->Cdb
.StatFlags
= PXE_STATFLAGS_INITIALIZE
;
42 Snp
->Cdb
.IFnum
= Snp
->IfNum
;
43 Snp
->Cdb
.Control
= PXE_CONTROL_LAST_CDB_IN_LIST
;
48 DEBUG ((EFI_D_NET
, "\nsnp->undi.stop() "));
50 (*Snp
->IssueUndi32Command
) ((UINT64
)(UINTN
) &Snp
->Cdb
);
52 if (Snp
->Cdb
.StatCode
!= PXE_STATCODE_SUCCESS
) {
55 "\nsnp->undi.stop() %xh:%xh\n",
60 return EFI_DEVICE_ERROR
;
63 // Set simple network state to Started and return success.
65 Snp
->Mode
.State
= EfiSimpleNetworkStopped
;
71 Changes the state of a network interface from "started" to "stopped."
73 This function stops a network interface. This call is only valid if the network
74 interface is in the started state. If the network interface was successfully
75 stopped, then EFI_SUCCESS will be returned.
77 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL instance.
80 @retval EFI_SUCCESS The network interface was stopped.
81 @retval EFI_NOT_STARTED The network interface has not been started.
82 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a valid
83 EFI_SIMPLE_NETWORK_PROTOCOL structure.
84 @retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
85 @retval EFI_UNSUPPORTED This function is not supported by the network interface.
91 IN EFI_SIMPLE_NETWORK_PROTOCOL
*This
99 return EFI_INVALID_PARAMETER
;
102 Snp
= EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This
);
104 OldTpl
= gBS
->RaiseTPL (TPL_CALLBACK
);
106 switch (Snp
->Mode
.State
) {
107 case EfiSimpleNetworkStarted
:
110 case EfiSimpleNetworkStopped
:
111 Status
= EFI_NOT_STARTED
;
115 Status
= EFI_DEVICE_ERROR
;
119 Status
= PxeStop (Snp
);
122 gBS
->RestoreTPL (OldTpl
);