mirror of
https://github.com/acpica/acpica/
synced 2025-01-14 21:39:19 +03:00
Added a control-c handler
date 2002.12.05.16.48.00; author rmoore1; state Exp;
This commit is contained in:
parent
67689d9c98
commit
dc5f966f43
@ -124,8 +124,6 @@
|
||||
|
||||
extern UINT8 *DsdtPtr;
|
||||
extern UINT32 AcpiDsdtLength;
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
extern UINT8 *AmlStart;
|
||||
extern UINT32 AmlLength;
|
||||
extern FILE *AcpiGbl_DebugFile;
|
||||
@ -180,11 +178,9 @@ typedef union ptr_ovl
|
||||
#define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\
|
||||
AcpiOsPrintf PARAM_LIST(fp);}
|
||||
|
||||
int
|
||||
getopt (
|
||||
int argc,
|
||||
char **argv,
|
||||
char *opts);
|
||||
void __cdecl
|
||||
AeCtrlCHandler (
|
||||
int Sig);
|
||||
|
||||
ACPI_STATUS
|
||||
AeBuildLocalTables (
|
||||
@ -223,43 +219,13 @@ 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);
|
||||
|
||||
int
|
||||
FlatMove (
|
||||
UINT32 Dest,
|
||||
UINT32 Src,
|
||||
UINT32 Size);
|
||||
|
||||
ACPI_STATUS
|
||||
AdGetTables (
|
||||
char *Filename);
|
||||
|
||||
ACPI_STATUS
|
||||
AdParseTables (void);
|
||||
|
||||
ACPI_STATUS
|
||||
AdDisplayTables (void);
|
||||
|
||||
ACPI_STATUS
|
||||
AdDisplayStatistics (void);
|
||||
|
||||
|
||||
#endif /* _ADCOMMON */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aeexec - Support routines for AcpiExec utility
|
||||
* $Revision: 1.53 $
|
||||
* $Revision: 1.63 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -124,10 +124,11 @@
|
||||
#include "aecommon.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
|
||||
#define _COMPONENT ACPI_TOOLS
|
||||
MODULE_NAME ("aeexec")
|
||||
ACPI_MODULE_NAME ("aeexec")
|
||||
|
||||
|
||||
ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
|
||||
@ -137,7 +138,7 @@ UINT32 AmlLength;
|
||||
UINT8 *DsdtPtr;
|
||||
UINT32 AcpiDsdtLength;
|
||||
|
||||
DEBUG_REGIONS Regions;
|
||||
DEBUG_REGIONS AeRegions;
|
||||
RSDP_DESCRIPTOR LocalRsdp;
|
||||
|
||||
|
||||
@ -149,7 +150,47 @@ RSDP_DESCRIPTOR LocalRsdp;
|
||||
RSDP_DESCRIPTOR LocalRSDP;
|
||||
FADT_DESCRIPTOR_REV1 LocalFADT;
|
||||
FACS_DESCRIPTOR_REV1 LocalFACS;
|
||||
RSDT_DESCRIPTOR_REV1 LocalRSDT;
|
||||
ACPI_TABLE_HEADER LocalTEST;
|
||||
ACPI_TABLE_HEADER LocalBADTABLE;
|
||||
|
||||
RSDT_DESCRIPTOR_REV1 *LocalRSDT;
|
||||
|
||||
#define RSDT_TABLES 3
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
@ -160,43 +201,53 @@ RSDT_DESCRIPTOR_REV1 LocalRSDT;
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DESCRIPTION:
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_STATUS
|
||||
AeBuildLocalTables (void)
|
||||
{
|
||||
/* Build an RSDP */
|
||||
|
||||
MEMSET (&LocalRSDP, 0, sizeof (RSDP_DESCRIPTOR));
|
||||
MEMCPY (&LocalRSDP.Signature, RSDP_SIG, 8);
|
||||
LocalRSDP.Revision = 1;
|
||||
LocalRSDP.RsdtPhysicalAddress = ACPI_TO_INTEGER (&LocalRSDT);
|
||||
|
||||
AcpiGbl_RSDP = &LocalRSDP;
|
||||
|
||||
|
||||
/* Build an RSDT */
|
||||
|
||||
MEMSET (&LocalRSDT, 0, sizeof (LocalRSDT));
|
||||
MEMCPY (&LocalRSDT.Header.Signature, RSDT_SIG, 4);
|
||||
LocalRSDT.Header.Length = sizeof (RSDT_DESCRIPTOR_REV1);
|
||||
LocalRSDT = AcpiOsAllocate (RSDT_SIZE);
|
||||
if (!LocalRSDT)
|
||||
{
|
||||
return AE_NO_MEMORY;
|
||||
}
|
||||
|
||||
ACPI_MEMSET (LocalRSDT, 0, RSDT_SIZE);
|
||||
ACPI_STRNCPY (LocalRSDT->Header.Signature, RSDT_SIG, 4);
|
||||
LocalRSDT->Header.Length = RSDT_SIZE;
|
||||
|
||||
LocalRSDT.TableOffsetEntry[0] = ACPI_TO_INTEGER (&LocalFADT);
|
||||
LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT);
|
||||
LocalRSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE);
|
||||
LocalRSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST);
|
||||
LocalRSDT->Header.Checksum = (UINT8) (0 - AcpiTbChecksum (LocalRSDT, LocalRSDT->Header.Length));
|
||||
|
||||
/* Build an RSDP */
|
||||
|
||||
ACPI_MEMSET (&LocalRSDP, 0, sizeof (RSDP_DESCRIPTOR));
|
||||
ACPI_STRNCPY (LocalRSDP.Signature, RSDP_SIG, 8);
|
||||
LocalRSDP.Revision = 1;
|
||||
LocalRSDP.RsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalRSDT);
|
||||
LocalRSDP.Checksum = (UINT8) (0 - AcpiTbChecksum (&LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH));
|
||||
|
||||
AcpiGbl_RSDP = &LocalRSDP;
|
||||
|
||||
/* Build a FADT so we can test the hardware/event init */
|
||||
|
||||
MEMSET (&LocalFADT, 0, sizeof (FADT_DESCRIPTOR_REV1));
|
||||
MEMCPY (&LocalFADT.Header.Signature, FADT_SIG, 4);
|
||||
ACPI_MEMSET (&LocalFADT, 0, sizeof (FADT_DESCRIPTOR_REV1));
|
||||
ACPI_STRNCPY (LocalFADT.Header.Signature, FADT_SIG, 4);
|
||||
|
||||
LocalFADT.FirmwareCtrl = ACPI_TO_INTEGER (&LocalFACS);
|
||||
LocalFADT.FirmwareCtrl = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
|
||||
LocalFADT.Dsdt = ACPI_PTR_TO_PHYSADDR (AcpiGbl_DbTablePtr);
|
||||
LocalFADT.Header.Revision = 1;
|
||||
LocalFADT.Header.Length = sizeof (FADT_DESCRIPTOR_REV1);
|
||||
LocalFADT.Gpe0BlkLen = 8;
|
||||
LocalFADT.Gpe1BlkLen = 12;
|
||||
LocalFADT.Gpe1Base = 64;
|
||||
LocalFADT.Gpe0BlkLen = 4;
|
||||
LocalFADT.Gpe1BlkLen = 6;
|
||||
LocalFADT.Gpe1Base = 61;
|
||||
|
||||
LocalFADT.Pm1EvtLen = 4;
|
||||
LocalFADT.Pm1CntLen = 4;
|
||||
@ -216,10 +267,26 @@ AeBuildLocalTables (void)
|
||||
|
||||
/* Build a FACS */
|
||||
|
||||
MEMSET (&LocalFACS, 0, sizeof (FACS_DESCRIPTOR_REV1));
|
||||
MEMCPY (&LocalFACS.Signature, FACS_SIG, 4);
|
||||
ACPI_MEMSET (&LocalFACS, 0, sizeof (FACS_DESCRIPTOR_REV1));
|
||||
ACPI_STRNCPY (LocalFACS.Signature, FACS_SIG, 4);
|
||||
LocalFACS.Length = sizeof (FACS_DESCRIPTOR_REV1);
|
||||
LocalFACS.GlobalLock = 0x11AA0011;
|
||||
|
||||
/* Build a fake table so that we make sure that the CA core ignores it */
|
||||
|
||||
ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER));
|
||||
ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4);
|
||||
|
||||
LocalTEST.Revision = 1;
|
||||
LocalTEST.Length = sizeof (ACPI_TABLE_HEADER);
|
||||
|
||||
/* Build a fake table with a bad signature so that we make sure that the CA core ignores it */
|
||||
|
||||
ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER));
|
||||
ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4);
|
||||
|
||||
LocalBADTABLE.Revision = 1;
|
||||
LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER);
|
||||
|
||||
return (AE_OK);
|
||||
}
|
||||
@ -233,7 +300,7 @@ AeBuildLocalTables (void)
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* DESCRIPTION:
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -243,10 +310,9 @@ AeInstallTables (void)
|
||||
ACPI_STATUS Status;
|
||||
|
||||
|
||||
#if 0
|
||||
Status = AcpiLoadTables ();
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) &LocalFADT);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
@ -260,12 +326,12 @@ AeInstallTables (void)
|
||||
printf ("**** Could not load local FACS, %s\n", AcpiFormatException (Status));
|
||||
return (Status);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (Status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* FUNCTION: AeLocalGetRootPointer
|
||||
@ -282,10 +348,11 @@ AeInstallTables (void)
|
||||
ACPI_STATUS
|
||||
AeLocalGetRootPointer (
|
||||
UINT32 Flags,
|
||||
ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
|
||||
ACPI_POINTER *Address)
|
||||
{
|
||||
|
||||
*RsdpPhysicalAddress = ACPI_TO_INTEGER (&LocalRSDP);
|
||||
Address->PointerType = ACPI_LOGICAL_POINTER;
|
||||
Address->Pointer.Logical = &LocalRSDP;
|
||||
return (AE_OK);
|
||||
}
|
||||
|
||||
@ -315,15 +382,15 @@ AeRegionHandler (
|
||||
|
||||
ACPI_OPERAND_OBJECT *RegionObject = (ACPI_OPERAND_OBJECT*) RegionContext;
|
||||
ACPI_PHYSICAL_ADDRESS BaseAddress;
|
||||
UINT32 Length;
|
||||
ACPI_SIZE Length;
|
||||
BOOLEAN BufferExists;
|
||||
REGION *RegionElement;
|
||||
void *BufferValue;
|
||||
UINT32 ByteWidth;
|
||||
UINT32 i;
|
||||
|
||||
|
||||
PROC_NAME ("AeRegionHandler");
|
||||
|
||||
ACPI_FUNCTION_NAME ("AeRegionHandler");
|
||||
|
||||
/*
|
||||
* If the object is not a region, simply return
|
||||
@ -333,25 +400,93 @@ 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;
|
||||
|
||||
/*
|
||||
* Find the region's address space and length before searching
|
||||
* the linked list.
|
||||
*/
|
||||
BaseAddress = RegionObject->Region.Address;
|
||||
Length = RegionObject->Region.Length;
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Search through the linked list for this region's buffer
|
||||
*/
|
||||
BufferExists = FALSE;
|
||||
RegionElement = Regions.RegionList;
|
||||
RegionElement = AeRegions.RegionList;
|
||||
|
||||
if (0 != Regions.NumberOfRegions)
|
||||
if (AeRegions.NumberOfRegions)
|
||||
{
|
||||
while (!BufferExists && RegionElement)
|
||||
{
|
||||
@ -370,7 +505,7 @@ AeRegionHandler (
|
||||
/*
|
||||
* If the Region buffer does not exist, create it now
|
||||
*/
|
||||
if (FALSE == BufferExists)
|
||||
if (!BufferExists)
|
||||
{
|
||||
/*
|
||||
* Do the memory allocations first
|
||||
@ -388,7 +523,7 @@ AeRegionHandler (
|
||||
return AE_NO_MEMORY;
|
||||
}
|
||||
|
||||
MEMSET (RegionElement->Buffer, 0, Length);
|
||||
ACPI_MEMSET (RegionElement->Buffer, 0, Length);
|
||||
RegionElement->Address = BaseAddress;
|
||||
RegionElement->Length = Length;
|
||||
RegionElement->NextRegion = NULL;
|
||||
@ -398,14 +533,14 @@ AeRegionHandler (
|
||||
* at the head of the list as it will probably get accessed
|
||||
* more often anyway.
|
||||
*/
|
||||
Regions.NumberOfRegions += 1;
|
||||
AeRegions.NumberOfRegions += 1;
|
||||
|
||||
if (NULL != Regions.RegionList)
|
||||
if (NULL != AeRegions.RegionList)
|
||||
{
|
||||
RegionElement->NextRegion = Regions.RegionList->NextRegion;
|
||||
RegionElement->NextRegion = AeRegions.RegionList->NextRegion;
|
||||
}
|
||||
|
||||
Regions.RegionList = RegionElement;
|
||||
AeRegions.RegionList = RegionElement;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -450,20 +585,19 @@ AeRegionHandler (
|
||||
/*
|
||||
* Set the pointer Value to whatever is in the buffer
|
||||
*/
|
||||
MEMCPY (Value, BufferValue, ByteWidth);
|
||||
ACPI_MEMCPY (Value, BufferValue, ByteWidth);
|
||||
break;
|
||||
|
||||
case ACPI_WRITE:
|
||||
/*
|
||||
* Write the contents of Value to the buffer
|
||||
*/
|
||||
MEMCPY (BufferValue, Value, ByteWidth);
|
||||
ACPI_MEMCPY (BufferValue, Value, ByteWidth);
|
||||
break;
|
||||
|
||||
default:
|
||||
return AE_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
return AE_OK;
|
||||
}
|
||||
|
||||
@ -519,6 +653,7 @@ AeNotifyHandler (
|
||||
|
||||
switch (Value)
|
||||
{
|
||||
#if 0
|
||||
case 0:
|
||||
printf ("**** Method Error 0x%X: Results not equal\n", Value);
|
||||
if (AcpiGbl_DebugFile)
|
||||
@ -545,9 +680,11 @@ AeNotifyHandler (
|
||||
}
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
default:
|
||||
printf ("**** Received a notify, value 0x%X\n", Value);
|
||||
printf ("**** Received a Notify on Device [%s] %p value 0x%X\n",
|
||||
((ACPI_NAMESPACE_NODE *) Device)->Name.Ascii, Device, Value);
|
||||
if (AcpiGbl_DebugFile)
|
||||
{
|
||||
AcpiOsPrintf ("**** Received a notify, value 0x%X\n", Value);
|
||||
@ -571,8 +708,8 @@ AeNotifyHandler (
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 0x80};
|
||||
#define AEXEC_NUM_REGIONS 5
|
||||
ACPI_ADR_SPACE_TYPE SpaceId[] = {0, 1, 2, 3, 4, 0x80};
|
||||
#define AEXEC_NUM_REGIONS 6
|
||||
|
||||
ACPI_STATUS
|
||||
AeInstallHandlers (void)
|
||||
@ -581,7 +718,7 @@ AeInstallHandlers (void)
|
||||
UINT32 i;
|
||||
|
||||
|
||||
PROC_NAME ("AeInstallHandlers");
|
||||
ACPI_FUNCTION_NAME ("AeInstallHandlers");
|
||||
|
||||
|
||||
Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
|
||||
@ -615,8 +752,8 @@ AeInstallHandlers (void)
|
||||
* Initialize the global Region Handler space
|
||||
* MCW 3/23/00
|
||||
*/
|
||||
Regions.NumberOfRegions = 0;
|
||||
Regions.RegionList = NULL;
|
||||
AeRegions.NumberOfRegions = 0;
|
||||
AeRegions.RegionList = NULL;
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Module Name: aemain - Main routine for the AcpiExec utility
|
||||
* $Revision: 1.57 $
|
||||
* $Revision: 1.75 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
@ -117,6 +117,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "acpi.h"
|
||||
#include "amlcode.h"
|
||||
@ -124,90 +125,22 @@
|
||||
#include "acnamesp.h"
|
||||
#include "acinterp.h"
|
||||
#include "acdebug.h"
|
||||
#include "acapps.h"
|
||||
|
||||
#include "aecommon.h"
|
||||
|
||||
|
||||
#define _COMPONENT PARSER
|
||||
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 (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)
|
||||
{
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
#if ACPI_MACHINE_WIDTH != 16
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _COMPONENT PARSER
|
||||
ACPI_MODULE_NAME ("aemain")
|
||||
|
||||
|
||||
#ifdef _IA16
|
||||
#if ACPI_MACHINE_WIDTH == 16
|
||||
|
||||
ACPI_STATUS
|
||||
AcpiGetIrqRoutingTable (
|
||||
ACPI_HANDLE DeviceHandle,
|
||||
@ -240,7 +173,7 @@ usage (void)
|
||||
printf (" Miscellaneous Options\n");
|
||||
printf (" -? Display this message\n");
|
||||
printf (" -i Do not run INI methods\n");
|
||||
printf (" -l DebugLevel Specify debug output level\n");
|
||||
printf (" -x DebugLevel Specify debug output level\n");
|
||||
printf (" -v Verbose init output\n");
|
||||
}
|
||||
|
||||
@ -257,7 +190,7 @@ usage (void)
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
int
|
||||
int ACPI_SYSTEM_XFACE
|
||||
main (
|
||||
int argc,
|
||||
char **argv)
|
||||
@ -269,27 +202,36 @@ main (
|
||||
char Buffer[32];
|
||||
|
||||
|
||||
/* Init globals */
|
||||
|
||||
AcpiDbgLevel = NORMAL_DEFAULT;
|
||||
AcpiDbgLayer = 0xFFFFFFFF;
|
||||
|
||||
|
||||
AeDoDivideCheck ();
|
||||
|
||||
printf ("ACPI AML Execution/Debug Utility ");
|
||||
|
||||
#ifdef _IA16
|
||||
printf ("(16-bit) ");
|
||||
#else
|
||||
printf ("(32-bit) ");
|
||||
#ifdef _DEBUG
|
||||
#if ACPI_MACHINE_WIDTH != 16
|
||||
_CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
printf ("CA version %4.4X [%s]\n", ACPI_CA_VERSION, __DATE__);
|
||||
signal (SIGINT, AeCtrlCHandler);
|
||||
|
||||
/* Init globals */
|
||||
|
||||
AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
|
||||
AcpiDbgLayer = 0xFFFFFFFF;
|
||||
|
||||
/* Init ACPI and start debugger thread */
|
||||
|
||||
AcpiInitializeSubsystem ();
|
||||
AcpiGbl_GlobalLockPresent = TRUE;
|
||||
|
||||
printf ("\nIntel ACPI Component Architecture\nAML Execution/Debug Utility");
|
||||
|
||||
#if ACPI_MACHINE_WIDTH == 16
|
||||
printf (" (16-bit)");
|
||||
#endif
|
||||
|
||||
printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION));
|
||||
printf (" [%s]\n\n", __DATE__);
|
||||
|
||||
/* Get the command line options */
|
||||
|
||||
while ((j = getopt (argc, argv, "?dgil:o:sv")) != EOF) switch(j)
|
||||
while ((j = AcpiGetopt (argc, argv, "?dgio:svx:")) != EOF) switch(j)
|
||||
{
|
||||
case 'd':
|
||||
AcpiGbl_DbOpt_disasm = TRUE;
|
||||
@ -305,8 +247,8 @@ main (
|
||||
AcpiGbl_DbOpt_ini_methods = FALSE;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
AcpiDbgLevel = strtoul (optarg, NULL, 0);
|
||||
case 'x':
|
||||
AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0);
|
||||
AcpiGbl_DbConsoleDebugLevel = AcpiDbgLevel;
|
||||
printf ("Debug Level: %lX\n", AcpiDbgLevel);
|
||||
break;
|
||||
@ -320,7 +262,7 @@ main (
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
AcpiDbgLevel |= ACPI_LV_INIT;
|
||||
AcpiDbgLevel |= ACPI_LV_INIT_NAMES;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
@ -329,9 +271,6 @@ main (
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Init ACPI and start debugger thread */
|
||||
|
||||
AcpiInitializeSubsystem ();
|
||||
|
||||
InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE);
|
||||
if (!AcpiGbl_DbOpt_ini_methods)
|
||||
@ -341,15 +280,15 @@ main (
|
||||
|
||||
/* Standalone filename is the only argument */
|
||||
|
||||
if (argv[optind])
|
||||
if (argv[AcpiGbl_Optind])
|
||||
{
|
||||
AcpiGbl_DbOpt_tables = TRUE;
|
||||
AcpiGbl_DbFilename = argv[optind];
|
||||
AcpiGbl_DbFilename = argv[AcpiGbl_Optind];
|
||||
|
||||
Status = AcpiDbLoadAcpiTable (AcpiGbl_DbFilename);
|
||||
Status = AcpiDbGetAcpiTable (AcpiGbl_DbFilename);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
printf ("**** Could not load input table, %s\n", AcpiFormatException (Status));
|
||||
printf ("**** Could not get input table, %s\n", AcpiFormatException (Status));
|
||||
goto enterloop;
|
||||
}
|
||||
|
||||
@ -362,7 +301,7 @@ main (
|
||||
goto enterloop;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* TBD:
|
||||
* Need a way to call this after the "LOAD" command
|
||||
*/
|
||||
@ -379,6 +318,13 @@ 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);
|
||||
@ -386,12 +332,12 @@ main (
|
||||
AcpiEnableEvent (0, ACPI_EVENT_GPE, 0);
|
||||
}
|
||||
|
||||
#ifdef _IA16
|
||||
#if ACPI_MACHINE_WIDTH == 16
|
||||
else
|
||||
{
|
||||
#include "16bit.h"
|
||||
|
||||
Status = AfFindDsdt (NULL, NULL);
|
||||
Status = AfFindTable (DSDT_SIG, NULL, NULL);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
goto enterloop;
|
||||
@ -427,6 +373,13 @@ 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user