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