1 | /** @file
|
---|
2 |
|
---|
3 | Implements
|
---|
4 | - the SNM.WaitForPacket EVT_NOTIFY_WAIT event,
|
---|
5 | - the EVT_SIGNAL_EXIT_BOOT_SERVICES event
|
---|
6 | for the e1000 driver.
|
---|
7 |
|
---|
8 | Copyright (c) 2021, Oracle and/or its affiliates.
|
---|
9 | Copyright (C) 2013, Red Hat, Inc.
|
---|
10 | Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
---|
11 |
|
---|
12 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
13 |
|
---|
14 | **/
|
---|
15 |
|
---|
16 | #include <Library/BaseLib.h>
|
---|
17 | #include <Library/UefiBootServicesTableLib.h>
|
---|
18 |
|
---|
19 | #include "E1kNet.h"
|
---|
20 |
|
---|
21 | /**
|
---|
22 | Invoke a notification event
|
---|
23 |
|
---|
24 | @param Event Event whose notification function is being
|
---|
25 | invoked.
|
---|
26 | @param Context The pointer to the notification function's
|
---|
27 | context, which is implementation-dependent.
|
---|
28 |
|
---|
29 | **/
|
---|
30 |
|
---|
31 | VOID
|
---|
32 | EFIAPI
|
---|
33 | E1kNetIsPacketAvailable (
|
---|
34 | IN EFI_EVENT Event,
|
---|
35 | IN VOID *Context
|
---|
36 | )
|
---|
37 | {
|
---|
38 | //
|
---|
39 | // This callback has been enqueued by an external application and is
|
---|
40 | // running at TPL_CALLBACK already.
|
---|
41 | //
|
---|
42 | // The WaitForPacket logic is similar to that of WaitForKey. The former has
|
---|
43 | // almost no documentation in either the UEFI-2.3.1+errC spec or the
|
---|
44 | // DWG-2.3.1, but WaitForKey does have some.
|
---|
45 | //
|
---|
46 | E1K_NET_DEV *Dev;
|
---|
47 | UINT32 RdhCur;
|
---|
48 |
|
---|
49 | Dev = Context;
|
---|
50 | if (Dev->Snm.State != EfiSimpleNetworkInitialized) {
|
---|
51 | return;
|
---|
52 | }
|
---|
53 |
|
---|
54 | E1kNetRegRead32(Dev, E1K_REG_RDH, &RdhCur);
|
---|
55 |
|
---|
56 | if (Dev->RdhLastSeen != RdhCur) {
|
---|
57 | gBS->SignalEvent (Dev->Snp.WaitForPacket);
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | VOID
|
---|
62 | EFIAPI
|
---|
63 | E1kNetExitBoot (
|
---|
64 | IN EFI_EVENT Event,
|
---|
65 | IN VOID *Context
|
---|
66 | )
|
---|
67 | {
|
---|
68 | //
|
---|
69 | // This callback has been enqueued by ExitBootServices() and is running at
|
---|
70 | // TPL_CALLBACK already.
|
---|
71 | //
|
---|
72 | // Shut down pending transfers according to DWG-2.3.1, "25.5.1 Exit Boot
|
---|
73 | // Services Event".
|
---|
74 | //
|
---|
75 | E1K_NET_DEV *Dev;
|
---|
76 |
|
---|
77 | DEBUG ((DEBUG_VERBOSE, "%a: Context=0x%p\n", __FUNCTION__, Context));
|
---|
78 | Dev = Context;
|
---|
79 | if (Dev->Snm.State == EfiSimpleNetworkInitialized) {
|
---|
80 | E1kNetDevReset (Dev);
|
---|
81 | }
|
---|
82 | }
|
---|