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