public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ming Huang <ming.huang@linaro.org>
To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org,
	edk2-devel@lists.01.org, graeme.gregory@linaro.org,
	star.zeng@intel.com, eric.dong@intel.com
Cc: ard.biesheuvel@linaro.org, michael.d.kinney@intel.com,
	liming.gao@intel.com, guoheyi@huawei.com,
	wanghuiqiang@huawei.com, huangming23@huawei.com,
	zhangjinsong2@huawei.com, mengfanrong@huawei.com,
	huangdaode@hisilicon.com, waip23@126.com,
	Ming Huang <ming.huang@linaro.org>
Subject: [RFC v1 1/1] MdeModulePkg/Usb: Use Pcd for UsbBootIoBlocks
Date: Sat, 24 Feb 2018 17:29:35 +0800	[thread overview]
Message-ID: <1519464575-38109-2-git-send-email-ming.huang@linaro.org> (raw)
In-Reply-To: <1519464575-38109-1-git-send-email-ming.huang@linaro.org>

Booting from USB may fail while the macro USB_BOOT_IO_BLOCKS
set to 128 because 128 blocks is exceeded the maximun blocks of
some USB devices,like some virtual CD-ROM from BMC. So, give a
chance to set the value of USB_BOOT_IO_BLOCKS by adding a Pcd.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <ming.huang@linaro.org>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h         | 7 +++++--
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf | 4 ++++
 MdeModulePkg/MdeModulePkg.dec                                | 4 ++++
 MdeModulePkg/MdeModulePkg.uni                                | 4 ++++
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h
index 5ee50ac52a21..ca9240adbd5f 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h
@@ -16,6 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef _EFI_USB_MASS_BOOT_H_
 #define _EFI_USB_MASS_BOOT_H_
 
+#include <Library/PcdLib.h>
+
 //
 // The opcodes of various USB boot commands:
 // INQUIRY/REQUEST_SENSE are "No Timeout Commands" as specified
@@ -66,9 +68,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define USB_PDT_SIMPLE_DIRECT           0x0E       ///< Simplified direct access device
 
 //
-// Other parameters, Max carried size is 512B * 128 = 64KB
+// Other parameters, Max carried size is depanded on Pcd.
+// The default of PcdUsbBootIoBlocks is 128. 512B * 128 = 64KB
 //
-#define USB_BOOT_IO_BLOCKS              128
+#define USB_BOOT_IO_BLOCKS              (FixedPcdGet32 (PcdUsbBootIoBlocks))
 
 //
 // Retry mass command times, set by experience
diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
index 26d15c7679bf..40426512f884 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
@@ -60,6 +60,7 @@ [Sources]
   UsbMassDiskInfo.c
 
 [Packages]
+  MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
 
 [LibraryClasses]
@@ -83,5 +84,8 @@ [Protocols]
 # EVENT_TYPE_RELATIVE_TIMER        ## CONSUMES
 #
 
+[FixedPcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUsbBootIoBlocks
+
 [UserExtensions.TianoCore."ExtraFiles"]
   UsbMassStorageDxeExtra.uni
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 455979386e3f..fc40745315a0 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -999,6 +999,10 @@ [PcdsFixedAtBuild]
   # @Prompt Enable UEFI Stack Guard.
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x30001055
 
+## The Max blocks of usb transfer. The default is 128.
+# @Prompt The Max blocks of usb transfer
+gEfiMdeModulePkgTokenSpaceGuid.PcdUsbBootIoBlocks|128|UINT32|0x0000010B
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   ## Dynamic type PCD can be registered callback function for Pcd setting action.
   #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of callback function
diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index f3fa616438b0..c996d6b4ebe0 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
@@ -1243,3 +1243,7 @@
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdEdkiiFpdtStringRecordEnableOnly_HELP    #language en-US "Control which FPDT record format will be used to store the performance entry.\n"
                                                                                                       "On TRUE, the string FPDT record will be used to store every performance entry.\n"
                                                                                                       "On FALSE, the different FPDT record will be used to store the different performance entries."
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdUsbBootIoBlocks_PROMPT  #language en-US "The Max blocks of usb transfer."
+
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdUsbBootIoBlocks_HELP    #language en-US "The Max blocks of usb transfer. The default is 128."
-- 
1.9.1



  reply	other threads:[~2018-02-24  9:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-24  9:29 [RFC v1 0/1] Add PcdUsbBootIoBlocks to UsbMassBoot Ming Huang
2018-02-24  9:29 ` Ming Huang [this message]
2018-02-27  5:25   ` [RFC v1 1/1] MdeModulePkg/Usb: Use Pcd for UsbBootIoBlocks Ni, Ruiyu
2018-02-27  9:25     ` Ming Huang
2018-02-27 10:01       ` Ni, Ruiyu
2018-03-02  6:36         ` Ming Huang
2018-03-12  6:01           ` Ming Huang
2018-03-12 15:47             ` Kinney, Michael D
2018-03-13  0:44               ` Zeng, Star
2018-03-13  1:38                 ` Kinney, Michael D
2018-03-14 12:40                   ` Ming Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1519464575-38109-2-git-send-email-ming.huang@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox