]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmSwDispatch.h
Minor code enhancement.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmSwDispatch.h
1 /** @file
2 Provides the parent dispatch service for a given SMI 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 for EFI SMM Core Interface Spec
15 Version 0.9.
16
17 **/
18
19 #ifndef _EFI_SMM_SW_DISPATCH_H_
20 #define _EFI_SMM_SW_DISPATCH_H_
21
22
23 //
24 // Global ID for the SW SMI Protocol
25 //
26 #define EFI_SMM_SW_DISPATCH_PROTOCOL_GUID \
27 { \
28 0xe541b773, 0xdd11, 0x420c, {0xb0, 0x26, 0xdf, 0x99, 0x36, 0x53, 0xf8, 0xbf } \
29 }
30
31 typedef struct _EFI_SMM_SW_DISPATCH_PROTOCOL EFI_SMM_SW_DISPATCH_PROTOCOL;
32
33 //
34 // Related Definitions
35 //
36 //
37 // A particular chipset may not support all possible software SMI input values.
38 // For example, the ICH supports only values 00h to 0FFh. The parent only allows a single
39 // child registration for each SwSmiInputValue.
40 //
41 typedef struct {
42 UINTN SwSmiInputValue;
43 } EFI_SMM_SW_DISPATCH_CONTEXT;
44
45 //
46 // Member functions
47 //
48 /**
49 Dispatch function for a Software SMI handler.
50
51 @param DispatchHandle Handle of this dispatch function.
52 @param DispatchContext Pointer to the dispatch function's context.
53 The SwSmiInputValue field is filled in
54 by the software dispatch driver prior to
55 invoking this dispatch function.
56 The dispatch function will only be called
57 for input values for which it is registered.
58
59 @return None
60
61 **/
62 typedef
63 VOID
64 (EFIAPI *EFI_SMM_SW_DISPATCH)(
65 IN EFI_HANDLE DispatchHandle,
66 IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext
67 );
68
69 /**
70 Register a child SMI source dispatch function with a parent SMM driver
71
72 @param This Pointer to the EFI_SMM_SW_DISPATCH_PROTOCOL instance.
73 @param DispatchFunction Function to install.
74 @param DispatchContext Pointer to the dispatch function's context.
75 Indicates to the register
76 function the Software SMI input value for which to invoke the
77 dispatch function.
78 @param DispatchHandle Handle generated by the dispatcher to track the function instance.
79
80 @retval EFI_SUCCESS The dispatch function has been successfully
81 registered and the SMI source has been enabled.
82 @retval EFI_DEVICE_ERROR The SW driver could not enable the SMI source.
83 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
84 child.
85 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The SW SMI input value
86 is not within valid range.
87
88 **/
89 typedef
90 EFI_STATUS
91 (EFIAPI *EFI_SMM_SW_REGISTER)(
92 IN EFI_SMM_SW_DISPATCH_PROTOCOL *This,
93 IN EFI_SMM_SW_DISPATCH DispatchFunction,
94 IN EFI_SMM_SW_DISPATCH_CONTEXT *DispatchContext,
95 OUT EFI_HANDLE *DispatchHandle
96 );
97
98 /**
99 Unregister a child SMI source dispatch function with a parent SMM driver
100
101 @param This Pointer to the EFI_SMM_SW_DISPATCH_PROTOCOL instance.
102 @param DispatchHandle Handle of the service to remove.
103
104 @retval EFI_SUCCESS The dispatch function has been successfully
105 unregistered and the SMI source has been disabled
106 if there are no other registered child dispatch
107 functions for this SMI source.
108 @retval EFI_INVALID_PARAMETER Handle is invalid.
109
110 **/
111 typedef
112 EFI_STATUS
113 (EFIAPI *EFI_SMM_SW_UNREGISTER)(
114 IN EFI_SMM_SW_DISPATCH_PROTOCOL *This,
115 IN EFI_HANDLE DispatchHandle
116 );
117
118
119 //
120 // Interface structure for the SMM Software SMI Dispatch Protocol
121 //
122 /**
123 Provides the parent dispatch service for a given SMI source generator.
124 **/
125 ///
126 /// Inconsistent with specification here:
127 /// In framework spec SmmCis, this definition is named as _EFI_SMM_ICHN_DISPATCH_PROTOCOL by mistake.
128 ///
129 struct _EFI_SMM_SW_DISPATCH_PROTOCOL {
130 ///
131 /// Installs a child service to be dispatched by this protocol.
132 ///
133 EFI_SMM_SW_REGISTER Register;
134
135 ///
136 /// Removes a child service dispatched by this protocol.
137 ///
138 EFI_SMM_SW_UNREGISTER UnRegister;
139
140 ///
141 /// A read-only field that describes the maximum value that can be used
142 /// in the EFI_SMM_SW_DISPATCH_PROTOCOL.Register() service.
143 ///
144 UINTN MaximumSwiValue;
145 };
146
147 extern EFI_GUID gEfiSmmSwDispatchProtocolGuid;
148
149 #endif