本文整理汇总了C++中ACPI_SERIAL_END函数的典型用法代码示例。如果您正苦于以下问题:C++ ACPI_SERIAL_END函数的具体用法?C++ ACPI_SERIAL_END怎么用?C++ ACPI_SERIAL_END使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACPI_SERIAL_END函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acpi_cmbat_bif
static int
acpi_cmbat_bif(device_t dev, struct acpi_bif *bifp)
{
struct acpi_cmbat_softc *sc;
sc = device_get_softc(dev);
/*
* Just copy the data. The only value that should change is the
* last-full capacity, so we only update when we get a notify that says
* the info has changed. Many systems apparently take a long time to
* process a _BIF call so we avoid it if possible.
*/
ACPI_SERIAL_BEGIN(cmbat);
bifp->units = sc->bif.units;
bifp->dcap = sc->bif.dcap;
bifp->lfcap = sc->bif.lfcap;
bifp->btech = sc->bif.btech;
bifp->dvol = sc->bif.dvol;
bifp->wcap = sc->bif.wcap;
bifp->lcap = sc->bif.lcap;
bifp->gra1 = sc->bif.gra1;
bifp->gra2 = sc->bif.gra2;
strncpy(bifp->model, sc->bif.model, sizeof(sc->bif.model));
strncpy(bifp->serial, sc->bif.serial, sizeof(sc->bif.serial));
strncpy(bifp->type, sc->bif.type, sizeof(sc->bif.type));
strncpy(bifp->oeminfo, sc->bif.oeminfo, sizeof(sc->bif.oeminfo));
ACPI_SERIAL_END(cmbat);
return (0);
}
示例2: acpi_panasonic_sysctl
static int
acpi_panasonic_sysctl(SYSCTL_HANDLER_ARGS)
{
struct acpi_panasonic_softc *sc;
UINT32 arg;
int function, error;
hkey_fn_t *handler;
sc = (struct acpi_panasonic_softc *)oidp->oid_arg1;
function = oidp->oid_arg2;
handler = sysctl_table[function].handler;
/* Get the current value from the appropriate function. */
ACPI_SERIAL_BEGIN(panasonic);
error = handler(sc->handle, HKEY_GET, &arg);
if (error != 0)
goto out;
/* Send the current value to the user and return if no new value. */
error = sysctl_handle_int(oidp, &arg, 0, req);
if (error != 0 || req->newptr == NULL)
goto out;
/* Set the new value via the appropriate function. */
error = handler(sc->handle, HKEY_SET, &arg);
out:
ACPI_SERIAL_END(panasonic);
return (error);
}
示例3: acpi_pci_link_resume
static int
acpi_pci_link_resume(device_t dev)
{
struct acpi_pci_link_softc *sc;
ACPI_STATUS status;
int i, routed;
/*
* If all of our links are routed, then restore the link via _SRS,
* otherwise, disable the link via _DIS.
*/
ACPI_SERIAL_BEGIN(pci_link);
sc = device_get_softc(dev);
routed = 0;
for (i = 0; i < sc->pl_num_links; i++)
if (sc->pl_links[i].l_routed)
routed++;
if (routed == sc->pl_num_links)
status = acpi_pci_link_route_irqs(dev);
else {
AcpiEvaluateObject(acpi_get_handle(dev), "_DIS", NULL, NULL);
status = AE_OK;
}
ACPI_SERIAL_END(pci_link);
if (ACPI_FAILURE(status))
return (ENXIO);
else
return (0);
}
示例4: acpi_fujitsu_sysctl
static int
acpi_fujitsu_sysctl(SYSCTL_HANDLER_ARGS)
{
struct acpi_fujitsu_softc *sc;
int method;
int arg;
int function_num, error = 0;
sc = (struct acpi_fujitsu_softc *)oidp->oid_arg1;
function_num = oidp->oid_arg2;
method = sysctl_table[function_num].method;
ACPI_SERIAL_BEGIN(fujitsu);
/* Get the current value */
arg = acpi_fujitsu_method_get(sc, method);
error = sysctl_handle_int(oidp, &arg, 0, req);
if (error != 0 || req->newptr == NULL)
goto out;
/* Update the value */
error = acpi_fujitsu_method_set(sc, method, arg);
out:
ACPI_SERIAL_END(fujitsu);
return (error);
}
示例5: EcUnlock
static void
EcUnlock(struct acpi_ec_softc *sc)
{
if (sc->ec_glk)
AcpiReleaseGlobalLock(sc->ec_glkhandle);
ACPI_SERIAL_END(ec);
}
示例6: acpi_cpu_global_cx_lowest_sysctl
static int
acpi_cpu_global_cx_lowest_sysctl(SYSCTL_HANDLER_ARGS)
{
struct acpi_cpu_softc *sc;
char state[8];
int val, error, i;
snprintf(state, sizeof(state), "C%d", cpu_cx_lowest + 1);
error = sysctl_handle_string(oidp, state, sizeof(state), req);
if (error != 0 || req->newptr == NULL)
return (error);
if (strlen(state) < 2 || toupper(state[0]) != 'C')
return (EINVAL);
val = (int) strtol(state + 1, NULL, 10) - 1;
if (val < 0 || val > cpu_cx_count - 1)
return (EINVAL);
cpu_cx_lowest = val;
/* Update the new lowest useable Cx state for all CPUs. */
ACPI_SERIAL_BEGIN(cpu);
for (i = 0; i < cpu_ndevices; i++) {
sc = device_get_softc(cpu_devices[i]);
acpi_cpu_set_cx_lowest(sc, val);
}
ACPI_SERIAL_END(cpu);
return (0);
}
示例7: acpi_cmbat_get_bif_task
/* XXX There should be a cleaner way to do this locking. */
static void
acpi_cmbat_get_bif_task(void *arg)
{
ACPI_SERIAL_BEGIN(cmbat);
acpi_cmbat_get_bif(arg);
ACPI_SERIAL_END(cmbat);
}
示例8: acpi_pci_link_route_interrupt
int
acpi_pci_link_route_interrupt(device_t dev, int index)
{
struct link *link;
if (acpi_disabled("pci_link"))
return (PCI_INVALID_IRQ);
ACPI_SERIAL_BEGIN(pci_link);
link = acpi_pci_link_lookup(dev, index);
if (link == NULL)
panic("%s: apparently invalid index %d", __func__, index);
/*
* If this link device is already routed to an interrupt, just return
* the interrupt it is routed to.
*/
if (link->l_routed) {
KASSERT(PCI_INTERRUPT_VALID(link->l_irq),
("%s: link is routed but has an invalid IRQ", __func__));
ACPI_SERIAL_END(pci_link);
return (link->l_irq);
}
/* Choose an IRQ if we need one. */
if (!PCI_INTERRUPT_VALID(link->l_irq)) {
link->l_irq = acpi_pci_link_choose_irq(dev, link);
/*
* Try to route the interrupt we picked. If it fails, then
* assume the interrupt is not routed.
*/
if (PCI_INTERRUPT_VALID(link->l_irq)) {
acpi_pci_link_route_irqs(dev);
if (!link->l_routed)
link->l_irq = PCI_INVALID_IRQ;
}
}
ACPI_SERIAL_END(pci_link);
return (link->l_irq);
}
示例9: 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);
}
}
示例10: acpi_battery_register
int
acpi_battery_register(device_t dev)
{
int error;
error = 0;
ACPI_SERIAL_BEGIN(battery);
if (!acpi_batteries_initted)
error = acpi_battery_init();
ACPI_SERIAL_END(battery);
return (error);
}
示例11: acpi_panasonic_power_profile
static void
acpi_panasonic_power_profile(void *arg)
{
ACPI_HANDLE handle;
UINT32 brightness;
handle = (ACPI_HANDLE)arg;
/* Reset current brightness according to new power state. */
ACPI_SERIAL_BEGIN(panasonic);
hkey_lcd_brightness(handle, HKEY_GET, &brightness);
hkey_lcd_brightness(handle, HKEY_SET, &brightness);
ACPI_SERIAL_END(panasonic);
}
示例12: acpi_dock_attach
static int
acpi_dock_attach(device_t dev)
{
struct acpi_dock_softc *sc;
ACPI_HANDLE h;
sc = device_get_softc(dev);
h = acpi_get_handle(dev);
if (sc == NULL || h == NULL)
return (ENXIO);
sc->status = ACPI_DOCK_STATUS_UNKNOWN;
AcpiEvaluateObject(h, "_INI", NULL, NULL);
ACPI_SERIAL_BEGIN(dock);
acpi_dock_device_check(dev);
/* Get the sysctl tree */
sc->sysctl_ctx = device_get_sysctl_ctx(dev);
sc->sysctl_tree = device_get_sysctl_tree(dev);
SYSCTL_ADD_INT(sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree),
OID_AUTO, "_sta", CTLFLAG_RD,
&sc->_sta, 0, "Dock _STA");
SYSCTL_ADD_INT(sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree),
OID_AUTO, "_bdn", CTLFLAG_RD,
&sc->_bdn, 0, "Dock _BDN");
SYSCTL_ADD_INT(sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree),
OID_AUTO, "_uid", CTLFLAG_RD,
&sc->_uid, 0, "Dock _UID");
SYSCTL_ADD_PROC(sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree),
OID_AUTO, "status",
CTLTYPE_INT|CTLFLAG_RW, dev, 0,
acpi_dock_status_sysctl, "I",
"Dock/Undock operation");
ACPI_SERIAL_END(dock);
AcpiInstallNotifyHandler(h, ACPI_ALL_NOTIFY,
acpi_dock_notify_handler, dev);
return (0);
}
示例13: EcLock
static ACPI_STATUS
EcLock(struct acpi_ec_softc *sc)
{
ACPI_STATUS status;
ACPI_SERIAL_BEGIN(ec);
/* If _GLK is non-zero, acquire the global lock. */
status = AE_OK;
if (sc->ec_glk) {
status = AcpiAcquireGlobalLock(EC_LOCK_TIMEOUT, &sc->ec_glkhandle);
if (ACPI_FAILURE(status))
ACPI_SERIAL_END(ec);
}
return (status);
}
示例14: acpi_fujitsu_notify_status_changed
static void
acpi_fujitsu_notify_status_changed(void *arg)
{
struct acpi_fujitsu_softc *sc;
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
sc = (struct acpi_fujitsu_softc *)arg;
/*
* Since our notify function is called, we know something has
* happened. So the only reason for acpi_fujitsu_update to fail
* is if we can't find what has changed or an error occurs.
*/
ACPI_SERIAL_BEGIN(fujitsu);
acpi_fujitsu_update(sc);
ACPI_SERIAL_END(fujitsu);
}
示例15: acpi_pci_set_powerstate_method
/*
* PCI power manangement
*/
static int
acpi_pci_set_powerstate_method(device_t dev, device_t child, int state)
{
ACPI_HANDLE h;
ACPI_STATUS status;
int old_state, error;
error = 0;
if (state < ACPI_STATE_D0 || state > ACPI_STATE_D3)
return (EINVAL);
/*
* We set the state using PCI Power Management outside of setting
* the ACPI state. This means that when powering down a device, we
* first shut it down using PCI, and then using ACPI, which lets ACPI
* try to power down any Power Resources that are now no longer used.
* When powering up a device, we let ACPI set the state first so that
* it can enable any needed Power Resources before changing the PCI
* power state.
*/
ACPI_SERIAL_BEGIN(pci_powerstate);
old_state = pci_get_powerstate(child);
if (old_state < state && pci_do_power_suspend) {
error = pci_set_powerstate_method(dev, child, state);
if (error)
goto out;
}
h = acpi_get_handle(child);
status = acpi_pwr_switch_consumer(h, state);
if (ACPI_SUCCESS(status)) {
if (bootverbose)
device_printf(dev, "set ACPI power state D%d on %s\n",
state, acpi_name(h));
} else if (status != AE_NOT_FOUND)
device_printf(dev,
"failed to set ACPI power state D%d on %s: %s\n",
state, acpi_name(h), AcpiFormatException(status));
if (old_state > state && pci_do_power_resume)
error = pci_set_powerstate_method(dev, child, state);
out:
ACPI_SERIAL_END(pci_powerstate);
return (error);
}