xref: /illumos-gate/usr/src/boot/efi/include/Protocol/Dpc.h (revision f334afcfaebea1b7dc3430015651d8d748fa8a3e)
1 /** @file
2 
3   EFI Deferred Procedure Call Protocol.
4 
5 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8 **/
9 
10 #ifndef __DPC_H__
11 #define __DPC_H__
12 
13 //
14 // DPC Protocol GUID value
15 //
16 #define EFI_DPC_PROTOCOL_GUID \
17     { \
18       0x480f8ae9, 0xc46, 0x4aa9, { 0xbc, 0x89, 0xdb, 0x9f, 0xba, 0x61, 0x98, 0x6 } \
19     }
20 
21 //
22 // Forward reference for pure ANSI compatibility
23 //
24 typedef struct _EFI_DPC_PROTOCOL EFI_DPC_PROTOCOL;
25 
26 /**
27   Invoke a Deferred Procedure Call.
28 
29   @param  DpcContext           The pointer to the Deferred Procedure Call's context,
30                                which is implementation dependent.
31 
32 **/
33 typedef
34 VOID
35 (EFIAPI *EFI_DPC_PROCEDURE)(
36   IN VOID  *DpcContext
37   );
38 
39 /**
40   Add a Deferred Procedure Call to the end of the DPC queue.
41 
42   @param  This          The protocol instance pointer.
43   @param  DpcTpl        The EFI_TPL that the DPC should invoke.
44   @param  DpcProcedure  The pointer to the DPC's function.
45   @param  DpcContext    The pointer to the DPC's context.  Passed to DpcProcedure
46                         when DpcProcedure is invoked.
47 
48   @retval EFI_SUCCESS            The DPC was queued.
49   @retval EFI_INVALID_PARAMETER  DpcTpl is not a valid EFI_TPL.
50   @retval EFI_INVALID_PARAMETER  DpcProcedure is NULL.
51   @retval EFI_OUT_OF_RESOURCES   There are not enough resources available to
52                                  add the DPC to the queue.
53 
54 **/
55 typedef
56 EFI_STATUS
57 (EFIAPI *EFI_DPC_QUEUE_DPC)(
58   IN EFI_DPC_PROTOCOL   *This,
59   IN EFI_TPL            DpcTpl,
60   IN EFI_DPC_PROCEDURE  DpcProcedure,
61   IN VOID               *DpcContext    OPTIONAL
62   );
63 
64 /**
65   Dispatch the queue of DPCs.
66 
67   DPCs with DpcTpl value greater than the current TPL value are queued, and then DPCs
68   with DpcTpl value lower than the current TPL value are queued. All DPCs in the first
69   group (higher DpcTpl values) are invoked before DPCs in the second group (lower DpcTpl values).
70 
71   @param  This  Protocol instance pointer.
72 
73   @retval EFI_SUCCESS    One or more DPCs were invoked.
74   @retval EFI_NOT_FOUND  No DPCs were invoked.
75 
76 **/
77 typedef
78 EFI_STATUS
79 (EFIAPI *EFI_DPC_DISPATCH_DPC)(
80   IN EFI_DPC_PROTOCOL  *This
81   );
82 
83 ///
84 /// DPC Protocol structure.
85 ///
86 struct _EFI_DPC_PROTOCOL {
87   EFI_DPC_QUEUE_DPC       QueueDpc;
88   EFI_DPC_DISPATCH_DPC    DispatchDpc;
89 };
90 
91 ///
92 /// DPC Protocol GUID variable.
93 ///
94 extern EFI_GUID  gEfiDpcProtocolGuid;
95 
96 #endif
97