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