]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - OvmfPkg/VirtioNetDxe/SnpStop.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / OvmfPkg / VirtioNetDxe / SnpStop.c
... / ...
CommitLineData
1/** @file\r
2\r
3 Implementation of the SNP.Stop() function and its private helpers if any.\r
4\r
5 Copyright (C) 2013, Red Hat, Inc.\r
6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
7\r
8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9\r
10**/\r
11\r
12#include <Library/UefiBootServicesTableLib.h>\r
13\r
14#include "VirtioNet.h"\r
15\r
16/**\r
17 Changes the state of a network interface from "started" to "stopped".\r
18\r
19 @param This Protocol instance pointer.\r
20\r
21 @retval EFI_SUCCESS The network interface was stopped.\r
22 @retval EFI_ALREADY_STARTED The network interface is already in the stopped\r
23 state.\r
24 @retval EFI_INVALID_PARAMETER One or more of the parameters has an\r
25 unsupported value.\r
26 @retval EFI_DEVICE_ERROR The command could not be sent to the network\r
27 interface.\r
28 @retval EFI_UNSUPPORTED This function is not supported by the network\r
29 interface.\r
30\r
31**/\r
32EFI_STATUS\r
33EFIAPI\r
34VirtioNetStop (\r
35 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
36 )\r
37{\r
38 VNET_DEV *Dev;\r
39 EFI_TPL OldTpl;\r
40 EFI_STATUS Status;\r
41\r
42 if (This == NULL) {\r
43 return EFI_INVALID_PARAMETER;\r
44 }\r
45\r
46 Dev = VIRTIO_NET_FROM_SNP (This);\r
47 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
48 if (Dev->Snm.State != EfiSimpleNetworkStarted) {\r
49 Status = EFI_NOT_STARTED;\r
50 } else {\r
51 Dev->Snm.State = EfiSimpleNetworkStopped;\r
52 Status = EFI_SUCCESS;\r
53 }\r
54\r
55 gBS->RestoreTPL (OldTpl);\r
56 return Status;\r
57}\r