From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 84DA1225E4025 for ; Sun, 25 Mar 2018 19:59:16 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Mar 2018 20:05:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,363,1517904000"; d="scan'208";a="28375786" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga008.jf.intel.com with ESMTP; 25 Mar 2018 20:05:51 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 25 Mar 2018 20:05:50 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.80]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.226]) with mapi id 14.03.0319.002; Mon, 26 Mar 2018 11:05:48 +0800 From: "Zeng, Star" To: Ming Huang , "linaro-uefi@lists.linaro.org" , "edk2-devel@lists.01.org" CC: "huangming23@huawei.com" , "Dong, Eric" , "ard.biesheuvel@linaro.org" , "zhangjinsong2@huawei.com" , "leif.lindholm@linaro.org" , "mengfanrong@huawei.com" , "guoheyi@huawei.com" , "Gao, Liming" , "Kinney, Michael D" , "waip23@126.com" , "wanghuiqiang@huawei.com" , "huangdaode@hisilicon.com" , "Ni, Ruiyu" , "Zeng, Star" Thread-Topic: [MdeModulePkg/Usb v2 1/1] MdeModulePkg/Usb: Replace macro USB_BOOT_IO_BLOCKS Thread-Index: AQHTwbGmnhWt1PURhECHPMDpLR5F86Pb7w4wgAVjIgCAAIj9oA== Date: Mon, 26 Mar 2018 03:05:48 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BA73351@shsmsx102.ccr.corp.intel.com> References: <1521704666-54009-1-git-send-email-ming.huang@linaro.org> <1521704666-54009-2-git-send-email-ming.huang@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103BA72588@shsmsx102.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5BC0CEC3@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5BC0CEC3@SHSMSX104.ccr.corp.intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [MdeModulePkg/Usb v2 1/1] MdeModulePkg/Usb: Replace macro USB_BOOT_IO_BLOCKS X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Mar 2018 02:59:17 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Patch has been pushed at https://github.com/tianocore/edk2/commit/824b6e3b5= fa080df36626db3eb8465c25a12c053. Thanks for the contribution. Star -----Original Message----- From: Ni, Ruiyu=20 Sent: Monday, March 26, 2018 10:55 AM To: Zeng, Star ; Ming Huang ; l= inaro-uefi@lists.linaro.org; edk2-devel@lists.01.org Cc: Zeng, Star ; huangming23@huawei.com; Dong, Eric ; ard.biesheuvel@linaro.org; zhangjinsong2@huawei.com; l= eif.lindholm@linaro.org; mengfanrong@huawei.com; guoheyi@huawei.com; Gao, L= iming ; Kinney, Michael D ; waip23@126.com; wanghuiqiang@huawei.com; huangdaode@hisilicon.com Subject: RE: [MdeModulePkg/Usb v2 1/1] MdeModulePkg/Usb: Replace macro USB_= BOOT_IO_BLOCKS Reviewed-by: Ruiyu Ni > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Zeng, Star > Sent: Thursday, March 22, 2018 4:39 PM > To: Ming Huang ; linaro-uefi@lists.linaro.org;=20 > edk2- devel@lists.01.org > Cc: Zeng, Star ; huangming23@huawei.com; Dong,=20 > Eric ; ard.biesheuvel@linaro.org;=20 > zhangjinsong2@huawei.com; leif.lindholm@linaro.org;=20 > mengfanrong@huawei.com; guoheyi@huawei.com; Gao, Liming=20 > ; Kinney, Michael D=20 > ; waip23@126.com; wanghuiqiang@huawei.com;=20 > huangdaode@hisilicon.com > Subject: Re: [edk2] [MdeModulePkg/Usb v2 1/1] MdeModulePkg/Usb:=20 > Replace macro USB_BOOT_IO_BLOCKS >=20 > Reviewed-by: Star Zeng >=20 > Thanks, > Star > -----Original Message----- > From: Ming Huang [mailto:ming.huang@linaro.org] > Sent: Thursday, March 22, 2018 3:44 PM > To: linaro-uefi@lists.linaro.org; edk2-devel@lists.01.org > Cc: Zeng, Star ; Dong, Eric=20 > ; Kinney, Michael D ;=20 > Gao, Liming ; leif.lindholm@linaro.org;=20 > ard.biesheuvel@linaro.org; guoheyi@huawei.com;=20 > wanghuiqiang@huawei.com; huangming23@huawei.com;=20 > zhangjinsong2@huawei.com; mengfanrong@huawei.com;=20 > huangdaode@hisilicon.com; waip23@126.com; Ming Huang=20 > > Subject: [MdeModulePkg/Usb v2 1/1] MdeModulePkg/Usb: Replace macro=20 > USB_BOOT_IO_BLOCKS >=20 > Booting from USB may fail while the macro USB_BOOT_IO_BLOCKS set to=20 > 128 because the block size of some USB devices are exceeded 512, like=20 > some virtual CD-ROM from BMC, the block size is 2048. > So,the count blocks to transfer should be calculated by block size of=20 > the USB devices. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ming Huang > --- > MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 16 > ++++++++++++---- > MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h | 4 ++-- > 2 files changed, 14 insertions(+), 6 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c > b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c > index b84bfd2d7290..3bf6e6a81f3c 100644 > --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c > +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c > @@ -814,11 +814,13 @@ UsbBootReadBlocks ( > USB_BOOT_READ10_CMD ReadCmd; > EFI_STATUS Status; > UINT16 Count; > + UINT16 CountMax; > UINT32 BlockSize; > UINT32 ByteSize; > UINT32 Timeout; >=20 > BlockSize =3D UsbMass->BlockIoMedia.BlockSize; > + CountMax =3D (UINT16)(USB_BOOT_MAX_CARRY_SIZE / BlockSize); > Status =3D EFI_SUCCESS; >=20 > while (TotalBlock > 0) { > @@ -827,7 +829,7 @@ UsbBootReadBlocks ( > // on the device. We must split the total block because the READ10 > // command only has 16 bit transfer length (in the unit of block). > // > - Count =3D (UINT16)((TotalBlock < USB_BOOT_IO_BLOCKS) ? TotalBloc= k : > USB_BOOT_IO_BLOCKS); > + Count =3D (UINT16)((TotalBlock < CountMax) ? TotalBlock : CountM= ax); > ByteSize =3D (UINT32)Count * BlockSize; >=20 > // > @@ -890,11 +892,13 @@ UsbBootWriteBlocks ( > USB_BOOT_WRITE10_CMD WriteCmd; > EFI_STATUS Status; > UINT16 Count; > + UINT16 CountMax; > UINT32 BlockSize; > UINT32 ByteSize; > UINT32 Timeout; >=20 > BlockSize =3D UsbMass->BlockIoMedia.BlockSize; > + CountMax =3D (UINT16)(USB_BOOT_MAX_CARRY_SIZE / BlockSize); > Status =3D EFI_SUCCESS; >=20 > while (TotalBlock > 0) { > @@ -903,7 +907,7 @@ UsbBootWriteBlocks ( > // on the device. We must split the total block because the WRITE10 > // command only has 16 bit transfer length (in the unit of block). > // > - Count =3D (UINT16)((TotalBlock < USB_BOOT_IO_BLOCKS) ? TotalBloc= k : > USB_BOOT_IO_BLOCKS); > + Count =3D (UINT16)((TotalBlock < CountMax) ? TotalBlock : CountM= ax); > ByteSize =3D (UINT32)Count * BlockSize; >=20 > // > @@ -966,18 +970,20 @@ UsbBootReadBlocks16 ( > UINT8 ReadCmd[16]; > EFI_STATUS Status; > UINT16 Count; > + UINT16 CountMax; > UINT32 BlockSize; > UINT32 ByteSize; > UINT32 Timeout; >=20 > BlockSize =3D UsbMass->BlockIoMedia.BlockSize; > + CountMax =3D (UINT16)(USB_BOOT_MAX_CARRY_SIZE / BlockSize); > Status =3D EFI_SUCCESS; >=20 > while (TotalBlock > 0) { > // > // Split the total blocks into smaller pieces. > // > - Count =3D (UINT16)((TotalBlock < USB_BOOT_IO_BLOCKS) ? TotalBloc= k : > USB_BOOT_IO_BLOCKS); > + Count =3D (UINT16)((TotalBlock < CountMax) ? TotalBlock : CountM= ax); > ByteSize =3D (UINT32)Count * BlockSize; >=20 > // > @@ -1040,18 +1046,20 @@ UsbBootWriteBlocks16 ( > UINT8 WriteCmd[16]; > EFI_STATUS Status; > UINT16 Count; > + UINT16 CountMax; > UINT32 BlockSize; > UINT32 ByteSize; > UINT32 Timeout; >=20 > BlockSize =3D UsbMass->BlockIoMedia.BlockSize; > + CountMax =3D (UINT16)(USB_BOOT_MAX_CARRY_SIZE / BlockSize); > Status =3D EFI_SUCCESS; >=20 > while (TotalBlock > 0) { > // > // Split the total blocks into smaller pieces. > // > - Count =3D (UINT16)((TotalBlock < USB_BOOT_IO_BLOCKS) ? TotalBloc= k : > USB_BOOT_IO_BLOCKS); > + Count =3D (UINT16)((TotalBlock < CountMax) ? TotalBlock : CountM= ax); > ByteSize =3D (UINT32)Count * BlockSize; >=20 > // > diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h > b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h > index 13a926035ceb..f8a0708350c7 100644 > --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h > +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h > @@ -65,9 +65,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,=20 > EITHER EXPRESS OR IMPLIED. > #define USB_PDT_SIMPLE_DIRECT 0x0E ///< Simplified direc= t access > device >=20 > // > -// Other parameters, Max carried size is 512B * 128 =3D 64KB > +// Other parameters, Max carried size is 64KB. > // > -#define USB_BOOT_IO_BLOCKS 128 > +#define USB_BOOT_MAX_CARRY_SIZE SIZE_64KB >=20 > // > // Retry mass command times, set by experience > -- > 1.9.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel