这篇教程C++ ACPI_SUCCESS函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ACPI_SUCCESS函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_SUCCESS函数的具体用法?C++ ACPI_SUCCESS怎么用?C++ ACPI_SUCCESS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ACPI_SUCCESS函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: EcGpeQueryHandlerstatic voidEcGpeQueryHandler(void *Context){ struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; int retry, sci_enqueued; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL")); /* Serialize user access with EcSpaceHandler(). */ Status = EcLock(sc); if (ACPI_FAILURE(Status)) { device_printf(sc->ec_dev, "GpeQuery lock error: %s/n", AcpiFormatException(Status)); return; } /* * Send a query command to the EC to find out which _Qxx call it * wants to make. This command clears the SCI bit and also the * interrupt source since we are edge-triggered. To prevent the GPE * that may arise from running the query from causing another query * to be queued, we clear the pending flag only after running it. */ sci_enqueued = sc->ec_sci_pend; for (retry = 0; retry < 2; retry++) { Status = EcCommand(sc, EC_COMMAND_QUERY); if (ACPI_SUCCESS(Status)) break; if (ACPI_SUCCESS(EcCheckStatus(sc, "retr_check", EC_EVENT_INPUT_BUFFER_EMPTY))) continue; else break; } sc->ec_sci_pend = FALSE; if (ACPI_FAILURE(Status)) { EcUnlock(sc); device_printf(sc->ec_dev, "GPE query failed: %s/n", AcpiFormatException(Status)); return; } Data = EC_GET_DATA(sc); /* * We have to unlock before running the _Qxx method below since that * method may attempt to read/write from EC address space, causing * recursive acquisition of the lock. */ EcUnlock(sc); /* Ignore the value for "no outstanding event". (13.3.5) */ CTR2(KTR_ACPI, "ec query ok,%s running _Q%02X", Data ? "" : " not", Data); if (Data == 0) return; /* Evaluate _Qxx to respond to the controller. */ snprintf(qxx, sizeof(qxx), "_Q%02X", Data); AcpiUtStrupr(qxx); Status = AcpiEvaluateObject(sc->ec_handle, qxx, NULL, NULL); if (ACPI_FAILURE(Status) && Status != AE_NOT_FOUND) { device_printf(sc->ec_dev, "evaluation of query method %s failed: %s/n", qxx, AcpiFormatException(Status)); } /* Reenable runtime GPE if its execution was deferred. */ if (sci_enqueued) { Status = AcpiFinishGpe(sc->ec_gpehandle, sc->ec_gpebit); if (ACPI_FAILURE(Status)) device_printf(sc->ec_dev, "reenabling runtime GPE failed: %s/n", AcpiFormatException(Status)); }}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:76,
示例2: acpi_dev_pm_get_state/** * acpi_dev_pm_get_state - Get preferred power state of ACPI device. * @dev: Device whose preferred target power state to return. * @adev: ACPI device node corresponding to @dev. * @target_state: System state to match the resultant device state. * @d_min_p: Location to store the highest power state available to the device. * @d_max_p: Location to store the lowest power state available to the device. * * Find the lowest power (highest number) and highest power (lowest number) ACPI * device power states that the device can be in while the system is in the * state represented by @target_state. Store the integer numbers representing * those stats in the memory locations pointed to by @d_max_p and @d_min_p, * respectively. * * Callers must ensure that @dev and @adev are valid pointers and that @adev * actually corresponds to @dev before using this function. * * Returns 0 on success or -ENODATA when one of the ACPI methods fails or * returns a value that doesn't make sense. The memory locations pointed to by * @d_max_p and @d_min_p are only modified on success. */static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev, u32 target_state, int *d_min_p, int *d_max_p){ char method[] = { '_', 'S', '0' + target_state, 'D', '/0' }; acpi_handle handle = adev->handle; unsigned long long ret; int d_min, d_max; bool wakeup = false; acpi_status status; /* * If the system state is S0, the lowest power state the device can be * in is D3cold, unless the device has _S0W and is supposed to signal * wakeup, in which case the return value of _S0W has to be used as the * lowest power state available to the device. */ d_min = ACPI_STATE_D0; d_max = ACPI_STATE_D3_COLD; /* * If present, _SxD methods return the minimum D-state (highest power * state) we can use for the corresponding S-states. Otherwise, the * minimum D-state is D0 (ACPI 3.x). */ if (target_state > ACPI_STATE_S0) { /* * We rely on acpi_evaluate_integer() not clobbering the integer * provided if AE_NOT_FOUND is returned. */ ret = d_min; status = acpi_evaluate_integer(handle, method, NULL, &ret); if ((ACPI_FAILURE(status) && status != AE_NOT_FOUND) || ret > ACPI_STATE_D3_COLD) return -ENODATA; /* * We need to handle legacy systems where D3hot and D3cold are * the same and 3 is returned in both cases, so fall back to * D3cold if D3hot is not a valid state. */ if (!adev->power.states[ret].flags.valid) { if (ret == ACPI_STATE_D3_HOT) ret = ACPI_STATE_D3_COLD; else return -ENODATA; } d_min = ret; wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid && adev->wakeup.sleep_state >= target_state; } else if (dev_pm_qos_flags(dev, PM_QOS_FLAG_REMOTE_WAKEUP) != PM_QOS_FLAGS_NONE) { wakeup = adev->wakeup.flags.valid; } /* * If _PRW says we can wake up the system from the target sleep state, * the D-state returned by _SxD is sufficient for that (we assume a * wakeup-aware driver if wake is set). Still, if _SxW exists * (ACPI 3.x), it should return the maximum (lowest power) D-state that * can wake the system. _S0W may be valid, too. */ if (wakeup) { method[3] = 'W'; status = acpi_evaluate_integer(handle, method, NULL, &ret); if (status == AE_NOT_FOUND) { if (target_state > ACPI_STATE_S0) d_max = d_min; } else if (ACPI_SUCCESS(status) && ret <= ACPI_STATE_D3_COLD) { /* Fall back to D3cold if ret is not a valid state. */ if (!adev->power.states[ret].flags.valid) ret = ACPI_STATE_D3_COLD; d_max = ret > d_min ? ret : d_min; } else { return -ENODATA; } } if (d_min_p)//.........这里部分代码省略.........
开发者ID:lihp1603,项目名称:firefly-3.14-kernel,代码行数:101,
示例3: acpi_thermal_cooling_device_cbstatic int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, struct thermal_cooling_device *cdev, bool bind){ struct acpi_device *device = cdev->devdata; struct acpi_thermal *tz = thermal->devdata; struct acpi_device *dev; acpi_status status; acpi_handle handle; int i; int j; int trip = -1; int result = 0; if (tz->trips.critical.flags.valid) trip++; if (tz->trips.hot.flags.valid) trip++; if (tz->trips.passive.flags.valid) { trip++; for (i = 0; i < tz->trips.passive.devices.count; i++) { handle = tz->trips.passive.devices.handles[i]; status = acpi_bus_get_device(handle, &dev); if (ACPI_FAILURE(status) || dev != device) continue; if (bind) result = thermal_zone_bind_cooling_device (thermal, trip, cdev, THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); else result = thermal_zone_unbind_cooling_device (thermal, trip, cdev); if (result) goto failed; } } for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { if (!tz->trips.active[i].flags.valid) break; trip++; for (j = 0; j < tz->trips.active[i].devices.count; j++) { handle = tz->trips.active[i].devices.handles[j]; status = acpi_bus_get_device(handle, &dev); if (ACPI_FAILURE(status) || dev != device) continue; if (bind) result = thermal_zone_bind_cooling_device (thermal, trip, cdev, THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); else result = thermal_zone_unbind_cooling_device (thermal, trip, cdev); if (result) goto failed; } } for (i = 0; i < tz->devices.count; i++) { handle = tz->devices.handles[i]; status = acpi_bus_get_device(handle, &dev); if (ACPI_SUCCESS(status) && (dev == device)) { if (bind) result = thermal_zone_bind_cooling_device (thermal, -1, cdev, THERMAL_NO_LIMIT, THERMAL_NO_LIMIT); else result = thermal_zone_unbind_cooling_device (thermal, -1, cdev); if (result) goto failed; } }failed: return result;}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:85,
示例4: AcpiPsGetNextNamepathvoidAcpiPsGetNextNamepath ( ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Arg, UINT32 *ArgCount, BOOLEAN MethodCall){ NATIVE_CHAR *Path; ACPI_PARSE_OBJECT *NameOp; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *MethodNode = NULL; ACPI_NAMESPACE_NODE *Node; ACPI_GENERIC_STATE ScopeInfo; FUNCTION_TRACE ("PsGetNextNamepath"); Path = AcpiPsGetNextNamestring (ParserState); if (!Path || !MethodCall) { /* Null name case, create a null namepath object */ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = Path; return_VOID; } if (MethodCall) { /* * Lookup the name in the internal namespace */ ScopeInfo.Scope.Node = NULL; Node = ParserState->StartNode; if (Node) { ScopeInfo.Scope.Node = Node; } /* * Lookup object. We don't want to add anything new to the namespace * here, however. So we use MODE_EXECUTE. Allow searching of the * parent tree, but don't open a new scope -- we just want to lookup the * object (MUST BE mode EXECUTE to perform upsearch) */ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, &Node); if (ACPI_SUCCESS (Status)) { if (Node->Type == ACPI_TYPE_METHOD) { MethodNode = Node; ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p/n", MethodNode, Path)); NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); if (NameOp) { /* Change arg into a METHOD CALL and attach name to it */ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); NameOp->Value.Name = Path; /* Point METHODCALL/NAME to the METHOD Node */ NameOp->Node = MethodNode; AcpiPsAppendArg (Arg, NameOp); if (!(ACPI_OPERAND_OBJECT *) MethodNode->Object) { return_VOID; } *ArgCount = ((ACPI_OPERAND_OBJECT *) MethodNode->Object)->Method.ParamCount; } return_VOID; } /* * Else this is normal named object reference. * Just init the NAMEPATH object with the pathname. * (See code below) */ } } /* * Either we didn't find the object in the namespace, or the object is * something other than a control method. Just initialize the Op with the * pathname. */ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = Path;//.........这里部分代码省略.........
开发者ID:MarginC,项目名称:kame,代码行数:101,
示例5: acpi_db_command_dispatch//.........这里部分代码省略......... acpi_db_generate_gpe(acpi_gbl_db_args[1], acpi_gbl_db_args[2]); break; case CMD_GPES: acpi_db_display_gpes(); break; case CMD_SCI: acpi_db_generate_sci(); break; case CMD_SLEEP: status = acpi_db_sleep(acpi_gbl_db_args[1]); break; /* File I/O commands. */ case CMD_CLOSE: acpi_db_close_debug_file(); break; case CMD_LOAD:{ struct acpi_new_table_desc *list_head = NULL; status = ac_get_all_tables_from_file(acpi_gbl_db_args[1], ACPI_GET_ALL_TABLES, &list_head); if (ACPI_SUCCESS(status)) { acpi_db_load_tables(list_head); } } break; case CMD_OPEN: acpi_db_open_debug_file(acpi_gbl_db_args[1]); break; /* User space commands. */ case CMD_TERMINATE: acpi_db_set_output_destination(ACPI_DB_REDIRECTABLE_OUTPUT); acpi_ut_subsystem_shutdown(); /* * TBD: [Restructure] Need some way to re-initialize without * re-creating the semaphores! */ acpi_gbl_db_terminate_loop = TRUE; /* acpi_initialize (NULL); */ break; case CMD_THREADS: acpi_db_create_execution_threads(acpi_gbl_db_args[1], acpi_gbl_db_args[2], acpi_gbl_db_args[3]); break;
开发者ID:faddat,项目名称:linux-mainline-next,代码行数:67,
示例6: AcpiDbCommandDispatch//.........这里部分代码省略......... break; case CMD_SLEEP: Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); break; case CMD_STATS: Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); break; case CMD_STOP: return (AE_NOT_IMPLEMENTED); case CMD_TABLES: AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); break; case CMD_TEMPLATE: AcpiDbDisplayTemplate (AcpiGbl_DbArgs[1]); break; case CMD_TERMINATE: AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); AcpiUtSubsystemShutdown (); /* * TBD: [Restructure] Need some way to re-initialize without * re-creating the semaphores! */ /* AcpiInitialize (NULL); */ break; case CMD_THREADS: AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]); break; case CMD_TRACE: (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); break; case CMD_TREE: AcpiDbDisplayCallingTree (); break; case CMD_TYPE: AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); break; case CMD_UNLOAD: AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1]); break; case CMD_EXIT: case CMD_QUIT: if (Op) { AcpiOsPrintf ("Method execution terminated/n"); return (AE_CTRL_TERMINATE); } if (!AcpiGbl_DbOutputToFile) { AcpiDbgLevel = ACPI_DEBUG_DEFAULT; } AcpiDbCloseDebugFile (); AcpiGbl_DbTerminateThreads = TRUE; return (AE_CTRL_TERMINATE); case CMD_NOT_FOUND: default: AcpiOsPrintf ("Unknown Command/n"); return (AE_CTRL_TRUE); } if (ACPI_SUCCESS (Status)) { Status = AE_CTRL_TRUE; } /* Add all commands that come here to the history buffer */ AcpiDbAddToHistory (InputBuffer); return (Status);}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:101,
示例7: acpi_bus_osc_supportstatic void acpi_bus_osc_support(void){ u32 capbuf[2]; struct acpi_osc_context context = { .uuid_str = sb_uuid_str, .rev = 1, .cap.length = 8, .cap.pointer = capbuf, }; acpi_handle handle; capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE; capbuf[OSC_SUPPORT_DWORD] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */#if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||/ defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PAD_SUPPORT;#endif#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_PPC_OST_SUPPORT;#endif#ifdef ACPI_HOTPLUG_OST capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_HOTPLUG_OST_SUPPORT;#endif if (!ghes_disable) capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_APEI_SUPPORT; if (ACPI_FAILURE(acpi_get_handle(NULL, "//_SB", &handle))) return; if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) { u32 *capbuf_ret = context.ret.pointer; if (context.ret.length > OSC_SUPPORT_DWORD) osc_sb_apei_support_acked = capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT; kfree(context.ret.pointer); } /* do we need to check other returned cap? Sounds no */}/* -------------------------------------------------------------------------- Notification Handling -------------------------------------------------------------------------- *//** * acpi_bus_notify * --------------- * Callback for all 'system-level' device notifications (values 0x00-0x7F). */static void acpi_bus_notify(acpi_handle handle, u32 type, void *data){ struct acpi_device *device = NULL; struct acpi_driver *driver; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p/n", type, handle)); switch (type) { case ACPI_NOTIFY_BUS_CHECK: /* TBD */ break; case ACPI_NOTIFY_DEVICE_CHECK: /* TBD */ break; case ACPI_NOTIFY_DEVICE_WAKE: /* TBD */ break; case ACPI_NOTIFY_EJECT_REQUEST: /* TBD */ break; case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: /* TBD: Exactly what does 'light' mean? */ break; case ACPI_NOTIFY_FREQUENCY_MISMATCH: /* TBD */ break; case ACPI_NOTIFY_BUS_MODE_MISMATCH: /* TBD */ break; case ACPI_NOTIFY_POWER_FAULT: /* TBD */ break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]/n", type)); break; } acpi_bus_get_device(handle, &device); if (device) {//.........这里部分代码省略.........
开发者ID:DecimalMan,项目名称:linux-misc,代码行数:101,
示例8: AcpiUtOsiImplementationACPI_STATUSAcpiUtOsiImplementation ( ACPI_WALK_STATE *WalkState){ ACPI_STATUS Status; ACPI_OPERAND_OBJECT *StringDesc; ACPI_OPERAND_OBJECT *ReturnDesc; UINT32 ReturnValue; UINT32 i; ACPI_FUNCTION_TRACE (UtOsiImplementation); /* Validate the string input argument */ StringDesc = WalkState->Arguments[0].Object; if (!StringDesc || (StringDesc->Common.Type != ACPI_TYPE_STRING)) { return_ACPI_STATUS (AE_TYPE); } /* Create a return object */ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!ReturnDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } /* Default return value is 0, NOT SUPPORTED */ ReturnValue = 0; /* Compare input string to static table of supported interfaces */ for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++) { if (!ACPI_STRCMP (StringDesc->String.Pointer, AcpiInterfacesSupported[i].Name)) { /* * The interface is supported. * Update the OsiData if necessary. We keep track of the latest * version of Windows that has been requested by the BIOS. */ if (AcpiInterfacesSupported[i].Value > AcpiGbl_OsiData) { AcpiGbl_OsiData = AcpiInterfacesSupported[i].Value; } ReturnValue = ACPI_UINT32_MAX; goto Exit; } } /* * Did not match the string in the static table, call the host OSL to * check for a match with one of the optional strings (such as * "Module Device", "3.0 Thermal Model", etc.) */ Status = AcpiOsValidateInterface (StringDesc->String.Pointer); if (ACPI_SUCCESS (Status)) { /* The interface is supported */ ReturnValue = ACPI_UINT32_MAX; }Exit: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "ACPI: BIOS _OSI(%s) is %ssupported/n", StringDesc->String.Pointer, ReturnValue == 0 ? "not " : "")); /* Complete the return value */ ReturnDesc->Integer.Value = ReturnValue; WalkState->ReturnDesc = ReturnDesc; return_ACPI_STATUS (AE_OK);}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:81,
示例9: AcpiUtAcquireMutexACPI_STATUSAcpiUtAcquireMutex ( ACPI_MUTEX_HANDLE MutexId){ ACPI_STATUS Status; ACPI_THREAD_ID ThisThreadId; ACPI_FUNCTION_NAME (UtAcquireMutex); if (MutexId > ACPI_MAX_MUTEX) { return (AE_BAD_PARAMETER); } ThisThreadId = AcpiOsGetThreadId ();#ifdef ACPI_MUTEX_DEBUG { UINT32 i; /* * Mutex debug code, for internal debugging only. * * Deadlock prevention. Check if this thread owns any mutexes of value * greater than or equal to this one. If so, the thread has violated * the mutex ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ for (i = MutexId; i < ACPI_NUM_MUTEX; i++) { if (AcpiGbl_MutexInfo[i].ThreadId == ThisThreadId) { if (i == MutexId) { ACPI_ERROR ((AE_INFO, "Mutex [%s] already acquired by this thread [%u]", AcpiUtGetMutexName (MutexId), (UINT32) ThisThreadId)); return (AE_ALREADY_ACQUIRED); } ACPI_ERROR ((AE_INFO, "Invalid acquire order: Thread %u owns [%s], wants [%s]", (UINT32) ThisThreadId, AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId))); return (AE_ACQUIRE_DEADLOCK); } } }#endif ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u attempting to acquire Mutex [%s]/n", (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); Status = AcpiOsAcquireMutex (AcpiGbl_MutexInfo[MutexId].Mutex, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]/n", (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId))); AcpiGbl_MutexInfo[MutexId].UseCount++; AcpiGbl_MutexInfo[MutexId].ThreadId = ThisThreadId; } else { ACPI_EXCEPTION ((AE_INFO, Status, "Thread %u could not acquire Mutex [0x%X]", (UINT32) ThisThreadId, MutexId)); } return (Status);}
开发者ID:iHaD,项目名称:DragonFlyBSD,代码行数:77,
示例10: EcWaitEventstatic ACPI_STATUSEcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count){ static int no_intr = 0; ACPI_STATUS Status; int count, i, need_poll, slp_ival; ACPI_SERIAL_ASSERT(ec); Status = AE_NO_HARDWARE_RESPONSE; need_poll = cold || rebooting || ec_polled_mode || sc->ec_suspending; /* Wait for event by polling or GPE (interrupt). */ if (need_poll) { count = (ec_timeout * 1000) / EC_POLL_DELAY; if (count == 0) count = 1; DELAY(10); for (i = 0; i < count; i++) { Status = EcCheckStatus(sc, "poll", Event); if (ACPI_SUCCESS(Status)) break; DELAY(EC_POLL_DELAY); } } else { slp_ival = hz / 1000; if (slp_ival != 0) { count = ec_timeout; } else { /* hz has less than 1 ms resolution so scale timeout. */ slp_ival = 1; count = ec_timeout / (1000 / hz); } /* * Wait for the GPE to signal the status changed, checking the * status register each time we get one. It's possible to get a * GPE for an event we're not interested in here (i.e., SCI for * EC query). */ for (i = 0; i < count; i++) { if (gen_count == sc->ec_gencount) tsleep(sc, 0, "ecgpe", slp_ival); /* * Record new generation count. It's possible the GPE was * just to notify us that a query is needed and we need to * wait for a second GPE to signal the completion of the * event we are actually waiting for. */ Status = EcCheckStatus(sc, "sleep", Event); if (ACPI_SUCCESS(Status)) { if (gen_count == sc->ec_gencount) no_intr++; else no_intr = 0; break; } gen_count = sc->ec_gencount; } /* * We finished waiting for the GPE and it never arrived. Try to * read the register once and trust whatever value we got. This is * the best we can do at this point. */ if (ACPI_FAILURE(Status)) Status = EcCheckStatus(sc, "sleep_end", Event); } if (!need_poll && no_intr > 10) { device_printf(sc->ec_dev, "not getting interrupts, switched to polled mode/n"); ec_polled_mode = 1; } if (ACPI_FAILURE(Status)) CTR0(KTR_ACPI, "error: ec wait timed out"); return (Status);}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:76,
示例11: EcSpaceHandlerstatic ACPI_STATUSEcSpaceHandler(UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 Width, UINT64 *Value, void *Context, void *RegionContext){ struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; ACPI_PHYSICAL_ADDRESS EcAddr; UINT8 *EcData; ACPI_STATUS Status; ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Address); if (Function != ACPI_READ && Function != ACPI_WRITE) return_ACPI_STATUS (AE_BAD_PARAMETER); if (Width % 8 != 0 || Value == NULL || Context == NULL) return_ACPI_STATUS (AE_BAD_PARAMETER); if (Address + Width / 8 > 256) return_ACPI_STATUS (AE_BAD_ADDRESS); /* * If booting, check if we need to run the query handler. If so, we * we call it directly here since our thread taskq is not active yet. */ if (cold || rebooting || sc->ec_suspending) { if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) { CTR0(KTR_ACPI, "ec running gpe handler directly"); EcGpeQueryHandler(sc); } } /* Serialize with EcGpeQueryHandler() at transaction granularity. */ Status = EcLock(sc); if (ACPI_FAILURE(Status)) return_ACPI_STATUS (Status); /* If we can't start burst mode, continue anyway. */ Status = EcCommand(sc, EC_COMMAND_BURST_ENABLE); if (ACPI_SUCCESS(Status)) { if (EC_GET_DATA(sc) == EC_BURST_ACK) { CTR0(KTR_ACPI, "ec burst enabled"); sc->ec_burstactive = TRUE; } } /* Perform the transaction(s), based on Width. */ EcAddr = Address; EcData = (UINT8 *)Value; if (Function == ACPI_READ) *Value = 0; do { switch (Function) { case ACPI_READ: Status = EcRead(sc, EcAddr, EcData); break; case ACPI_WRITE: Status = EcWrite(sc, EcAddr, *EcData); break; } if (ACPI_FAILURE(Status)) break; EcAddr++; EcData++; } while (EcAddr < Address + Width / 8); if (sc->ec_burstactive) { sc->ec_burstactive = FALSE; if (ACPI_SUCCESS(EcCommand(sc, EC_COMMAND_BURST_DISABLE))) CTR0(KTR_ACPI, "ec disabled burst ok"); } EcUnlock(sc); return_ACPI_STATUS (Status);}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:72,
示例12: DisplayOneDeviceACPI_STATUSDisplayOneDevice (ACPI_HANDLE ObjHandle, UINT32 Level, void *Context, void **RetVal){ ACPI_STATUS Status; ACPI_DEVICE_INFO *Info; ACPI_BUFFER Path; ACPI_BUFFER Result; ACPI_OBJECT Obj; char Buffer[256]; uint8 prt_buf[1024]; ACPI_BUFFER Prt = { .Length = sizeof (prt_buf), .Pointer = prt_buf }; ACPI_PCI_ROUTING_TABLE *prtd; uint32 addr=0; uint32 fun = 0; bool pcibus=FALSE; u8 busnum; Path.Length = sizeof (Buffer); Path.Pointer = Buffer; Status = AcpiGetName (ObjHandle, ACPI_FULL_PATHNAME, &Path); if (ACPI_SUCCESS (Status)) { DLOG_COM1 ("%s: /n", Path.Pointer); } Status = AcpiGetObjectInfo (ObjHandle, &Info); if (ACPI_SUCCESS (Status)) { DLOG_COM1 (" "); if (Info->Flags & ACPI_PCI_ROOT_BRIDGE) { DLOG_COM1 (" PCI_ROOT"); busnum = 0; pcibus = TRUE; } if (Info->Valid & ACPI_VALID_STA) DLOG_COM1 (" STA %.8X", Info->CurrentStatus); if (Info->Valid & ACPI_VALID_ADR) { DLOG_COM1 (" ADR %.8X", Info->Address); addr = Info->Address >> 16; fun = Info->Address & 0x7; } if (Info->Valid & ACPI_VALID_HID) DLOG_COM1 (" HID %s", Info->HardwareId.String); if (Info->Valid & ACPI_VALID_UID) DLOG_COM1 (" UID %s", Info->UniqueId.String); if (Info->Valid & ACPI_VALID_CID) DLOG_COM1 (" CID"); ACPI_FREE (Info); } Result.Length = sizeof (Obj); Result.Pointer = &Obj; Status = AcpiEvaluateObjectTyped (ObjHandle, "_DDN", NULL, &Result, ACPI_TYPE_STRING); if (ACPI_SUCCESS (Status)) { DLOG_COM1 (" DDN=%s", Obj.String.Pointer); } Result.Length = sizeof (Obj); Result.Pointer = &Obj; Status = AcpiEvaluateObjectTyped (ObjHandle, "_STR", NULL, &Result, ACPI_TYPE_STRING); if (ACPI_SUCCESS (Status)) { DLOG_COM1 (" STR=%s", Obj.String.Pointer); } Result.Length = sizeof (Obj); Result.Pointer = &Obj; Status = AcpiEvaluateObjectTyped (ObjHandle, "_MLS", NULL, &Result, ACPI_TYPE_STRING); if (ACPI_SUCCESS (Status)) { DLOG_COM1 (" MLS=%s", Obj.String.Pointer); } Status = AcpiEvaluateObjectTyped (ObjHandle, "_BBN", NULL, &Result, ACPI_TYPE_INTEGER); if (ACPI_SUCCESS (Status)) { DLOG_COM1 (" BBN=%d", Obj.Integer.Value); } else if (Status != AE_NOT_FOUND) DLOG_COM1 (" bbnERR=%d", Status); Status = AcpiEvaluateObjectTyped (ObjHandle, "_PXM", NULL, &Result, ACPI_TYPE_INTEGER); if (ACPI_SUCCESS (Status)) { DLOG_COM1 (" PXM=%d", Obj.Integer.Value); } else if (Status != AE_NOT_FOUND) DLOG_COM1 (" pxmERR=%d", Status); DLOG_COM1 ("/n"); for (;;) { Status = AcpiGetIrqRoutingTable (ObjHandle, &Prt); if (ACPI_FAILURE (Status)) { if (Status == AE_BUFFER_OVERFLOW) {//.........这里部分代码省略.........
开发者ID:missimer,项目名称:quest-edison,代码行数:101,
示例13: pnpacpi_add_devicestatic int __init pnpacpi_add_device(struct acpi_device *device){ acpi_handle temp = NULL; acpi_status status; struct pnp_dev *dev; /* * If a PnPacpi device is not present , the device * driver should not be loaded. */ status = acpi_get_handle(device->handle, "_CRS", &temp); if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) || is_exclusive_device(device) || (!device->status.present)) return 0; dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device)); if (!dev) return -ENOMEM; dev->data = device->handle; /* .enabled means the device can decode the resources */ dev->active = device->status.enabled; status = acpi_get_handle(device->handle, "_SRS", &temp); if (ACPI_SUCCESS(status)) dev->capabilities |= PNP_CONFIGURABLE; dev->capabilities |= PNP_READ; if (device->flags.dynamic_status && (dev->capabilities & PNP_CONFIGURABLE)) dev->capabilities |= PNP_WRITE; if (device->flags.removable) dev->capabilities |= PNP_REMOVABLE; status = acpi_get_handle(device->handle, "_DIS", &temp); if (ACPI_SUCCESS(status)) dev->capabilities |= PNP_DISABLE; if (strlen(acpi_device_name(device))) strncpy(dev->name, acpi_device_name(device), sizeof(dev->name)); else strncpy(dev->name, acpi_device_bid(device), sizeof(dev->name)); if (dev->active) pnpacpi_parse_allocated_resource(dev); if (dev->capabilities & PNP_CONFIGURABLE) pnpacpi_parse_resource_option_data(dev); if (device->flags.compatible_ids) { struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; int i; for (i = 0; i < cid_list->count; i++) { if (!ispnpidacpi(cid_list->id[i].value)) continue; pnp_add_id(dev, cid_list->id[i].value); } } /* clear out the damaged flags */ if (!dev->active) pnp_init_resources(dev); pnp_add_device(dev); num++; return AE_OK;}
开发者ID:mecke,项目名称:linux-2.6,代码行数:64,
示例14: acpi_bus_osc_supportstatic void acpi_bus_osc_support(void){ u32 capbuf[2]; struct acpi_osc_context context = { .uuid_str = sb_uuid_str, .rev = 1, .cap.length = 8, .cap.pointer = capbuf, }; acpi_handle handle; capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */#if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||/ defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT;#endif#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT;#endif if (ACPI_FAILURE(acpi_get_handle(NULL, "//_SB", &handle))) return; if (is_uv_system() && is_kdump_kernel()) { /* * There is no need to parse the OS Capabilities table * in the crash kernel. And it should not be done, as * that parsing includes destructive writes to io ports to * initialize UV system controller interrupts. */ return; } if (ACPI_SUCCESS(acpi_run_osc(handle, &context))) kfree(context.ret.pointer); /* do we need to check the returned cap? Sounds no */}/* -------------------------------------------------------------------------- Event Management -------------------------------------------------------------------------- */#ifdef CONFIG_ACPI_PROC_EVENTstatic DEFINE_SPINLOCK(acpi_bus_event_lock);LIST_HEAD(acpi_bus_event_list);DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);extern int event_is_open;int acpi_bus_generate_proc_event4(const char *device_class, const char *bus_id, u8 type, int data){ struct acpi_bus_event *event; unsigned long flags = 0; /* drop event on the floor if no one's listening */ if (!event_is_open) return 0; event = kmalloc(sizeof(struct acpi_bus_event), GFP_ATOMIC); if (!event) return -ENOMEM; strcpy(event->device_class, device_class); strcpy(event->bus_id, bus_id); event->type = type; event->data = data; spin_lock_irqsave(&acpi_bus_event_lock, flags); list_add_tail(&event->node, &acpi_bus_event_list); spin_unlock_irqrestore(&acpi_bus_event_lock, flags); wake_up_interruptible(&acpi_bus_event_queue); return 0;}EXPORT_SYMBOL_GPL(acpi_bus_generate_proc_event4);int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data){ if (!device) return -EINVAL; return acpi_bus_generate_proc_event4(device->pnp.device_class, device->pnp.bus_id, type, data);}EXPORT_SYMBOL(acpi_bus_generate_proc_event);int acpi_bus_receive_event(struct acpi_bus_event *event){ unsigned long flags = 0; struct acpi_bus_event *entry = NULL; DECLARE_WAITQUEUE(wait, current); if (!event)//.........这里部分代码省略.........
开发者ID:710leo,项目名称:LVS,代码行数:101,
示例15: DtCompileGenericACPI_STATUSDtCompileGeneric ( void **List){ ACPI_STATUS Status; DT_SUBTABLE *Subtable; DT_SUBTABLE *ParentTable; DT_FIELD **PFieldList = (DT_FIELD **) List; ACPI_DMTABLE_INFO *Info; ParentTable = DtPeekSubtable (); /* * Compile the "generic" portion of the table. This * part of the table is not predefined and any of the generic * operators may be used. */ /* Find any and all labels in the entire generic portion */ DtDetectAllLabels (*PFieldList); /* Now we can actually compile the parse tree */ while (*PFieldList) { Info = DtGetGenericTableInfo ((*PFieldList)->Name); if (!Info) { sprintf (MsgBuffer, "Generic data type /"%s/" not found", (*PFieldList)->Name); DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, (*PFieldList), MsgBuffer); *PFieldList = (*PFieldList)->Next; continue; } Status = DtCompileTable (PFieldList, Info, &Subtable, TRUE); if (ACPI_SUCCESS (Status)) { DtInsertSubtable (ParentTable, Subtable); } else { *PFieldList = (*PFieldList)->Next; if (Status == AE_NOT_FOUND) { sprintf (MsgBuffer, "Generic data type /"%s/" not found", (*PFieldList)->Name); DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME, (*PFieldList), MsgBuffer); } } } return (AE_OK);}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:61,
示例16: acpi_ut_acquire_mutexacpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id){ acpi_status status; acpi_thread_id this_thread_id; ACPI_FUNCTION_NAME(ut_acquire_mutex); if (mutex_id > ACPI_MAX_MUTEX) { return (AE_BAD_PARAMETER); } this_thread_id = acpi_os_get_thread_id();#ifdef ACPI_MUTEX_DEBUG { u32 i; /* * Mutex debug code, for internal debugging only. * * Deadlock prevention. Check if this thread owns any mutexes of value * greater than or equal to this one. If so, the thread has violated * the mutex ordering rule. This indicates a coding error somewhere in * the ACPI subsystem code. */ for (i = mutex_id; i < ACPI_NUM_MUTEX; i++) { if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { if (i == mutex_id) { ACPI_ERROR((AE_INFO, "Mutex [%s] already acquired by this thread [%u]", acpi_ut_get_mutex_name (mutex_id), (u32)this_thread_id)); return (AE_ALREADY_ACQUIRED); } ACPI_ERROR((AE_INFO, "Invalid acquire order: Thread %u owns [%s], wants [%s]", (u32)this_thread_id, acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); return (AE_ACQUIRE_DEADLOCK); } } }#endif ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u attempting to acquire Mutex [%s]/n", (u32)this_thread_id, acpi_ut_get_mutex_name(mutex_id))); status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, ACPI_WAIT_FOREVER); if (ACPI_SUCCESS(status)) { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]/n", (u32)this_thread_id, acpi_ut_get_mutex_name(mutex_id))); acpi_gbl_mutex_info[mutex_id].use_count++; acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; } else { ACPI_EXCEPTION((AE_INFO, status, "Thread %u could not acquire Mutex [0x%X]", (u32)this_thread_id, mutex_id)); } return (status);}
开发者ID:0-T-0,项目名称:ps4-linux,代码行数:71,
示例17: AcpiNsGetObjectValueACPI_STATUSAcpiNsGetObjectValue ( ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT **ReturnObjDesc){ ACPI_STATUS Status = AE_OK; ACPI_NAMESPACE_NODE *ResolvedNode = Node; ACPI_FUNCTION_TRACE ("NsGetObjectValue"); /* * Objects require additional resolution steps (e.g., the * Node may be a field that must be read, etc.) -- we can't just grab * the object out of the node. */ /* * Use ResolveNodeToValue() to get the associated value. This call * always deletes ObjDesc (allocated above). * * NOTE: we can get away with passing in NULL for a walk state * because ObjDesc is guaranteed to not be a reference to either * a method local or a method argument (because this interface can only be * called from the AcpiEvaluate external interface, never called from * a running control method.) * * Even though we do not directly invoke the interpreter * for this, we must enter it because we could access an opregion. * The opregion access code assumes that the interpreter * is locked. * * We must release the namespace lock before entering the * intepreter. */ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiExEnterInterpreter (); if (ACPI_SUCCESS (Status)) { Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); /* * If AcpiExResolveNodeToValue() succeeded, the return value was * placed in ResolvedNode. */ AcpiExExitInterpreter (); if (ACPI_SUCCESS (Status)) { Status = AE_CTRL_RETURN_VALUE; *ReturnObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ResolvedNode); ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]/n", *ReturnObjDesc, AcpiUtGetObjectTypeName (*ReturnObjDesc))); } } /* Namespace is unlocked */ return_ACPI_STATUS (Status);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:65,
示例18: AcpiDsEvaluateNamePathACPI_STATUSAcpiDsEvaluateNamePath ( ACPI_WALK_STATE *WalkState){ ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Op = WalkState->Op; ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; ACPI_OPERAND_OBJECT *NewObjDesc; UINT8 Type; ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath, WalkState); if (!Op->Common.Parent) { /* This happens after certain exception processing */ goto Exit; } if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP)) { /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */ goto Exit; } Status = AcpiDsCreateOperand (WalkState, Op, 0); if (ACPI_FAILURE (Status)) { goto Exit; } if (Op->Common.Flags & ACPI_PARSEOP_TARGET) { NewObjDesc = *Operand; goto PushResult; } Type = (*Operand)->Common.Type; Status = AcpiExResolveToValue (Operand, WalkState); if (ACPI_FAILURE (Status)) { goto Exit; } if (Type == ACPI_TYPE_INTEGER) { /* It was incremented by AcpiExResolveToValue */ AcpiUtRemoveReference (*Operand); Status = AcpiUtCopyIobjectToIobject (*Operand, &NewObjDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Exit; } } else { /* * The object either was anew created or is * a Namespace node - don't decrement it. */ NewObjDesc = *Operand; } /* Cleanup for name-path operand */ Status = AcpiDsObjStackPop (1, WalkState); if (ACPI_FAILURE (Status)) { WalkState->ResultObj = NewObjDesc; goto Exit; }PushResult: WalkState->ResultObj = NewObjDesc; Status = AcpiDsResultPush (WalkState->ResultObj, WalkState); if (ACPI_SUCCESS (Status)) { /* Force to take it from stack */ Op->Common.Flags |= ACPI_PARSEOP_IN_STACK; }Exit: return_ACPI_STATUS (Status);}
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:96,
示例19: AcpiExGetNameString//.........这里部分代码省略......... HasPrefix = TRUE; break; default: /* Not a prefix character */ break; } /* Examine first character of name for name segment prefix operator */ switch (*AmlAddress) { case AML_DUAL_NAME_PREFIX: ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p/n", AmlAddress)); AmlAddress++; NameString = AcpiExAllocateNameString (PrefixCount, 2); if (!NameString) { Status = AE_NO_MEMORY; break; } /* Indicate that we processed a prefix */ HasPrefix = TRUE; Status = AcpiExNameSegment (&AmlAddress, NameString); if (ACPI_SUCCESS (Status)) { Status = AcpiExNameSegment (&AmlAddress, NameString); } break; case AML_MULTI_NAME_PREFIX_OP: ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p/n", AmlAddress)); /* Fetch count of segments remaining in name path */ AmlAddress++; NumSegments = *AmlAddress; NameString = AcpiExAllocateNameString (PrefixCount, NumSegments); if (!NameString) { Status = AE_NO_MEMORY; break; } /* Indicate that we processed a prefix */ AmlAddress++; HasPrefix = TRUE; while (NumSegments && (Status = AcpiExNameSegment (&AmlAddress, NameString)) == AE_OK) {
开发者ID:Aresthu,项目名称:ucore_plus,代码行数:67,
示例20: setup_resourcestatic acpi_statussetup_resource(struct acpi_resource *acpi_res, void *data){ struct pci_root_info *info = data; struct resource *res; struct acpi_resource_address64 addr; acpi_status status; unsigned long flags; struct resource *root, *conflict; u64 start, end; status = resource_to_addr(acpi_res, &addr); if (!ACPI_SUCCESS(status)) return AE_OK; if (addr.resource_type == ACPI_MEMORY_RANGE) { root = &iomem_resource; flags = IORESOURCE_MEM; if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY) flags |= IORESOURCE_PREFETCH; } else if (addr.resource_type == ACPI_IO_RANGE) { root = &ioport_resource; flags = IORESOURCE_IO; } else return AE_OK; start = addr.minimum + addr.translation_offset; end = addr.maximum + addr.translation_offset; res = &info->res[info->res_num]; res->name = info->name; res->flags = flags; res->start = start; res->end = end; res->child = NULL; if (!pci_use_crs) { dev_printk(KERN_DEBUG, &info->bridge->dev, "host bridge window %pR (ignored)/n", res); return AE_OK; } conflict = insert_resource_conflict(root, res); if (conflict) { dev_err(&info->bridge->dev, "address space collision: host bridge window %pR " "conflicts with %s %pR/n", res, conflict->name, conflict); } else { pci_bus_add_resource(info->bus, res, 0); info->res_num++; if (addr.translation_offset) dev_info(&info->bridge->dev, "host bridge window %pR " "(PCI address [%#llx-%#llx])/n", res, res->start - addr.translation_offset, res->end - addr.translation_offset); else dev_info(&info->bridge->dev, "host bridge window %pR/n", res); } return AE_OK;}
开发者ID:CoreTech-Development,项目名称:buildroot-linux-kernel-m3,代码行数:62,
示例21: AfInstallGpeBlockstatic voidAfInstallGpeBlock ( void){ ACPI_STATUS Status; ACPI_HANDLE Handle; ACPI_GENERIC_ADDRESS BlockAddress; ACPI_HANDLE GpeDevice; ACPI_OBJECT_TYPE Type; /* _GPE should always exist */ Status = AcpiGetHandle (NULL, "//_GPE", &Handle); AE_CHECK_OK (AcpiGetHandle, Status); if (ACPI_FAILURE (Status)) { return; } memset (&BlockAddress, 0, sizeof (ACPI_GENERIC_ADDRESS)); BlockAddress.SpaceId = ACPI_ADR_SPACE_SYSTEM_MEMORY; BlockAddress.Address = 0x76540000; /* Attempt to install a GPE block on GPE2 (if present) */ Status = AcpiGetHandle (NULL, "//GPE2", &Handle); if (ACPI_SUCCESS (Status)) { Status = AcpiGetType (Handle, &Type); if (ACPI_FAILURE (Status) || (Type != ACPI_TYPE_DEVICE)) { return; } Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 7, 8); AE_CHECK_OK (AcpiInstallGpeBlock, Status); Status = AcpiInstallGpeHandler (Handle, 8, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); AE_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (Handle, 8); AE_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiGetGpeDevice (0x30, &GpeDevice); AE_CHECK_OK (AcpiGetGpeDevice, Status); Status = AcpiGetGpeDevice (0x42, &GpeDevice); AE_CHECK_OK (AcpiGetGpeDevice, Status); Status = AcpiGetGpeDevice (AcpiCurrentGpeCount-1, &GpeDevice); AE_CHECK_OK (AcpiGetGpeDevice, Status); Status = AcpiGetGpeDevice (AcpiCurrentGpeCount, &GpeDevice); AE_CHECK_STATUS (AcpiGetGpeDevice, Status, AE_NOT_EXIST); Status = AcpiRemoveGpeHandler (Handle, 8, AeGpeHandler); AE_CHECK_OK (AcpiRemoveGpeHandler, Status); } /* Attempt to install a GPE block on GPE3 (if present) */ Status = AcpiGetHandle (NULL, "//GPE3", &Handle); if (ACPI_SUCCESS (Status)) { Status = AcpiGetType (Handle, &Type); if (ACPI_FAILURE (Status) || (Type != ACPI_TYPE_DEVICE)) { return; } Status = AcpiInstallGpeBlock (Handle, &BlockAddress, 8, 11); AE_CHECK_OK (AcpiInstallGpeBlock, Status); }}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:78,
示例22: acpi_hw_register_read/****************************************************************************** * * FUNCTION: acpi_hw_register_read * * PARAMETERS: register_id - ACPI Register ID * return_value - Where the register value is returned * * RETURN: Status and the value read. * * DESCRIPTION: Read from the specified ACPI register * ******************************************************************************/acpi_statusacpi_hw_register_read(u32 register_id, u32 * return_value){ u32 value = 0; acpi_status status; ACPI_FUNCTION_TRACE(hw_register_read); switch (register_id) { case ACPI_REGISTER_PM1_STATUS: /* PM1 A/B: 16-bit access each */ status = acpi_hw_read_multiple(&value, &acpi_gbl_xpm1a_status, &acpi_gbl_xpm1b_status); break; case ACPI_REGISTER_PM1_ENABLE: /* PM1 A/B: 16-bit access each */ status = acpi_hw_read_multiple(&value, &acpi_gbl_xpm1a_enable, &acpi_gbl_xpm1b_enable); break; case ACPI_REGISTER_PM1_CONTROL: /* PM1 A/B: 16-bit access each */ status = acpi_hw_read_multiple(&value, &acpi_gbl_FADT. xpm1a_control_block, &acpi_gbl_FADT. xpm1b_control_block); /* * Zero the write-only bits. From the ACPI specification, "Hardware * Write-Only Bits": "Upon reads to registers with write-only bits, * software masks out all write-only bits." */ value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS; break; case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ status = acpi_hw_read(&value, &acpi_gbl_FADT.xpm2_control_block); break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ status = acpi_hw_read(&value, &acpi_gbl_FADT.xpm_timer_block); break; case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ status = acpi_hw_read_port(acpi_gbl_FADT.smi_command, &value, 8); break; default: ACPI_ERROR((AE_INFO, "Unknown Register ID: 0x%X", register_id)); status = AE_BAD_PARAMETER; break; } if (ACPI_SUCCESS(status)) { *return_value = value; } return_ACPI_STATUS(status);}
开发者ID:stoku,项目名称:linux-3.6.11-ab,代码行数:80,
示例23: AeMiscellaneousTests//.........这里部分代码省略......... AE_CHECK_OK (AcpiSetGpe, Status); Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE); AE_CHECK_OK (AcpiSetGpe, Status); Status = AcpiInstallGpeHandler (NULL, 1, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); AE_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 1); AE_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiInstallGpeHandler (NULL, 2, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); AE_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 2); AE_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiInstallGpeHandler (NULL, 3, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); AE_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiInstallGpeHandler (NULL, 4, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); AE_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiInstallGpeHandler (NULL, 5, ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL); AE_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiGetHandle (NULL, "//_SB", &Handle); AE_CHECK_OK (AcpiGetHandle, Status); Status = AcpiSetupGpeForWake (Handle, NULL, 5); AE_CHECK_OK (AcpiSetupGpeForWake, Status); Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE); AE_CHECK_OK (AcpiSetGpeWakeMask, Status); Status = AcpiSetupGpeForWake (Handle, NULL, 6); AE_CHECK_OK (AcpiSetupGpeForWake, Status); Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6); AE_CHECK_OK (AcpiSetupGpeForWake, Status); Status = AcpiSetupGpeForWake (Handle, NULL, 9); AE_CHECK_OK (AcpiSetupGpeForWake, Status); Status = AcpiInstallGpeHandler (NULL, 0x19, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); AE_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 0x19); AE_CHECK_OK (AcpiEnableGpe, Status); /* GPE block 1 */ Status = AcpiInstallGpeHandler (NULL, 101, ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL); AE_CHECK_OK (AcpiInstallGpeHandler, Status); Status = AcpiEnableGpe (NULL, 101); AE_CHECK_OK (AcpiEnableGpe, Status); Status = AcpiDisableGpe (NULL, 101); AE_CHECK_OK (AcpiDisableGpe, Status); AfInstallGpeBlock (); /* Here is where the GPEs are actually "enabled" */ Status = AcpiUpdateAllGpes (); AE_CHECK_OK (AcpiUpdateAllGpes, Status); Status = AcpiGetHandle (NULL, "RSRC", &Handle); if (ACPI_SUCCESS (Status)) { ReturnBuf.Length = ACPI_ALLOCATE_BUFFER; Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf); if (ACPI_SUCCESS (Status)) { AcpiOsFree (ReturnBuf.Pointer); } } /* Test global lock */ Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1); AE_CHECK_OK (AcpiAcquireGlobalLock, Status); Status = AcpiAcquireGlobalLock (0x5, &LockHandle2); AE_CHECK_OK (AcpiAcquireGlobalLock, Status); Status = AcpiReleaseGlobalLock (LockHandle1); AE_CHECK_OK (AcpiReleaseGlobalLock, Status); Status = AcpiReleaseGlobalLock (LockHandle2); AE_CHECK_OK (AcpiReleaseGlobalLock, Status);#endif /* !ACPI_REDUCED_HARDWARE */}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,
示例24: AcpiDbReadTablestatic ACPI_STATUSAcpiDbReadTable ( FILE *fp, ACPI_TABLE_HEADER **Table, UINT32 *TableLength){ ACPI_TABLE_HEADER TableHeader; UINT32 Actual; ACPI_STATUS Status; UINT32 FileSize; BOOLEAN StandardHeader = TRUE; /* Get the file size */ FileSize = CmGetFileSize (fp); if (FileSize == ACPI_UINT32_MAX) { return (AE_ERROR); } if (FileSize < 4) { return (AE_BAD_HEADER); } /* Read the signature */ if (fread (&TableHeader, 1, 4, fp) != 4) { AcpiOsPrintf ("Could not read the table signature/n"); return (AE_BAD_HEADER); } fseek (fp, 0, SEEK_SET); /* The RSDP table does not have standard ACPI header */ if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ")) { *TableLength = FileSize; StandardHeader = FALSE; } else { /* Read the table header */ if (fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), fp) != sizeof (ACPI_TABLE_HEADER)) { AcpiOsPrintf ("Could not read the table header/n"); return (AE_BAD_HEADER); }#if 0 /* Validate the table header/length */ Status = AcpiTbValidateTableHeader (&TableHeader); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Table header is invalid!/n"); return (Status); }#endif /* File size must be at least as long as the Header-specified length */ if (TableHeader.Length > FileSize) { AcpiOsPrintf ( "TableHeader length [0x%X] greater than the input file size [0x%X]/n", TableHeader.Length, FileSize);#ifdef ACPI_ASL_COMPILER Status = FlCheckForAscii (fp, NULL, FALSE); if (ACPI_SUCCESS (Status)) { AcpiOsPrintf ("File appears to be ASCII only, must be binary/n", TableHeader.Length, FileSize); }#endif return (AE_BAD_HEADER); }#ifdef ACPI_OBSOLETE_CODE /* We only support a limited number of table types */ if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) && !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) && !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT)) { AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported/n", (char *) TableHeader.Signature); ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER)); return (AE_ERROR); }#endif *TableLength = TableHeader.Length; }//.........这里部分代码省略.........
开发者ID:queer1,项目名称:acpica,代码行数:101,
示例25: AcpiPsParseAml//.........这里部分代码省略......... /* TBD: [Restructure] add walkstate as a param */ AcpiDsMethodDataInitArgs (Params, MTH_NUM_ARGS, WalkState); } else { /* Setup the current scope */ ParserState->StartNode = ParserState->StartOp->Node; if (ParserState->StartNode) { /* Push start scope on scope stack and make it current */ Status = AcpiDsScopeStackPush (ParserState->StartNode, ParserState->StartNode->Type, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; } } } /* * Execute the walk loop as long as there is a valid Walk State. This * handles nested control method invocations without recursion. */ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p/n", WalkState)); Status = AE_OK; while (WalkState) { if (ACPI_SUCCESS (Status)) { Status = AcpiPsParseLoop (WalkState); } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Completed one call to walk loop, State=%p/n", WalkState)); if (Status == AE_CTRL_TRANSFER) { /* * A method call was detected. * Transfer control to the called control method */ Status = AcpiDsCallControlMethod (&WalkList, WalkState, NULL); /* * If the transfer to the new method method call worked, a new walk * state was created -- get it */ WalkState = AcpiDsGetCurrentWalkState (&WalkList); continue; } else if (Status == AE_CTRL_TERMINATE) { Status = AE_OK; } /* We are done with this walk, move on to the parent if any */ WalkState = AcpiDsPopWalkState (&WalkList);
开发者ID:MarginC,项目名称:kame,代码行数:66,
注:本文中的ACPI_SUCCESS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ACPI_TO_INTEGER函数代码示例 C++ ACPI_STRTOUL函数代码示例 |