On 10/13/15 20:34, Jordan Justen wrote:
> On 2015-10-13 10:49:24, Michael Kinney wrote:
>> VS20xx generates a warning if a typecast to a smaller
>> size strips upper bits that are set to 1.

Sigh.

>> The fix is
>> to mask off the upper bits before the typecast.

I agree. However...

> 
> Once again, these line seem to be wrapped smaller than necessary.
> 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Michael Kinney <[email protected]>
>> ---
>>  OvmfPkg/SmmAccess/SmmAccessPei.c  | 2 +-
>>  OvmfPkg/SmmAccess/SmramInternal.c | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/OvmfPkg/SmmAccess/SmmAccessPei.c 
>> b/OvmfPkg/SmmAccess/SmmAccessPei.c
>> index d340894..d5b3f5b 100644
>> --- a/OvmfPkg/SmmAccess/SmmAccessPei.c
>> +++ b/OvmfPkg/SmmAccess/SmmAccessPei.c
>> @@ -389,7 +389,7 @@ SmmAccessPeiEntryPoint (
>>    // (Global SMRAM Enable) too, as both D_LCK and T_EN depend on it.
>>    //
>>    PciAndThenOr8 (DRAMC_REGISTER_Q35 (MCH_SMRAM),
>> -    (UINT8)~(UINT32)MCH_SMRAM_D_LCK, MCH_SMRAM_G_SMRAME);
>> +    (UINT8)((~MCH_SMRAM_D_LCK) & 0xff), MCH_SMRAM_G_SMRAME);
>>  
>>    //
>>    // Create the GUID HOB and point it to the first SMRAM range.
>> diff --git a/OvmfPkg/SmmAccess/SmramInternal.c 
>> b/OvmfPkg/SmmAccess/SmramInternal.c
>> index 372ca2d..64601e5 100644
>> --- a/OvmfPkg/SmmAccess/SmramInternal.c
>> +++ b/OvmfPkg/SmmAccess/SmramInternal.c
>> @@ -70,7 +70,7 @@ SmramAccessOpen (
>>    //
>>    // Open TSEG by clearing T_EN.
>>    //
>> -  PciAnd8 (DRAMC_REGISTER_Q35 (MCH_ESMRAMC), 
>> (UINT8)~(UINT32)MCH_ESMRAMC_T_EN);
>> +  PciAnd8 (DRAMC_REGISTER_Q35 (MCH_ESMRAMC), (UINT8)((~MCH_ESMRAMC_T_EN) & 
>> 0xff));

MCH_SMRAM_D_LCK and MCH_ESMRAMC_T_EN both have type "int". Each time the
bitwise negation operator is applied to a signed int variable or
constant, the universe comes a bit closer to collapsing into a black hole.

So, I'll fix these up as:

(UINT8)((~(UINT32)Constant) & 0xff)

(I think that the parens around the bit-neg are excessive, but the
reasoning behind the warnings that VS20xx emits remains impenetrable to
me, so I'll err for over-parenthesizing here.)

Thanks!
Laszlo

> 
> Looks like this line moved > 80 characters. Can you split it?
> 
> Reviewed-by: Jordan Justen <[email protected]>
> 
>>    GetStates (LockState, OpenState);
>>    if (!*OpenState) {
>> -- 
>> 1.9.5.msysgit.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> [email protected]
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel
> 

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to