]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.h
MdeModulePkg UhciPei: Remove redundant functions
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / IdeBusPei / AtapiPeim.h
index 5cbd6fd96a3d2c99c909bc874d6f174dce9424ed..2b06a8ba1b2b436d0b35fcb7826a32673826cfa0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Private Include file for IdeBus PEIM.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <PiPei.h>\r
 \r
 #include <Ppi/BlockIo.h>\r
+#include <Ppi/BlockIo2.h>\r
 #include <Ppi/AtaController.h>\r
 \r
 #include <Library/DebugLib.h>\r
@@ -90,6 +91,7 @@ typedef struct {
 \r
   UINTN                   DevicePosition;\r
   EFI_PEI_BLOCK_IO_MEDIA  MediaInfo;\r
+  EFI_PEI_BLOCK_IO2_MEDIA MediaInfo2;\r
 \r
 } PEI_ATAPI_DEVICE_INFO;\r
 \r
@@ -98,7 +100,9 @@ typedef struct {
   UINTN                           Signature;\r
 \r
   EFI_PEI_RECOVERY_BLOCK_IO_PPI   AtapiBlkIo;\r
+  EFI_PEI_RECOVERY_BLOCK_IO2_PPI  AtapiBlkIo2;\r
   EFI_PEI_PPI_DESCRIPTOR          PpiDescriptor;\r
+  EFI_PEI_PPI_DESCRIPTOR          PpiDescriptor2;\r
   PEI_ATA_CONTROLLER_PPI          *AtaControllerPpi;\r
 \r
   UINTN                           DeviceCount;\r
@@ -107,6 +111,7 @@ typedef struct {
 } ATAPI_BLK_IO_DEV;\r
 \r
 #define PEI_RECOVERY_ATAPI_FROM_BLKIO_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo, ATAPI_BLK_IO_DEV_SIGNATURE)\r
+#define PEI_RECOVERY_ATAPI_FROM_BLKIO2_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo2, ATAPI_BLK_IO_DEV_SIGNATURE)\r
 \r
 \r
 #define STALL_1_MILLI_SECOND  1000  // stall 1 ms\r
@@ -135,16 +140,16 @@ typedef struct {
 /**\r
   Gets the count of block I/O devices that one specific block driver detects.\r
 \r
-  This function is used for getting the count of block I/O devices that one \r
+  This function is used for getting the count of block I/O devices that one\r
   specific block driver detects.  To the PEI ATAPI driver, it returns the number\r
-  of all the detected ATAPI devices it detects during the enumeration process. \r
-  To the PEI legacy floppy driver, it returns the number of all the legacy \r
-  devices it finds during its enumeration process. If no device is detected, \r
-  then the function will return zero.  \r
-  \r
-  @param[in]  PeiServices          General-purpose services that are available \r
+  of all the detected ATAPI devices it detects during the enumeration process.\r
+  To the PEI legacy floppy driver, it returns the number of all the legacy\r
+  devices it finds during its enumeration process. If no device is detected,\r
+  then the function will return zero.\r
+\r
+  @param[in]  PeiServices          General-purpose services that are available\r
                                    to every PEIM.\r
-  @param[in]  This                 Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI \r
+  @param[in]  This                 Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI\r
                                    instance.\r
   @param[out] NumberBlockDevices   The number of block I/O devices discovered.\r
 \r
@@ -162,27 +167,27 @@ AtapiGetNumberOfBlockDevices (
 /**\r
   Gets a block device's media information.\r
 \r
-  This function will provide the caller with the specified block device's media \r
-  information. If the media changes, calling this function will update the media \r
+  This function will provide the caller with the specified block device's media\r
+  information. If the media changes, calling this function will update the media\r
   information accordingly.\r
 \r
   @param[in]  PeiServices   General-purpose services that are available to every\r
                             PEIM\r
   @param[in]  This          Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r
-  @param[in]  DeviceIndex   Specifies the block device to which the function wants \r
-                            to talk. Because the driver that implements Block I/O \r
-                            PPIs will manage multiple block devices, the PPIs that \r
-                            want to talk to a single device must specify the \r
+  @param[in]  DeviceIndex   Specifies the block device to which the function wants\r
+                            to talk. Because the driver that implements Block I/O\r
+                            PPIs will manage multiple block devices, the PPIs that\r
+                            want to talk to a single device must specify the\r
                             device index that was assigned during the enumeration\r
-                            process. This index is a number from one to \r
+                            process. This index is a number from one to\r
                             NumberBlockDevices.\r
-  @param[out] MediaInfo     The media information of the specified block media.  \r
-                            The caller is responsible for the ownership of this \r
+  @param[out] MediaInfo     The media information of the specified block media.\r
+                            The caller is responsible for the ownership of this\r
                             data structure.\r
-  \r
-  @retval EFI_SUCCESS           Media information about the specified block device \r
+\r
+  @retval EFI_SUCCESS           Media information about the specified block device\r
                                 was obtained successfully.\r
-  @retval EFI_DEVICE_ERROR      Cannot get the media information due to a hardware \r
+  @retval EFI_DEVICE_ERROR      Cannot get the media information due to a hardware\r
                                 error.\r
   @retval Others                Other failure occurs.\r
 \r
@@ -199,31 +204,31 @@ AtapiGetBlockDeviceMediaInfo (
 /**\r
   Reads the requested number of blocks from the specified block device.\r
 \r
-  The function reads the requested number of blocks from the device. All the \r
+  The function reads the requested number of blocks from the device. All the\r
   blocks are read, or an error is returned. If there is no media in the device,\r
   the function returns EFI_NO_MEDIA.\r
 \r
-  @param[in]  PeiServices   General-purpose services that are available to \r
+  @param[in]  PeiServices   General-purpose services that are available to\r
                             every PEIM.\r
   @param[in]  This          Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r
-  @param[in]  DeviceIndex   Specifies the block device to which the function wants \r
-                            to talk. Because the driver that implements Block I/O \r
-                            PPIs will manage multiple block devices, the PPIs that \r
-                            want to talk to a single device must specify the device \r
-                            index that was assigned during the enumeration process. \r
+  @param[in]  DeviceIndex   Specifies the block device to which the function wants\r
+                            to talk. Because the driver that implements Block I/O\r
+                            PPIs will manage multiple block devices, the PPIs that\r
+                            want to talk to a single device must specify the device\r
+                            index that was assigned during the enumeration process.\r
                             This index is a number from one to NumberBlockDevices.\r
   @param[in]  StartLBA      The starting logical block address (LBA) to read from\r
                             on the device\r
   @param[in]  BufferSize    The size of the Buffer in bytes. This number must be\r
                             a multiple of the intrinsic block size of the device.\r
   @param[out] Buffer        A pointer to the destination buffer for the data.\r
-                            The caller is responsible for the ownership of the \r
+                            The caller is responsible for the ownership of the\r
                             buffer.\r
-                         \r
+\r
   @retval EFI_SUCCESS             The data was read correctly from the device.\r
-  @retval EFI_DEVICE_ERROR        The device reported an error while attempting \r
+  @retval EFI_DEVICE_ERROR        The device reported an error while attempting\r
                                   to perform the read operation.\r
-  @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not \r
+  @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not\r
                                   valid, or the buffer is not properly aligned.\r
   @retval EFI_NO_MEDIA            There is no media in the device.\r
   @retval EFI_BAD_BUFFER_SIZE     The BufferSize parameter is not a multiple of\r
@@ -241,6 +246,115 @@ AtapiReadBlocks (
   OUT  VOID                              *Buffer\r
   );\r
 \r
+/**\r
+  Gets the count of block I/O devices that one specific block driver detects.\r
+\r
+  This function is used for getting the count of block I/O devices that one\r
+  specific block driver detects.  To the PEI ATAPI driver, it returns the number\r
+  of all the detected ATAPI devices it detects during the enumeration process.\r
+  To the PEI legacy floppy driver, it returns the number of all the legacy\r
+  devices it finds during its enumeration process. If no device is detected,\r
+  then the function will return zero.\r
+\r
+  @param[in]  PeiServices          General-purpose services that are available\r
+                                   to every PEIM.\r
+  @param[in]  This                 Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI\r
+                                   instance.\r
+  @param[out] NumberBlockDevices   The number of block I/O devices discovered.\r
+\r
+  @retval     EFI_SUCCESS          Operation performed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AtapiGetNumberOfBlockDevices2 (\r
+  IN   EFI_PEI_SERVICES                  **PeiServices,\r
+  IN   EFI_PEI_RECOVERY_BLOCK_IO2_PPI    *This,\r
+  OUT  UINTN                             *NumberBlockDevices\r
+  );\r
+\r
+/**\r
+  Gets a block device's media information.\r
+\r
+  This function will provide the caller with the specified block device's media\r
+  information. If the media changes, calling this function will update the media\r
+  information accordingly.\r
+\r
+  @param[in]  PeiServices   General-purpose services that are available to every\r
+                            PEIM\r
+  @param[in]  This          Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.\r
+  @param[in]  DeviceIndex   Specifies the block device to which the function wants\r
+                            to talk. Because the driver that implements Block I/O\r
+                            PPIs will manage multiple block devices, the PPIs that\r
+                            want to talk to a single device must specify the\r
+                            device index that was assigned during the enumeration\r
+                            process. This index is a number from one to\r
+                            NumberBlockDevices.\r
+  @param[out] MediaInfo     The media information of the specified block media.\r
+                            The caller is responsible for the ownership of this\r
+                            data structure.\r
+\r
+  @retval EFI_SUCCESS           Media information about the specified block device\r
+                                was obtained successfully.\r
+  @retval EFI_DEVICE_ERROR      Cannot get the media information due to a hardware\r
+                                error.\r
+  @retval Others                Other failure occurs.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AtapiGetBlockDeviceMediaInfo2 (\r
+  IN   EFI_PEI_SERVICES                     **PeiServices,\r
+  IN   EFI_PEI_RECOVERY_BLOCK_IO2_PPI       *This,\r
+  IN   UINTN                                DeviceIndex,\r
+  OUT  EFI_PEI_BLOCK_IO2_MEDIA              *MediaInfo\r
+  );\r
+\r
+/**\r
+  Reads the requested number of blocks from the specified block device.\r
+\r
+  The function reads the requested number of blocks from the device. All the\r
+  blocks are read, or an error is returned. If there is no media in the device,\r
+  the function returns EFI_NO_MEDIA.\r
+\r
+  @param[in]  PeiServices   General-purpose services that are available to\r
+                            every PEIM.\r
+  @param[in]  This          Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.\r
+  @param[in]  DeviceIndex   Specifies the block device to which the function wants\r
+                            to talk. Because the driver that implements Block I/O\r
+                            PPIs will manage multiple block devices, the PPIs that\r
+                            want to talk to a single device must specify the device\r
+                            index that was assigned during the enumeration process.\r
+                            This index is a number from one to NumberBlockDevices.\r
+  @param[in]  StartLBA      The starting logical block address (LBA) to read from\r
+                            on the device\r
+  @param[in]  BufferSize    The size of the Buffer in bytes. This number must be\r
+                            a multiple of the intrinsic block size of the device.\r
+  @param[out] Buffer        A pointer to the destination buffer for the data.\r
+                            The caller is responsible for the ownership of the\r
+                            buffer.\r
+\r
+  @retval EFI_SUCCESS             The data was read correctly from the device.\r
+  @retval EFI_DEVICE_ERROR        The device reported an error while attempting\r
+                                  to perform the read operation.\r
+  @retval EFI_INVALID_PARAMETER   The read request contains LBAs that are not\r
+                                  valid, or the buffer is not properly aligned.\r
+  @retval EFI_NO_MEDIA            There is no media in the device.\r
+  @retval EFI_BAD_BUFFER_SIZE     The BufferSize parameter is not a multiple of\r
+                                  the intrinsic block size of the device.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AtapiReadBlocks2 (\r
+  IN   EFI_PEI_SERVICES                  **PeiServices,\r
+  IN   EFI_PEI_RECOVERY_BLOCK_IO2_PPI    *This,\r
+  IN   UINTN                             DeviceIndex,\r
+  IN   EFI_PEI_LBA                       StartLBA,\r
+  IN   UINTN                             BufferSize,\r
+  OUT  VOID                              *Buffer\r
+  );\r
+\r
 //\r
 // Internal functions\r
 //\r
@@ -260,10 +374,11 @@ AtapiEnumerateDevices (
 \r
 /**\r
   Detect Atapi devices.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
   @param[in]  DevicePosition  An integer to signify device position.\r
   @param[out] MediaInfo       The media information of the specified block media.\r
+  @param[out] MediaInfo2      The media information 2 of the specified block media.\r
 \r
   @retval TRUE                Atapi device exists in specified position.\r
   @retval FALSE               Atapi device does not exist in specified position.\r
@@ -273,12 +388,13 @@ BOOLEAN
 DiscoverAtapiDevice (\r
   IN  ATAPI_BLK_IO_DEV              *AtapiBlkIoDev,\r
   IN  UINTN                         DevicePosition,\r
-  OUT EFI_PEI_BLOCK_IO_MEDIA        *MediaInfo\r
+  OUT EFI_PEI_BLOCK_IO_MEDIA        *MediaInfo,\r
+  OUT EFI_PEI_BLOCK_IO2_MEDIA       *MediaInfo2\r
   );\r
 \r
 /**\r
   Detect if an IDE controller exists in specified position.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
   @param[in]  DevicePosition  An integer to signify device position.\r
 \r
@@ -294,7 +410,7 @@ DetectIDEController (
 \r
 /**\r
   Wait specified time interval to poll for BSY bit clear in the Status Register.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev          A pointer to atapi block IO device.\r
   @param[in]  IdeIoRegisters         A pointer to IDE IO registers.\r
   @param[in]  TimeoutInMilliSeconds  Time specified in milliseconds.\r
@@ -312,7 +428,7 @@ WaitForBSYClear (
 \r
 /**\r
   Wait specified time interval to poll for DRDY bit set in the Status register.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev          A pointer to atapi block IO device.\r
   @param[in]  IdeIoRegisters         A pointer to IDE IO registers.\r
   @param[in]  TimeoutInMilliSeconds  Time specified in milliseconds.\r
@@ -330,7 +446,7 @@ DRDYReady (
 \r
 /**\r
   Wait specified time interval to poll for DRQ bit clear in the Status Register.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev          A pointer to atapi block IO device.\r
   @param[in]  IdeIoRegisters         A pointer to IDE IO registers.\r
   @param[in]  TimeoutInMilliSeconds  Time specified in milliseconds.\r
@@ -348,7 +464,7 @@ DRQClear (
 \r
 /**\r
   Wait specified time interval to poll for DRQ bit clear in the Alternate Status Register.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev          A pointer to atapi block IO device.\r
   @param[in]  IdeIoRegisters         A pointer to IDE IO registers.\r
   @param[in]  TimeoutInMilliSeconds  Time specified in milliseconds.\r
@@ -453,7 +569,7 @@ TestUnitReady (
 \r
 /**\r
   Send out ATAPI commands conforms to the Packet Command with PIO Data In Protocol.\r
-  \r
+\r
   @param[in]  AtapiBlkIoDev         A pointer to atapi block IO device.\r
   @param[in]  DevicePosition        An integer to signify device position.\r
   @param[in]  Packet                A pointer to ATAPI command packet.\r
@@ -482,6 +598,7 @@ AtapiPacketCommandIn (
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
   @param[in]  DevicePosition  An integer to signify device position.\r
   @param[out] MediaInfo       The media information of the specified block media.\r
+  @param[out] MediaInfo2      The media information 2 of the specified block media.\r
 \r
   @retval EFI_SUCCESS        Command executed successfully.\r
   @retval EFI_DEVICE_ERROR   Device cannot be executed command successfully.\r
@@ -492,17 +609,19 @@ EFI_STATUS
 Inquiry (\r
   IN  ATAPI_BLK_IO_DEV              *AtapiBlkIoDev,\r
   IN  UINTN                         DevicePosition,\r
-  OUT EFI_PEI_BLOCK_IO_MEDIA        *MediaInfo\r
+  OUT EFI_PEI_BLOCK_IO_MEDIA        *MediaInfo,\r
+  OUT EFI_PEI_BLOCK_IO2_MEDIA       *MediaInfo2\r
   );\r
 \r
-/**  \r
-  Used before read/write blocks from/to ATAPI device media. \r
+/**\r
+  Used before read/write blocks from/to ATAPI device media.\r
   Since ATAPI device media is removable, it is necessary to detect\r
-  whether media is present and get current present media's information.  \r
+  whether media is present and get current present media's information.\r
 \r
   @param[in]  AtapiBlkIoDev     A pointer to atapi block IO device.\r
   @param[in]  DevicePosition    An integer to signify device position.\r
-  @param[in, out] MediaInfo         The media information of the specified block media.\r
+  @param[in, out] MediaInfo     The media information of the specified block media.\r
+  @param[in, out] MediaInfo2    The media information 2 of the specified block media.\r
 \r
   @retval EFI_SUCCESS           Command executed successfully.\r
   @retval EFI_DEVICE_ERROR      Some device errors happen.\r
@@ -513,10 +632,11 @@ EFI_STATUS
 DetectMedia (\r
   IN  ATAPI_BLK_IO_DEV              *AtapiBlkIoDev,\r
   IN  UINTN                         DevicePosition,\r
-  IN OUT EFI_PEI_BLOCK_IO_MEDIA     *MediaInfo\r
+  IN OUT EFI_PEI_BLOCK_IO_MEDIA     *MediaInfo,\r
+  IN OUT EFI_PEI_BLOCK_IO2_MEDIA    *MediaInfo2\r
   );\r
 \r
-/**  \r
+/**\r
   Reset specified Atapi device.\r
 \r
   @param[in]  AtapiBlkIoDev     A pointer to atapi block IO device.\r
@@ -534,7 +654,7 @@ ResetDevice (
   IN  BOOLEAN           Extensive\r
   );\r
 \r
-/**  \r
+/**\r
   Sends out ATAPI Request Sense Packet Command to the specified device.\r
 \r
   @param[in]      AtapiBlkIoDev   A pointer to atapi block IO device.\r
@@ -548,20 +668,21 @@ ResetDevice (
 **/\r
 EFI_STATUS\r
 RequestSense (\r
-  IN  ATAPI_BLK_IO_DEV    *AtapiBlkIoDev,\r
-  IN  UINTN               DevicePosition,\r
+  IN  ATAPI_BLK_IO_DEV          *AtapiBlkIoDev,\r
+  IN  UINTN                     DevicePosition,\r
   IN  ATAPI_REQUEST_SENSE_DATA  *SenseBuffers,\r
-  IN OUT  UINT8           *SenseCounts\r
+  IN OUT  UINT8                 *SenseCounts\r
   );\r
 \r
-/**  \r
+/**\r
   Sends out ATAPI Read Capacity Packet Command to the specified device.\r
   This command will return the information regarding the capacity of the\r
   media in the device.\r
 \r
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
   @param[in]  DevicePosition  An integer to signify device position.\r
-  @param[in, out] MediaInfo       The media information of the specified block media.\r
+  @param[in, out] MediaInfo   The media information of the specified block media.\r
+  @param[in, out] MediaInfo2  The media information 2 of the specified block media.\r
 \r
   @retval EFI_SUCCESS           Command executed successfully.\r
   @retval EFI_DEVICE_ERROR      Some device errors happen.\r
@@ -571,10 +692,11 @@ EFI_STATUS
 ReadCapacity (\r
   IN  ATAPI_BLK_IO_DEV              *AtapiBlkIoDev,\r
   IN  UINTN                         DevicePosition,\r
-  IN OUT EFI_PEI_BLOCK_IO_MEDIA     *MediaInfo\r
+  IN OUT EFI_PEI_BLOCK_IO_MEDIA     *MediaInfo,\r
+  IN OUT EFI_PEI_BLOCK_IO2_MEDIA    *MediaInfo2\r
   );\r
 \r
-/**  \r
+/**\r
   Perform read from disk in block unit.\r
 \r
   @param[in]  AtapiBlkIoDev   A pointer to atapi block IO device.\r
@@ -598,7 +720,7 @@ ReadSectors (
   IN  UINTN               BlockSize\r
   );\r
 \r
-/**  \r
+/**\r
   Check if there is media according to sense data.\r
 \r
   @param[in]  SenseData   Pointer to sense data.\r
@@ -614,14 +736,14 @@ IsNoMedia (
   IN  UINTN                 SenseCounts\r
   );\r
 \r
-/**  \r
+/**\r
   Check if device state is unclear according to sense data.\r
 \r
   @param[in]  SenseData   Pointer to sense data.\r
   @param[in]  SenseCounts Count of sense data.\r
 \r
   @retval TRUE    Device state is unclear\r
-  @retval FALSE   Device state is clear  \r
+  @retval FALSE   Device state is clear\r
 \r
 **/\r
 BOOLEAN\r
@@ -630,7 +752,7 @@ IsDeviceStateUnclear (
   IN  UINTN                 SenseCounts\r
   );\r
 \r
-/**  \r
+/**\r
   Check if there is media error according to sense data.\r
 \r
   @param[in]  SenseData   Pointer to sense data.\r
@@ -646,7 +768,7 @@ IsMediaError (
   IN  UINTN                 SenseCounts\r
   );\r
 \r
-/**  \r
+/**\r
   Check if drive is ready according to sense data.\r
 \r
   @param[in]  SenseData   Pointer to sense data.\r