TianoCore EDK2 master
Loading...
Searching...
No Matches
SnpShutdown.c
Go to the documentation of this file.
1
14
15#include "VirtioNet.h"
16
34EFIAPI
37 )
38{
39 VNET_DEV *Dev;
40 EFI_TPL OldTpl;
41 EFI_STATUS Status;
42
43 if (This == NULL) {
44 return EFI_INVALID_PARAMETER;
45 }
46
47 Dev = VIRTIO_NET_FROM_SNP (This);
48 OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
49 switch (Dev->Snm.State) {
50 case EfiSimpleNetworkStopped:
51 Status = EFI_NOT_STARTED;
52 goto Exit;
53 case EfiSimpleNetworkStarted:
54 Status = EFI_DEVICE_ERROR;
55 goto Exit;
56 default:
57 break;
58 }
59
60 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);
62 VirtioNetShutdownTx (Dev);
63 VirtioNetUninitRing (Dev, &Dev->TxRing, Dev->TxRingMap);
64 VirtioNetUninitRing (Dev, &Dev->RxRing, Dev->RxRingMap);
65
66 Dev->Snm.State = EfiSimpleNetworkStarted;
67 Status = EFI_SUCCESS;
68
69Exit:
70 gBS->RestoreTPL (OldTpl);
71 return Status;
72}
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
VOID EFIAPI VirtioNetShutdownRx(IN OUT VNET_DEV *Dev)
VOID EFIAPI VirtioNetUninitRing(IN OUT VNET_DEV *Dev, IN OUT VRING *Ring, IN VOID *RingMap)
EFI_STATUS EFIAPI VirtioNetShutdown(IN EFI_SIMPLE_NETWORK_PROTOCOL *This)
Definition: SnpShutdown.c:35
VOID EFIAPI Exit(IN EFI_STATUS Status)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
UINTN EFI_TPL
Definition: UefiBaseType.h:41
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS