RedfishConfigHandlerDriver.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /** @file
  2. Header file of Redfish Configuration Handler UEFI driver.
  3. Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
  4. (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef EFI_REDFISH_CONFIG_HANDLER_DRIVER_H_
  8. #define EFI_REDFISH_CONFIG_HANDLER_DRIVER_H_
  9. #include "RedfishConfigHandlerCommon.h"
  10. //
  11. // UEFI Driver Model Protocols
  12. //
  13. #include <Protocol/DriverBinding.h>
  14. #include <Protocol/RedfishDiscover.h>
  15. #include <Protocol/RestEx.h>
  16. //
  17. // Protocol instances
  18. //
  19. extern EFI_DRIVER_BINDING_PROTOCOL gRedfishConfigDriverBinding;
  20. extern REDFISH_CONFIG_DRIVER_DATA gRedfishConfigData;
  21. extern EDKII_REDFISH_CREDENTIAL_PROTOCOL *gCredential;
  22. extern EFI_EVENT gEndOfDxeEvent;
  23. extern EFI_EVENT gExitBootServiceEvent;
  24. /**
  25. Tests to see if this driver supports a given controller. If a child device is provided,
  26. it further tests to see if this driver supports creating a handle for the specified child device.
  27. This function checks to see if the driver specified by This supports the device specified by
  28. ControllerHandle. Drivers will typically use the device path attached to
  29. ControllerHandle and/or the services from the bus I/O abstraction attached to
  30. ControllerHandle to determine if the driver supports ControllerHandle. This function
  31. may be called many times during platform initialization. In order to reduce boot times, the tests
  32. performed by this function must be very small, and take as little time as possible to execute. This
  33. function must not change the state of any hardware devices, and this function must be aware that the
  34. device specified by ControllerHandle may already be managed by the same driver or a
  35. different driver. This function must match its calls to AllocatePages() with FreePages(),
  36. AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
  37. Because ControllerHandle may have been previously started by the same driver, if a protocol is
  38. already in the opened state, then it must not be closed with CloseProtocol(). This is required
  39. to guarantee the state of ControllerHandle is not modified by this function.
  40. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  41. @param[in] ControllerHandle The handle of the controller to test. This handle
  42. must support a protocol interface that supplies
  43. an I/O abstraction to the driver.
  44. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
  45. parameter is ignored by device drivers, and is optional for bus
  46. drivers. For bus drivers, if this parameter is not NULL, then
  47. the bus driver must determine if the bus controller specified
  48. by ControllerHandle and the child controller specified
  49. by RemainingDevicePath are both supported by this
  50. bus driver.
  51. @retval EFI_SUCCESS The device specified by ControllerHandle and
  52. RemainingDevicePath is supported by the driver specified by This.
  53. @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
  54. RemainingDevicePath is already being managed by the driver
  55. specified by This.
  56. @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
  57. RemainingDevicePath is already being managed by a different
  58. driver or an application that requires exclusive access.
  59. Currently not implemented.
  60. @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
  61. RemainingDevicePath is not supported by the driver specified by This.
  62. **/
  63. EFI_STATUS
  64. EFIAPI
  65. RedfishConfigDriverBindingSupported (
  66. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  67. IN EFI_HANDLE ControllerHandle,
  68. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  69. );
  70. /**
  71. Starts a device controller or a bus controller.
  72. The Start() function is designed to be invoked from the EFI boot service ConnectController().
  73. As a result, much of the error checking on the parameters to Start() has been moved into this
  74. common boot service. It is legal to call Start() from other locations,
  75. but the following calling restrictions must be followed, or the system behavior will not be deterministic.
  76. 1. ControllerHandle must be a valid EFI_HANDLE.
  77. 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
  78. EFI_DEVICE_PATH_PROTOCOL.
  79. 3. Prior to calling Start(), the Supported() function for the driver specified by This must
  80. have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
  81. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  82. @param[in] ControllerHandle The handle of the controller to start. This handle
  83. must support a protocol interface that supplies
  84. an I/O abstraction to the driver.
  85. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
  86. parameter is ignored by device drivers, and is optional for bus
  87. drivers. For a bus driver, if this parameter is NULL, then handles
  88. for all the children of Controller are created by this driver.
  89. If this parameter is not NULL and the first Device Path Node is
  90. not the End of Device Path Node, then only the handle for the
  91. child device specified by the first Device Path Node of
  92. RemainingDevicePath is created by this driver.
  93. If the first Device Path Node of RemainingDevicePath is
  94. the End of Device Path Node, no child handle is created by this
  95. driver.
  96. @retval EFI_SUCCESS The driver is started.
  97. @retval EFI_ALREADY_STARTED The driver was already started.
  98. **/
  99. EFI_STATUS
  100. EFIAPI
  101. RedfishConfigDriverBindingStart (
  102. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  103. IN EFI_HANDLE ControllerHandle,
  104. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
  105. );
  106. /**
  107. Stops a device controller or a bus controller.
  108. The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
  109. As a result, much of the error checking on the parameters to Stop() has been moved
  110. into this common boot service. It is legal to call Stop() from other locations,
  111. but the following calling restrictions must be followed, or the system behavior will not be deterministic.
  112. 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
  113. same driver's Start() function.
  114. 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
  115. EFI_HANDLE. In addition, all of these handles must have been created in this driver's
  116. Start() function, and the Start() function must have called OpenProtocol() on
  117. ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
  118. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
  119. @param[in] ControllerHandle A handle to the device being stopped. The handle must
  120. support a bus specific I/O protocol for the driver
  121. to use to stop the device.
  122. @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
  123. @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
  124. if NumberOfChildren is 0.
  125. @retval EFI_SUCCESS The device was stopped.
  126. @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
  127. **/
  128. EFI_STATUS
  129. EFIAPI
  130. RedfishConfigDriverBindingStop (
  131. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  132. IN EFI_HANDLE ControllerHandle,
  133. IN UINTN NumberOfChildren,
  134. IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
  135. );
  136. #endif