]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SmmSwDispatch2.h
MdePkg: Replace BSD License with BSD+Patent License
[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
9344f092 8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
83632987 9\r
10**/\r
11\r
12#ifndef _SMM_SW_DISPATCH2_H_\r
13#define _SMM_SW_DISPATCH2_H_\r
14\r
2f208e59 15#include <Protocol/MmSwDispatch.h>\r
83632987 16#include <Pi/PiSmmCis.h>\r
17\r
2f208e59 18#define EFI_SMM_SW_DISPATCH2_PROTOCOL_GUID EFI_MM_SW_DISPATCH_PROTOCOL_GUID\r
83632987 19\r
20///\r
21/// A particular chipset may not support all possible software SMI input values.\r
22/// For example, the ICH supports only values 00h to 0FFh. The parent only allows a single\r
23/// child registration for each SwSmiInputValue.\r
24///\r
25typedef struct {\r
26 UINTN SwSmiInputValue;\r
27} EFI_SMM_SW_REGISTER_CONTEXT;\r
28\r
29///\r
9095d37b 30/// The DispatchFunction will be called with Context set to the same value as was passed into\r
83632987 31/// this function in RegisterContext and with CommBuffer (and CommBufferSize) pointing\r
9095d37b 32/// to an instance of EFI_SMM_SW_CONTEXT indicating the index of the CPU which generated the\r
83632987 33/// software SMI.\r
34///\r
35typedef struct {\r
36 ///\r
37 /// The 0-based index of the CPU which generated the software SMI.\r
38 ///\r
39 UINTN SwSmiCpuIndex;\r
40 ///\r
41 /// This value corresponds directly to the CommandPort parameter used in the call to Trigger().\r
42 ///\r
43 UINT8 CommandPort;\r
44 ///\r
45 /// This value corresponds directly to the DataPort parameter used in the call to Trigger().\r
46 ///\r
47 UINT8 DataPort;\r
48} EFI_SMM_SW_CONTEXT;\r
49\r
50typedef struct _EFI_SMM_SW_DISPATCH2_PROTOCOL EFI_SMM_SW_DISPATCH2_PROTOCOL;\r
51\r
52/**\r
53 Register a child SMI source dispatch function for the specified software SMI.\r
54\r
9095d37b
LG
55 This service registers a function (DispatchFunction) which will be called when the software\r
56 SMI source specified by RegisterContext->SwSmiCpuIndex is detected. On return,\r
57 DispatchHandle contains a unique handle which may be used later to unregister the function\r
83632987 58 using UnRegister().\r
59\r
36e8c955 60 @param[in] This Pointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.\r
9095d37b
LG
61 @param[in] DispatchFunction Function to register for handler when the specified software\r
62 SMI is generated.\r
36e8c955 63 @param[in, out] RegisterContext Pointer to the dispatch function's context.\r
64 The caller fills this context in before calling\r
65 the register function to indicate to the register\r
66 function which Software SMI input value the\r
67 dispatch function should be invoked for.\r
68 @param[out] DispatchHandle Handle generated by the dispatcher to track the\r
69 function instance.\r
83632987 70\r
71 @retval EFI_SUCCESS The dispatch function has been successfully\r
72 registered and the SMI source has been enabled.\r
73 @retval EFI_DEVICE_ERROR The SW driver was unable to enable the SMI source.\r
74 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The SW SMI input value\r
d0594a9b 75 is not within a valid range or is already in use.\r
83632987 76 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this\r
77 child.\r
78 @retval EFI_OUT_OF_RESOURCES A unique software SMI value could not be assigned\r
79 for this dispatch.\r
80**/\r
81typedef\r
82EFI_STATUS\r
a2bb197e 83(EFIAPI *EFI_SMM_SW_REGISTER2)(\r
83632987 84 IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This,\r
85 IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,\r
36e8c955 86 IN OUT EFI_SMM_SW_REGISTER_CONTEXT *RegisterContext,\r
83632987 87 OUT EFI_HANDLE *DispatchHandle\r
88 );\r
89\r
90/**\r
91 Unregister a child SMI source dispatch function for the specified software SMI.\r
92\r
9095d37b 93 This service removes the handler associated with DispatchHandle so that it will no longer be\r
83632987 94 called in response to a software SMI.\r
95\r
96 @param[in] This Pointer to the EFI_SMM_SW_DISPATCH2_PROTOCOL instance.\r
97 @param[in] DispatchHandle Handle of dispatch function to deregister.\r
98\r
99 @retval EFI_SUCCESS The dispatch function has been successfully unregistered.\r
100 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
101**/\r
102typedef\r
103EFI_STATUS\r
a2bb197e 104(EFIAPI *EFI_SMM_SW_UNREGISTER2)(\r
83632987 105 IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This,\r
106 IN EFI_HANDLE DispatchHandle\r
107);\r
108\r
109///\r
110/// Interface structure for the SMM Software SMI Dispatch Protocol.\r
111///\r
9095d37b
LG
112/// The EFI_SMM_SW_DISPATCH2_PROTOCOL provides the ability to install child handlers for the\r
113/// given software. These handlers will respond to software interrupts, and the maximum software\r
83632987 114/// interrupt in the EFI_SMM_SW_REGISTER_CONTEXT is denoted by MaximumSwiValue.\r
115///\r
116struct _EFI_SMM_SW_DISPATCH2_PROTOCOL {\r
a2bb197e 117 EFI_SMM_SW_REGISTER2 Register;\r
118 EFI_SMM_SW_UNREGISTER2 UnRegister;\r
83632987 119 ///\r
9095d37b 120 /// A read-only field that describes the maximum value that can be used in the\r
83632987 121 /// EFI_SMM_SW_DISPATCH2_PROTOCOL.Register() service.\r
122 ///\r
123 UINTN MaximumSwiValue;\r
124};\r
125\r
126extern EFI_GUID gEfiSmmSwDispatch2ProtocolGuid;\r
127\r
128#endif\r