本文整理汇总了C++中ACPI_STRCMP函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_STRCMP函数的具体用法?C++ ACPI_STRCMP怎么用?C++ ACPI_STRCMP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_STRCMP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: while
struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name)
{
struct acpi_interface_info *next_interface;
next_interface = acpi_gbl_supported_interfaces;
while (next_interface) {
if (!ACPI_STRCMP(interface_name, next_interface->name)) {
return (next_interface);
}
next_interface = next_interface->next;
}
return (NULL);
}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:15,代码来源:utosi.c
示例2: acpi_ut_remove_interface
acpi_status acpi_ut_remove_interface(acpi_string interface_name)
{
struct acpi_interface_info *previous_interface;
struct acpi_interface_info *next_interface;
previous_interface = next_interface = acpi_gbl_supported_interfaces;
while (next_interface) {
if (!ACPI_STRCMP(interface_name, next_interface->name)) {
/* Found: name is in either the static list or was added at runtime */
if (next_interface->flags & ACPI_OSI_DYNAMIC) {
/* Interface was added dynamically, remove and free it */
if (previous_interface == next_interface) {
acpi_gbl_supported_interfaces =
next_interface->next;
} else {
previous_interface->next =
next_interface->next;
}
ACPI_FREE(next_interface->name);
ACPI_FREE(next_interface);
} else {
/*
* Interface is in static list. If marked invalid, then it
* does not actually exist. Else, mark it invalid.
*/
if (next_interface->flags & ACPI_OSI_INVALID) {
return (AE_NOT_EXIST);
}
next_interface->flags |= ACPI_OSI_INVALID;
}
return (AE_OK);
}
previous_interface = next_interface;
next_interface = next_interface->next;
}
/* Interface was not found */
return (AE_NOT_EXIST);
}
开发者ID:bjayesh,项目名称:chandra,代码行数:48,代码来源:utosi.c
示例3: AcpiAhMatchHardwareId
const AH_DEVICE_ID *
AcpiAhMatchHardwareId (
char *HardwareId)
{
const AH_DEVICE_ID *Info;
for (Info = AslDeviceIds; Info->Name; Info++)
{
if (!ACPI_STRCMP (HardwareId, Info->Name))
{
return (Info);
}
}
return (NULL);
}
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:17,代码来源:ahids.c
示例4: acpi_ut_remove_interface
acpi_status acpi_ut_remove_interface(acpi_string interface_name)
{
struct acpi_interface_info *previous_interface;
struct acpi_interface_info *next_interface;
previous_interface = next_interface = acpi_gbl_supported_interfaces;
while (next_interface) {
if (!ACPI_STRCMP(interface_name, next_interface->name)) {
if (next_interface->flags & ACPI_OSI_DYNAMIC) {
if (previous_interface == next_interface) {
acpi_gbl_supported_interfaces =
next_interface->next;
} else {
previous_interface->next =
next_interface->next;
}
ACPI_FREE(next_interface->name);
ACPI_FREE(next_interface);
} else {
if (next_interface->flags & ACPI_OSI_INVALID) {
return (AE_NOT_EXIST);
}
next_interface->flags |= ACPI_OSI_INVALID;
}
return (AE_OK);
}
previous_interface = next_interface;
next_interface = next_interface->next;
}
return (AE_NOT_EXIST);
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:44,代码来源:utosi.c
示例5: AcpiUtGetInterface
ACPI_INTERFACE_INFO *
AcpiUtGetInterface (
ACPI_STRING InterfaceName)
{
ACPI_INTERFACE_INFO *NextInterface;
NextInterface = AcpiGbl_SupportedInterfaces;
while (NextInterface)
{
if (!ACPI_STRCMP (InterfaceName, NextInterface->Name))
{
return (NextInterface);
}
NextInterface = NextInterface->Next;
}
return (NULL);
}
开发者ID:alexandermerritt,项目名称:dragonfly,代码行数:20,代码来源:utosi.c
示例6: acpi_ut_osi_implementation
acpi_status
acpi_ut_osi_implementation (
struct acpi_walk_state *walk_state)
{
union acpi_operand_object *string_desc;
union acpi_operand_object *return_desc;
acpi_native_uint i;
ACPI_FUNCTION_TRACE ("ut_osi_implementation");
/* Validate the string input argument */
string_desc = walk_state->arguments[0].object;
if (!string_desc || (string_desc->common.type != ACPI_TYPE_STRING)) {
return_ACPI_STATUS (AE_TYPE);
}
/* Create a return object (Default value = 0) */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Compare input string to table of supported strings */
for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) {
if (!ACPI_STRCMP (string_desc->string.pointer,
(char *) acpi_gbl_valid_osi_strings[i])) {
/* This string is supported */
return_desc->integer.value = 0xFFFFFFFF;
break;
}
}
walk_state->return_desc = return_desc;
return_ACPI_STATUS (AE_CTRL_TERMINATE);
}
开发者ID:GodFox,项目名称:magx_kernel_xpixl,代码行数:41,代码来源:uteval.c
示例7: AcpiDbDisplayResources
void
AcpiDbDisplayResources (
char *ObjectArg)
{
ACPI_NAMESPACE_NODE *Node;
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiDbgLevel |= ACPI_LV_RESOURCES;
/* Asterisk means "display resources for all devices" */
if (!ACPI_STRCMP (ObjectArg, "*"))
{
(void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, AcpiDbDeviceResources, NULL, NULL, NULL);
}
else
{
/* Convert string to object pointer */
Node = AcpiDbConvertToNode (ObjectArg);
if (Node)
{
if (Node->Type != ACPI_TYPE_DEVICE)
{
AcpiOsPrintf ("%4.4s: Name is not a device object (%s)\n",
Node->Name.Ascii, AcpiUtGetTypeName (Node->Type));
}
else
{
(void) AcpiDbDeviceResources (Node, 0, NULL, NULL);
}
}
}
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
开发者ID:dmarion,项目名称:freebsd-armv6-sys,代码行数:38,代码来源:dbcmds.c
示例8: DtTrim
static char *
DtTrim (
char *String)
{
char *Start;
char *End;
char *ReturnString;
ACPI_SIZE Length;
/* Skip lines that start with a space */
if (!ACPI_STRCMP (String, " "))
{
ReturnString = UtLocalCalloc (1);
return (ReturnString);
}
/* Setup pointers to start and end of input string */
Start = String;
End = String + ACPI_STRLEN (String) - 1;
/* Find first non-whitespace character */
while ((Start <= End) && ((*Start == ' ') || (*Start == '\t')))
{
Start++;
}
/* Find last non-space character */
while (End >= Start)
{
if (*End == '\r' || *End == '\n')
{
End--;
continue;
}
if (*End != ' ')
{
break;
}
End--;
}
/* Remove any quotes around the string */
if (*Start == '\"')
{
Start++;
}
if (*End == '\"')
{
End--;
}
/* Create the trimmed return string */
Length = ACPI_PTR_DIFF (End, Start) + 1;
ReturnString = UtLocalCalloc (Length + 1);
if (ACPI_STRLEN (Start))
{
ACPI_STRNCPY (ReturnString, Start, Length);
}
ReturnString[Length] = 0;
return (ReturnString);
}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:71,代码来源:dtio.c
示例9: AcpiUtDumpAllocations
void
AcpiUtDumpAllocations (
UINT32 Component,
const char *Module)
{
ACPI_DEBUG_MEM_BLOCK *Element;
ACPI_DESCRIPTOR *Descriptor;
UINT32 NumOutstanding = 0;
UINT8 DescriptorType;
ACPI_FUNCTION_TRACE (UtDumpAllocations);
/*
* Walk the allocation list.
*/
if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY)))
{
return;
}
Element = AcpiGbl_GlobalList->ListHead;
while (Element)
{
if ((Element->Component & Component) &&
((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
{
Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace);
if (Element->Size < sizeof (ACPI_COMMON_DESCRIPTOR))
{
AcpiOsPrintf ("%p Length 0x%04X %9.9s-%d "
"[Not a Descriptor - too small]\n",
Descriptor, Element->Size, Element->Module,
Element->Line);
}
else
{
/* Ignore allocated objects that are in a cache */
if (ACPI_GET_DESCRIPTOR_TYPE (Descriptor) != ACPI_DESC_TYPE_CACHED)
{
AcpiOsPrintf ("%p Length 0x%04X %9.9s-%d [%s] ",
Descriptor, Element->Size, Element->Module,
Element->Line, AcpiUtGetDescriptorName (Descriptor));
/* Validate the descriptor type using Type field and length */
DescriptorType = 0; /* Not a valid descriptor type */
switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
{
case ACPI_DESC_TYPE_OPERAND:
if (Element->Size == sizeof (ACPI_DESC_TYPE_OPERAND))
{
DescriptorType = ACPI_DESC_TYPE_OPERAND;
}
break;
case ACPI_DESC_TYPE_PARSER:
if (Element->Size == sizeof (ACPI_DESC_TYPE_PARSER))
{
DescriptorType = ACPI_DESC_TYPE_PARSER;
}
break;
case ACPI_DESC_TYPE_NAMED:
if (Element->Size == sizeof (ACPI_DESC_TYPE_NAMED))
{
DescriptorType = ACPI_DESC_TYPE_NAMED;
}
break;
default:
break;
}
/* Display additional info for the major descriptor types */
switch (DescriptorType)
{
case ACPI_DESC_TYPE_OPERAND:
AcpiOsPrintf ("%12.12s RefCount 0x%04X\n",
AcpiUtGetTypeName (Descriptor->Object.Common.Type),
Descriptor->Object.Common.ReferenceCount);
break;
case ACPI_DESC_TYPE_PARSER:
AcpiOsPrintf ("AmlOpcode 0x%04hX\n",
Descriptor->Op.Asl.AmlOpcode);
break;
case ACPI_DESC_TYPE_NAMED:
AcpiOsPrintf ("%4.4s\n",
AcpiUtGetNodeName (&Descriptor->Node));
break;
default:
AcpiOsPrintf ( "\n");
//.........这里部分代码省略.........
开发者ID:luciang,项目名称:haiku,代码行数:101,代码来源:uttrack.c
示例10: acpi_ns_root_initialize
/*******************************************************************************
*
* FUNCTION: acpi_ns_root_initialize
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Allocate and initialize the default root named objects
*
* MUTEX: Locks namespace for entire execution
*
******************************************************************************/
acpi_status acpi_ns_root_initialize(void)
{
acpi_status status;
const struct acpi_predefined_names *init_val = NULL;
struct acpi_namespace_node *new_node;
union acpi_operand_object *obj_desc;
acpi_string val = NULL;
ACPI_FUNCTION_TRACE(ns_root_initialize);
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* The global root ptr is initially NULL, so a non-NULL value indicates
* that acpi_ns_root_initialize() has already been called; just return.
*/
if (acpi_gbl_root_node) {
status = AE_OK;
goto unlock_and_exit;
}
/*
* Tell the rest of the subsystem that the root is initialized
* (This is OK because the namespace is locked)
*/
acpi_gbl_root_node = &acpi_gbl_root_node_struct;
/* Enter the pre-defined names in the name table */
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Entering predefined entries into namespace\n"));
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
/* _OSI is optional for now, will be permanent later */
if (!ACPI_STRCMP(init_val->name, "_OSI")
&& !acpi_gbl_create_osi_method) {
continue;
}
status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
ACPI_IMODE_LOAD_PASS2,
ACPI_NS_NO_UPSEARCH, NULL, &new_node);
if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */
ACPI_EXCEPTION((AE_INFO, status,
"Could not create predefined name %s",
init_val->name));
}
/*
* Name entered successfully.
* If entry in pre_defined_names[] specifies an
* initial value, create the initial value.
*/
if (init_val->val) {
status = acpi_os_predefined_override(init_val, &val);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO,
"Could not override predefined %s",
init_val->name));
}
if (!val) {
val = init_val->val;
}
/*
* Entry requests an initial value, allocate a
* descriptor for it.
*/
obj_desc =
acpi_ut_create_internal_object(init_val->type);
if (!obj_desc) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
}
/*
* Convert value string from table entry to
* internal representation. Only types actually
* used for initial values are implemented here.
*/
//.........这里部分代码省略.........
开发者ID:10x-Amin,项目名称:x10_Th_kernel,代码行数:101,代码来源:nsaccess.c
示例11: AcpiDmCreateNewExternal
static ACPI_STATUS
AcpiDmCreateNewExternal (
char *ExternalPath,
char *InternalPath,
UINT8 Type,
UINT32 Value,
UINT16 Flags)
{
ACPI_EXTERNAL_LIST *NewExternal;
ACPI_EXTERNAL_LIST *NextExternal;
ACPI_EXTERNAL_LIST *PrevExternal = NULL;
ACPI_FUNCTION_TRACE (DmCreateNewExternal);
/* Check all existing externals to ensure no duplicates */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
{
/* Duplicate method, check that the Value (ArgCount) is the same */
if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
(NextExternal->Value != Value) &&
(Value > 0))
{
ACPI_ERROR ((AE_INFO,
"External method arg count mismatch %s: Current %u, attempted %u",
NextExternal->Path, NextExternal->Value, Value));
}
/* Allow upgrade of type from ANY */
else if (NextExternal->Type == ACPI_TYPE_ANY)
{
NextExternal->Type = Type;
NextExternal->Value = Value;
}
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
NextExternal = NextExternal->Next;
}
/* Allocate and init a new External() descriptor */
NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
if (!NewExternal)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Adding external reference node (%s) type [%s]\n",
ExternalPath, AcpiUtGetTypeName (Type)));
NewExternal->Flags = Flags;
NewExternal->Value = Value;
NewExternal->Path = ExternalPath;
NewExternal->Type = Type;
NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
NewExternal->InternalPath = InternalPath;
/* Link the new descriptor into the global list, alphabetically ordered */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0)
{
if (PrevExternal)
{
PrevExternal->Next = NewExternal;
}
else
{
AcpiGbl_ExternalList = NewExternal;
}
NewExternal->Next = NextExternal;
return_ACPI_STATUS (AE_OK);
}
PrevExternal = NextExternal;
NextExternal = NextExternal->Next;
}
if (PrevExternal)
{
PrevExternal->Next = NewExternal;
}
else
{
AcpiGbl_ExternalList = NewExternal;
}
//.........这里部分代码省略.........
开发者ID:99corps,项目名称:runtime,代码行数:101,代码来源:dmextern.c
示例12: DtCompileIvrs
ACPI_STATUS
DtCompileIvrs (
void **List)
{
ACPI_STATUS Status;
DT_SUBTABLE *Subtable;
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *SubtableStart;
ACPI_DMTABLE_INFO *InfoTable;
ACPI_IVRS_HEADER *IvrsHeader;
UINT8 EntryType;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrs,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
while (*PFieldList)
{
SubtableStart = *PFieldList;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIvrsHdr,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
DtPushSubtable (Subtable);
IvrsHeader = ACPI_CAST_PTR (ACPI_IVRS_HEADER, Subtable->Buffer);
switch (IvrsHeader->Type)
{
case ACPI_IVRS_TYPE_HARDWARE:
InfoTable = AcpiDmTableInfoIvrs0;
break;
case ACPI_IVRS_TYPE_MEMORY1:
case ACPI_IVRS_TYPE_MEMORY2:
case ACPI_IVRS_TYPE_MEMORY3:
InfoTable = AcpiDmTableInfoIvrs1;
break;
default:
DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IVRS");
return (AE_ERROR);
}
Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE)
{
while (*PFieldList &&
!ACPI_STRCMP ((*PFieldList)->Name, "Entry Type"))
{
SubtableStart = *PFieldList;
DtCompileInteger (&EntryType, *PFieldList, 1, 0);
switch (EntryType)
{
/* 4-byte device entries */
case ACPI_IVRS_TYPE_PAD4:
case ACPI_IVRS_TYPE_ALL:
case ACPI_IVRS_TYPE_SELECT:
case ACPI_IVRS_TYPE_START:
case ACPI_IVRS_TYPE_END:
InfoTable = AcpiDmTableInfoIvrs4;
break;
/* 8-byte entries, type A */
case ACPI_IVRS_TYPE_ALIAS_SELECT:
case ACPI_IVRS_TYPE_ALIAS_START:
InfoTable = AcpiDmTableInfoIvrs8a;
break;
/* 8-byte entries, type B */
case ACPI_IVRS_TYPE_PAD8:
case ACPI_IVRS_TYPE_EXT_SELECT:
case ACPI_IVRS_TYPE_EXT_START:
//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,代码来源:dttable.c
示例13: AnMethodAnalysisWalkBegin
//.........这里部分代码省略.........
}
break;
case PARSEOP_BREAK:
case PARSEOP_CONTINUE:
Next = Op->Asl.Parent;
while (Next)
{
if (Next->Asl.ParseOpcode == PARSEOP_WHILE)
{
break;
}
Next = Next->Asl.Parent;
}
if (!Next)
{
AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL);
}
break;
case PARSEOP_STALL:
/* We can range check if the argument is an integer */
if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
(Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL);
}
break;
case PARSEOP_DEVICE:
case PARSEOP_EVENT:
case PARSEOP_MUTEX:
case PARSEOP_OPERATIONREGION:
case PARSEOP_POWERRESOURCE:
case PARSEOP_PROCESSOR:
case PARSEOP_THERMALZONE:
/*
* The first operand is a name to be created in the namespace.
* Check against the reserved list.
*/
i = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
if (i < ACPI_VALID_RESERVED_NAME_MAX)
{
AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName);
}
break;
case PARSEOP_NAME:
/* Typecheck any predefined names statically defined with Name() */
ApCheckForPredefinedObject (Op, Op->Asl.NameSeg);
/* Special typechecking for _HID */
if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;
AnCheckId (Next, ASL_TYPE_HID);
}
/* Special typechecking for _CID */
else if (!ACPI_STRCMP (METHOD_NAME__CID, Op->Asl.NameSeg))
{
Next = Op->Asl.Child->Asl.Next;
if ((Next->Asl.ParseOpcode == PARSEOP_PACKAGE) ||
(Next->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE))
{
Next = Next->Asl.Child;
while (Next)
{
AnCheckId (Next, ASL_TYPE_CID);
Next = Next->Asl.Next;
}
}
else
{
AnCheckId (Next, ASL_TYPE_CID);
}
}
break;
default:
break;
}
return (AE_OK);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:101,代码来源:aslwalks.c
示例14: acpi_ns_root_initialize
acpi_status acpi_ns_root_initialize(void)
{
acpi_status status;
const struct acpi_predefined_names *init_val = NULL;
struct acpi_namespace_node *new_node;
union acpi_operand_object *obj_desc;
acpi_string val = NULL;
ACPI_FUNCTION_TRACE(ns_root_initialize);
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
if (acpi_gbl_root_node) {
status = AE_OK;
goto unlock_and_exit;
}
acpi_gbl_root_node = &acpi_gbl_root_node_struct;
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Entering predefined entries into namespace\n"));
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
if (!ACPI_STRCMP(init_val->name, "_OSI")
&& !acpi_gbl_create_osi_method) {
continue;
}
status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
ACPI_IMODE_LOAD_PASS2,
ACPI_NS_NO_UPSEARCH, NULL, &new_node);
if (ACPI_FAILURE(status) || (!new_node)) {
ACPI_EXCEPTION((AE_INFO, status,
"Could not create predefined name %s",
init_val->name));
}
if (init_val->val) {
status = acpi_os_predefined_override(init_val, &val);
if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO,
"Could not override predefined %s",
init_val->name));
}
if (!val) {
val = init_val->val;
}
obj_desc =
acpi_ut_create_internal_object(init_val->type);
if (!obj_desc) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
}
switch (init_val->type) {
case ACPI_TYPE_METHOD:
obj_desc->method.param_count =
(u8) ACPI_TO_INTEGER(val);
obj_desc->common.flags |= AOPOBJ_DATA_VALID;
#if defined (ACPI_ASL_COMPILER)
new_node->value = obj_desc->method.param_count;
#else
obj_desc->method.info_flags =
ACPI_METHOD_INTERNAL_ONLY;
obj_desc->method.dispatch.implementation =
acpi_ut_osi_implementation;
#endif
break;
case ACPI_TYPE_INTEGER:
obj_desc->integer.value = ACPI_TO_INTEGER(val);
break;
case ACPI_TYPE_STRING:
obj_desc->string.length =
(u32) ACPI_STRLEN(val);
obj_desc->string.pointer = val;
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
//.........这里部分代码省略.........
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:101,代码来源:nsaccess.c
示例15: AcpiDbTestStringType
static ACPI_STATUS
AcpiDbTestStringType (
ACPI_NAMESPACE_NODE *Node,
UINT32 ByteLength)
{
ACPI_OBJECT *Temp1 = NULL;
ACPI_OBJECT *Temp2 = NULL;
ACPI_OBJECT *Temp3 = NULL;
char *ValueToWrite = "Test String from AML Debugger";
ACPI_OBJECT WriteValue;
ACPI_STATUS Status;
/* Read the original value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp1);
if (ACPI_FAILURE (Status))
{
return (Status);
}
AcpiOsPrintf (" (%4.4X/%3.3X) \"%s\"", (Temp1->String.Length * 8),
Temp1->String.Length, Temp1->String.Pointer);
/* Write a new value */
WriteValue.Type = ACPI_TYPE_STRING;
WriteValue.String.Length = ACPI_STRLEN (ValueToWrite);
WriteValue.String.Pointer = ValueToWrite;
Status = AcpiDbWriteToObject (Node, &WriteValue);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Ensure that we can read back the new value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp2);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
if (ACPI_STRCMP (Temp2->String.Pointer, ValueToWrite))
{
AcpiOsPrintf (" MISMATCH 2: %s, expecting %s",
Temp2->String.Pointer, ValueToWrite);
}
/* Write back the original value */
WriteValue.String.Length = ACPI_STRLEN (Temp1->String.Pointer);
WriteValue.String.Pointer = Temp1->String.Pointer;
Status = AcpiDbWriteToObject (Node, &WriteValue);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
/* Ensure that we can read back the original value */
Status = AcpiDbReadFromObject (Node, ACPI_TYPE_STRING, &Temp3);
if (ACPI_FAILURE (Status))
{
goto Exit;
}
if (ACPI_STRCMP (Temp1->String.Pointer, Temp3->String.Pointer))
{
AcpiOsPrintf (" MISMATCH 3: %s, expecting %s",
Temp3->String.Pointer, Temp1->String.Pointer);
}
Exit:
if (Temp1) {AcpiOsFree (Temp1);}
if (Temp2) {AcpiOsFree (Temp2);}
if (Temp3) {AcpiOsFree (Temp3);}
return (Status);
}
开发者ID:99corps,项目名称:runtime,代码行数:81,代码来源:dbtest.c
示例16: AcpiGetopt
int
AcpiGetopt(
int argc,
char **argv,
char *opts)
{
int CurrentChar;
char *OptsPtr;
if (CurrentCharPtr == 1)
{
if (AcpiGbl_Optind >= argc ||
argv[AcpiGbl_Optind][0] != '-' ||
argv[AcpiGbl_Optind][1] == '\0')
{
return (ACPI_OPT_END);
}
else if (ACPI_STRCMP (argv[AcpiGbl_Optind], "--") == 0)
{
AcpiGbl_Optind++;
return (ACPI_OPT_END);
}
}
/* Get the option */
CurrentChar = argv[AcpiGbl_Optind][CurrentCharPtr];
/* Make sure that the option is legal */
if (CurrentChar == ':' ||
(OptsPtr = ACPI_STRCHR (opts, CurrentChar)) == NULL)
{
ACPI_OPTION_ERROR ("Illegal option: -", CurrentChar);
if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0')
{
AcpiGbl_Optind++;
CurrentCharPtr = 1;
}
return ('?');
}
/* Option requires an argument? */
if (*++OptsPtr == ':')
{
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)];
}
else if (++AcpiGbl_Optind >= argc)
{
ACPI_OPTION_ERROR ("Option requires an argument: -", CurrentChar);
CurrentCharPtr = 1;
return ('?');
}
else
{
AcpiGbl_Optarg = argv[AcpiGbl_Optind++];
}
CurrentCharPtr = 1;
}
/* Option has an optional argument? */
else if (*OptsPtr == '+')
{
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][(int) (CurrentCharPtr+1)];
}
else if (++AcpiGbl_Optind >= argc)
{
AcpiGbl_Optarg = NULL;
}
else
{
AcpiGbl_Optarg = argv[AcpiGbl_Optind++];
}
CurrentCharPtr = 1;
}
/* Option has optional single-char arguments? */
else if (*OptsPtr == '^')
{
if (argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)] != '\0')
{
AcpiGbl_Optarg = &argv[AcpiGbl_Optind][(int) (CurrentCharPtr+1)];
}
else
{
AcpiGbl_Optarg = "^";
}
//.........这里部分代码省略.........
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:101,代码来源:getopt.c
示例17: AcpiNsGetDeviceCallback
static ACPI_STATUS
AcpiNsGetDeviceCallback (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
ACPI_GET_DEVICES_INFO *Info = Context;
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
UINT32 Flags;
ACPI_DEVICE_ID *Hid;
ACPI_DEVICE_ID_LIST *Cid;
UINT32 i;
BOOLEAN Found;
int NoMatch;
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
Node = AcpiNsValidateHandle (ObjHandle);
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
return (Status);
}
if (!Node)
{
return (AE_BAD_PARAMETER);
}
/* Run _STA to determine if device is present */
Status = AcpiUtExecute_STA (Node, &Flags);
if (ACPI_FAILURE (Status))
{
return (AE_CTRL_DEPTH);
}
if (!(Flags & ACPI_STA_DEVICE_PRESENT) &&
!(Flags & ACPI_STA_DEVICE_FUNCTIONING))
{
/*
* Don't examine the children of the device only when the
* device is neither present nor functional. See ACPI spec,
* description of _STA for more information.
*/
return (AE_CTRL_DEPTH);
}
/* Filter based on device HID & CID */
if (Info->Hid != NULL)
{
Status = AcpiUtExecute_HID (Node, &Hid);
if (Status == AE_NOT_FOUND)
{
return (AE_OK);
}
else if (ACPI_FAILURE (Status))
{
return (AE_CTRL_DEPTH);
}
NoMatch = ACPI_STRCMP (Hid->String, Info->Hid);
ACPI_FREE (Hid);
if (NoMatch)
{
/*
* HID does not match, attempt match within the
* list of Compatible IDs (CIDs)
*/
Status = AcpiUtExecute_CID (Node, &Cid);
if (Status == AE_NOT_FOUND)
{
return (AE_OK);
}
else if (ACPI_FAILURE (Status))
{
return (AE_CTRL_DEPTH);
}
/* Walk the CID list */
Found = FALSE;
for (i = 0; i < Cid->Count; i++)
{
if (ACPI_STRCMP (Cid->Ids[i].String, Info->Hid) == 0)
{
/* Found a matching CID */
Found = TRUE;
break;
}
//.........这里部分代码省略.........
开发者ID:ExpressOS,项目名称:third_party-l4re,代码行数:101,代码来源:nsxfeval.c
示例18: AcpiDmAddToExternalList
void
AcpiDmAddToExternalList (
ACPI_PARSE_OBJECT *Op,
char *Path,
UINT8 Type,
UINT32 Value)
{
char *ExternalPath;
char *Fullpath = NULL;
ACPI_EXTERNAL_LIST *NewExternal;
ACPI_EXTERNAL_LIST *NextExternal;
ACPI_EXTERNAL_LIST *PrevExternal = NULL;
ACPI_STATUS Status;
BOOLEAN Resolved = FALSE;
if (!Path)
{
return;
}
if (Type == ACPI_TYPE_METHOD)
{
if (Value & 0x80)
{
Resolved = TRUE;
}
Value &= 0x07;
}
/*
* We don't want External() statements to contain a leading '\'.
* This prevents duplicate external statements of the form:
*
* External (\ABCD)
* External (ABCD)
*
* This would cause a compile time error when the disassembled
* output file is recompiled.
*/
if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
{
Path++;
}
/* Externalize the ACPI pathname */
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
NULL, &ExternalPath);
if (ACPI_FAILURE (Status))
{
return;
}
/*
* Get the full pathname from the root if "Path" has one or more
* parent prefixes (^). Note: path will not contain a leading '\'.
*/
if (*Path == (UINT8) AML_PARENT_PREFIX)
{
Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath);
if (Fullpath)
{
/* Set new external path */
ACPI_FREE (ExternalPath);
ExternalPath = Fullpath;
}
}
/* Check all existing externals to ensure no duplicates */
NextExternal = AcpiGbl_ExternalList;
while (NextExternal)
{
if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
{
/* Duplicate method, check that the Value (ArgCount) is the same */
if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
(NextExternal->Value != Value))
{
ACPI_ERROR ((AE_INFO,
"External method arg count mismatch %s: Current %u, attempted %u",
NextExternal->Path, NextExternal->Value, Value));
}
/* Allow upgrade of type from ANY */
else if (NextExternal->Type == ACPI_TYPE_ANY)
{
NextExternal->Type = Type;
NextExternal->Value = Value;
}
ACPI_FREE (ExternalPath);
return;
}
NextExternal = NextExternal->Next;
//.........这里部分代码省略.........
开发者ID:DonCN,项目名称:haiku,代码行数:101,代码来源:dmextern.c
示例19: DtCreateTemplates
ACPI_STATUS
DtCreateTemplates (
char *Signature)
{
ACPI_DMTABLE_DATA *TableData;
ACPI_STATUS Status;
AslInitializeGlobals ();
/* Default (no signature) is DSDT */
if (!Signature)
{
Signature = "DSDT";
goto GetTemplate;
}
AcpiUtStrupr (Signature);
if (!ACPI_STRCMP (Signature, "ALL") ||
!ACPI_STRCMP (Signature, "*"))
{
/* Create all available/known templates */
Status = DtCreateAllTemplates ();
return (Status);
}
/*
* Validate signature and get the template data:
* 1) Signature must be 4 characters
* 2) Signature must be a recognized ACPI table
* 3) There must be a template associated with the signature
*/
if (strlen (Signature) != ACPI_NAME_SIZE)
{
fprintf (stderr,
"%s: Invalid ACPI table signature (length must be 4 characters)\n",
Signature);
return (AE_ERROR);
}
/*
* Some slack for the two strange tables whose name is different than
* their signatures: MADT->APIC and FADT->FACP.
*/
if (!strcmp (Signature, "MADT"))
{
Signature = "APIC";
}
else if (!strcmp (Signature, "FADT"))
{
Signature = "FACP";
}
GetTemplate:
TableData = AcpiDmGetTableData (Signature);
if (TableData)
{
if (!TableData->Template)
{
fprintf (stderr, "%4.4s: No template available\n", Signature);
return (AE_ERROR);
}
}
else if (!AcpiUtIsSpecialTable (Signature))
{
fprintf (stderr,
"%4.4s: Unrecognized ACPI table signature\n", Signature);
return (AE_ERROR);
}
Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return (Status);
}
Status = DtCreateOneTemplate (Signature, TableData);
return (Status);
}
开发者ID:99corps,项目名称:runtime,代码行数:81,代码来源:dttemplate.c
示例20: DtCompileInteger
void
DtCompileInteger (
UINT8 *Buffer,
DT_FIELD *Field,
UINT32 ByteLength,
UINT8 Flags)
{
UINT64 Value;
UINT64 MaxValue;
ACPI_STATUS Status;
/* Output buffer byte length must be in range 1-8 */
|
请发表评论