From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AJdET5ffZnwwpPDKK0inMmy5YwWg0wLmgD/9XqPNIIM2St/bPu3aekLtxttA+Evc+FwqglQZOiA3BA== 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 Cc: leif.lindholm@linaro.org, lersek@redhat.com, philmd@redhat.com, hongbo.zhang@linaro.org, nariman.poushin@linaro.org, thomas.abraham@arm.com, Ard Biesheuvel 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: [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: , X-List-Received-Date: Wed, 21 Nov 2018 11:58:40 -0000 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(-) 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; -- 2.17.1