date 2003.02.28.16.05.00; author rmoore1; state Exp;

This commit is contained in:
aystarik 2005-06-29 20:40:43 +00:00
parent 75147c8ff3
commit a4d5e964af
2 changed files with 91 additions and 31 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: aeexec - Support routines for AcpiExec utility * Module Name: aeexec - Support routines for AcpiExec utility
* $Revision: 1.64 $ * $Revision: 1.67 $
* *
*****************************************************************************/ *****************************************************************************/
@ -9,7 +9,7 @@
* *
* 1. Copyright Notice * 1. Copyright Notice
* *
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved. * All rights reserved.
* *
* 2. License * 2. License
@ -150,12 +150,13 @@ RSDP_DESCRIPTOR LocalRsdp;
RSDP_DESCRIPTOR LocalRSDP; RSDP_DESCRIPTOR LocalRSDP;
FADT_DESCRIPTOR_REV1 LocalFADT; FADT_DESCRIPTOR_REV1 LocalFADT;
FACS_DESCRIPTOR_REV1 LocalFACS; FACS_DESCRIPTOR_REV1 LocalFACS;
ACPI_TABLE_HEADER LocalDSDT;
ACPI_TABLE_HEADER LocalTEST; ACPI_TABLE_HEADER LocalTEST;
ACPI_TABLE_HEADER LocalBADTABLE; ACPI_TABLE_HEADER LocalBADTABLE;
RSDT_DESCRIPTOR_REV1 *LocalRSDT; RSDT_DESCRIPTOR_REV1 *LocalRSDT;
#define RSDT_TABLES 3 #define RSDT_TABLES 4
#define RSDT_SIZE (sizeof (RSDT_DESCRIPTOR_REV1) + ((RSDT_TABLES -1) * sizeof (UINT32))) #define RSDT_SIZE (sizeof (RSDT_DESCRIPTOR_REV1) + ((RSDT_TABLES -1) * sizeof (UINT32)))
@ -205,9 +206,11 @@ AeCtrlCHandler (
*****************************************************************************/ *****************************************************************************/
ACPI_STATUS ACPI_STATUS
AeBuildLocalTables (void) AeBuildLocalTables (
ACPI_TABLE_HEADER *UserTable)
{ {
/* Build an RSDT */ /* Build an RSDT */
LocalRSDT = AcpiOsAllocate (RSDT_SIZE); LocalRSDT = AcpiOsAllocate (RSDT_SIZE);
@ -220,10 +223,10 @@ AeBuildLocalTables (void)
ACPI_STRNCPY (LocalRSDT->Header.Signature, RSDT_SIG, 4); ACPI_STRNCPY (LocalRSDT->Header.Signature, RSDT_SIG, 4);
LocalRSDT->Header.Length = RSDT_SIZE; LocalRSDT->Header.Length = RSDT_SIZE;
LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); /* Just a placeholder for a user SSDT */
LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT);
LocalRSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE); LocalRSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE);
LocalRSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); LocalRSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST);
LocalRSDT->Header.Checksum = (UINT8) (0 - AcpiTbChecksum (LocalRSDT, LocalRSDT->Header.Length));
/* Build an RSDP */ /* Build an RSDP */
@ -231,17 +234,48 @@ AeBuildLocalTables (void)
ACPI_STRNCPY (LocalRSDP.Signature, RSDP_SIG, 8); ACPI_STRNCPY (LocalRSDP.Signature, RSDP_SIG, 8);
LocalRSDP.Revision = 1; LocalRSDP.Revision = 1;
LocalRSDP.RsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalRSDT); LocalRSDP.RsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalRSDT);
LocalRSDP.Checksum = (UINT8) (0 - AcpiTbChecksum (&LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH));
AcpiGbl_RSDP = &LocalRSDP; AcpiGbl_RSDP = &LocalRSDP;
/*
* Examine the incoming user table. At this point, it has been verified
* to be either a DSDT, SSDT, or a PSDT, but they must be handled differently
*/
if (!ACPI_STRNCMP ((char *) UserTable->Signature, DSDT_SIG, 4))
{
/* User DSDT is installed directly into the FADT */
AcpiGbl_DSDT = UserTable;
}
else
{
/* Build a local DSDT because incoming table is an SSDT or PSDT */
ACPI_MEMSET (&LocalDSDT, 0, sizeof (ACPI_TABLE_HEADER));
ACPI_STRNCPY (LocalDSDT.Signature, DSDT_SIG, 4);
LocalDSDT.Revision = 1;
LocalDSDT.Length = sizeof (ACPI_TABLE_HEADER);
LocalDSDT.Checksum = (UINT8) (0 - AcpiTbChecksum (&LocalDSDT, LocalDSDT.Length));
AcpiGbl_DSDT = &LocalDSDT;
/* Install incoming table (SSDT or PSDT) directly into the RSDT */
LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (UserTable);
}
/* Set checksums for both RSDT and RSDP */
LocalRSDT->Header.Checksum = (UINT8) (0 - AcpiTbChecksum (LocalRSDT, LocalRSDT->Header.Length));
LocalRSDP.Checksum = (UINT8) (0 - AcpiTbChecksum (&LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH));
/* Build a FADT so we can test the hardware/event init */ /* Build a FADT so we can test the hardware/event init */
ACPI_MEMSET (&LocalFADT, 0, sizeof (FADT_DESCRIPTOR_REV1)); ACPI_MEMSET (&LocalFADT, 0, sizeof (FADT_DESCRIPTOR_REV1));
ACPI_STRNCPY (LocalFADT.Header.Signature, FADT_SIG, 4); ACPI_STRNCPY (LocalFADT.Header.Signature, FADT_SIG, 4);
LocalFADT.FirmwareCtrl = ACPI_PTR_TO_PHYSADDR (&LocalFACS); LocalFADT.FirmwareCtrl = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
LocalFADT.Dsdt = ACPI_PTR_TO_PHYSADDR (AcpiGbl_DbTablePtr); LocalFADT.Dsdt = ACPI_PTR_TO_PHYSADDR (AcpiGbl_DSDT);
LocalFADT.Header.Revision = 1; LocalFADT.Header.Revision = 1;
LocalFADT.Header.Length = sizeof (FADT_DESCRIPTOR_REV1); LocalFADT.Header.Length = sizeof (FADT_DESCRIPTOR_REV1);
LocalFADT.Gpe0BlkLen = 4; LocalFADT.Gpe0BlkLen = 4;
@ -629,6 +663,7 @@ AeRegionInit (
} }
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: AeNotifyHandler * FUNCTION: AeNotifyHandler
@ -747,6 +782,9 @@ AeInstallHandlers (void)
} }
} }
/* /*
* Initialize the global Region Handler space * Initialize the global Region Handler space
* MCW 3/23/00 * MCW 3/23/00

View File

@ -1,7 +1,7 @@
/****************************************************************************** /******************************************************************************
* *
* Module Name: aemain - Main routine for the AcpiExec utility * Module Name: aemain - Main routine for the AcpiExec utility
* $Revision: 1.69 $ * $Revision: 1.78 $
* *
*****************************************************************************/ *****************************************************************************/
@ -9,7 +9,7 @@
* *
* 1. Copyright Notice * 1. Copyright Notice
* *
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved. * All rights reserved.
* *
* 2. License * 2. License
@ -117,6 +117,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <signal.h>
#include "acpi.h" #include "acpi.h"
#include "amlcode.h" #include "amlcode.h"
@ -124,6 +125,7 @@
#include "acnamesp.h" #include "acnamesp.h"
#include "acinterp.h" #include "acinterp.h"
#include "acdebug.h" #include "acdebug.h"
#include "acapps.h"
#include "aecommon.h" #include "aecommon.h"
@ -148,6 +150,19 @@ AcpiGetIrqRoutingTable (
} }
#endif #endif
void
AeGpeHandler (
void *Context)
{
AcpiOsPrintf ("Received a GPE at handler\n");
}
/****************************************************************************** /******************************************************************************
* *
* FUNCTION: usage * FUNCTION: usage
@ -171,7 +186,7 @@ usage (void)
printf (" Miscellaneous Options\n"); printf (" Miscellaneous Options\n");
printf (" -? Display this message\n"); printf (" -? Display this message\n");
printf (" -i Do not run INI methods\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"); printf (" -v Verbose init output\n");
} }
@ -197,6 +212,7 @@ main (
ACPI_STATUS Status; ACPI_STATUS Status;
UINT32 InitFlags; UINT32 InitFlags;
ACPI_BUFFER ReturnBuf; ACPI_BUFFER ReturnBuf;
ACPI_TABLE_HEADER *Table;
char Buffer[32]; char Buffer[32];
@ -206,26 +222,30 @@ main (
#endif #endif
#endif #endif
signal (SIGINT, AeCtrlCHandler);
/* Init globals */ /* Init globals */
AcpiDbgLevel = NORMAL_DEFAULT; AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
AcpiDbgLayer = 0xFFFFFFFF; AcpiDbgLayer = 0xFFFFFFFF;
/* Init ACPI and start debugger thread */ /* Init ACPI and start debugger thread */
AcpiInitializeSubsystem (); AcpiInitializeSubsystem ();
AcpiGbl_GlobalLockPresent = TRUE;
printf ("\nIntel ACPI Component Architecture\nAML Execution/Debug Utility"); printf ("\nIntel ACPI Component Architecture\nAML Execution/Debug Utility");
#if ACPI_MACHINE_WIDTH == 16 #if ACPI_MACHINE_WIDTH == 16
printf ("(16-bit)"); printf (" (16-bit)");
#endif #endif
printf (" version %8.8X [%s]\n\n", (UINT32) ACPI_CA_VERSION, __DATE__); printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION));
printf (" [%s]\n\n", __DATE__);
/* Get the command line options */ /* 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': case 'd':
AcpiGbl_DbOpt_disasm = TRUE; AcpiGbl_DbOpt_disasm = TRUE;
@ -241,8 +261,8 @@ main (
AcpiGbl_DbOpt_ini_methods = FALSE; AcpiGbl_DbOpt_ini_methods = FALSE;
break; break;
case 'l': case 'x':
AcpiDbgLevel = strtoul (optarg, NULL, 0); AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0);
AcpiGbl_DbConsoleDebugLevel = AcpiDbgLevel; AcpiGbl_DbConsoleDebugLevel = AcpiDbgLevel;
printf ("Debug Level: %lX\n", AcpiDbgLevel); printf ("Debug Level: %lX\n", AcpiDbgLevel);
break; break;
@ -256,7 +276,7 @@ main (
break; break;
case 'v': case 'v':
AcpiDbgLevel |= ACPI_LV_INIT; AcpiDbgLevel |= ACPI_LV_INIT_NAMES;
break; break;
case '?': case '?':
@ -274,20 +294,19 @@ main (
/* Standalone filename is the only argument */ /* Standalone filename is the only argument */
if (argv[optind]) if (argv[AcpiGbl_Optind])
{ {
AcpiGbl_DbOpt_tables = TRUE; AcpiGbl_DbOpt_tables = TRUE;
AcpiGbl_DbFilename = argv[optind]; AcpiGbl_DbFilename = argv[AcpiGbl_Optind];
Status = AcpiDbGetAcpiTable (AcpiGbl_DbFilename); Status = AcpiDbReadTableFromFile (AcpiGbl_DbFilename, &Table);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
printf ("**** Could not get input table, %s\n", AcpiFormatException (Status)); printf ("**** Could not get input table, %s\n", AcpiFormatException (Status));
goto enterloop; goto enterloop;
} }
AeBuildLocalTables (Table);
AeBuildLocalTables ();
Status = AeInstallTables (); Status = AeInstallTables ();
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
@ -295,16 +314,16 @@ main (
goto enterloop; goto enterloop;
} }
/*
* TBD:
* Need a way to call this after the "LOAD" command
*/
Status = AeInstallHandlers (); Status = AeInstallHandlers ();
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto enterloop; goto enterloop;
} }
/*
* TBD:
* Need a way to call this after the "LOAD" command
*/
Status = AcpiEnableSubsystem (InitFlags); Status = AcpiEnableSubsystem (InitFlags);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
@ -319,6 +338,8 @@ main (
goto enterloop; goto enterloop;
} }
AcpiInstallGpeHandler (0, 0, AeGpeHandler, NULL);
ReturnBuf.Length = 32; ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer; ReturnBuf.Pointer = Buffer;
AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf); AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
@ -331,7 +352,7 @@ main (
{ {
#include "16bit.h" #include "16bit.h"
Status = AfFindDsdt (NULL, NULL); Status = AfFindTable (DSDT_SIG, NULL, NULL);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto enterloop; goto enterloop;
@ -352,15 +373,15 @@ main (
goto enterloop; goto enterloop;
} }
/* TBD:
* Need a way to call this after the "LOAD" command
*/
Status = AeInstallHandlers (); Status = AeInstallHandlers ();
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
goto enterloop; goto enterloop;
} }
/* TBD:
* Need a way to call this after the "LOAD" command
*/
Status = AcpiEnableSubsystem (InitFlags); Status = AcpiEnableSubsystem (InitFlags);
if (ACPI_FAILURE (Status)) if (ACPI_FAILURE (Status))
{ {
@ -374,6 +395,7 @@ main (
printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status)); printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status));
goto enterloop; goto enterloop;
} }
} }
#endif #endif