]>
Commit | Line | Data |
---|---|---|
395e912e LE |
1 | /** @file\r |
2 | \r | |
3 | Implementation of the SNP.Stop() 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 "started" to "stopped".\r | |
18 | \r | |
19 | @param This Protocol instance pointer.\r | |
20 | \r | |
21 | @retval EFI_SUCCESS The network interface was stopped.\r | |
22 | @retval EFI_ALREADY_STARTED The network interface is already in the stopped\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 | |
32 | \r | |
33 | EFI_STATUS\r | |
34 | EFIAPI\r | |
35 | VirtioNetStop (\r | |
36 | IN EFI_SIMPLE_NETWORK_PROTOCOL *This\r | |
37 | )\r | |
38 | {\r | |
39 | VNET_DEV *Dev;\r | |
40 | EFI_TPL OldTpl;\r | |
41 | EFI_STATUS Status;\r | |
42 | \r | |
43 | if (This == NULL) {\r | |
44 | return EFI_INVALID_PARAMETER;\r | |
45 | }\r | |
46 | \r | |
47 | Dev = VIRTIO_NET_FROM_SNP (This);\r | |
48 | OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r | |
49 | if (Dev->Snm.State != EfiSimpleNetworkStarted) {\r | |
50 | Status = EFI_NOT_STARTED;\r | |
51 | }\r | |
52 | else {\r | |
53 | Dev->Snm.State = EfiSimpleNetworkStopped;\r | |
54 | Status = EFI_SUCCESS;\r | |
55 | }\r | |
56 | \r | |
57 | gBS->RestoreTPL (OldTpl);\r | |
58 | return Status;\r | |
59 | }\r |