]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h
MdeModulePkg/UsbMass: Fix various typos
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbMassStorageDxe / UsbMassBoot.h
index 5ee50ac52a21b4cb3a9505ab1d4778bbec6c6971..f34a41284e4c561acd7cf4a9f796a68d72ce9e72 100644 (file)
@@ -3,13 +3,7 @@
   for Bootability, Revision 1.0.\r
 \r
 Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\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
@@ -21,7 +15,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 // INQUIRY/REQUEST_SENSE are "No Timeout Commands" as specified\r
 // by Multi-Media Commands (MMC) set.\r
 // Others are "Group 1 Timeout Commands". That is,\r
-// they should be retried if driver is ready. \r
+// they should be retried if driver is ready.\r
 //\r
 #define USB_BOOT_INQUIRY_OPCODE         0x12\r
 #define USB_BOOT_REQUEST_SENSE_OPCODE   0x03\r
@@ -55,7 +49,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define USB_BOOT_ASC_NOT_READY                        0x04\r
 #define USB_BOOT_ASC_NO_MEDIA                         0x3A\r
 #define USB_BOOT_ASC_MEDIA_CHANGE                     0x28\r
-#define USB_BOOT_ASC_POWER_ON                         0x29\r
 \r
 //\r
 // Supported PDT codes, or Peripheral Device Type\r
@@ -66,9 +59,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define USB_PDT_SIMPLE_DIRECT           0x0E       ///< Simplified direct access device\r
 \r
 //\r
-// Other parameters, Max carried size is 512B * 128 = 64KB\r
+// Other parameters, Max carried size is 64KB.\r
 //\r
-#define USB_BOOT_IO_BLOCKS              128\r
+#define USB_BOOT_MAX_CARRY_SIZE         SIZE_64KB\r
 \r
 //\r
 // Retry mass command times, set by experience\r
@@ -83,17 +76,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 //\r
 // Mass command timeout, refers to specification[USB20-9.2.6.1]\r
 //\r
-// USB2.0 Spec define the up-limit timeout 5s for all command. USB floppy, \r
-// USB CD-Rom and iPod devices are much slower than USB key when reponse \r
+// USB2.0 Spec define the up-limit timeout 5s for all command. USB floppy,\r
+// USB CD-Rom and iPod devices are much slower than USB key when response\r
 // most of commands, So we set 5s as timeout here.\r
-// \r
+//\r
 #define USB_BOOT_GENERAL_CMD_TIMEOUT    (5 * USB_MASS_1_SECOND)\r
 \r
 //\r
 // The required commands are INQUIRY, READ CAPACITY, TEST UNIT READY,\r
 // READ10, WRITE10, and REQUEST SENSE. The BLOCK_IO protocol uses LBA\r
 // so it isn't necessary to issue MODE SENSE / READ FORMAT CAPACITY\r
