]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/DxeDpcLib/DpcLib.c
BaseTools:Change the path of the file that Binary Cache
[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
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
36ee91ca 6**/\r
7\r
9fbc7449 8#include <Uefi.h>\r
36ee91ca 9#include <Library/DebugLib.h>\r
10#include <Library/UefiBootServicesTableLib.h>\r
11#include <Protocol/Dpc.h>\r
12\r
13//\r
14// Pointer to the DPC Protocol\r
15//\r
16EFI_DPC_PROTOCOL *mDpc;\r
17\r
18/**\r
19 This constructor function caches the EFI_DPC_PROTOCOL pointer.\r
20\r
21 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
22 @param[in] SystemTable A pointer to the EFI System Table.\r
23\r
24 @retval EFI_SUCCESS The constructor always return EFI_SUCCESS.\r
25\r
26**/\r
27EFI_STATUS\r
28EFIAPI\r
29DpcLibConstructor (\r
30 IN EFI_HANDLE ImageHandle,\r
31 IN EFI_SYSTEM_TABLE *SystemTable\r
32 )\r
33{\r
34 EFI_STATUS Status;\r
35\r
36 //\r
37 // Locate the EFI_DPC_PROTOCOL in the handle database\r
38 //\r
39 Status = gBS->LocateProtocol (&gEfiDpcProtocolGuid, NULL, (VOID **)&mDpc);\r
40 ASSERT_EFI_ERROR (Status);\r
41\r
c7285227 42 return Status;\r
36ee91ca 43}\r
44\r
45/**\r
46 Add a Deferred Procedure Call to the end of the DPC queue.\r
47\r
96858792 48 @param[in] DpcTpl The EFI_TPL that the DPC should be invoked.\r
49 @param[in] DpcProcedure Pointer to the DPC's function.\r
50 @param[in] DpcContext Pointer to the DPC's context. Passed to DpcProcedure\r
51 when DpcProcedure is invoked.\r
36ee91ca 52\r
53 @retval EFI_SUCCESS The DPC was queued.\r
54 @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.\r
55 @retval EFI_INVALID_PARAMETER DpcProcedure is NULL.\r
56 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to\r
57 add the DPC to the queue.\r
58\r
59**/\r
60EFI_STATUS\r
7b414b4e 61EFIAPI\r
36ee91ca 62QueueDpc (\r
63 IN EFI_TPL DpcTpl,\r
64 IN EFI_DPC_PROCEDURE DpcProcedure,\r
96858792 65 IN VOID *DpcContext OPTIONAL\r
36ee91ca 66 )\r
67{\r
68 //\r
69 // Call the EFI_DPC_PROTOCOL to queue the DPC\r
70 //\r
71 return mDpc->QueueDpc (mDpc, DpcTpl, DpcProcedure, DpcContext);\r
72}\r
73\r
74/**\r
75 Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl\r
76 value greater than or equal to the current TPL are invoked in the order that\r
77 they were queued. DPCs with higher DpcTpl values are invoked before DPCs with\r
78 lower DpcTpl values.\r
79\r
80 @retval EFI_SUCCESS One or more DPCs were invoked.\r
81 @retval EFI_NOT_FOUND No DPCs were invoked.\r
82\r
83**/\r
84EFI_STATUS\r
7b414b4e 85EFIAPI\r
36ee91ca 86DispatchDpc (\r
87 VOID\r
88 )\r
89{\r
90 //\r
91 // Call the EFI_DPC_PROTOCOL to dispatch previously queued DPCs\r
92 //\r
93 return mDpc->DispatchDpc (mDpc);\r
94}\r