]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SmmSxDispatch2.h
Rename PI SMM definitions which has same name with those of Framework SMM spec but...
[mirror_edk2.git] / MdePkg / Include / Protocol / SmmSxDispatch2.h
1 /** @file
2 SMM Sx Dispatch Protocol as defined in PI 1.2 Specification
3 Volume 4 System Management Mode Core Interface.
4
5 Provides the parent dispatch service for a given Sx-state source generator.
6
7 Copyright (c) 2009, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _SMM_SX_DISPATCH2_H_
19 #define _SMM_SX_DISPATCH2_H_
20
21 #include <Pi/PiSmmCis.h>
22
23 ///
24 /// Note:
25 /// To avoid name conflict between PI and Framework SMM spec, the following names defined
26 /// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.
27 ///
28 /// EFI_SMM_SX_REGISTER -> EFI_SMM_SX_REGISTER2
29 /// EFI_SMM_SX_UNREGISTER -> EFI_SMM_SX_UNREGISTER2
30 ///
31
32 #define EFI_SMM_SX_DISPATCH2_PROTOCOL_GUID \
33 { \
34 0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d } \
35 }
36
37 ///
38 /// Sleep states S0-S5
39 ///
40 typedef enum {
41 SxS0,
42 SxS1,
43 SxS2,
44 SxS3,
45 SxS4,
46 SxS5,
47 EfiMaximumSleepType
48 } EFI_SLEEP_TYPE;
49
50 ///
51 /// Sleep state phase: entry or exit
52 ///
53 typedef enum {
54 SxEntry,
55 SxExit,
56 EfiMaximumPhase
57 } EFI_SLEEP_PHASE;
58
59 ///
60 /// The dispatch function's context
61 ///
62 typedef struct {
63 EFI_SLEEP_TYPE Type;
64 EFI_SLEEP_PHASE Phase;
65 } EFI_SMM_SX_REGISTER_CONTEXT;
66
67 typedef struct _EFI_SMM_SX_DISPATCH2_PROTOCOL EFI_SMM_SX_DISPATCH2_PROTOCOL;
68
69 /**
70 Provides the parent dispatch service for a given Sx source generator.
71
72 This service registers a function (DispatchFunction) which will be called when the sleep state
73 event specified by RegisterContext is detected. On return, DispatchHandle contains a
74 unique handle which may be used later to unregister the function using UnRegister().
75 The DispatchFunction will be called with Context set to the same value as was passed into
76 this function in RegisterContext and with CommBuffer and CommBufferSize set to
77 NULL and 0 respectively.
78
79 @param[in] This Pointer to the EFI_SMM_SX_DISPATCH2_PROTOCOL instance.
80 @param[in] DispatchFunction Function to register for handler when the specified sleep state event occurs.
81 @param[in] RegisterContext Pointer to the dispatch function's context.
82 The caller fills this context in before calling
83 the register function to indicate to the register
84 function which Sx state type and phase the caller
85 wishes to be called back on. For this intertace,
86 the Sx driver will call the registered handlers for
87 all Sx type and phases, so the Sx state handler(s)
88 must check the Type and Phase field of the Dispatch
89 context and act accordingly.
90 @param[out] DispatchHandle Handle of dispatch function, for when interfacing
91 with the parent Sx state SMM driver.
92
93 @retval EFI_SUCCESS The dispatch function has been successfully
94 registered and the SMI source has been enabled.
95 @retval EFI_UNSUPPORTED The Sx driver or hardware does not support that
96 Sx Type/Phase.
97 @retval EFI_DEVICE_ERROR The Sx driver was unable to enable the SMI source.
98 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. Type & Phase are not
99 within valid range.
100 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this
101 child.
102 **/
103 typedef
104 EFI_STATUS
105 (EFIAPI *EFI_SMM_SX_REGISTER2)(
106 IN CONST EFI_SMM_SX_DISPATCH2_PROTOCOL *This,
107 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,
108 IN CONST EFI_SMM_SX_REGISTER_CONTEXT *RegisterContext,
109 OUT EFI_HANDLE *DispatchHandle
110 );
111
112 /**
113 Unregisters an Sx-state service.
114
115 This service removes the handler associated with DispatchHandle so that it will no longer be
116 called in response to sleep event.
117
118 @param[in] This Pointer to the EFI_SMM_SX_DISPATCH2_PROTOCOL instance.
119 @param[in] DispatchHandle Handle of the service to remove.
120
121 @retval EFI_SUCCESS The service has been successfully removed.
122 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
123 **/
124 typedef
125 EFI_STATUS
126 (EFIAPI *EFI_SMM_SX_UNREGISTER2)(
127 IN CONST EFI_SMM_SX_DISPATCH2_PROTOCOL *This,
128 IN EFI_HANDLE DispatchHandle
129 );
130
131 ///
132 /// Interface structure for the SMM Sx Dispatch Protocol
133 ///
134 /// The EFI_SMM_SX_DISPATCH2_PROTOCOL provides the ability to install child handlers to
135 /// respond to sleep state related events.
136 ///
137 struct _EFI_SMM_SX_DISPATCH2_PROTOCOL {
138 EFI_SMM_SX_REGISTER2 Register;
139 EFI_SMM_SX_UNREGISTER2 UnRegister;
140 };
141
142 extern EFI_GUID gEfiSmmSxDispatch2ProtocolGuid;
143
144 #endif