VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/VirtioNetDxe/Events.c

最後變更 在這個檔案是 101291,由 vboxsync 提交於 16 月 前

EFI/FirmwareNew: Make edk2-stable202308 build on all supported platforms (using gcc at least, msvc not tested yet), bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.0 KB
 
1/** @file
2
3 Implements
4 - the SNM.WaitForPacket EVT_NOTIFY_WAIT event,
5 - the EVT_SIGNAL_EXIT_BOOT_SERVICES event
6 for the virtio-net driver.
7
8 Copyright (C) 2013, Red Hat, Inc.
9 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
10
11 SPDX-License-Identifier: BSD-2-Clause-Patent
12
13**/
14
15#include <Library/BaseLib.h>
16#include <Library/UefiBootServicesTableLib.h>
17
18#include "VirtioNet.h"
19
20/**
21 Invoke a notification event
22
23 @param Event Event whose notification function is being
24 invoked.
25 @param Context The pointer to the notification function's
26 context, which is implementation-dependent.
27
28**/
29VOID
30EFIAPI
31VirtioNetIsPacketAvailable (
32 IN EFI_EVENT Event,
33 IN VOID *Context
34 )
35{
36 //
37 // This callback has been enqueued by an external application and is
38 // running at TPL_CALLBACK already.
39 //
40 // The WaitForPacket logic is similar to that of WaitForKey. The former has
41 // almost no documentation in either the UEFI-2.3.1+errC spec or the
42 // DWG-2.3.1, but WaitForKey does have some.
43 //
44 VNET_DEV *Dev;
45 UINT16 RxCurUsed;
46
47 Dev = Context;
48 if (Dev->Snm.State != EfiSimpleNetworkInitialized) {
49 return;
50 }
51
52 //
53 // virtio-0.9.5, 2.4.2 Receiving Used Buffers From the Device
54 //
55 MemoryFence ();
56 RxCurUsed = *Dev->RxRing.Used.Idx;
57 MemoryFence ();
58
59 if (Dev->RxLastUsed != RxCurUsed) {
60 gBS->SignalEvent (Dev->Snp.WaitForPacket);
61 }
62}
63
64VOID
65EFIAPI
66VirtioNetExitBoot (
67 IN EFI_EVENT Event,
68 IN VOID *Context
69 )
70{
71 //
72 // This callback has been enqueued by ExitBootServices() and is running at
73 // TPL_CALLBACK already.
74 //
75 // Shut down pending transfers according to DWG-2.3.1, "25.5.1 Exit Boot
76 // Services Event".
77 //
78 VNET_DEV *Dev;
79
80 DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __func__, Context));
81 Dev = Context;
82 if (Dev->Snm.State == EfiSimpleNetworkInitialized) {
83 Dev->VirtIo->SetDeviceStatus (Dev->VirtIo, 0);
84 }
85}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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