From c93776c2d47b23b5e64691753efc7ab47ba257c0 Mon Sep 17 00:00:00 2001 From: jyao1 Date: Fri, 30 Nov 2012 09:03:15 +0000 Subject: ACPI4.0/5.0 have clear description: FIRMWARE_CTRL: If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero. X_FIRMWARE_CTRL: This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero. Update code in AcpiSupport/AcpiTable when it produces this field to set one only. Update code in AcpiS3Save when it consumes this field, check 0 value. Signed-off-by: jiewen.yao@intel.com Reviewed-by: star.zeng@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13980 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Acpi/AcpiTableDxe/AcpiTableProtocol.c | 42 ++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'MdeModulePkg/Universal/Acpi') diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index 6505de8..dfd1669 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c @@ -1,7 +1,7 @@ /** @file ACPI Table Protocol Implementation - Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -717,14 +717,19 @@ AddTableToList ( // // Update pointers in FADT. If tables don't exist this will put NULL pointers there. + // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and + // vice-versa. // - AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs3; - Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3; - CopyMem ( - &AcpiTableInstance->Fadt3->XFirmwareCtrl, - &Buffer64, - sizeof (UINT64) - ); + if ((UINT64)(UINTN)AcpiSupportInstance->Facs3 < BASE_4GB) { + AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs3; + } else { + Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3; + CopyMem ( + &AcpiTableInstance->Fadt3->XFirmwareCtrl, + &Buffer64, + sizeof (UINT64) + ); + } AcpiTableInstance->Fadt3->Dsdt = (UINT32) (UINTN) AcpiTableInstance->Dsdt3; Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Dsdt3; CopyMem ( @@ -840,13 +845,20 @@ AddTableToList ( // If FADT already exists, update table pointers. // if (AcpiTableInstance->Fadt3 != NULL) { - AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs3; - Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3; - CopyMem ( - &AcpiTableInstance->Fadt3->XFirmwareCtrl, - &Buffer64, - sizeof (UINT64) - ); + // + // Note: If the FIRMWARE_CTRL is non-zero, then X_FIRMWARE_CTRL must be zero, and + // vice-versa. + // + if ((UINT64)(UINTN)AcpiSupportInstance->Facs3 < BASE_4GB) { + AcpiTableInstance->Fadt3->FirmwareCtrl = (UINT32) (UINTN) AcpiTableInstance->Facs3; + } else { + Buffer64 = (UINT64) (UINTN) AcpiTableInstance->Facs3; + CopyMem ( + &AcpiTableInstance->Fadt3->XFirmwareCtrl, + &Buffer64, + sizeof (UINT64) + ); + } // // Checksum FADT table -- cgit v1.1