DriverBinding.h 8.1 KB

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