]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/VirtioNetDxe/SnpStart.c
OvmfPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / OvmfPkg / VirtioNetDxe / SnpStart.c
CommitLineData
395e912e
LE
1/** @file\r
2\r
3 Implementation of the SNP.Start() 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
b26f0cf9 8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
395e912e
LE
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 "stopped" to "started".\r
18\r
19 @param This Protocol instance pointer.\r
20\r
21 @retval EFI_SUCCESS The network interface was started.\r
22 @retval EFI_ALREADY_STARTED The network interface is already in the started\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
34VirtioNetStart (\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 != EfiSimpleNetworkStopped) {\r
49 Status = EFI_ALREADY_STARTED;\r
50 }\r
51 else {\r
52 Dev->Snm.State = EfiSimpleNetworkStarted;\r
53 Status = EFI_SUCCESS;\r
54 }\r
55\r
56 gBS->RestoreTPL (OldTpl);\r
57 return Status;\r
58}\r