[edk2] [PATCH v2] EmbeddedPkg/MmcDxe: Add alignment for ECSD data

Jun Nie posted 1 patch 7 years, 6 months ago
Failed in applying to current master (apply log)
EmbeddedPkg/Universal/MmcDxe/Mmc.h | 1 +
1 file changed, 1 insertion(+)
[edk2] [PATCH v2] EmbeddedPkg/MmcDxe: Add alignment for ECSD data
Posted by Jun Nie 7 years, 6 months ago
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 <jun.nie@linaro.org>
---
 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
Re: [edk2] [PATCH v2] EmbeddedPkg/MmcDxe: Add alignment for ECSD data
Posted by Leif Lindholm 7 years, 6 months ago
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

> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> ---
>  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
Re: [edk2] [PATCH v2] EmbeddedPkg/MmcDxe: Add alignment for ECSD data
Posted by Jun Nie 7 years, 6 months ago
2017-06-12 23:53 GMT+08:00 Leif Lindholm <leif.lindholm@linaro.org>:
> 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

>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Jun Nie <jun.nie@linaro.org>
>> ---
>>  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
Re: [edk2] [PATCH v2] EmbeddedPkg/MmcDxe: Add alignment for ECSD data
Posted by Andrew Fish 7 years, 6 months ago
> On Jun 12, 2017, at 8:53 AM, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> 
> 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?
> 

And it is still exposed to enum optimization changing the alignment of the structure. 

Thanks,

Andrew Fish

> /
>    Leif
> 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Jun Nie <jun.nie@linaro.org>
>> ---
>> 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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel