On Mon, Mar 4, 2013 at 11:46 AM, Laszlo Ersek <[email protected]> wrote:
> On 03/04/13 19:28, Jordan Justen wrote:
>> When the PM base address was moved from 0x400 to 0xb000, this
>> code was missed. This prevented shutdown's via the UEFI system
>> call from working.
>>
>> (For example, at the EFI shell prompt: reset -s)
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Jordan Justen <[email protected]>
>> ---
>>  OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c 
>> b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
>> index d075fbe..89a2644 100644
>> --- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
>> +++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
>> @@ -26,8 +26,8 @@ AcpiPmControl (
>>  {
>>    ASSERT (SuspendType < 6);
>>
>> -  IoAndThenOr16 (0x404, (UINT16) ~0x3c00, (UINT16) (SuspendType << 10));
>> -  IoOr16 (0x404, BIT13);
>> +  IoAndThenOr16 (0xb004, (UINT16) ~0x3c00, (UINT16) (SuspendType << 10));
>> +  IoOr16 (0xb004, BIT13);
>>    CpuDeadLoop ();
>>  }
>>
>
> Could you use (PcdGet16 (PcdAcpiPmBaseAddress) + 4) instead? (Added in
> svn r13719.)

Definitely.

> Also (independently), 0x3c00 is an "int" (INT32), and bitwise complement
> on signed integers is not the most beautiful thing in the universe. What
> happens now is:
>
> - ~0x3c00 has type "signed int",
> - representation is bit pattern 11111111 11111111 11000011 11111111,
> - value is -15361 decimal (two's complement on our platform --
> implementation-defined),
> - when casting it to "short unsigned" (UINT16), we get
>   USHRT_MAX + 1 + (-15361) == 65536 - 15361 == 0xC3FF
>
> I think ((UINT16) ~0x3c00u) would be cleaner (without the detour into
> negative), but that's just an idea.

Hmm, I was wondering what ~(BIT13|BIT12|BIT11|BIT10) might do, but
then I saw that BIT31 and lower in Base.h don't use the 'u' suffix.

Do you think that we should update Base.h?

-Jordan

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to