1 | /** @file
|
---|
2 | Help functions to access UDP service.
|
---|
3 |
|
---|
4 | Copyright (c) 2005 - 2007, Intel Corporation. All rights reserved.<BR>
|
---|
5 | This program and the accompanying materials
|
---|
6 | are licensed and made available under the terms and conditions of the BSD License
|
---|
7 | which accompanies this distribution. The full text of the license may be found at
|
---|
8 | http://opensource.org/licenses/bsd-license.php
|
---|
9 |
|
---|
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
---|
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
---|
12 | **/
|
---|
13 |
|
---|
14 | #include <Uefi.h>
|
---|
15 | #include <Library/DebugLib.h>
|
---|
16 | #include <Library/UefiBootServicesTableLib.h>
|
---|
17 | #include <Protocol/Dpc.h>
|
---|
18 |
|
---|
19 | //
|
---|
20 | // Pointer to the DPC Protocol
|
---|
21 | //
|
---|
22 | EFI_DPC_PROTOCOL *mDpc;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | This constructor function caches the EFI_DPC_PROTOCOL pointer.
|
---|
26 |
|
---|
27 | @param[in] ImageHandle The firmware allocated handle for the EFI image.
|
---|
28 | @param[in] SystemTable A pointer to the EFI System Table.
|
---|
29 |
|
---|
30 | @retval EFI_SUCCESS The constructor always return EFI_SUCCESS.
|
---|
31 |
|
---|
32 | **/
|
---|
33 | EFI_STATUS
|
---|
34 | EFIAPI
|
---|
35 | DpcLibConstructor (
|
---|
36 | IN EFI_HANDLE ImageHandle,
|
---|
37 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
38 | )
|
---|
39 | {
|
---|
40 | EFI_STATUS Status;
|
---|
41 |
|
---|
42 | //
|
---|
43 | // Locate the EFI_DPC_PROTOCOL in the handle database
|
---|
44 | //
|
---|
45 | Status = gBS->LocateProtocol (&gEfiDpcProtocolGuid, NULL, (VOID **)&mDpc);
|
---|
46 | ASSERT_EFI_ERROR (Status);
|
---|
47 |
|
---|
48 | return EFI_SUCCESS;
|
---|
49 | }
|
---|
50 |
|
---|
51 | /**
|
---|
52 | Add a Deferred Procedure Call to the end of the DPC queue.
|
---|
53 |
|
---|
54 | @param[in] DpcTpl The EFI_TPL that the DPC should be invoked.
|
---|
55 | @param[in] DpcProcedure Pointer to the DPC's function.
|
---|
56 | @param[in] DpcContext Pointer to the DPC's context. Passed to DpcProcedure
|
---|
57 | when DpcProcedure is invoked.
|
---|
58 |
|
---|
59 | @retval EFI_SUCCESS The DPC was queued.
|
---|
60 | @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.
|
---|
61 | @retval EFI_INVALID_PARAMETER DpcProcedure is NULL.
|
---|
62 | @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
|
---|
63 | add the DPC to the queue.
|
---|
64 |
|
---|
65 | **/
|
---|
66 | EFI_STATUS
|
---|
67 | EFIAPI
|
---|
68 | QueueDpc (
|
---|
69 | IN EFI_TPL DpcTpl,
|
---|
70 | IN EFI_DPC_PROCEDURE DpcProcedure,
|
---|
71 | IN VOID *DpcContext OPTIONAL
|
---|
72 | )
|
---|
73 | {
|
---|
74 | //
|
---|
75 | // Call the EFI_DPC_PROTOCOL to queue the DPC
|
---|
76 | //
|
---|
77 | return mDpc->QueueDpc (mDpc, DpcTpl, DpcProcedure, DpcContext);
|
---|
78 | }
|
---|
79 |
|
---|
80 | /**
|
---|
81 | Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl
|
---|
82 | value greater than or equal to the current TPL are invoked in the order that
|
---|
83 | they were queued. DPCs with higher DpcTpl values are invoked before DPCs with
|
---|
84 | lower DpcTpl values.
|
---|
85 |
|
---|
86 | @retval EFI_SUCCESS One or more DPCs were invoked.
|
---|
87 | @retval EFI_NOT_FOUND No DPCs were invoked.
|
---|
88 |
|
---|
89 | **/
|
---|
90 | EFI_STATUS
|
---|
91 | EFIAPI
|
---|
92 | DispatchDpc (
|
---|
93 | VOID
|
---|
94 | )
|
---|
95 | {
|
---|
96 | //
|
---|
97 | // Call the EFI_DPC_PROTOCOL to dispatch previously queued DPCs
|
---|
98 | //
|
---|
99 | return mDpc->DispatchDpc (mDpc);
|
---|
100 | }
|
---|