您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AcpiOsAllocate函数代码示例

51自学网 2021-06-01 19:39:45
  C++
这篇教程C++ AcpiOsAllocate函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中AcpiOsAllocate函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiOsAllocate函数的具体用法?C++ AcpiOsAllocate怎么用?C++ AcpiOsAllocate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了AcpiOsAllocate函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AcpiDbAddToHistory

voidAcpiDbAddToHistory (    char                    *CommandLine){    UINT16                  CmdLen;    UINT16                  BufferLen;    /* Put command into the next available slot */    CmdLen = (UINT16) ACPI_STRLEN (CommandLine);    if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL)    {        BufferLen = (UINT16) ACPI_STRLEN (            AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command);        if (CmdLen > BufferLen)        {            AcpiOsFree (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].                Command);            AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =                AcpiOsAllocate (CmdLen + 1);        }    }    else    {        AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command =            AcpiOsAllocate (CmdLen + 1);    }    ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command,        CommandLine);    AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum =        AcpiGbl_NextCmdNum;    /* Adjust indexes */    if ((AcpiGbl_NumHistory == HISTORY_SIZE) &&        (AcpiGbl_NextHistoryIndex == AcpiGbl_LoHistory))    {        AcpiGbl_LoHistory++;        if (AcpiGbl_LoHistory >= HISTORY_SIZE)        {            AcpiGbl_LoHistory = 0;        }    }    AcpiGbl_NextHistoryIndex++;    if (AcpiGbl_NextHistoryIndex >= HISTORY_SIZE)    {        AcpiGbl_NextHistoryIndex = 0;    }    AcpiGbl_NextCmdNum++;    if (AcpiGbl_NumHistory < HISTORY_SIZE)    {        AcpiGbl_NumHistory++;    }}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:58,


示例2: AcpiOsCreateCache

ACPI_STATUSAcpiOsCreateCache (    const char              *CacheName,    UINT16                  ObjectSize,    UINT16                  MaxDepth,    ACPI_MEMORY_LIST        **ReturnCache){    ACPI_MEMORY_LIST        *Cache;    ACPI_FUNCTION_ENTRY ();    if (!CacheName || !ReturnCache || (ObjectSize < 16))    {        return (AE_BAD_PARAMETER);    }    /* Create the cache object */    Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));    if (!Cache)    {        return (AE_NO_MEMORY);    }    /* Populate the cache object and return it */    memset (Cache, 0, sizeof (ACPI_MEMORY_LIST));    Cache->ListName   = __UNCONST(CacheName);    Cache->ObjectSize = ObjectSize;    Cache->MaxDepth = MaxDepth;    *ReturnCache = Cache;    return (AE_OK);}
开发者ID:ryo,项目名称:netbsd-src,代码行数:35,


示例3: AcpiUtAllocate

void *AcpiUtAllocate (    ACPI_SIZE               Size,    UINT32                  Component,    const char              *Module,    UINT32                  Line){    void                    *Allocation;    ACPI_FUNCTION_TRACE_U32 (UtAllocate, Size);    /* Check for an inadvertent size of zero bytes */    if (!Size)    {        ACPI_WARNING ((Module, Line,                       "Attempt to allocate zero bytes, allocating 1 byte"));        Size = 1;    }    Allocation = AcpiOsAllocate (Size);    if (!Allocation)    {        /* Report allocation error */        ACPI_WARNING ((Module, Line,                       "Could not allocate size %u", (UINT32) Size));        return_PTR (NULL);    }    return_PTR (Allocation);}
开发者ID:michas2,项目名称:l4re-snapshot,代码行数:35,


示例4: acpi_res_set_init

static voidacpi_res_set_init(device_t dev, void *arg, void **context){    struct acpi_res_context	*cp;    if ((cp = AcpiOsAllocate(sizeof(*cp))) != NULL) {	bzero(cp, sizeof(*cp));	cp->ar_parent = arg;	*context = cp;    }}
开发者ID:jamesbjackson,项目名称:src,代码行数:11,


示例5: AcpiUtAllocateAndTrack

