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