3 Copyright (c) 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include <Library/DebugLib.h>
22 #include <Library/UefiBootServicesTableLib.h>
23 #include <Protocol/Dpc.h>
26 // Pointer to the DPC Protocol
28 EFI_DPC_PROTOCOL
*mDpc
;
31 This constructor function caches the EFI_DPC_PROTOCOL pointer.
33 @param[in] ImageHandle The firmware allocated handle for the EFI image.
34 @param[in] SystemTable A pointer to the EFI System Table.
36 @retval EFI_SUCCESS The constructor always return EFI_SUCCESS.
42 IN EFI_HANDLE ImageHandle
,
43 IN EFI_SYSTEM_TABLE
*SystemTable
49 // Locate the EFI_DPC_PROTOCOL in the handle database
51 Status
= gBS
->LocateProtocol (&gEfiDpcProtocolGuid
, NULL
, (VOID
**)&mDpc
);
52 ASSERT_EFI_ERROR (Status
);
58 Add a Deferred Procedure Call to the end of the DPC queue.
60 @param DpcTpl The EFI_TPL that the DPC should be invoked.
61 @param DpcProcedure Pointer to the DPC's function.
62 @param DpcContext Pointer to the DPC's context. Passed to DpcProcedure
63 when DpcProcedure is invoked.
65 @retval EFI_SUCCESS The DPC was queued.
66 @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL.
67 @retval EFI_INVALID_PARAMETER DpcProcedure is NULL.
68 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to
69 add the DPC to the queue.
75 IN EFI_DPC_PROCEDURE DpcProcedure
,
80 // Call the EFI_DPC_PROTOCOL to queue the DPC
82 return mDpc
->QueueDpc (mDpc
, DpcTpl
, DpcProcedure
, DpcContext
);
86 Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl
87 value greater than or equal to the current TPL are invoked in the order that
88 they were queued. DPCs with higher DpcTpl values are invoked before DPCs with
91 @retval EFI_SUCCESS One or more DPCs were invoked.
92 @retval EFI_NOT_FOUND No DPCs were invoked.
101 // Call the EFI_DPC_PROTOCOL to dispatch previously queued DPCs
103 return mDpc
->DispatchDpc (mDpc
);