AhciPeiPassThru.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /** @file
  2. The AhciPei driver is used to manage ATA hard disk device working under AHCI
  3. mode at PEI phase.
  4. Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #ifndef _AHCI_PEI_PASSTHRU_H_
  8. #define _AHCI_PEI_PASSTHRU_H_
  9. /**
  10. Sends an ATA command to an ATA device that is attached to the ATA controller.
  11. @param[in] This The PPI instance pointer.
  12. @param[in] Port The port number of the ATA device to send
  13. the command.
  14. @param[in] PortMultiplierPort The port multiplier port number of the ATA
  15. device to send the command.
  16. If there is no port multiplier, then specify
  17. 0xFFFF.
  18. @param[in,out] Packet A pointer to the ATA command to send to
  19. the ATA device specified by Port and
  20. PortMultiplierPort.
  21. @retval EFI_SUCCESS The ATA command was sent by the host. For
  22. bi-directional commands, InTransferLength bytes
  23. were transferred from InDataBuffer. For write
  24. and bi-directional commands, OutTransferLength
  25. bytes were transferred by OutDataBuffer.
  26. @retval EFI_NOT_FOUND The specified ATA device is not found.
  27. @retval EFI_INVALID_PARAMETER The contents of Acb are invalid. The ATA command
  28. was not sent, so no additional status information
  29. is available.
  30. @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number
  31. of bytes that could be transferred is returned
  32. in InTransferLength. For write and bi-directional
  33. commands, OutTransferLength bytes were transferred
  34. by OutDataBuffer.
  35. @retval EFI_NOT_READY The ATA command could not be sent because there
  36. are too many ATA commands already queued. The
  37. caller may retry again later.
  38. @retval EFI_DEVICE_ERROR A device error occurred while attempting to
  39. send the ATA command.
  40. **/
  41. EFI_STATUS
  42. EFIAPI
  43. AhciAtaPassThruPassThru (
  44. IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
  45. IN UINT16 Port,
  46. IN UINT16 PortMultiplierPort,
  47. IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet
  48. );
  49. /**
  50. Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.
  51. These can either be the list of ports where ATA devices are actually present or the
  52. list of legal port numbers for the ATA controller. Regardless, the caller of this
  53. function must probe the port number returned to see if an ATA device is actually
  54. present at that location on the ATA controller.
  55. The GetNextPort() function retrieves the port number on an ATA controller. If on
  56. input Port is 0xFFFF, then the port number of the first port on the ATA controller
  57. is returned in Port and EFI_SUCCESS is returned.
  58. If Port is a port number that was returned on a previous call to GetNextPort(),
  59. then the port number of the next port on the ATA controller is returned in Port,
  60. and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on
  61. a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned.
  62. If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND
  63. is returned.
  64. @param[in] This The PPI instance pointer.
  65. @param[in,out] Port On input, a pointer to the port number on the ATA controller.
  66. On output, a pointer to the next port number on the ATA
  67. controller. An input value of 0xFFFF retrieves the first
  68. port number on the ATA controller.
  69. @retval EFI_SUCCESS The next port number on the ATA controller was
  70. returned in Port.
  71. @retval EFI_NOT_FOUND There are no more ports on this ATA controller.
  72. @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned
  73. on a previous call to GetNextPort().
  74. **/
  75. EFI_STATUS
  76. EFIAPI
  77. AhciAtaPassThruGetNextPort (
  78. IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
  79. IN OUT UINT16 *Port
  80. );
  81. /**
  82. Used to retrieve the list of legal port multiplier port numbers for ATA devices
  83. on a port of an ATA controller. These can either be the list of port multiplier
  84. ports where ATA devices are actually present on port or the list of legal port
  85. multiplier ports on that port. Regardless, the caller of this function must probe
  86. the port number and port multiplier port number returned to see if an ATA device
  87. is actually present.
  88. The GetNextDevice() function retrieves the port multiplier port number of an ATA
  89. device present on a port of an ATA controller.
  90. If PortMultiplierPort points to a port multiplier port number value that was
  91. returned on a previous call to GetNextDevice(), then the port multiplier port
  92. number of the next ATA device on the port of the ATA controller is returned in
  93. PortMultiplierPort, and EFI_SUCCESS is returned.
  94. If PortMultiplierPort points to 0xFFFF, then the port multiplier port number
  95. of the first ATA device on port of the ATA controller is returned in PortMultiplierPort
  96. and EFI_SUCCESS is returned.
  97. If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
  98. was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
  99. is returned.
  100. If PortMultiplierPort is the port multiplier port number of the last ATA device
  101. on the port of the ATA controller, then EFI_NOT_FOUND is returned.
  102. @param[in] This The PPI instance pointer.
  103. @param[in] Port The port number present on the ATA controller.
  104. @param[in,out] PortMultiplierPort On input, a pointer to the port multiplier
  105. port number of an ATA device present on the
  106. ATA controller. If on input a PortMultiplierPort
  107. of 0xFFFF is specified, then the port multiplier
  108. port number of the first ATA device is returned.
  109. On output, a pointer to the port multiplier port
  110. number of the next ATA device present on an ATA
  111. controller.
  112. @retval EFI_SUCCESS The port multiplier port number of the next ATA
  113. device on the port of the ATA controller was
  114. returned in PortMultiplierPort.
  115. @retval EFI_NOT_FOUND There are no more ATA devices on this port of
  116. the ATA controller.
  117. @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort
  118. was not returned on a previous call to GetNextDevice().
  119. **/
  120. EFI_STATUS
  121. EFIAPI
  122. AhciAtaPassThruGetNextDevice (
  123. IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
  124. IN UINT16 Port,
  125. IN OUT UINT16 *PortMultiplierPort
  126. );
  127. /**
  128. Gets the device path information of the underlying ATA host controller.
  129. @param[in] This The PPI instance pointer.
  130. @param[out] DevicePathLength The length of the device path in bytes specified
  131. by DevicePath.
  132. @param[out] DevicePath The device path of the underlying ATA host controller.
  133. This field re-uses EFI Device Path Protocol as
  134. defined by Section 10.2 EFI Device Path Protocol
  135. of UEFI 2.7 Specification.
  136. @retval EFI_SUCCESS The device path of the ATA host controller has
  137. been successfully returned.
  138. @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.
  139. @retval EFI_OUT_OF_RESOURCES Not enough resource to return the device path.
  140. **/
  141. EFI_STATUS
  142. EFIAPI
  143. AhciAtaPassThruGetDevicePath (
  144. IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
  145. OUT UINTN *DevicePathLength,
  146. OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
  147. );
  148. #endif