From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in25.apple.com (mail-out25.apple.com [17.171.2.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5C73820945559 for ; Thu, 8 Jun 2017 07:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1496933715; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jAO8Ib96Uf+bnwU3Bys6YXWBu5FnRILYZqw4gnHkCbg=; b=wT1JSwrPTwLWdOBo8CDpQE/ylYvjMzJkgzca3O7n+wNJ9shHsqETPn4EFdfb81HM tciSfgSmsGhk3XAor0yFbrSv9k9gAAhOmCSKCZesELo3aFA+J689e4s8em/8mDVz 9aiAifXPgQ2gPuPI20lUr3udtrN1T7m1zGPvhbqGY+KwRKIzPFAGZKIQ6ZaaqU1i jMKSXvUO1Y39Bla+S5UKI7X3tTTRSH6VN78RWpH2ISXAFox5dE2377+DWU2Y3Gyw MVtx+4Lfi/UD8cO/Npaglllz5D68v4LxJTuUmT6iv1+bOxmH5eEIve8VGSuvXxbZ FPU0tGmcOekHZHCHFk7oag==; Received: from relay5.apple.com (relay5.apple.com [17.128.113.88]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in25.apple.com (Apple Secure Mail Relay) with SMTP id 61.DB.02110.25569395; Thu, 8 Jun 2017 07:55:15 -0700 (PDT) X-AuditID: 11ab0219-f49ff7000000083e-14-593965526302 Received: from nwk-mmpp-sz10.apple.com (nwk-mmpp-sz10.apple.com [17.128.115.122]) by relay5.apple.com (Apple SCV relay) with SMTP id A8.9C.02326.15569395; Thu, 8 Jun 2017 07:55:14 -0700 (PDT) MIME-version: 1.0 Received: from [17.153.85.153] (unknown [17.153.85.153]) by nwk-mmpp-sz10.apple.com (Oracle Communications Messaging Server 8.0.1.2.20170210 64bit (built Feb 10 2017)) with ESMTPSA id <0OR80012OHFZ6530@nwk-mmpp-sz10.apple.com>; Thu, 08 Jun 2017 07:55:13 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish Message-id: <1235B084-B1C5-490B-89CC-BC88BF652FB5@apple.com> Date: Thu, 08 Jun 2017 07:55:11 -0700 In-reply-to: <1496909927-16812-1-git-send-email-jun.nie@linaro.org> Cc: olivier.martin@arm.com, haojian.zhuang@linaro.org, edk2-devel@lists.01.org, jason.liu@linaro.org, shawn.guo@linaro.org To: Jun Nie References: <1496909927-16812-1-git-send-email-jun.nie@linaro.org> X-Mailer: Apple Mail (2.3273) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrHLMWRmVeSWpSXmKPExsUi2FAYoRucahlpMOu4ocWeQ0eZLS6fO8xo 8f7oFUaLJU8eslscXfeF3eLpuiXMDmwea+atYfS4c20Pm0f37H8sAcxRXDYpqTmZZalF+nYJ XBmtJ2ezFdzZw1gxqfsOYwPjq6WMXYycHBICJhL3Ljxj6WLk4hASWMMkcbe3jxUmMavzDztE 4hCjxNmbz5hAErwCghI/Jt9jAbGZBcIkHh7bwwRRNJFJYv//92AJYQFxiXdnNjGD2GwCyhIr 5n9gh2i2kXj/dAU7RI23xNq3z8GGsgioStxd2MzWxcjBwSngLPGyXwRifo3Ep5bPYCUiAgoS Xe/awI4TEnCSaJnzlhniUFmJW7MvQdnv2SSuXymYwCg0C8mps5CcCmFrSXx/1AoU5wCy5SUO npeFCGtKPLv3iR3C1pZ48u4C6wJGtlWMwrmJmTm6mXlGpnqJBQU5qXrJ+bmbGEERtJpJcgfj 19eGhxgFOBiVeHgTIiwjhVgTy4or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4FncN6wIAAA== X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: Re: [PATCH] EmbeddedPkg/MmcDxe: Add alignment for ECSD data X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jun 2017 14:54:07 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT > On Jun 8, 2017, at 1:18 AM, Jun Nie wrote: > > Add alignment for ECSD data for DMA access. Otherwise > the data is corrupted on Sanechips platform. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Jun Nie > > --- > EmbeddedPkg/Universal/MmcDxe/Mmc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h b/EmbeddedPkg/Universal/MmcDxe/Mmc.h > index 8a7d5a3..ca1a9d5 100644 > --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h > +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h > @@ -319,7 +319,7 @@ typedef struct { > OCR OCRData; > CID CIDData; > CSD CSDData; > - ECSD ECSDData; // MMC V4 extended card specific > + ECSD ECSDData __attribute__((aligned(8))); // MMC V4 extended card specific > } CARD_INFO; > Jun, This structure does not look portable. 1) CARD_TYPE is an ENUM and the size of an enum is not a standard thing in C. Compiler is probably picking int and it seems to work. 2) I don't think __attribute__((aligned(8))) is supported by all the edk2 compilers (VC++ for example). It is an GNU extensions to C, not standard C, so we normally don't use it in edk2 code. While the alignment of types is not defined by the C standard, it is defined in the EFI ABI to be natural alignment. So you can add padding elements to a structure. You can also union with a UINT64 for force 8 byte alignment. typedef struct { UINT16 RCA; UINT32 CardType; //CARD_TYPE OCR OCRData; CID CIDData; CSD CSDData; UINT32 Pad; ECSD ECSDData; // MMC V4 extended card specific } CARD_INFO; Thanks, Andrew Fish > typedef struct _MMC_HOST_INSTANCE { > -- > 1.9.1 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel