iASL/tools: Lint changes.

For acpiexec, also add additional error checking in the utility
itself.
This commit is contained in:
Robert Moore 2010-09-03 09:54:53 -07:00
parent 0845205248
commit 5642c304e4
28 changed files with 417 additions and 298 deletions

View File

@ -126,13 +126,13 @@
/* Local prototypes */
INT32
static INT32
AdWriteBuffer (
char *Filename,
char *Buffer,
UINT32 Length);
char FilenameBuf[20];
static char FilenameBuf[20];
/******************************************************************************
@ -190,7 +190,7 @@ AdGenerateFilename (
*
******************************************************************************/
INT32
static INT32
AdWriteBuffer (
char *Filename,
char *Buffer,

View File

@ -147,18 +147,18 @@ LsSetupNsList (
/* Local prototypes */
void
static void
AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table);
ACPI_STATUS
static ACPI_STATUS
AdDeferredParse (
ACPI_PARSE_OBJECT *Op,
UINT8 *Aml,
UINT32 AmlLength);
ACPI_STATUS
static ACPI_STATUS
AdParseDeferredOps (
ACPI_PARSE_OBJECT *Root);
@ -634,7 +634,7 @@ AdDisassemblerHeader (
*
*****************************************************************************/
void
static void
AdCreateTableHeader (
char *Filename,
ACPI_TABLE_HEADER *Table)
@ -781,7 +781,7 @@ AdDisplayTables (
*
*****************************************************************************/
ACPI_STATUS
static ACPI_STATUS
AdDeferredParse (
ACPI_PARSE_OBJECT *Op,
UINT8 *Aml,
@ -904,7 +904,7 @@ AdDeferredParse (
*
*****************************************************************************/
ACPI_STATUS
static ACPI_STATUS
AdParseDeferredOps (
ACPI_PARSE_OBJECT *Root)
{

View File

@ -792,6 +792,7 @@ AcpiDmXrefDescendingOp (
ACPI_PARSE_OBJECT *NextOp;
ACPI_NAMESPACE_NODE *Node;
ACPI_OPERAND_OBJECT *Object;
UINT32 ParamCount = 0;
WalkState = Info->WalkState;
@ -880,18 +881,13 @@ AcpiDmXrefDescendingOp (
if (Object)
{
ObjectType2 = Object->Common.Type;
if (ObjectType2 == ACPI_TYPE_METHOD)
{
ParamCount = Object->Method.ParamCount;
}
}
if (ObjectType2 == ACPI_TYPE_METHOD)
{
AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_METHOD,
Object->Method.ParamCount);
}
else
{
AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, 0);
}
AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType2, ParamCount);
Op->Common.Node = Node;
}
else

View File

@ -704,8 +704,8 @@ AcpiDmUpdateResourceName (
Name[0] = '_';
Name[1] = AcpiGbl_Prefix[AcpiGbl_NextPrefix];
Name[2] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 4);
Name[3] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 0);
Name[2] = AcpiUtHexToAsciiChar ((UINT64) AcpiGbl_NextResourceId, 4);
Name[3] = AcpiUtHexToAsciiChar ((UINT64) AcpiGbl_NextResourceId, 0);
/* Update globals for next name */

View File

@ -126,7 +126,6 @@
int AcpiGbl_Opterr = 1;
int AcpiGbl_Optind = 1;
int AcpiGbl_Optopt;
char *AcpiGbl_Optarg;
@ -171,9 +170,7 @@ AcpiGetopt(
/* Get the option */
CurrentChar =
AcpiGbl_Optopt =
argv[AcpiGbl_Optind][CurrentCharPtr];
CurrentChar = argv[AcpiGbl_Optind][CurrentCharPtr];
/* Make sure that the option is legal */

View File

@ -166,7 +166,7 @@ static UINT32
AnGetInternalMethodReturnType (
ACPI_PARSE_OBJECT *Op);
BOOLEAN
static BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op);
@ -1754,7 +1754,7 @@ AnOperandTypecheckWalkEnd (
*
******************************************************************************/
BOOLEAN
static BOOLEAN
AnIsResultUsed (
ACPI_PARSE_OBJECT *Op)
{
@ -1862,6 +1862,7 @@ AnOtherSemanticAnalysisWalkBegin (
if (Op->Asl.AmlOpcode == AML_DIVIDE_OP)
{
if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) &&
(PrevArgNode) &&
(PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO))
{
AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);

View File

@ -127,12 +127,12 @@ static void
CmFlushSourceCode (
void);
void
static void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
void
static void
FlConsumeNewComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status);
@ -345,7 +345,7 @@ CmFlushSourceCode (
*
******************************************************************************/
void
static void
FlConsumeAnsiComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status)
@ -389,7 +389,7 @@ FlConsumeAnsiComment (
}
void
static void
FlConsumeNewComment (
ASL_FILE_INFO *FileInfo,
ASL_FILE_STATUS *Status)

View File

@ -686,6 +686,10 @@ ACPI_STATUS
LsDisplayNamespace (
void);
void
LsSetupNsList (
void *Handle);
/*
* aslutils - common compiler utilites

View File

@ -122,7 +122,7 @@
/* Local prototypes */
FILE *
static FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
char *Filename);
@ -546,7 +546,7 @@ FlAddIncludeDirectory (
*
******************************************************************************/
FILE *
static FILE *
FlOpenIncludeWithPrefix (
char *PrefixDir,
char *Filename)

View File

@ -202,7 +202,7 @@ static void
LsDoHexOutputAsl (
void);
ACPI_STATUS
static ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@ -222,7 +222,7 @@ LsTreeWriteWalk (
*
******************************************************************************/
ACPI_STATUS
static ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,

View File

@ -180,11 +180,7 @@ LsDoOnePathname (
void *Context,
void **ReturnValue);
void
LsSetupNsList (
void *Handle);
ACPI_PARSE_OBJECT *
static ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op);
@ -623,7 +619,7 @@ LkObjectExists (
*
******************************************************************************/
ACPI_PARSE_OBJECT *
static ACPI_PARSE_OBJECT *
LkGetNameOp (
ACPI_PARSE_OBJECT *Op)
{

View File

@ -462,6 +462,7 @@ AslDoOptions (
BOOLEAN IsResponseFile)
{
int j;
ACPI_STATUS Status;
/* Get the command line options */
@ -554,7 +555,12 @@ AslDoOptions (
case 'e':
AcpiDmAddToExternalFileList (AcpiGbl_Optarg);
Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg);
if (ACPI_FAILURE (Status))
{
printf ("Could not add %s to external list\n", AcpiGbl_Optarg);
return (-1);
}
break;
@ -601,7 +607,6 @@ AslDoOptions (
printf ("Unknown option: -h%s\n", AcpiGbl_Optarg);
return (-1);
}
break;
case 'I': /* Add an include file search directory */
@ -891,6 +896,7 @@ AslCommandLine (
char **argv)
{
int BadCommandLine = 0;
ACPI_STATUS Status;
/* Minimum command line contains at least the command and an input file */
@ -908,7 +914,11 @@ AslCommandLine (
if (Gbl_DoTemplates)
{
DtCreateTemplates (Gbl_TemplateSignature);
Status = DtCreateTemplates (Gbl_TemplateSignature);
if (ACPI_FAILURE (Status))
{
exit (-1);
}
exit (1);
}

View File

@ -592,9 +592,9 @@ OpcDoEisaId (
/* Create ID big-endian first (bits are contiguous) */
BigEndianId =
(UINT32) (InString[0] - 0x40) << 26 |
(UINT32) (InString[1] - 0x40) << 21 |
(UINT32) (InString[2] - 0x40) << 16 |
(UINT32) ((UINT8) (InString[0] - 0x40)) << 26 |
(UINT32) ((UINT8) (InString[1] - 0x40)) << 21 |
(UINT32) ((UINT8) (InString[2] - 0x40)) << 16 |
(UtHexCharToValue (InString[3])) << 12 |
(UtHexCharToValue (InString[4])) << 8 |

View File

@ -117,8 +117,6 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"
#include "acparser.h"
#include "acpredef.h"

View File

@ -224,7 +224,6 @@ RsDoMemory24Descriptor (
ACPI_PARSE_OBJECT *MinOp = NULL;
ACPI_PARSE_OBJECT *MaxOp = NULL;
ACPI_PARSE_OBJECT *LengthOp = NULL;
ACPI_PARSE_OBJECT *AlignOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
@ -270,7 +269,6 @@ RsDoMemory24Descriptor (
Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
AlignOp = InitializerOp;
break;
case 4: /* Length */

View File

@ -347,10 +347,10 @@ RsDoDwordIoDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
Descriptor->Address32.Minimum,
Descriptor->Address32.Maximum,
Descriptor->Address32.AddressLength,
Descriptor->Address32.Granularity,
(UINT64) Descriptor->Address32.Minimum,
(UINT64) Descriptor->Address32.Maximum,
(UINT64) Descriptor->Address32.AddressLength,
(UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);
@ -583,10 +583,10 @@ RsDoDwordMemoryDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
Descriptor->Address32.Minimum,
Descriptor->Address32.Maximum,
Descriptor->Address32.AddressLength,
Descriptor->Address32.Granularity,
(UINT64) Descriptor->Address32.Minimum,
(UINT64) Descriptor->Address32.Maximum,
(UINT64) Descriptor->Address32.AddressLength,
(UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);
@ -801,10 +801,10 @@ RsDoDwordSpaceDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
Descriptor->Address32.Minimum,
Descriptor->Address32.Maximum,
Descriptor->Address32.AddressLength,
Descriptor->Address32.Granularity,
(UINT64) Descriptor->Address32.Minimum,
(UINT64) Descriptor->Address32.Maximum,
(UINT64) Descriptor->Address32.AddressLength,
(UINT64) Descriptor->Address32.Granularity,
Descriptor->Address32.Flags,
MinOp, MaxOp, LengthOp, GranOp);

View File

@ -116,7 +116,6 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslrestype2e")

View File

@ -338,10 +338,10 @@ RsDoWordIoDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
Descriptor->Address16.Minimum,
Descriptor->Address16.Maximum,
Descriptor->Address16.AddressLength,
Descriptor->Address16.Granularity,
(UINT64) Descriptor->Address16.Minimum,
(UINT64) Descriptor->Address16.Maximum,
(UINT64) Descriptor->Address16.AddressLength,
(UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);
@ -544,10 +544,10 @@ RsDoWordBusNumberDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
Descriptor->Address16.Minimum,
Descriptor->Address16.Maximum,
Descriptor->Address16.AddressLength,
Descriptor->Address16.Granularity,
(UINT64) Descriptor->Address16.Minimum,
(UINT64) Descriptor->Address16.Maximum,
(UINT64) Descriptor->Address16.AddressLength,
(UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);
@ -761,10 +761,10 @@ RsDoWordSpaceDescriptor (
/* Validate the Min/Max/Len/Gran values */
RsLargeAddressCheck (
Descriptor->Address16.Minimum,
Descriptor->Address16.Maximum,
Descriptor->Address16.AddressLength,
Descriptor->Address16.Granularity,
(UINT64) Descriptor->Address16.Minimum,
(UINT64) Descriptor->Address16.Maximum,
(UINT64) Descriptor->Address16.AddressLength,
(UINT64) Descriptor->Address16.Granularity,
Descriptor->Address16.Flags,
MinOp, MaxOp, LengthOp, GranOp);

View File

@ -124,9 +124,8 @@
#define ASL_MAX_FILES 256
char *FileList[ASL_MAX_FILES];
int FileCount;
BOOLEAN AslToFile = TRUE;
static char *FileList[ASL_MAX_FILES];
static BOOLEAN AslToFile = TRUE;
/* Local prototypes */
@ -136,7 +135,7 @@ AsDoWildcard (
char *DirectoryPathname,
char *FileSpecifier);
UINT8
static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info);
@ -210,6 +209,7 @@ AsDoWildcard (
#ifdef WIN32
void *DirInfo;
char *Filename;
int FileCount;
FileCount = 0;
@ -277,7 +277,7 @@ AsDoWildcard (
*
******************************************************************************/
UINT8
static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info)
{
@ -397,7 +397,7 @@ AslDoOneFile (
/* Shutdown compiler and ACPICA subsystem */
AeClearErrorLog ();
AcpiTerminate ();
(void) AcpiTerminate ();
/*
* Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the
@ -487,7 +487,7 @@ AslDoOneFile (
}
Status = CmDoCompile ();
AcpiTerminate ();
(void) AcpiTerminate ();
/*
* Return non-zero exit code if there have been errors, unless the
@ -533,7 +533,7 @@ AslDoOnePathname (
ASL_PATHNAME_CALLBACK PathCallback)
{
ACPI_STATUS Status = AE_OK;
char **FileList;
char **WildcardList;
char *Filename;
char *FullPathname;
@ -548,16 +548,16 @@ AslDoOnePathname (
/* Expand possible wildcard into a file list (Windows/DOS only) */
FileList = AsDoWildcard (Gbl_DirectoryPath, Filename);
while (*FileList)
WildcardList = AsDoWildcard (Gbl_DirectoryPath, Filename);
while (*WildcardList)
{
FullPathname = ACPI_ALLOCATE (
strlen (Gbl_DirectoryPath) + strlen (*FileList) + 1);
strlen (Gbl_DirectoryPath) + strlen (*WildcardList) + 1);
/* Construct a full path to the file */
strcpy (FullPathname, Gbl_DirectoryPath);
strcat (FullPathname, *FileList);
strcat (FullPathname, *WildcardList);
/*
* If -p not specified, we will use the input filename as the
@ -573,9 +573,9 @@ AslDoOnePathname (
Status |= (*PathCallback) (FullPathname);
ACPI_FREE (FullPathname);
ACPI_FREE (*FileList);
*FileList = NULL;
FileList++;
ACPI_FREE (*WildcardList);
*WildcardList = NULL;
WildcardList++;
}
ACPI_FREE (Gbl_DirectoryPath);

View File

@ -127,7 +127,7 @@ static char VersionString[9];
/* Local prototypes */
static void
static ACPI_STATUS
DtInitialize (
void);
@ -166,7 +166,12 @@ DtDoCompile (
/* Initialize globals */
DtInitialize ();
Status = DtInitialize ();
if (ACPI_FAILURE (Status))
{
printf ("Error during compiler initialization, 0x%X\n", Status);
return (Status);
}
/*
* Scan the input file (file is already open) and
@ -236,26 +241,38 @@ CleanupAndExit:
*
* PARAMETERS: None
*
* RETURN: None
* RETURN: Status
*
* DESCRIPTION: Initialize data table compiler globals. Enables multiple
* compiles per invocation.
*
*****************************************************************************/
static void
static ACPI_STATUS
DtInitialize (
void)
{
ACPI_STATUS Status;
AcpiOsInitialize ();
AcpiUtInitGlobals ();
Status = AcpiOsInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = AcpiUtInitGlobals ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Gbl_FieldList = NULL;
Gbl_RootTable = NULL;
Gbl_SubtableStack = NULL;
sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
return (AE_OK);
}

View File

@ -158,7 +158,7 @@ DtWriteBinary (
#define DT_SLASH_SLASH_COMMENT 4
#define DT_END_COMMENT 5
UINT32 Gbl_NextLineOffset;
static UINT32 Gbl_NextLineOffset;
/******************************************************************************

View File

@ -116,16 +116,13 @@
#ifdef WIN32
#pragma warning(disable:4115) /* warning C4115: (caused by rpcasync.h) */
#include <windows.h>
#include <winbase.h>
#elif WIN64
#include <windowsx.h>
#endif
#include "acpi.h"
#include "accommon.h"
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME ("oswintbl")

View File

@ -139,6 +139,18 @@ extern FILE *AcpiGbl_DebugFile;
extern BOOLEAN AcpiGbl_IgnoreErrors;
extern UINT8 AcpiGbl_RegionFillValue;
/* Check for unexpected exceptions */
#define AE_CHECK_STATUS(Name, Status, Expected) \
if (Status != Expected) \
{ \
AcpiOsPrintf ("Unexpected %s from %s (%s-%d)\n", \
AcpiFormatException (Status), #Name, _AcpiModuleName, __LINE__); \
}
/* Check for unexpected non-AE_OK errors */
#define AE_CHECK_OK(Name, Status) AE_CHECK_STATUS (Name, Status, AE_OK);
typedef struct ae_table_desc
{
@ -173,7 +185,7 @@ typedef struct ae_debug_regions
#define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\
AcpiOsPrintf PARAM_LIST(fp);}
void __cdecl
void ACPI_SYSTEM_XFACE
AeCtrlCHandler (
int Sig);

View File

@ -120,39 +120,39 @@
/* Local prototypes */
ACPI_STATUS
static ACPI_STATUS
AeSetupConfiguration (
void *RegionAddr);
void
static void
AfInstallGpeBlock (
void);
void
static void
AeTestBufferArgument (
void);
void
static void
AeTestPackageArgument (
void);
ACPI_STATUS
static ACPI_STATUS
AeGetDevices (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
ACPI_STATUS
static ACPI_STATUS
ExecuteOSI (
char *OsiString,
UINT32 ExpectedResult);
void
static void
AeHardwareInterfaces (
void);
void
static void
AeGenericRegisters (
void);
@ -172,11 +172,10 @@ extern unsigned char Ssdt3Code[];
*
*****************************************************************************/
ACPI_STATUS
static ACPI_STATUS
AeSetupConfiguration (
void *RegionAddr)
{
ACPI_STATUS Status;
ACPI_OBJECT_LIST ArgList;
ACPI_OBJECT Arg[3];
@ -190,8 +189,7 @@ AeSetupConfiguration (
Arg[0].Type = ACPI_TYPE_INTEGER;
Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr);
Status = AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
(void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
return (AE_OK);
}
@ -209,7 +207,7 @@ AeSetupConfiguration (
*
*****************************************************************************/
void
static void
AfInstallGpeBlock (
void)
{
@ -235,33 +233,46 @@ AfInstallGpeBlock (
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 7, 8);
AE_CHECK_OK (AcpiInstallGpeBlock, Status);
AcpiInstallGpeHandler (Handle2, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiEnableGpe (Handle2, 8);
Status = AcpiInstallGpeHandler (Handle2, 8,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (Handle2, 8);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiGetGpeDevice (0x30, &GpeDevice);
Status = AcpiGetGpeDevice (0x42, &GpeDevice);
Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
AE_CHECK_OK (AcpiGetGpeDevice, Status);
AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
Status = AcpiGetGpeDevice (0x42, &GpeDevice);
AE_CHECK_OK (AcpiGetGpeDevice, Status);
Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice);
AE_CHECK_OK (AcpiGetGpeDevice, Status);
Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice);
AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST);
Status = AcpiRemoveGpeHandler (Handle2, 8, AeGpeHandler);
AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
}
Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
AE_CHECK_OK (AcpiInstallGpeBlock, Status);
}
}
/* Test using a Buffer object as a method argument */
void
static void
AeTestBufferArgument (
void)
{
ACPI_STATUS Status;
ACPI_OBJECT_LIST Params;
ACPI_OBJECT BufArg;
UINT8 Buffer[] = {
@ -277,26 +288,23 @@ AeTestBufferArgument (
Params.Count = 1;
Params.Pointer = &BufArg;
Status = AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
(void) AcpiEvaluateObject (NULL, "\\BUF", &Params, NULL);
}
ACPI_OBJECT PkgArg;
ACPI_OBJECT PkgElements[5];
ACPI_OBJECT Pkg2Elements[5];
ACPI_OBJECT_LIST Params;
static ACPI_OBJECT PkgArg;
static ACPI_OBJECT PkgElements[5];
static ACPI_OBJECT Pkg2Elements[5];
static ACPI_OBJECT_LIST Params;
/*
* Test using a Package object as an method argument
*/
void
static void
AeTestPackageArgument (
void)
{
ACPI_STATUS Status;
/* Main package */
@ -335,11 +343,11 @@ AeTestPackageArgument (
Params.Count = 1;
Params.Pointer = &PkgArg;
Status = AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
(void) AcpiEvaluateObject (NULL, "\\_PKG", &Params, NULL);
}
ACPI_STATUS
static ACPI_STATUS
AeGetDevices (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@ -364,7 +372,7 @@ AeGetDevices (
*
*****************************************************************************/
ACPI_STATUS
static ACPI_STATUS
ExecuteOSI (
char *OsiString,
UINT32 ExpectedResult)
@ -434,9 +442,9 @@ ExecuteOSI (
*
*****************************************************************************/
ACPI_GENERIC_ADDRESS GenericRegister;
static ACPI_GENERIC_ADDRESS GenericRegister;
void
static void
AeGenericRegisters (
void)
{
@ -450,14 +458,20 @@ AeGenericRegisters (
GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
Status = AcpiRead (&Value, &GenericRegister);
AE_CHECK_OK (AcpiRead, Status);
Status = AcpiWrite (Value, &GenericRegister);
AE_CHECK_OK (AcpiWrite, Status);
GenericRegister.Address = 0x12345678;
GenericRegister.BitOffset = 0;
GenericRegister.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY;
Status = AcpiRead (&Value, &GenericRegister);
AE_CHECK_OK (AcpiRead, Status);
Status = AcpiWrite (Value, &GenericRegister);
AE_CHECK_OK (AcpiWrite, Status);
}
@ -469,7 +483,7 @@ AeGenericRegisters (
*
*****************************************************************************/
void
static void
AeHardwareInterfaces (
void)
{
@ -478,14 +492,29 @@ AeHardwareInterfaces (
Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
AE_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
AE_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
AE_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
AE_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
AE_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
AE_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
AE_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
AE_CHECK_OK (AcpiReadBitRegister, Status);
}
@ -519,52 +548,108 @@ AeMiscellaneousTests (
AeTestPackageArgument ();
AcpiInstallInterface ("");
AcpiInstallInterface ("TestString");
AcpiInstallInterface ("TestString");
AcpiRemoveInterface ("Windows 2006");
AcpiRemoveInterface ("TestString");
AcpiRemoveInterface ("XXXXXX");
AcpiInstallInterface ("AnotherTestString");
Status = AcpiInstallInterface ("");
AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
ExecuteOSI ("MichiganTerminalSystem", 0);
Status = AcpiInstallInterface ("TestString");
AE_CHECK_OK (AcpiInstallInterface, Status);
Status = AcpiInstallInterface ("TestString");
AE_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
Status = AcpiRemoveInterface ("Windows 2006");
AE_CHECK_OK (AcpiRemoveInterface, Status);
Status = AcpiRemoveInterface ("TestString");
AE_CHECK_OK (AcpiRemoveInterface, Status);
Status = AcpiRemoveInterface ("XXXXXX");
AE_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
Status = AcpiInstallInterface ("AnotherTestString");
AE_CHECK_OK (AcpiInstallInterface, Status);
Status = ExecuteOSI ("Windows 2001", 0xFFFFFFFF);
AE_CHECK_OK (ExecuteOSI, Status);
Status = ExecuteOSI ("MichiganTerminalSystem", 0);
AE_CHECK_OK (ExecuteOSI, Status);
ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer;
AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
Status = AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
AE_CHECK_OK (AcpiGetName, Status);
Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
AE_CHECK_OK (AcpiEnableEvent, Status);
/*
* GPEs: Handlers, enable/disable, etc.
*/
AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiEnableGpe (NULL, 0);
AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiEnableGpe (NULL, 0);
AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
Status = AcpiEnableGpe (NULL, 0);
AE_CHECK_OK (AcpiEnableGpe, Status);
AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AcpiEnableGpe (NULL, 1);
Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
AE_CHECK_OK (AcpiRemoveGpeHandler, Status);
AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiEnableGpe (NULL, 2);
Status = AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
Status = AcpiEnableGpe (NULL, 0);
AE_CHECK_OK (AcpiEnableGpe, Status);
AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiEnableGpe (NULL, 0x19);
Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
AE_CHECK_OK (AcpiSetGpe, Status);
AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiEnableGpe (NULL, 0x62);
AcpiDisableGpe (NULL, 0x62);
Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
AE_CHECK_OK (AcpiSetGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 1);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 2);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0x19);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 0x62, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AE_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0x62);
AE_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiDisableGpe (NULL, 0x62);
AE_CHECK_OK (AcpiDisableGpe, Status);
AfInstallGpeBlock ();
@ -584,41 +669,23 @@ AeMiscellaneousTests (
/* Test global lock */
Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status);
}
AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not get GlobalLock, %X\n", Status);
}
AE_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle1);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status);
}
AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle2);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not release GlobalLock, %X\n", Status);
}
AE_CHECK_OK (AcpiReleaseGlobalLock, Status);
/* Get Devices */
Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not AcpiGetDevices, %X\n", Status);
}
AE_CHECK_OK (AcpiGetDevices, Status);
Status = AcpiGetStatistics (&Stats);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not AcpiGetStatistics, %X\n", Status);
}
AE_CHECK_OK (AcpiGetStatistics, Status);
}

View File

@ -120,19 +120,19 @@
/* Local prototypes */
void
static void
AeNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
void *Context);
void
static void
AeDeviceNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
void *Context);
ACPI_STATUS
static ACPI_STATUS
AeExceptionHandler (
ACPI_STATUS AmlStatus,
ACPI_NAME Name,
@ -140,31 +140,31 @@ AeExceptionHandler (
UINT32 AmlOffset,
void *Context);
ACPI_STATUS
static ACPI_STATUS
AeTableHandler (
UINT32 Event,
void *Table,
void *Context);
ACPI_STATUS
static ACPI_STATUS
AeRegionInit (
ACPI_HANDLE RegionHandle,
UINT32 Function,
void *HandlerContext,
void **RegionContext);
void
static void
AeAttachedDataHandler (
ACPI_HANDLE Object,
void *Data);
UINT32
static UINT32
AeInterfaceHandler (
ACPI_STRING InterfaceName,
UINT32 Supported);
UINT32 SigintCount = 0;
AE_DEBUG_REGIONS AeRegions;
static UINT32 SigintCount = 0;
static AE_DEBUG_REGIONS AeRegions;
/******************************************************************************
@ -179,7 +179,7 @@ AE_DEBUG_REGIONS AeRegions;
*
*****************************************************************************/
void __cdecl
void ACPI_SYSTEM_XFACE
AeCtrlCHandler (
int Sig)
{
@ -218,7 +218,7 @@ AeCtrlCHandler (
*
*****************************************************************************/
void
static void
AeNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
@ -268,7 +268,6 @@ AeNotifyHandler (
(void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL);
break;
}
}
@ -286,7 +285,7 @@ AeNotifyHandler (
*
*****************************************************************************/
void
static void
AeDeviceNotifyHandler (
ACPI_HANDLE Device,
UINT32 Value,
@ -317,7 +316,7 @@ AeDeviceNotifyHandler (
*
*****************************************************************************/
ACPI_STATUS
static ACPI_STATUS
AeExceptionHandler (
ACPI_STATUS AmlStatus,
ACPI_NAME Name,
@ -416,14 +415,14 @@ AeExceptionHandler (
*
*****************************************************************************/
char *TableEvents[] =
static char *TableEvents[] =
{
"LOAD",
"UNLOAD",
"UNKNOWN"
};
ACPI_STATUS
static ACPI_STATUS
AeTableHandler (
UINT32 Event,
void *Table,
@ -469,7 +468,7 @@ AeGpeHandler (
*
*****************************************************************************/
void
static void
AeAttachedDataHandler (
ACPI_HANDLE Object,
void *Data)
@ -490,7 +489,7 @@ AeAttachedDataHandler (
*
*****************************************************************************/
UINT32
static UINT32
AeInterfaceHandler (
ACPI_STRING InterfaceName,
UINT32 Supported)
@ -518,7 +517,7 @@ AeInterfaceHandler (
*
*****************************************************************************/
ACPI_STATUS
static ACPI_STATUS
AeRegionInit (
ACPI_HANDLE RegionHandle,
UINT32 Function,
@ -530,7 +529,7 @@ AeRegionInit (
*/
*RegionContext = RegionHandle;
return AE_OK;
return (AE_OK);
}
@ -549,7 +548,7 @@ AeRegionInit (
*
*****************************************************************************/
ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 3, 4, 5, 6, 7, 0x80};
static ACPI_ADR_SPACE_TYPE SpaceIdList[] = {0, 1, 3, 4, 5, 6, 7, 0x80};
#define AEXEC_NUM_REGIONS 8
ACPI_STATUS
@ -623,8 +622,12 @@ AeInstallHandlers (void)
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
AeNotifyHandler, NULL);
AE_CHECK_OK (AcpiInstallNotifyHandler, Status);
Status = AcpiRemoveNotifyHandler (Handle, ACPI_ALL_NOTIFY,
AeNotifyHandler);
AE_CHECK_OK (AcpiRemoveNotifyHandler, Status);
Status = AcpiInstallNotifyHandler (Handle, ACPI_ALL_NOTIFY,
AeNotifyHandler, NULL);
if (ACPI_FAILURE (Status))
@ -634,8 +637,13 @@ AeInstallHandlers (void)
}
Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
AE_CHECK_OK (AcpiAttachData, Status);
Status = AcpiDetachData (Handle, AeAttachedDataHandler);
AE_CHECK_OK (AcpiDetachData, Status);
Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle);
AE_CHECK_OK (AcpiAttachData, Status);
}
else
{
@ -646,19 +654,21 @@ AeInstallHandlers (void)
for (i = 0; i < AEXEC_NUM_REGIONS; i++)
{
Status = AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
SpaceId[i], AeRegionHandler);
/* Remove any existing handler */
(void) AcpiRemoveAddressSpaceHandler (AcpiGbl_RootNode,
SpaceIdList[i], AeRegionHandler);
/* Install handler at the root object.
* TBD: all default handlers should be installed here!
*/
Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode,
SpaceId[i], AeRegionHandler, AeRegionInit, NULL);
SpaceIdList[i], AeRegionHandler, AeRegionInit, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%u)",
AcpiUtGetRegionName((UINT8) SpaceId[i]), SpaceId[i]));
AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
return (Status);
}
}
@ -670,7 +680,7 @@ AeInstallHandlers (void)
AeRegions.NumberOfRegions = 0;
AeRegions.RegionList = NULL;
return Status;
return (Status);
}
@ -717,7 +727,7 @@ AeRegionHandler (
*/
if (RegionObject->Region.Type != ACPI_TYPE_REGION)
{
return AE_OK;
return (AE_OK);
}
/*
@ -759,10 +769,12 @@ AeRegionHandler (
{
case ACPI_READ:
Status = AcpiHwReadPort (Address, (UINT32 *) Value, BitWidth);
AE_CHECK_OK (AcpiHwReadPort, Status);
break;
case ACPI_WRITE:
Status = AcpiHwWritePort (Address, (UINT32) *Value, BitWidth);
AE_CHECK_OK (AcpiHwWritePort, Status);
break;
default:
@ -906,14 +918,14 @@ AeRegionHandler (
RegionElement = AcpiOsAllocate (sizeof (AE_REGION));
if (!RegionElement)
{
return AE_NO_MEMORY;
return (AE_NO_MEMORY);
}
RegionElement->Buffer = AcpiOsAllocate (Length);
if (!RegionElement->Buffer)
{
AcpiOsFree (RegionElement);
return AE_NO_MEMORY;
return (AE_NO_MEMORY);
}
/* Initialize the region with the default fill value */
@ -966,7 +978,7 @@ AeRegionHandler (
ByteWidth, (UINT32)(RegionElement->Address),
RegionElement->Length));
return AE_AML_REGION_LIMIT;
return (AE_AML_REGION_LIMIT);
}
/*
@ -997,9 +1009,10 @@ DoFunction:
break;
default:
return AE_BAD_PARAMETER;
return (AE_BAD_PARAMETER);
}
return AE_OK;
return (AE_OK);
}

View File

@ -122,17 +122,18 @@
#define _COMPONENT PARSER
ACPI_MODULE_NAME ("aemain")
UINT8 AcpiGbl_BatchMode = 0;
UINT8 AcpiGbl_RegionFillValue = 0;
BOOLEAN AcpiGbl_IgnoreErrors = FALSE;
BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE;
BOOLEAN AcpiGbl_DebugTimeout = FALSE;
char BatchBuffer[128];
AE_TABLE_DESC *AeTableListHead = NULL;
UINT8 AcpiGbl_RegionFillValue = 0;
BOOLEAN AcpiGbl_IgnoreErrors = FALSE;
BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE;
BOOLEAN AcpiGbl_DebugTimeout = FALSE;
static UINT8 AcpiGbl_BatchMode = 0;
static char BatchBuffer[128];
static AE_TABLE_DESC *AeTableListHead = NULL;
#define ASL_MAX_FILES 256
char *FileList[ASL_MAX_FILES];
int FileCount;
static char *FileList[ASL_MAX_FILES];
#define AE_SUPPORTED_OPTIONS "?b:d:e:f:gm^ovx:"
@ -203,6 +204,7 @@ AcpiDbRunBatchMode (
char *Cmd = Ptr;
UINT8 Run = 0;
AcpiGbl_MethodExecuting = FALSE;
AcpiGbl_StepToNextCall = FALSE;
@ -360,6 +362,7 @@ AsDoWildcard (
#ifdef WIN32
void *DirInfo;
char *Filename;
int FileCount;
FileCount = 0;
@ -441,7 +444,7 @@ main (
ACPI_TABLE_HEADER *Table = NULL;
UINT32 TableCount;
AE_TABLE_DESC *TableDesc;
char **FileList;
char **WildcardList;
char *Filename;
char *Directory;
char *FullPathname;
@ -459,7 +462,7 @@ main (
if (argc < 2)
{
usage ();
return 0;
return (0);
}
signal (SIGINT, AeCtrlCHandler);
@ -471,7 +474,8 @@ main (
/* Init ACPI and start debugger thread */
AcpiInitializeSubsystem ();
Status = AcpiInitializeSubsystem ();
AE_CHECK_OK (AcpiInitializeSubsystem, Status);
/* Get the command line options */
@ -482,7 +486,7 @@ main (
{
printf ("**** The length of command line (%u) exceeded maximum (127)\n",
(UINT32) strlen (AcpiGbl_Optarg));
return -1;
return (-1);
}
AcpiGbl_BatchMode = 1;
strcpy (BatchBuffer, AcpiGbl_Optarg);
@ -586,7 +590,7 @@ main (
case 'h':
default:
usage();
return -1;
return (-1);
}
@ -617,21 +621,21 @@ main (
/* Expand wildcards (Windows only) */
FileList = AsDoWildcard (Directory, Filename);
if (!FileList)
WildcardList = AsDoWildcard (Directory, Filename);
if (!WildcardList)
{
return -1;
return (-1);
}
while (*FileList)
while (*WildcardList)
{
FullPathname = AcpiOsAllocate (
strlen (Directory) + strlen (*FileList) + 1);
strlen (Directory) + strlen (*WildcardList) + 1);
/* Construct a full path to the file */
strcpy (FullPathname, Directory);
strcat (FullPathname, *FileList);
strcat (FullPathname, *WildcardList);
/* Get one table */
@ -644,9 +648,9 @@ main (
}
AcpiOsFree (FullPathname);
AcpiOsFree (*FileList);
*FileList = NULL;
FileList++;
AcpiOsFree (*WildcardList);
*WildcardList = NULL;
WildcardList++;
/*
* Ignore an FACS or RSDT, we can't use them.
@ -676,7 +680,7 @@ main (
Status = AeBuildLocalTables (TableCount, AeTableListHead);
if (ACPI_FAILURE (Status))
{
return -1;
return (-1);
}
Status = AeInstallTables ();
@ -730,6 +734,6 @@ enterloop:
AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL);
}
return 0;
return (0);
}

View File

@ -135,7 +135,7 @@ AeLocalGetRootPointer (
/* Default DSDT. This will be replaced with the input DSDT */
unsigned char DsdtCode[] =
static unsigned char DsdtCode[] =
{
0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */
0x02,0x6F,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".oIntel." */
@ -144,7 +144,7 @@ unsigned char DsdtCode[] =
0x04,0x12,0x08,0x20,
};
unsigned char LocalDsdtCode[] =
static unsigned char LocalDsdtCode[] =
{
0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */
0x02,0x2C,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".,Intel." */
@ -155,7 +155,7 @@ unsigned char LocalDsdtCode[] =
/* Several example SSDTs */
unsigned char Ssdt1Code[] = /* Has method _T98 */
static unsigned char Ssdt1Code[] = /* Has method _T98 */
{
0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */
0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
@ -165,7 +165,7 @@ unsigned char Ssdt1Code[] = /* Has method _T98 */
0x39,0x38,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "98.p..`." */
};
unsigned char Ssdt2Code[] = /* Has method _T99 */
static unsigned char Ssdt2Code[] = /* Has method _T99 */
{
0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */
0x01,0xB7,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
@ -175,7 +175,7 @@ unsigned char Ssdt2Code[] = /* Has method _T99 */
0x39,0x39,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "99.p..`." */
};
unsigned char Ssdt3Code[] = /* Has method _T97 */
unsigned char Ssdt3Code[] = /* Has method _T97 */
{
0x54,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "TSDT0..." */
0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
@ -187,7 +187,7 @@ unsigned char Ssdt3Code[] = /* Has method _T97 */
/* Example OEM table */
unsigned char Oem1Code[] =
static unsigned char Oem1Code[] =
{
0x4F,0x45,0x4D,0x31,0x38,0x00,0x00,0x00, /* 00000000 "OEM18..." */
0x01,0x4B,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".KIntel." */
@ -200,7 +200,7 @@ unsigned char Oem1Code[] =
/* ASL source for this table is at the end of this file */
unsigned char OemxCode[] =
static unsigned char OemxCode[] =
{
0x4F,0x45,0x4D,0x58,0xB0,0x00,0x00,0x00, /* 00000000 "OEMX...." */
0x02,0x54,0x4D,0x79,0x4F,0x45,0x4D,0x00, /* 00000008 ".TMyOEM." */
@ -241,7 +241,7 @@ unsigned char OemxCode[] =
*
* Compiled byte code below.
*/
unsigned char MethodCode[] =
static unsigned char MethodCode[] =
{
0x44,0x53,0x44,0x54,0x53,0x00,0x00,0x00, /* 00000000 "DSDTS..." */
0x02,0xF9,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */
@ -262,19 +262,19 @@ unsigned char MethodCode[] =
* even though the underlying OSD HW access functions don't do
* anything.
*/
ACPI_TABLE_HEADER *DsdtToInstallOverride;
ACPI_TABLE_RSDP LocalRSDP;
ACPI_TABLE_FADT LocalFADT;
ACPI_TABLE_FACS LocalFACS;
ACPI_TABLE_HEADER LocalTEST;
ACPI_TABLE_HEADER LocalBADTABLE;
ACPI_TABLE_RSDT *LocalRSDT;
static ACPI_TABLE_HEADER *DsdtToInstallOverride;
static ACPI_TABLE_RSDP LocalRSDP;
static ACPI_TABLE_FADT LocalFADT;
static ACPI_TABLE_FACS LocalFACS;
static ACPI_TABLE_HEADER LocalTEST;
static ACPI_TABLE_HEADER LocalBADTABLE;
static ACPI_TABLE_RSDT *LocalRSDT;
#define BASE_RSDT_TABLES 7
#define BASE_RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32)))
#define BASE_RSDT_TABLES 7
#define BASE_RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32)))
#define ACPI_MAX_INIT_TABLES (32)
static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES];
#define ACPI_MAX_INIT_TABLES (32)
static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES];
/******************************************************************************
@ -357,7 +357,7 @@ AeBuildLocalTables (
LocalRSDT = AcpiOsAllocate (RsdtSize);
if (!LocalRSDT)
{
return AE_NO_MEMORY;
return (AE_NO_MEMORY);
}
ACPI_MEMSET (LocalRSDT, 0, RsdtSize);
@ -398,7 +398,7 @@ AeBuildLocalTables (
if (DsdtAddress)
{
printf ("Already found a DSDT, only one allowed\n");
return AE_ALREADY_EXISTS;
return (AE_ALREADY_EXISTS);
}
/* The incoming user table is a DSDT */
@ -488,21 +488,25 @@ AeBuildLocalTables (
/* Miscellaneous FADT fields */
LocalFADT.Gpe0BlockLength = 16;
LocalFADT.Gpe0Block = 0x00001234;
LocalFADT.Gpe1BlockLength = 6;
LocalFADT.Gpe1Block = 0x00005678;
LocalFADT.Gpe1Base = 96;
LocalFADT.Pm1EventLength = 4;
LocalFADT.Pm1ControlLength = 2;
LocalFADT.PmTimerLength = 4;
LocalFADT.Gpe0Block = 0x00001234;
LocalFADT.Gpe1Block = 0x00005678;
LocalFADT.Pm1aEventBlock = 0x00001aaa;
LocalFADT.Pm1bEventBlock = 0x00001bbb;
LocalFADT.PmTimerBlock = 0xA0;
LocalFADT.Pm1ControlLength = 2;
LocalFADT.Pm1aControlBlock = 0xB0;
LocalFADT.PmTimerLength = 4;
LocalFADT.PmTimerBlock = 0xA0;
LocalFADT.Pm2ControlBlock = 0xC0;
LocalFADT.Pm2ControlLength = 1;
/* Setup one example X-64 field */
LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
@ -566,9 +570,15 @@ AeInstallTables (
{
ACPI_STATUS Status;
Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE);
AE_CHECK_OK (AcpiInitializeTables, Status);
Status = AcpiReallocateRootTable ();
AE_CHECK_OK (AcpiReallocateRootTable, Status);
Status = AcpiLoadTables ();
AE_CHECK_OK (AcpiLoadTables, Status);
/*
* Test run-time control method installation. Do it twice to test code

View File

@ -130,46 +130,46 @@
/* Local prototypes */
void
static void
CheckAscii (
char *Name,
int Count);
void
static void
NormalizeSignature (
char *Signature);
unsigned int
static unsigned int
GetNextInstance (
char *InputPathname,
char *Signature);
int
static int
ExtractTables (
char *InputPathname,
char *Signature,
unsigned int MinimumInstances);
size_t
static size_t
GetTableHeader (
FILE *InputFile,
unsigned char *OutputData);
unsigned int
static unsigned int
CountTableInstances (
char *InputPathname,
char *Signature);
int
static int
ListTables (
char *InputPathname);
size_t
static size_t
ConvertLine (
char *InputLine,
unsigned char *OutputData);
void
static void
DisplayUsage (
void);
@ -196,9 +196,9 @@ struct TableInfo
struct TableInfo *Next;
};
struct TableInfo *ListHead = NULL;
char Filename[16];
unsigned char Data[16];
static struct TableInfo *ListHead = NULL;
static char Filename[16];
static unsigned char Data[16];
/******************************************************************************
@ -209,7 +209,7 @@ unsigned char Data[16];
*
******************************************************************************/
void
static void
DisplayUsage (
void)
{
@ -240,7 +240,7 @@ DisplayUsage (
*
******************************************************************************/
void
static void
CheckAscii (
char *Name,
int Count)
@ -270,7 +270,7 @@ CheckAscii (
*
******************************************************************************/
void
static void
NormalizeSignature (
char *Signature)
{
@ -295,7 +295,7 @@ NormalizeSignature (
*
******************************************************************************/
size_t
static size_t
ConvertLine (
char *InputLine,
unsigned char *OutputData)
@ -353,7 +353,7 @@ ConvertLine (
*
******************************************************************************/
size_t
static size_t
GetTableHeader (
FILE *InputFile,
unsigned char *OutputData)
@ -401,7 +401,7 @@ GetTableHeader (
*
******************************************************************************/
unsigned int
static unsigned int
CountTableInstances (
char *InputPathname,
char *Signature)
@ -459,7 +459,7 @@ CountTableInstances (
*
******************************************************************************/
unsigned int
static unsigned int
GetNextInstance (
char *InputPathname,
char *Signature)
@ -520,7 +520,7 @@ GetNextInstance (
*
******************************************************************************/
int
static int
ExtractTables (
char *InputPathname,
char *Signature,
@ -707,7 +707,7 @@ CleanupAndExit:
*
******************************************************************************/
int
static int
ListTables (
char *InputPathname)
{