本文整理汇总了C++中AcpiOsAllocate函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiOsAllocate函数的具体用法?C++ AcpiOsAllocate怎么用?C++ AcpiOsAllocate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AcpiOsAllocate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AcpiDbAddToHistory
void
AcpiDbAddToHistory (
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,代码来源:dbhistry.c
示例2: AcpiOsCreateCache
ACPI_STATUS
AcpiOsCreateCache (
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,代码来源:utcache.c
示例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,代码来源:utalloc.c
示例4: acpi_res_set_init
static void
acpi_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,代码来源:acpi_resource.c
示例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,代码来源:uttrack.c
示例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,代码来源:utalloc.c
示例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,代码来源:osefixf.c
示例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,代码来源:aemain.c
示例9: AcpiOsCreateSemaphore
ACPI_STATUS
AcpiOsCreateSemaphore (
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,代码来源:ostron.c
示例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,代码来源:utalloc.c
示例11: AcpiUtCreateList
ACPI_STATUS
AcpiUtCreateList (
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,代码来源:uttrack.c
示例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,代码来源:aemain.c
示例13: AcpiUtInitializeBuffer
ACPI_STATUS
AcpiUtInitializeBuffer (
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,代码来源:utalloc.c
示例14: AbComputeChecksum
void
AbComputeChecksum (
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,代码来源:abcompare.c
示例15: AcpiDbReadTable
static ACPI_STATUS
AcpiDbReadTable (
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,代码来源:dbfileio.c
示例16: main
int ACPI_SYSTEM_XFACE
main (
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,代码来源:aemain.c
示例17: AcpiUtReadTable
static ACPI_STATUS
AcpiUtReadTable (
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,代码来源:utfileio.c
示例18: AcpiUtInitializeBuffer
ACPI_STATUS
AcpiUtInitializeBuffer (
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,代码来源:utalloc.c
示例19: AcpiDbInitialize
ACPI_STATUS
AcpiDbInitialize (
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,代码来源:dbxface.c
示例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,代码来源:aehandlers.c
注:本文中的AcpiOsAllocate函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论