void *AcpiUtAllocateAndTrack (    ACPI_SIZE               Size,    UINT32                  Component,    const char              *Module,    UINT32                  Line){    ACPI_DEBUG_MEM_BLOCK    *Allocation;    ACPI_STATUS             Status;    /* Check for an inadvertent size of zero bytes */    if (!Size)    {        ACPI_WARNING ((Module, Line,            "Attempt to allocate zero bytes, allocating 1 byte"));        Size = 1;    }    Allocation = AcpiOsAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER));    if (!Allocation)    {        /* Report allocation error */        ACPI_WARNING ((Module, Line,            "Could not allocate size %u", (UINT32) Size));        return (NULL);    }    Status = AcpiUtTrackAllocation (        Allocation, Size, ACPI_MEM_MALLOC, Component, Module, Line);    if (ACPI_FAILURE (Status))    {        AcpiOsFree (Allocation);        return (NULL);    }    AcpiGbl_GlobalList->TotalAllocated++;    AcpiGbl_GlobalList->TotalSize += (UINT32) Size;    AcpiGbl_GlobalList->CurrentTotalSize += (UINT32) Size;    if (AcpiGbl_GlobalList->CurrentTotalSize >        AcpiGbl_GlobalList->MaxOccupied)    {        AcpiGbl_GlobalList->MaxOccupied =            AcpiGbl_GlobalList->CurrentTotalSize;    }    return ((void *) &Allocation->UserSpace);}
开发者ID:bininc,项目名称:acpica,代码行数:52,


示例6: AcpiUtAllocate

void *AcpiUtAllocate (    UINT32                  Size,    UINT32                  Component,    NATIVE_CHAR             *Module,    UINT32                  Line){    ACPI_DEBUG_MEM_BLOCK    *Address;    ACPI_STATUS             Status;    FUNCTION_TRACE_U32 ("UtAllocate", Size);    /* Check for an inadvertent size of zero bytes */    if (!Size)    {        _REPORT_ERROR (Module, Line, Component,                ("UtAllocate: Attempt to allocate zero bytes/n"));        Size = 1;    }    Address = AcpiOsAllocate (Size + sizeof (ACPI_DEBUG_MEM_BLOCK));    if (!Address)    {        /* Report allocation error */        _REPORT_ERROR (Module, Line, Component,                ("UtAllocate: Could not allocate size %X/n", Size));        return_PTR (NULL);    }    Status = AcpiUtAddElementToAllocList (ACPI_MEM_LIST_GLOBAL, Address, Size,                    MEM_MALLOC, Component, Module, Line);    if (ACPI_FAILURE (Status))    {        AcpiOsFree (Address);        return_PTR (NULL);    }    AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;    AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += Size;    ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X/n", Address, Size));    return_PTR ((void *) &Address->UserSpace);}
开发者ID:MarginC,项目名称:kame,代码行数:49,


示例7: AcpiOsAllocateZeroed

void *AcpiOsAllocateZeroed (    ACPI_SIZE               Size){    void                    *Mem;    Mem = AcpiOsAllocate (Size);    if (Mem)    {        ACPI_MEMSET (Mem, 0, Size);    }    return (Mem);}
开发者ID:d3c0n808,项目名称:Intel-iasl,代码行数:15,


示例8: FlStrdup

static char *FlStrdup (    char                *String){    char                *NewString;    NewString = AcpiOsAllocate (strlen (String) + 1);    if (!NewString)    {        return (NULL);    }    strcpy (NewString, String);    return (NewString);}
开发者ID:minggr,项目名称:acpica,代码行数:16,


示例9: AcpiOsCreateSemaphore

ACPI_STATUSAcpiOsCreateSemaphore (    UINT32              MaxUnits,    UINT32              InitialUnits,    ACPI_HANDLE         *OutHandle){#if 0    sem_t               *Sem;    if (!OutHandle)    {        return (AE_BAD_PARAMETER);    }#ifdef __APPLE__    {        char            *SemaphoreName = tmpnam (NULL);        Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits);        if (!Sem)        {            return (AE_NO_MEMORY);        }        sem_unlink (SemaphoreName); /* This just deletes the name */    }#else    Sem = AcpiOsAllocate (sizeof (sem_t));    if (!Sem)    {        return (AE_NO_MEMORY);    }    if (sem_init (Sem, 0, InitialUnits) == -1)    {        AcpiOsFree (Sem);        return (AE_BAD_PARAMETER);    }#endif    *OutHandle = (ACPI_HANDLE) Sem;#endif	*OutHandle = (ACPI_HANDLE) 1;    return (AE_OK);}
开发者ID:Ninals-GitHub,项目名称:TRON,代码行数:46,


示例10: AcpiOsAllocateZeroed

void *AcpiOsAllocateZeroed (    ACPI_SIZE               Size){    void                    *Allocation;    ACPI_FUNCTION_ENTRY ();    Allocation = AcpiOsAllocate (Size);    if (Allocation)    {        /* Clear the memory block */        ACPI_MEMSET (Allocation, 0, Size);    }    return (Allocation);}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:20,


示例11: AcpiUtCreateList

ACPI_STATUSAcpiUtCreateList (    char                    *ListName,    UINT16                  ObjectSize,    ACPI_MEMORY_LIST        **ReturnCache){    ACPI_MEMORY_LIST        *Cache;    Cache = AcpiOsAllocate (sizeof (ACPI_MEMORY_LIST));    if (!Cache)    {        return (AE_NO_MEMORY);    }    ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));    Cache->ListName   = ListName;    Cache->ObjectSize = ObjectSize;    *ReturnCache = Cache;    return (AE_OK);}
开发者ID:luciang,项目名称:haiku,代码行数:23,