-// command to retrieve the disk gemotrics. \r
+// command to retrieve the disk gemotrics.\r
 //\r
 #pragma pack(1)\r
 typedef struct {\r
@@ -162,17 +155,7 @@ typedef struct {
   UINT8             TransferLen[2]; ///< Transfer length\r
   UINT8             Reserverd1;\r
   UINT8             Pad[2];\r
-} USB_BOOT_READ10_CMD;\r
-\r
-typedef struct {\r
-  UINT8             OpCode;\r
-  UINT8             Lun;\r
-  UINT8             Lba[4];\r
-  UINT8             Reserved0;\r
-  UINT8             TransferLen[2];\r
-  UINT8             Reserverd1;\r
-  UINT8             Pad[2];\r
-} USB_BOOT_WRITE10_CMD;\r
+} USB_BOOT_READ_WRITE_10_CMD;\r
 \r
 typedef struct {\r
   UINT8             OpCode;\r
@@ -230,7 +213,7 @@ typedef struct {
   This function get the parameters for the USB mass storage media,\r
   It is used both to initialize the media during the Start() phase\r
   of Driver Binding Protocol and to re-initialize it when the media is\r
-  changed. Althought the RemoveableMedia is unlikely to change,\r
+  changed. Although the RemoveableMedia is unlikely to change,\r
   it is also included here.\r
 \r
   @param  UsbMass                The device to retrieve disk gemotric.\r
@@ -293,66 +276,48 @@ UsbBootReadBlocks (
   );\r
 \r
 /**\r
-  Write some blocks to the device.\r
+  Read or write some blocks from the device.\r
 \r
-  @param  UsbMass                The USB mass storage device to write to\r
+  @param  UsbMass                The USB mass storage device to access\r
+  @param  Write                  TRUE for write operation.\r
   @param  Lba                    The start block number\r
-  @param  TotalBlock             Total block number to write\r
-  @param  Buffer                 Pointer to the source buffer for the data.\r
+  @param  TotalBlock             Total block number to read or write\r
+  @param  Buffer                 The buffer to read to or write from\r
 \r
-  @retval EFI_SUCCESS            Data are written into the buffer\r
-  @retval Others                 Failed to write all the data\r
+  @retval EFI_SUCCESS            Data are read into the buffer or writen into the device.\r
+  @retval Others                 Failed to read or write all the data\r
 \r
 **/\r
 EFI_STATUS\r
-UsbBootWriteBlocks (\r
-  IN  USB_MASS_DEVICE         *UsbMass,\r
-  IN  UINT32                  Lba,\r
-  IN  UINTN                   TotalBlock,\r
-  IN  UINT8                   *Buffer\r
+UsbBootReadWriteBlocks (\r
+  IN  USB_MASS_DEVICE       *UsbMass,\r
+  IN  BOOLEAN               Write,\r
+  IN  UINT32                Lba,\r
+  IN  UINTN                 TotalBlock,\r
+  IN OUT UINT8              *Buffer\r
   );\r
 \r
 /**\r
-  Read some blocks from the device by SCSI 16 byte cmd.\r
+  Read or write some blocks from the device by SCSI 16 byte cmd.\r
 \r
-  @param  UsbMass                The USB mass storage device to read from\r
+  @param  UsbMass                The USB mass storage device to access\r
+  @param  Write                  TRUE for write operation.\r
   @param  Lba                    The start block number\r
-  @param  TotalBlock             Total block number to read\r
-  @param  Buffer                 The buffer to read to\r
-\r
-  @retval EFI_SUCCESS            Data are read into the buffer\r
-  @retval Others                 Failed to read all the data\r
+  @param  TotalBlock             Total block number to read or write\r
+  @param  Buffer                 The buffer to read to or write from\r
 \r
+  @retval EFI_SUCCESS            Data are read into the buffer or writen into the device.\r
+  @retval Others                 Failed to read or write all the data\r
 **/\r
 EFI_STATUS\r
-UsbBootReadBlocks16 (\r
+UsbBootReadWriteBlocks16 (\r
   IN  USB_MASS_DEVICE       *UsbMass,\r
+  IN  BOOLEAN               Write,\r
   IN  UINT64                Lba,\r
   IN  UINTN                 TotalBlock,\r
-  OUT UINT8                 *Buffer\r
-  );\r
-\r
-/**\r
-  Write some blocks to the device by SCSI 16 byte cmd.\r
-\r
-  @param  UsbMass                The USB mass storage device to write to\r
-  @param  Lba                    The start block number\r
-  @param  TotalBlock             Total block number to write\r
-  @param  Buffer                 Pointer to the source buffer for the data.\r
-\r
-  @retval EFI_SUCCESS            Data are written into the buffer\r
-  @retval Others                 Failed to write all the data\r
-\r
-**/\r
-EFI_STATUS\r
-UsbBootWriteBlocks16 (\r
-  IN  USB_MASS_DEVICE         *UsbMass,\r
-  IN  UINT64                  Lba,\r
-  IN  UINTN                   TotalBlock,\r
-  IN  UINT8                   *Buffer\r
+  IN OUT UINT8              *Buffer\r
   );\r
 \r
-\r
 /**\r
   Use the USB clear feature control transfer to clear the endpoint stall condition.\r
 \r