]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBotPei/UsbBotPeim.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBotPei / UsbBotPeim.h
index 26d08dfd563da5ace1b8af28d308c406b6965bcf..1819784981f3400a1d13566656607e76bf657dbd 100644 (file)
@@ -1,16 +1,9 @@
 /** @file\r
 Usb BOT Peim definition.\r
 \r
-Copyright (c) 2006, 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
-of the BSD License which accompanies this distribution.  The\r
-full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -22,6 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Ppi/UsbIo.h>\r
 #include <Ppi/UsbHostController.h>\r
 #include <Ppi/BlockIo.h>\r
+#include <Ppi/BlockIo2.h>\r
 \r
 #include <Library/DebugLib.h>\r
 \r
@@ -33,16 +27,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 /**\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
@@ -52,75 +46,75 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 EFI_STATUS\r
 EFIAPI\r
 BotGetNumberOfBlockDevices (\r
-  IN  EFI_PEI_SERVICES                         **PeiServices,\r
-  IN  EFI_PEI_RECOVERY_BLOCK_IO_PPI            *This,\r
-  OUT UINTN                                    *NumberBlockDevices\r
+  IN  EFI_PEI_SERVICES               **PeiServices,\r
+  IN  EFI_PEI_RECOVERY_BLOCK_IO_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
+  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
+  @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
 \r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
 BotGetMediaInfo (\r
-  IN  EFI_PEI_SERVICES                          **PeiServices,\r
-  IN  EFI_PEI_RECOVERY_BLOCK_IO_PPI             *This,\r
-  IN  UINTN                                     DeviceIndex,\r
-  OUT EFI_PEI_BLOCK_IO_MEDIA                    *MediaInfo\r
+  IN  EFI_PEI_SERVICES               **PeiServices,\r
+  IN  EFI_PEI_RECOVERY_BLOCK_IO_PPI  *This,\r
+  IN  UINTN                          DeviceIndex,\r
+  OUT EFI_PEI_BLOCK_IO_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
+  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
   @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
@@ -130,17 +124,125 @@ BotGetMediaInfo (
 EFI_STATUS\r
 EFIAPI\r
 BotReadBlocks (\r
-  IN  EFI_PEI_SERVICES                          **PeiServices,\r
-  IN  EFI_PEI_RECOVERY_BLOCK_IO_PPI             *This,\r
-  IN  UINTN                                     DeviceIndex,\r
-  IN  EFI_PEI_LBA                               StartLBA,\r
-  IN  UINTN                                     BufferSize,\r
-  OUT VOID                                      *Buffer\r
+  IN  EFI_PEI_SERVICES               **PeiServices,\r
+  IN  EFI_PEI_RECOVERY_BLOCK_IO_PPI  *This,\r
+  IN  UINTN                          DeviceIndex,\r
+  IN  EFI_PEI_LBA                    StartLBA,\r
+  IN  UINTN                          BufferSize,\r
+  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
+BotGetNumberOfBlockDevices2 (\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
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BotGetMediaInfo2 (\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
+BotReadBlocks2 (\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
-  UsbIo installation notification function. \r
-  \r
+  UsbIo installation notification function.\r
+\r
   This function finds out all the current USB IO PPIs in the system and add them\r
   into private data.\r
 \r
@@ -154,9 +256,9 @@ BotReadBlocks (
 EFI_STATUS\r
 EFIAPI\r
 NotifyOnUsbIoPpi (\r
-  IN  EFI_PEI_SERVICES                              **PeiServices,\r
-  IN  EFI_PEI_NOTIFY_DESCRIPTOR                     *NotifyDesc,\r
-  IN  VOID                                          *InvokePpi\r
+  IN  EFI_PEI_SERVICES           **PeiServices,\r
+  IN  EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDesc,\r
+  IN  VOID                       *InvokePpi\r
   );\r
 \r
 /**\r
@@ -172,11 +274,11 @@ NotifyOnUsbIoPpi (
 **/\r
 EFI_STATUS\r
 InitUsbBot (\r
-  IN  EFI_PEI_SERVICES                          **PeiServices,\r
-  IN  PEI_USB_IO_PPI                            *UsbIoPpi\r
+  IN  EFI_PEI_SERVICES  **PeiServices,\r
+  IN  PEI_USB_IO_PPI    *UsbIoPpi\r
   );\r
 \r