示例12: main

//.........这里部分代码省略.........    {        InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT);    }    /* The remaining arguments are filenames for ACPI tables */    if (argv[AcpiGbl_Optind])    {        AcpiGbl_DbOpt_tables = TRUE;        TableCount = 0;        /* Get each of the ACPI table files on the command line */        while (argv[AcpiGbl_Optind])        {            /* Split incoming path into a directory/filename combo */            Status = FlSplitInputPathname (argv[AcpiGbl_Optind], &Directory, &Filename);            if (ACPI_FAILURE (Status))            {                return (Status);            }            /* Expand wildcards (Windows only) */            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 enterloop;                }                AcpiOsFree (FullPathname);                AcpiOsFree (*WildcardList);                *WildcardList = NULL;                WildcardList++;                /*                 * Ignore an FACS or RSDT, we can't use them.                 */                if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS) ||                    ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDT))                {                    AcpiOsFree (Table);                    continue;                }
开发者ID:minggr,项目名称:acpica,代码行数:66,


示例13: AcpiUtInitializeBuffer

ACPI_STATUSAcpiUtInitializeBuffer (    ACPI_BUFFER             *Buffer,    ACPI_SIZE               RequiredLength){    ACPI_SIZE               InputBufferLength;    /* Parameter validation */    if (!Buffer || !RequiredLength)    {        return (AE_BAD_PARAMETER);    }    /*     * Buffer->Length is used as both an input and output parameter. Get the     * input actual length and set the output required buffer length.     */    InputBufferLength = Buffer->Length;    Buffer->Length = RequiredLength;    /*     * The input buffer length contains the actual buffer length, or the type     * of buffer to be allocated by this routine.     */    switch (InputBufferLength)    {    case ACPI_NO_BUFFER:        /* Return the exception (and the required buffer length) */        return (AE_BUFFER_OVERFLOW);    case ACPI_ALLOCATE_BUFFER:        /* Allocate a new buffer */        Buffer->Pointer = AcpiOsAllocate (RequiredLength);        break;    case ACPI_ALLOCATE_LOCAL_BUFFER:        /* Allocate a new buffer with local interface to allow tracking */        Buffer->Pointer = ACPI_ALLOCATE (RequiredLength);        break;    default:        /* Existing buffer: Validate the size of the buffer */        if (InputBufferLength < RequiredLength)        {            return (AE_BUFFER_OVERFLOW);        }        break;    }    /* Validate allocation from above or input buffer pointer */    if (!Buffer->Pointer)    {        return (AE_NO_MEMORY);    }    /* Have a valid buffer, clear it */    ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);    return (AE_OK);}
开发者ID:michas2,项目名称:l4re-snapshot,代码行数:71,


示例14: AbComputeChecksum

voidAbComputeChecksum (    char                    *FilePath){    UINT32                  Actual;    ACPI_TABLE_HEADER       *Table;    UINT8                   Checksum;    FILE                    *File;    File = fopen (FilePath, "rb");    if (!File)    {        printf ("Could not open file %s/n", FilePath);        return;    }    Actual = fread (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File);    if (Actual < sizeof (ACPI_TABLE_HEADER))    {        printf ("File %s does not contain a valid ACPI table header/n", FilePath);        goto Exit1;    }    if (!AbValidateHeader (&Header1))    {        goto Exit1;    }    if (!Gbl_TerseMode)    {        AbPrintHeaderInfo (&Header1);    }    /* Allocate a buffer to hold the entire table */    Table = AcpiOsAllocate (Header1.Length);    if (!Table)    {        printf ("Could not allocate buffer for table/n");        goto Exit1;    }    /* Read the entire table, including header */    fseek (File, 0, SEEK_SET);    Actual = fread (Table, 1, Header1.Length, File);    if (Actual != Header1.Length)    {        printf ("Could not read table, length %u/n", Header1.Length);        goto Exit2;    }    /* Compute the checksum for the table */    Table->Checksum = 0;    Checksum = (UINT8) (0 - AcpiTbSumTable (Table, Table->Length));    printf ("Computed checksum: 0x%X/n/n", Checksum);    if (Header1.Checksum == Checksum)    {        printf ("Checksum OK in AML file, not updating/n");        goto Exit2;    }    /* Open the target file for writing, to update checksum */    fclose (File);    File = fopen (FilePath, "r+b");    if (!File)    {        printf ("Could not open file %s for writing/n", FilePath);        goto Exit2;    }    /* Set the checksum, write the new header */    Header1.Checksum = Checksum;    Actual = fwrite (&Header1, 1, sizeof (ACPI_TABLE_HEADER), File);    if (Actual != sizeof (ACPI_TABLE_HEADER))    {        printf ("Could not write updated table header/n");        goto Exit2;    }    printf ("Wrote new checksum/n");Exit2:    AcpiOsFree (Table);Exit1:    if (File)    {        fclose (File);    }    return;}
开发者ID:SchmErik,项目名称:acpica,代码行数:99,


示例15: AcpiDbReadTable

static 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 */    fseek (fp, 0, SEEK_END);    FileSize = (UINT32) ftell (fp);    fseek (fp, 0, SEEK_SET);    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 RSDT, FACS and S3PT tables do not have standard ACPI headers */    if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") ||        ACPI_COMPARE_NAME (TableHeader.Signature, "FACS") ||        ACPI_COMPARE_NAME (TableHeader.Signature, "S3PT"))    {        *TableLength = FileSize;        StandardHeader = FALSE;    }    else    {        /* Read the table header */        if (fread (&TableHeader, 1, sizeof (TableHeader), 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);            return (AE_BAD_HEADER);        }#ifdef ACPI_OBSOLETE_CODE        /* We only support a limited number of table types */        if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&            ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&            ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))        {            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;    }    /* Allocate a buffer for the table */    *Table = AcpiOsAllocate ((size_t) FileSize);    if (!*Table)    {        AcpiOsPrintf (            "Could not allocate memory for ACPI table %4.4s (size=0x%X)/n",            TableHeader.Signature, *TableLength);//.........这里部分代码省略.........
开发者ID:ppaeps,项目名称:freebsd-head,代码行数:101,


示例16: main

int 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_DbOpt_tables = TRUE;    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:LlsDimple,项目名称:acpica,代码行数:101,


示例17: AcpiUtReadTable

static ACPI_STATUSAcpiUtReadTable (    FILE                    *fp,    ACPI_TABLE_HEADER       **Table,    UINT32                  *TableLength){    ACPI_TABLE_HEADER       TableHeader;    UINT32                  Actual;    ACPI_STATUS             Status;    UINT32                  FileSize;    BOOLEAN                 StandardHeader = TRUE;    INT32                   Count;    /* 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 */    fseek (fp, 0, SEEK_SET);    Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp);    if (Count != sizeof (ACPI_TABLE_HEADER))    {        AcpiOsPrintf ("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 (TableHeader.Signature))    {        *TableLength = FileSize;        StandardHeader = FALSE;    }    else    {#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            AcpiOsPrintf ("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 *) 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;    }    /* Allocate a buffer for the table */    *Table = AcpiOsAllocate ((size_t) FileSize);    if (!*Table)    {        AcpiOsPrintf (            "Could not allocate memory for ACPI table %4.4s (size=0x%X)/n",            TableHeader.Signature, *TableLength);        return (AE_NO_MEMORY);    }//.........这里部分代码省略.........
开发者ID:coyizumi,项目名称:cs111,代码行数:101,


示例18: AcpiUtInitializeBuffer

ACPI_STATUSAcpiUtInitializeBuffer (    ACPI_BUFFER             *Buffer,    ACPI_SIZE               RequiredLength){    ACPI_STATUS             Status = AE_OK;    switch (Buffer->Length)    {    case ACPI_NO_BUFFER:        /* Set the exception and returned the required length */        Status = AE_BUFFER_OVERFLOW;        break;    case ACPI_ALLOCATE_BUFFER:        /* Allocate a new buffer */        Buffer->Pointer = AcpiOsAllocate (RequiredLength);        if (!Buffer->Pointer)        {            return (AE_NO_MEMORY);        }        /* Clear the buffer */        ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);        break;    case ACPI_ALLOCATE_LOCAL_BUFFER:        /* Allocate a new buffer with local interface to allow tracking */        Buffer->Pointer = ACPI_ALLOCATE_ZEROED (RequiredLength);        if (!Buffer->Pointer)        {            return (AE_NO_MEMORY);        }        break;    default:        /* Existing buffer: Validate the size of the buffer */        if (Buffer->Length < RequiredLength)        {            Status = AE_BUFFER_OVERFLOW;            break;        }        /* Clear the buffer */        ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);        break;    }    Buffer->Length = RequiredLength;    return (Status);}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:65,


示例19: AcpiDbInitialize

ACPI_STATUSAcpiDbInitialize (    void){    ACPI_STATUS             Status;    /* Init globals */    AcpiGbl_DbBuffer            = NULL;    AcpiGbl_DbFilename          = NULL;    AcpiGbl_DbOutputToFile      = FALSE;    AcpiGbl_DbDebugLevel        = ACPI_LV_VERBOSITY2;    AcpiGbl_DbConsoleDebugLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES;    AcpiGbl_DbOutputFlags       = ACPI_DB_CONSOLE_OUTPUT;    AcpiGbl_DbOpt_tables        = FALSE;    AcpiGbl_DbOpt_stats         = FALSE;#ifdef ACPI_DISASSEMBLER    AcpiGbl_DbOpt_disasm        = FALSE;    AcpiGbl_DbOpt_verbose       = TRUE;#endif    AcpiGbl_DbOpt_ini_methods   = TRUE;    AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE);    if (!AcpiGbl_DbBuffer)    {        return (AE_NO_MEMORY);    }    ACPI_MEMSET (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE);    /* Initial scope is the root */    AcpiGbl_DbScopeBuf [0] = '//';    AcpiGbl_DbScopeBuf [1] =  0;    AcpiGbl_DbScopeNode = AcpiGbl_RootNode;    /*     * If configured for multi-thread support, the debug executor runs in     * a separate thread so that the front end can be in another address     * space, environment, or even another machine.     */    if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED)    {        /* These were created with one unit, grab it */        Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("Could not get debugger mutex/n");            return (Status);        }        Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("Could not get debugger mutex/n");            return (Status);        }        /* Create the debug execution thread to execute commands */        Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbExecuteThread, NULL);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("Could not start debugger thread/n");            return (Status);        }    }#ifdef ACPI_DISASSEMBLER    if (!AcpiGbl_DbOpt_verbose)    {        AcpiGbl_DbOpt_disasm = TRUE;        AcpiGbl_DbOpt_stats = FALSE;    }#endif    return (AE_OK);}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:81,


示例20: AeRegionHandler

//.........这里部分代码省略.........    }    /*     * Search through the linked list for this region's buffer     */    BufferExists = FALSE;    RegionElement = AeRegions.RegionList;    if (AeRegions.NumberOfRegions)    {        while (!BufferExists && RegionElement)        {            if (RegionElement->Address == BaseAddress &&                RegionElement->Length == Length &&                RegionElement->SpaceId == SpaceId)            {                BufferExists = TRUE;            }            else            {                RegionElement = RegionElement->NextRegion;            }        }    }    /*     * If the Region buffer does not exist, create it now     */    if (!BufferExists)    {        /*         * Do the memory allocations first         */        RegionElement = AcpiOsAllocate (sizeof (AE_REGION));        if (!RegionElement)        {            return AE_NO_MEMORY;        }        RegionElement->Buffer = AcpiOsAllocate (Length);        if (!RegionElement->Buffer)        {            AcpiOsFree (RegionElement);            return AE_NO_MEMORY;        }        /* Initialize the region with the default fill value */        ACPI_MEMSET (RegionElement->Buffer, AcpiGbl_RegionFillValue, Length);        RegionElement->Address      = BaseAddress;        RegionElement->Length       = Length;        RegionElement->SpaceId      = SpaceId;        RegionElement->NextRegion   = NULL;        /*         * Increment the number of regions and put this one         *  at the head of the list as it will probably get accessed         *  more often anyway.         */        AeRegions.NumberOfRegions += 1;        if (AeRegions.RegionList)        {            RegionElement->NextRegion = AeRegions.RegionList;        }
开发者ID:iversonjimmy,项目名称:acer_cloud_wifi_copy,代码行数:67,


示例21: OpnDoDefinitionBlock

static voidOpnDoDefinitionBlock (    ACPI_PARSE_OBJECT       *Op){    ACPI_PARSE_OBJECT       *Child;    ACPI_SIZE               Length;    ACPI_NATIVE_UINT        i;    /*     * These nodes get stuffed into the table header.  They are special     * cased when the table is written to the output file.     *     * Mark all of these nodes as non-usable so they won't get output     * as AML opcodes!     */    /* Get AML filename. Use it if non-null */    Child = Op->Asl.Child;    if (Child->Asl.Value.Buffer  &&        *Child->Asl.Value.Buffer &&        (Gbl_UseDefaultAmlFilename))    {        Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer;    }    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;    /* Signature */    Child = Child->Asl.Next;    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;    if (Child->Asl.Value.String)    {        Gbl_TableSignature = Child->Asl.Value.String;        if (ACPI_STRLEN (Gbl_TableSignature) != 4)        {            AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,                "Length not exactly 4");        }        for (i = 0; i < 4; i++)        {            if (!isalnum (Gbl_TableSignature[i]))            {                AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,                    "Contains non-alphanumeric characters");            }        }    }    /* Revision */    Child = Child->Asl.Next;    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;    /*     * We used the revision to set the integer width earlier     */    /* OEMID */    Child = Child->Asl.Next;    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;    /* OEM TableID */    Child = Child->Asl.Next;    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;    if (Child->Asl.Value.String)    {        Length = ACPI_STRLEN (Child->Asl.Value.String);        Gbl_TableId = AcpiOsAllocate (Length + 1);        ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String);        for (i = 0; i < Length; i++)        {            if (Gbl_TableId[i] == ' ')            {                Gbl_TableId[i] = 0;                break;            }        }    }    /* OEM Revision */    Child = Child->Asl.Next;    Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:89,


示例22: AcpiUtInitializeBuffer

ACPI_STATUSAcpiUtInitializeBuffer (    ACPI_BUFFER             *Buffer,    ACPI_SIZE               RequiredLength){    ACPI_SIZE               InputBufferLength;    /* Parameter validation */    if (!Buffer || !RequiredLength)    {        return (AE_BAD_PARAMETER);    }    /*     * Buffer->Length is used as both an input and output parameter. Get the     * input actual length and set the output required buffer length.     */    InputBufferLength = Buffer->Length;    Buffer->Length = RequiredLength;    /*     * The input buffer length contains the actual buffer length, or the type     * of buffer to be allocated by this routine.     */    switch (InputBufferLength)    {    case ACPI_NO_BUFFER:        /* Return the exception (and the required buffer length) */        return (AE_BUFFER_OVERFLOW);    case ACPI_ALLOCATE_BUFFER:        /*         * Allocate a new buffer. We directectly call AcpiOsAllocate here to         * purposefully bypass the (optionally enabled) internal allocation         * tracking mechanism since we only want to track internal         * allocations. Note: The caller should use AcpiOsFree to free this         * buffer created via ACPI_ALLOCATE_BUFFER.         */        Buffer->Pointer = AcpiOsAllocate (RequiredLength);        break;    case ACPI_ALLOCATE_LOCAL_BUFFER:        /* Allocate a new buffer with local interface to allow tracking */        Buffer->Pointer = ACPI_ALLOCATE (RequiredLength);        break;    default:        /* Existing buffer: Validate the size of the buffer */        if (InputBufferLength < RequiredLength)        {            return (AE_BUFFER_OVERFLOW);        }        break;    }    /* Validate allocation from above or input buffer pointer */    if (!Buffer->Pointer)    {        return (AE_NO_MEMORY);    }    /* Have a valid buffer, clear it */    ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);    return (AE_OK);}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:75,


示例23: OsGetTable

//.........这里部分代码省略.........            /*             * 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            {                AcpiOsPrintf ("Could not find %s in registry at %s/n",                    Signature, KeyBuffer);                return (NULL);            }        }        else        {            break;        }    }    /* Actual data for table is down a couple levels */    for (i = 0; ;)    {        Status = RegEnumKey (Handle, i, KeyBuffer, sizeof (KeyBuffer));        i += 1;        if (Status == ERROR_NO_MORE_ITEMS)        {            break;        }        Status = RegOpenKey (Handle, KeyBuffer, &SubKey);        if (Status != ERROR_SUCCESS)        {            AcpiOsPrintf ("Could not open %s entry/n", Signature);            return (NULL);        }        RegCloseKey (Handle);        Handle = SubKey;        i = 0;    }    /* Find the (binary) table entry */    for (i = 0; ;)    {        NameSize = sizeof (KeyBuffer);        Status = RegEnumValue (Handle, i, KeyBuffer, &NameSize,                    NULL, &Type, NULL, 0);        if (Status != ERROR_SUCCESS)        {            AcpiOsPrintf ("Could not get %s registry entry/n", Signature);            return (NULL);        }        if (Type == REG_BINARY)        {            break;        }        i += 1;    }    /* Get the size of the table */    Status = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL, NULL, &DataSize);    if (Status != ERROR_SUCCESS)    {        AcpiOsPrintf ("Could not read the %s table size/n", Signature);        return (NULL);    }    /* Allocate a new buffer for the table */    ReturnTable = AcpiOsAllocate (DataSize);    if (!ReturnTable)    {        goto Cleanup;    }    /* Get the actual table from the registry */    Status = RegQueryValueEx (Handle, KeyBuffer, NULL, NULL,                (UCHAR *) ReturnTable, &DataSize);    if (Status != ERROR_SUCCESS)    {        AcpiOsPrintf ("Could not read %s data/n", Signature);        AcpiOsFree (ReturnTable);        return (NULL);    }Cleanup:    RegCloseKey (Handle);    return (ReturnTable);}
开发者ID:ExpressOS,项目名称:third_party-l4re,代码行数:101,


示例24: AeBuildLocalTables

ACPI_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:BarrelfishOS,项目名称:barrelfish,代码行数:101,


示例25: NsDumpEntireNamespace

static intNsDumpEntireNamespace (    char                    *AmlFilename){    ACPI_STATUS             Status;    ACPI_TABLE_HEADER       *Table = NULL;    UINT32                  TableCount = 0;    AE_TABLE_DESC           *TableDesc;    ACPI_HANDLE             Handle;    /* Open the binary AML file and read the entire table */    Status = AcpiUtReadTableFromFile (AmlFilename, &Table);    if (ACPI_FAILURE (Status))    {        printf ("**** Could not get input table %s, %s/n", AmlFilename,            AcpiFormatException (Status));        return (-1);    }    /* Table must be a DSDT. SSDTs are not currently supported */    if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))    {        printf ("**** Input table signature is [%4.4s], must be [DSDT]/n",            Table->Signature);        return (-1);    }    /*     * Allocate and link a table descriptor (allows for future expansion to     * multiple input files)     */    TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC));    TableDesc->Table = Table;    TableDesc->Next = AeTableListHead;    AeTableListHead = TableDesc;    TableCount++;    /*     * Build a local XSDT with all tables. Normally, here is where the     * RSDP search is performed to find the ACPI tables     */    Status = AeBuildLocalTables (TableCount, AeTableListHead);    if (ACPI_FAILURE (Status))    {        return (-1);    }    /* Initialize table manager, get XSDT */    Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE);    if (ACPI_FAILURE (Status))    {        printf ("**** Could not initialize ACPI table manager, %s/n",            AcpiFormatException (Status));        return (-1);    }    /* Reallocate root table to dynamic memory */    Status = AcpiReallocateRootTable ();    if (ACPI_FAILURE (Status))    {        printf ("**** Could not reallocate root table, %s/n",            AcpiFormatException (Status));        return (-1);    }    /* Load the ACPI namespace */    Status = AcpiLoadTables ();    if (ACPI_FAILURE (Status))    {        printf ("**** Could not load ACPI tables, %s/n",            AcpiFormatException (Status));        return (-1);    }    /*     * Enable ACPICA. These calls don't do much for this     * utility, since we only dump the namespace. There is no     * hardware or event manager code underneath.     */    Status = AcpiEnableSubsystem (                ACPI_NO_ACPI_ENABLE |                ACPI_NO_ADDRESS_SPACE_INIT |                ACPI_NO_EVENT_INIT |                ACPI_NO_HANDLER_INIT);    if (ACPI_FAILURE (Status))    {        printf ("**** Could not EnableSubsystem, %s/n",            AcpiFormatException (Status));        return (-1);    }    Status = AcpiInitializeObjects (                ACPI_NO_ADDRESS_SPACE_INIT |//.........这里部分代码省略.........
开发者ID:victoredwardocallaghan,项目名称:DragonFlyBSD,代码行数:101,


示例26: AcpiDbCreateExecutionThreads

voidAcpiDbCreateExecutionThreads (    char                    *NumThreadsArg,    char                    *NumLoopsArg,    char                    *MethodNameArg){    ACPI_STATUS             Status;    UINT32                  NumThreads;    UINT32                  NumLoops;    UINT32                  i;    UINT32                  Size;    ACPI_MUTEX              MainThreadGate;    ACPI_MUTEX              ThreadCompleteGate;    ACPI_MUTEX              InfoGate;    /* Get the arguments */    NumThreads = ACPI_STRTOUL (NumThreadsArg, NULL, 0);    NumLoops   = ACPI_STRTOUL (NumLoopsArg, NULL, 0);    if (!NumThreads || !NumLoops)    {        AcpiOsPrintf ("Bad argument: Threads %X, Loops %X/n",            NumThreads, NumLoops);        return;    }    /*     * Create the semaphore for synchronization of     * the created threads with the main thread.     */    Status = AcpiOsCreateSemaphore (1, 0, &MainThreadGate);    if (ACPI_FAILURE (Status))    {        AcpiOsPrintf ("Could not create semaphore for synchronization with the main thread, %s/n",            AcpiFormatException (Status));        return;    }    /*     * Create the semaphore for synchronization     * between the created threads.     */    Status = AcpiOsCreateSemaphore (1, 1, &ThreadCompleteGate);    if (ACPI_FAILURE (Status))    {        AcpiOsPrintf ("Could not create semaphore for synchronization between the created threads, %s/n",            AcpiFormatException (Status));        (void) AcpiOsDeleteSemaphore (MainThreadGate);        return;    }    Status = AcpiOsCreateSemaphore (1, 1, &InfoGate);    if (ACPI_FAILURE (Status))    {        AcpiOsPrintf ("Could not create semaphore for synchronization of AcpiGbl_DbMethodInfo, %s/n",            AcpiFormatException (Status));        (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);        (void) AcpiOsDeleteSemaphore (MainThreadGate);        return;    }    ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));    /* Array to store IDs of threads */    AcpiGbl_DbMethodInfo.NumThreads = NumThreads;    Size = sizeof (ACPI_THREAD_ID) * AcpiGbl_DbMethodInfo.NumThreads;    AcpiGbl_DbMethodInfo.Threads = AcpiOsAllocate (Size);    if (AcpiGbl_DbMethodInfo.Threads == NULL)    {        AcpiOsPrintf ("No memory for thread IDs array/n");        (void) AcpiOsDeleteSemaphore (MainThreadGate);        (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);        (void) AcpiOsDeleteSemaphore (InfoGate);        return;    }    ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size);    /* Setup the context to be passed to each thread */    AcpiGbl_DbMethodInfo.Name = MethodNameArg;    AcpiGbl_DbMethodInfo.Flags = 0;    AcpiGbl_DbMethodInfo.NumLoops = NumLoops;    AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate;    AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate;    AcpiGbl_DbMethodInfo.InfoGate = InfoGate;    /* Init arguments to be passed to method */    AcpiGbl_DbMethodInfo.InitArgs = 1;    AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments;    AcpiGbl_DbMethodInfo.Arguments[0] = AcpiGbl_DbMethodInfo.NumThreadsStr;    AcpiGbl_DbMethodInfo.Arguments[1] = AcpiGbl_DbMethodInfo.IdOfThreadStr;    AcpiGbl_DbMethodInfo.Arguments[2] = AcpiGbl_DbMethodInfo.IndexOfThreadStr;    AcpiGbl_DbMethodInfo.Arguments[3] = NULL;    AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes;    AcpiGbl_DbMethodInfo.ArgTypes[0] = ACPI_TYPE_INTEGER;//.........这里部分代码省略.........
开发者ID:Lxg1582,项目名称:freebsd,代码行数:101,


