]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/MmUsbDispatch.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / MmUsbDispatch.h
CommitLineData
07c6a47e
ED
1/** @file\r
2 MM USB Dispatch Protocol as defined in PI 1.5 Specification\r
3 Volume 4 Management Mode Core Interface.\r
4\r
5 Provides the parent dispatch service for the USB MMI source generator.\r
6\r
7 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
9344f092 8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
07c6a47e
ED
9\r
10 @par Revision Reference:\r
11 This protocol is from PI Version 1.5.\r
12\r
13**/\r
14\r
15#ifndef _MM_USB_DISPATCH_H_\r
16#define _MM_USB_DISPATCH_H_\r
17\r
18#include <Pi/PiMmCis.h>\r
19\r
20#define EFI_MM_USB_DISPATCH_PROTOCOL_GUID \\r
21 { \\r
22 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 } \\r
23 }\r
24\r
25///\r
26/// USB MMI event types\r
27///\r
28typedef enum {\r
29 UsbLegacy,\r
30 UsbWake\r
31} EFI_USB_MMI_TYPE;\r
32\r
33///\r
34/// The dispatch function's context.\r
35///\r
36typedef struct {\r
37 ///\r
38 /// Describes whether this child handler will be invoked in response to a USB legacy\r
39 /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a\r
40 /// USB wake event, such as resumption from a sleep state.\r
41 ///\r
42 EFI_USB_MMI_TYPE Type;\r
43 ///\r
44 /// The device path is part of the context structure and describes the location of the\r
45 /// particular USB host controller in the system for which this register event will occur.\r
46 /// This location is important because of the possible integration of several USB host\r
47 /// controllers in a system.\r
48 ///\r
49 EFI_DEVICE_PATH_PROTOCOL *Device;\r
50} EFI_MM_USB_REGISTER_CONTEXT;\r
51\r
52typedef struct _EFI_MM_USB_DISPATCH_PROTOCOL EFI_MM_USB_DISPATCH_PROTOCOL;\r
53\r
54/**\r
55 Provides the parent dispatch service for the USB MMI source generator.\r
56\r
57 This service registers a function (DispatchFunction) which will be called when the USB-\r
58 related MMI specified by RegisterContext has occurred. On return, DispatchHandle\r
59 contains a unique handle which may be used later to unregister the function using UnRegister().\r
60 The DispatchFunction will be called with Context set to the same value as was passed into\r
61 this function in RegisterContext and with CommBuffer containing NULL and\r
62 CommBufferSize containing zero.\r
63\r
64 @param[in] This Pointer to the EFI_MM_USB_DISPATCH_PROTOCOL instance.\r
65 @param[in] DispatchFunction Function to register for handler when a USB-related MMI occurs.\r
66 @param[in] RegisterContext Pointer to the dispatch function's context.\r
67 The caller fills this context in before calling\r
68 the register function to indicate to the register\r
69 function the USB MMI types for which the dispatch\r
70 function should be invoked.\r
71 @param[out] DispatchHandle Handle generated by the dispatcher to track the function instance.\r
72\r
73 @retval EFI_SUCCESS The dispatch function has been successfully\r
74 registered and the MMI source has been enabled.\r
75 @retval EFI_DEVICE_ERROR The driver was unable to enable the MMI source.\r
76 @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The USB MMI type\r
77 is not within valid range.\r
78 @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or MM) to manage this child.\r
79**/\r
80typedef\r
81EFI_STATUS\r
82(EFIAPI *EFI_MM_USB_REGISTER)(\r
83 IN CONST EFI_MM_USB_DISPATCH_PROTOCOL *This,\r
84 IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,\r
85 IN CONST EFI_MM_USB_REGISTER_CONTEXT *RegisterContext,\r
86 OUT EFI_HANDLE *DispatchHandle\r
87 );\r
88\r
89/**\r
90 Unregisters a USB service.\r
91\r
92 This service removes the handler associated with DispatchHandle so that it will no longer be\r
93 called when the USB event occurs.\r
94\r
95 @param[in] This Pointer to the EFI_MM_USB_DISPATCH_PROTOCOL instance.\r
96 @param[in] DispatchHandle Handle of the service to remove.\r
97\r
98 @retval EFI_SUCCESS The dispatch function has been successfully\r
99 unregistered and the MMI source has been disabled\r
100 if there are no other registered child dispatch\r
101 functions for this MMI source.\r
102 @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.\r
103**/\r
104typedef\r
105EFI_STATUS\r
106(EFIAPI *EFI_MM_USB_UNREGISTER)(\r
107 IN CONST EFI_MM_USB_DISPATCH_PROTOCOL *This,\r
108 IN EFI_HANDLE DispatchHandle\r
109 );\r
110\r
111///\r
112/// Interface structure for the MM USB MMI Dispatch Protocol\r
113///\r
114/// This protocol provides the parent dispatch service for the USB MMI source generator.\r
115///\r
116struct _EFI_MM_USB_DISPATCH_PROTOCOL {\r
117 EFI_MM_USB_REGISTER Register;\r
118 EFI_MM_USB_UNREGISTER UnRegister;\r
119};\r
120\r
121extern EFI_GUID gEfiMmUsbDispatchProtocolGuid;\r
122\r
123#endif\r
124\r