VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/NetworkPkg/SnpDxe/Stop.c@ 89989

Last change on this file since 89989 was 80721, checked in by vboxsync, 5 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 3.0 KB
Line 
1/** @file
2 Implementation of stopping a network interface.
3
4Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include "Snp.h"
10
11
12/**
13 Call UNDI to stop the interface and changes the snp state.
14
15 @param Snp Pointer to snp driver structure
16
17 @retval EFI_SUCCESS The network interface was stopped.
18 @retval EFI_DEVICE_ERROR SNP is not initialized.
19
20**/
21EFI_STATUS
22PxeStop (
23 SNP_DRIVER *Snp
24 )
25{
26 Snp->Cdb.OpCode = PXE_OPCODE_STOP;
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
39 //
40 DEBUG ((EFI_D_NET, "\nsnp->undi.stop() "));
41
42 (*Snp->IssueUndi32Command) ((UINT64)(UINTN) &Snp->Cdb);
43
44 if (Snp->Cdb.StatCode != PXE_STATCODE_SUCCESS) {
45 DEBUG (
46 (EFI_D_WARN,
47 "\nsnp->undi.stop() %xh:%xh\n",
48 Snp->Cdb.StatFlags,
49 Snp->Cdb.StatCode)
50 );
51
52 return EFI_DEVICE_ERROR;
53 }
54 //
55 // Set simple network state to Started and return success.
56 //
57 Snp->Mode.State = EfiSimpleNetworkStopped;
58 return EFI_SUCCESS;
59}
60
61
62/**
63 Changes the state of a network interface from "started" to "stopped."
64
65 This function stops a network interface. This call is only valid if the network
66 interface is in the started state. If the network interface was successfully
67 stopped, then EFI_SUCCESS will be returned.
68
69 @param This A pointer to the EFI_SIMPLE_NETWORK_PROTOCOL
70 instance.
71
72
73 @retval EFI_SUCCESS The network interface was stopped.
74 @retval EFI_NOT_STARTED The network interface has not been started.
75 @retval EFI_INVALID_PARAMETER This parameter was NULL or did not point to a
76 valid EFI_SIMPLE_NETWORK_PROTOCOL structure.
77 @retval EFI_DEVICE_ERROR The command could not be sent to the network
78 interface.
79 @retval EFI_UNSUPPORTED This function is not supported by the network
80 interface.
81
82**/
83EFI_STATUS
84EFIAPI
85SnpUndi32Stop (
86 IN EFI_SIMPLE_NETWORK_PROTOCOL *This
87 )
88{
89 SNP_DRIVER *Snp;
90 EFI_TPL OldTpl;
91 EFI_STATUS Status;
92
93 if (This == NULL) {
94 return EFI_INVALID_PARAMETER;
95 }
96
97 Snp = EFI_SIMPLE_NETWORK_DEV_FROM_THIS (This);
98
99 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
100
101 switch (Snp->Mode.State) {
102 case EfiSimpleNetworkStarted:
103 break;
104
105 case EfiSimpleNetworkStopped:
106 Status = EFI_NOT_STARTED;
107 goto ON_EXIT;
108
109 default:
110 Status = EFI_DEVICE_ERROR;
111 goto ON_EXIT;
112 }
113
114 Status = PxeStop (Snp);
115
116ON_EXIT:
117 gBS->RestoreTPL (OldTpl);
118
119 return Status;
120}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette