本文整理汇总了C++中ACPI_VPRINT函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_VPRINT函数的具体用法?C++ ACPI_VPRINT怎么用?C++ ACPI_VPRINT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_VPRINT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EcRead
static ACPI_STATUS
EcRead(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data)
{
ACPI_STATUS Status;
if (!EcIsLocked(sc))
ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
"EcRead called without EC lock!\n");
/*EcBurstEnable(EmbeddedController);*/
EC_SET_CSR(sc, EC_COMMAND_READ);
if (ACPI_FAILURE(Status = EcWaitEventIntr(sc, EC_EVENT_INPUT_BUFFER_EMPTY))) {
ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
"EcRead: Failed waiting for EC to process read command.\n");
return(Status);
}
EC_SET_DATA(sc, Address);
if (ACPI_FAILURE(Status = EcWaitEventIntr(sc, EC_EVENT_OUTPUT_BUFFER_FULL))) {
ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
"EcRead: Failed waiting for EC to send data.\n");
return(Status);
}
(*Data) = EC_GET_DATA(sc);
/*EcBurstDisable(EmbeddedController);*/
return(AE_OK);
}
示例2: acpi_button_notify_pressed_for_sleep
static void
acpi_button_notify_pressed_for_sleep(void *arg)
{
struct acpi_button_softc *sc;
struct acpi_softc *acpi_sc;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
sc = (struct acpi_button_softc *)arg;
acpi_sc = acpi_device_get_parent_softc(sc->button_dev);
if (acpi_sc == NULL) {
return_VOID;
}
switch (sc->button_type) {
case ACPI_POWER_BUTTON:
ACPI_VPRINT(sc->button_dev, acpi_sc, "power button pressed\n");
acpi_eventhandler_power_button_for_sleep((void *)acpi_sc);
break;
case ACPI_SLEEP_BUTTON:
ACPI_VPRINT(sc->button_dev, acpi_sc, "sleep button pressed\n");
acpi_eventhandler_sleep_button_for_sleep((void *)acpi_sc);
break;
default:
break; /* unknown button type */
}
return_VOID;
}
示例3: acpi_button_notify_wakeup
static void
acpi_button_notify_wakeup(void *arg)
{
struct acpi_button_softc *sc;
struct acpi_softc *acpi_sc;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
sc = (struct acpi_button_softc *)arg;
acpi_sc = acpi_device_get_parent_softc(sc->button_dev);
if (acpi_sc == NULL)
return_VOID;
acpi_UserNotify("Button", sc->button_handle, sc->button_type);
switch (sc->button_type) {
case ACPI_POWER_BUTTON:
ACPI_VPRINT(sc->button_dev, acpi_sc, "wakeup by power button\n");
acpi_event_power_button_wake(acpi_sc);
break;
case ACPI_SLEEP_BUTTON:
ACPI_VPRINT(sc->button_dev, acpi_sc, "wakeup by sleep button\n");
acpi_event_sleep_button_wake(acpi_sc);
break;
default:
break; /* unknown button type */
}
}
示例4: acpi_PkgGas
int
acpi_PkgGas(device_t dev, ACPI_OBJECT *res, int idx, int *rid,
struct resource **dst)
{
ACPI_GENERIC_ADDRESS gas;
ACPI_OBJECT *obj;
obj = &res->Package.Elements[idx];
if (obj == NULL || obj->Type != ACPI_TYPE_BUFFER ||
obj->Buffer.Length < sizeof(ACPI_GENERIC_ADDRESS) + 3) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"PkgGas error at %d\n", idx);
return (-1);
}
memcpy(&gas, obj->Buffer.Pointer + 3, sizeof(gas));
*dst = acpi_bus_alloc_gas(dev, rid, &gas);
if (*dst == NULL) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"PkgGas error at %d\n", idx);
return (-1);
}
return (0);
}
示例5: acpi_cmbat_get_bst
static void
acpi_cmbat_get_bst(void *arg)
{
struct acpi_cmbat_softc *sc;
ACPI_STATUS as;
ACPI_OBJECT *res;
ACPI_HANDLE h;
ACPI_BUFFER bst_buffer;
device_t dev;
ACPI_SERIAL_ASSERT(cmbat);
dev = arg;
sc = device_get_softc(dev);
h = acpi_get_handle(dev);
bst_buffer.Pointer = NULL;
bst_buffer.Length = ACPI_ALLOCATE_BUFFER;
if (!acpi_cmbat_info_expired(&sc->bst_lastupdated))
goto end;
as = AcpiEvaluateObject(h, "_BST", NULL, &bst_buffer);
if (ACPI_FAILURE(as)) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"error fetching current battery status -- %s\n",
AcpiFormatException(as));
goto end;
}
res = (ACPI_OBJECT *)bst_buffer.Pointer;
if (!ACPI_PKG_VALID(res, 4)) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery status corrupted\n");
goto end;
}
if (acpi_PkgInt32(res, 0, &sc->bst.state) != 0)
goto end;
if (acpi_PkgInt32(res, 1, &sc->bst.rate) != 0)
goto end;
if (acpi_PkgInt32(res, 2, &sc->bst.cap) != 0)
goto end;
if (acpi_PkgInt32(res, 3, &sc->bst.volt) != 0)
goto end;
acpi_cmbat_info_updated(&sc->bst_lastupdated);
/* XXX If all batteries are critical, perhaps we should suspend. */
if (sc->bst.state & ACPI_BATT_STAT_CRITICAL) {
if ((sc->flags & ACPI_BATT_STAT_CRITICAL) == 0) {
sc->flags |= ACPI_BATT_STAT_CRITICAL;
device_printf(dev, "critically low charge!\n");
}
} else
sc->flags &= ~ACPI_BATT_STAT_CRITICAL;
end:
if (bst_buffer.Pointer != NULL)
AcpiOsFree(bst_buffer.Pointer);
}
示例6: acpi_cmbat_get_bif
static void
acpi_cmbat_get_bif(void *context)
{
device_t dev;
struct acpi_cmbat_softc *sc;
ACPI_STATUS as;
ACPI_OBJECT *res, *tmp;
ACPI_HANDLE h;
ACPI_BUFFER bif_buffer;
dev = context;
sc = device_get_softc(dev);
h = acpi_get_handle(dev);
bif_buffer.Pointer = NULL;
if (!acpi_cmbat_info_expired(&sc->bif_lastupdated)) {
return;
}
if (sc->bif_updating) {
return;
}
sc->bif_updating = 1;
bif_buffer.Length = ACPI_ALLOCATE_BUFFER;
if (ACPI_FAILURE(as = AcpiEvaluateObject(h, "_BIF", NULL, &bif_buffer))) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"error fetching current battery info -- %s\n",
AcpiFormatException(as));
goto end;
}
res = (ACPI_OBJECT *)bif_buffer.Pointer;
if ((res == NULL) || (res->Type != ACPI_TYPE_PACKAGE) || (res->Package.Count != 13)) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery info corrupted\n");
goto end;
}
PKG_GETINT(res, tmp, 0, sc->bif.unit, end);
PKG_GETINT(res, tmp, 1, sc->bif.dcap, end);
PKG_GETINT(res, tmp, 2, sc->bif.lfcap, end);
PKG_GETINT(res, tmp, 3, sc->bif.btech, end);
PKG_GETINT(res, tmp, 4, sc->bif.dvol, end);
PKG_GETINT(res, tmp, 5, sc->bif.wcap, end);
PKG_GETINT(res, tmp, 6, sc->bif.lcap, end);
PKG_GETINT(res, tmp, 7, sc->bif.gra1, end);
PKG_GETINT(res, tmp, 8, sc->bif.gra2, end);
PKG_GETSTR(res, tmp, 9, sc->bif.model, ACPI_CMBAT_MAXSTRLEN, end);
PKG_GETSTR(res, tmp, 10, sc->bif.serial, ACPI_CMBAT_MAXSTRLEN, end);
PKG_GETSTR(res, tmp, 11, sc->bif.type, ACPI_CMBAT_MAXSTRLEN, end);
PKG_GETSTR(res, tmp, 12, sc->bif.oeminfo, ACPI_CMBAT_MAXSTRLEN, end);
acpi_cmbat_info_updated(&sc->bif_lastupdated);
end:
if (bif_buffer.Pointer != NULL)
AcpiOsFree(bif_buffer.Pointer);
sc->bif_updating = 0;
}
示例7: EcTransaction
static ACPI_STATUS
EcTransaction(struct acpi_ec_softc *sc, EC_REQUEST *EcRequest)
{
ACPI_STATUS Status;
/*
* Lock the EC
*/
if (ACPI_FAILURE(Status = EcLock(sc)))
return(Status);
/*
* Perform the transaction.
*/
switch (EcRequest->Command) {
case EC_COMMAND_READ:
Status = EcRead(sc, EcRequest->Address, &(EcRequest->Data));
break;
case EC_COMMAND_WRITE:
Status = EcWrite(sc, EcRequest->Address, &(EcRequest->Data));
break;
default:
Status = AE_SUPPORT;
break;
}
/*
* Unlock the EC
*/
EcUnlock(sc);
/*
* Clear & Re-Enable the EC GPE:
* -----------------------------
* 'Consume' any EC GPE events that we generated while performing
* the transaction (e.g. IBF/OBF). Clearing the GPE here shouldn't
* have an adverse affect on outstanding EC-SCI's, as the source
* (EC-SCI) will still be high and thus should trigger the GPE
* immediately after we re-enabling it.
*/
if (sc->ec_pendquery){
if (ACPI_FAILURE(AcpiOsQueueForExecution(OSD_PRIORITY_HIGH,
EcGpeQueryHandler, sc)))
printf("Pend Query Queuing Failed\n");
sc->ec_pendquery = 0;
}
if (ACPI_FAILURE(AcpiClearEvent(sc->ec_gpebit, ACPI_EVENT_GPE)))
ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
"EcRequest: Unable to clear the EC GPE.\n");
if (ACPI_FAILURE(AcpiEnableEvent(sc->ec_gpebit, ACPI_EVENT_GPE, 0)))
ACPI_VPRINT(sc->ec_dev, acpi_device_get_parent_softc(sc->ec_dev),
"EcRequest: Unable to re-enable the EC GPE.\n");
return(Status);
}
示例8: acpi_cmbat_init_battery
static void
acpi_cmbat_init_battery(void *arg)
{
struct acpi_cmbat_softc *sc;
int retry, valid;
device_t dev;
dev = (device_t)arg;
sc = device_get_softc(dev);
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery initialization start\n");
/*
* Try repeatedly to get valid data from the battery. Since the
* embedded controller isn't always ready just after boot, we may have
* to wait a while.
*/
for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(10000)) {
/* batteries on DOCK can be ejected w/ DOCK during retrying */
if (!device_is_attached(dev))
return;
if (!acpi_BatteryIsPresent(dev))
continue;
/*
* Only query the battery if this is the first try or the specific
* type of info is still invalid.
*/
ACPI_SERIAL_BEGIN(cmbat);
if (retry == 0 || !acpi_battery_bst_valid(&sc->bst)) {
timespecclear(&sc->bst_lastupdated);
acpi_cmbat_get_bst(dev);
}
if (retry == 0 || !acpi_battery_bif_valid(&sc->bif))
acpi_cmbat_get_bif(dev);
valid = acpi_battery_bst_valid(&sc->bst) &&
acpi_battery_bif_valid(&sc->bif);
ACPI_SERIAL_END(cmbat);
if (valid)
break;
}
if (retry == ACPI_CMBAT_RETRY_MAX) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery initialization failed, giving up\n");
} else {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery initialization done, tried %d times\n", retry + 1);
}
}
示例9: acpi_cmbat_init_battery
static void
acpi_cmbat_init_battery(void *arg)
{
int retry;
device_t dev = (device_t)arg;
struct acpi_cmbat_softc *sc = device_get_softc(dev);
#define ACPI_CMBAT_RETRY_MAX 6
if (sc->initializing) {
return;
}
sc->initializing = 1;
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery initialization start\n");
for (retry = 0; retry < ACPI_CMBAT_RETRY_MAX; retry++, AcpiOsSleep(10, 0)) {
sc->present = acpi_BatteryIsPresent(dev);
if (!sc->present) {
continue;
}
timespecclear(&sc->bst_lastupdated);
timespecclear(&sc->bif_lastupdated);
acpi_cmbat_get_bst(dev);
if (!acpi_cmbat_is_bst_valid(&sc->bst)) {
continue;
}
acpi_cmbat_get_bif(dev);
if (!acpi_cmbat_is_bif_valid(&sc->bif)) {
continue;
}
break;
}
if (retry == ACPI_CMBAT_RETRY_MAX)
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery initialization failed, giving up\n");
else
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery initialization done, tried %d times\n",
retry+1);
sc->initializing = 0;
}
示例10: acpi_cmbat_get_bst
static void
acpi_cmbat_get_bst(void *context)
{
device_t dev;
struct acpi_cmbat_softc *sc;
ACPI_STATUS as;
ACPI_OBJECT *res, *tmp;
ACPI_HANDLE h;
ACPI_BUFFER bst_buffer;
dev = context;
sc = device_get_softc(dev);
h = acpi_get_handle(dev);
bst_buffer.Pointer = NULL;
if (!acpi_cmbat_info_expired(&sc->bst_lastupdated)) {
return;
}
if (sc->bst_updating) {
return;
}
sc->bst_updating = 1;
bst_buffer.Length = ACPI_ALLOCATE_BUFFER;
if (ACPI_FAILURE(as = AcpiEvaluateObject(h, "_BST", NULL, &bst_buffer))) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"error fetching current battery status -- %s\n",
AcpiFormatException(as));
goto end;
}
res = (ACPI_OBJECT *)bst_buffer.Pointer;
if ((res == NULL) || (res->Type != ACPI_TYPE_PACKAGE) || (res->Package.Count != 4)) {
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"battery status corrupted\n");
goto end;
}
PKG_GETINT(res, tmp, 0, sc->bst.state, end);
PKG_GETINT(res, tmp, 1, sc->bst.rate, end);
PKG_GETINT(res, tmp, 2, sc->bst.cap, end);
PKG_GETINT(res, tmp, 3, sc->bst.volt, end);
acpi_cmbat_info_updated(&sc->bst_lastupdated);
end:
if (bst_buffer.Pointer != NULL)
AcpiOsFree(bst_buffer.Pointer);
sc->bst_updating = 0;
}
示例11: acpi_lid_notify_status_changed
static void
acpi_lid_notify_status_changed(void *arg)
{
struct acpi_lid_softc *sc;
struct acpi_softc *acpi_sc;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
sc = (struct acpi_lid_softc *)arg;
/*
* Evaluate _LID and check the return value, update lid status.
* Zero: The lid is closed
* Non-zero: The lid is open
*/
if (ACPI_FAILURE(acpi_EvaluateInteger(sc->lid_handle, "_LID", &sc->lid_status)))
return_VOID;
acpi_sc = acpi_device_get_parent_softc(sc->lid_dev);
if (acpi_sc == NULL) {
return_VOID;
}
ACPI_VPRINT(sc->lid_dev, acpi_sc,
"Lid %s\n", sc->lid_status ? "opened" : "closed");
if (sc->lid_status == 0) {
EVENTHANDLER_INVOKE(acpi_sleep_event, acpi_sc->acpi_lid_switch_sx);
} else {
EVENTHANDLER_INVOKE(acpi_wakeup_event, acpi_sc->acpi_lid_switch_sx);
}
return_VOID;
}
示例12: acpi_dock_eject_child
static ACPI_STATUS
acpi_dock_eject_child(ACPI_HANDLE handle, UINT32 level, void *context,
void **status)
{
device_t dock_dev, dev;
ACPI_HANDLE dock_handle;
dock_dev = *(device_t *)context;
dock_handle = acpi_get_handle(dock_dev);
if (!acpi_dock_is_ejd_device(dock_handle, handle))
goto out;
ACPI_VPRINT(dock_dev, acpi_device_get_parent_softc(dock_dev),
"ejecting device for %s\n", acpi_name(handle));
dev = acpi_get_device(handle);
if (dev != NULL && device_is_attached(dev)) {
mtx_lock(&Giant);
device_detach(dev);
mtx_unlock(&Giant);
}
acpi_SetInteger(handle, "_EJ0", 0);
out:
return (AE_OK);
}
示例13: acpi_acad_get_status
static void
acpi_acad_get_status(void *context)
{
struct acpi_acad_softc *sc;
device_t dev;
ACPI_HANDLE h;
int newstatus;
dev = context;
sc = device_get_softc(dev);
h = acpi_get_handle(dev);
newstatus = -1;
acpi_GetInteger(h, "_PSR", &newstatus);
/* If status is valid and has changed, notify the system. */
ACPI_SERIAL_BEGIN(acad);
if (newstatus != -1 && sc->status != newstatus) {
sc->status = newstatus;
power_profile_set_state(newstatus ? POWER_PROFILE_PERFORMANCE :
POWER_PROFILE_ECONOMY);
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"%s Line\n", newstatus ? "On" : "Off");
acpi_UserNotify("ACAD", h, newstatus);
}
ACPI_SERIAL_END(acad);
}
示例14: acpi_tz_notify_handler
static void
acpi_tz_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
{
struct acpi_tz_softc *sc = (struct acpi_tz_softc *)context;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
switch (notify) {
case TZ_NOTIFY_TEMPERATURE:
/* Temperature change occurred */
acpi_tz_signal(sc, 0);
break;
case TZ_NOTIFY_DEVICES:
case TZ_NOTIFY_LEVELS:
/* Zone devices/setpoints changed */
acpi_tz_signal(sc, TZ_FLAG_GETSETTINGS);
break;
default:
ACPI_VPRINT(sc->tz_dev, acpi_device_get_parent_softc(sc->tz_dev),
"unknown Notify event 0x%x\n", notify);
break;
}
acpi_UserNotify("Thermal", h, notify);
return_VOID;
}
示例15: acpi_tz_power_profile
/*
* System power profile may have changed; fetch and notify the
* thermal zone accordingly.
*
* Since this can be called from an arbitrary eventhandler, it needs
* to get the ACPI lock itself.
*/
static void
acpi_tz_power_profile(void *arg)
{
ACPI_STATUS status;
struct acpi_tz_softc *sc = (struct acpi_tz_softc *)arg;
int state;
state = power_profile_get_state();
if (state != POWER_PROFILE_PERFORMANCE && state != POWER_PROFILE_ECONOMY)
return;
/* check that we haven't decided there's no _SCP method */
if ((sc->tz_flags & TZ_FLAG_NO_SCP) == 0) {
/* Call _SCP to set the new profile */
status = acpi_SetInteger(sc->tz_handle, "_SCP",
(state == POWER_PROFILE_PERFORMANCE) ? 0 : 1);
if (ACPI_FAILURE(status)) {
if (status != AE_NOT_FOUND)
ACPI_VPRINT(sc->tz_dev,
acpi_device_get_parent_softc(sc->tz_dev),
"can't evaluate %s._SCP - %s\n",
acpi_name(sc->tz_handle),
AcpiFormatException(status));
sc->tz_flags |= TZ_FLAG_NO_SCP;
} else {
/* We have to re-evaluate the entire zone now */
acpi_tz_signal(sc, TZ_FLAG_GETSETTINGS);
}
}
}