From patchwork Tue Jun 21 10:30:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 70543 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1941704qgy; Tue, 21 Jun 2016 03:30:48 -0700 (PDT) X-Received: by 10.98.28.143 with SMTP id c137mr27716047pfc.131.1466505048676; Tue, 21 Jun 2016 03:30:48 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id h63si2807231pfe.82.2016.06.21.03.30.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jun 2016 03:30:48 -0700 (PDT) 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; 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 dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 788E81A1E43; Tue, 21 Jun 2016 03:31:15 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (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 040261A1E27 for ; Tue, 21 Jun 2016 03:31:13 -0700 (PDT) Received: by mail-lf0-x232.google.com with SMTP id l188so16585930lfe.2 for ; Tue, 21 Jun 2016 03:30:44 -0700 (PDT) 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=D+HI4CfGqKjY3e44gmLCM04Cyd3s9ZHyLHj24vO2Pw0=; b=RRr/7/sdIVlLfizb0j3ubjsH8QajDD6qcUTXMiJ92TM/ZfK/RtfdhJzwbzIZEJ/2Nj wRMZT84JhKO2zRDGcr/Ur4DqDLZH8NAI/2VnsL/IwZ8R5eyLDbGNMNfBmBwnej3YPMsT I1iV2jiMOyI3T0ILEEBF7hx3svJCSWkDEpdjA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=D+HI4CfGqKjY3e44gmLCM04Cyd3s9ZHyLHj24vO2Pw0=; b=FMTGBHl0CzKCu22hSQuGRRhkERubcWdLRetOIUBmzLzrP2QF/tjiIBMoJEh/gVCAkc HvN+I2o1XbW8b8Uer7Vq7zeRZxeW4pkAYu3kOwoaNVLuU1gI7skPWnjgmhjwSF6rAIE9 FXOXGLUhOCrC4fAWIM+lTBcK/WPAgWxRFy9ZFhJhImo+BTsoEtwQdYnmH0OEhIbZpAMt P741QxfOn3hx+gzn+twACLO9GXrTQl2pWsNOdaei+7dVOyMiLxSmMNjPG4r+KymutRHF qjnorQiny+F7mZ1qWJ4qRvdw2YttGAQAHezhBuey+Y+3+92Zj6R+oyXYhRvCpK+zSmgo cl1Q== X-Gm-Message-State: ALyK8tLe9mrwrrNFEPG3d6Zl/wrH9Kzxaq1N2vw1medI9+Yp8vq4i2UcyzmzVWvRJdmfIfcc X-Received: by 10.28.29.211 with SMTP id d202mr2563552wmd.22.1466505040683; Tue, 21 Jun 2016 03:30:40 -0700 (PDT) Received: from localhost.localdomain ([188.203.148.129]) by smtp.gmail.com with ESMTPSA id d137sm2314154wmd.12.2016.06.21.03.30.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Jun 2016 03:30:39 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, lersek@redhat.com Date: Tue, 21 Jun 2016 12:30:31 +0200 Message-Id: <1466505034-10267-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466505034-10267-1-git-send-email-ard.biesheuvel@linaro.org> References: <1466505034-10267-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 1/4] ArmPlatformPkg/NorFlashDxe: accept both non-secure and secure varstore GUIDs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Now that the generic Variable Runtime DXE code no longer distinguishes between gEfiVariableGuid and gEfiAuthenticatedVariableGuid in the varstore FV header, we can relax the check in the NOR flash driver to accept either GUID regardless of whether we are running a secure boot capable build or not. This also means we can always use gEfiAuthenticatedVariableGuid when we encounter an empty NOR flash that needs to be initialized before use. So remove the mNorFlashVariableGuid global from the shared code and from both versions of NorFlashDxe.inf. This essentially collapses the two drivers into a single one, which means we can remove NorFlashAuthenticatedDxe entirely in a subsequent patch. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf | 2 +- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c | 19 ------------------- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h | 2 -- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf | 2 +- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c | 5 +++-- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c | 19 ------------------- 6 files changed, 5 insertions(+), 44 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf index 6c5e6aef0ddf..0e25b8f6ed6d 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf @@ -28,7 +28,6 @@ [Sources.common] NorFlashDxe.c NorFlashFvbDxe.c NorFlashBlockIoDxe.c - NorFlashAuthenticatedVariableDep.c [Packages] MdePkg/MdePkg.dec @@ -50,6 +49,7 @@ [LibraryClasses] [Guids] gEfiSystemNvDataFvGuid + gEfiVariableGuid gEfiAuthenticatedVariableGuid gEfiEventVirtualAddressChangeGuid diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c deleted file mode 100644 index 2ea8ead85d9b..000000000000 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c +++ /dev/null @@ -1,19 +0,0 @@ -/** @file NorFlashAuthenticatedVariableDep.c - - Copyright (c) 2015, Linaro Ltd. 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. - -**/ - -#include - -#include - -CONST EFI_GUID* CONST mNorFlashVariableGuid = &gEfiAuthenticatedVariableGuid; diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h index d0b5c5b12f9e..c24680098f62 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h @@ -152,8 +152,6 @@ struct _NOR_FLASH_INSTANCE { NOR_FLASH_DEVICE_PATH DevicePath; }; -extern CONST EFI_GUID* CONST mNorFlashVariableGuid; - EFI_STATUS NorFlashReadCfiData ( IN UINTN DeviceBaseAddress, diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf index 563d7573e7a2..812dafd065b2 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf @@ -26,7 +26,6 @@ [Sources.common] NorFlashDxe.c NorFlashFvbDxe.c NorFlashBlockIoDxe.c - NorFlashVariableDep.c [Packages] MdePkg/MdePkg.dec @@ -48,6 +47,7 @@ [LibraryClasses] [Guids] gEfiSystemNvDataFvGuid gEfiVariableGuid + gEfiAuthenticatedVariableGuid gEfiEventVirtualAddressChangeGuid [Protocols] diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c index e0edc62c95eb..42be5c2a2dad 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c @@ -111,7 +111,7 @@ InitializeFvAndVariableStoreHeaders ( // VARIABLE_STORE_HEADER // VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)Headers + FirmwareVolumeHeader->HeaderLength); - CopyGuid (&VariableStoreHeader->Signature, mNorFlashVariableGuid); + CopyGuid (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid); VariableStoreHeader->Size = PcdGet32(PcdFlashNvStorageVariableSize) - FirmwareVolumeHeader->HeaderLength; VariableStoreHeader->Format = VARIABLE_STORE_FORMATTED; VariableStoreHeader->State = VARIABLE_STORE_HEALTHY; @@ -181,7 +181,8 @@ ValidateFvHeader ( VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)FwVolHeader + FwVolHeader->HeaderLength); // Check the Variable Store Guid - if (!CompareGuid (&VariableStoreHeader->Signature, mNorFlashVariableGuid)) { + if (!CompareGuid (&VariableStoreHeader->Signature, &gEfiVariableGuid) && + !CompareGuid (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid)) { DEBUG ((EFI_D_INFO, "%a: Variable Store Guid non-compatible\n", __FUNCTION__)); return EFI_NOT_FOUND; diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c deleted file mode 100644 index 4d52296ce1a0..000000000000 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c +++ /dev/null @@ -1,19 +0,0 @@ -/** @file NorFlashVariableDep.c - - Copyright (c) 2015, Linaro Ltd. 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. - -**/ - -#include - -#include - -CONST EFI_GUID* CONST mNorFlashVariableGuid = &gEfiVariableGuid;