]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/VirtioNetDxe/SnpStart.c
OvmfPkg/VirtioNetDxe: list "VirtioNet.h" in the INF file
[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
8 This program and the accompanying materials are licensed and made available\r
9 under the terms and conditions of the BSD License which accompanies this\r
10 distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
14 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#include <Library/UefiBootServicesTableLib.h>\r
19\r
20#include "VirtioNet.h"\r
21\r
22/**\r
23 Changes the state of a network interface from "stopped" to "started".\r
24\r
25 @param This Protocol instance pointer.\r
26\r
27 @retval EFI_SUCCESS The network interface was started.\r
28 @retval EFI_ALREADY_STARTED The network interface is already in the started\r
29 state.\r
30 @retval EFI_INVALID_PARAMETER One or more of the parameters has an\r
31 unsupported value.\r
32 @retval EFI_DEVICE_ERROR The command could not be sent to the network\r
33 interface.\r
34 @retval EFI_UNSUPPORTED This function is not supported by the network\r
35 interface.\r
36**/\r
37\r
38EFI_STATUS\r
39EFIAPI\r
40VirtioNetStart (\r
41 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
42 )\r
43{\r
44 VNET_DEV *Dev;\r
45 EFI_TPL OldTpl;\r
46 EFI_STATUS Status;\r
47\r
48 if (This == NULL) {\r
49 return EFI_INVALID_PARAMETER;\r
50 }\r
51\r
52 Dev = VIRTIO_NET_FROM_SNP (This);\r
53 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
54 if (Dev->Snm.State != EfiSimpleNetworkStopped) {\r
55 Status = EFI_ALREADY_STARTED;\r
56 }\r
57 else {\r
58 Dev->Snm.State = EfiSimpleNetworkStarted;\r
59 Status = EFI_SUCCESS;\r
60 }\r
61\r
62 gBS->RestoreTPL (OldTpl);\r
63 return Status;\r
64}\r