VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/VirtioNetDxe/SnpShutdown.c@ 85801

Last change on this file since 85801 was 80721, checked in by vboxsync, 6 years ago

Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/** @file
2
3 Implementation of the SNP.Shutdown() 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 Copyright (c) 2017, AMD Inc, All rights reserved.<BR>
8
9 SPDX-License-Identifier: BSD-2-Clause-Patent
10
11**/
12
13#include <Library/UefiBootServicesTableLib.h>
14
15#include "VirtioNet.h"
16
17/**
18 Resets a network adapter and leaves it in a state that is safe for another
19 driver to initialize.
20
21 @param This Protocol instance pointer.
22
23 @retval EFI_SUCCESS The network interface was shutdown.
24 @retval EFI_NOT_STARTED The network interface has not been started.
25 @retval EFI_INVALID_PARAMETER One or more of the parameters has an
26 unsupported value.
27 @retval EFI_DEVICE_ERROR The command could not be sent to the network
28 interface.
29 @retval EFI_UNSUPPORTED This function is not supported by the network
30 interface.
31
32**/
33
34EFI_STATUS
35EFIAPI
36VirtioNetShutdown (
37 IN EFI_SIMPLE_NETWORK_PROTOCOL *This
38 )
39{
40 VNET_DEV *Dev;
41 EFI_TPL OldTpl;
42 EFI_STATUS Status;
43
44 if (This == NULL) {
45 return EFI_INVALID_PARAMETER;
46 }
47
48 Dev = VIRTIO_NET_FROM_SNP (This);
49 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
50 switch (Dev->Snm.State) {
51 case EfiSimpleNetworkStopped:
52 Status = EFI_NOT_STARTED;
53 goto Exit;
54 case EfiSimpleNetworkStarted:
55 Status = EFI_DEVICE_ERROR;
56 goto Exit;
57 default:
58 break;
59 }
60
61 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);
62 VirtioNetShutdownRx (Dev);
63 VirtioNetShutdownTx (Dev);
64 VirtioNetUninitRing (Dev, &Dev->TxRing, Dev->TxRingMap);
65 VirtioNetUninitRing (Dev, &Dev->RxRing, Dev->RxRingMap);
66
67 Dev->Snm.State = EfiSimpleNetworkStarted;
68 Status = EFI_SUCCESS;
69
70Exit:
71 gBS->RestoreTPL (OldTpl);
72 return Status;
73}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette