diff options
Diffstat (limited to 'MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.h')
-rw-r--r-- | MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.h | 142 |
1 files changed, 132 insertions, 10 deletions
diff --git a/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.h b/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.h index 5cbd6fd96a..20b35c4afd 100644 --- a/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.h +++ b/MdeModulePkg/Bus/Pci/IdeBusPei/AtapiPeim.h @@ -1,7 +1,7 @@ /** @file
Private Include file for IdeBus PEIM.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <PiPei.h>
#include <Ppi/BlockIo.h>
+#include <Ppi/BlockIo2.h>
#include <Ppi/AtaController.h>
#include <Library/DebugLib.h>
@@ -90,6 +91,7 @@ typedef struct { UINTN DevicePosition;
EFI_PEI_BLOCK_IO_MEDIA MediaInfo;
+ EFI_PEI_BLOCK_IO2_MEDIA MediaInfo2;
} PEI_ATAPI_DEVICE_INFO;
@@ -98,7 +100,9 @@ typedef struct { UINTN Signature;
EFI_PEI_RECOVERY_BLOCK_IO_PPI AtapiBlkIo;
+ EFI_PEI_RECOVERY_BLOCK_IO2_PPI AtapiBlkIo2;
EFI_PEI_PPI_DESCRIPTOR PpiDescriptor;
+ EFI_PEI_PPI_DESCRIPTOR PpiDescriptor2;
PEI_ATA_CONTROLLER_PPI *AtaControllerPpi;
UINTN DeviceCount;
@@ -107,6 +111,7 @@ typedef struct { } ATAPI_BLK_IO_DEV;
#define PEI_RECOVERY_ATAPI_FROM_BLKIO_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo, ATAPI_BLK_IO_DEV_SIGNATURE)
+#define PEI_RECOVERY_ATAPI_FROM_BLKIO2_THIS(a) CR (a, ATAPI_BLK_IO_DEV, AtapiBlkIo2, ATAPI_BLK_IO_DEV_SIGNATURE)
#define STALL_1_MILLI_SECOND 1000 // stall 1 ms
@@ -241,6 +246,115 @@ AtapiReadBlocks ( OUT VOID *Buffer
);
+/**
+ Gets the count of block I/O devices that one specific block driver detects.
+
+ This function is used for getting the count of block I/O devices that one
+ specific block driver detects. To the PEI ATAPI driver, it returns the number
+ of all the detected ATAPI devices it detects during the enumeration process.
+ To the PEI legacy floppy driver, it returns the number of all the legacy
+ devices it finds during its enumeration process. If no device is detected,
+ then the function will return zero.
+
+ @param[in] PeiServices General-purpose services that are available
+ to every PEIM.
+ @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI
+ instance.
+ @param[out] NumberBlockDevices The number of block I/O devices discovered.
+
+ @retval EFI_SUCCESS Operation performed successfully.
+
+**/
+EFI_STATUS
+EFIAPI
+AtapiGetNumberOfBlockDevices2 (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
+ OUT UINTN *NumberBlockDevices
+ );
+
+/**
+ Gets a block device's media information.
+
+ This function will provide the caller with the specified block device's media
+ information. If the media changes, calling this function will update the media
+ information accordingly.
+
+ @param[in] PeiServices General-purpose services that are available to every
+ PEIM
+ @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
+ @param[in] DeviceIndex Specifies the block device to which the function wants
+ to talk. Because the driver that implements Block I/O
+ PPIs will manage multiple block devices, the PPIs that
+ want to talk to a single device must specify the
+ device index that was assigned during the enumeration
+ process. This index is a number from one to
+ NumberBlockDevices.
+ @param[out] MediaInfo The media information of the specified block media.
+ The caller is responsible for the ownership of this
+ data structure.
+
+ @retval EFI_SUCCESS Media information about the specified block device
+ was obtained successfully.
+ @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware
+ error.
+ @retval Others Other failure occurs.
+
+**/
+EFI_STATUS
+EFIAPI
+AtapiGetBlockDeviceMediaInfo2 (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
+ IN UINTN DeviceIndex,
+ OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
+ );
+
+/**
+ Reads the requested number of blocks from the specified block device.
+
+ The function reads the requested number of blocks from the device. All the
+ blocks are read, or an error is returned. If there is no media in the device,
+ the function returns EFI_NO_MEDIA.
+
+ @param[in] PeiServices General-purpose services that are available to
+ every PEIM.
+ @param[in] This Indicates the EFI_PEI_RECOVERY_BLOCK_IO2_PPI instance.
+ @param[in] DeviceIndex Specifies the block device to which the function wants
+ to talk. Because the driver that implements Block I/O
+ PPIs will manage multiple block devices, the PPIs that
+ want to talk to a single device must specify the device
+ index that was assigned during the enumeration process.
+ This index is a number from one to NumberBlockDevices.
+ @param[in] StartLBA The starting logical block address (LBA) to read from
+ on the device
+ @param[in] BufferSize The size of the Buffer in bytes. This number must be
+ a multiple of the intrinsic block size of the device.
+ @param[out] Buffer A pointer to the destination buffer for the data.
+ The caller is responsible for the ownership of the
+ buffer.
+
+ @retval EFI_SUCCESS The data was read correctly from the device.
+ @retval EFI_DEVICE_ERROR The device reported an error while attempting
+ to perform the read operation.
+ @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not
+ valid, or the buffer is not properly aligned.
+ @retval EFI_NO_MEDIA There is no media in the device.
+ @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of
+ the intrinsic block size of the device.
+
+**/
+EFI_STATUS
+EFIAPI
+AtapiReadBlocks2 (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
+ IN UINTN DeviceIndex,
+ IN EFI_PEI_LBA StartLBA,
+ IN UINTN BufferSize,
+ OUT VOID *Buffer
+ );
+
//
// Internal functions
//
@@ -264,6 +378,7 @@ AtapiEnumerateDevices ( @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
@param[in] DevicePosition An integer to signify device position.
@param[out] MediaInfo The media information of the specified block media.
+ @param[out] MediaInfo2 The media information 2 of the specified block media.
@retval TRUE Atapi device exists in specified position.
@retval FALSE Atapi device does not exist in specified position.
@@ -273,7 +388,8 @@ BOOLEAN DiscoverAtapiDevice (
IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev,
IN UINTN DevicePosition,
- OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
+ OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo,
+ OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2
);
/**
@@ -482,6 +598,7 @@ AtapiPacketCommandIn ( @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
@param[in] DevicePosition An integer to signify device position.
@param[out] MediaInfo The media information of the specified block media.
+ @param[out] MediaInfo2 The media information 2 of the specified block media.
@retval EFI_SUCCESS Command executed successfully.
@retval EFI_DEVICE_ERROR Device cannot be executed command successfully.
@@ -492,7 +609,8 @@ EFI_STATUS Inquiry (
IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev,
IN UINTN DevicePosition,
- OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
+ OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo,
+ OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2
);
/**
@@ -502,7 +620,8 @@ Inquiry ( @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
@param[in] DevicePosition An integer to signify device position.
- @param[in, out] MediaInfo The media information of the specified block media.
+ @param[in, out] MediaInfo The media information of the specified block media.
+ @param[in, out] MediaInfo2 The media information 2 of the specified block media.
@retval EFI_SUCCESS Command executed successfully.
@retval EFI_DEVICE_ERROR Some device errors happen.
@@ -513,7 +632,8 @@ EFI_STATUS DetectMedia (
IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev,
IN UINTN DevicePosition,
- IN OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
+ IN OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo,
+ IN OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2
);
/**
@@ -548,10 +668,10 @@ ResetDevice ( **/
EFI_STATUS
RequestSense (
- IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev,
- IN UINTN DevicePosition,
+ IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev,
+ IN UINTN DevicePosition,
IN ATAPI_REQUEST_SENSE_DATA *SenseBuffers,
- IN OUT UINT8 *SenseCounts
+ IN OUT UINT8 *SenseCounts
);
/**
@@ -561,7 +681,8 @@ RequestSense ( @param[in] AtapiBlkIoDev A pointer to atapi block IO device.
@param[in] DevicePosition An integer to signify device position.
- @param[in, out] MediaInfo The media information of the specified block media.
+ @param[in, out] MediaInfo The media information of the specified block media.
+ @param[in, out] MediaInfo2 The media information 2 of the specified block media.
@retval EFI_SUCCESS Command executed successfully.
@retval EFI_DEVICE_ERROR Some device errors happen.
@@ -571,7 +692,8 @@ EFI_STATUS ReadCapacity (
IN ATAPI_BLK_IO_DEV *AtapiBlkIoDev,
IN UINTN DevicePosition,
- IN OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo
+ IN OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo,
+ IN OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo2
);
/**
|