1 /** @file
2 
3   EFI Deferred Procedure Call Protocol.
4 
5 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10 
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 
17 #ifndef __DPC_H__
18 #define __DPC_H__
19 
20 //
21 // DPC Protocol GUID value
22 //
23 #define EFI_DPC_PROTOCOL_GUID \
24     { \
25       0x480f8ae9, 0xc46, 0x4aa9, { 0xbc, 0x89, 0xdb, 0x9f, 0xba, 0x61, 0x98, 0x6 } \
26     }
27 
28 //
29 // Forward reference for pure ANSI compatability
30 //
31 typedef struct _EFI_DPC_PROTOCOL  EFI_DPC_PROTOCOL;
32 
33 
34 /**
35   Invoke a Deferred Procedure Call.
36 
37   @param  DpcContext           The pointer to the Deferred Procedure Call's context,
38                                which is implementation dependent.
39 
40 **/
41 typedef
42 VOID
43 (EFIAPI *EFI_DPC_PROCEDURE)(
44   IN VOID  *DpcContext
45   );
46 
47 /**
48   Add a Deferred Procedure Call to the end of the DPC queue.
49 
50   @param  This          The protocol instance pointer.
51   @param  DpcTpl        The EFI_TPL that the DPC should invoke.
52   @param  DpcProcedure  The pointer to the DPC's function.
53   @param  DpcContext    The pointer to the DPC's context.  Passed to DpcProcedure
54                         when DpcProcedure is invoked.
55 
56   @retval EFI_SUCCESS            The DPC was queued.
57   @retval EFI_INVALID_PARAMETER  DpcTpl is not a valid EFI_TPL.
58   @retval EFI_INVALID_PARAMETER  DpcProcedure is NULL.
59   @retval EFI_OUT_OF_RESOURCES   There are not enough resources available to
60                                  add the DPC to the queue.
61 
62 **/
63 typedef
64 EFI_STATUS
65 (EFIAPI *EFI_DPC_QUEUE_DPC)(
66   IN EFI_DPC_PROTOCOL   *This,
67   IN EFI_TPL            DpcTpl,
68   IN EFI_DPC_PROCEDURE  DpcProcedure,
69   IN VOID               *DpcContext    OPTIONAL
70   );
71 
72 /**
73   Dispatch the queue of DPCs.
74 
75   DPCs with DpcTpl value greater than the current TPL value are queued, and then DPCs
76   with DpcTpl value lower than the current TPL value are queued. All DPCs in the first
77   group (higher DpcTpl values) are invoked before DPCs in the second group (lower DpcTpl values).
78 
79   @param  This  Protocol instance pointer.
80 
81   @retval EFI_SUCCESS    One or more DPCs were invoked.
82   @retval EFI_NOT_FOUND  No DPCs were invoked.
83 
84 **/
85 typedef
86 EFI_STATUS
87 (EFIAPI *EFI_DPC_DISPATCH_DPC)(
88   IN EFI_DPC_PROTOCOL  *This
89   );
90 
91 ///
92 /// DPC Protocol structure.
93 ///
94 struct _EFI_DPC_PROTOCOL {
95   EFI_DPC_QUEUE_DPC     QueueDpc;
96   EFI_DPC_DISPATCH_DPC  DispatchDpc;
97 };
98 
99 ///
100 /// DPC Protocol GUID variable.
101 ///
102 extern EFI_GUID gEfiDpcProtocolGuid;
103 
104 #endif
105