示例27: AeBuildLocalTables

ACPI_STATUSAeBuildLocalTables (    UINT32                  TableCount,    AE_TABLE_DESC           *TableList){    ACPI_PHYSICAL_ADDRESS   DsdtAddress = 0;    UINT32                  XsdtSize;    AE_TABLE_DESC           *NextTable;    UINT32                  NextIndex;    ACPI_TABLE_FADT         *ExternalFadt = NULL;    /*     * Update the table count. For DSDT, it is not put into the XSDT. For     * FADT, this 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);    }    ACPI_MEMSET (LocalXSDT, 0, XsdtSize);    ACPI_MOVE_NAME (LocalXSDT->Header.Signature, ACPI_SIG_XSDT);    LocalXSDT->Header.Length = XsdtSize;    LocalXSDT->Header.Revision = 1;    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.     */    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[2] = 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;    }    /* Build an RSDP */    ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP));    ACPI_MAKE_RSDP_SIG (LocalRSDP.Signature);    ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6);    LocalRSDP.Revision = 2;    LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT);    LocalRSDP.Length = sizeof (ACPI_TABLE_XSDT);    /* Set checksums for both XSDT and RSDP */    LocalXSDT->Header.Checksum = (UINT8) -AcpiTbChecksum (        (void *) LocalXSDT, LocalXSDT->Header.Length);    LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum (        (void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH);//.........这里部分代码省略.........
开发者ID:zenny,项目名称:DragonFlyBSD,代码行数:101,



注:本文中的AcpiOsAllocate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ AcpiOsFree函数代码示例
C++ AcpiOsAcquireLock函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。