From patchwork Sat Jul 19 01:28:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 33924 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 35C2721309 for ; Sat, 19 Jul 2014 01:28:48 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id m1sf20244630oag.11 for ; Fri, 18 Jul 2014 18:28:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=z+7RKxeJ8s3sCMY716fVAG10sl6YFQgWXO1Xp6x1X5w=; b=PAYdE0CEcZTwljO7wkPLVKoWtup+yVMV8jhCw0yyE2VeGhc9Ob9pIrNK0MMvKCWx0Z 8d/s6fv25hRljCnlsFJZHhSV0qDesCqpFKhjrbDX2rfFzcEr+svWbXc7MQprD6tt2L/Y 0RiglDDzIOEtwt2jr+hcMcP5TEuBxn4rvsPQ2LtF3ha5mehlhgrQUbHx10n8R20aJ9cW d48Tr6e7wbk7/3e8vBK1CoZw65cDnEwku454uvzsFDigMQV6UohG9rg1WnlFurtjX1We uXwYuqn/O4LSb9rsi8YhqEzm0N0b+Z+j7zFnBfIqT3B6U/wlKhCXyHpoMOyYBlVlUn14 jVMA== X-Gm-Message-State: ALoCoQnZVVuxpGtEMAyx9acK+Rdxa2yrlNhzXphNnp9JzgTDynNESd3E5fTWvgT/fDX/181BqPLU X-Received: by 10.50.98.69 with SMTP id eg5mr4852657igb.7.1405733327823; Fri, 18 Jul 2014 18:28:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.40 with SMTP id m37ls1266978qgd.18.gmail; Fri, 18 Jul 2014 18:28:47 -0700 (PDT) X-Received: by 10.52.117.209 with SMTP id kg17mr8967188vdb.28.1405733327674; Fri, 18 Jul 2014 18:28:47 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ft1si7263654vec.94.2014.07.18.18.28.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 18:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so8812380vcb.39 for ; Fri, 18 Jul 2014 18:28:47 -0700 (PDT) X-Received: by 10.221.26.71 with SMTP id rl7mr8400366vcb.69.1405733327581; Fri, 18 Jul 2014 18:28:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp52880vcb; Fri, 18 Jul 2014 18:28:47 -0700 (PDT) X-Received: by 10.50.25.196 with SMTP id e4mr14655293igg.28.1405733326416; Fri, 18 Jul 2014 18:28:46 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id ci1si9149926igc.30.2014.07.18.18.28.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 18 Jul 2014 18:28:46 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1X8JS1-0004zn-8q; Sat, 19 Jul 2014 01:28:37 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1X8JRz-0004zh-LK for edk2-devel@lists.sourceforge.net; Sat, 19 Jul 2014 01:28:35 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=lersek@redhat.com; helo=mx1.redhat.com; Received: from mx1.redhat.com ([209.132.183.28]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1X8JRy-00086e-67 for edk2-devel@lists.sourceforge.net; Sat, 19 Jul 2014 01:28:35 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6J1SRRk012050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 18 Jul 2014 21:28:27 -0400 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6J1SOMW016646 for ; Fri, 18 Jul 2014 21:28:26 -0400 From: Laszlo Ersek To: edk2-devel@lists.sourceforge.net Date: Sat, 19 Jul 2014 03:28:22 +0200 Message-Id: <1405733302-11454-3-git-send-email-lersek@redhat.com> In-Reply-To: <1405733302-11454-1-git-send-email-lersek@redhat.com> References: <1405733302-11454-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1X8JRy-00086e-67 Subject: [edk2] [PATCH v2 2/2] OvmfPkg: build OVMF_VARS.fd, OVMF_CODE.fd, OVMF.fd X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lersek@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 OVMF_VARS.fd and OVMF_CODE.fd split the variable store and the firmware code in separate files. The PCDs' values continue to depend only on FD_SIZE_1MB vs. FD_SIZE_2MB. With the split files, it must be ensured on the QEMU command line that OVMF_VARS.fd and OVMF_CODE.fd be contiguously mapped so that they end exactly at 4GB. See QEMU commit 637a5acb (first released in v2.0.0). In this patch we must take care to assign each PCD only once. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen --- OvmfPkg/OvmfPkg.fdf.inc | 57 ++++++++++++++++++++++++++++++++++++++++++++ OvmfPkg/OvmfPkgIa32.fdf | 59 ++++++++++++++++++++++++++++++++++++---------- OvmfPkg/OvmfPkgIa32X64.fdf | 59 ++++++++++++++++++++++++++++++++++++---------- OvmfPkg/OvmfPkgX64.fdf | 59 ++++++++++++++++++++++++++++++++++++---------- OvmfPkg/VarStore.fdf.inc | 5 ---- 5 files changed, 195 insertions(+), 44 deletions(-) create mode 100644 OvmfPkg/OvmfPkg.fdf.inc diff --git a/OvmfPkg/OvmfPkg.fdf.inc b/OvmfPkg/OvmfPkg.fdf.inc new file mode 100644 index 0000000..6cc810e --- /dev/null +++ b/OvmfPkg/OvmfPkg.fdf.inc @@ -0,0 +1,57 @@ +## @file +# FDF include file that defines the main macros and sets the dependent PCDs. +# +# Copyright (C) 2014, Red Hat, Inc. +# +# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR +# IMPLIED. +# +## + +DEFINE BLOCK_SIZE = 0x1000 +DEFINE VARS_SIZE = 0x20000 +DEFINE VARS_BLOCKS = 0x20 + +!ifdef $(FD_SIZE_1MB) + +DEFINE FW_BASE_ADDRESS = 0xFFF00000 +DEFINE FW_SIZE = 0x00100000 +DEFINE FW_BLOCKS = 0x100 +DEFINE CODE_BASE_ADDRESS = 0xFFF20000 +DEFINE CODE_SIZE = 0x000E0000 +DEFINE CODE_BLOCKS = 0xE0 + +!else + +DEFINE FW_BASE_ADDRESS = 0xFFE00000 +DEFINE FW_SIZE = 0x00200000 +DEFINE FW_BLOCKS = 0x200 +DEFINE CODE_BASE_ADDRESS = 0xFFE20000 +DEFINE CODE_SIZE = 0x001E0000 +DEFINE CODE_BLOCKS = 0x1E0 + +!endif + +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress = $(FW_BASE_ADDRESS) +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize = $(FW_SIZE) +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize = $(BLOCK_SIZE) + +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase = $(FW_BASE_ADDRESS) +SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize = 0xE000 + +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize = $(BLOCK_SIZE) + +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize +SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize = $(BLOCK_SIZE) + +SET gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase = gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize +SET gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize = 0x10000 diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf index f47655c..cd0e9cc 100644 --- a/OvmfPkg/OvmfPkgIa32.fdf +++ b/OvmfPkg/OvmfPkgIa32.fdf @@ -28,21 +28,18 @@ DEFINE FD_SIZE_1MB= !endif !endif -!ifdef $(FD_SIZE_1MB) +!include OvmfPkg.fdf.inc + +# +# Build the variable store and the firmware code as one unified flash device +# image. +# [FD.OVMF] -BaseAddress = 0xFFF00000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress -Size = 0x00100000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize +BaseAddress = $(FW_BASE_ADDRESS) +Size = $(FW_SIZE) ErasePolarity = 1 -BlockSize = 0x1000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize -NumBlocks = 0x100 -!else -[FD.OVMF] -BaseAddress = 0xFFE00000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress -Size = 0x00200000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize -ErasePolarity = 1 -BlockSize = 0x1000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize -NumBlocks = 0x200 -!endif +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(FW_BLOCKS) !include VarStore.fdf.inc @@ -61,6 +58,42 @@ FV = FVMAIN_COMPACT FV = SECFV !endif +# +# Build the variable store and the firmware code as separate flash device +# images. +# +[FD.OVMF_VARS] +BaseAddress = $(FW_BASE_ADDRESS) +Size = $(VARS_SIZE) +ErasePolarity = 1 +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(VARS_BLOCKS) + +!include VarStore.fdf.inc + +[FD.OVMF_CODE] +BaseAddress = $(CODE_BASE_ADDRESS) +Size = $(CODE_SIZE) +ErasePolarity = 1 +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(CODE_BLOCKS) + +!ifdef $(FD_SIZE_1MB) + +0x00000000|0x000CC000 +FV = FVMAIN_COMPACT +0x000CC000|0x14000 +FV = SECFV + +!else + +0x00000000|0x001AC000 +FV = FVMAIN_COMPACT +0x001AC000|0x34000 +FV = SECFV + +!endif + ################################################################################ [FD.MEMFD] diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf index dd705a8..769c857 100644 --- a/OvmfPkg/OvmfPkgIa32X64.fdf +++ b/OvmfPkg/OvmfPkgIa32X64.fdf @@ -28,21 +28,18 @@ DEFINE FD_SIZE_1MB= !endif !endif -!ifdef $(FD_SIZE_1MB) +!include OvmfPkg.fdf.inc + +# +# Build the variable store and the firmware code as one unified flash device +# image. +# [FD.OVMF] -BaseAddress = 0xFFF00000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress -Size = 0x00100000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize +BaseAddress = $(FW_BASE_ADDRESS) +Size = $(FW_SIZE) ErasePolarity = 1 -BlockSize = 0x1000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize -NumBlocks = 0x100 -!else -[FD.OVMF] -BaseAddress = 0xFFE00000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress -Size = 0x00200000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize -ErasePolarity = 1 -BlockSize = 0x1000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize -NumBlocks = 0x200 -!endif +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(FW_BLOCKS) !include VarStore.fdf.inc @@ -61,6 +58,42 @@ FV = FVMAIN_COMPACT FV = SECFV !endif +# +# Build the variable store and the firmware code as separate flash device +# images. +# +[FD.OVMF_VARS] +BaseAddress = $(FW_BASE_ADDRESS) +Size = $(VARS_SIZE) +ErasePolarity = 1 +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(VARS_BLOCKS) + +!include VarStore.fdf.inc + +[FD.OVMF_CODE] +BaseAddress = $(CODE_BASE_ADDRESS) +Size = $(CODE_SIZE) +ErasePolarity = 1 +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(CODE_BLOCKS) + +!ifdef $(FD_SIZE_1MB) + +0x00000000|0x000CC000 +FV = FVMAIN_COMPACT +0x000CC000|0x14000 +FV = SECFV + +!else + +0x00000000|0x001AC000 +FV = FVMAIN_COMPACT +0x001AC000|0x34000 +FV = SECFV + +!endif + ################################################################################ [FD.MEMFD] diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index 6ec8e88..9b4b03b 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -28,21 +28,18 @@ DEFINE FD_SIZE_1MB= !endif !endif -!ifdef $(FD_SIZE_1MB) +!include OvmfPkg.fdf.inc + +# +# Build the variable store and the firmware code as one unified flash device +# image. +# [FD.OVMF] -BaseAddress = 0xFFF00000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress -Size = 0x00100000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize +BaseAddress = $(FW_BASE_ADDRESS) +Size = $(FW_SIZE) ErasePolarity = 1 -BlockSize = 0x1000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize -NumBlocks = 0x100 -!else -[FD.OVMF] -BaseAddress = 0xFFE00000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress -Size = 0x00200000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize -ErasePolarity = 1 -BlockSize = 0x1000|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareBlockSize -NumBlocks = 0x200 -!endif +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(FW_BLOCKS) !include VarStore.fdf.inc @@ -61,6 +58,42 @@ FV = FVMAIN_COMPACT FV = SECFV !endif +# +# Build the variable store and the firmware code as separate flash device +# images. +# +[FD.OVMF_VARS] +BaseAddress = $(FW_BASE_ADDRESS) +Size = $(VARS_SIZE) +ErasePolarity = 1 +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(VARS_BLOCKS) + +!include VarStore.fdf.inc + +[FD.OVMF_CODE] +BaseAddress = $(CODE_BASE_ADDRESS) +Size = $(CODE_SIZE) +ErasePolarity = 1 +BlockSize = $(BLOCK_SIZE) +NumBlocks = $(CODE_BLOCKS) + +!ifdef $(FD_SIZE_1MB) + +0x00000000|0x000CC000 +FV = FVMAIN_COMPACT +0x000CC000|0x14000 +FV = SECFV + +!else + +0x00000000|0x001AC000 +FV = FVMAIN_COMPACT +0x001AC000|0x34000 +FV = SECFV + +!endif + ################################################################################ [FD.MEMFD] diff --git a/OvmfPkg/VarStore.fdf.inc b/OvmfPkg/VarStore.fdf.inc index 10a9258..2ea64c6 100644 --- a/OvmfPkg/VarStore.fdf.inc +++ b/OvmfPkg/VarStore.fdf.inc @@ -17,7 +17,6 @@ ## 0x00000000|0x0000e000 -gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize #NV_VARIABLE_STORE DATA = { ## This is the EFI_FIRMWARE_VOLUME_HEADER @@ -63,10 +62,8 @@ DATA = { 0x0000e000|0x00001000 #NV_EVENT_LOG -gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogBase|gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageEventLogSize 0x0000f000|0x00001000 -gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize #NV_FTW_WORKING DATA = { # EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEdkiiWorkingBlockSignatureGuid = @@ -81,5 +78,3 @@ DATA = { 0x00010000|0x00010000 #NV_FTW_SPARE -gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize -