diff options
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c | 58 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPei.inf | 3 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.c | 236 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.h | 121 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBotPei/UsbPeim.h | 3 |
5 files changed, 380 insertions, 41 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c b/MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c index 28574d0..eaad626 100644 --- a/MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c +++ b/MdeModulePkg/Bus/Usb/UsbBotPei/PeiAtapi.c @@ -1,7 +1,7 @@ /** @file
Pei USB ATATPI command implementations.
-Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions
@@ -73,9 +73,15 @@ PeiUsbInquiry ( if ((Idata.peripheral_type & 0x1f) == 0x05) {
PeiBotDevice->DeviceType = USBCDROM;
PeiBotDevice->Media.BlockSize = 0x800;
+ PeiBotDevice->Media2.ReadOnly = TRUE;
+ PeiBotDevice->Media2.RemovableMedia = TRUE;
+ PeiBotDevice->Media2.BlockSize = 0x800;
} else {
PeiBotDevice->DeviceType = USBFLOPPY;
PeiBotDevice->Media.BlockSize = 0x200;
+ PeiBotDevice->Media2.ReadOnly = FALSE;
+ PeiBotDevice->Media2.RemovableMedia = TRUE;
+ PeiBotDevice->Media2.BlockSize = 0x200;
}
return EFI_SUCCESS;
@@ -148,10 +154,10 @@ PeiUsbRequestSense ( IN UINT8 *SenseKeyBuffer
)
{
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
- UINT8 *Ptr;
- BOOLEAN SenseReq;
+ EFI_STATUS Status;
+ ATAPI_PACKET_COMMAND Packet;
+ UINT8 *Ptr;
+ BOOLEAN SenseReq;
ATAPI_REQUEST_SENSE_DATA *Sense;
*SenseCounts = 0;
@@ -241,9 +247,10 @@ PeiUsbReadCapacity ( IN PEI_BOT_DEVICE *PeiBotDevice
)
{
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
+ EFI_STATUS Status;
+ ATAPI_PACKET_COMMAND Packet;
ATAPI_READ_CAPACITY_DATA Data;
+ UINT32 LastBlock;
ZeroMem (&Data, sizeof (ATAPI_READ_CAPACITY_DATA));
ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
@@ -267,10 +274,17 @@ PeiUsbReadCapacity ( if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
+ LastBlock = (Data.LastLba3 << 24) | (Data.LastLba2 << 16) | (Data.LastLba1 << 8) | Data.LastLba0;
+
+ if (LastBlock == 0xFFFFFFFF) {
+ DEBUG ((EFI_D_INFO, "The usb device LBA count is larger than 0xFFFFFFFF!\n"));
+ }
- PeiBotDevice->Media.LastBlock = (Data.LastLba3 << 24) | (Data.LastLba2 << 16) | (Data.LastLba1 << 8) | Data.LastLba0;
+ PeiBotDevice->Media.LastBlock = LastBlock;
+ PeiBotDevice->Media.MediaPresent = TRUE;
- PeiBotDevice->Media.MediaPresent = TRUE;
+ PeiBotDevice->Media2.LastBlock = LastBlock;
+ PeiBotDevice->Media2.MediaPresent = TRUE;
return EFI_SUCCESS;
}
@@ -293,9 +307,10 @@ PeiUsbReadFormattedCapacity ( IN PEI_BOT_DEVICE *PeiBotDevice
)
{
- EFI_STATUS Status;
- ATAPI_PACKET_COMMAND Packet;
+ EFI_STATUS Status;
+ ATAPI_PACKET_COMMAND Packet;
ATAPI_READ_FORMAT_CAPACITY_DATA FormatData;
+ UINT32 LastBlock;
ZeroMem (&FormatData, sizeof (ATAPI_READ_FORMAT_CAPACITY_DATA));
ZeroMem (&Packet, sizeof (ATAPI_PACKET_COMMAND));
@@ -327,14 +342,23 @@ PeiUsbReadFormattedCapacity ( //
PeiBotDevice->Media.MediaPresent = FALSE;
PeiBotDevice->Media.LastBlock = 0;
+ PeiBotDevice->Media2.MediaPresent = FALSE;
+ PeiBotDevice->Media2.LastBlock = 0;
} else {
+ LastBlock = (FormatData.LastLba3 << 24) | (FormatData.LastLba2 << 16) | (FormatData.LastLba1 << 8) | FormatData.LastLba0;
+ if (LastBlock == 0xFFFFFFFF) {
+ DEBUG ((EFI_D_INFO, "The usb device LBA count is larger than 0xFFFFFFFF!\n"));
+ }
- PeiBotDevice->Media.LastBlock = (FormatData.LastLba3 << 24) | (FormatData.LastLba2 << 16) | (FormatData.LastLba1 << 8) | FormatData.LastLba0;
+ PeiBotDevice->Media.LastBlock = LastBlock;
PeiBotDevice->Media.LastBlock--;
PeiBotDevice->Media.MediaPresent = TRUE;
+
+ PeiBotDevice->Media2.MediaPresent = TRUE;
+ PeiBotDevice->Media2.LastBlock = PeiBotDevice->Media.LastBlock;
}
return EFI_SUCCESS;
@@ -468,8 +492,8 @@ IsNoMedia ( )
{
ATAPI_REQUEST_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN NoMedia;
+ UINTN Index;
+ BOOLEAN NoMedia;
NoMedia = FALSE;
SensePtr = SenseData;
@@ -515,12 +539,12 @@ IsNoMedia ( BOOLEAN
IsMediaError (
IN ATAPI_REQUEST_SENSE_DATA *SenseData,
- IN UINTN SenseCounts
+ IN UINTN SenseCounts
)
{
ATAPI_REQUEST_SENSE_DATA *SensePtr;
- UINTN Index;
- BOOLEAN Error;
+ UINTN Index;
+ BOOLEAN Error;
SensePtr = SenseData;
Error = FALSE;
diff --git a/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPei.inf b/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPei.inf index f601532..977bef5 100644 --- a/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPei.inf +++ b/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPei.inf @@ -1,7 +1,7 @@ ## @file
# The Usb mass storage device Peim driver is used to support recovery from USB device.
#
-# Copyright (c) 2006 - 2014, 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
@@ -57,6 +57,7 @@ [Ppis]
gEfiPeiVirtualBlockIoPpiGuid ## PRODUCES
+ gEfiPeiVirtualBlockIo2PpiGuid ## PRODUCES
## CONSUMES
## NOTIFY
gPeiUsbIoPpiGuid
diff --git a/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.c b/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.c index c436ed7..5e18306 100644 --- a/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.c +++ b/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.c @@ -31,10 +31,24 @@ EFI_PEI_RECOVERY_BLOCK_IO_PPI mRecoveryBlkIoPpi = { BotReadBlocks
};
-EFI_PEI_PPI_DESCRIPTOR mPpiList = {
- EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
- &gEfiPeiVirtualBlockIoPpiGuid,
- NULL
+EFI_PEI_RECOVERY_BLOCK_IO2_PPI mRecoveryBlkIo2Ppi = {
+ EFI_PEI_RECOVERY_BLOCK_IO2_PPI_REVISION,
+ BotGetNumberOfBlockDevices2,
+ BotGetMediaInfo2,
+ BotReadBlocks2
+};
+
+EFI_PEI_PPI_DESCRIPTOR mPpiList[2] = {
+ {
+ EFI_PEI_PPI_DESCRIPTOR_PPI,
+ &gEfiPeiVirtualBlockIoPpiGuid,
+ NULL
+ },
+ {
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
+ &gEfiPeiVirtualBlockIo2PpiGuid,
+ NULL
+ }
};
/**
@@ -200,6 +214,10 @@ InitUsbBot ( //
PeiBotDevice->Media.DeviceType = UsbMassStorage;
PeiBotDevice->Media.BlockSize = 0x200;
+ PeiBotDevice->Media2.InterfaceType = MSG_USB_DP;
+ PeiBotDevice->Media2.BlockSize = 0x200;
+ PeiBotDevice->Media2.RemovableMedia = FALSE;
+ PeiBotDevice->Media2.ReadOnly = FALSE;
//
// Check its Bulk-in/Bulk-out endpoint
@@ -229,11 +247,22 @@ InitUsbBot ( sizeof (EFI_PEI_RECOVERY_BLOCK_IO_PPI)
);
CopyMem (
+ &(PeiBotDevice->BlkIo2Ppi),
+ &mRecoveryBlkIo2Ppi,
+ sizeof (EFI_PEI_RECOVERY_BLOCK_IO2_PPI)
+ );
+ CopyMem (
&(PeiBotDevice->BlkIoPpiList),
- &mPpiList,
+ &mPpiList[0],
+ sizeof (EFI_PEI_PPI_DESCRIPTOR)
+ );
+ CopyMem (
+ &(PeiBotDevice->BlkIo2PpiList),
+ &mPpiList[1],
sizeof (EFI_PEI_PPI_DESCRIPTOR)
);
PeiBotDevice->BlkIoPpiList.Ppi = &PeiBotDevice->BlkIoPpi;
+ PeiBotDevice->BlkIo2PpiList.Ppi = &PeiBotDevice->BlkIo2Ppi;
Status = PeiUsbInquiry (PeiServices, PeiBotDevice);
if (EFI_ERROR (Status)) {
@@ -435,7 +464,7 @@ BotReadBlocks ( Status = EFI_BAD_BUFFER_SIZE;
}
- if (StartLBA > PeiBotDev->Media.LastBlock) {
+ if (StartLBA > PeiBotDev->Media2.LastBlock) {
Status = EFI_INVALID_PARAMETER;
}
@@ -489,11 +518,11 @@ BotReadBlocks ( return EFI_BAD_BUFFER_SIZE;
}
- if (StartLBA > PeiBotDev->Media.LastBlock) {
+ if (StartLBA > PeiBotDev->Media2.LastBlock) {
return EFI_INVALID_PARAMETER;
}
- if ((StartLBA + NumberOfBlocks - 1) > PeiBotDev->Media.LastBlock) {
+ if ((StartLBA + NumberOfBlocks - 1) > PeiBotDev->Media2.LastBlock) {
return EFI_INVALID_PARAMETER;
}
@@ -542,6 +571,168 @@ BotReadBlocks ( }
/**
+ 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
+BotGetNumberOfBlockDevices2 (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
+ OUT UINTN *NumberBlockDevices
+ )
+{
+ //
+ // For Usb devices, this value should be always 1
+ //
+ *NumberBlockDevices = 1;
+ return EFI_SUCCESS;
+}
+
+/**
+ 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.
+
+**/
+EFI_STATUS
+EFIAPI
+BotGetMediaInfo2 (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This,
+ IN UINTN DeviceIndex,
+ OUT EFI_PEI_BLOCK_IO2_MEDIA *MediaInfo
+ )
+{
+ PEI_BOT_DEVICE *PeiBotDev;
+ EFI_STATUS Status;
+
+ PeiBotDev = PEI_BOT_DEVICE2_FROM_THIS (This);
+
+ Status = BotGetMediaInfo (
+ PeiServices,
+ &PeiBotDev->BlkIoPpi,
+ DeviceIndex,
+ &PeiBotDev->Media
+ );
+
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ CopyMem (
+ MediaInfo,
+ &(PeiBotDev->Media2),
+ sizeof (EFI_PEI_BLOCK_IO2_MEDIA)
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
+ 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
+BotReadBlocks2 (
+ 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
+ )
+{
+ PEI_BOT_DEVICE *PeiBotDev;
+ EFI_STATUS Status;
+
+ if (This == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = EFI_SUCCESS;
+ PeiBotDev = PEI_BOT_DEVICE2_FROM_THIS (This);
+
+ Status = BotReadBlocks (
+ PeiServices,
+ &PeiBotDev->BlkIoPpi,
+ DeviceIndex,
+ StartLBA,
+ BufferSize,
+ Buffer
+ );
+
+ return Status;
+}
+
+/**
Detect whether the removable media is present and whether it has changed.
@param[in] PeiServices General-purpose services that are available to every
@@ -554,17 +745,17 @@ BotReadBlocks ( **/
EFI_STATUS
PeiBotDetectMedia (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_BOT_DEVICE *PeiBotDev
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_BOT_DEVICE *PeiBotDev
)
{
- EFI_STATUS Status;
- EFI_STATUS FloppyStatus;
- UINTN SenseCounts;
- BOOLEAN NeedReadCapacity;
- EFI_PHYSICAL_ADDRESS AllocateAddress;
+ EFI_STATUS Status;
+ EFI_STATUS FloppyStatus;
+ UINTN SenseCounts;
+ BOOLEAN NeedReadCapacity;
+ EFI_PHYSICAL_ADDRESS AllocateAddress;
ATAPI_REQUEST_SENSE_DATA *SensePtr;
- UINTN Retry;
+ UINTN Retry;
//
// if there is no media present,or media not changed,
@@ -601,12 +792,15 @@ PeiBotDetectMedia ( NeedReadCapacity = FALSE;
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
+ PeiBotDev->Media2.MediaPresent = FALSE;
+ PeiBotDev->Media2.LastBlock = 0;
} else {
//
// Media Changed
//
if (IsMediaChange (SensePtr, SenseCounts)) {
- PeiBotDev->Media.MediaPresent = TRUE;
+ PeiBotDev->Media.MediaPresent = TRUE;
+ PeiBotDev->Media2.MediaPresent = TRUE;
}
//
// Media Error
@@ -617,6 +811,8 @@ PeiBotDetectMedia ( //
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
+ PeiBotDev->Media2.MediaPresent = FALSE;
+ PeiBotDev->Media2.LastBlock = 0;
}
}
@@ -647,7 +843,7 @@ PeiBotDetectMedia ( // retry the ReadCapacity command
//
PeiBotDev->DeviceType = USBFLOPPY;
- Status = EFI_DEVICE_ERROR;
+ Status = EFI_DEVICE_ERROR;
}
break;
@@ -694,6 +890,8 @@ PeiBotDetectMedia ( if (IsNoMedia (SensePtr, SenseCounts)) {
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
+ PeiBotDev->Media2.MediaPresent = FALSE;
+ PeiBotDev->Media2.LastBlock = 0;
break;
}
@@ -703,6 +901,8 @@ PeiBotDetectMedia ( //
PeiBotDev->Media.MediaPresent = FALSE;
PeiBotDev->Media.LastBlock = 0;
+ PeiBotDev->Media2.MediaPresent = FALSE;
+ PeiBotDev->Media2.LastBlock = 0;
break;
}
}
diff --git a/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.h b/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.h index 26d08df..3ae8c67 100644 --- a/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.h +++ b/MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.h @@ -1,7 +1,7 @@ /** @file
Usb BOT Peim definition.
-Copyright (c) 2006, 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
@@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Ppi/UsbIo.h>
#include <Ppi/UsbHostController.h>
#include <Ppi/BlockIo.h>
+#include <Ppi/BlockIo2.h>
#include <Library/DebugLib.h>
@@ -139,8 +140,116 @@ BotReadBlocks ( );
/**
- UsbIo installation notification function.
-
+ 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
+BotGetNumberOfBlockDevices2 (
+ 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.
+
+**/
+EFI_STATUS
+EFIAPI
+BotGetMediaInfo2 (
+ 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
+BotReadBlocks2 (
+ 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
+ );
+
+/**
+ UsbIo installation notification function.
+
This function finds out all the current USB IO PPIs in the system and add them
into private data.
@@ -188,18 +297,22 @@ InitUsbBot ( typedef struct {
UINTN Signature;
EFI_PEI_RECOVERY_BLOCK_IO_PPI BlkIoPpi;
+ EFI_PEI_RECOVERY_BLOCK_IO2_PPI BlkIo2Ppi;
EFI_PEI_PPI_DESCRIPTOR BlkIoPpiList;
+ EFI_PEI_PPI_DESCRIPTOR BlkIo2PpiList;
EFI_PEI_BLOCK_IO_MEDIA Media;
+ EFI_PEI_BLOCK_IO2_MEDIA Media2;
PEI_USB_IO_PPI *UsbIoPpi;
EFI_USB_INTERFACE_DESCRIPTOR *BotInterface;
EFI_USB_ENDPOINT_DESCRIPTOR *BulkInEndpoint;
EFI_USB_ENDPOINT_DESCRIPTOR *BulkOutEndpoint;
UINTN AllocateAddress;
UINTN DeviceType;
- ATAPI_REQUEST_SENSE_DATA *SensePtr;
+ ATAPI_REQUEST_SENSE_DATA *SensePtr;
} PEI_BOT_DEVICE;
#define PEI_BOT_DEVICE_FROM_THIS(a) CR (a, PEI_BOT_DEVICE, BlkIoPpi, PEI_BOT_DEVICE_SIGNATURE)
+#define PEI_BOT_DEVICE2_FROM_THIS(a) CR (a, PEI_BOT_DEVICE, BlkIo2Ppi, PEI_BOT_DEVICE_SIGNATURE)
/**
Send ATAPI command using BOT protocol.
diff --git a/MdeModulePkg/Bus/Usb/UsbBotPei/UsbPeim.h b/MdeModulePkg/Bus/Usb/UsbBotPei/UsbPeim.h index 6dcd189..c62b99d 100644 --- a/MdeModulePkg/Bus/Usb/UsbBotPei/UsbPeim.h +++ b/MdeModulePkg/Bus/Usb/UsbBotPei/UsbPeim.h @@ -1,7 +1,7 @@ /** @file
Usb Peim definition.
-Copyright (c) 2006 - 2014, 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
@@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Ppi/UsbIo.h>
#include <Ppi/BlockIo.h>
+#include <Ppi/BlockIo2.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
|