From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-in5.apple.com (mail-out5.apple.com [17.151.62.27]) (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 9903C2095CC40 for ; Mon, 12 Jun 2017 21:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1497326478; 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=b2gG22lHnf3ZZY6XvgfiwqvMYUrx4Wia3REvYELVheg=; b=Oa7DUXHorybiF4qAtJHcZdJfMS+idwFfVByzASALje+WWW6a0ubLFKV5zN5zN7cp rpg+b7cGDDqGZGjaYJuaNBbqMZuzTPUbeIa8PDcUiZ7favFDF39/CZIW7YCW47d6 HKiwl9KJOp++ejJmuxZhXCSR5ZIjLqgUd4wWC3d3B5oCYeECmNGydFM4siqVCFbL XlAekTS/eINZVDbPIFW40Z61YfzPpHAcSIiS6p0GETsAZi+gryyewyE5cOXMbAKG rafTHuNo0dhtKGSV62byt2faa4idc1rmEzqXFZTLtcsMsYW/+/5q5AHJ89egL3lC W3kxVRszX7OBe/bG8HlJ7A==; Received: from relay7.apple.com (relay7.apple.com [17.128.113.101]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail-in5.apple.com (Apple Secure Mail Relay) with SMTP id B4.DD.01595.C836F395; Mon, 12 Jun 2017 21:01:18 -0700 (PDT) X-AuditID: 11973e13-7cffb7000000063b-bf-593f638cba3d Received: from nwk-mmpp-sz11.apple.com (nwk-mmpp-sz11.apple.com [17.128.115.155]) by relay7.apple.com (Apple SCV relay) with SMTP id F5.1E.18088.C836F395; Mon, 12 Jun 2017 21:01:16 -0700 (PDT) MIME-version: 1.0 Received: from [17.153.95.126] (unknown [17.153.95.126]) by nwk-mmpp-sz11.apple.com (Oracle Communications Messaging Server 8.0.1.2.20170210 64bit (built Feb 10 2017)) with ESMTPSA id <0ORG00DU7WI3PX10@nwk-mmpp-sz11.apple.com>; Mon, 12 Jun 2017 21:01:16 -0700 (PDT) Sender: afish@apple.com From: Andrew Fish In-reply-to: Date: Mon, 12 Jun 2017 21:01:14 -0700 Cc: Leif Lindholm , Jason Liu , edk2-devel@lists.01.org, Shawn Guo , Haojian Zhuang , Ard Biesheuvel Message-id: <0C3C4FE2-0357-42D5-8DD2-28C840179A1A@apple.com> References: <1497232768-8993-1-git-send-email-jun.nie@linaro.org> <20170612155315.GK26676@bivouac.eciton.net> To: Jun Nie X-Mailer: Apple Mail (2.3273) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrCLMWRmVeSWpSXmKPExsUi2FCYqtuXbB9pcOudlMX/D7sZLfYcOsps cfncYUaL90evMFosefKQ3eLT7j0sFk/XLWF2YPe4c20Pm0f37H8sAUxRXDYpqTmZZalF+nYJ XBk/7m5gLJggUnHt6xLWBsbp/F2MnBwSAiYSL09NZOti5OIQEljDJLH6xSxWmMTHtk4WiMQh Rolp048zgSR4BQQlfky+B5Tg4GAWkJc4eF4WJMwsoCXx/VErVP1EJon5/fPYQRLCAuIS785s Yoaw/SRO999lA7HZBJQlVsz/AFbDKRAssfDVajaQmSwCqhI398eAzGEWeM4o8X7vVFaIvTYS k47cArOFBLYxSny4rwBiiwgoSHS9a4M6Wlbi1uxLzCDNEgJn2CTub9rCNoFReBaSu2ch3D0L yd0LGJlXMQrlJmbm6GbmmeolFhTkpOol5+duYgRFw3Q74R2Mp1dZHWIU4GBU4uFdMckuUog1 say4MvcQozQHi5I4b6WtdaSQQHpiSWp2ampBalF8UWlOavEhRiYOTqkGxuM/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: 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: Tue, 13 Jun 2017 04:00:04 -0000 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII > On Jun 12, 2017, at 7:14 PM, Jun Nie wrote: > > 2017-06-12 23:53 GMT+08:00 Leif Lindholm : >> On Mon, Jun 12, 2017 at 09:59:28AM +0800, Jun Nie wrote: >>> Add alignment for ECSD data for DMA access. Otherwise >>> the data is corrupted on Sanechips platform. >> >> I never did see a reply to my proposed solution, and the below is not >> it. Can you explain why you prefer this one? >> >> / >> Leif > > Sorry, just see your email because that thread is not highlighted for > new email in gmail for unknown reason. > I have concern that "UINT64 VENDOR_SPECIFIC_FIELD[8]" cannot secure > the ECSD alignment because it is not the first member. Changing the > first member to "UINT64 RESERVED_1[2]" shall secure the alignment. But > I preferred Pad method. It is more readable if all ECSD member are > UINT8 type. It is also more clear to add alignment info in CARD_INFO, > just before ECSD member. > I do not get point of Andrew, maybe he share the same concern. > Jun typedef enum { UNKNOWN_CARD, MMC_CARD, //MMC card MMC_CARD_HIGH, //MMC Card with High capacity EMMC_CARD, //eMMC 4.41 card SD_CARD, //SD 1.1 card SD_CARD_2, //SD 2.0 or above standard card SD_CARD_2_HIGH //SD 2.0 or above high capacity card } CARD_TYPE; Per C spec sizeof(CARD_TYPE) can be 1, 2, 4, or 8 (64-bit integer), and it is legal for the compiler to pick any of these. So it is not portable C code to use an enum in a data structure when layout maters. Thanks, Andrew Fish > Jun > >> >>> Contributed-under: TianoCore Contribution Agreement 1.0 >>> Signed-off-by: Jun Nie >>> --- >>> EmbeddedPkg/Universal/MmcDxe/Mmc.h | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h b/EmbeddedPkg/Universal/MmcDxe/Mmc.h >>> index 8a7d5a3..6e3ab17 100644 >>> --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h >>> +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h >>> @@ -319,6 +319,7 @@ typedef struct { >>> OCR OCRData; >>> CID CIDData; >>> CSD CSDData; >>> + UINT64 Pad; // For 8 bytes alignment of ECSDData >>> ECSD ECSDData; // MMC V4 extended card specific >>> } CARD_INFO; >>> >>> -- >>> 1.9.1 >>> > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel