1 /** @file 2 3 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR> 4 SPDX-License-Identifier: BSD-2-Clause-Patent 5 6 Module Name: 7 8 Dpc.h 9 10 Abstract: 11 12 13 **/ 14 15 #ifndef _DPC_H_ 16 #define _DPC_H_ 17 18 #include <Uefi.h> 19 #include <Library/BaseLib.h> 20 #include <Library/DebugLib.h> 21 #include <Library/UefiDriverEntryPoint.h> 22 #include <Library/UefiBootServicesTableLib.h> 23 #include <Library/MemoryAllocationLib.h> 24 #include <Protocol/Dpc.h> 25 26 // 27 // Internal data structure for managing DPCs. A DPC entry is either on the free 28 // list or on a DPC queue at a specific EFI_TPL. 29 // 30 typedef struct { 31 LIST_ENTRY ListEntry; 32 EFI_DPC_PROCEDURE DpcProcedure; 33 VOID *DpcContext; 34 } DPC_ENTRY; 35 36 /** 37 Add a Deferred Procedure Call to the end of the DPC queue. 38 39 @param This Protocol instance pointer. 40 @param DpcTpl The EFI_TPL that the DPC should be invoked. 41 @param DpcProcedure Pointer to the DPC's function. 42 @param DpcContext Pointer to the DPC's context. Passed to DpcProcedure 43 when DpcProcedure is invoked. 44 45 @retval EFI_SUCCESS The DPC was queued. 46 @retval EFI_INVALID_PARAMETER DpcTpl is not a valid EFI_TPL. 47 @retval EFI_INVALID_PARAMETER DpcProcedure is NULL. 48 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to 49 add the DPC to the queue. 50 51 **/ 52 EFI_STATUS 53 EFIAPI 54 DpcQueueDpc ( 55 IN EFI_DPC_PROTOCOL *This, 56 IN EFI_TPL DpcTpl, 57 IN EFI_DPC_PROCEDURE DpcProcedure, 58 IN VOID *DpcContext OPTIONAL 59 ); 60 61 /** 62 Dispatch the queue of DPCs. ALL DPCs that have been queued with a DpcTpl 63 value greater than or equal to the current TPL are invoked in the order that 64 they were queued. DPCs with higher DpcTpl values are invoked before DPCs with 65 lower DpcTpl values. 66 67 @param This Protocol instance pointer. 68 69 @retval EFI_SUCCESS One or more DPCs were invoked. 70 @retval EFI_NOT_FOUND No DPCs were invoked. 71 72 **/ 73 EFI_STATUS 74 EFIAPI 75 DpcDispatchDpc ( 76 IN EFI_DPC_PROTOCOL *This 77 ); 78 79 #endif 80 81