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.151; helo=mga17.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (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 6F9622214672B for ; Wed, 21 Mar 2018 07:15:37 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2018 07:22:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,340,1517904000"; d="scan'208";a="35649694" Received: from orsmsx107.amr.corp.intel.com ([10.22.240.5]) by FMSMGA003.fm.intel.com with ESMTP; 21 Mar 2018 07:22:07 -0700 Received: from orsmsx160.amr.corp.intel.com (10.22.226.43) by ORSMSX107.amr.corp.intel.com (10.22.240.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 21 Mar 2018 07:22:06 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.121]) by ORSMSX160.amr.corp.intel.com ([169.254.13.99]) with mapi id 14.03.0319.002; Wed, 21 Mar 2018 07:22:06 -0700 From: "Kinney, Michael D" To: "Zeng, Star" , Ming Huang , "Ni, Ruiyu" , "leif.lindholm@linaro.org" , "linaro-uefi@lists.linaro.org" , "edk2-devel@lists.01.org" , "Dong, Eric" , "Kinney, Michael D" CC: "ard.biesheuvel@linaro.org" , "Gao, Liming" , "guoheyi@huawei.com" , "wanghuiqiang@huawei.com" , "huangming23@huawei.com" , "zhangjinsong2@huawei.com" , "mengfanrong@huawei.com" , "huangdaode@hisilicon.com" , "waip23@126.com" Thread-Topic: [edk2 UsbMassStorageDxe v1 1/1] MdeModulePkg/Usb: Replace macro USB_BOOT_IO_BLOCKS Thread-Index: AQHTvFlSLUiz/ymaYEGfTy/HV5BvjKPbIFUA//+motA= Date: Wed, 21 Mar 2018 14:22:06 +0000 Message-ID: References: <1521116980-120594-1-git-send-email-ming.huang@linaro.org> <1521116980-120594-2-git-send-email-ming.huang@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103BA71F3C@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BA71F3C@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.22.254.138] MIME-Version: 1.0 Subject: Re: [edk2 UsbMassStorageDxe v1 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: Wed, 21 Mar 2018 14:15:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable One minor comment. #define USB_BOOT_MAX_CARRY_SIZE 0x10000 Should be #define USB_BOOT_MAX_CARRY_SIZE SIZE_64KB Mike > -----Original Message----- > From: Zeng, Star > Sent: Wednesday, March 21, 2018 5:41 AM > To: Ming Huang ; Ni, Ruiyu > ; leif.lindholm@linaro.org; linaro- > uefi@lists.linaro.org; edk2-devel@lists.01.org; Dong, > Eric > Cc: ard.biesheuvel@linaro.org; Kinney, Michael D > ; Gao, Liming > ; guoheyi@huawei.com; > wanghuiqiang@huawei.com; huangming23@huawei.com; > zhangjinsong2@huawei.com; mengfanrong@huawei.com; > huangdaode@hisilicon.com; waip23@126.com > Subject: RE: [edk2 UsbMassStorageDxe v1 1/1] > MdeModulePkg/Usb: Replace macro USB_BOOT_IO_BLOCKS >=20 > Ming, >=20 > Basically, I am ok with the change in this patch. There > are two comments. >=20 > 1. Please add more background information about the > specific device in the commit log. For example, you > mentioned " like some virtual CD-ROM from BMC " in > previous patch. > 2. Please make sure building pass with the patch on > different tool chains. I tried to build with the patch > on VS2015, but met building failure like below. > warning C4244: '=3D': conversion from 'UINT32' to > 'UINT16', possible loss of data >=20 >=20 > Ray, >=20 > Do you have other concern? >=20 >=20 > Thanks, > Star > -----Original Message----- > From: Ming Huang [mailto:ming.huang@linaro.org] > Sent: Thursday, March 15, 2018 8:30 PM > To: leif.lindholm@linaro.org; linaro- > uefi@lists.linaro.org; edk2-devel@lists.01.org; Zeng, > Star ; Dong, Eric > > Cc: ard.biesheuvel@linaro.org; Kinney, Michael D > ; Gao, Liming > ; guoheyi@huawei.com; > wanghuiqiang@huawei.com; huangming23@huawei.com; > zhangjinsong2@huawei.com; mengfanrong@huawei.com; > huangdaode@hisilicon.com; waip23@126.com; Ming Huang > > Subject: [edk2 UsbMassStorageDxe v1 1/1] > MdeModulePkg/Usb: Replace macro USB_BOOT_IO_BLOCKS >=20 > Booting from USB may fail while the macro > USB_BOOT_IO_BLOCKS set to 128 because the block size of > some USB devices are exceeded 512. So,the count blocks > to transfer should be calculated by block size of 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..b38cb6116bf4 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 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) ? TotalBlock : USB_BOOT_IO_BLOCKS); > + Count =3D (UINT16)((TotalBlock < CountMax) ? > TotalBlock : CountMax); > 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 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) ? TotalBlock : USB_BOOT_IO_BLOCKS); > + Count =3D (UINT16)((TotalBlock < CountMax) ? > TotalBlock : CountMax); > 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 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) ? TotalBlock : USB_BOOT_IO_BLOCKS); > + Count =3D (UINT16)((TotalBlock < CountMax) ? > TotalBlock : CountMax); > 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 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) ? TotalBlock : USB_BOOT_IO_BLOCKS); > + Count =3D (UINT16)((TotalBlock < CountMax) ? > TotalBlock : CountMax); > ByteSize =3D (UINT32)Count * BlockSize; >=20 > // > diff --git > a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h > b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h > index 13a926035ceb..fc5449bde21e 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, EITHER EXPRESS OR IMPLIED. > #define USB_PDT_SIMPLE_DIRECT 0x0E > ///< Simplified direct 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 0x10000 >=20 > // > // Retry mass command times, set by experience > -- > 1.9.1