-#define USBCDROM    1 // let the device type value equal to USBCDROM, which is defined by PI spec.\r
+#define USBCDROM  1   // let the device type value equal to USBCDROM, which is defined by PI spec.\r
                       // Therefore the CdExpressPei module can do recovery on UsbCdrom.\r
 #define USBFLOPPY   2 // for those that use ReadCapacity(0x25) command to retrieve media capacity\r
 #define USBFLOPPY2  3 // for those that use ReadFormatCapacity(0x23) command to retrieve media capacity\r
@@ -186,20 +288,24 @@ InitUsbBot (
 //\r
 #define PEI_BOT_DEVICE_SIGNATURE  SIGNATURE_32 ('U', 'B', 'O', 'T')\r
 typedef struct {\r
-  UINTN                           Signature;\r
-  EFI_PEI_RECOVERY_BLOCK_IO_PPI   BlkIoPpi;\r
-  EFI_PEI_PPI_DESCRIPTOR          BlkIoPpiList;\r
-  EFI_PEI_BLOCK_IO_MEDIA          Media;\r
-  PEI_USB_IO_PPI                  *UsbIoPpi;\r
-  EFI_USB_INTERFACE_DESCRIPTOR    *BotInterface;\r
-  EFI_USB_ENDPOINT_DESCRIPTOR     *BulkInEndpoint;\r
-  EFI_USB_ENDPOINT_DESCRIPTOR     *BulkOutEndpoint;\r
-  UINTN                           AllocateAddress;\r
-  UINTN                           DeviceType;\r
-  ATAPI_REQUEST_SENSE_DATA              *SensePtr;\r
+  UINTN                             Signature;\r
+  EFI_PEI_RECOVERY_BLOCK_IO_PPI     BlkIoPpi;\r
+  EFI_PEI_RECOVERY_BLOCK_IO2_PPI    BlkIo2Ppi;\r
+  EFI_PEI_PPI_DESCRIPTOR            BlkIoPpiList;\r
+  EFI_PEI_PPI_DESCRIPTOR            BlkIo2PpiList;\r
+  EFI_PEI_BLOCK_IO_MEDIA            Media;\r
+  EFI_PEI_BLOCK_IO2_MEDIA           Media2;\r
+  PEI_USB_IO_PPI                    *UsbIoPpi;\r
+  EFI_USB_INTERFACE_DESCRIPTOR      *BotInterface;\r
+  EFI_USB_ENDPOINT_DESCRIPTOR       *BulkInEndpoint;\r
+  EFI_USB_ENDPOINT_DESCRIPTOR       *BulkOutEndpoint;\r
+  UINTN                             AllocateAddress;\r
+  UINTN                             DeviceType;\r
+  ATAPI_REQUEST_SENSE_DATA          *SensePtr;\r
 } PEI_BOT_DEVICE;\r
 \r
-#define PEI_BOT_DEVICE_FROM_THIS(a) CR (a, PEI_BOT_DEVICE, BlkIoPpi, PEI_BOT_DEVICE_SIGNATURE)\r
+#define PEI_BOT_DEVICE_FROM_THIS(a)   CR (a, PEI_BOT_DEVICE, BlkIoPpi, PEI_BOT_DEVICE_SIGNATURE)\r
+#define PEI_BOT_DEVICE2_FROM_THIS(a)  CR (a, PEI_BOT_DEVICE, BlkIo2Ppi, PEI_BOT_DEVICE_SIGNATURE)\r
 \r
 /**\r
   Send ATAPI command using BOT protocol.\r
@@ -220,14 +326,14 @@ typedef struct {
 **/\r
 EFI_STATUS\r
 PeiAtapiCommand (\r
-  IN  EFI_PEI_SERVICES            **PeiServices,\r
-  IN  PEI_BOT_DEVICE              *PeiBotDev,\r
-  IN  VOID                        *Command,\r
-  IN  UINT8                       CommandSize,\r
-  IN  VOID                        *DataBuffer,\r
-  IN  UINT32                      BufferLength,\r
-  IN  EFI_USB_DATA_DIRECTION      Direction,\r
-  IN  UINT16                      TimeOutInMilliSeconds\r
+  IN  EFI_PEI_SERVICES        **PeiServices,\r
+  IN  PEI_BOT_DEVICE          *PeiBotDev,\r
+  IN  VOID                    *Command,\r
+  IN  UINT8                   CommandSize,\r
+  IN  VOID                    *DataBuffer,\r
+  IN  UINT32                  BufferLength,\r
+  IN  EFI_USB_DATA_DIRECTION  Direction,\r
+  IN  UINT16                  TimeOutInMilliSeconds\r
   );\r
 \r
 #endif\r