]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - OvmfPkg/VirtioNetDxe/SnpStart.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / VirtioNetDxe / SnpStart.c
... / ...
CommitLineData
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 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 "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
31EFI_STATUS\r
32EFIAPI\r
33VirtioNetStart (\r
34 IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r
35 )\r
36{\r
37 VNET_DEV *Dev;\r
38 EFI_TPL OldTpl;\r
39 EFI_STATUS Status;\r
40\r
41 if (This == NULL) {\r
42 return EFI_INVALID_PARAMETER;\r
43 }\r
44\r
45 Dev = VIRTIO_NET_FROM_SNP (This);\r
46 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
47 if (Dev->Snm.State != EfiSimpleNetworkStopped) {\r
48 Status = EFI_ALREADY_STARTED;\r
49 } else {\r
50 Dev->Snm.State = EfiSimpleNetworkStarted;\r
51 Status = EFI_SUCCESS;\r
52 }\r
53\r
54 gBS->RestoreTPL (OldTpl);\r
55 return Status;\r
56}\r