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