Support for AcpiGetVendorResource

This commit is contained in:
rmoore1 2005-11-14 21:43:50 +00:00
parent 78b0fcd499
commit ca028a8386
7 changed files with 219 additions and 129 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 1.166 $
* $Revision: 1.167 $
*
*****************************************************************************/
@ -184,9 +184,11 @@
*/
#define ACPI_GET8(addr) (*(UINT8*)(addr))
/* Pointer arithmetic */
/* Pointer manipulation */
#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (ACPI_NATIVE_UINT)(b))
#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
#define ACPI_PTR_ADD(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_NATIVE_UINT)(b)))
#define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) ((char *)(a) - (char *)(b))
/* Pointer/Integer type conversions */
@ -196,9 +198,6 @@
#define ACPI_OFFSET(d,f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
#if ACPI_MACHINE_WIDTH == 16
#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
@ -444,6 +443,13 @@
#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask)
#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)
/* Generate a UUID */
#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
(b) & 0xFF, ((b) >> 8) & 0xFF, \
(c) & 0xFF, ((c) >> 8) & 0xFF, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
/*
* An ACPI_NAMESPACE_NODE * can appear in some contexts,
* where a pointer to an ACPI_OPERAND_OBJECT can also

View File

@ -465,6 +465,12 @@ ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
ACPI_RESOURCE *Resource,
void *Context);
ACPI_STATUS
AcpiGetVendorResource (
ACPI_HANDLE DeviceHandle,
char *Name,
ACPI_VENDOR_UUID *Uuid,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiGetCurrentResources(
@ -478,10 +484,10 @@ AcpiGetPossibleResources(
ACPI_STATUS
AcpiWalkResources (
ACPI_HANDLE DeviceHandle,
char *Path,
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
void *Context);
ACPI_HANDLE DeviceHandle,
char *Name,
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
void *Context);
ACPI_STATUS
AcpiSetCurrentResources (

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
* $Revision: 1.54 $
* $Revision: 1.55 $
*
*****************************************************************************/
@ -216,9 +216,18 @@ extern ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[];
/* Resource tables indexed by raw AML resource descriptor type */
extern const UINT8 AcpiGbl_ResourceStructSizes[];
extern ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[];
extern const UINT8 AcpiGbl_ResourceStructSizes[];
typedef struct acpi_vendor_walk_info
{
ACPI_VENDOR_UUID *Uuid;
ACPI_BUFFER *Buffer;
ACPI_STATUS Status;
} ACPI_VENDOR_WALK_INFO;
/*
* rscreate

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 1.288 $
* $Revision: 1.289 $
*
*****************************************************************************/
@ -1165,6 +1165,22 @@ typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descr
#pragma pack(1)
#endif
#define ACPI_UUID_LENGTH 16
/* UUID data structures for use in vendor-defined resource descriptors */
typedef struct acpi_uuid
{
UINT8 Data[ACPI_UUID_LENGTH];
} ACPI_UUID;
typedef struct acpi_vendor_uuid
{
UINT8 Subtype;
UINT8 Data[ACPI_UUID_LENGTH];
} ACPI_VENDOR_UUID;
/*
* Structures used to describe device resources
*/
@ -1228,6 +1244,17 @@ typedef struct acpi_resource_vendor
} ACPI_RESOURCE_VENDOR;
/* Vendor resource with UUID info (introduced in ACPI 3.0) */
typedef struct acpi_resource_vendor_typed
{
UINT16 ByteLength;
UINT8 UuidSubtype;
UINT8 Uuid[ACPI_UUID_LENGTH];
UINT8 ByteData[1];
} ACPI_RESOURCE_VENDOR_TYPED;
typedef struct acpi_resource_end_tag
{
UINT8 Checksum;
@ -1417,6 +1444,7 @@ typedef union acpi_resource_data
ACPI_RESOURCE_IO Io;
ACPI_RESOURCE_FIXED_IO FixedIo;
ACPI_RESOURCE_VENDOR Vendor;
ACPI_RESOURCE_VENDOR_TYPED VendorTyped;
ACPI_RESOURCE_END_TAG EndTag;
ACPI_RESOURCE_MEMORY24 Memory24;
ACPI_RESOURCE_MEMORY32 Memory32;

View File

@ -229,7 +229,12 @@ AeDisplayAllMethods (
UINT32 DisplayCount);
ACPI_STATUS
AeInstallHandlers (void);
AeInstallHandlers (
void);
void
AeMiscellaneousTests (
void);
#endif /* _AECOMMON */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: aeexec - Support routines for AcpiExec utility
* $Revision: 1.88 $
* $Revision: 1.89 $
*
*****************************************************************************/
@ -945,3 +945,150 @@ AeInstallHandlers (void)
}
/******************************************************************************
*
* FUNCTION: AeGpeHandler
*
* DESCRIPTION: GPE handler for acpiexec
*
*****************************************************************************/
UINT32
AeGpeHandler (
void *Context)
{
AcpiOsPrintf ("Received a GPE at handler\n");
return (0);
}
/******************************************************************************
*
* FUNCTION: AfInstallGpeBlock
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Various GPE initialization
*
*****************************************************************************/
void
AfInstallGpeBlock (
void)
{
ACPI_STATUS Status;
ACPI_HANDLE Handle;
ACPI_HANDLE Handle2 = NULL;
ACPI_HANDLE Handle3 = NULL;
ACPI_GENERIC_ADDRESS BlockAddress;
Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
if (ACPI_FAILURE (Status))
{
return;
}
BlockAddress.AddressSpaceId = 0;
#if ACPI_MACHINE_WIDTH != 16
ACPI_STORE_ADDRESS (BlockAddress.Address, 0x8000000076540000);
#else
ACPI_STORE_ADDRESS (BlockAddress.Address, 0x76540000);
#endif
// Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 4, 8);
/* Above should fail, ignore */
Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2);
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 8, 8);
AcpiInstallGpeHandler (Handle2, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (Handle2, 8, ACPI_GPE_TYPE_WAKE);
AcpiEnableGpe (Handle2, 8, 0);
}
Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
}
// Status = AcpiRemoveGpeBlock (Handle);
// Status = AcpiRemoveGpeBlock (Handle2);
// Status = AcpiRemoveGpeBlock (Handle3);
}
void
AeMiscellaneousTests (
void)
{
ACPI_HANDLE Handle;
ACPI_BUFFER ReturnBuf;
char Buffer[32];
ACPI_VENDOR_UUID Uuid = {0, ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)};
ACPI_STATUS Status;
ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer;
AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 0, ACPI_GPE_TYPE_WAKE_RUN);
AcpiEnableGpe (NULL, 0, ACPI_NOT_ISR);
AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 0, ACPI_GPE_TYPE_WAKE_RUN);
AcpiEnableGpe (NULL, 0, ACPI_NOT_ISR);
AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 1, ACPI_GPE_TYPE_RUNTIME);
AcpiEnableGpe (NULL, 1, ACPI_NOT_ISR);
AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 2, ACPI_GPE_TYPE_WAKE);
AcpiEnableGpe (NULL, 2, ACPI_NOT_ISR);
AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 3, ACPI_GPE_TYPE_WAKE_RUN);
AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 4, ACPI_GPE_TYPE_RUNTIME);
AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 5, ACPI_GPE_TYPE_WAKE);
AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 0x19, ACPI_GPE_TYPE_WAKE_RUN);
AcpiEnableGpe (NULL, 0x19, ACPI_NOT_ISR);
AfInstallGpeBlock ();
Status = AcpiGetHandle (NULL, "RSRC", &Handle);
if (ACPI_FAILURE (Status))
{
return;
}
ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
if (ACPI_SUCCESS (Status))
{
AcpiOsFree (ReturnBuf.Pointer);
}
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: aemain - Main routine for the AcpiExec utility
* $Revision: 1.95 $
* $Revision: 1.98 $
*
*****************************************************************************/
@ -114,19 +114,6 @@
*
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "acpi.h"
#include "amlcode.h"
#include "acparser.h"
#include "acnamesp.h"
#include "acinterp.h"
#include "acdebug.h"
#include "acapps.h"
#include "aecommon.h"
#ifdef _DEBUG
@ -154,65 +141,6 @@ AcpiGetIrqRoutingTable (
#endif
UINT32
AeGpeHandler (
void *Context)
{
AcpiOsPrintf ("Received a GPE at handler\n");
return (0);
}
void
AfInstallGpeBlock (void)
{
ACPI_STATUS Status;
ACPI_HANDLE Handle;
ACPI_HANDLE Handle2 = NULL;
ACPI_HANDLE Handle3 = NULL;
ACPI_GENERIC_ADDRESS BlockAddress;
Status = AcpiGetHandle (NULL, "\\_GPE", &Handle);
if (ACPI_FAILURE (Status))
{
return;
}
BlockAddress.AddressSpaceId = 0;
#if ACPI_MACHINE_WIDTH != 16
ACPI_STORE_ADDRESS (BlockAddress.Address, 0x8000000076540000);
#else
ACPI_STORE_ADDRESS (BlockAddress.Address, 0x76540000);
#endif
// Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 4, 8);
/* Above should fail, ignore */
Status = AcpiGetHandle (NULL, "\\GPE2", &Handle2);
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallGpeBlock (Handle2, &BlockAddress, 8, 8);
AcpiInstallGpeHandler (Handle2, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (Handle2, 8, ACPI_GPE_TYPE_WAKE);
AcpiEnableGpe (Handle2, 8, 0);
}
Status = AcpiGetHandle (NULL, "\\GPE3", &Handle3);
if (ACPI_SUCCESS (Status))
{
Status = AcpiInstallGpeBlock (Handle3, &BlockAddress, 8, 11);
}
// Status = AcpiRemoveGpeBlock (Handle);
// Status = AcpiRemoveGpeBlock (Handle2);
// Status = AcpiRemoveGpeBlock (Handle3);
}
/******************************************************************************
*
* FUNCTION: usage
@ -263,9 +191,7 @@ main (
int j;
ACPI_STATUS Status;
UINT32 InitFlags;
ACPI_BUFFER ReturnBuf;
ACPI_TABLE_HEADER *Table;
char Buffer[32];
#ifdef _DEBUG
@ -330,7 +256,7 @@ main (
case 'x':
AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0);
AcpiGbl_DbConsoleDebugLevel = AcpiDbgLevel;
printf ("Debug Level: %lX\n", AcpiDbgLevel);
printf ("Debug Level: %X\n", AcpiDbgLevel);
break;
case 'o':
@ -405,44 +331,7 @@ main (
goto enterloop;
}
ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer;
AcpiGetName (AcpiGbl_RootNode, ACPI_FULL_PATHNAME, &ReturnBuf);
AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 0, ACPI_GPE_TYPE_WAKE_RUN);
AcpiEnableGpe (NULL, 0, ACPI_NOT_ISR);
AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
AcpiInstallGpeHandler (NULL, 0, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 0, ACPI_GPE_TYPE_WAKE_RUN);
AcpiEnableGpe (NULL, 0, ACPI_NOT_ISR);
AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 1, ACPI_GPE_TYPE_RUNTIME);
AcpiEnableGpe (NULL, 1, ACPI_NOT_ISR);
AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 2, ACPI_GPE_TYPE_WAKE);
AcpiEnableGpe (NULL, 2, ACPI_NOT_ISR);
AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 3, ACPI_GPE_TYPE_WAKE_RUN);
AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 4, ACPI_GPE_TYPE_RUNTIME);
AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 5, ACPI_GPE_TYPE_WAKE);
AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
AcpiSetGpeType (NULL, 0x19, ACPI_GPE_TYPE_WAKE_RUN);
AcpiEnableGpe (NULL, 0x19, ACPI_NOT_ISR);
AfInstallGpeBlock ();
AeMiscellaneousTests ();
}
#if ACPI_MACHINE_WIDTH == 16