Some Lint changes; 16-bit changes

date	2002.04.15.22.46.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 20:35:15 +00:00
parent 29cbb61869
commit 3c4f5b8bd0
4 changed files with 148 additions and 172 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: oswinxf - Windows OSL
* $Revision: 1.30 $
* $Revision: 1.31 $
*
*****************************************************************************/
@ -157,9 +157,8 @@ typedef struct semaphore_entry
SEMAPHORE_ENTRY AcpiGbl_Semaphores[NUM_SEMAPHORES];
extern FILE *AcpiGbl_DebugFile;
ACPI_STATUS
AeLocalGetRootPointer (
UINT32 Flags,

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -178,9 +178,11 @@ typedef union ptr_ovl
#define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\
AcpiOsPrintf PARAM_LIST(fp);}
void __cdecl
AeCtrlCHandler (
int Sig);
int
getopt (
int argc,
char **argv,
char *opts);
ACPI_STATUS
AeBuildLocalTables (
@ -219,13 +221,37 @@ void
AeOpenDebugFile (
char *Name);
void
AdPrintStatistics (void);
ACPI_STATUS
AeDisplayAllMethods (
UINT32 DisplayCount);
ACPI_STATUS
AdFindDsdt(
UINT8 **DsdtPtr,
UINT32 *DsdtLength);
void
AdDumpTables (void);
ACPI_STATUS
AeInstallHandlers (void);
ACPI_STATUS
AdGetTables (
char *Filename);
ACPI_STATUS
AdParseTables (void);
ACPI_STATUS
AdDisplayTables (void);
ACPI_STATUS
AdDisplayStatistics (void);
#endif /* _ADCOMMON */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: aeexec - Support routines for AcpiExec utility
* $Revision: 1.65 $
* $Revision: 1.59 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -124,7 +124,6 @@
#include "aecommon.h"
#include <stdio.h>
#include <signal.h>
#define _COMPONENT ACPI_TOOLS
@ -159,38 +158,6 @@ RSDT_DESCRIPTOR_REV1 *LocalRSDT;
#define RSDT_SIZE (sizeof (RSDT_DESCRIPTOR_REV1) + ((RSDT_TABLES -1) * sizeof (UINT32)))
/******************************************************************************
*
* FUNCTION: AeCtrlCHandler
*
* PARAMETERS:
*
* RETURN: none
*
* DESCRIPTION: Control-C handler. Abort running control method if any.
*
*****************************************************************************/
void __cdecl
AeCtrlCHandler (
int Sig)
{
signal (SIGINT, SIG_IGN);
AcpiOsPrintf ("Caught a ctrl-c\n\n");
if (AcpiGbl_MethodExecuting)
{
AcpiGbl_AbortMethod = TRUE;
signal (SIGINT, AeCtrlCHandler);
}
else
{
exit (0);
}
}
/******************************************************************************
*
@ -246,7 +213,7 @@ AeBuildLocalTables (void)
LocalFADT.Header.Length = sizeof (FADT_DESCRIPTOR_REV1);
LocalFADT.Gpe0BlkLen = 4;
LocalFADT.Gpe1BlkLen = 6;
LocalFADT.Gpe1Base = 61;
LocalFADT.Gpe1Base = 61;
LocalFADT.Pm1EvtLen = 4;
LocalFADT.Pm1CntLen = 4;
@ -381,12 +348,11 @@ AeRegionHandler (
ACPI_OPERAND_OBJECT *RegionObject = (ACPI_OPERAND_OBJECT*) RegionContext;
ACPI_PHYSICAL_ADDRESS BaseAddress;
ACPI_SIZE Length;
UINT32 Length;
BOOLEAN BufferExists;
REGION *RegionElement;
void *BufferValue;
UINT32 ByteWidth;
UINT32 i;
ACPI_FUNCTION_NAME ("AeRegionHandler");
@ -399,85 +365,16 @@ AeRegionHandler (
return AE_OK;
}
/*
* Find the region's address space and length before searching
* the linked list.
*/
BaseAddress = RegionObject->Region.Address;
Length = (ACPI_SIZE) RegionObject->Region.Length;
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Operation Region request on %s at 0x%X\n",
AcpiUtGetRegionName (RegionObject->Region.SpaceId),
Address));
if (RegionObject->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
{
Length = 0;
switch (Function & ACPI_IO_MASK)
{
case ACPI_READ:
switch (Function >> 16)
{
case AML_FIELD_ATTRIB_SMB_QUICK:
case AML_FIELD_ATTRIB_SMB_SEND_RCV:
case AML_FIELD_ATTRIB_SMB_BYTE:
Length = 1;
break;
case AML_FIELD_ATTRIB_SMB_WORD:
case AML_FIELD_ATTRIB_SMB_WORD_CALL:
Length = 2;
break;
case AML_FIELD_ATTRIB_SMB_BLOCK:
case AML_FIELD_ATTRIB_SMB_BLOCK_CALL:
Length = 32;
break;
default:
break;
}
break;
case ACPI_WRITE:
switch (Function >> 16)
{
case AML_FIELD_ATTRIB_SMB_QUICK:
case AML_FIELD_ATTRIB_SMB_SEND_RCV:
case AML_FIELD_ATTRIB_SMB_BYTE:
case AML_FIELD_ATTRIB_SMB_WORD:
case AML_FIELD_ATTRIB_SMB_BLOCK:
Length = 0;
break;
case AML_FIELD_ATTRIB_SMB_WORD_CALL:
Length = 2;
break;
case AML_FIELD_ATTRIB_SMB_BLOCK_CALL:
Length = 32;
break;
default:
break;
}
break;
default:
break;
}
for (i = 0; i < Length; i++)
{
((UINT8 *) Value)[i+2] = (UINT8) (0xA0 + i);
}
((UINT8 *) Value)[0] = 0x7A;
((UINT8 *) Value)[1] = (UINT8) Length;
return AE_OK;
}
/*
* Find the region's address space and length before searching
* the linked list.
*/
BaseAddress = RegionObject->Region.Address;
Length = RegionObject->Region.Length;
/*
* Search through the linked list for this region's buffer
@ -499,7 +396,7 @@ AeRegionHandler (
RegionElement = RegionElement->NextRegion;
}
}
}
}
/*
* If the Region buffer does not exist, create it now
@ -652,7 +549,6 @@ AeNotifyHandler (
switch (Value)
{
#if 0
case 0:
printf ("**** Method Error 0x%X: Results not equal\n", Value);
if (AcpiGbl_DebugFile)
@ -679,11 +575,9 @@ AeNotifyHandler (
}
break;
#endif
default:
printf ("**** Received a Notify on Device [%s] %p value 0x%X\n",
((ACPI_NAMESPACE_NODE *) Device)->Name.Ascii, Device, Value);
printf ("**** Received a notify, value 0x%X\n", Value);
if (AcpiGbl_DebugFile)
{
AcpiOsPrintf ("**** Received a notify, value 0x%X\n", Value);
@ -707,8 +601,8 @@ AeNotifyHandler (
*
*****************************************************************************/
ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 4, 0x80};
#define AEXEC_NUM_REGIONS 6
ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 0x80};
#define AEXEC_NUM_REGIONS 5
ACPI_STATUS
AeInstallHandlers (void)

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: aemain - Main routine for the AcpiExec utility
* $Revision: 1.76 $
* $Revision: 1.63 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -117,7 +117,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "acpi.h"
#include "amlcode.h"
@ -125,22 +124,94 @@
#include "acnamesp.h"
#include "acinterp.h"
#include "acdebug.h"
#include "acapps.h"
#include "aecommon.h"
#ifdef _DEBUG
#if ACPI_MACHINE_WIDTH != 16
#ifdef _DEBUG
#ifndef _IA16
#include <crtdbg.h>
#endif
#endif
#endif
#define _COMPONENT PARSER
ACPI_MODULE_NAME ("aemain")
/*
* TBD: Debug only, remove!
*/
#ifdef _IA32
void
AcpiCompare (
UINT64_OVERLAY Dividend,
UINT64_OVERLAY Divisor,
UINT64_OVERLAY LibDiv,
UINT64_OVERLAY Div,
UINT64_OVERLAY LibMod,
UINT64_OVERLAY Mod)
{
#if ACPI_MACHINE_WIDTH == 16
if (LibDiv.Full != Div.Full)
{
AcpiOsPrintf ("Mismatch-DIV: n=%8.8X%8.8X d=%8.8X%8.8X, lr=%8.8X%8.8X ar=%8.8X%8.8X\n",
Dividend.Part.Hi, Dividend.Part.Lo,
Divisor.Part.Hi, Divisor.Part.Lo,
LibDiv.Part.Hi, LibDiv.Part.Lo,
Div.Part.Hi, Div.Part.Lo);
}
if (LibMod.Full != Mod.Full)
{
AcpiOsPrintf ("Mismatch-MOD: n=%8.8X%8.8X d=%8.8X%8.8X, lr=%8.8X%8.8X ar=%8.8X%8.8X\n",
Dividend.Part.Hi, Dividend.Part.Lo,
Divisor.Part.Hi, Divisor.Part.Lo,
LibMod.Part.Hi, LibMod.Part.Lo,
Mod.Part.Hi, Mod.Part.Lo);
}
}
/* Check answer against the library (DEBUG ONLY) */
/*
CompareDiv.Full = Dividend.Full / Divisor.Full;
CompareMod.Full = Dividend.Full % Divisor.Full;
AcpiCompare (Dividend, Divisor, CompareDiv, Quotient, CompareMod, Remainder);
*/
void
AeDoDivideCheck (void)
{
UINT32 i;
UINT64_OVERLAY CompareDiv;
UINT64_OVERLAY CompareMod;
UINT64_OVERLAY Dividend;
UINT64_OVERLAY Divisor;
UINT64_OVERLAY Quotient;
UINT64_OVERLAY Remainder;
for (i = 1; i < 0xFFFFFF; i++)
{
Dividend.Part.Hi = rand ();
Dividend.Part.Lo = rand ();
Divisor.Part.Hi = rand ();
Divisor.Part.Lo = rand ();
CompareDiv.Full = Dividend.Full / Divisor.Full;
CompareMod.Full = Dividend.Full % Divisor.Full;
AcpiUtDivide (&Dividend.Full, &Divisor.Full, &Quotient.Full, &Remainder.Full);
AcpiCompare (Dividend, Divisor, CompareDiv, Quotient, CompareMod, Remainder);
}
}
#else
void
AeDoDivideCheck (void)
{
}
#endif
#ifdef _IA16
ACPI_STATUS
AcpiGetIrqRoutingTable (
ACPI_HANDLE DeviceHandle,
@ -173,7 +244,7 @@ usage (void)
printf (" Miscellaneous Options\n");
printf (" -? Display this message\n");
printf (" -i Do not run INI methods\n");
printf (" -x DebugLevel Specify debug output level\n");
printf (" -l DebugLevel Specify debug output level\n");
printf (" -v Verbose init output\n");
}
@ -202,36 +273,33 @@ main (
char Buffer[32];
#ifdef _DEBUG
#if ACPI_MACHINE_WIDTH != 16
#ifdef _DEBUG
#ifndef _IA16
_CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0));
#endif
#endif
#endif
signal (SIGINT, AeCtrlCHandler);
/* Init globals */
AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
AcpiDbgLevel = NORMAL_DEFAULT;
AcpiDbgLayer = 0xFFFFFFFF;
/* Init ACPI and start debugger thread */
AcpiInitializeSubsystem ();
AcpiGbl_GlobalLockPresent = TRUE;
AeDoDivideCheck ();
printf ("\nIntel ACPI Component Architecture\nAML Execution/Debug Utility");
printf ("ACPI AML Execution/Debug Utility ");
#if ACPI_MACHINE_WIDTH == 16
printf (" (16-bit)");
#ifdef _IA16
printf ("(16-bit) ");
#else
printf ("(32-bit) ");
#endif
printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION));
printf (" [%s]\n\n", __DATE__);
printf ("CA version %8.8lX [%s]\n", ACPI_CA_VERSION, __DATE__);
/* Get the command line options */
while ((j = AcpiGetopt (argc, argv, "?dgio:svx:")) != EOF) switch(j)
while ((j = getopt (argc, argv, "?dgil:o:sv")) != EOF) switch(j)
{
case 'd':
AcpiGbl_DbOpt_disasm = TRUE;
@ -247,8 +315,8 @@ main (
AcpiGbl_DbOpt_ini_methods = FALSE;
break;
case 'x':
AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0);
case 'l':
AcpiDbgLevel = strtoul (optarg, NULL, 0);
AcpiGbl_DbConsoleDebugLevel = AcpiDbgLevel;
printf ("Debug Level: %lX\n", AcpiDbgLevel);
break;
@ -262,7 +330,7 @@ main (
break;
case 'v':
AcpiDbgLevel |= ACPI_LV_INIT_NAMES;
AcpiDbgLevel |= ACPI_LV_INIT;
break;
case '?':
@ -271,6 +339,9 @@ main (
return -1;
}
/* Init ACPI and start debugger thread */
AcpiInitializeSubsystem ();
InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE);
if (!AcpiGbl_DbOpt_ini_methods)
@ -280,10 +351,10 @@ main (
/* Standalone filename is the only argument */
if (argv[AcpiGbl_Optind])
if (argv[optind])
{
AcpiGbl_DbOpt_tables = TRUE;
AcpiGbl_DbFilename = argv[AcpiGbl_Optind];
AcpiGbl_DbFilename = argv[optind];
Status = AcpiDbGetAcpiTable (AcpiGbl_DbFilename);
if (ACPI_FAILURE (Status))
@ -318,13 +389,6 @@ main (
goto enterloop;
}
Status = AcpiInitializeObjects (InitFlags);
if (ACPI_FAILURE (Status))
{
printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status));
goto enterloop;
}
ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer;
AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
@ -332,12 +396,12 @@ main (
AcpiEnableEvent (0, ACPI_EVENT_GPE, 0);
}
#if ACPI_MACHINE_WIDTH == 16
#ifdef _IA16
else
{
#include "16bit.h"
Status = AfFindTable (DSDT_SIG, NULL, NULL);
Status = AfFindDsdt (NULL, NULL);
if (ACPI_FAILURE (Status))
{
goto enterloop;
@ -373,13 +437,6 @@ main (
printf ("**** Could not EnableSubsystem, %s\n", AcpiFormatException (Status));
goto enterloop;
}
Status = AcpiInitializeObjects (InitFlags);
if (ACPI_FAILURE (Status))
{
printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status));
goto enterloop;
}
}
#endif