From patchwork Sat Feb 24 09:29:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 129507 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1524742lja; Sat, 24 Feb 2018 01:30:11 -0800 (PST) X-Google-Smtp-Source: AH8x227eNsg5phxP8twkNNCBgYd4q/yd6iloOqe9aqAtL8vsGFiye+DQm4IEJIko0dcvJTXSH98Z X-Received: by 2002:a17:902:5982:: with SMTP id p2-v6mr4228817pli.289.1519464610894; Sat, 24 Feb 2018 01:30:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519464610; cv=none; d=google.com; s=arc-20160816; b=d15DxKr4GcPOjF/3Ej0pqrUO/4gvx2N+6Rf4NoJoelYtPo+nNRT7eccAeq6rT7yoXd EQVG/nh77uJqgXmMigAWN673wfEPVte6tT6iF4K0Ux4RoY7l6ssRSzWTiDPG6f8VhCXV Dqd3Mi9CWTvOo4xQpALYkAgXfeE+2kOXZQY9hcQIT49S3dAL41s6ZBBuwJyEsqqPwGY8 vG1cBTYTsh+21lw+Rnx2jHW5p1Od+ra4Ys5mxI6M52g8TumUud3qVX7BpodN5qtzJw3T cH+iBMphNLtvH/fP2Bdz4CDrgJyIDDa44EbsffFlUebmR1u2FAnLi+Mn1fWPhG7ya0y5 1RZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=eDinMoHX9d7EJIk58PkEmPs5fLexAylqMXS7AZS/enc=; b=vDzVel1wVWDi0IEtd2WTwqLP6mldUC504UJMIqHguZSfHgN05o5We3Z8SeQr2wrz3u vpdYRVlK6SbwYtzOcKMTrJFb3CMe0btjom9aINjcPLI/+0Rm7H2MRFi83SZRDu9QEExz +1v6bwgtdIQYalOrIpxZZFc7yJ98KdmCj0W6iM65sew0mDCSf+BrQ/cyHUnd+dTMf0RD /3+EC6uWxjEqaDQTa/eaDQN0qYCeoVkm/rlsrZSRehJSa8MjhPKfsqmoQCRfdvp4kXcW ceT90Qv63F4W9eJrUkKGlh/75z0WzjJcFwMid4lfdDn7NjQU/JAQlRXigBREBZdMp8pB rBOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Rd29Iuv+; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id w3-v6si3312975pll.663.2018.02.24.01.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2018 01:30:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Rd29Iuv+; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A2B1E22436935; Sat, 24 Feb 2018 01:24:07 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::244; helo=mail-pf0-x244.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3478420954CAB for ; Sat, 24 Feb 2018 01:24:06 -0800 (PST) Received: by mail-pf0-x244.google.com with SMTP id d26so4531779pfn.5 for ; Sat, 24 Feb 2018 01:30:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=awm1weUg3eM5WgqiWYZB12p0zvBpWtf4hTyWrHI12j0=; b=Rd29Iuv+JlSqPtO767QNZzp+s9paRbSa3Bu4i/9Khyg1u379WZ+rponXC3iu330KOG M28CdlRTOHOYf4NnZvlYtmN+HxRPSvrsj8iCSXg9NEA9KWj3KszBVAGRIv9u8afpVL6G yTZyEMHbgwxpFG8BaSdNjvq77B4JcDhjnYRCc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=awm1weUg3eM5WgqiWYZB12p0zvBpWtf4hTyWrHI12j0=; b=IqY0wtwBPENbNPC7cN10atgC7TAEOYxJA0qLdHnUj+6rEED/+5ItgXaRyXdkAEiciW otDxnCiiYasoYK1aQ5vHnA1SmYXueTyvQ/2Mdwvkh2yUzJs5Rb3xV6+J1X1QdmX7hVw7 ShQQ1HRnNJ1aHupMTtJImYFdQmlJDE83ihJXsY0ClfoNPZkTrOCtVGGMKiWI2Fd9SKCa 6WGs6ewOxk7APPYb+IjGdjAsogQMdQngIDMsrDwpIS4d2p13NRKO1cGILbLjHg2i5itQ kVbWgRhSfAyXvXd5yzpAOBTykBEX+bdaMaTf4TmlgT00feZEZ4uerlwRokmL2lEv9Sz1 K23w== X-Gm-Message-State: APf1xPDsf/5Z1u4LIV2d2R1m1IgyjnknUV8q57muFd5qN/JzFAyJL9aw zuJ+tYMmo5xqA13XXvAKbdFLmQ== X-Received: by 10.99.52.203 with SMTP id b194mr3675917pga.349.1519464608522; Sat, 24 Feb 2018 01:30:08 -0800 (PST) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id p9sm7230169pff.173.2018.02.24.01.30.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Feb 2018 01:30:08 -0800 (PST) From: Ming Huang 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 Date: Sat, 24 Feb 2018 17:29:35 +0800 Message-Id: <1519464575-38109-2-git-send-email-ming.huang@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519464575-38109-1-git-send-email-ming.huang@linaro.org> References: <1519464575-38109-1-git-send-email-ming.huang@linaro.org> Subject: [edk2] [RFC v1 1/1] MdeModulePkg/Usb: Use Pcd for UsbBootIoBlocks 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: , Cc: huangming23@huawei.com, ard.biesheuvel@linaro.org, Ming Huang , liming.gao@intel.com, mengfanrong@huawei.com, guoheyi@huawei.com, zhangjinsong2@huawei.com, michael.d.kinney@intel.com, waip23@126.com, wanghuiqiang@huawei.com, huangdaode@hisilicon.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- 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(-) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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 + // // 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."