]>
Commit | Line | Data |
---|---|---|
07c6a47e ED |
1 | /** @file\r |
2 | MM Sx Dispatch Protocol as defined in PI 1.5 Specification\r | |
3 | Volume 4 Management Mode Core Interface.\r | |
4 | \r | |
5 | Provides the parent dispatch service for a given Sx-state source generator.\r | |
6 | \r | |
7 | Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r | |
9344f092 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
07c6a47e ED |
9 | \r |
10 | **/\r | |
11 | \r | |
12 | #ifndef _MM_SX_DISPATCH_H_\r | |
13 | #define _MM_SX_DISPATCH_H_\r | |
14 | \r | |
15 | #include <Pi/PiMmCis.h>\r | |
16 | \r | |
17 | #define EFI_MM_SX_DISPATCH_PROTOCOL_GUID \\r | |
18 | { \\r | |
19 | 0x456d2859, 0xa84b, 0x4e47, {0xa2, 0xee, 0x32, 0x76, 0xd8, 0x86, 0x99, 0x7d } \\r | |
20 | }\r | |
21 | \r | |
22 | ///\r | |
23 | /// Sleep states S0-S5\r | |
24 | ///\r | |
25 | typedef enum {\r | |
26 | SxS0,\r | |
27 | SxS1,\r | |
28 | SxS2,\r | |
29 | SxS3,\r | |
30 | SxS4,\r | |
31 | SxS5,\r | |
32 | EfiMaximumSleepType\r | |
33 | } EFI_SLEEP_TYPE;\r | |
34 | \r | |
35 | ///\r | |
36 | /// Sleep state phase: entry or exit\r | |
37 | ///\r | |
38 | typedef enum {\r | |
39 | SxEntry,\r | |
40 | SxExit,\r | |
41 | EfiMaximumPhase\r | |
42 | } EFI_SLEEP_PHASE;\r | |
43 | \r | |
44 | ///\r | |
45 | /// The dispatch function's context\r | |
46 | ///\r | |
47 | typedef struct {\r | |
48 | EFI_SLEEP_TYPE Type;\r | |
49 | EFI_SLEEP_PHASE Phase;\r | |
50 | } EFI_MM_SX_REGISTER_CONTEXT;\r | |
51 | \r | |
52 | typedef struct _EFI_MM_SX_DISPATCH_PROTOCOL EFI_MM_SX_DISPATCH_PROTOCOL;\r | |
53 | \r | |
54 | /**\r | |
55 | Provides the parent dispatch service for a given Sx source generator.\r | |
56 | \r | |
57 | This service registers a function (DispatchFunction) which will be called when the sleep state\r | |
58 | event specified by RegisterContext is detected. On return, DispatchHandle contains a\r | |
59 | unique handle which may be used later to unregister the function using UnRegister().\r | |
60 | The DispatchFunction will be called with Context set to the same value as was passed into\r | |
61 | this function in RegisterContext and with CommBuffer and CommBufferSize set to\r | |
62 | NULL and 0 respectively.\r | |
63 | \r | |
64 | @param[in] This Pointer to the EFI_MM_SX_DISPATCH_PROTOCOL instance.\r | |
65 | @param[in] DispatchFunction Function to register for handler when the specified sleep state event occurs.\r | |
66 | @param[in] RegisterContext Pointer to the dispatch function's context.\r | |
67 | The caller fills this context in before calling\r | |
68 | the register function to indicate to the register\r | |
69 | function which Sx state type and phase the caller\r | |
70 | wishes to be called back on. For this intertace,\r | |
71 | the Sx driver will call the registered handlers for\r | |
72 | all Sx type and phases, so the Sx state handler(s)\r | |
73 | must check the Type and Phase field of the Dispatch\r | |
74 | context and act accordingly.\r | |
75 | @param[out] DispatchHandle Handle of dispatch function, for when interfacing\r | |
76 | with the parent Sx state MM driver.\r | |
77 | \r | |
78 | @retval EFI_SUCCESS The dispatch function has been successfully\r | |
79 | registered and the MMI source has been enabled.\r | |
80 | @retval EFI_UNSUPPORTED The Sx driver or hardware does not support that\r | |
81 | Sx Type/Phase.\r | |
82 | @retval EFI_DEVICE_ERROR The Sx driver was unable to enable the MMI source.\r | |
83 | @retval EFI_INVALID_PARAMETER RegisterContext is invalid. Type & Phase are not\r | |
84 | within valid range.\r | |
85 | @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this\r | |
86 | child.\r | |
87 | **/\r | |
88 | typedef\r | |
89 | EFI_STATUS\r | |
90 | (EFIAPI *EFI_MM_SX_REGISTER)(\r | |
91 | IN CONST EFI_MM_SX_DISPATCH_PROTOCOL *This,\r | |
92 | IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,\r | |
93 | IN CONST EFI_MM_SX_REGISTER_CONTEXT *RegisterContext,\r | |
94 | OUT EFI_HANDLE *DispatchHandle\r | |
95 | );\r | |
96 | \r | |
97 | /**\r | |
98 | Unregisters an Sx-state service.\r | |
99 | \r | |
100 | This service removes the handler associated with DispatchHandle so that it will no longer be\r | |
101 | called in response to sleep event.\r | |
102 | \r | |
103 | @param[in] This Pointer to the EFI_MM_SX_DISPATCH_PROTOCOL instance.\r | |
104 | @param[in] DispatchHandle Handle of the service to remove.\r | |
105 | \r | |
106 | @retval EFI_SUCCESS The service has been successfully removed.\r | |
107 | @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r | |
108 | **/\r | |
109 | typedef\r | |
110 | EFI_STATUS\r | |
111 | (EFIAPI *EFI_MM_SX_UNREGISTER)(\r | |
112 | IN CONST EFI_MM_SX_DISPATCH_PROTOCOL *This,\r | |
113 | IN EFI_HANDLE DispatchHandle\r | |
114 | );\r | |
115 | \r | |
116 | ///\r | |
117 | /// Interface structure for the MM Sx Dispatch Protocol\r | |
118 | ///\r | |
119 | /// The EFI_MM_SX_DISPATCH_PROTOCOL provides the ability to install child handlers to\r | |
120 | /// respond to sleep state related events.\r | |
121 | ///\r | |
122 | struct _EFI_MM_SX_DISPATCH_PROTOCOL {\r | |
123 | EFI_MM_SX_REGISTER Register;\r | |
124 | EFI_MM_SX_UNREGISTER UnRegister;\r | |
125 | };\r | |
126 | \r | |
127 | extern EFI_GUID gEfiMmSxDispatchProtocolGuid;\r | |
128 | \r | |
129 | #endif\r |