]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SmmSwDispatch2.h
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Include / Protocol / SmmSwDispatch2.h
CommitLineData
83632987 1/** @file\r
d0594a9b 2 SMM Software Dispatch Protocol introduced from PI 1.2 Specification\r
83632987 3 Volume 4 System Management Mode Core Interface.\r
4\r
5 This protocol provides the parent dispatch service for a given SMI source generator.\r
6\r
9095d37b 7 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
9df063a0 8 This program and the accompanying materials\r
83632987 9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef _SMM_SW_DISPATCH2_H_\r
19#define _SMM_SW_DISPATCH2_H_\r
20\r
2f208e59 21#include <Protocol/MmSwDispatch.h>\r
83632987 22#include <Pi/PiSmmCis.h>\r
23\r
2f208e59 24#define EFI_SMM_SW_DISPATCH2_PROTOCOL_GUID EFI_MM_SW_DISPATCH_PROTOCOL_GUID\r
83632987 25\r
26///\r
27/// A particular chipset may not support all possible software SMI input values.\r
28/// For example, the ICH supports only values 00h to 0FFh. The parent only allows a single\r
29/// child registration for each SwSmiInputValue.\r
30///\r
31typedef struct {\r
32 UINTN SwSmiInputValue;\r
33} EFI_SMM_SW_REGISTER_CONTEXT;\r
34\r
35///\r
9095d37b 36/// The DispatchFunction will be called with Context set to the same value as was passed into\r
83632987 37/// this function in RegisterContext and with CommBuffer (and CommBufferSize) pointing\r
9095d37b 38/// to an instance of EFI_SMM_SW_CONTEXT indicating the index of the CPU which generated the\r
83632987 39/// software SMI.\r
40///\r
41typedef struct {\r
42 ///\r
43 /// The 0-based index of the CPU which generated the software SMI.\r
44 ///\r
45 UINTN SwSmiCpuIndex;\r
46 ///\r
47 /// This value corresponds directly to the CommandPort parameter used in the call to Trigger().\r
48 ///\r
49 UINT8 CommandPort;\r
50 ///\r
51 /// This value corresponds directly to the DataPort parameter used in the call to Trigger().\r
52 ///\r
53 UINT8 DataPort;\r
54} EFI_SMM_SW_CONTEXT;\r
55\r
56typedef struct _EFI_SMM_SW_DISPATCH2_PROTOCOL EFI_SMM_SW_DISPATCH2_PROTOCOL;\r
57\r
58/**\r
59 Register a child SMI source dispatch function for the specified software SMI.\r
60\r
9095d37b
LG
61 This service registers a function (DispatchFunction) which will be called when the software\r
62 SMI source specified by RegisterContext->SwSmiCpuIndex is detected. On return,\r
63 DispatchHandle contains a unique handle which may be used later to unregister the function\r
83632987 64 using UnRegister().\r
65\r
36e8c955 66 @param[in] This Pointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.\r
9095d37b
LG
67 @param[in] DispatchFunction Function to register for handler when the specified software\r
68 SMI is generated.\r
36e8c955 69 @param[in, out] RegisterContext Pointer to the dispatch function's context.\r
70 The caller fills this context in before calling\r
71 the register function to indicate to the register\r
72 function which Software SMI input value the\r
73 dispatch function should be invoked for.\r
74 @param[out] DispatchHandle Handle generated by the dispatcher to track the\r
75 function instance.\r
83632987 76\r
77 @retval EFI_SUCCESS The dispatch function has been successfully\r
78 registered and the SMI source has been enabled.\r
79 @retval EFI_DEVICE_ERROR The SW driver was unable to enable the SMI source.\r
80 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The SW SMI input value\r
d0594a9b 81 is not within a valid range or is already in use.\r
83632987 82 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this\r
83 child.\r
84 @retval EFI_OUT_OF_RESOURCES A unique software SMI value could not be assigned\r
85 for this dispatch.\r
86**/\r
87typedef\r
88EFI_STATUS\r
a2bb197e 89(EFIAPI *EFI_SMM_SW_REGISTER2)(\r
83632987 90 IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This,\r
91 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,\r
36e8c955 92 IN OUT EFI_SMM_SW_REGISTER_CONTEXT *RegisterContext,\r
83632987 93 OUT EFI_HANDLE *DispatchHandle\r
94 );\r
95\r
96/**\r
97 Unregister a child SMI source dispatch function for the specified software SMI.\r
98\r
9095d37b 99 This service removes the handler associated with DispatchHandle so that it will no longer be\r
83632987 100 called in response to a software SMI.\r
101\r
102 @param[in] This Pointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.\r
103 @param[in] DispatchHandle Handle of dispatch function to deregister.\r
104\r
105 @retval EFI_SUCCESS The dispatch function has been successfully unregistered.\r
106 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
107**/\r
108typedef\r
109EFI_STATUS\r
a2bb197e 110(EFIAPI *EFI_SMM_SW_UNREGISTER2)(\r
83632987 111 IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This,\r
112 IN EFI_HANDLE DispatchHandle\r
113);\r
114\r
115///\r
116/// Interface structure for the SMM Software SMI Dispatch Protocol.\r
117///\r
9095d37b
LG
118/// The EFI_SMM_SW_DISPATCH2_PROTOCOL provides the ability to install child handlers for the\r
119/// given software. These handlers will respond to software interrupts, and the maximum software\r
83632987 120/// interrupt in the EFI_SMM_SW_REGISTER_CONTEXT is denoted by MaximumSwiValue.\r
121///\r
122struct _EFI_SMM_SW_DISPATCH2_PROTOCOL {\r
a2bb197e 123 EFI_SMM_SW_REGISTER2 Register;\r
124 EFI_SMM_SW_UNREGISTER2 UnRegister;\r
83632987 125 ///\r
9095d37b 126 /// A read-only field that describes the maximum value that can be used in the\r
83632987 127 /// EFI_SMM_SW_DISPATCH2_PROTOCOL.Register() service.\r
128 ///\r
129 UINTN MaximumSwiValue;\r
130};\r
131\r
132extern EFI_GUID gEfiSmmSwDispatch2ProtocolGuid;\r
133\r
134#endif\r