Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | SMM USB Dispatch2 Protocol as defined in PI 1.1 Specification
|
| 3 | Volume 4 System Management Mode Core Interface.
|
| 4 |
|
| 5 | Provides the parent dispatch service for the USB SMI source generator.
|
| 6 |
|
| 7 | Copyright (c) 2009 - 2010, 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.1.
|
| 18 |
|
| 19 | **/
|
| 20 |
|
| 21 | #ifndef _SMM_USB_DISPATCH2_H_
|
| 22 | #define _SMM_USB_DISPATCH2_H_
|
| 23 |
|
| 24 | #include <Pi/PiSmmCis.h>
|
| 25 |
|
| 26 | #define EFI_SMM_USB_DISPATCH2_PROTOCOL_GUID \
|
| 27 | { \
|
| 28 | 0xee9b8d90, 0xc5a6, 0x40a2, {0xbd, 0xe2, 0x52, 0x55, 0x8d, 0x33, 0xcc, 0xa1 } \
|
| 29 | }
|
| 30 |
|
| 31 | ///
|
| 32 | /// USB SMI event types
|
| 33 | ///
|
| 34 | typedef enum {
|
| 35 | UsbLegacy,
|
| 36 | UsbWake
|
| 37 | } EFI_USB_SMI_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_SMI_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_SMM_USB_REGISTER_CONTEXT;
|
| 57 |
|
| 58 | typedef struct _EFI_SMM_USB_DISPATCH2_PROTOCOL EFI_SMM_USB_DISPATCH2_PROTOCOL;
|
| 59 |
|
| 60 | /**
|
| 61 | Provides the parent dispatch service for the USB SMI source generator.
|
| 62 |
|
| 63 | This service registers a function (DispatchFunction) which will be called when the USB-
|
| 64 | related SMI 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_SMM_USB_DISPATCH2_PROTOCOL instance.
|
| 71 | @param[in] DispatchFunction Function to register for handler when a USB-related SMI 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 SMI 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 SMI source has been enabled.
|
| 81 | @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
|
| 82 | @retval EFI_INVALID_PARAMETER RegisterContext is invalid. The USB SMI type
|
| 83 | is not within valid range.
|
| 84 | @retval EFI_OUT_OF_RESOURCES There is not enough memory (system or SMM) to manage this child.
|
| 85 | **/
|
| 86 | typedef
|
| 87 | EFI_STATUS
|
| 88 | (EFIAPI *EFI_SMM_USB_REGISTER2)(
|
| 89 | IN CONST EFI_SMM_USB_DISPATCH2_PROTOCOL *This,
|
| 90 | IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,
|
| 91 | IN CONST EFI_SMM_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_SMM_USB_DISPATCH2_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 SMI source has been disabled
|
| 106 | if there are no other registered child dispatch
|
| 107 | functions for this SMI source.
|
| 108 | @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
|
| 109 | **/
|
| 110 | typedef
|
| 111 | EFI_STATUS
|
| 112 | (EFIAPI *EFI_SMM_USB_UNREGISTER2)(
|
| 113 | IN CONST EFI_SMM_USB_DISPATCH2_PROTOCOL *This,
|
| 114 | IN EFI_HANDLE DispatchHandle
|
| 115 | );
|
| 116 |
|
| 117 | ///
|
| 118 | /// Interface structure for the SMM USB SMI Dispatch2 Protocol
|
| 119 | ///
|
| 120 | /// This protocol provides the parent dispatch service for the USB SMI source generator.
|
| 121 | ///
|
| 122 | struct _EFI_SMM_USB_DISPATCH2_PROTOCOL {
|
| 123 | EFI_SMM_USB_REGISTER2 Register;
|
| 124 | EFI_SMM_USB_UNREGISTER2 UnRegister;
|
| 125 | };
|
| 126 |
|
| 127 | extern EFI_GUID gEfiSmmUsbDispatch2ProtocolGuid;
|
| 128 |
|
| 129 | #endif
|
| 130 |
|