SmmUsbDispatch.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /** @file
  2. Provides the parent dispatch service for the USB SMI source generator.
  3. Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. @par Revision Reference:
  6. This Protocol is defined in Framework of EFI SMM Core Interface Spec
  7. Version 0.9.
  8. **/
  9. #ifndef _EFI_SMM_USB_DISPATCH_H_
  10. #define _EFI_SMM_USB_DISPATCH_H_
  11. //
  12. // Share some common definitions with PI SMM
  13. //
  14. #include <Protocol/SmmUsbDispatch2.h>
  15. //
  16. // Global ID for the USB Protocol
  17. //
  18. #define EFI_SMM_USB_DISPATCH_PROTOCOL_GUID \
  19. { \
  20. 0xa05b6ffd, 0x87af, 0x4e42, {0x95, 0xc9, 0x62, 0x28, 0xb6, 0x3c, 0xf3, 0xf3 } \
  21. }
  22. typedef struct _EFI_SMM_USB_DISPATCH_PROTOCOL EFI_SMM_USB_DISPATCH_PROTOCOL;
  23. typedef struct {
  24. ///
  25. /// Describes whether this child handler will be invoked in response to a USB legacy
  26. /// emulation event, such as port-trap on the PS/2* keyboard control registers, or to a
  27. /// USB wake event, such as resumption from a sleep state.
  28. ///
  29. EFI_USB_SMI_TYPE Type;
  30. ///
  31. /// The device path is part of the context structure and describes the location of the
  32. /// particular USB host controller in the system for which this register event will occur.
  33. /// This location is important because of the possible integration of several USB host
  34. /// controllers in a system.
  35. ///
  36. EFI_DEVICE_PATH_PROTOCOL *Device;
  37. } EFI_SMM_USB_DISPATCH_CONTEXT;
  38. //
  39. // Member functions
  40. //
  41. /**
  42. Dispatch function for a USB SMI handler.
  43. @param[in] DispatchHandle Handle of this dispatch function.
  44. @param[in] DispatchContext Pointer to the dispatch function's context.
  45. The DispatchContext fields are filled in
  46. by the dispatching driver prior to
  47. invoking this dispatch function.
  48. **/
  49. typedef
  50. VOID
  51. (EFIAPI *EFI_SMM_USB_DISPATCH)(
  52. IN EFI_HANDLE DispatchHandle,
  53. IN EFI_SMM_USB_DISPATCH_CONTEXT *DispatchContext
  54. );
  55. /**
  56. Register a child SMI source dispatch function with a parent SMM driver.
  57. @param[in] This The pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.
  58. @param[in] DispatchFunction The pointer to dispatch function to be invoked
  59. for this SMI source.
  60. @param[in] DispatchContext The pointer to the dispatch function's context.
  61. The caller fills this context in before calling
  62. the register function to indicate to the register
  63. function the USB SMI types for which the dispatch
  64. function should be invoked.
  65. @param[out] DispatchHandle The handle generated by the dispatcher to track the
  66. function instance.
  67. @retval EFI_SUCCESS The dispatch function has been successfully
  68. registered and the SMI source has been enabled.
  69. @retval EFI_DEVICE_ERROR The driver was unable to enable the SMI source.
  70. @retval EFI_OUT_OF_RESOURCES Not enough memory (system or SMM) to manage this
  71. child.
  72. @retval EFI_INVALID_PARAMETER DispatchContext is invalid. The USB SMI type
  73. is not within valid range.
  74. **/
  75. typedef
  76. EFI_STATUS
  77. (EFIAPI *EFI_SMM_USB_REGISTER)(
  78. IN EFI_SMM_USB_DISPATCH_PROTOCOL *This,
  79. IN EFI_SMM_USB_DISPATCH DispatchFunction,
  80. IN EFI_SMM_USB_DISPATCH_CONTEXT *DispatchContext,
  81. OUT EFI_HANDLE *DispatchHandle
  82. );
  83. /**
  84. Unregisters a USB service.
  85. @param[in] This The pointer to the EFI_SMM_USB_DISPATCH_PROTOCOL instance.
  86. @param[in] DispatchHandle Handle of the service to remove.
  87. @retval EFI_SUCCESS The dispatch function has been successfully
  88. unregistered and the SMI source has been disabled
  89. if there are no other registered child dispatch
  90. functions for this SMI source.
  91. @retval EFI_INVALID_PARAMETER The DispatchHandle was not valid.
  92. **/
  93. typedef
  94. EFI_STATUS
  95. (EFIAPI *EFI_SMM_USB_UNREGISTER)(
  96. IN EFI_SMM_USB_DISPATCH_PROTOCOL *This,
  97. IN EFI_HANDLE DispatchHandle
  98. );
  99. ///
  100. /// The EFI_SMM_USB_DISPATCH_PROTOCOL provides the ability to install child handlers for the
  101. /// given event types.
  102. ///
  103. struct _EFI_SMM_USB_DISPATCH_PROTOCOL {
  104. EFI_SMM_USB_REGISTER Register;
  105. EFI_SMM_USB_UNREGISTER UnRegister;
  106. };
  107. extern EFI_GUID gEfiSmmUsbDispatchProtocolGuid;
  108. #endif