这篇教程C++ ACPI_COMPARE_NAME函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACPI_COMPARE_NAME函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_COMPARE_NAME函数的具体用法?C++ ACPI_COMPARE_NAME怎么用?C++ ACPI_COMPARE_NAME使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACPI_COMPARE_NAME函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: AdCreateTableHeaderstatic voidAdCreateTableHeader ( char *Filename, ACPI_TABLE_HEADER *Table){ char *NewFilename; UINT8 Checksum; /* * Print file header and dump original table header */ AdDisassemblerHeader (Filename); AcpiOsPrintf (" * Original Table Header:/n"); AcpiOsPrintf (" * Signature /"%4.4s/"/n", Table->Signature); AcpiOsPrintf (" * Length 0x%8.8X (%u)/n", Table->Length, Table->Length); /* Print and validate the revision */ AcpiOsPrintf (" * Revision 0x%2.2X", Table->Revision); switch (Table->Revision) { case 0: AcpiOsPrintf (" **** Invalid Revision"); break; case 1: /* Revision of DSDT controls the ACPI integer width */ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT)) { AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support"); } break; default: break; } AcpiOsPrintf ("/n"); /* Print and validate the table checksum */ AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); if (Checksum) { AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", (UINT8) (Table->Checksum - Checksum)); } AcpiOsPrintf ("/n"); AcpiOsPrintf (" * OEM ID /"%.6s/"/n", Table->OemId); AcpiOsPrintf (" * OEM Table ID /"%.8s/"/n", Table->OemTableId); AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)/n", Table->OemRevision, Table->OemRevision); AcpiOsPrintf (" * Compiler ID /"%.4s/"/n", Table->AslCompilerId); AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)/n", Table->AslCompilerRevision, Table->AslCompilerRevision); AcpiOsPrintf (" *//n"); /* Create AML output filename based on input filename */ if (Filename) { NewFilename = FlGenerateFilename (Filename, "aml"); } else { NewFilename = ACPI_ALLOCATE_ZEROED (9); if (NewFilename) { strncat (NewFilename, Table->Signature, 4); strcat (NewFilename, ".aml"); } } if (!NewFilename) { AcpiOsPrintf (" **** Could not generate AML output filename/n"); return; } /* Open the ASL definition block */ AcpiOsPrintf ( "DefinitionBlock (/"%s/", /"%4.4s/", %hu, /"%.6s/", /"%.8s/", 0x%8.8X)/n", NewFilename, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); ACPI_FREE (NewFilename);}
开发者ID:99corps,项目名称:runtime,代码行数:95,
示例2: OslAddTablesToListstatic ACPI_STATUSOslAddTablesToList( void){ ACPI_PHYSICAL_ADDRESS TableAddress; OSL_TABLE_INFO *Info = NULL; OSL_TABLE_INFO *NewInfo; ACPI_TABLE_HEADER *Table; UINT8 Instance; UINT8 NumberOfTables; int i; /* Initialize the table list on first invocation */ if (Gbl_TableListInitialized) { return (AE_OK); } /* Add mandatory tables to global table list first */ for (i = 0; i < 4; i++) { NewInfo = calloc (1, sizeof (*NewInfo)); if (!NewInfo) { return (AE_NO_MEMORY); } switch (i) { case 0: Gbl_TableListHead = Info = NewInfo; continue; case 1: ACPI_MOVE_NAME (NewInfo->Signature, Gbl_Revision ? ACPI_SIG_XSDT : ACPI_SIG_RSDT); break; case 2: ACPI_MOVE_NAME (NewInfo->Signature, ACPI_SIG_FACS); break; default: ACPI_MOVE_NAME (NewInfo->Signature, ACPI_SIG_DSDT); } Info->Next = NewInfo; Info = NewInfo; Gbl_TableListHead->Instance++; } /* Add normal tables from RSDT/XSDT to global list */ if (Gbl_Revision) { NumberOfTables = (Gbl_Xsdt->Header.Length - sizeof (Gbl_Xsdt->Header)) / sizeof (Gbl_Xsdt->TableOffsetEntry[0]); } else { NumberOfTables = (Gbl_Rsdt->Header.Length - sizeof (Gbl_Rsdt->Header)) / sizeof (Gbl_Rsdt->TableOffsetEntry[0]); } for (i = 0; i < NumberOfTables; i++) { if (Gbl_Revision) { TableAddress = Gbl_Xsdt->TableOffsetEntry[i]; } else { TableAddress = Gbl_Rsdt->TableOffsetEntry[i]; } Table = AcpiOsMapMemory (TableAddress, sizeof (*Table)); if (!Table) { return (AE_BAD_ADDRESS); } Instance = 0; NewInfo = Gbl_TableListHead; while (NewInfo->Next != NULL) { NewInfo = NewInfo->Next; if (ACPI_COMPARE_NAME (Table->Signature, NewInfo->Signature)) { Instance++; } }//.........这里部分代码省略.........
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:101,
示例3: AcpiTbLoadNamespacestatic ACPI_STATUSAcpiTbLoadNamespace ( void){ ACPI_STATUS Status; UINT32 i; ACPI_TABLE_HEADER *NewDsdt; ACPI_FUNCTION_TRACE (TbLoadNamespace); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* * Load the namespace. The DSDT is required, but any SSDT and * PSDT tables are optional. Verify the DSDT. */ if (!AcpiGbl_RootTableList.CurrentTableCount || !ACPI_COMPARE_NAME ( &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), ACPI_SIG_DSDT) || ACPI_FAILURE (AcpiTbVerifyTable ( &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) { Status = AE_NO_ACPI_TABLES; goto UnlockAndExit; } /* * Save the DSDT pointer for simple access. This is the mapped memory * address. We must take care here because the address of the .Tables * array can change dynamically as tables are loaded at run-time. Note: * .Pointer field is not validated until after call to AcpiTbVerifyTable. */ AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer; /* * Optionally copy the entire DSDT to local memory (instead of simply * mapping it.) There are some BIOSs that corrupt or replace the original * DSDT, creating the need for this option. Default is FALSE, do not copy * the DSDT. */ if (AcpiGbl_CopyDsdtLocally) { NewDsdt = AcpiTbCopyDsdt (ACPI_TABLE_INDEX_DSDT); if (NewDsdt) { AcpiGbl_DSDT = NewDsdt; } } /* * Save the original DSDT header for detection of table corruption * and/or replacement of the DSDT from outside the OS. */ ACPI_MEMCPY (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER)); (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); /* Load and parse tables */ Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), ACPI_SIG_PSDT)) || ACPI_FAILURE (AcpiTbVerifyTable ( &AcpiGbl_RootTableList.Tables[i]))) { continue; } /* Ignore errors while loading tables, get as many as possible */ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); (void) AcpiNsLoadTable (i, AcpiGbl_RootNode); (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); } ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired/n"));UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status);}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:97,
示例4: AcpiDbExecute//.........这里部分代码省略......... if (*Name == '*') { (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL); return; } else { NameString = ACPI_ALLOCATE (strlen (Name) + 1); if (!NameString) { return; } memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); strcpy (NameString, Name); AcpiUtStrupr (NameString); AcpiGbl_DbMethodInfo.Name = NameString; AcpiGbl_DbMethodInfo.Args = Args; AcpiGbl_DbMethodInfo.Types = Types; AcpiGbl_DbMethodInfo.Flags = Flags; ReturnObj.Pointer = NULL; ReturnObj.Length = ACPI_ALLOCATE_BUFFER; Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); if (ACPI_FAILURE (Status)) { ACPI_FREE (NameString); return; } /* Get the NS node, determines existence also */ Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, &AcpiGbl_DbMethodInfo.Method); if (ACPI_SUCCESS (Status)) { Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj); } ACPI_FREE (NameString); } /* * Allow any handlers in separate threads to complete. * (Such as Notify handlers invoked from AML executed above). */ AcpiOsSleep ((UINT64) 10);#ifdef ACPI_DEBUG_OUTPUT /* Memory allocation tracking */ Allocations = AcpiDbGetOutstandingAllocations () - PreviousAllocations; AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); if (Allocations > 0) { AcpiOsPrintf ("0x%X Outstanding allocations after evaluation of %s/n", Allocations, AcpiGbl_DbMethodInfo.Pathname); }#endif if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Evaluation of %s failed with status %s/n", AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status)); } else { /* Display a return object, if any */ if (ReturnObj.Length) { AcpiOsPrintf ( "Evaluation of %s returned object %p, external buffer length %X/n", AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length); AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); /* Dump a _PLD buffer if present */ if (ACPI_COMPARE_NAME ((ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, AcpiGbl_DbMethodInfo.Method)->Name.Ascii), METHOD_NAME__PLD)) { AcpiDbDumpPldBuffer (ReturnObj.Pointer); } } else { AcpiOsPrintf ("No object was returned from evaluation of %s/n", AcpiGbl_DbMethodInfo.Pathname); } } AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);}
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:101,
示例5: AcpiOsGetTableByNameACPI_STATUSAcpiOsGetTableByName ( char *Signature, UINT32 Instance, ACPI_TABLE_HEADER **Table, ACPI_PHYSICAL_ADDRESS *Address){ ACPI_STATUS Status; /* Instance is only valid for SSDT/UEFI tables */ if (Instance && !ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME (Signature, ACPI_SIG_UEFI)) { return (AE_LIMIT); } /* Initialize main tables */ Status = OslTableInitialize (); if (ACPI_FAILURE (Status)) { return (Status); } /* * If one of the main ACPI tables was requested (RSDT/XSDT/FADT), * simply return it immediately. */ if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_XSDT)) { if (!Gbl_Revision) { return (AE_NOT_FOUND); } *Address = Gbl_Rsdp.XsdtPhysicalAddress; *Table = (ACPI_TABLE_HEADER *) Gbl_Xsdt; return (AE_OK); } if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDT)) { if (!Gbl_Rsdp.RsdtPhysicalAddress) { return (AE_NOT_FOUND); } *Address = Gbl_Rsdp.RsdtPhysicalAddress; *Table = (ACPI_TABLE_HEADER *) Gbl_Rsdt; return (AE_OK); } if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FADT)) { *Address = Gbl_FadtAddress; *Table = (ACPI_TABLE_HEADER *) Gbl_Fadt; return (AE_OK); } /* Not a main ACPI table, attempt to extract it from the RSDT/XSDT */ Status = OslGetTableViaRoot (Signature, Instance, Table, Address); if (ACPI_FAILURE (Status)) { return (Status); } return (AE_OK);}
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:72,
示例6: AcpiUnloadParentTableACPI_STATUSAcpiUnloadParentTable ( ACPI_HANDLE Object){ ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object); ACPI_STATUS Status = AE_NOT_EXIST; ACPI_OWNER_ID OwnerId; UINT32 i; ACPI_FUNCTION_TRACE (AcpiUnloadParentTable); /* Parameter validation */ if (!Object) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* * The node OwnerId is currently the same as the parent table ID. * However, this could change in the future. */ OwnerId = Node->OwnerId; if (!OwnerId) { /* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */ return_ACPI_STATUS (AE_TYPE); } /* Must acquire the interpreter lock during this operation */ Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Find the table in the global table list */ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) { if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId) { continue; } /* * Allow unload of SSDT and OEMx tables only. Do not allow unload * of the DSDT. No other types of tables should get here, since * only these types can contain AML and thus are the only types * that can create namespace objects. */ if (ACPI_COMPARE_NAME ( AcpiGbl_RootTableList.Tables[i].Signature.Ascii, ACPI_SIG_DSDT)) { Status = AE_TYPE; break; } /* Ensure the table is actually loaded */ if (!AcpiTbIsTableLoaded (i)) { Status = AE_NOT_EXIST; break; } /* Invoke table handler if present */ if (AcpiGbl_TableHandler) { (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, AcpiGbl_RootTableList.Tables[i].Pointer, AcpiGbl_TableHandlerContext); } /* * Delete all namespace objects owned by this table. Note that * these objects can appear anywhere in the namespace by virtue * of the AML "Scope" operator. Thus, we need to track ownership * by an ID, not simply a position within the hierarchy. */ Status = AcpiTbDeleteNamespaceByOwner (i); if (ACPI_FAILURE (Status)) { break; } Status = AcpiTbReleaseOwnerId (i); AcpiTbSetTableLoadedFlag (i, FALSE); break; } (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); return_ACPI_STATUS (Status);}
开发者ID:mmadia,项目名称:haiku,代码行数:100,
示例7: AcpiDbReadTablestatic ACPI_STATUSAcpiDbReadTable ( FILE *fp, ACPI_TABLE_HEADER **Table, UINT32 *TableLength){ ACPI_TABLE_HEADER TableHeader; UINT32 Actual; ACPI_STATUS Status; UINT32 FileSize; BOOLEAN StandardHeader = TRUE; /* Get the file size */ FileSize = CmGetFileSize (fp); if (FileSize == ACPI_UINT32_MAX) { return (AE_ERROR); } if (FileSize < 4) { return (AE_BAD_HEADER); } /* Read the signature */ if (fread (&TableHeader, 1, 4, fp) != 4) { AcpiOsPrintf ("Could not read the table signature/n"); return (AE_BAD_HEADER); } fseek (fp, 0, SEEK_SET); /* The RSDP table does not have standard ACPI header */ if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ")) { *TableLength = FileSize; StandardHeader = FALSE; } else { /* Read the table header */ if (fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp) != sizeof (ACPI_TABLE_HEADER)) { AcpiOsPrintf ("Could not read the table header/n"); return (AE_BAD_HEADER); }#if 0 /* Validate the table header/length */ Status = AcpiTbValidateTableHeader (&TableHeader); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Table header is invalid!/n"); return (Status); }#endif /* File size must be at least as long as the Header-specified length */ if (TableHeader.Length > FileSize) { AcpiOsPrintf ( "TableHeader length [0x%X] greater than the input file size [0x%X]/n", TableHeader.Length, FileSize);#ifdef ACPI_ASL_COMPILER Status = FlCheckForAscii (fp, NULL, FALSE); if (ACPI_SUCCESS (Status)) { AcpiOsPrintf ("File appears to be ASCII only, must be binary/n", TableHeader.Length, FileSize); }#endif return (AE_BAD_HEADER); }#ifdef ACPI_OBSOLETE_CODE /* We only support a limited number of table types */ if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) && !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) && !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT)) { AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported/n", (char *) TableHeader.Signature); ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER)); return (AE_ERROR); }#endif *TableLength = TableHeader.Length; }//.........这里部分代码省略.........
开发者ID:queer1,项目名称:acpica,代码行数:101,
示例8: AxExtractTablesintAxExtractTables ( char *InputPathname, char *Signature, unsigned int MinimumInstances){ FILE *InputFile; FILE *OutputFile = NULL; size_t BytesWritten; size_t TotalBytesWritten = 0; size_t BytesConverted; unsigned int State = AX_STATE_FIND_HEADER; unsigned int FoundTable = 0; unsigned int Instances = 0; unsigned int ThisInstance; char ThisSignature[4]; int Status = 0; /* Open input in text mode, output is in binary mode */ InputFile = fopen (InputPathname, "rt"); if (!InputFile) { printf ("Could not open %s/n", InputPathname); return (-1); } if (Signature) { /* Are there enough instances of the table to continue? */ AxNormalizeSignature (Signature); Instances = AxCountTableInstances (InputPathname, Signature); if (Instances < MinimumInstances) { printf ("Table %s was not found in %s/n", Signature, InputPathname); Status = -1; goto CleanupAndExit; } if (Instances == 0) { goto CleanupAndExit; } } /* Convert all instances of the table to binary */ while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { switch (State) { case AX_STATE_FIND_HEADER: /* Ignore lines that are too short to be header lines */ if (strlen (LineBuffer) < AX_MIN_TABLE_NAME_LENGTH) { continue; } /* Ignore empty lines and lines that start with a space */ if ((LineBuffer[0] == ' ') || (LineBuffer[0] == '/n')) { continue; } /* * Ignore lines that are not of the form <sig> @ <addr>. * Examples of lines that must be supported: * * DSDT @ 0x737e4000 * XSDT @ 0x737f2fff * RSD PTR @ 0xf6cd0 * SSDT @ (nil) */ if (!strstr (LineBuffer, " @ ")) { continue; } AxNormalizeSignature (LineBuffer); ACPI_MOVE_NAME (ThisSignature, LineBuffer); if (Signature) { /* Ignore signatures that don't match */ if (!ACPI_COMPARE_NAME (ThisSignature, Signature)) { continue; } } /* * Get the instance number for this signature. Only the//.........这里部分代码省略.........
开发者ID:KyulingLee,项目名称:L4Re,代码行数:101,
示例9: AxListTablesintAxListTables ( char *InputPathname){ FILE *InputFile; size_t HeaderSize; unsigned char Header[48]; int TableCount = 0; ACPI_TABLE_HEADER *TableHeader = (ACPI_TABLE_HEADER *) (void *) Header; /* Open input in text mode, output is in binary mode */ InputFile = fopen (InputPathname, "rt"); if (!InputFile) { printf ("Could not open %s/n", InputPathname); return (-1); } /* Dump the headers for all tables found in the input file */ printf ("/nSignature Length Revision OemId OemTableId" " OemRevision CompilerId CompilerRevision/n/n"); while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { /* Ignore empty lines and lines that start with a space */ if ((LineBuffer[0] == ' ') || (LineBuffer[0] == '/n')) { continue; } /* Get the 36 byte header and display the fields */ HeaderSize = AxGetTableHeader (InputFile, Header); if (HeaderSize < 16) { continue; } /* RSDP has an oddball signature and header */ if (!strncmp (TableHeader->Signature, "RSD PTR ", 8)) { AxCheckAscii ((char *) &Header[9], 6); printf ("%8.4s /"%6.6s/"/n", "RSDP", &Header[9]); TableCount++; continue; } /* Minimum size for table with standard header */ if (HeaderSize < sizeof (ACPI_TABLE_HEADER)) { continue; } /* Signature and Table length */ TableCount++; printf ("%8.4s % 7d", TableHeader->Signature, TableHeader->Length); /* FACS has only signature and length */ if (ACPI_COMPARE_NAME (TableHeader->Signature, "FACS")) { printf ("/n"); continue; } /* OEM IDs and Compiler IDs */ AxCheckAscii (TableHeader->OemId, 6); AxCheckAscii (TableHeader->OemTableId, 8); AxCheckAscii (TableHeader->AslCompilerId, 4); printf (" %2.2X /"%6.6s/" /"%8.8s/" %8.8X /"%4.4s/" %8.8X/n", TableHeader->Revision, TableHeader->OemId, TableHeader->OemTableId, TableHeader->OemRevision, TableHeader->AslCompilerId, TableHeader->AslCompilerRevision); } printf ("/nFound %u ACPI tables/n", TableCount); fclose (InputFile); return (0);}
开发者ID:KyulingLee,项目名称:L4Re,代码行数:89,
示例10: AeBuildLocalTablesACPI_STATUSAeBuildLocalTables ( ACPI_NEW_TABLE_DESC *ListHead){ UINT32 TableCount = 1; ACPI_PHYSICAL_ADDRESS DsdtAddress = 0; UINT32 XsdtSize; ACPI_NEW_TABLE_DESC *NextTable; UINT32 NextIndex; ACPI_TABLE_FADT *ExternalFadt = NULL; /* * Update the table count. For the DSDT, it is not put into the XSDT. * For the FADT, this table is already accounted for since we usually * install a local FADT. */ NextTable = ListHead; while (NextTable) { if (!ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) && !ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { TableCount++; } NextTable = NextTable->Next; } XsdtSize = (((TableCount + 1) * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER)); if (AcpiGbl_LoadTestTables) { XsdtSize += BASE_XSDT_SIZE; } /* Build an XSDT */ LocalXSDT = AcpiOsAllocate (XsdtSize); if (!LocalXSDT) { return (AE_NO_MEMORY); } memset (LocalXSDT, 0, XsdtSize); LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); NextIndex = 1; /* * Install the user tables. The DSDT must be installed in the FADT. * All other tables are installed directly into the XSDT. */ NextTable = ListHead; while (NextTable) { /* * Incoming DSDT or FADT are special cases. All other tables are * just immediately installed into the XSDT. */ if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT)) { if (DsdtAddress) { printf ("Already found a DSDT, only one allowed/n"); return (AE_ALREADY_EXISTS); } /* The incoming user table is a DSDT */ DsdtAddress = ACPI_PTR_TO_PHYSADDR (NextTable->Table); DsdtToInstallOverride = NextTable->Table; } else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table); LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); } else { /* Install the table in the XSDT */ LocalXSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); NextIndex++; } NextTable = NextTable->Next; } /* Install the optional extra local tables */ if (AcpiGbl_LoadTestTables) { LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE); /* Install two SSDTs to test multiple table support */ LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code); LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code);//.........这里部分代码省略.........
开发者ID:cailianchun,项目名称:acpica,代码行数:101,
示例11: AxExtractTablesintAxExtractTables ( char *InputPathname, char *Signature, unsigned int MinimumInstances){ FILE *InputFile; FILE *OutputFile = NULL; unsigned int BytesConverted; unsigned int ThisTableBytesWritten = 0; unsigned int FoundTable = 0; unsigned int Instances = 0; unsigned int ThisInstance; char ThisSignature[5]; char UpperSignature[5]; int Status = 0; unsigned int State = AX_STATE_FIND_HEADER; /* Open input in text mode, output is in binary mode */ InputFile = fopen (InputPathname, "rt"); if (!InputFile) { printf ("Could not open input file %s/n", InputPathname); return (-1); } if (!AxIsFileAscii (InputFile)) { fclose (InputFile); return (-1); } if (Signature) { strncpy (UpperSignature, Signature, 4); UpperSignature[4] = 0; AcpiUtStrupr (UpperSignature); /* Are there enough instances of the table to continue? */ AxNormalizeSignature (UpperSignature); Instances = AxCountTableInstances (InputPathname, UpperSignature); if (Instances < MinimumInstances) { printf ("Table [%s] was not found in %s/n", UpperSignature, InputPathname); fclose (InputFile); return (-1); } if (Instances == 0) { fclose (InputFile); return (-1); } } /* Convert all instances of the table to binary */ while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { switch (State) { case AX_STATE_FIND_HEADER: if (!AxIsDataBlockHeader ()) { continue; } ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer); if (Signature) { /* Ignore signatures that don't match */ if (!ACPI_COMPARE_NAME (ThisSignature, UpperSignature)) { continue; } } /* * Get the instance number for this signature. Only the * SSDT and PSDT tables can have multiple instances. */ ThisInstance = AxGetNextInstance (InputPathname, ThisSignature); /* Build an output filename and create/open the output file */ if (ThisInstance > 0) { /* Add instance number to the output filename */ sprintf (Gbl_OutputFilename, "%4.4s%u.dat", ThisSignature, ThisInstance); } else//.........这里部分代码省略.........
开发者ID:Raphine,项目名称:Raph_Kernel,代码行数:101,
示例12: AxExtractToMultiAmlFileintAxExtractToMultiAmlFile ( char *InputPathname){ FILE *InputFile; FILE *OutputFile; int Status = 0; unsigned int TotalBytesWritten = 0; unsigned int ThisTableBytesWritten = 0; unsigned int BytesConverted; char ThisSignature[4]; unsigned int State = AX_STATE_FIND_HEADER; strcpy (Gbl_OutputFilename, AX_MULTI_TABLE_FILENAME); /* Open the input file in text mode */ InputFile = fopen (InputPathname, "rt"); if (!InputFile) { printf ("Could not open input file %s/n", InputPathname); return (-1); } if (!AxIsFileAscii (InputFile)) { fclose (InputFile); return (-1); } /* Open the output file in binary mode */ OutputFile = fopen (Gbl_OutputFilename, "w+b"); if (!OutputFile) { printf ("Could not open output file %s/n", Gbl_OutputFilename); fclose (InputFile); return (-1); } /* Convert the DSDT and all SSDTs to binary */ while (fgets (Gbl_LineBuffer, AX_LINE_BUFFER_SIZE, InputFile)) { switch (State) { case AX_STATE_FIND_HEADER: if (!AxIsDataBlockHeader ()) { continue; } ACPI_MOVE_NAME (ThisSignature, Gbl_LineBuffer); /* Only want DSDT and SSDTs */ if (!ACPI_COMPARE_NAME (ThisSignature, ACPI_SIG_DSDT) && !ACPI_COMPARE_NAME (ThisSignature, ACPI_SIG_SSDT)) { continue; } /* * Toss this block header of the form "<sig> @ <addr>" line * and move on to the actual data block */ Gbl_TableCount++; ThisTableBytesWritten = 0; State = AX_STATE_EXTRACT_DATA; continue; case AX_STATE_EXTRACT_DATA: /* Empty line or non-data line terminates the data block */ BytesConverted = AxProcessOneTextLine ( OutputFile, ThisSignature, ThisTableBytesWritten); switch (BytesConverted) { case 0: State = AX_STATE_FIND_HEADER; /* No more data block lines */ continue; case -1: goto CleanupAndExit; /* There was a write error */ default: /* Normal case, get next line */ ThisTableBytesWritten += BytesConverted; TotalBytesWritten += BytesConverted; continue; } default: Status = -1;//.........这里部分代码省略.........
开发者ID:Raphine,项目名称:Raph_Kernel,代码行数:101,
示例13: DtCreateOneTemplatestatic ACPI_STATUSDtCreateOneTemplate ( char *Signature, UINT32 TableCount, const ACPI_DMTABLE_DATA *TableData){ char *DisasmFilename; FILE *File; ACPI_STATUS Status = AE_OK; int Actual; UINT32 i; /* New file will have a .asl suffix */ DisasmFilename = FlGenerateFilename ( Signature, FILE_SUFFIX_ASL_CODE); if (!DisasmFilename) { fprintf (stderr, "Could not generate output filename/n"); return (AE_ERROR); } AcpiUtStrlwr (DisasmFilename); if (!UtQueryForOverwrite (DisasmFilename)) { return (AE_ERROR); } File = fopen (DisasmFilename, "w+"); if (!File) { fprintf (stderr, "Could not open output file %s/n", DisasmFilename); return (AE_ERROR); } /* Emit the common file header */ AcpiOsRedirectOutput (File); AcpiOsPrintf ("/*/n"); AcpiOsPrintf (ACPI_COMMON_HEADER ("iASL Compiler/Disassembler", " * ")); if (TableCount == 0) { AcpiOsPrintf (" * Template for [%4.4s] ACPI Table", Signature); } else { AcpiOsPrintf (" * Template for [%4.4s] and %u [SSDT] ACPI Tables", Signature, TableCount); } /* Dump the actual ACPI table */ if (TableData) { /* Normal case, tables that appear in AcpiDmTableData */ AcpiOsPrintf (" (static data table)/n"); if (Gbl_VerboseTemplates) { AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength]" " FieldName : HexFieldValue/n *//n/n"); } else { AcpiOsPrintf (" * Format: [ByteLength]" " FieldName : HexFieldValue/n *//n"); } AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, TableData->Template)); } else { /* Special ACPI tables - DSDT, SSDT, OSDT, FACS, RSDP */ AcpiOsPrintf (" (AML byte code table)/n"); AcpiOsPrintf (" *//n"); if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT)) { Actual = DtEmitDefinitionBlock ( File, DisasmFilename, ACPI_SIG_DSDT, 1); if (Actual < 0) { Status = AE_ERROR; goto Cleanup; } /* Emit any requested SSDTs into the same file */ for (i = 1; i <= TableCount; i++) { Actual = DtEmitDefinitionBlock ( File, DisasmFilename, ACPI_SIG_SSDT, i + 1);//.........这里部分代码省略.........
开发者ID:mulichao,项目名称:freebsd,代码行数:101,
示例14: AcpiOsGetTableByNameACPI_STATUSAcpiOsGetTableByName ( char *Signature, UINT32 Instance, ACPI_TABLE_HEADER **Table, ACPI_PHYSICAL_ADDRESS *Address){ HKEY Handle = NULL; LONG WinStatus; ULONG Type; ULONG NameSize; ULONG DataSize; HKEY SubKey; ULONG i; ACPI_TABLE_HEADER *ReturnTable; ACPI_STATUS Status = AE_OK; /* * Windows has no SSDTs in the registry, so multiple instances are * not supported. */ if (Instance > 0) { return (AE_LIMIT); } /* Get a handle to the table key */ while (1) { strcpy (KeyBuffer, "HARDWARE//ACPI//"); if (AcpiUtSafeStrcat (KeyBuffer, sizeof (KeyBuffer), Signature)) { return (AE_BUFFER_OVERFLOW); } WinStatus = RegOpenKeyEx (HKEY_LOCAL_MACHINE, KeyBuffer, 0L, KEY_READ, &Handle); if (WinStatus != ERROR_SUCCESS) { /* * Somewhere along the way, MS changed the registry entry for * the FADT from * HARDWARE/ACPI/FACP to * HARDWARE/ACPI/FADT. * * This code allows for both. */ if (ACPI_COMPARE_NAME (Signature, "FACP")) { Signature = "FADT"; } else if (ACPI_COMPARE_NAME (Signature, "XSDT")) { Signature = "RSDT"; } else { fprintf (stderr, "Could not find %s in registry at %s: %s (WinStatus=0x%X)/n", Signature, KeyBuffer, WindowsFormatException (WinStatus), WinStatus); return (AE_NOT_FOUND); } } else { break; } } /* Actual data for the table is down a couple levels */ for (i = 0; ;) { WinStatus = RegEnumKey (Handle, i, KeyBuffer, sizeof (KeyBuffer)); i++; if (WinStatus == ERROR_NO_MORE_ITEMS) { break; } WinStatus = RegOpenKey (Handle, KeyBuffer, &SubKey); if (WinStatus != ERROR_SUCCESS) { fprintf (stderr, "Could not open %s entry: %s/n", Signature, WindowsFormatException (WinStatus)); Status = AE_ERROR; goto Cleanup; } RegCloseKey (Handle); Handle = SubKey; i = 0; } /* Find the (binary) table entry */ for (i = 0; ; i++)//.........这里部分代码省略.........
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:101,
示例15: acpi_tb_load_namespace/******************************************************************************* * * FUNCTION: acpi_tb_load_namespace * * PARAMETERS: None * * RETURN: Status * * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in * the RSDT/XSDT. * ******************************************************************************/acpi_status acpi_tb_load_namespace(void){ acpi_status status; u32 i; struct acpi_table_header *new_dsdt; struct acpi_table_desc *table; u32 tables_loaded = 0; u32 tables_failed = 0; ACPI_FUNCTION_TRACE(tb_load_namespace); (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); /* * Load the namespace. The DSDT is required, but any SSDT and * PSDT tables are optional. Verify the DSDT. */ table = &acpi_gbl_root_table_list.tables[acpi_gbl_dsdt_index]; if (!acpi_gbl_root_table_list.current_table_count || !ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_DSDT) || ACPI_FAILURE(acpi_tb_validate_table(table))) { status = AE_NO_ACPI_TABLES; goto unlock_and_exit; } /* * Save the DSDT pointer for simple access. This is the mapped memory * address. We must take care here because the address of the .Tables * array can change dynamically as tables are loaded at run-time. Note: * .Pointer field is not validated until after call to acpi_tb_validate_table. */ acpi_gbl_DSDT = table->pointer; /* * Optionally copy the entire DSDT to local memory (instead of simply * mapping it.) There are some BIOSs that corrupt or replace the original * DSDT, creating the need for this option. Default is FALSE, do not copy * the DSDT. */ if (acpi_gbl_copy_dsdt_locally) { new_dsdt = acpi_tb_copy_dsdt(acpi_gbl_dsdt_index); if (new_dsdt) { acpi_gbl_DSDT = new_dsdt; } } /* * Save the original DSDT header for detection of table corruption * and/or replacement of the DSDT from outside the OS. */ memcpy(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT, sizeof(struct acpi_table_header)); /* Load and parse tables */ (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); status = acpi_ns_load_table(acpi_gbl_dsdt_index, acpi_gbl_root_node); (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "[DSDT] table load failed")); tables_failed++; } else { tables_loaded++; } /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) { table = &acpi_gbl_root_table_list.tables[i]; if (!acpi_gbl_root_table_list.tables[i].address || (!ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_SSDT) && !ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_PSDT) && !ACPI_COMPARE_NAME(table->signature.ascii, ACPI_SIG_OSDT)) || ACPI_FAILURE(acpi_tb_validate_table(table))) { continue; } /* Ignore errors while loading tables, get as many as possible */ (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); status = acpi_ns_load_table(i, acpi_gbl_root_node); (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status,//.........这里部分代码省略.........
开发者ID:forgivemyheart,项目名称:linux,代码行数:101,
示例16: acpi_walk_resources/******************************************************************************* * * FUNCTION: acpi_walk_resources * * PARAMETERS: device_handle - Handle to the device object for the * device we are querying * Name - Method name of the resources we want. * (METHOD_NAME__CRS, METHOD_NAME__PRS, or * METHOD_NAME__AEI) * user_function - Called for each resource * Context - Passed to user_function * * RETURN: Status * * DESCRIPTION: Retrieves the current or possible resource list for the * specified device. The user_function is called once for * each resource in the list. * ******************************************************************************/acpi_statusacpi_walk_resources(acpi_handle device_handle, char *name, acpi_walk_resource_callback user_function, void *context){ acpi_status status; struct acpi_buffer buffer; struct acpi_resource *resource; struct acpi_resource *resource_end; ACPI_FUNCTION_TRACE(acpi_walk_resources); /* Parameter validation */ if (!device_handle || !user_function || !name || (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) && !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS) && !ACPI_COMPARE_NAME(name, METHOD_NAME__AEI))) { return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Get the _CRS/_PRS/_AEI resource list */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; status = acpi_rs_get_method_data(device_handle, name, &buffer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Buffer now contains the resource list */ resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); resource_end = ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); /* Walk the resource list until the end_tag is found (or buffer end) */ while (resource < resource_end) { /* Sanity check the resource */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { status = AE_AML_INVALID_RESOURCE_TYPE; break; } /* Invoke the user function, abort on any error returned */ status = user_function(resource, context); if (ACPI_FAILURE(status)) { if (status == AE_CTRL_TERMINATE) { /* This is an OK termination by the user function */ status = AE_OK; } break; } /* end_tag indicates end-of-list */ if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { break; } /* Get the next resource descriptor */ resource = ACPI_ADD_PTR(struct acpi_resource, resource, resource->length); } ACPI_FREE(buffer.pointer); return_ACPI_STATUS(status);}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:94,
示例17: acpi_unload_parent_table/******************************************************************************* * * FUNCTION: acpi_unload_parent_table * * PARAMETERS: object - Handle to any namespace object owned by * the table to be unloaded * * RETURN: Status * * DESCRIPTION: Via any namespace object within an SSDT or OEMx table, unloads * the table and deletes all namespace objects associated with * that table. Unloading of the DSDT is not allowed. * Note: Mainly intended to support hotplug removal of SSDTs. * ******************************************************************************/acpi_status acpi_unload_parent_table(acpi_handle object){ struct acpi_namespace_node *node = ACPI_CAST_PTR(struct acpi_namespace_node, object); acpi_status status = AE_NOT_EXIST; acpi_owner_id owner_id; u32 i; ACPI_FUNCTION_TRACE(acpi_unload_parent_table); /* Parameter validation */ if (!object) { return_ACPI_STATUS(AE_BAD_PARAMETER); } /* * The node owner_id is currently the same as the parent table ID. * However, this could change in the future. */ owner_id = node->owner_id; if (!owner_id) { /* owner_id==0 means DSDT is the owner. DSDT cannot be unloaded */ return_ACPI_STATUS(AE_TYPE); } /* Must acquire the table lock during this operation */ status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Find the table in the global table list */ for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) { if (owner_id != acpi_gbl_root_table_list.tables[i].owner_id) { continue; } /* * Allow unload of SSDT and OEMx tables only. Do not allow unload * of the DSDT. No other types of tables should get here, since * only these types can contain AML and thus are the only types * that can create namespace objects. */ if (ACPI_COMPARE_NAME (acpi_gbl_root_table_list.tables[i].signature.ascii, ACPI_SIG_DSDT)) { status = AE_TYPE; break; } (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); status = acpi_tb_unload_table(i); (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); break; } (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); return_ACPI_STATUS(status);}
开发者ID:forgivemyheart,项目名称:linux,代码行数:79,
示例18: mainint ACPI_SYSTEM_XFACEmain ( int argc, char **argv){ ACPI_STATUS Status; UINT32 InitFlags; ACPI_TABLE_HEADER *Table = NULL; UINT32 TableCount; AE_TABLE_DESC *TableDesc; ACPI_DEBUG_INITIALIZE (); /* For debug version only */ signal (SIGINT, AeCtrlCHandler); /* Init debug globals */ AcpiDbgLevel = ACPI_NORMAL_DEFAULT; AcpiDbgLayer = 0xFFFFFFFF; /* Init ACPICA and start debugger thread */ Status = AcpiInitializeSubsystem (); AE_CHECK_OK (AcpiInitializeSubsystem, Status); if (ACPI_FAILURE (Status)) { goto ErrorExit; } printf (ACPI_COMMON_SIGNON (ACPIEXEC_NAME)); if (argc < 2) { usage (); (void) AcpiOsTerminate (); return (0); } /* Get the command line options */ if (AeDoOptions (argc, argv)) { goto ErrorExit; } /* The remaining arguments are filenames for ACPI tables */ if (!argv[AcpiGbl_Optind]) { goto EnterDebugger; } AcpiGbl_CstyleDisassembly = FALSE; /* Not supported for AcpiExec */ TableCount = 0; /* Get each of the ACPI table files on the command line */ while (argv[AcpiGbl_Optind]) { /* Get one entire table */ Status = AcpiUtReadTableFromFile (argv[AcpiGbl_Optind], &Table); if (ACPI_FAILURE (Status)) { printf ("**** Could not get table from file %s, %s/n", argv[AcpiGbl_Optind], AcpiFormatException (Status)); goto ErrorExit; } /* Ignore non-AML tables, we can't use them. Except for an FADT */ if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) && !AcpiUtIsAmlTable (Table)) { ACPI_INFO ((AE_INFO, "Table [%4.4s] is not an AML table, ignoring", Table->Signature)); AcpiOsFree (Table); } else { /* Allocate and link a table descriptor */ TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC)); TableDesc->Table = Table; TableDesc->Next = AeTableListHead; AeTableListHead = TableDesc; TableCount++; } AcpiGbl_Optind++; } printf ("/n"); /* Build a local RSDT with all tables and let ACPICA process the RSDT */ Status = AeBuildLocalTables (TableCount, AeTableListHead); if (ACPI_FAILURE (Status)) {//.........这里部分代码省略.........
开发者ID:JamesLinus,项目名称:ChaiOS,代码行数:101,
示例19: AnBuildLocalTablesACPI_STATUSAnBuildLocalTables ( ACPI_NEW_TABLE_DESC *TableList){ UINT32 TableCount = 0; ACPI_PHYSICAL_ADDRESS DsdtAddress = 0; UINT32 XsdtSize; ACPI_NEW_TABLE_DESC *NextTable; UINT32 NextIndex; ACPI_TABLE_FADT *ExternalFadt = NULL; /* * Update the table count. For the DSDT, it is not put into the XSDT. * For the FADT, this table is already accounted for since we usually * install a local FADT. */ NextTable = TableList; while (NextTable) { if (!ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) && !ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { TableCount++; } NextTable = NextTable->Next; } XsdtSize = BASE_XSDT_SIZE + (TableCount * sizeof (UINT64)); /* Build an XSDT */ LocalXSDT = AcpiOsAllocate (XsdtSize); if (!LocalXSDT) { return (AE_NO_MEMORY); } memset (LocalXSDT, 0, XsdtSize); LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); /* * Install the user tables. The DSDT must be installed in the FADT. * All other tables are installed directly into the XSDT. * * Note: The tables are loaded in reverse order from the incoming * input, which makes it match the command line order. */ NextIndex = BASE_XSDT_TABLES; NextTable = TableList; while (NextTable) { /* * Incoming DSDT or FADT are special cases. All other tables are * just immediately installed into the XSDT. */ if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT)) { if (DsdtAddress) { printf ("Already found a DSDT, only one allowed/n"); return (AE_ALREADY_EXISTS); } /* The incoming user table is a DSDT */ DsdtAddress = ACPI_PTR_TO_PHYSADDR (NextTable->Table); } else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table); LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); } else { /* Install the table in the XSDT */ LocalXSDT->TableOffsetEntry[TableCount - NextIndex + 1] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); NextIndex++; } NextTable = NextTable->Next; } /* Build an RSDP. Contains a valid XSDT only, no RSDT */ memset (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature); memcpy (LocalRSDP.OemId, "Intel", 6); LocalRSDP.Revision = 2; LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT); LocalRSDP.Length = sizeof (ACPI_TABLE_XSDT); /* Set checksums for both XSDT and RSDP *///.........这里部分代码省略.........
开发者ID:cailianchun,项目名称:acpica,代码行数:101,
示例20: acpi_ut_read_tablestatic acpi_statusacpi_ut_read_table(FILE * fp, struct acpi_table_header **table, u32 *table_length){ struct acpi_table_header table_header; u32 actual; acpi_status status; u32 file_size; u8 standard_header = TRUE; s32 count; /* Get the file size */ file_size = cm_get_file_size(fp); if (file_size == ACPI_UINT32_MAX) { return (AE_ERROR); } if (file_size < 4) { return (AE_BAD_HEADER); } /* Read the signature */ fseek(fp, 0, SEEK_SET); count = fread(&table_header, 1, sizeof(struct acpi_table_header), fp); if (count != sizeof(struct acpi_table_header)) { acpi_os_printf("Could not read the table header/n"); return (AE_BAD_HEADER); } /* The RSDP table does not have standard ACPI header */ if (ACPI_VALIDATE_RSDP_SIG(table_header.signature)) { *table_length = file_size; standard_header = FALSE; } else {#if 0 /* Validate the table header/length */ status = acpi_tb_validate_table_header(&table_header); if (ACPI_FAILURE(status)) { acpi_os_printf("Table header is invalid!/n"); return (status); }#endif /* File size must be at least as long as the Header-specified length */ if (table_header.length > file_size) { acpi_os_printf ("TableHeader length [0x%X] greater than the input file size [0x%X]/n", table_header.length, file_size);#ifdef ACPI_ASL_COMPILER acpi_os_printf("File is corrupt or is ASCII text -- " "it must be a binary file/n");#endif return (AE_BAD_HEADER); }#ifdef ACPI_OBSOLETE_CODE /* We only support a limited number of table types */ if (!ACPI_COMPARE_NAME ((char *)table_header.signature, ACPI_SIG_DSDT) && !ACPI_COMPARE_NAME((char *)table_header.signature, ACPI_SIG_PSDT) && !ACPI_COMPARE_NAME((char *)table_header.signature, ACPI_SIG_SSDT)) { acpi_os_printf ("Table signature [%4.4s] is invalid or not supported/n", (char *)table_header.signature); ACPI_DUMP_BUFFER(&table_header, sizeof(struct acpi_table_header)); return (AE_ERROR); }#endif *table_length = table_header.length; } /* Allocate a buffer for the table */ *table = acpi_os_allocate((size_t) file_size); if (!*table) { acpi_os_printf ("Could not allocate memory for ACPI table %4.4s (size=0x%X)/n", table_header.signature, *table_length); return (AE_NO_MEMORY); } /* Get the rest of the table */ fseek(fp, 0, SEEK_SET); actual = fread(*table, 1, (size_t) file_size, fp); if (actual == file_size) { if (standard_header) {//.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:101,
示例21: acpi_ds_initialize_objectsacpi_statusacpi_ds_initialize_objects(u32 table_index, struct acpi_namespace_node * start_node){ acpi_status status; struct acpi_init_walk_info info; struct acpi_table_header *table; acpi_owner_id owner_id; ACPI_FUNCTION_TRACE(ds_initialize_objects); status = acpi_tb_get_owner_id(table_index, &owner_id); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****/n")); /* Set all init info to zero */ memset(&info, 0, sizeof(struct acpi_init_walk_info)); info.owner_id = owner_id; info.table_index = table_index; /* Walk entire namespace from the supplied root */ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* * We don't use acpi_walk_namespace since we do not want to acquire * the namespace reader lock. */ status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ds_init_one_object, NULL, &info, NULL); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); } (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); status = acpi_get_table_by_index(table_index, &table); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* DSDT is always the first AML table */ if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT)) { ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "/nInitializing Namespace objects:/n")); } /* Summary of objects initialized */ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Table [%4.4s: %-8.8s] (id %.2X) - %4u Objects with %3u Devices, " "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)/n", table->signature, table->oem_table_id, owner_id, info.object_count, info.device_count, info.op_region_count, info.method_count, info.serial_method_count, info.non_serial_method_count, info.serialized_method_count)); ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "%u Methods, %u Regions/n", info.method_count, info.op_region_count)); return_ACPI_STATUS(AE_OK);}
开发者ID:020gzh,项目名称:linux,代码行数:75,
示例22: main//.........这里部分代码省略......... WildcardList = AsDoWildcard (Directory, Filename); if (!WildcardList) { return (-1); } while (*WildcardList) { FullPathname = AcpiOsAllocate ( strlen (Directory) + strlen (*WildcardList) + 1); /* Construct a full path to the file */ strcpy (FullPathname, Directory); strcat (FullPathname, *WildcardList); /* Get one table */ Status = AcpiDbReadTableFromFile (FullPathname, &Table); if (ACPI_FAILURE (Status)) { printf ("**** Could not get input table %s, %s/n", FullPathname, AcpiFormatException (Status)); goto EnterDebugger; } AcpiOsFree (FullPathname); AcpiOsFree (*WildcardList); *WildcardList = NULL; WildcardList++; /* Ignore non-AML tables, we can't use them. Except for an FADT */ if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) && !AcpiUtIsAmlTable (Table)) { ACPI_WARNING ((AE_INFO, "Table %4.4s is not an AML table, ignoring", Table->Signature)); AcpiOsFree (Table); continue; } /* Allocate and link a table descriptor */ TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC)); TableDesc->Table = Table; TableDesc->Next = AeTableListHead; AeTableListHead = TableDesc; TableCount++; } AcpiGbl_Optind++; } /* Build a local RSDT with all tables and let ACPICA process the RSDT */ Status = AeBuildLocalTables (TableCount, AeTableListHead); if (ACPI_FAILURE (Status)) { return (-1); } Status = AeInstallTables (); if (ACPI_FAILURE (Status))
开发者ID:cloudius-systems,项目名称:acpica,代码行数:67,
示例23: AcpiTbParseRootTable//.........这里部分代码省略......... * the XSDT if the revision is > 1 and the XSDT pointer is present, * as per the ACPI specification. */ Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress; TableEntrySize = ACPI_XSDT_ENTRY_SIZE; } else { /* Root table is an RSDT (32-bit physical addresses) */ Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress; TableEntrySize = ACPI_RSDT_ENTRY_SIZE; } /* * It is not possible to map more than one entry in some environments, * so unmap the RSDP here before mapping other tables */ AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP)); /* Map the RSDT/XSDT table header to get the full table length */ Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER)); if (!Table) { return_ACPI_STATUS (AE_NO_MEMORY); } AcpiTbPrintTableHeader (Address, Table); /* * Validate length of the table, and map entire table. * Minimum length table must contain at least one entry. */ Length = Table->Length; AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); if (Length < (sizeof (ACPI_TABLE_HEADER) + TableEntrySize)) { ACPI_BIOS_ERROR ((AE_INFO, "Invalid table length 0x%X in RSDT/XSDT", Length)); return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); } Table = AcpiOsMapMemory (Address, Length); if (!Table) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Validate the root table checksum */ Status = AcpiTbVerifyChecksum (Table, Length); if (ACPI_FAILURE (Status)) { AcpiOsUnmapMemory (Table, Length); return_ACPI_STATUS (Status); } /* Get the number of entries and pointer to first entry */ TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) / TableEntrySize); TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER)); /* Initialize the root table array from the RSDT/XSDT */ for (i = 0; i < TableCount; i++) { /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */ Address = AcpiTbGetRootTableEntry (TableEntry, TableEntrySize); /* Skip NULL entries in RSDT/XSDT */ if (!Address) { goto NextTable; } Status = AcpiTbInstallStandardTable (Address, ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex); if (ACPI_SUCCESS (Status) && ACPI_COMPARE_NAME ( &AcpiGbl_RootTableList.Tables[TableIndex].Signature, ACPI_SIG_FADT)) { AcpiGbl_FadtIndex = TableIndex; AcpiTbParseFadt (); }NextTable: TableEntry += TableEntrySize; } AcpiOsUnmapMemory (Table, Length); return_ACPI_STATUS (AE_OK);}
开发者ID:Fluray,项目名称:MollenOS,代码行数:101,
示例24: OslGetTableViaRootstatic ACPI_STATUSOslGetTableViaRoot ( char *Signature, UINT32 Instance, ACPI_TABLE_HEADER **Table, ACPI_PHYSICAL_ADDRESS *Address){ ACPI_TABLE_HEADER *LocalTable = NULL; ACPI_TABLE_HEADER *MappedTable = NULL; UINT8 NumberOfTables; UINT32 CurrentInstance = 0; ACPI_PHYSICAL_ADDRESS TableAddress = 0; ACPI_STATUS Status; UINT32 i; /* DSDT and FACS address must be extracted from the FADT */ if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT) || ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) { /* * Get the appropriate address, either 32-bit or 64-bit. Be very * careful about the FADT length and validate table addresses. * Note: The 64-bit addresses have priority. */ if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT)) { if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XDSDT) && Gbl_Fadt->XDsdt) { TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XDsdt; } else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_DSDT) && Gbl_Fadt->Dsdt) { TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Dsdt; } } else /* FACS */ { if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_XFACS) && Gbl_Fadt->XFacs) { TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->XFacs; } else if ((Gbl_Fadt->Header.Length >= MIN_FADT_FOR_FACS) && Gbl_Fadt->Facs) { TableAddress = (ACPI_PHYSICAL_ADDRESS) Gbl_Fadt->Facs; } } } else /* Case for a normal ACPI table */ { if (Gbl_Revision) { NumberOfTables = (Gbl_Xsdt->Header.Length - sizeof (Gbl_Xsdt->Header)) / sizeof (Gbl_Xsdt->TableOffsetEntry[0]); } else /* Use RSDT if XSDT is not available */ { NumberOfTables = (Gbl_Rsdt->Header.Length - sizeof (Gbl_Rsdt->Header)) / sizeof (Gbl_Rsdt->TableOffsetEntry[0]); } /* Search RSDT/XSDT for the requested table */ for (i = 0; i < NumberOfTables; i++) { if (Gbl_Revision) { TableAddress = Gbl_Xsdt->TableOffsetEntry[i]; } else { TableAddress = Gbl_Rsdt->TableOffsetEntry[i]; } MappedTable = AcpiOsMapMemory (TableAddress, sizeof (*MappedTable)); if (!MappedTable) { return (AE_BAD_ADDRESS); } /* Does this table match the requested signature? */ if (ACPI_COMPARE_NAME (MappedTable->Signature, Signature)) { /* Match table instance (for SSDT/UEFI tables) */ if (CurrentInstance == Instance) { AcpiOsUnmapMemory (MappedTable, sizeof (*MappedTable)); break; }//.........这里部分代码省略.........
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:101,
示例25: AcpiGetTableHeaderACPI_STATUSAcpiGetTableHeader ( ACPI_CONST_STRING Signature, UINT32 Instance, ACPI_TABLE_HEADER *OutTableHeader){ UINT32 i; UINT32 j; ACPI_TABLE_HEADER *Header; ACPI_STRING USignature = __UNCONST(Signature); /* Parameter validation */ if (!Signature || !OutTableHeader) { return (AE_BAD_PARAMETER); } /* Walk the root table list */ for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) { if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), USignature)) { continue; } if (++j < Instance) { continue; } if (!AcpiGbl_RootTableList.Tables[i].Pointer) { if ((AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_ORIGIN_MASK) == ACPI_TABLE_ORIGIN_MAPPED) { Header = AcpiOsMapMemory ( AcpiGbl_RootTableList.Tables[i].Address, sizeof (ACPI_TABLE_HEADER)); if (!Header) { return AE_NO_MEMORY; } ACPI_MEMCPY (OutTableHeader, Header, sizeof(ACPI_TABLE_HEADER)); AcpiOsUnmapMemory (Header, sizeof(ACPI_TABLE_HEADER)); } else { return AE_NOT_FOUND; } } else { ACPI_MEMCPY (OutTableHeader, AcpiGbl_RootTableList.Tables[i].Pointer, sizeof(ACPI_TABLE_HEADER)); } return (AE_OK); } return (AE_NOT_FOUND);}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:67,
示例26: DtCreateOneTemplatestatic ACPI_STATUSDtCreateOneTemplate ( char *Signature, ACPI_DMTABLE_DATA *TableData){ char *DisasmFilename; FILE *File; ACPI_STATUS Status = AE_OK; /* New file will have a .asl suffix */ DisasmFilename = FlGenerateFilename ( Signature, FILE_SUFFIX_ASL_CODE); if (!DisasmFilename) { fprintf (stderr, "Could not generate output filename/n"); return (AE_ERROR); } /* Probably should prompt to overwrite the file */ AcpiUtStrlwr (DisasmFilename); File = fopen (DisasmFilename, "w+"); if (!File) { fprintf (stderr, "Could not open output file %s/n", DisasmFilename); return (AE_ERROR); } /* Emit the common file header */ AcpiOsRedirectOutput (File); AcpiOsPrintf ("/*/n"); AcpiOsPrintf (ACPI_COMMON_HEADER ("iASL Compiler/Disassembler", " * ")); AcpiOsPrintf (" * Template for [%4.4s] ACPI Table/n", Signature); /* Dump the actual ACPI table */ if (TableData) { /* Normal case, tables that appear in AcpiDmTableData */ if (Gbl_VerboseTemplates) { AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength]" " FieldName : HexFieldValue/n *//n/n"); } else { AcpiOsPrintf (" * Format: [ByteLength]" " FieldName : HexFieldValue/n *//n/n"); } AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, TableData->Template)); } else { /* Special ACPI tables - DSDT, SSDT, FACS, RSDP */ AcpiOsPrintf (" *//n/n"); if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_DSDT)) { fwrite (TemplateDsdt, sizeof (TemplateDsdt) -1, 1, File); } else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_SSDT)) { fwrite (TemplateSsdt, sizeof (TemplateSsdt) -1, 1, File); } else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS)) { AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, TemplateFacs)); } else if (ACPI_COMPARE_NAME (Signature, ACPI_RSDP_NAME)) { AcpiDmDumpDataTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, TemplateRsdp)); } else { fprintf (stderr, "%4.4s, Unrecognized ACPI table signature/n", Signature); return (AE_ERROR); } } fprintf (stderr, "Created ACPI table template for [%4.4s], written to /"%s/"/n", Signature, DisasmFilename); fclose (File); AcpiOsRedirectOutput (stdout); ACPI_FREE (DisasmFilename); return (Status);}
开发者ID:CoryXie,项目名称:CellOS,代码行数:100,
示例27: AcpiTbAddTableACPI_STATUSAcpiTbAddTable ( ACPI_TABLE_DESC *TableDesc, UINT32 *TableIndex){ UINT32 i; ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE (TbAddTable); if (!TableDesc->Pointer) { Status = AcpiTbVerifyTable (TableDesc); if (ACPI_FAILURE (Status) || !TableDesc->Pointer) { return_ACPI_STATUS (Status); } } /* * Validate the incoming table signature. * * 1) Originally, we checked the table signature for "SSDT" or "PSDT". * 2) We added support for OEMx tables, signature "OEM". * 3) Valid tables were encountered with a null signature, so we just * gave up on validating the signature, (05/2008). * 4) We encountered non-AML tables such as the MADT, which caused * interpreter errors and kernel faults. So now, we once again allow * only "SSDT", "OEMx", and now, also a null signature. (05/2011). */ if ((TableDesc->Pointer->Signature[0] != 0x00) && (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) && (ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3))) { ACPI_ERROR ((AE_INFO, "Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx", AcpiUtValidAcpiName (*(UINT32 *) TableDesc->Pointer->Signature) ? TableDesc->Pointer->Signature : "????", *(UINT32 *) TableDesc->Pointer->Signature)); return_ACPI_STATUS (AE_BAD_SIGNATURE); } (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* Check if table is already registered */ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) { if (!AcpiGbl_RootTableList.Tables[i].Pointer) { Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]); if (ACPI_FAILURE (Status) || !AcpiGbl_RootTableList.Tables[i].Pointer) { continue; } } /* * Check for a table match on the entire table length, * not just the header. */ if (TableDesc->Length != AcpiGbl_RootTableList.Tables[i].Length) { continue; } if (ACPI_MEMCMP (TableDesc->Pointer, AcpiGbl_RootTableList.Tables[i].Pointer, AcpiGbl_RootTableList.Tables[i].Length)) { continue; } /* * Note: the current mechanism does not unregister a table if it is * dynamically unloaded. The related namespace entries are deleted, * but the table remains in the root table list. * * The assumption here is that the number of different tables that * will be loaded is actually small, and there is minimal overhead * in just keeping the table in case it is needed again. * * If this assumption changes in the future (perhaps on large * machines with many table load/unload operations), tables will * need to be unregistered when they are unloaded, and slots in the * root table list should be reused when empty. */ /* * Table is already registered. * We can delete the table that was passed as a parameter. */ AcpiTbDeleteTable (TableDesc); *TableIndex = i; if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED)//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:freebsd,代码行数:101,
示例28: acpi_ns_one_complete_parse/******************************************************************************* * * FUNCTION: ns_one_complete_parse * * PARAMETERS: pass_number - 1 or 2 * table_desc - The table to be parsed. * * RETURN: Status * * DESCRIPTION: Perform one complete parse of an ACPI/AML table. * ******************************************************************************/acpi_statusacpi_ns_one_complete_parse(u32 pass_number, u32 table_index, struct acpi_namespace_node *start_node){ union acpi_parse_object *parse_root; acpi_status status; u32 aml_length; u8 *aml_start; struct acpi_walk_state *walk_state; struct acpi_table_header *table; acpi_owner_id owner_id; ACPI_FUNCTION_TRACE(ns_one_complete_parse); status = acpi_get_table_by_index(table_index, &table); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Table must consist of at least a complete header */ if (table->length < sizeof(struct acpi_table_header)) { return_ACPI_STATUS(AE_BAD_HEADER); } aml_start = (u8 *)table + sizeof(struct acpi_table_header); aml_length = table->length - sizeof(struct acpi_table_header); status = acpi_tb_get_owner_id(table_index, &owner_id); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Create and init a Root Node */ parse_root = acpi_ps_create_scope_op(aml_start); if (!parse_root) { return_ACPI_STATUS(AE_NO_MEMORY); } /* Create and initialize a new walk state */ walk_state = acpi_ds_create_walk_state(owner_id, NULL, NULL, NULL); if (!walk_state) { acpi_ps_free_op(parse_root); return_ACPI_STATUS(AE_NO_MEMORY); } status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, aml_start, aml_length, NULL, (u8)pass_number); if (ACPI_FAILURE(status)) { acpi_ds_delete_walk_state(walk_state); goto cleanup; } /* Found OSDT table, enable the namespace override feature */ if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT) && pass_number == ACPI_IMODE_LOAD_PASS1) { walk_state->namespace_override = TRUE; } /* start_node is the default location to load the table */ if (start_node && start_node != acpi_gbl_root_node) { status = acpi_ds_scope_stack_push(start_node, ACPI_TYPE_METHOD, walk_state); if (ACPI_FAILURE(status)) { acpi_ds_delete_walk_state(walk_state); goto cleanup; } } /* Parse the AML */ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %u parse/n", pass_number)); status = acpi_ps_parse_aml(walk_state);cleanup: acpi_ps_delete_parse_tree(parse_root); return_ACPI_STATUS(status);}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:98,
注:本文中的ACPI_COMPARE_NAME函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACPI_DEBUG_PRINT_RAW函数代码示例 C++ ACPI_COMPANION函数代码示例 |