From nobody Thu May 2 18:07:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+60933+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60933+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1591690624; cv=none; d=zohomail.com; s=zohoarc; b=d5MUgDHX/AZwgDXEa5PYIASvomHUM9FGMWZkQlJmhNp+kRGFy2rdn8r61uQtI3YJQ+Ju4FHBqE4hZzsWlcSGwWxh8fCTsyM/W5pS8a0rXb1ynYzvm0jQyxl/lwln6gpuJtBF1guhmtRY8VUrQMbzMpXJPI5z+bQsKOllZDPxhdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591690624; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=I7i1eMXm+6g3fFbKQMZWmtVzs95YhG85clLdhjwV0h8=; b=i8UQYUlTolpUkfrCsExf6oLrqUi3Ji2pegZmiy7fNqzHXotkcPexhxifR5TViurQTxJU/KTqIXYt8SruBaTKW1F2tuflpo1pvMasM0Hgc03jjEMFfuo6YGLKFIlOkWGZApR9RssyG9nxCg9SAHqpCXoaMLTxz4lAnWw6g0LYgkM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+60933+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1591690624618324.5212059034551; Tue, 9 Jun 2020 01:17:04 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id SxSOYY1788612xI6KGcwpud9; Tue, 09 Jun 2020 01:17:04 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.2635.1591690623019810754 for ; Tue, 09 Jun 2020 01:17:03 -0700 IronPort-SDR: DuRZKMuo4XDujIj1ZhS8LI4Ty3ddipurjpYpDWQNK+omtU1S1CTvMYtKMCrrAJKhxKtPsIhC+V eVzrIDh1TUQQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2020 01:17:01 -0700 IronPort-SDR: c6k0ykk3qLMjd0rqniXk8rxNrHoBgZm6hjaMSgKsTum+jH71IpyHV5yVuKgG9dix0BCzI+UoPN iI3d46YNYvsA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,491,1583222400"; d="scan'208";a="472994382" X-Received: from shwde7172.ccr.corp.intel.com ([10.239.158.67]) by fmsmga005.fm.intel.com with ESMTP; 09 Jun 2020 01:17:01 -0700 From: "Liming Gao" To: devel@edk2.groups.io Cc: Bob Feng Subject: [edk2-devel] [Patch] BaseTools GenFv: Report the correct spare FV image size Date: Tue, 9 Jun 2020 16:16:48 +0800 Message-Id: <20200609081648.1527-1-liming.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,liming.gao@intel.com X-Gm-Message-State: krTimBgp5nxXtxxfUtLfHFNNx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1591690624; bh=aweDWpLzdrAhlQaYAuKf4NjrAjCPW1WrdBUaEwT0v7w=; h=Cc:Date:From:Reply-To:Subject:To; b=Dqqp8ES0yit9m869joZQlXqb496fHbPjxKpYeS+SXkEzsC4JbMRX9hyzdVGMXDEKMIV mundAZyIetuLXYt+qkIsCRPoIIuS9OG83MU40/o6MQETTfnOpNqoKvbYF+oeaZSgZbXmo HDBC2HbR2/OVrpATxb1CoR/JuJP3DFiFSZA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2790 If the top FFS is placed in FV image, current FV will show there is no spac= e. In fact, the pad ffs in FV image can be regarded as the spare space. This change reports the max pad ffs size as the spare space for use. Signed-off-by: Liming Gao Cc: Bob Feng Reviewed-by: Bob Feng --- BaseTools/Source/C/GenFv/GenFvInternalLib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source= /C/GenFv/GenFvInternalLib.c index d29a891c9c..b5ffed93a9 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -3140,6 +3140,7 @@ Returns: --*/ { UINTN CurrentOffset; + UINTN OrigOffset; UINTN Index; FILE *fpin; UINTN FfsFileSize; @@ -3148,8 +3149,10 @@ Returns: UINT32 FfsHeaderSize; EFI_FFS_FILE_HEADER FfsHeader; UINTN VtfFileSize; + UINTN MaxPadFileSize; =20 FvExtendHeaderSize =3D 0; + MaxPadFileSize =3D 0; VtfFileSize =3D 0; fpin =3D NULL; Index =3D 0; @@ -3258,8 +3261,12 @@ Returns: // // Only EFI_FFS_FILE_HEADER is needed for a pad section. // + OrigOffset =3D CurrentOffset; CurrentOffset =3D (CurrentOffset + FfsHeaderSize + sizeof(EFI_FFS_= FILE_HEADER) + FfsAlignment - 1) & ~(FfsAlignment - 1); CurrentOffset -=3D FfsHeaderSize; + if ((CurrentOffset - OrigOffset) > MaxPadFileSize) { + MaxPadFileSize =3D CurrentOffset - OrigOffset; + } } } =20 @@ -3303,6 +3310,12 @@ Returns: // mFvTotalSize =3D FvInfoPtr->Size; mFvTakenSize =3D CurrentOffset; + if ((mFvTakenSize =3D=3D mFvTotalSize) && (MaxPadFileSize > 0)) { + // + // This FV means TOP FFS has been taken. Then, check whether there is = padding data for use. + // + mFvTakenSize =3D mFvTakenSize - MaxPadFileSize; + } =20 return EFI_SUCCESS; } --=20 2.13.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#60933): https://edk2.groups.io/g/devel/message/60933 Mute This Topic: https://groups.io/mt/74770051/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-