]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmSxDispatch.h
14d5a551b894d526558bdf95dfbce83ee0f6896a
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmSxDispatch.h
1 /** @file
2 Provides the parent dispatch service for a given Sx-state source generator.
3
4 Copyright (c) 2007 - 2009, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 @par Revision Reference:
14 This Protocol is defined in Framework of EFI SMM Core Interface Spec
15 Version 0.9.
16
17 **/
18
19 #ifndef _EFI_SMM_SX_DISPATCH_H_
20 #define _EFI_SMM_SX_DISPATCH_H_
21
22
23 //
24 // Global ID for the Sx SMI Protocol
25 //
26 #define EFI_SMM_SX_DISPATCH_PROTOCOL_GUID \
27 { \
28 0x14fc52be, 0x1dc, 0x426c, {0x91, 0xae, 0xa2, 0x3c, 0x3e, 0x22, 0xa, 0xe8 } \
29 }
30
31 typedef struct _EFI_SMM_SX_DISPATCH_PROTOCOL EFI_SMM_SX_DISPATCH_PROTOCOL;
32 //
33 // Related Definitions
34 //
35 typedef enum {
36 SxS0,
37 SxS1,
38 SxS2,
39 SxS3,
40 SxS4,
41 SxS5,
42 EfiMaximumSleepType
43 } EFI_SLEEP_TYPE;
44
45 typedef enum {
46 SxEntry,
47 SxExit,
48 EfiMaximumPhase
49 } EFI_SLEEP_PHASE;
50
51 typedef struct {
52 EFI_SLEEP_TYPE Type;
53 EFI_SLEEP_PHASE Phase;
54 } EFI_SMM_SX_DISPATCH_CONTEXT;
55
56 //
57 // Member functions
58 //
59 /**
60 Dispatch function for a Sx state SMI handler.
61
62 @param DispatchHandle Handle of this dispatch function.
63 @param DispatchContext Pointer to the dispatch function's context.
64 The Type and Phase fields are filled in by the Sx dispatch driver
65 prior to invoking this dispatch function. For this interface,
66 the Sx driver will call the dispatch function for all Sx type
67 and phases, so the Sx state handler(s) must check the Type and
68 Phase field of EFI_SMM_SX_DISPATCH_CONTEXT and act accordingly.
69
70 @return None
71
72 **/
73 typedef
74 VOID
75 (EFIAPI *EFI_SMM_SX_DISPATCH)(
76 IN EFI_HANDLE DispatchHandle,
77 IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext
78 );
79
80 /**
81 Register a child SMI source dispatch function with a parent SMM driver
82
83 @param This Pointer to the EFI_SMM_SX_DISPATCH_PROTOCOL instance.
84 @param DispatchFunction Function to install.
85 @param DispatchContext Pointer to the dispatch function's context.
86 The caller fills in this context before calling
87 the register function to indicates to the register
88 function which Sx state type and phase the caller
89 wishes to be called back on. For this interface,
90 the Sx driver will call the registered handlers for
91 all Sx type and phases, so the Sx state handler(s)
92 must check the Type and Phase field of the Dispatch
93 context and act accordingly.
94 @param DispatchHandle Handle of dispatch function, for interfacing
95 with the parent Sx state SMM driver.
96
97 @retval EFI_SUCCESS The dispatch function has been successfully
98 registered and the SMI source has been enabled.
99 @retval EFI_UNSUPPORTED The Sx driver or hardware does not support that
100 Sx Type/Phase.
101 @retval EFI_DEVICE_ERROR The Sx driver was unable to enable the SMI source.
102 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
103 child.
104 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. Type & Phase are not
105 within valid range.
106
107 **/
108 typedef
109 EFI_STATUS
110 (EFIAPI *EFI_SMM_SX_REGISTER)(
111 IN EFI_SMM_SX_DISPATCH_PROTOCOL *This,
112 IN EFI_SMM_SX_DISPATCH DispatchFunction,
113 IN EFI_SMM_SX_DISPATCH_CONTEXT *DispatchContext,
114 OUT EFI_HANDLE *DispatchHandle
115 );
116
117 /**
118 Unregisters an Sx-state service
119
120 @param This Pointer to the EFI_SMM_SX_DISPATCH_PROTOCOL instance.
121 @param DispatchHandle Handle of the service to remove.
122
123 @retval EFI_SUCCESS The dispatch function has been successfully unregistered and the
124 SMI source has been disabled if there are no other registered child
125 dispatch functions for this SMI source.
126 @retval EFI_INVALID_PARAMETER Handle is invalid.
127
128 **/
129 typedef
130 EFI_STATUS
131 (EFIAPI *EFI_SMM_SX_UNREGISTER)(
132 IN EFI_SMM_SX_DISPATCH_PROTOCOL *This,
133 IN EFI_HANDLE DispatchHandle
134 );
135
136 //
137 // Interface structure for the SMM Child Dispatch Protocol
138 //
139 /**
140 Provides the parent dispatch service for a given Sx-state source generator.
141 **/
142 struct _EFI_SMM_SX_DISPATCH_PROTOCOL {
143 EFI_SMM_SX_REGISTER Register; ///< Installs a child service to be dispatched by this protocol.
144 EFI_SMM_SX_UNREGISTER UnRegister; ///< Removes a child service dispatched by this protocol.
145 };
146
147 extern EFI_GUID gEfiSmmSxDispatchProtocolGuid;
148
149 #endif