Refine SMM USB Dispatch Protocol definition.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmUsbDispatch.h
CommitLineData
79964ac8 1/** @file\r
8411f1c0 2 Provides the parent dispatch service for the USB SMI source generator.\r
79964ac8 3\r
d97286f4 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
d97286f4 16\r
79964ac8 17**/\r
18\r
19#ifndef _EFI_SMM_USB_DISPATCH_H_\r
20#define _EFI_SMM_USB_DISPATCH_H_\r
21\r
b80fbe85 22#include <PiDxe.h>\r
23\r
79964ac8 24//\r
25// Global ID for the USB Protocol\r
26//\r
27#define EFI_SMM_USB_DISPATCH_PROTOCOL_GUID \\r
28 { \\r
29 0xa05b6ffd, 0x87af, 0x4e42, {0x95, 0xc9, 0x62, 0x28, 0xb6, 0x3c, 0xf3, 0xf3 } \\r
30 }\r
31\r
32typedef struct _EFI_SMM_USB_DISPATCH_PROTOCOL EFI_SMM_USB_DISPATCH_PROTOCOL;\r
33\r
34//\r
35// Related Definitions\r
36//\r
37typedef enum {\r
38 UsbLegacy,\r
39 UsbWake\r
40} EFI_USB_SMI_TYPE;\r
41\r
42typedef struct {\r
534b8251 43 ///\r
44 /// Describes whether this child handler will be invoked in response to a USB legacy\r
45 /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a\r
46 /// USB wake event, such as resumption from a sleep state. \r
47 ///\r
79964ac8 48 EFI_USB_SMI_TYPE Type;\r
534b8251 49 ///\r
50 /// The device path is part of the context structure and describes the location of the\r
51 /// particular USB host controller in the system for which this register event will occur.\r
52 /// This location is important because of the possible integration of several USB host\r
53 /// controllers in a system. \r
54 ///\r
79964ac8 55 EFI_DEVICE_PATH_PROTOCOL *Device;\r
56} EFI_SMM_USB_DISPATCH_CONTEXT;\r
57\r
58//\r
59// Member functions\r
60//\r
61/**\r
62 Dispatch function for a USB SMI handler.\r
63\r
64 @param DispatchHandle Handle of this dispatch function.\r
65 @param DispatchContext Pointer to the dispatch function's context.\r
66 The DispatchContext fields are filled in\r
67 by the dispatching driver prior to\r
68 invoking this dispatch function.\r
69\r
79964ac8 70**/\r
71typedef\r
72VOID\r
69686d56 73(EFIAPI *EFI_SMM_USB_DISPATCH)(\r
79964ac8 74 IN EFI_HANDLE DispatchHandle,\r
75 IN EFI_SMM_USB_DISPATCH_CONTEXT *DispatchContext\r
76 );\r
77\r
78/**\r
d97286f4 79 Register a child SMI source dispatch function with a parent SMM driver.\r
79964ac8 80\r
700a7869 81 @param This Pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.\r
82 @param DispatchFunction Pointer to dispatch function to be invoked \r
83 for this SMI source.\r
79964ac8 84 @param DispatchContext Pointer to the dispatch function's context.\r
85 The caller fills this context in before calling\r
86 the register function to indicate to the register\r
87 function the USB SMI types for which the dispatch\r
88 function should be invoked.\r
700a7869 89 @param DispatchHandle Handle generated by the dispatcher to track the \r
90 function instance.\r
79964ac8 91\r
92 @retval EFI_SUCCESS The dispatch function has been successfully\r
93 registered and the SMI source has been enabled.\r
94 @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.\r
95 @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this\r
96 child.\r
97 @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The USB SMI type\r
98 is not within valid range.\r
99\r
100**/\r
101typedef\r
102EFI_STATUS\r
69686d56 103(EFIAPI *EFI_SMM_USB_REGISTER)(\r
79964ac8 104 IN EFI_SMM_USB_DISPATCH_PROTOCOL *This,\r
105 IN EFI_SMM_USB_DISPATCH DispatchFunction,\r
106 IN EFI_SMM_USB_DISPATCH_CONTEXT *DispatchContext,\r
107 OUT EFI_HANDLE *DispatchHandle\r
108 );\r
109\r
110/**\r
d97286f4 111 Unregisters a USB service.\r
79964ac8 112\r
700a7869 113 @param This Pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.\r
114 @param DispatchHandle Handle of the service to remove.\r
79964ac8 115\r
116 @retval EFI_SUCCESS The dispatch function has been successfully\r
117 unregistered and the SMI source has been disabled\r
118 if there are no other registered child dispatch\r
119 functions for this SMI source.\r
d97286f4 120 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
79964ac8 121\r
122**/\r
123typedef\r
124EFI_STATUS\r
69686d56 125(EFIAPI *EFI_SMM_USB_UNREGISTER)(\r
79964ac8 126 IN EFI_SMM_USB_DISPATCH_PROTOCOL *This,\r
127 IN EFI_HANDLE DispatchHandle\r
128 );\r
129\r
d97286f4 130///\r
131/// The EFI_SMM_USB_DISPATCH_PROTOCOL provides the ability to install child handlers for the\r
132/// given event types.\r
133///\r
79964ac8 134struct _EFI_SMM_USB_DISPATCH_PROTOCOL {\r
135 EFI_SMM_USB_REGISTER Register;\r
136 EFI_SMM_USB_UNREGISTER UnRegister;\r
137};\r
138\r
139extern EFI_GUID gEfiSmmUsbDispatchProtocolGuid;\r
140\r
141#endif\r