From patchwork Wed Nov 21 11:58:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151670 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1828916ljp; Wed, 21 Nov 2018 03:58:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/VeNmiGTQ9D8lt0kxK/wPuMT+tl1/dHsm+V/qSKa0ZSXuSDRR1hjMEiKZbgJkruY1iSOMa+ X-Received: by 2002:a24:b641:: with SMTP id d1-v6mr4874108itj.133.1542801523886; Wed, 21 Nov 2018 03:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542801523; cv=none; d=google.com; s=arc-20160816; b=vdoOLhHOjy+R4JpXNx5+Ix4gGU+uPjlSwcl2J/+NGCMrLWdE/abZvcEInaLtvPk6xj Pbd4+z0/IqTXf/sefgMejyyc3tWbNOAPhl1EGXbJR7dgeCSwhZuHad/nTZEaPznlitJ7 7Tm593Dt9wpU7KZ+oUuIgX8GbjapeGkS/lgS+/y/6TtbXDFx1Ff6pHeZEoQkDgxdAOYI FDhRbK5JYyRi2MmyqEb79Sqxecw/65IrBCA441bAlG3ycXaWRQq1QH4FoA4yPbfa9d6d 5AihH90/XV0CTczQeRr+4BzYZSWoRRBepr1ND7i8P3uZBynNWCFgzE+/VaITdfOlgmui oCHA== 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; bh=yCbcs1MZPlanZLU4a+Bjy4oXVRw5Kf0gbqVlLQzlrbw=; b=WJvkkzoFNf3mgWM9Z1maHA+ukL642HHMd2qb5hqyxEjZob94DTzNsv+oGAsWh4DEuP q7aO3FHlBG8TqMHrs6U7KcjPvG3+m/NqQUMfHHDQEf2hfSASYr4cb2baHBhPHVW2UhWs hnQno/2S191c2SNC6CtW3/vy3sy/9VCpwvxlOlQmVTSMpJzoyO8FhwK+tpL2mapPZ0Cf BTUI7U7EBssbfx5ucJve6fC+8vxffAqUGHXhOqAg9JSe6wKQnUtYiE3a2HkK1erWQ0G3 s79Ijtgx8BfcBGVd2qFXSNy35USdvE4EexuqtndqzIME1TonfrEMT2Z6n/xGs0pmrCpn g7NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ncr0cGgd; 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 u7si1242743iom.121.2018.11.21.03.58.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 03:58:43 -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=Ncr0cGgd; 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 C05142194D3AE; Wed, 21 Nov 2018 03:58:41 -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=2a00:1450:4864:20::541; helo=mail-ed1-x541.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) (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 2895C2119376C for ; Wed, 21 Nov 2018 03:58:40 -0800 (PST) Received: by mail-ed1-x541.google.com with SMTP id b14so4656921edt.6 for ; Wed, 21 Nov 2018 03:58:40 -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=W2WZ4XhSXcF0kAyNl4/Jdv466whNrXqAiZVg6B20t4U=; b=Ncr0cGgdzjcXnEbRv2wDfsTTCR4omBZnBHBuxDNSqwed13zYKlNjmTCPN8W8ltTWD7 nQUh69W+zoWm4QsrJAab0XpqDYv37n09P40cdRkluS28FO17l+cL/ii5c+1R9Mtldnm4 V0yHB6utFzDSdNa4rYnI5J+kjAf0mpgLuxIzw= 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=W2WZ4XhSXcF0kAyNl4/Jdv466whNrXqAiZVg6B20t4U=; b=fnKZ4T5/KGQsc0/t+uCNiGMocdkV3RiaAU6q32Kp5a/Gc+eEvefq4O0/covJOK1Mfb CZbXQ8KIrjH09oJ8Kos3Coq5fsrSfSZMu0/37eK6Ixorq1Pihp4tz2GnAtpRQKDWup/W JYQQ1UUJWGaMgLhDzNLKs0c4wE1sBaySYsiP7Se1S+cJbFoDs7lVLSs7UF0q3M+SWXbs Kt+ncFW+C8nf9zHZHE7Uy1oHHUkCcVUbPPCxpMoTfbANh2gGoxEQbzAaIJzbcRxuYy6n qP4PEd/BtuYiZhkQ45RTMHR21MHVY4cXjVdfTZCk2WCIsS9FORgikcGPGHWBK89OgVGO smUQ== X-Gm-Message-State: AGRZ1gISdMLoJKLm8jwwv72S7hEAv/2u/5iInTPsCWyCCr3EFW5nbAAE lLcshPgHFlploAkN3WAsoEsnctDlRW8/Pg== X-Received: by 2002:a17:906:359b:: with SMTP id o27-v6mr4908190ejb.14.1542801518252; Wed, 21 Nov 2018 03:58:38 -0800 (PST) Received: from mba13.wifi.ns.nl (dhcp-077-251-017-237.chello.nl. [77.251.17.237]) by smtp.gmail.com with ESMTPSA id x90sm4090716ede.35.2018.11.21.03.58.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Nov 2018 03:58:37 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 21 Nov 2018 12:58:24 +0100 Message-Id: <20181121115828.3026-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181121115828.3026-1-ard.biesheuvel@linaro.org> References: <20181121115828.3026-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 1/5] ArmPlatformPkg/NorFlashDxe: prepare for devicepath format change X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, nariman.poushin@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" A subsequent patch will change the layout of devicepath nodes produced by this driver. In preparation, make some tweaks to the code to use a packed struct for the devicepath and to pass the device index to NorFlashCreateInstance(). These are cosmetic changes only, the resulting binaries should be identical. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c | 9 ++++++--- ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Philippe Mathieu-Daudé diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c index 46e815beb343..53753a4721ac 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c @@ -82,7 +82,10 @@ NOR_FLASH_INSTANCE mNorFlashInstanceTemplate = { { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, - { (UINT8)sizeof(VENDOR_DEVICE_PATH), (UINT8)((sizeof(VENDOR_DEVICE_PATH)) >> 8) } + { + (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End)), + (UINT8)(OFFSET_OF (NOR_FLASH_DEVICE_PATH, End) >> 8) + } }, { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }, // GUID ... NEED TO BE FILLED }, @@ -99,7 +102,7 @@ NorFlashCreateInstance ( IN UINTN NorFlashDeviceBase, IN UINTN NorFlashRegionBase, IN UINTN NorFlashSize, - IN UINT32 MediaId, + IN UINT32 Index, IN UINT32 BlockSize, IN BOOLEAN SupportFvb, IN CONST GUID *NorFlashGuid, @@ -121,7 +124,7 @@ NorFlashCreateInstance ( Instance->Size = NorFlashSize; Instance->BlockIoProtocol.Media = &Instance->Media; - Instance->Media.MediaId = MediaId; + Instance->Media.MediaId = Index; Instance->Media.BlockSize = BlockSize; Instance->Media.LastBlock = (NorFlashSize / BlockSize)-1; diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h index 5c07694fbfaa..910681fd4412 100644 --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h @@ -122,10 +122,12 @@ typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE; +#pragma pack(1) typedef struct { VENDOR_DEVICE_PATH Vendor; EFI_DEVICE_PATH_PROTOCOL End; } NOR_FLASH_DEVICE_PATH; +#pragma pack() struct _NOR_FLASH_INSTANCE { UINT32 Signature;