mirror of https://github.com/acpica/acpica/
commit
6cd1ba2619
|
@ -0,0 +1,68 @@
|
|||
#/** @file
|
||||
# Build discription file to generate ACPICA applications.
|
||||
#
|
||||
# Copyright (c) 2009 Intel Corporation. All rights reserved
|
||||
# This software and associated documentation (if any) is furnished
|
||||
# under a license and may only be used or copied in accordance
|
||||
# with the terms of the license. Except as permitted by such
|
||||
# license, no part of this software or documentation may be
|
||||
# reproduced, stored in a retrieval system, or transmitted in any
|
||||
# form or by any means without the express written consent of
|
||||
# Intel Corporation.
|
||||
#
|
||||
# **/
|
||||
|
||||
[Defines]
|
||||
PLATFORM_NAME = Acpi
|
||||
PLATFORM_GUID = b03fdec4-2942-11e6-a416-0024e8c6d30e
|
||||
PLATFORM_VERSION = 1.0
|
||||
DSC_SPECIFICATION = 0x00010005
|
||||
OUTPUT_DIRECTORY = Build/Acpi
|
||||
SUPPORTED_ARCHITECTURES = IA32|X64
|
||||
BUILD_TARGETS = DEBUG|RELEASE
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
|
||||
[LibraryClasses]
|
||||
#
|
||||
# Entry Point Libraries
|
||||
#
|
||||
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
||||
ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
|
||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||
#
|
||||
# Common Libraries
|
||||
#
|
||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
|
||||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
||||
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||
DevMedia|StdLib/LibC/Uefi/Devices/daShell.inf # support new name of DevShell
|
||||
!if $(DEBUG_ENABLE_OUTPUT)
|
||||
DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
|
||||
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
|
||||
!else ## DEBUG_ENABLE_OUTPUT
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
!endif ## DEBUG_ENABLE_OUTPUT
|
||||
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
|
||||
PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf
|
||||
PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf
|
||||
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
|
||||
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
|
||||
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
|
||||
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
|
||||
|
||||
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
||||
FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
|
||||
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
|
||||
|
||||
!include StdLib/StdLib.inc
|
||||
|
||||
[Components.common]
|
||||
AcpiPkg/source/acpidump.inf
|
|
@ -55,7 +55,7 @@
|
|||
BaseLib
|
||||
|
||||
[BuildOptions]
|
||||
MSFT:*_*_IA32_CC_FLAGS = /Oi- /WX- /D_EDK2_EFI /DACPI_DUMP_APP
|
||||
MSFT:*_*_X64_CC_FLAGS = /Oi- /WX- /D_EDK2_EFI /DACPI_DUMP_APP
|
||||
MSFT:*_*_IA32_CC_FLAGS = /GL- /D_EDK2_EFI /DUSE_MS_ABI /D__i386__ /DACPI_DUMP_APP
|
||||
MSFT:*_*_X64_CC_FLAGS = /GL- /D_EDK2_EFI /DUSE_MS_ABI /D__x86_64__ /DACPI_DUMP_APP
|
||||
GCC:*_*_IA32_CC_FLAGS = -U__linux__ -U_LINUX -D_EDK2_EFI -DACPI_DUMP_APP -fno-builtin -iwithprefix include
|
||||
GCC:*_*_X64_CC_FLAGS = -U__linux__ -U_LINUX -D_EDK2_EFI -DACPI_DUMP_APP -fno-builtin -iwithprefix include
|
|
@ -0,0 +1,65 @@
|
|||
## @file
|
||||
# acpidump.inf
|
||||
#
|
||||
# Copyright (c) 2017, 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
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = acpidump
|
||||
FILE_GUID = EAB96253-B448-4855-BE7D-5A95DDECA540
|
||||
MODULE_TYPE = UEFI_APPLICATION
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = ShellCEntryLib
|
||||
|
||||
[Sources]
|
||||
tools/acpidump/apdump.c
|
||||
tools/acpidump/apfiles.c
|
||||
tools/acpidump/apmain.c
|
||||
common/cmfsize.c
|
||||
common/getopt.c
|
||||
os_specific/efi/osefitbl.c
|
||||
os_specific/efi/osefixf.c
|
||||
components/tables/tbprint.c
|
||||
components/tables/tbxfroot.c
|
||||
components/utilities/utascii.c
|
||||
components/utilities/utbuffer.c
|
||||
components/utilities/utdebug.c
|
||||
components/utilities/utexcep.c
|
||||
components/utilities/utglobal.c
|
||||
components/utilities/uthex.c
|
||||
components/utilities/utmath.c
|
||||
components/utilities/utnonansi.c
|
||||
components/utilities/utstring.c
|
||||
components/utilities/utstrtoul64.c
|
||||
components/utilities/utxferror.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
StdLib/StdLib.dec
|
||||
ShellPkg/ShellPkg.dec
|
||||
AcpiPkg/AcpiPkg.dec
|
||||
StdLibPrivateInternalFiles/DoNotUse.dec
|
||||
|
||||
[LibraryClasses]
|
||||
ShellCEntryLib
|
||||
BaseLib
|
||||
LibC
|
||||
DevMedia
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
|
||||
[BuildOptions]
|
||||
MSFT:*_*_IA32_CC_FLAGS = /D_EDK2_EFI /DACPI_DUMP_APP /DUSE_MS_ABI /DUSE_STDLIB /D__i386__
|
||||
MSFT:*_*_X64_CC_FLAGS = /D_EDK2_EFI /DACPI_DUMP_APP /DUSE_MS_ABI /DUSE_STDLIB /D__x86_64__
|
||||
GCC:*_*_IA32_CC_FLAGS = -U__linux__ -U_LINUX -D_EDK2_EFI -DACPI_DUMP_APP -DUSE_STDLIB -fno-builtin -iwithprefix include
|
||||
GCC:*_*_X64_CC_FLAGS = -U__linux__ -U_LINUX -D_EDK2_EFI -DACPI_DUMP_APP -DUSE_STDLIB -fno-builtin -iwithprefix include
|
|
@ -5,10 +5,39 @@ EFIPROGS="acpidump"
|
|||
EFIDIR=`(cd \`dirname $0\`; pwd)`
|
||||
TOPDIR=`(cd ${EFIDIR}/../..; pwd)`
|
||||
|
||||
usage() {
|
||||
echo "Usage: `basename $0` [-c]"
|
||||
echo "Where:"
|
||||
echo " -c: Use EDK standard C-library - StdLib."
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts "c" opt
|
||||
do
|
||||
case $opt in
|
||||
c) EDKSTDLIB=yes;;
|
||||
?) echo "Invalid option: $1"
|
||||
usage;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z ${EDKSTDLIB} ]; then
|
||||
EFISUFFIX=nostdlib
|
||||
else
|
||||
EFISUFFIX=stdlib
|
||||
fi
|
||||
|
||||
echo "Copying AcpiPkg package files..."
|
||||
cp -f ${EFIDIR}/AcpiPkg.dec ${TOPDIR}/AcpiPkg.dec
|
||||
cp -f ${EFIDIR}/AcpiPkg.dsc ${TOPDIR}/AcpiPkg.dsc
|
||||
cp -f ${EFIDIR}/AcpiPkg_${EFISUFFIX}.dsc ${TOPDIR}/AcpiPkg.dsc
|
||||
|
||||
for p in ${EFIPROGS}; do
|
||||
echo "Copying $p build files..."
|
||||
cp -f ${EFIDIR}/$p/${p}.inf ${TOPDIR}/source/${p}.inf
|
||||
EFIINF=${p}_${EFISUFFIX}.inf
|
||||
echo "Copying $p build file: ${EFIINF}..."
|
||||
if [ ! -f ${EFIDIR}/$p/${EFIINF} ]; then
|
||||
echo "Invalid build file: ${EFIINF}"
|
||||
exit 1
|
||||
else
|
||||
cp -f ${EFIDIR}/$p/${EFIINF} ${TOPDIR}/source/${p}.inf
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -762,7 +762,7 @@ strstr (
|
|||
char *String1,
|
||||
char *String2)
|
||||
{
|
||||
UINT32 Length;
|
||||
ACPI_SIZE Length;
|
||||
|
||||
|
||||
Length = strlen (String2);
|
||||
|
|
|
@ -183,8 +183,10 @@ AcpiUtHexToAsciiChar (
|
|||
UINT64 Integer,
|
||||
UINT32 Position)
|
||||
{
|
||||
UINT64 Index;
|
||||
|
||||
return (AcpiGbl_HexToAscii[(Integer >> Position) & 0xF]);
|
||||
AcpiUtShortShiftRight (Integer, Position, &Index);
|
||||
return (AcpiGbl_HexToAscii[Index & 0xF]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -156,16 +156,6 @@
|
|||
#define _COMPONENT ACPI_UTILITIES
|
||||
ACPI_MODULE_NAME ("utmath")
|
||||
|
||||
/*
|
||||
* Optional support for 64-bit double-precision integer divide. This code
|
||||
* is configurable and is implemented in order to support 32-bit kernel
|
||||
* environments where a 64-bit double-precision math library is not available.
|
||||
*
|
||||
* Support for a more normal 64-bit divide/modulo (with check for a divide-
|
||||
* by-zero) appears after this optional section of code.
|
||||
*/
|
||||
#ifndef ACPI_USE_NATIVE_DIVIDE
|
||||
|
||||
/* Structures used only for 64-bit divide */
|
||||
|
||||
typedef struct uint64_struct
|
||||
|
@ -182,6 +172,257 @@ typedef union uint64_overlay
|
|||
|
||||
} UINT64_OVERLAY;
|
||||
|
||||
/*
|
||||
* Optional support for 64-bit double-precision integer multiply and shift.
|
||||
* This code is configurable and is implemented in order to support 32-bit
|
||||
* kernel environments where a 64-bit double-precision math library is not
|
||||
* available.
|
||||
*/
|
||||
#ifndef ACPI_USE_NATIVE_MATH64
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtShortMultiply
|
||||
*
|
||||
* PARAMETERS: Multiplicand - 64-bit multiplicand
|
||||
* Multiplier - 32-bit multiplier
|
||||
* OutProduct - Pointer to where the product is returned
|
||||
*
|
||||
* DESCRIPTION: Perform a short multiply.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortMultiply (
|
||||
UINT64 Multiplicand,
|
||||
UINT32 Multiplier,
|
||||
UINT64 *OutProduct)
|
||||
{
|
||||
UINT64_OVERLAY MultiplicandOvl;
|
||||
UINT64_OVERLAY Product;
|
||||
UINT32 Carry32;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (UtShortMultiply);
|
||||
|
||||
|
||||
MultiplicandOvl.Full = Multiplicand;
|
||||
|
||||
/*
|
||||
* The Product is 64 bits, the carry is always 32 bits,
|
||||
* and is generated by the second multiply.
|
||||
*/
|
||||
ACPI_MUL_64_BY_32 (0, MultiplicandOvl.Part.Hi, Multiplier,
|
||||
Product.Part.Hi, Carry32);
|
||||
|
||||
ACPI_MUL_64_BY_32 (0, MultiplicandOvl.Part.Lo, Multiplier,
|
||||
Product.Part.Lo, Carry32);
|
||||
|
||||
Product.Part.Hi += Carry32;
|
||||
|
||||
/* Return only what was requested */
|
||||
|
||||
if (OutProduct)
|
||||
{
|
||||
*OutProduct = Product.Full;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtShortShiftLeft
|
||||
*
|
||||
* PARAMETERS: Operand - 64-bit shift operand
|
||||
* Count - 32-bit shift count
|
||||
* OutResult - Pointer to where the result is returned
|
||||
*
|
||||
* DESCRIPTION: Perform a short left shift.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortShiftLeft (
|
||||
UINT64 Operand,
|
||||
UINT32 Count,
|
||||
UINT64 *OutResult)
|
||||
{
|
||||
UINT64_OVERLAY OperandOvl;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (UtShortShiftLeft);
|
||||
|
||||
|
||||
OperandOvl.Full = Operand;
|
||||
|
||||
if ((Count & 63) >= 32)
|
||||
{
|
||||
OperandOvl.Part.Hi = OperandOvl.Part.Lo;
|
||||
OperandOvl.Part.Lo ^= OperandOvl.Part.Lo;
|
||||
Count = (Count & 63) - 32;
|
||||
}
|
||||
ACPI_SHIFT_LEFT_64_BY_32 (OperandOvl.Part.Hi,
|
||||
OperandOvl.Part.Lo, Count);
|
||||
|
||||
/* Return only what was requested */
|
||||
|
||||
if (OutResult)
|
||||
{
|
||||
*OutResult = OperandOvl.Full;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtShortShiftRight
|
||||
*
|
||||
* PARAMETERS: Operand - 64-bit shift operand
|
||||
* Count - 32-bit shift count
|
||||
* OutResult - Pointer to where the result is returned
|
||||
*
|
||||
* DESCRIPTION: Perform a short right shift.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortShiftRight (
|
||||
UINT64 Operand,
|
||||
UINT32 Count,
|
||||
UINT64 *OutResult)
|
||||
{
|
||||
UINT64_OVERLAY OperandOvl;
|
||||
|
||||
|
||||
ACPI_FUNCTION_TRACE (UtShortShiftRight);
|
||||
|
||||
|
||||
OperandOvl.Full = Operand;
|
||||
|
||||
if ((Count & 63) >= 32)
|
||||
{
|
||||
OperandOvl.Part.Lo = OperandOvl.Part.Hi;
|
||||
OperandOvl.Part.Hi ^= OperandOvl.Part.Hi;
|
||||
Count = (Count & 63) - 32;
|
||||
}
|
||||
ACPI_SHIFT_RIGHT_64_BY_32 (OperandOvl.Part.Hi,
|
||||
OperandOvl.Part.Lo, Count);
|
||||
|
||||
/* Return only what was requested */
|
||||
|
||||
if (OutResult)
|
||||
{
|
||||
*OutResult = OperandOvl.Full;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
#else
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtShortMultiply
|
||||
*
|
||||
* PARAMETERS: See function headers above
|
||||
*
|
||||
* DESCRIPTION: Native version of the UtShortMultiply function.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortMultiply (
|
||||
UINT64 Multiplicand,
|
||||
UINT32 Multiplier,
|
||||
UINT64 *OutProduct)
|
||||
{
|
||||
|
||||
ACPI_FUNCTION_TRACE (UtShortMultiply);
|
||||
|
||||
|
||||
/* Return only what was requested */
|
||||
|
||||
if (OutProduct)
|
||||
{
|
||||
*OutProduct = Multiplicand * Multiplier;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtShortShiftLeft
|
||||
*
|
||||
* PARAMETERS: See function headers above
|
||||
*
|
||||
* DESCRIPTION: Native version of the UtShortShiftLeft function.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortShiftLeft (
|
||||
UINT64 Operand,
|
||||
UINT32 Count,
|
||||
UINT64 *OutResult)
|
||||
{
|
||||
|
||||
ACPI_FUNCTION_TRACE (UtShortShiftLeft);
|
||||
|
||||
|
||||
/* Return only what was requested */
|
||||
|
||||
if (OutResult)
|
||||
{
|
||||
*OutResult = Operand << Count;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiUtShortShiftRight
|
||||
*
|
||||
* PARAMETERS: See function headers above
|
||||
*
|
||||
* DESCRIPTION: Native version of the UtShortShiftRight function.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortShiftRight (
|
||||
UINT64 Operand,
|
||||
UINT32 Count,
|
||||
UINT64 *OutResult)
|
||||
{
|
||||
|
||||
ACPI_FUNCTION_TRACE (UtShortShiftRight);
|
||||
|
||||
|
||||
/* Return only what was requested */
|
||||
|
||||
if (OutResult)
|
||||
{
|
||||
*OutResult = Operand >> Count;
|
||||
}
|
||||
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Optional support for 64-bit double-precision integer divide. This code
|
||||
* is configurable and is implemented in order to support 32-bit kernel
|
||||
* environments where a 64-bit double-precision math library is not available.
|
||||
*
|
||||
* Support for a more normal 64-bit divide/modulo (with check for a divide-
|
||||
* by-zero) appears after this optional section of code.
|
||||
*/
|
||||
#ifndef ACPI_USE_NATIVE_DIVIDE
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
|
|
@ -331,7 +331,7 @@ AcpiUtScanNumber (
|
|||
|
||||
while (isdigit ((int) *String))
|
||||
{
|
||||
Number *= 10;
|
||||
AcpiUtShortMultiply (Number, 10, &Number);
|
||||
Number += *(String++) - '0';
|
||||
}
|
||||
|
||||
|
@ -463,7 +463,7 @@ AcpiUtFormatNumber (
|
|||
/* Generate full string in reverse order */
|
||||
|
||||
Pos = AcpiUtPutNumber (ReversedString, Number, Base, Upper);
|
||||
i = ACPI_PTR_DIFF (Pos, ReversedString);
|
||||
i = (INT32) ACPI_PTR_DIFF (Pos, ReversedString);
|
||||
|
||||
/* Printing 100 using %2d gives "100", not "00" */
|
||||
|
||||
|
@ -695,7 +695,7 @@ vsnprintf (
|
|||
{
|
||||
s = "<NULL>";
|
||||
}
|
||||
Length = AcpiUtBoundStringLength (s, Precision);
|
||||
Length = (INT32) AcpiUtBoundStringLength (s, Precision);
|
||||
if (!(Type & ACPI_FORMAT_LEFT))
|
||||
{
|
||||
while (Length < Width--)
|
||||
|
@ -815,7 +815,7 @@ vsnprintf (
|
|||
}
|
||||
}
|
||||
|
||||
return (ACPI_PTR_DIFF (Pos, String));
|
||||
return ((int) ACPI_PTR_DIFF (Pos, String));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -419,8 +419,8 @@ AcpiUtStrtoulBase10 (
|
|||
|
||||
/* Convert and insert (add) the decimal digit */
|
||||
|
||||
NextValue =
|
||||
(ReturnValue * 10) + (AsciiDigit - ACPI_ASCII_ZERO);
|
||||
AcpiUtShortMultiply (ReturnValue, 10, &NextValue);
|
||||
NextValue += (AsciiDigit - ACPI_ASCII_ZERO);
|
||||
|
||||
/* Check for overflow (32 or 64 bit) - return current converted value */
|
||||
|
||||
|
@ -486,8 +486,8 @@ AcpiUtStrtoulBase16 (
|
|||
|
||||
/* Convert and insert the hex digit */
|
||||
|
||||
ReturnValue =
|
||||
(ReturnValue << 4) | AcpiUtAsciiCharToHex (AsciiDigit);
|
||||
AcpiUtShortShiftLeft (ReturnValue, 4, &ReturnValue);
|
||||
ReturnValue |= AcpiUtAsciiCharToHex (AsciiDigit);
|
||||
|
||||
String++;
|
||||
ValidDigits++;
|
||||
|
|
|
@ -162,14 +162,14 @@
|
|||
* Note: The order of these include files is important.
|
||||
*/
|
||||
#include "platform/acenv.h" /* Environment-specific items */
|
||||
#include "acnames.h" /* Common ACPI names and strings */
|
||||
#include "actypes.h" /* ACPICA data types and structures */
|
||||
#include "platform/acenvex.h" /* Extra environment-specific items */
|
||||
#include "acnames.h" /* Common ACPI names and strings */
|
||||
#include "acexcep.h" /* ACPICA exceptions */
|
||||
#include "actbl.h" /* ACPI table definitions */
|
||||
#include "acoutput.h" /* Error output and Debug macros */
|
||||
#include "acrestyp.h" /* Resource Descriptor structs */
|
||||
#include "acpiosxf.h" /* OSL interfaces (ACPICA-to-OS) */
|
||||
#include "acpixf.h" /* ACPI core subsystem external interfaces */
|
||||
#include "platform/acenvex.h" /* Extra environment-specific items */
|
||||
|
||||
#endif /* __ACPI_H__ */
|
||||
|
|
|
@ -276,6 +276,7 @@ typedef UINT64 ACPI_PHYSICAL_ADDRESS;
|
|||
#define ACPI_MAX_PTR ACPI_UINT64_MAX
|
||||
#define ACPI_SIZE_MAX ACPI_UINT64_MAX
|
||||
#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */
|
||||
#define ACPI_USE_NATIVE_MATH64 /* Has native 64-bit integer support */
|
||||
|
||||
/*
|
||||
* In the case of the Itanium Processor Family (IPF), the hardware does not
|
||||
|
|
|
@ -879,6 +879,24 @@ AcpiUtShortDivide (
|
|||
UINT64 *OutQuotient,
|
||||
UINT32 *OutRemainder);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortMultiply (
|
||||
UINT64 InMultiplicand,
|
||||
UINT32 Multiplier,
|
||||
UINT64 *Outproduct);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortShiftLeft (
|
||||
UINT64 Operand,
|
||||
UINT32 Count,
|
||||
UINT64 *OutResult);
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiUtShortShiftRight (
|
||||
UINT64 Operand,
|
||||
UINT32 Count,
|
||||
UINT64 *OutResult);
|
||||
|
||||
|
||||
/*
|
||||
* utmisc
|
||||
|
|
|
@ -180,6 +180,7 @@
|
|||
#define COMPILER_DEPENDENT_INT64 long long
|
||||
#define COMPILER_DEPENDENT_UINT64 unsigned long long
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
#endif
|
||||
|
||||
#ifndef __cdecl
|
||||
|
|
|
@ -159,6 +159,7 @@
|
|||
#else
|
||||
#define ACPI_MACHINE_WIDTH 32
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
#endif
|
||||
|
||||
#define ACPI_UINTPTR_T uintptr_t
|
||||
|
|
|
@ -152,11 +152,24 @@
|
|||
#ifndef __ACEFI_H__
|
||||
#define __ACEFI_H__
|
||||
|
||||
/*
|
||||
* Single threaded environment where Mutex/Event/Sleep are fake. This model is
|
||||
* sufficient for pre-boot AcpiExec.
|
||||
*/
|
||||
#ifndef DEBUGGER_THREADING
|
||||
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
|
||||
#endif /* !DEBUGGER_THREADING */
|
||||
|
||||
/* EDK2 EFI environemnt */
|
||||
|
||||
#if defined(_EDK2_EFI)
|
||||
|
||||
#define _GNU_EFI
|
||||
#ifdef USE_STDLIB
|
||||
#define ACPI_USE_STANDARD_HEADERS
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -194,8 +207,10 @@
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef USE_STDLIB
|
||||
#define UINTN uint64_t
|
||||
#define INTN int64_t
|
||||
#endif
|
||||
|
||||
#define ACPI_EFI_ERR(a) (0x8000000000000000 | a)
|
||||
|
||||
|
@ -203,8 +218,10 @@
|
|||
|
||||
#define ACPI_MACHINE_WIDTH 32
|
||||
|
||||
#ifndef USE_STDLIB
|
||||
#define UINTN uint32_t
|
||||
#define INTN int32_t
|
||||
#endif
|
||||
|
||||
#define ACPI_EFI_ERR(a) (0x80000000 | a)
|
||||
|
||||
|
@ -326,26 +343,59 @@ UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
|
|||
#endif
|
||||
|
||||
|
||||
/* GNU EFI definitions */
|
||||
|
||||
#if defined(_GNU_EFI)
|
||||
/* EFI math64 definitions */
|
||||
|
||||
#if defined(_GNU_EFI) || defined(_EDK2_EFI)
|
||||
/*
|
||||
* Math helpers
|
||||
* Math helpers, GNU EFI provided a platform independent 64-bit math
|
||||
* support.
|
||||
*/
|
||||
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
|
||||
#ifndef ACPI_DIV_64_BY_32
|
||||
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
|
||||
do { \
|
||||
UINT64 __n = ((UINT64) n_hi) << 32 | (n_lo); \
|
||||
(q32) = (UINT32) DivU64x32 ((__n), (d32), &(r32)); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_MUL_64_BY_32
|
||||
#define ACPI_MUL_64_BY_32(n_hi, n_lo, m32, p32, c32) \
|
||||
do { \
|
||||
UINT64 __n = ((UINT64) n_hi) << 32 | (n_lo); \
|
||||
(q32) = DivU64x32 ((__n), (d32), &(r32)); \
|
||||
UINT64 __p = MultU64x32 (__n, (m32)); \
|
||||
(p32) = (UINT32) __p; \
|
||||
(c32) = (UINT32) (__p >> 32); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_SHIFT_LEFT_64_by_32
|
||||
#define ACPI_SHIFT_LEFT_64_BY_32(n_hi, n_lo, s32) \
|
||||
do { \
|
||||
UINT64 __n = ((UINT64) n_hi) << 32 | (n_lo); \
|
||||
UINT64 __r = LShiftU64 (__n, (s32)); \
|
||||
(n_lo) = (UINT32) __r; \
|
||||
(n_hi) = (UINT32) (__r >> 32); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_SHIFT_RIGHT_64_BY_32
|
||||
#define ACPI_SHIFT_RIGHT_64_BY_32(n_hi, n_lo, s32) \
|
||||
do { \
|
||||
UINT64 __n = ((UINT64) n_hi) << 32 | (n_lo); \
|
||||
UINT64 __r = RShiftU64 (__n, (s32)); \
|
||||
(n_lo) = (UINT32) __r; \
|
||||
(n_hi) = (UINT32) (__r >> 32); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_SHIFT_RIGHT_64
|
||||
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
|
||||
do { \
|
||||
(n_lo) >>= 1; \
|
||||
(n_lo) |= (((n_hi) & 1) << 31); \
|
||||
(n_hi) >>= 1; \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct _ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE;
|
||||
|
@ -353,17 +403,21 @@ struct _ACPI_SIMPLE_INPUT_INTERFACE;
|
|||
struct _ACPI_EFI_FILE_IO_INTERFACE;
|
||||
struct _ACPI_EFI_FILE_HANDLE;
|
||||
struct _ACPI_EFI_BOOT_SERVICES;
|
||||
struct _ACPI_EFI_RUNTIME_SERVICES;
|
||||
struct _ACPI_EFI_SYSTEM_TABLE;
|
||||
struct _ACPI_EFI_PCI_IO;
|
||||
|
||||
extern struct _ACPI_EFI_SYSTEM_TABLE *ST;
|
||||
extern struct _ACPI_EFI_BOOT_SERVICES *BS;
|
||||
extern struct _ACPI_EFI_RUNTIME_SERVICES *RT;
|
||||
|
||||
#ifndef USE_STDLIB
|
||||
typedef union acpi_efi_file ACPI_EFI_FILE;
|
||||
#define FILE ACPI_EFI_FILE
|
||||
|
||||
extern FILE *stdin;
|
||||
extern FILE *stdout;
|
||||
extern FILE *stderr;
|
||||
#endif
|
||||
|
||||
#endif /* __ACEFI_H__ */
|
||||
|
|
|
@ -595,6 +595,11 @@ ACPI_EFI_STATUS
|
|||
ACPI_EFI_HANDLE ImageHandle);
|
||||
|
||||
|
||||
typedef
|
||||
ACPI_EFI_STATUS
|
||||
(ACPI_EFI_API *ACPI_EFI_STALL) (
|
||||
UINTN Microseconds);
|
||||
|
||||
typedef
|
||||
ACPI_EFI_STATUS
|
||||
(ACPI_EFI_API *ACPI_EFI_SET_WATCHDOG_TIMER) (
|
||||
|
@ -664,6 +669,27 @@ ACPI_EFI_STATUS
|
|||
VOID *Buffer);
|
||||
|
||||
|
||||
/*
|
||||
* EFI Time
|
||||
*/
|
||||
typedef struct {
|
||||
UINT32 Resolution;
|
||||
UINT32 Accuracy;
|
||||
BOOLEAN SetsToZero;
|
||||
} ACPI_EFI_TIME_CAPABILITIES;
|
||||
|
||||
typedef
|
||||
ACPI_EFI_STATUS
|
||||
(ACPI_EFI_API *ACPI_EFI_GET_TIME) (
|
||||
ACPI_EFI_TIME *Time,
|
||||
ACPI_EFI_TIME_CAPABILITIES *Capabilities);
|
||||
|
||||
typedef
|
||||
ACPI_EFI_STATUS
|
||||
(ACPI_EFI_API *ACPI_EFI_SET_TIME) (
|
||||
ACPI_EFI_TIME *Time);
|
||||
|
||||
|
||||
/*
|
||||
* Protocol handler functions
|
||||
*/
|
||||
|
@ -890,12 +916,11 @@ typedef struct _ACPI_EFI_BOOT_SERVICES {
|
|||
#if 0
|
||||
ACPI_EFI_EXIT_BOOT_SERVICES ExitBootServices;
|
||||
ACPI_EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
|
||||
ACPI_EFI_STALL Stall;
|
||||
#else
|
||||
ACPI_EFI_UNKNOWN_INTERFACE ExitBootServices;
|
||||
ACPI_EFI_UNKNOWN_INTERFACE GetNextMonotonicCount;
|
||||
ACPI_EFI_UNKNOWN_INTERFACE Stall;
|
||||
#endif
|
||||
ACPI_EFI_STALL Stall;
|
||||
ACPI_EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
|
||||
|
||||
#if 0
|
||||
|
@ -928,6 +953,54 @@ typedef struct _ACPI_EFI_BOOT_SERVICES {
|
|||
} ACPI_EFI_BOOT_SERVICES;
|
||||
|
||||
|
||||
/*
|
||||
* EFI Runtime Services Table
|
||||
*/
|
||||
#define ACPI_EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544e5552
|
||||
#define ACPI_EFI_RUNTIME_SERVICES_REVISION (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
|
||||
|
||||
typedef struct _ACPI_EFI_RUNTIME_SERVICES {
|
||||
ACPI_EFI_TABLE_HEADER Hdr;
|
||||
|
||||
ACPI_EFI_GET_TIME GetTime;
|
||||
ACPI_EFI_SET_TIME SetTime;
|
||||
#if 0
|
||||
ACPI_EFI_GET_WAKEUP_TIME GetWakeupTime;
|
||||
ACPI_EFI_SET_WAKEUP_TIME SetWakeupTime;
|
||||
#else
|
||||
ACPI_EFI_UNKNOWN_INTERFACE GetWakeupTime;
|
||||
ACPI_EFI_UNKNOWN_INTERFACE SetWakeupTime;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
ACPI_EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
|
||||
ACPI_EFI_CONVERT_POINTER ConvertPointer;
|
||||
#else
|
||||
ACPI_EFI_UNKNOWN_INTERFACE SetVirtualAddressMap;
|
||||
ACPI_EFI_UNKNOWN_INTERFACE ConvertPointer;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
ACPI_EFI_GET_VARIABLE GetVariable;
|
||||
ACPI_EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
|
||||
ACPI_EFI_SET_VARIABLE SetVariable;
|
||||
#else
|
||||
ACPI_EFI_UNKNOWN_INTERFACE GetVariable;
|
||||
ACPI_EFI_UNKNOWN_INTERFACE GetNextVariableName;
|
||||
ACPI_EFI_UNKNOWN_INTERFACE SetVariable;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
ACPI_EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
|
||||
ACPI_EFI_RESET_SYSTEM ResetSystem;
|
||||
#else
|
||||
ACPI_EFI_UNKNOWN_INTERFACE GetNextHighMonotonicCount;
|
||||
ACPI_EFI_UNKNOWN_INTERFACE ResetSystem;
|
||||
#endif
|
||||
|
||||
} ACPI_EFI_RUNTIME_SERVICES;
|
||||
|
||||
|
||||
/*
|
||||
* EFI System Table
|
||||
*/
|
||||
|
@ -964,11 +1037,7 @@ typedef struct _ACPI_EFI_SYSTEM_TABLE {
|
|||
ACPI_EFI_HANDLE StandardErrorHandle;
|
||||
ACPI_SIMPLE_TEXT_OUTPUT_INTERFACE *StdErr;
|
||||
|
||||
#if 0
|
||||
ACPI_EFI_RUNTIME_SERVICES *RuntimeServices;
|
||||
#else
|
||||
ACPI_EFI_HANDLE *RuntimeServices;
|
||||
#endif
|
||||
ACPI_EFI_BOOT_SERVICES *BootServices;
|
||||
|
||||
UINTN NumberOfTableEntries;
|
||||
|
@ -1051,19 +1120,34 @@ union acpi_efi_file {
|
|||
};
|
||||
|
||||
|
||||
/* GNU EFI definitions */
|
||||
/* EFI definitions */
|
||||
|
||||
#if defined(_GNU_EFI)
|
||||
#if defined(_GNU_EFI) || defined(_EDK2_EFI)
|
||||
|
||||
/*
|
||||
* This is needed to hide platform specific code from ACPICA
|
||||
*/
|
||||
UINT64
|
||||
UINT64 ACPI_EFI_API
|
||||
DivU64x32 (
|
||||
UINT64 Dividend,
|
||||
UINTN Divisor,
|
||||
UINTN *Remainder);
|
||||
|
||||
UINT64 ACPI_EFI_API
|
||||
MultU64x32 (
|
||||
UINT64 Multiplicand,
|
||||
UINTN Multiplier);
|
||||
|
||||
UINT64 ACPI_EFI_API
|
||||
LShiftU64 (
|
||||
UINT64 Operand,
|
||||
UINTN Count);
|
||||
|
||||
UINT64 ACPI_EFI_API
|
||||
RShiftU64 (
|
||||
UINT64 Operand,
|
||||
UINTN Count);
|
||||
|
||||
/*
|
||||
* EFI specific prototypes
|
||||
*/
|
||||
|
@ -1077,7 +1161,6 @@ acpi_main (
|
|||
int argc,
|
||||
char *argv[]);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
extern ACPI_EFI_GUID AcpiGbl_LoadedImageProtocol;
|
||||
|
|
|
@ -169,6 +169,7 @@
|
|||
#define ACPI_USE_DO_WHILE_0
|
||||
#define ACPI_USE_LOCAL_CACHE
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
|
|
@ -192,4 +192,8 @@ typedef __builtin_va_list va_list;
|
|||
|
||||
#define COMPILER_VA_MACRO 1
|
||||
|
||||
/* GCC supports native multiply/shift on 32-bit platforms */
|
||||
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
|
||||
#endif /* __ACGCC_H__ */
|
||||
|
|
|
@ -166,6 +166,7 @@ struct mutex;
|
|||
#define ACPI_MUTEX struct mutex *
|
||||
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
|
||||
/* #define ACPI_THREAD_ID thread_id */
|
||||
|
||||
|
|
|
@ -237,6 +237,7 @@
|
|||
/* Host-dependent types and defines for in-kernel ACPICA */
|
||||
|
||||
#define ACPI_MACHINE_WIDTH BITS_PER_LONG
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
|
||||
#define strtoul simple_strtoul
|
||||
|
||||
|
@ -325,6 +326,7 @@
|
|||
#define COMPILER_DEPENDENT_INT64 long long
|
||||
#define COMPILER_DEPENDENT_UINT64 unsigned long long
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
#endif
|
||||
|
||||
#ifndef __cdecl
|
||||
|
|
|
@ -161,30 +161,6 @@
|
|||
* out if these are actually defined.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Map low I/O functions for MS. This allows us to disable MS language
|
||||
* extensions for maximum portability.
|
||||
*/
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define write _write
|
||||
#define close _close
|
||||
#define stat _stat
|
||||
#define fstat _fstat
|
||||
#define mkdir _mkdir
|
||||
#define snprintf _snprintf
|
||||
#if _MSC_VER <= 1200 /* Versions below VC++ 6 */
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define O_RDONLY _O_RDONLY
|
||||
#define O_BINARY _O_BINARY
|
||||
#define O_CREAT _O_CREAT
|
||||
#define O_WRONLY _O_WRONLY
|
||||
#define O_TRUNC _O_TRUNC
|
||||
#define S_IREAD _S_IREAD
|
||||
#define S_IWRITE _S_IWRITE
|
||||
#define S_IFDIR _S_IFDIR
|
||||
|
||||
/* Eliminate warnings for "old" (non-secure) versions of clib functions */
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
|
@ -217,11 +193,11 @@
|
|||
|
||||
/* Do not maintain the architecture specific stuffs for the EFI ports */
|
||||
|
||||
#if !defined(_EDK2_EFI) && !defined(_GNU_EFI)
|
||||
#ifndef _LINT
|
||||
#if defined(__i386__) && !defined(_GNU_EFI) && !defined(_EDK2_EFI)
|
||||
/*
|
||||
* Math helper functions
|
||||
*/
|
||||
#ifndef ACPI_DIV_64_BY_32
|
||||
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
|
||||
{ \
|
||||
__asm mov edx, n_hi \
|
||||
|
@ -230,27 +206,53 @@
|
|||
__asm mov q32, eax \
|
||||
__asm mov r32, edx \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_MUL_64_BY_32
|
||||
#define ACPI_MUL_64_BY_32(n_hi, n_lo, m32, p32, c32) \
|
||||
{ \
|
||||
__asm mov edx, n_hi \
|
||||
__asm mov eax, n_lo \
|
||||
__asm mul m32 \
|
||||
__asm mov p32, eax \
|
||||
__asm mov c32, edx \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_SHIFT_LEFT_64_BY_32
|
||||
#define ACPI_SHIFT_LEFT_64_BY_32(n_hi, n_lo, s32) \
|
||||
{ \
|
||||
__asm mov edx, n_hi \
|
||||
__asm mov eax, n_lo \
|
||||
__asm mov ecx, s32 \
|
||||
__asm and ecx, 31 \
|
||||
__asm shld edx, eax, cl \
|
||||
__asm shl eax, cl \
|
||||
__asm mov n_hi, edx \
|
||||
__asm mov n_lo, eax \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_SHIFT_RIGHT_64_BY_32
|
||||
#define ACPI_SHIFT_RIGHT_64_BY_32(n_hi, n_lo, s32) \
|
||||
{ \
|
||||
__asm mov edx, n_hi \
|
||||
__asm mov eax, n_lo \
|
||||
__asm mov ecx, s32 \
|
||||
__asm and ecx, 31 \
|
||||
__asm shrd eax, edx, cl \
|
||||
__asm shr edx, cl \
|
||||
__asm mov n_hi, edx \
|
||||
__asm mov n_lo, eax \
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef ACPI_SHIFT_RIGHT_64
|
||||
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
|
||||
{ \
|
||||
__asm shr n_hi, 1 \
|
||||
__asm rcr n_lo, 1 \
|
||||
}
|
||||
#else
|
||||
|
||||
/* Fake versions to make lint happy */
|
||||
|
||||
#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
|
||||
{ \
|
||||
q32 = n_hi / d32; \
|
||||
r32 = n_lo / d32; \
|
||||
}
|
||||
|
||||
#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
|
||||
{ \
|
||||
n_hi >>= 1; \
|
||||
n_lo >>= 1; \
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
#define asm __asm
|
||||
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
|
||||
#define ACPI_SYSTEM_XFACE
|
||||
#define ACPI_EXTERNAL_XFACE
|
||||
|
@ -215,5 +216,6 @@
|
|||
/* Always use NetBSD code over our local versions */
|
||||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
|
||||
#endif /* __ACNETBSD_H__ */
|
||||
|
|
|
@ -164,6 +164,7 @@
|
|||
#define COMPILER_DEPENDENT_INT64 long long
|
||||
#define COMPILER_DEPENDENT_UINT64 unsigned long long
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
|
||||
#define ACPI_SYSTEM_XFACE APIENTRY
|
||||
#define ACPI_EXTERNAL_XFACE APIENTRY
|
||||
|
|
|
@ -174,5 +174,6 @@
|
|||
#define __cdecl
|
||||
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
|
||||
#endif /* __ACQNX_H__ */
|
||||
|
|
|
@ -156,6 +156,8 @@
|
|||
#define ACPI_USE_SYSTEM_CLIBRARY
|
||||
|
||||
#define ACPI_MACHINE_WIDTH 32
|
||||
#define ACPI_USE_NATIVE_DIVIDE
|
||||
#define ACPI_USE_NATIVE_MATH64
|
||||
|
||||
#ifdef ACPI_DEFINE_ALTERNATE_TYPES
|
||||
/*
|
||||
|
@ -170,6 +172,30 @@ typedef unsigned int u32;
|
|||
typedef COMPILER_DEPENDENT_UINT64 u64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Map low I/O functions for MS. This allows us to disable MS language
|
||||
* extensions for maximum portability.
|
||||
*/
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define write _write
|
||||
#define close _close
|
||||
#define stat _stat
|
||||
#define fstat _fstat
|
||||
#define mkdir _mkdir
|
||||
#define snprintf _snprintf
|
||||
#if _MSC_VER <= 1200 /* Versions below VC++ 6 */
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define O_RDONLY _O_RDONLY
|
||||
#define O_BINARY _O_BINARY
|
||||
#define O_CREAT _O_CREAT
|
||||
#define O_WRONLY _O_WRONLY
|
||||
#define O_TRUNC _O_TRUNC
|
||||
#define S_IREAD _S_IREAD
|
||||
#define S_IWRITE _S_IWRITE
|
||||
#define S_IFDIR _S_IFDIR
|
||||
|
||||
|
||||
/*
|
||||
* Handle platform- and compiler-specific assembly language differences.
|
||||
|
|
|
@ -157,6 +157,30 @@
|
|||
|
||||
#define ACPI_MACHINE_WIDTH 64
|
||||
|
||||
/*
|
||||
* Map low I/O functions for MS. This allows us to disable MS language
|
||||
* extensions for maximum portability.
|
||||
*/
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define write _write
|
||||
#define close _close
|
||||
#define stat _stat
|
||||
#define fstat _fstat
|
||||
#define mkdir _mkdir
|
||||
#define snprintf _snprintf
|
||||
#if _MSC_VER <= 1200 /* Versions below VC++ 6 */
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
#define O_RDONLY _O_RDONLY
|
||||
#define O_BINARY _O_BINARY
|
||||
#define O_CREAT _O_CREAT
|
||||
#define O_WRONLY _O_WRONLY
|
||||
#define O_TRUNC _O_TRUNC
|
||||
#define S_IREAD _S_IREAD
|
||||
#define S_IWRITE _S_IWRITE
|
||||
#define S_IFDIR _S_IFDIR
|
||||
|
||||
/*
|
||||
* Handle platform- and compiler-specific assembly language differences.
|
||||
*
|
||||
|
|
|
@ -621,7 +621,7 @@ WaitKey:
|
|||
break;
|
||||
}
|
||||
}
|
||||
Length = Pos;
|
||||
Length = (int) Pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -641,7 +641,7 @@ WaitKey:
|
|||
Length = -EIO;
|
||||
goto ErrorExit;
|
||||
}
|
||||
Length = ReadSize;
|
||||
Length = (int) ReadSize;
|
||||
}
|
||||
|
||||
ErrorExit:
|
||||
|
@ -720,7 +720,7 @@ fwrite (
|
|||
const char *Ascii;
|
||||
CHAR16 *End;
|
||||
CHAR16 *Pos;
|
||||
int i, j;
|
||||
ACPI_SIZE i, j;
|
||||
ACPI_EFI_FILE_HANDLE EfiFile;
|
||||
UINTN WriteSize;
|
||||
ACPI_EFI_STATUS EfiStatus;
|
||||
|
@ -773,7 +773,7 @@ fwrite (
|
|||
errno = EIO;
|
||||
goto ErrorExit;
|
||||
}
|
||||
Length = WriteSize;
|
||||
Length = (int) WriteSize;
|
||||
}
|
||||
|
||||
ErrorExit:
|
||||
|
@ -926,7 +926,7 @@ fseek (
|
|||
{
|
||||
return (Error);
|
||||
}
|
||||
Size = Info->FileSize;
|
||||
Size = (ACPI_SIZE) (Info->FileSize);
|
||||
AcpiOsFree (Info);
|
||||
|
||||
if (From == SEEK_CUR)
|
||||
|
@ -1229,6 +1229,7 @@ efi_main (
|
|||
|
||||
ST = SystemTab;
|
||||
BS = SystemTab->BootServices;
|
||||
RT = SystemTab->RuntimeServices;
|
||||
stdin = ACPI_CAST_PTR (ACPI_EFI_FILE, SystemTab->ConIn);
|
||||
stdout = ACPI_CAST_PTR (ACPI_EFI_FILE, SystemTab->ConOut);
|
||||
stderr = ACPI_CAST_PTR (ACPI_EFI_FILE, SystemTab->ConOut);
|
||||
|
@ -1289,10 +1290,6 @@ ErrorAlloc:
|
|||
}
|
||||
|
||||
#ifdef _EDK2_EFI
|
||||
struct _ACPI_EFI_SYSTEM_TABLE *ST;
|
||||
struct _ACPI_EFI_BOOT_SERVICES *BS;
|
||||
struct _ACPI_EFI_RUNTIME_SERVICES *RT;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UefiMain (
|
||||
|
|
|
@ -184,7 +184,7 @@ OslAddTableToList (
|
|||
|
||||
static ACPI_STATUS
|
||||
OslMapTable (
|
||||
ACPI_SIZE Address,
|
||||
ACPI_PHYSICAL_ADDRESS Address,
|
||||
char *Signature,
|
||||
ACPI_TABLE_HEADER **Table);
|
||||
|
||||
|
@ -544,7 +544,7 @@ OslLoadRsdp (
|
|||
/* Search low memory for the RSDP */
|
||||
|
||||
MappedTable = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
|
||||
AcpiTbScanMemoryForRsdp (RsdpAddress, RsdpSize));
|
||||
AcpiTbScanMemoryForRsdp (RsdpAddress, (UINT32) RsdpSize));
|
||||
if (!MappedTable)
|
||||
{
|
||||
AcpiOsUnmapMemory (RsdpAddress, RsdpSize);
|
||||
|
@ -782,7 +782,7 @@ OslListTables (
|
|||
|
||||
/* Skip NULL entries in RSDT/XSDT */
|
||||
|
||||
if (!TableAddress)
|
||||
if (TableAddress == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -835,7 +835,8 @@ OslGetTable (
|
|||
UINT8 NumberOfTables;
|
||||
UINT8 ItemSize;
|
||||
UINT32 CurrentInstance = 0;
|
||||
ACPI_PHYSICAL_ADDRESS TableAddress = 0;
|
||||
ACPI_PHYSICAL_ADDRESS TableAddress;
|
||||
ACPI_PHYSICAL_ADDRESS FirstTableAddress = 0;
|
||||
UINT32 TableLength = 0;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT32 i;
|
||||
|
@ -849,6 +850,11 @@ OslGetTable (
|
|||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) ||
|
||||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
|
||||
{
|
||||
|
||||
FindNextInstance:
|
||||
|
||||
TableAddress = 0;
|
||||
|
||||
/*
|
||||
* Get the appropriate address, either 32-bit or 64-bit. Be very
|
||||
* careful about the FADT length and validate table addresses.
|
||||
|
@ -856,28 +862,34 @@ OslGetTable (
|
|||
*/
|
||||
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
|
||||
{
|
||||
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XDSDT) &&
|
||||
Gbl_Fadt->XDsdt)
|
||||
if (CurrentInstance < 2)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XDsdt;
|
||||
}
|
||||
else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_DSDT) &&
|
||||
Gbl_Fadt->Dsdt)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Dsdt;
|
||||
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XDSDT) &&
|
||||
Gbl_Fadt->XDsdt && CurrentInstance == 0)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XDsdt;
|
||||
}
|
||||
else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_DSDT) &&
|
||||
Gbl_Fadt->Dsdt != FirstTableAddress)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Dsdt;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
|
||||
{
|
||||
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XFACS) &&
|
||||
Gbl_Fadt->XFacs)
|
||||
if (CurrentInstance < 2)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XFacs;
|
||||
}
|
||||
else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_FACS) &&
|
||||
Gbl_Fadt->Facs)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Facs;
|
||||
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XFACS) &&
|
||||
Gbl_Fadt->XFacs && CurrentInstance == 0)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XFacs;
|
||||
}
|
||||
else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_FACS) &&
|
||||
Gbl_Fadt->Facs != FirstTableAddress)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Facs;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_XSDT))
|
||||
|
@ -886,16 +898,32 @@ OslGetTable (
|
|||
{
|
||||
return (AE_BAD_SIGNATURE);
|
||||
}
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.XsdtPhysicalAddress;
|
||||
if (CurrentInstance == 0)
|
||||
{
|
||||
TableAddress =
|
||||
(ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.XsdtPhysicalAddress;
|
||||
}
|
||||
}
|
||||
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDT))
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.RsdtPhysicalAddress;
|
||||
if (CurrentInstance == 0)
|
||||
{
|
||||
TableAddress =
|
||||
(ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.RsdtPhysicalAddress;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_RsdpAddress;
|
||||
Signature = ACPI_SIG_RSDP;
|
||||
if (CurrentInstance == 0)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_RsdpAddress;
|
||||
Signature = ACPI_SIG_RSDP;
|
||||
}
|
||||
}
|
||||
|
||||
if (TableAddress == 0)
|
||||
{
|
||||
goto ExitFindTable;
|
||||
}
|
||||
|
||||
/* Now we can get the requested special table */
|
||||
|
@ -907,6 +935,20 @@ OslGetTable (
|
|||
}
|
||||
|
||||
TableLength = ApGetTableLength (MappedTable);
|
||||
if (FirstTableAddress == 0)
|
||||
{
|
||||
FirstTableAddress = TableAddress;
|
||||
}
|
||||
|
||||
/* Match table instance */
|
||||
|
||||
if (CurrentInstance != Instance)
|
||||
{
|
||||
OslUnmapTable (MappedTable);
|
||||
MappedTable = NULL;
|
||||
CurrentInstance++;
|
||||
goto FindNextInstance;
|
||||
}
|
||||
}
|
||||
else /* Case for a normal ACPI table */
|
||||
{
|
||||
|
@ -944,7 +986,7 @@ OslGetTable (
|
|||
|
||||
/* Skip NULL entries in RSDT/XSDT */
|
||||
|
||||
if (!TableAddress)
|
||||
if (TableAddress == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -979,6 +1021,8 @@ OslGetTable (
|
|||
}
|
||||
}
|
||||
|
||||
ExitFindTable:
|
||||
|
||||
if (!MappedTable)
|
||||
{
|
||||
return (AE_LIMIT);
|
||||
|
@ -1028,7 +1072,7 @@ Exit:
|
|||
|
||||
static ACPI_STATUS
|
||||
OslMapTable (
|
||||
ACPI_SIZE Address,
|
||||
ACPI_PHYSICAL_ADDRESS Address,
|
||||
char *Signature,
|
||||
ACPI_TABLE_HEADER **Table)
|
||||
{
|
||||
|
|
|
@ -173,6 +173,15 @@ AcpiEfiGetPciDev (
|
|||
ACPI_PCI_ID *PciId);
|
||||
|
||||
|
||||
/* Global variables */
|
||||
|
||||
#ifdef _EDK2_EFI
|
||||
struct _ACPI_EFI_SYSTEM_TABLE *ST;
|
||||
struct _ACPI_EFI_BOOT_SERVICES *BS;
|
||||
struct _ACPI_EFI_RUNTIME_SERVICES *RT;
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiEfiGetRsdpViaGuid
|
||||
|
@ -225,7 +234,7 @@ AcpiEfiGetRsdpViaGuid (
|
|||
ACPI_EFI_GUID *Guid)
|
||||
{
|
||||
ACPI_PHYSICAL_ADDRESS Address = 0;
|
||||
int i;
|
||||
UINTN i;
|
||||
|
||||
|
||||
for (i = 0; i < ST->NumberOfTableEntries; i++)
|
||||
|
@ -273,6 +282,36 @@ AcpiOsGetRootPointer (
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsPredefinedOverride
|
||||
*
|
||||
* PARAMETERS: InitVal - Initial value of the predefined object
|
||||
* NewVal - The new value for the object
|
||||
*
|
||||
* RETURN: Status, pointer to value. Null pointer returned if not
|
||||
* overriding.
|
||||
*
|
||||
* DESCRIPTION: Allow the OS to override predefined names
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsPredefinedOverride (
|
||||
const ACPI_PREDEFINED_NAMES *InitVal,
|
||||
ACPI_STRING *NewVal)
|
||||
{
|
||||
|
||||
if (!InitVal || !NewVal)
|
||||
{
|
||||
return (AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
*NewVal = NULL;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsMapMemory
|
||||
|
@ -322,7 +361,7 @@ AcpiOsUnmapMemory (
|
|||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: Spinlock interfaces
|
||||
* FUNCTION: Single threaded stub interfaces
|
||||
*
|
||||
* DESCRIPTION: No-op on single threaded BIOS
|
||||
*
|
||||
|
@ -355,6 +394,232 @@ AcpiOsReleaseLock (
|
|||
{
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsCreateSemaphore (
|
||||
UINT32 MaxUnits,
|
||||
UINT32 InitialUnits,
|
||||
ACPI_HANDLE *OutHandle)
|
||||
{
|
||||
*OutHandle = (ACPI_HANDLE) 1;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsDeleteSemaphore (
|
||||
ACPI_HANDLE Handle)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsWaitSemaphore (
|
||||
ACPI_HANDLE Handle,
|
||||
UINT32 Units,
|
||||
UINT16 Timeout)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsSignalSemaphore (
|
||||
ACPI_HANDLE Handle,
|
||||
UINT32 Units)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
ACPI_THREAD_ID
|
||||
AcpiOsGetThreadId (
|
||||
void)
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsExecute (
|
||||
ACPI_EXECUTE_TYPE Type,
|
||||
ACPI_OSD_EXEC_CALLBACK Function,
|
||||
void *Context)
|
||||
{
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
void
|
||||
AcpiOsWaitEventsComplete (
|
||||
void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsInstallInterruptHandler
|
||||
*
|
||||
* PARAMETERS: InterruptNumber - Level handler should respond to.
|
||||
* ServiceRoutine - Address of the ACPI interrupt handler
|
||||
* Context - Where status is returned
|
||||
*
|
||||
* RETURN: Handle to the newly installed handler.
|
||||
*
|
||||
* DESCRIPTION: Install an interrupt handler. Used to install the ACPI
|
||||
* OS-independent handler.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
UINT32
|
||||
AcpiOsInstallInterruptHandler (
|
||||
UINT32 InterruptNumber,
|
||||
ACPI_OSD_HANDLER ServiceRoutine,
|
||||
void *Context)
|
||||
{
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsRemoveInterruptHandler
|
||||
*
|
||||
* PARAMETERS: InterruptNumber - Level handler should respond to.
|
||||
* ServiceRoutine - Address of the ACPI interrupt handler
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Uninstalls an interrupt handler.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsRemoveInterruptHandler (
|
||||
UINT32 InterruptNumber,
|
||||
ACPI_OSD_HANDLER ServiceRoutine)
|
||||
{
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsGetTimer
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Current time in 100 nanosecond units
|
||||
*
|
||||
* DESCRIPTION: Get the current system time
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
UINT64
|
||||
AcpiOsGetTimer (
|
||||
void)
|
||||
{
|
||||
ACPI_EFI_STATUS EfiStatus;
|
||||
ACPI_EFI_TIME EfiTime;
|
||||
int Year, Month, Day;
|
||||
int Hour, Minute, Second;
|
||||
UINT64 Timer;
|
||||
|
||||
|
||||
EfiStatus = uefi_call_wrapper (RT->GetTime, 2, &EfiTime, NULL);
|
||||
if (ACPI_EFI_ERROR (EfiStatus))
|
||||
{
|
||||
return ((UINT64) -1);
|
||||
}
|
||||
|
||||
Year = EfiTime.Year;
|
||||
Month = EfiTime.Month;
|
||||
Day = EfiTime.Day;
|
||||
Hour = EfiTime.Hour;
|
||||
Minute = EfiTime.Minute;
|
||||
Second = EfiTime.Second;
|
||||
|
||||
/* 1..12 -> 11,12,1..10 */
|
||||
|
||||
if (0 >= (int) (Month -= 2))
|
||||
{
|
||||
/* Feb has leap days */
|
||||
|
||||
Month += 12;
|
||||
Year -= 1;
|
||||
}
|
||||
|
||||
/* Calculate days */
|
||||
|
||||
Timer = ((UINT64) (Year/4 - Year/100 + Year/400 + 367*Month/12 + Day) +
|
||||
Year*365 - 719499);
|
||||
|
||||
/* Calculate seconds */
|
||||
|
||||
(void) AcpiUtShortMultiply (Timer, 24, &Timer);
|
||||
Timer += Hour;
|
||||
(void) AcpiUtShortMultiply (Timer, 60, &Timer);
|
||||
Timer += Minute;
|
||||
(void) AcpiUtShortMultiply (Timer, 60, &Timer);
|
||||
Timer += Second;
|
||||
|
||||
/* Calculate 100 nanoseconds */
|
||||
|
||||
(void) AcpiUtShortMultiply (Timer, ACPI_100NSEC_PER_SEC, &Timer);
|
||||
return (Timer + (EfiTime.Nanosecond / 100));
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsStall
|
||||
*
|
||||
* PARAMETERS: microseconds - Time to sleep
|
||||
*
|
||||
* RETURN: Blocks until sleep is completed.
|
||||
*
|
||||
* DESCRIPTION: Sleep at microsecond granularity
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
AcpiOsStall (
|
||||
UINT32 microseconds)
|
||||
{
|
||||
|
||||
if (microseconds)
|
||||
{
|
||||
uefi_call_wrapper (BS->Stall, 1, microseconds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsSleep
|
||||
*
|
||||
* PARAMETERS: milliseconds - Time to sleep
|
||||
*
|
||||
* RETURN: Blocks until sleep is completed.
|
||||
*
|
||||
* DESCRIPTION: Sleep at millisecond granularity
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void
|
||||
AcpiOsSleep (
|
||||
UINT64 milliseconds)
|
||||
{
|
||||
UINT64 microseconds;
|
||||
|
||||
|
||||
AcpiUtShortMultiply (milliseconds, ACPI_USEC_PER_MSEC, µseconds);
|
||||
while (microseconds > ACPI_UINT32_MAX)
|
||||
{
|
||||
AcpiOsStall (ACPI_UINT32_MAX);
|
||||
microseconds -= ACPI_UINT32_MAX;
|
||||
}
|
||||
AcpiOsStall ((UINT32) microseconds);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
@ -492,13 +757,13 @@ AcpiOsVprintf (
|
|||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsInitialize
|
||||
* FUNCTION: AcpiOsInitialize, AcpiOsTerminate
|
||||
*
|
||||
* PARAMETERS: None
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Initialize this module.
|
||||
* DESCRIPTION: Initialize/terminate this module.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -510,6 +775,100 @@ AcpiOsInitialize (
|
|||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsTerminate (
|
||||
void)
|
||||
{
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsSignal
|
||||
*
|
||||
* PARAMETERS: Function - ACPI A signal function code
|
||||
* Info - Pointer to function-dependent structure
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Miscellaneous functions. Example implementation only.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiOsSignal (
|
||||
UINT32 Function,
|
||||
void *Info)
|
||||
{
|
||||
|
||||
switch (Function)
|
||||
{
|
||||
case ACPI_SIGNAL_FATAL:
|
||||
|
||||
break;
|
||||
|
||||
case ACPI_SIGNAL_BREAKPOINT:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsReadable
|
||||
*
|
||||
* PARAMETERS: Pointer - Area to be verified
|
||||
* Length - Size of area
|
||||
*
|
||||
* RETURN: TRUE if readable for entire length
|
||||
*
|
||||
* DESCRIPTION: Verify that a pointer is valid for reading
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiOsReadable (
|
||||
void *Pointer,
|
||||
ACPI_SIZE Length)
|
||||
{
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsWritable
|
||||
*
|
||||
* PARAMETERS: Pointer - Area to be verified
|
||||
* Length - Size of area
|
||||
*
|
||||
* RETURN: TRUE if writable for entire length
|
||||
*
|
||||
* DESCRIPTION: Verify that a pointer is valid for writing
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
BOOLEAN
|
||||
AcpiOsWritable (
|
||||
void *Pointer,
|
||||
ACPI_SIZE Length)
|
||||
{
|
||||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AcpiOsReadPciConfiguration
|
||||
|
@ -704,3 +1063,26 @@ AcpiEfiGetPciDev (
|
|||
uefi_call_wrapper (BS->FreePool, 1, Handles);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
#if defined(_EDK2_EFI) && defined(USE_STDLIB)
|
||||
extern EFI_RUNTIME_SERVICES *gRT;
|
||||
extern EFI_BOOT_SERVICES *gBS;
|
||||
extern EFI_SYSTEM_TABLE *gST;
|
||||
|
||||
int ACPI_SYSTEM_XFACE
|
||||
main (
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
int Error;
|
||||
|
||||
|
||||
ST = ACPI_CAST_PTR (ACPI_EFI_SYSTEM_TABLE, gST);
|
||||
BS = ACPI_CAST_PTR (ACPI_EFI_BOOT_SERVICES, gBS);
|
||||
RT = ACPI_CAST_PTR (ACPI_EFI_RUNTIME_SERVICES, gRT);
|
||||
|
||||
Error = acpi_main (argc, argv);
|
||||
return (Error);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -988,7 +988,7 @@ OslListBiosTables (
|
|||
|
||||
/* Skip NULL entries in RSDT/XSDT */
|
||||
|
||||
if (!TableAddress)
|
||||
if (TableAddress == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1041,7 +1041,8 @@ OslGetBiosTable (
|
|||
UINT8 NumberOfTables;
|
||||
UINT8 ItemSize;
|
||||
UINT32 CurrentInstance = 0;
|
||||
ACPI_PHYSICAL_ADDRESS TableAddress = 0;
|
||||
ACPI_PHYSICAL_ADDRESS TableAddress;
|
||||
ACPI_PHYSICAL_ADDRESS FirstTableAddress = 0;
|
||||
UINT32 TableLength = 0;
|
||||
ACPI_STATUS Status = AE_OK;
|
||||
UINT32 i;
|
||||
|
@ -1055,10 +1056,10 @@ OslGetBiosTable (
|
|||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) ||
|
||||
ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
|
||||
{
|
||||
if (Instance > 0)
|
||||
{
|
||||
return (AE_LIMIT);
|
||||
}
|
||||
|
||||
FindNextInstance:
|
||||
|
||||
TableAddress = 0;
|
||||
|
||||
/*
|
||||
* Get the appropriate address, either 32-bit or 64-bit. Be very
|
||||
|
@ -1067,28 +1068,34 @@ OslGetBiosTable (
|
|||
*/
|
||||
if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT))
|
||||
{
|
||||
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XDSDT) &&
|
||||
Gbl_Fadt->XDsdt)
|
||||
if (CurrentInstance < 2)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XDsdt;
|
||||
}
|
||||
else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_DSDT) &&
|
||||
Gbl_Fadt->Dsdt)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Dsdt;
|
||||
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XDSDT) &&
|
||||
Gbl_Fadt->XDsdt && CurrentInstance == 0)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XDsdt;
|
||||
}
|
||||
else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_DSDT) &&
|
||||
Gbl_Fadt->Dsdt != FirstTableAddress)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Dsdt;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
|
||||
{
|
||||
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XFACS) &&
|
||||
Gbl_Fadt->XFacs)
|
||||
if (CurrentInstance < 2)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XFacs;
|
||||
}
|
||||
else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_FACS) &&
|
||||
Gbl_Fadt->Facs)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Facs;
|
||||
if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XFACS) &&
|
||||
Gbl_Fadt->XFacs && CurrentInstance == 0)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XFacs;
|
||||
}
|
||||
else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_FACS) &&
|
||||
Gbl_Fadt->Facs != FirstTableAddress)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Facs;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_XSDT))
|
||||
|
@ -1097,16 +1104,32 @@ OslGetBiosTable (
|
|||
{
|
||||
return (AE_BAD_SIGNATURE);
|
||||
}
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.XsdtPhysicalAddress;
|
||||
if (CurrentInstance == 0)
|
||||
{
|
||||
TableAddress =
|
||||
(ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.XsdtPhysicalAddress;
|
||||
}
|
||||
}
|
||||
else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDT))
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.RsdtPhysicalAddress;
|
||||
if (CurrentInstance == 0)
|
||||
{
|
||||
TableAddress =
|
||||
(ACPI_PHYSICAL_ADDRESS) Gbl_Rsdp.RsdtPhysicalAddress;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_RsdpAddress;
|
||||
Signature = ACPI_SIG_RSDP;
|
||||
if (CurrentInstance == 0)
|
||||
{
|
||||
TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_RsdpAddress;
|
||||
Signature = ACPI_SIG_RSDP;
|
||||
}
|
||||
}
|
||||
|
||||
if (TableAddress == 0)
|
||||
{
|
||||
goto ExitFindTable;
|
||||
}
|
||||
|
||||
/* Now we can get the requested special table */
|
||||
|
@ -1118,6 +1141,20 @@ OslGetBiosTable (
|
|||
}
|
||||
|
||||
TableLength = ApGetTableLength (MappedTable);
|
||||
if (FirstTableAddress == 0)
|
||||
{
|
||||
FirstTableAddress = TableAddress;
|
||||
}
|
||||
|
||||
/* Match table instance */
|
||||
|
||||
if (CurrentInstance != Instance)
|
||||
{
|
||||
OslUnmapTable (MappedTable);
|
||||
MappedTable = NULL;
|
||||
CurrentInstance++;
|
||||
goto FindNextInstance;
|
||||
}
|
||||
}
|
||||
else /* Case for a normal ACPI table */
|
||||
{
|
||||
|
@ -1155,7 +1192,7 @@ OslGetBiosTable (
|
|||
|
||||
/* Skip NULL entries in RSDT/XSDT */
|
||||
|
||||
if (!TableAddress)
|
||||
if (TableAddress == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1190,6 +1227,8 @@ OslGetBiosTable (
|
|||
}
|
||||
}
|
||||
|
||||
ExitFindTable:
|
||||
|
||||
if (!MappedTable)
|
||||
{
|
||||
return (AE_LIMIT);
|
||||
|
|
|
@ -175,7 +175,7 @@ static int
|
|||
ApIsExistingFile (
|
||||
char *Pathname)
|
||||
{
|
||||
#ifndef _GNU_EFI
|
||||
#if !defined(_GNU_EFI) && !defined(_EDK2_EFI)
|
||||
struct stat StatInfo;
|
||||
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ ApDoOptions (
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _GNU_EFI
|
||||
#if !defined(_GNU_EFI) && !defined(_EDK2_EFI)
|
||||
int ACPI_SYSTEM_XFACE
|
||||
main (
|
||||
int argc,
|
||||
|
|
|
@ -169,7 +169,7 @@ static char LineBuffer[LINE_SIZE];
|
|||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _GNU_EFI
|
||||
#if !defined(_GNU_EFI) && !defined(_EDK2_EFI)
|
||||
int ACPI_SYSTEM_XFACE
|
||||
main (
|
||||
int argc,
|
||||
|
|
Loading…
Reference in New Issue