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