本文整理汇总了C++中ACPI_TO_INTEGER函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_TO_INTEGER函数的具体用法?C++ ACPI_TO_INTEGER怎么用?C++ ACPI_TO_INTEGER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_TO_INTEGER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LsAmlListingWalk
static ACPI_STATUS
LsAmlListingWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
UINT8 FileByte;
UINT32 i;
UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context);
LsWriteNodeToListing (Op, FileId);
if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA)
{
/* Buffer is a resource template, don't dump the data all at once */
return (AE_OK);
}
/* Write the hex bytes to the listing file(s) (if requested) */
for (i = 0; i < Op->Asl.FinalAmlLength; i++)
{
if (ACPI_FAILURE (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1)))
{
FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ);
AslAbort ();
}
LsWriteListingHexBytes (&FileByte, 1, FileId);
}
return (AE_OK);
}
示例2: acpi_os_unmap_memory
void acpi_os_unmap_memory(void *where, acpi_size length)
{
acpi_physical_address offset;
acpi_size page_size;
page_size = acpi_os_get_page_size();
offset = ACPI_TO_INTEGER(where) % page_size;
munmap((u8 *)where - offset, (length + offset));
}
示例3: AcpiOsUnmapMemory
void
AcpiOsUnmapMemory (
void *Where,
ACPI_SIZE Length)
{
ACPI_PHYSICAL_ADDRESS Offset;
ACPI_SIZE PageSize;
PageSize = AcpiOsGetPageSize ();
Offset = ACPI_TO_INTEGER (Where) % PageSize;
munmap ((UINT8 *) Where - Offset, (Length + Offset));
}
示例4: AeSetupConfiguration
static ACPI_STATUS
AeSetupConfiguration (
void *RegionAddr)
{
ACPI_OBJECT_LIST ArgList;
ACPI_OBJECT Arg[3];
/*
* Invoke _CFG method if present
*/
ArgList.Count = 1;
ArgList.Pointer = Arg;
Arg[0].Type = ACPI_TYPE_INTEGER;
Arg[0].Integer.Value = ACPI_TO_INTEGER (RegionAddr);
(void) AcpiEvaluateObject (NULL, "\\_CFG", &ArgList, NULL);
return (AE_OK);
}
示例5: ExInitializeAcpiTables
void
ExInitializeAcpiTables (
void)
{
/* Setup RSDP */
Rsdp->RsdtPhysicalAddress = (UINT32) ACPI_TO_INTEGER (RsdtCode);
Rsdp->XsdtPhysicalAddress = (UINT64) ACPI_TO_INTEGER (XsdtCode);
/* RSDT and XSDT */
Rsdt->TableOffsetEntry[0] = (UINT32) ACPI_TO_INTEGER (FadtCode);
Xsdt->TableOffsetEntry[0] = (UINT64) ACPI_TO_INTEGER (FadtCode);
/* FADT */
Fadt->Facs = 0;
Fadt->Dsdt = 0;
Fadt->XFacs = (UINT64) ACPI_TO_INTEGER (FacsCode);
Fadt->XDsdt = (UINT64) ACPI_TO_INTEGER (DsdtCode);
/* Set new checksums for the modified tables */
Rsdp->Checksum = 0;
Rsdp->Checksum = (UINT8) -AcpiTbChecksum (
(void *) RsdpCode, ACPI_RSDP_CHECKSUM_LENGTH);
Rsdt->Header.Checksum = 0;
Rsdt->Header.Checksum = (UINT8) -AcpiTbChecksum (
(void *) Rsdt, Rsdt->Header.Length);
Xsdt->Header.Checksum = 0;
Xsdt->Header.Checksum = (UINT8) -AcpiTbChecksum (
(void *) Xsdt, Xsdt->Header.Length);
Fadt->Header.Checksum = 0;
Fadt->Header.Checksum = (UINT8) -AcpiTbChecksum (
(void *) Fadt, Fadt->Header.Length);
}
示例6: acpi_tb_find_rsdp
acpi_status
acpi_tb_find_rsdp (
struct acpi_table_desc *table_info,
u32 flags)
{
u8 *table_ptr;
u8 *mem_rover;
u64 phys_addr;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("tb_find_rsdp");
/*
* Scan supports either 1) Logical addressing or 2) Physical addressing
*/
if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
/*
* 1) Search EBDA (low memory) paragraphs
*/
status = acpi_os_map_memory ((u64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE,
(void *) &table_ptr);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE));
return_ACPI_STATUS (status);
}
mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_LO_RSDP_WINDOW_SIZE);
acpi_os_unmap_memory (table_ptr, ACPI_LO_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* Found it, return the physical address */
phys_addr = ACPI_LO_RSDP_WINDOW_BASE;
phys_addr += ACPI_PTR_DIFF (mem_rover,table_ptr);
table_info->physical_address = phys_addr;
return_ACPI_STATUS (AE_OK);
}
/*
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
*/
status = acpi_os_map_memory ((u64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE,
(void *) &table_ptr);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
return_ACPI_STATUS (status);
}
mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* Found it, return the physical address */
phys_addr = ACPI_HI_RSDP_WINDOW_BASE;
phys_addr += ACPI_PTR_DIFF (mem_rover, table_ptr);
table_info->physical_address = phys_addr;
return_ACPI_STATUS (AE_OK);
}
}
/*
* Physical addressing
*/
else {
/*
* 1) Search EBDA (low memory) paragraphs
*/
mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_LO_RSDP_WINDOW_BASE),
ACPI_LO_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* Found it, return the physical address */
table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
return_ACPI_STATUS (AE_OK);
}
/*
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
*/
mem_rover = acpi_tb_scan_memory_for_rsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* Found it, return the physical address */
table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
return_ACPI_STATUS (AE_OK);
}
}
/* RSDP signature was not found */
return_ACPI_STATUS (AE_NOT_FOUND);
}
示例7: AcpiExLoadOp
//.........这里部分代码省略.........
if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER))
{
return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
}
/* Get the actual table length from the table header */
Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer);
Length = Table->Length;
/* Table cannot extend beyond the buffer */
if (Length > ObjDesc->Buffer.Length)
{
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
if (Length < sizeof (ACPI_TABLE_HEADER))
{
return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
}
/*
* Copy the table from the buffer because the buffer could be modified
* or even deleted in the future
*/
TableDesc.Pointer = ACPI_ALLOCATE (Length);
if (!TableDesc.Pointer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ACPI_MEMCPY (TableDesc.Pointer, Table, Length);
TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer);
break;
default:
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/* Validate table checksum (will not get validated in TbAddTable) */
Status = AcpiTbVerifyChecksum (TableDesc.Pointer, Length);
if (ACPI_FAILURE (Status))
{
ACPI_FREE (TableDesc.Pointer);
return_ACPI_STATUS (Status);
}
/* Complete the table descriptor */
TableDesc.Length = Length;
TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
/* Install the new table into the local data structures */
Status = AcpiTbAddTable (&TableDesc, &TableIndex);
if (ACPI_FAILURE (Status))
{
/* Delete allocated table buffer */
AcpiTbDeleteTable (&TableDesc);
return_ACPI_STATUS (Status);
}
示例8: acpi_ns_root_initialize
acpi_status acpi_ns_root_initialize(void)
{
acpi_status status;
const struct acpi_predefined_names *init_val = NULL;
struct acpi_namespace_node *new_node;
union acpi_operand_object *obj_desc;
acpi_string val = NULL;
ACPI_FUNCTION_TRACE(ns_root_initialize);
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
if (acpi_gbl_root_node) {
status = AE_OK;
goto unlock_and_exit;
}
acpi_gbl_root_node = &acpi_gbl_root_node_struct;
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Entering predefined entries into namespace\n"));
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
if (!ACPI_STRCMP(init_val->name, "_OSI")
&& !acpi_gbl_create_osi_method) {
continue;
}
status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
ACPI_IMODE_LOAD_PASS2,
ACPI_NS_NO_UPSEARCH, NULL, &new_node);
if (ACPI_FAILURE(status) || (!new_node)) {
ACPI_EXCEPTION((AE_INFO, status,
"Could not create predefined name %s",
init_val->name));
}
if (init_val->val) {
status = acpi_os_predefined_override(init_val, &val);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO,
"Could not override predefined %s",
init_val->name));
}
if (!val) {
val = init_val->val;
}
obj_desc =
acpi_ut_create_internal_object(init_val->type);
if (!obj_desc) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
}
switch (init_val->type) {
case ACPI_TYPE_METHOD:
obj_desc->method.param_count =
(u8) ACPI_TO_INTEGER(val);
obj_desc->common.flags |= AOPOBJ_DATA_VALID;
#if defined (ACPI_ASL_COMPILER)
new_node->value = obj_desc->method.param_count;
#else
obj_desc->method.info_flags =
ACPI_METHOD_INTERNAL_ONLY;
obj_desc->method.dispatch.implementation =
acpi_ut_osi_implementation;
#endif
break;
case ACPI_TYPE_INTEGER:
obj_desc->integer.value = ACPI_TO_INTEGER(val);
break;
case ACPI_TYPE_STRING:
obj_desc->string.length =
(u32) ACPI_STRLEN(val);
obj_desc->string.pointer = val;
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
//.........这里部分代码省略.........
示例9: AcpiDsEvalTableRegionOperands
ACPI_STATUS
AcpiDsEvalTableRegionOperands (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_OPERAND_OBJECT **Operand;
ACPI_NAMESPACE_NODE *Node;
ACPI_PARSE_OBJECT *NextOp;
UINT32 TableIndex;
ACPI_TABLE_HEADER *Table;
ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
/*
* This is where we evaluate the Signature string, OemId string,
* and OemTableId string of the Data Table Region declaration
*/
Node = Op->Common.Node;
/* NextOp points to Signature string op */
NextOp = Op->Common.Value.Arg;
/*
* Evaluate/create the Signature string, OemId string,
* and OemTableId string operands
*/
Status = AcpiDsCreateOperands (WalkState, NextOp);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Resolve the Signature string, OemId string,
* and OemTableId string operands
*/
Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
ACPI_WALK_OPERANDS, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Operand = &WalkState->Operands[0];
/* Find the ACPI table */
Status = AcpiTbFindTable (Operand[0]->String.Pointer,
Operand[1]->String.Pointer, Operand[2]->String.Pointer,
&TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiUtRemoveReference (Operand[0]);
AcpiUtRemoveReference (Operand[1]);
AcpiUtRemoveReference (Operand[2]);
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
ObjDesc->Region.Length = Table->Length;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
ObjDesc,
ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
ObjDesc->Region.Length));
/* Now the address and length are valid for this opregion */
ObjDesc->Region.Flags |= AOPOBJ_DATA_VALID;
return_ACPI_STATUS (Status);
}
示例10: TrDoSwitch
static void
TrDoSwitch (
ACPI_PARSE_OBJECT *StartNode)
{
ACPI_PARSE_OBJECT *Next;
ACPI_PARSE_OBJECT *CaseOp = NULL;
ACPI_PARSE_OBJECT *CaseBlock = NULL;
ACPI_PARSE_OBJECT *DefaultOp = NULL;
ACPI_PARSE_OBJECT *CurrentParentNode;
ACPI_PARSE_OBJECT *Conditional = NULL;
ACPI_PARSE_OBJECT *Predicate;
ACPI_PARSE_OBJECT *Peer;
ACPI_PARSE_OBJECT *NewOp;
ACPI_PARSE_OBJECT *NewOp2;
ACPI_PARSE_OBJECT *MethodOp;
ACPI_PARSE_OBJECT *StoreOp;
ACPI_PARSE_OBJECT *BreakOp;
ACPI_PARSE_OBJECT *BufferOp;
char *PredicateValueName;
UINT16 Index;
UINT32 Btype;
/* Start node is the Switch() node */
CurrentParentNode = StartNode;
/* Create a new temp name of the form _T_x */
PredicateValueName = TrAmlGetNextTempName (StartNode, &AslGbl_TempCount);
if (!PredicateValueName)
{
return;
}
/* First child is the Switch() predicate */
Next = StartNode->Asl.Child;
/*
* Examine the return type of the Switch Value -
* must be Integer/Buffer/String
*/
Index = (UINT16) (Next->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE);
Btype = AslKeywordMapping[Index].AcpiBtype;
if ((Btype != ACPI_BTYPE_INTEGER) &&
(Btype != ACPI_BTYPE_STRING) &&
(Btype != ACPI_BTYPE_BUFFER))
{
AslError (ASL_WARNING, ASL_MSG_SWITCH_TYPE, Next, NULL);
Btype = ACPI_BTYPE_INTEGER;
}
/* CASE statements start at next child */
Peer = Next->Asl.Next;
while (Peer)
{
Next = Peer;
Peer = Next->Asl.Next;
if (Next->Asl.ParseOpcode == PARSEOP_CASE)
{
if (CaseOp)
{
/* Add an ELSE to complete the previous CASE */
NewOp = TrCreateLeafOp (PARSEOP_ELSE);
NewOp->Asl.Parent = Conditional->Asl.Parent;
TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent);
/* Link ELSE node as a peer to the previous IF */
TrAmlInsertPeer (Conditional, NewOp);
CurrentParentNode = NewOp;
}
CaseOp = Next;
Conditional = CaseOp;
CaseBlock = CaseOp->Asl.Child->Asl.Next;
Conditional->Asl.Child->Asl.Next = NULL;
Predicate = CaseOp->Asl.Child;
if ((Predicate->Asl.ParseOpcode == PARSEOP_PACKAGE) ||
(Predicate->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE))
{
/*
* Convert the package declaration to this form:
*
* If (LNotEqual (Match (Package(<size>){<data>},
* MEQ, _T_x, MTR, Zero, Zero), Ones))
*/
NewOp2 = TrCreateLeafOp (PARSEOP_MATCHTYPE_MEQ);
Predicate->Asl.Next = NewOp2;
TrAmlInitLineNumbers (NewOp2, Conditional);
NewOp = NewOp2;
NewOp2 = TrCreateValuedLeafOp (PARSEOP_NAMESTRING,
(UINT64) ACPI_TO_INTEGER (PredicateValueName));
NewOp->Asl.Next = NewOp2;
//.........这里部分代码省略.........
示例11: acpi_tb_find_rsdp
//.........这里部分代码省略.........
mem_rover = acpi_tb_scan_memory_for_rsdp(table_ptr,
ACPI_EBDA_WINDOW_SIZE);
acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE);
if (mem_rover) {
/* Return the physical address */
physical_address +=
ACPI_PTR_DIFF(mem_rover, table_ptr);
table_info->physical_address =
(acpi_physical_address) physical_address;
return_ACPI_STATUS(AE_OK);
}
}
/*
* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
*/
status = acpi_os_map_memory((acpi_physical_address)
ACPI_HI_RSDP_WINDOW_BASE,
ACPI_HI_RSDP_WINDOW_SIZE,
(void *)&table_ptr);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not map memory at %8.8X for length %X\n",
ACPI_HI_RSDP_WINDOW_BASE,
ACPI_HI_RSDP_WINDOW_SIZE));
return_ACPI_STATUS(status);
}
mem_rover =
acpi_tb_scan_memory_for_rsdp(table_ptr,
ACPI_HI_RSDP_WINDOW_SIZE);
acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* Return the physical address */
physical_address =
ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover,
table_ptr);
table_info->physical_address =
(acpi_physical_address) physical_address;
return_ACPI_STATUS(AE_OK);
}
}
/*
* Physical addressing
*/
else {
/* 1a) Get the location of the EBDA */
ACPI_MOVE_16_TO_32(&physical_address, ACPI_EBDA_PTR_LOCATION);
physical_address <<= 4; /* Convert segment to physical address */
/* EBDA present? */
if (physical_address > 0x400) {
/*
* 1b) Search EBDA paragraphs (EBDa is required to be a minimum of
* 1_k length)
*/
mem_rover =
acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR
(physical_address),
ACPI_EBDA_WINDOW_SIZE);
if (mem_rover) {
/* Return the physical address */
table_info->physical_address =
ACPI_TO_INTEGER(mem_rover);
return_ACPI_STATUS(AE_OK);
}
}
/* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */
mem_rover =
acpi_tb_scan_memory_for_rsdp(ACPI_PHYSADDR_TO_PTR
(ACPI_HI_RSDP_WINDOW_BASE),
ACPI_HI_RSDP_WINDOW_SIZE);
if (mem_rover) {
/* Found it, return the physical address */
table_info->physical_address =
ACPI_TO_INTEGER(mem_rover);
return_ACPI_STATUS(AE_OK);
}
}
/* A valid RSDP was not found */
ACPI_REPORT_ERROR(("No valid RSDP was found\n"));
return_ACPI_STATUS(AE_NOT_FOUND);
}
示例12: LsAmlOffsetWalk
ACPI_STATUS
LsAmlOffsetWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context)
{
UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context);
ACPI_NAMESPACE_NODE *Node;
UINT32 Length;
UINT32 NamepathOffset;
UINT32 DataOffset;
ACPI_PARSE_OBJECT *NextOp;
/* Ignore actual data blocks for resource descriptors */
if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA)
{
return (AE_OK); /* Do NOT update the global AML offset */
}
/* We are only interested in named objects (have a namespace node) */
Node = Op->Asl.Node;
if (!Node)
{
Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength;
return (AE_OK);
}
/* Named resource descriptor (has a descriptor tag) */
if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE) &&
(Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC))
{
LsEmitOffsetTableEntry (FileId, Node, 0, Gbl_CurrentAmlOffset,
Op->Asl.ParseOpName, 0, Op->Asl.Extra, AML_BUFFER_OP);
Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength;
return (AE_OK);
}
switch (Op->Asl.AmlOpcode)
{
case AML_NAME_OP:
/* Named object -- Name (NameString, DataRefObject) */
if (!Op->Asl.Child)
{
FlPrintFile (FileId, "%s NO CHILD!\n", MsgBuffer);
return (AE_OK);
}
Length = Op->Asl.FinalAmlLength;
NamepathOffset = Gbl_CurrentAmlOffset + Length;
/* Get to the NameSeg/NamePath Op (and length of the name) */
Op = Op->Asl.Child;
/* Get offset of last nameseg and the actual data */
NamepathOffset = Gbl_CurrentAmlOffset + Length +
(Op->Asl.FinalAmlLength - ACPI_NAME_SIZE);
DataOffset = Gbl_CurrentAmlOffset + Length +
Op->Asl.FinalAmlLength;
/* Get actual value associated with the name */
Op = Op->Asl.Next;
switch (Op->Asl.AmlOpcode)
{
case AML_BYTE_OP:
case AML_WORD_OP:
case AML_DWORD_OP:
case AML_QWORD_OP:
/* The +1 is to handle the integer size prefix (opcode) */
LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, (DataOffset + 1),
Op->Asl.ParseOpName, Op->Asl.Value.Integer,
(UINT8) Op->Asl.AmlOpcode, AML_NAME_OP);
break;
case AML_ONE_OP:
case AML_ONES_OP:
case AML_ZERO_OP:
/* For these, offset will point to the opcode */
LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, DataOffset,
Op->Asl.ParseOpName, Op->Asl.Value.Integer,
(UINT8) Op->Asl.AmlOpcode, AML_NAME_OP);
break;
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
//.........这里部分代码省略.........
示例13: AcpiNsRootInitialize
//.........这里部分代码省略.........
Status = AcpiOsPredefinedOverride (InitVal, &Val);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR ((AE_INFO,
"Could not override predefined %s",
InitVal->Name));
}
if (!Val)
{
Val = InitVal->Val;
}
/*
* Entry requests an initial value, allocate a
* descriptor for it.
*/
ObjDesc = AcpiUtCreateInternalObject (InitVal->Type);
if (!ObjDesc)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
/*
* Convert value string from table entry to
* internal representation. Only types actually
* used for initial values are implemented here.
*/
switch (InitVal->Type)
{
case ACPI_TYPE_METHOD:
ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val);
ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
#if defined (ACPI_ASL_COMPILER)
/* Save the parameter count for the iASL compiler */
NewNode->Value = ObjDesc->Method.ParamCount;
#else
/* Mark this as a very SPECIAL method */
ObjDesc->Method.InfoFlags = ACPI_METHOD_INTERNAL_ONLY;
ObjDesc->Method.Dispatch.Implementation = AcpiUtOsiImplementation;
#endif
break;
case ACPI_TYPE_INTEGER:
ObjDesc->Integer.Value = ACPI_TO_INTEGER (Val);
break;
case ACPI_TYPE_STRING:
/* Build an object around the static string */
ObjDesc->String.Length = (UINT32) strlen (Val);
ObjDesc->String.Pointer = Val;
ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
break;
case ACPI_TYPE_MUTEX:
ObjDesc->Mutex.Node = NewNode;
示例14: AeExceptionHandler
ACPI_STATUS
AeExceptionHandler (
ACPI_STATUS AmlStatus,
ACPI_NAME Name,
UINT16 Opcode,
UINT32 AmlOffset,
void *Context)
{
ACPI_STATUS NewAmlStatus = AmlStatus;
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
ACPI_OBJECT_LIST ArgList;
ACPI_OBJECT Arg[3];
const char *Exception;
Exception = AcpiFormatException (AmlStatus);
AcpiOsPrintf ("[AcpiExec] Exception %s during execution ", Exception);
if (Name)
{
AcpiOsPrintf ("of method [%4.4s]", (char *) &Name);
}
else
{
AcpiOsPrintf ("at module level (table load)");
}
AcpiOsPrintf (" Opcode [%s] @%X\n", AcpiPsGetOpcodeName (Opcode), AmlOffset);
/*
* Invoke the _ERR method if present
*
* Setup parameter object
*/
ArgList.Count = 3;
ArgList.Pointer = Arg;
Arg[0].Type = ACPI_TYPE_INTEGER;
Arg[0].Integer.Value = AmlStatus;
Arg[1].Type = ACPI_TYPE_STRING;
Arg[1].String.Pointer = ACPI_CAST_PTR (char, Exception);
Arg[1].String.Length = ACPI_STRLEN (Exception);
Arg[2].Type = ACPI_TYPE_INTEGER;
Arg[2].Integer.Value = ACPI_TO_INTEGER (AcpiOsGetThreadId());
/* Setup return buffer */
ReturnObj.Pointer = NULL;
ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
Status = AcpiEvaluateObject (NULL, "\\_ERR", &ArgList, &ReturnObj);
if (ACPI_SUCCESS (Status))
{
if (ReturnObj.Pointer)
{
/* Override original status */
NewAmlStatus = (ACPI_STATUS)
((ACPI_OBJECT *) ReturnObj.Pointer)->Integer.Value;
AcpiOsFree (ReturnObj.Pointer);
}
}
else if (Status != AE_NOT_FOUND)
{
AcpiOsPrintf ("[AcpiExec] Could not execute _ERR method, %s\n",
AcpiFormatException (Status));
}
/* Global override */
if (AcpiGbl_IgnoreErrors)
{
NewAmlStatus = AE_OK;
}
if (NewAmlStatus != AmlStatus)
{
AcpiOsPrintf ("[AcpiExec] Exception override, new status %s\n",
AcpiFormatException (NewAmlStatus));
}
return (NewAmlStatus);
}
示例15: AcpiTbFindRsdp
ACPI_STATUS
AcpiTbFindRsdp (
ACPI_TABLE_DESC *TableInfo,
UINT32 Flags)
{
UINT8 *TablePtr;
UINT8 *MemRover;
UINT64 PhysAddr;
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE ("TbFindRsdp");
/*
* Scan supports either 1) Logical addressing or 2) Physical addressing
*/
if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
{
/*
* 1) Search EBDA (low memory) paragraphs
*/
Status = AcpiOsMapMemory ((UINT64) ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE,
(void **) &TablePtr);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
ACPI_LO_RSDP_WINDOW_BASE, ACPI_LO_RSDP_WINDOW_SIZE));
return_ACPI_STATUS (Status);
}
MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE);
AcpiOsUnmapMemory (TablePtr, ACPI_LO_RSDP_WINDOW_SIZE);
if (MemRover)
{
/* Found it, return the physical address */
PhysAddr = ACPI_LO_RSDP_WINDOW_BASE;
PhysAddr += ACPI_PTR_DIFF (MemRover,TablePtr);
TableInfo->PhysicalAddress = PhysAddr;
return_ACPI_STATUS (AE_OK);
}
/*
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
*/
Status = AcpiOsMapMemory ((UINT64) ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE,
(void **) &TablePtr);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
return_ACPI_STATUS (Status);
}
MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
if (MemRover)
{
/* Found it, return the physical address */
PhysAddr = ACPI_HI_RSDP_WINDOW_BASE;
PhysAddr += ACPI_PTR_DIFF (MemRover, TablePtr);
TableInfo->PhysicalAddress = PhysAddr;
return_ACPI_STATUS (AE_OK);
}
}
/*
* Physical addressing
*/
else
{
/*
* 1) Search EBDA (low memory) paragraphs
*/
MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_LO_RSDP_WINDOW_BASE),
ACPI_LO_RSDP_WINDOW_SIZE);
if (MemRover)
{
/* Found it, return the physical address */
TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
return_ACPI_STATUS (AE_OK);
}
/*
* 2) Search upper memory: 16-byte boundaries in E0000h-F0000h
*/
MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
ACPI_HI_RSDP_WINDOW_SIZE);
if (MemRover)
{
/* Found it, return the physical address */
TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
//.........这里部分代码省略.........