]>
Commit | Line | Data |
---|---|---|
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 | |
395e912e LE |
31 | EFI_STATUS\r |
32 | EFIAPI\r | |
33 | VirtioNetStart (\r | |
ac0a286f | 34 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r |
395e912e LE |
35 | )\r |
36 | {\r | |
ac0a286f MK |
37 | VNET_DEV *Dev;\r |
38 | EFI_TPL OldTpl;\r | |
39 | EFI_STATUS Status;\r | |
395e912e LE |
40 | \r |
41 | if (This == NULL) {\r | |
42 | return EFI_INVALID_PARAMETER;\r | |
43 | }\r | |
44 | \r | |
ac0a286f | 45 | Dev = VIRTIO_NET_FROM_SNP (This);\r |
395e912e LE |
46 | OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r |
47 | if (Dev->Snm.State != EfiSimpleNetworkStopped) {\r | |
48 | Status = EFI_ALREADY_STARTED;\r | |
ac0a286f | 49 | } else {\r |
395e912e | 50 | Dev->Snm.State = EfiSimpleNetworkStarted;\r |
ac0a286f | 51 | Status = EFI_SUCCESS;\r |
395e912e LE |
52 | }\r |
53 | \r | |
54 | gBS->RestoreTPL (OldTpl);\r | |
55 | return Status;\r | |
56 | }\r |