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