Lines Matching +full:cold +full:- +full:temp

1 /*-
283 acpi_ca_version, 0, "Version of Intel ACPI-CA");
346 if (!cold) { in acpi_modevent()
352 if (!cold && power_pm_get_type() == POWER_PM_TYPE_ACPI) in acpi_modevent()
388 * Pre-allocate space for RSDT/XSDT and DSDT tables and allow resizing in acpi_Startup()
401 /* If the user manually set the disabled hint to 0, force-enable ACPI. */ in acpi_Startup()
425 if (!cold) in acpi_identify()
448 if (rsdp->Revision > 1 && rsdp->XsdtPhysicalAddress != 0) in acpi_identify()
449 paddr = (ACPI_PHYSICAL_ADDRESS)rsdp->XsdtPhysicalAddress; in acpi_identify()
451 paddr = (ACPI_PHYSICAL_ADDRESS)rsdp->RsdtPhysicalAddress; in acpi_identify()
457 sbuf_bcat(&sb, rsdt->OemId, ACPI_OEM_ID_SIZE); in acpi_identify()
460 sbuf_bcat(&sb, rsdt->OemTableId, ACPI_OEM_TABLE_ID_SIZE); in acpi_identify()
499 sc->acpi_dev = dev; in acpi_attach()
500 callout_init(&sc->susp_force_to, 1); in acpi_attach()
516 resource_list_init(&sc->sysres_rl); in acpi_attach()
522 * Set the globals from our tunables. This is needed because ACPI-CA in acpi_attach()
595 sysctl_ctx_init(&sc->acpi_sysctl_ctx); in acpi_attach()
596 sc->acpi_sysctl_tree = SYSCTL_ADD_NODE(&sc->acpi_sysctl_ctx, in acpi_attach()
599 SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
604 SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
607 &sc->acpi_power_button_stype, 0, acpi_stype_sysctl, "A", in acpi_attach()
609 SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
612 &sc->acpi_sleep_button_stype, 0, acpi_stype_sysctl, "A", in acpi_attach()
614 SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
617 &sc->acpi_lid_switch_stype, 0, acpi_stype_sysctl, "A", in acpi_attach()
620 SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
625 SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
628 &sc->acpi_standby_sx, 0, acpi_sleep_state_sysctl, "A", in acpi_attach()
630 SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
631 OID_AUTO, "sleep_delay", CTLFLAG_RW, &sc->acpi_sleep_delay, 0, in acpi_attach()
633 SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
634 OID_AUTO, "s4bios", CTLFLAG_RW, &sc->acpi_s4bios, 0, in acpi_attach()
636 SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
637 OID_AUTO, "verbose", CTLFLAG_RW, &sc->acpi_verbose, 0, "verbose mode"); in acpi_attach()
638 SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
640 &sc->acpi_do_disable, 0, "Disable ACPI when rebooting/halting system"); in acpi_attach()
641 SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
643 &sc->acpi_handle_reboot, 0, "Use ACPI Reset Register to reboot"); in acpi_attach()
652 SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), in acpi_attach()
655 "Force active-hi polarity for edge-triggered ISA IRQs"); in acpi_attach()
662 sc->acpi_sleep_delay = 1; in acpi_attach()
664 sc->acpi_verbose = 1; in acpi_attach()
667 sc->acpi_verbose = 1; in acpi_attach()
673 sc->acpi_handle_reboot = 1; in acpi_attach()
677 if (AcpiGbl_FACS != NULL && AcpiGbl_FACS->Flags & ACPI_FACS_S4_BIOS_PRESENT) in acpi_attach()
678 sc->acpi_s4bios = 1; in acpi_attach()
698 sc->acpi_power_button_stype = acpi_supported_stypes[POWER_STYPE_POWEROFF] ? in acpi_attach()
700 sc->acpi_lid_switch_stype = POWER_STYPE_UNKNOWN; in acpi_attach()
702 sc->acpi_standby_sx = ACPI_STATE_UNKNOWN; in acpi_attach()
704 sc->acpi_standby_sx = ACPI_STATE_S1; in acpi_attach()
706 sc->acpi_standby_sx = ACPI_STATE_S2; in acpi_attach()
709 sc->acpi_sleep_button_stype = POWER_STYPE_UNKNOWN; in acpi_attach()
712 sc->acpi_sleep_button_stype = stype; in acpi_attach()
736 sc->acpi_enabled = TRUE; in acpi_attach()
737 sc->acpi_stype = POWER_STYPE_AWAKE; in acpi_attach()
738 sc->acpi_sleep_disabled = TRUE; in acpi_attach()
741 sc->acpi_dev_t = make_dev(&acpi_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0664, in acpi_attach()
743 sc->acpi_dev_t->si_drv1 = sc; in acpi_attach()
783 return (sc->acpi_standby_sx); in acpi_stype_to_sstate()
800 * acpi_EnterSleepState and acpi_ReqSleepState to take in actual ACPI S-states,
801 * which won't be possible at the moment because suspend-to-idle (which is not
802 * an ACPI S-state nor maps to one) will be implemented here.
805 * to enable suspend-to-idle on non-ACPI builds, and then make
806 * acpi_EnterSleepState and acpi_ReqSleepState truly take in ACPI S-states
839 * Retrieve and set D-state for the sleep state if _SxD is present. in acpi_set_power_children()
888 * Enable any GPEs that are able to power-on the system (i.e., RTC). in acpi_shutdown()
908 ad->ad_domain = ACPI_DEV_DOMAIN_UNKNOWN; in acpi_add_child()
909 resource_list_init(&ad->ad_rl); in acpi_add_child()
923 struct resource_list *rl = &adev->ad_rl; in acpi_print_child()
991 if (dinfo->ad_handle) { in acpi_child_location_method()
992 sbuf_printf(sb, "handle=%s", acpi_name(dinfo->ad_handle)); in acpi_child_location_method()
993 if (ACPI_SUCCESS(acpi_GetInteger(dinfo->ad_handle, "_PXM", &pxm))) { in acpi_child_location_method()
1012 (adinfo->Valid & ACPI_VALID_HID) ? in acpi_pnpinfo()
1013 adinfo->HardwareId.String : "none", in acpi_pnpinfo()
1014 (adinfo->Valid & ACPI_VALID_UID) ? in acpi_pnpinfo()
1015 strtoul(adinfo->UniqueId.String, NULL, 10) : 0UL, in acpi_pnpinfo()
1016 ((adinfo->Valid & ACPI_VALID_CID) && in acpi_pnpinfo()
1017 adinfo->CompatibleIdList.Count > 0) ? in acpi_pnpinfo()
1018 adinfo->CompatibleIdList.Ids[0].String : "none"); in acpi_pnpinfo()
1029 return (acpi_pnpinfo(dinfo->ad_handle, sb)); in acpi_child_pnpinfo_method()
1061 if (!ACPI_FAILURE(AcpiGetObjectInfo(dinfo->ad_handle, &adinfo)) && in acpi_get_device_path()
1062 dinfo->ad_handle != 0 && (adinfo->Valid & ACPI_VALID_HID)) { in acpi_get_device_path()
1063 const char *hid = adinfo->HardwareId.String; in acpi_get_device_path()
1064 u_long uid = (adinfo->Valid & ACPI_VALID_UID) ? in acpi_get_device_path()
1065 strtoul(adinfo->UniqueId.String, NULL, 10) : 0UL; in acpi_get_device_path()
1117 if (acpi_get_device(dinfo->ad_handle) == child) in acpi_child_deleted()
1118 AcpiDetachData(dinfo->ad_handle, acpi_fake_objhandler); in acpi_child_deleted()
1122 * Handle per-device ivars
1137 *(ACPI_HANDLE *)result = ad->ad_handle; in acpi_read_ivar()
1140 *(void **)result = ad->ad_private; in acpi_read_ivar()
1143 *(int *)result = ad->ad_flags; in acpi_read_ivar()
1146 *(int *)result = ad->ad_domain; in acpi_read_ivar()
1151 *(int *)result = -1; in acpi_read_ivar()
1157 *(uint8_t*)result = (ad->ad_cls_class >> 16) & 0xff; in acpi_read_ivar()
1160 *(uint8_t*)result = (ad->ad_cls_class >> 8) & 0xff; in acpi_read_ivar()
1163 *(uint8_t*)result = (ad->ad_cls_class >> 0) & 0xff; in acpi_read_ivar()
1184 ad->ad_handle = (ACPI_HANDLE)value; in acpi_write_ivar()
1187 ad->ad_private = (void *)value; in acpi_write_ivar()
1190 ad->ad_flags = (int)value; in acpi_write_ivar()
1193 ad->ad_domain = (int)value; in acpi_write_ivar()
1212 return (&ad->ad_rl); in acpi_get_rlist()
1219 struct resource_list *rl = &ad->ad_rl; in acpi_match_resource_hint()
1223 if (rle->type != type) in acpi_match_resource_hint()
1225 if (rle->start <= value && rle->end >= value) in acpi_match_resource_hint()
1340 * -2 is returned. If any other error occurs, -1 is returned.
1353 return (-2); in acpi_pxm_parse()
1358 return (-2); in acpi_pxm_parse()
1361 return (-1); in acpi_pxm_parse()
1420 * Pre-allocate/manage all memory and IO resources. Since rman can't handle
1435 * had multi-pass probe/attach. in acpi_sysres_alloc()
1445 STAILQ_FOREACH(rle, &sc->sysres_rl, link) { in acpi_sysres_alloc()
1446 if (rle->res != NULL) { in acpi_sysres_alloc()
1447 device_printf(dev, "duplicate resource for %jx\n", rle->start); in acpi_sysres_alloc()
1452 rm = acpi_get_rman(dev, rle->type, 0); in acpi_sysres_alloc()
1456 /* Pre-allocate resource and add to our rman pool. */ in acpi_sysres_alloc()
1457 res = bus_alloc_resource(dev, rle->type, in acpi_sysres_alloc()
1458 &rle->rid, rle->start, rle->start + rle->count - 1, rle->count, in acpi_sysres_alloc()
1462 rle->res = res; in acpi_sysres_alloc()
1465 rle->start, rle->count, rle->type); in acpi_sysres_alloc()
1472 * namespace scan once the boot-time attach of devices has completed.
1474 * Ideally reserving firmware-assigned resources would work in a
1475 * depth-first traversal of the device namespace, but this is
1496 rl = &ad->ad_rl; in acpi_reserve_resources()
1508 if (rle->type == SYS_RES_IRQ) in acpi_reserve_resources()
1516 if (rle->res != NULL) in acpi_reserve_resources()
1525 * acpi_alloc_resource() will sub-alloc from the system in acpi_reserve_resources()
1528 resource_list_reserve(rl, dev, children[i], rle->type, &rle->rid, in acpi_reserve_resources()
1529 rle->start, rle->end, rle->count, 0); in acpi_reserve_resources()
1540 struct resource_list *rl = &ad->ad_rl; in acpi_set_resource()
1559 end = (start + count - 1); in acpi_set_resource()
1584 rl = &ad->ad_rl; in acpi_alloc_resource()
1588 * devices. That is, if a non-default range is specified for in acpi_alloc_resource()
1621 start = rle->start; in acpi_alloc_resource()
1622 end = rle->end; in acpi_alloc_resource()
1623 count = rle->count; in acpi_alloc_resource()
1635 if (res == NULL && start + count - 1 == end) in acpi_alloc_resource()
1661 STAILQ_FOREACH(rle, &sc->sysres_rl, link) { in acpi_managed_resource()
1662 if (rle->type != rman_get_type(r) || rle->res == NULL) in acpi_managed_resource()
1664 if (rman_get_start(r) >= rman_get_start(rle->res) && in acpi_managed_resource()
1665 rman_get_end(r) <= rman_get_end(rle->res)) in acpi_managed_resource()
1666 return (rle->res); in acpi_managed_resource()
1751 args.offset = start - rman_get_start(sysres); in acpi_map_resource()
1783 switch (gas->SpaceId) { in acpi_bus_alloc_gas()
1798 if (gas->BitWidth && gas->BitWidth < 8) in acpi_bus_alloc_gas()
1799 gas->BitWidth = 8; in acpi_bus_alloc_gas()
1802 if (gas->Address == 0 || gas->BitWidth == 0) in acpi_bus_alloc_gas()
1805 bus_set_resource(dev, res_type, *rid, gas->Address, in acpi_bus_alloc_gas()
1806 gas->BitWidth / 8); in acpi_bus_alloc_gas()
1832 pnpid = (devinfo->Valid & ACPI_VALID_HID) != 0 && in acpi_isa_get_logicalid()
1833 devinfo->HardwareId.Length >= ACPI_EISAID_STRING_SIZE ? in acpi_isa_get_logicalid()
1834 PNP_EISAID(devinfo->HardwareId.String) : 0; in acpi_isa_get_logicalid()
1858 if ((devinfo->Valid & ACPI_VALID_CID) == 0) { in acpi_isa_get_compatid()
1863 if (devinfo->CompatibleIdList.Count < count) in acpi_isa_get_compatid()
1864 count = devinfo->CompatibleIdList.Count; in acpi_isa_get_compatid()
1865 ids = devinfo->CompatibleIdList.Ids; in acpi_isa_get_compatid()
1933 if (ad->dsd_pkg == NULL) { in acpi_device_get_prop()
1934 if (ad->dsd.Pointer == NULL) { in acpi_device_get_prop()
1943 for (i = 0; i < ad->dsd_pkg->Package.Count; i ++) { in acpi_device_get_prop()
1944 pkg = &ad->dsd_pkg->Package.Elements[i]; in acpi_device_get_prop()
1945 if (pkg->Type != ACPI_TYPE_PACKAGE || pkg->Package.Count != 2) in acpi_device_get_prop()
1948 name = &pkg->Package.Elements[0]; in acpi_device_get_prop()
1949 val = &pkg->Package.Elements[1]; in acpi_device_get_prop()
1950 if (name->Type != ACPI_TYPE_STRING) in acpi_device_get_prop()
1952 if (strncmp(propname, name->String.Pointer, name->String.Length) == 0) { in acpi_device_get_prop()
1969 ad->dsd.Length = ACPI_ALLOCATE_BUFFER; in acpi_find_dsd()
1970 ad->dsd.Pointer = NULL; in acpi_find_dsd()
1971 ad->dsd_pkg = NULL; in acpi_find_dsd()
1973 status = AcpiEvaluateObject(ad->ad_handle, "_DSD", NULL, &ad->dsd); in acpi_find_dsd()
1977 dsd = ad->dsd.Pointer; in acpi_find_dsd()
1978 guid = &dsd->Package.Elements[0]; in acpi_find_dsd()
1979 pkg = &dsd->Package.Elements[1]; in acpi_find_dsd()
1981 if (guid->Type != ACPI_TYPE_BUFFER || pkg->Type != ACPI_TYPE_PACKAGE || in acpi_find_dsd()
1982 guid->Buffer.Length != sizeof(acpi_dsd_uuid)) in acpi_find_dsd()
1984 if (memcmp(guid->Buffer.Pointer, &acpi_dsd_uuid, in acpi_find_dsd()
1987 ad->dsd_pkg = pkg; in acpi_find_dsd()
2000 if (hobj->Type != ACPI_TYPE_PACKAGE) in acpi_bus_get_prop_handle()
2002 if (hobj->Package.Count != 1) in acpi_bus_get_prop_handle()
2005 pobj = &hobj->Package.Elements[0]; in acpi_bus_get_prop_handle()
2008 if (pobj->Type != ACPI_TYPE_LOCAL_REFERENCE) in acpi_bus_get_prop_handle()
2020 return (-1); in acpi_bus_get_prop_handle()
2033 return (-1); in acpi_bus_get_prop()
2044 return (-1); in acpi_bus_get_prop()
2047 switch (obj->Type) { in acpi_bus_get_prop()
2051 *((uint32_t *)propvalue) = obj->Integer.Value; in acpi_bus_get_prop()
2055 *((uint64_t *) propvalue) = obj->Integer.Value; in acpi_bus_get_prop()
2061 return (-1); in acpi_bus_get_prop()
2064 memcpy(propvalue, obj->String.Pointer, in acpi_bus_get_prop()
2065 MIN(size, obj->String.Length)); in acpi_bus_get_prop()
2066 return (obj->String.Length); in acpi_bus_get_prop()
2070 memcpy(propvalue, obj->Buffer.Pointer, in acpi_bus_get_prop()
2071 MIN(size, obj->Buffer.Length)); in acpi_bus_get_prop()
2072 return (obj->Buffer.Length); in acpi_bus_get_prop()
2124 snprintf(sxd, sizeof(sxd), "_S%dD", acpi_stype_to_sstate(sc, sc->acpi_stype)); in acpi_device_pwr_for_sleep()
2155 if (acpi_avoid(h) || h == ctx->parent) in acpi_device_scan_cb()
2171 status = ctx->user_fn(h, &dev, level, ctx->arg); in acpi_device_scan_cb()
2247 * ISA-style drivers attached to ACPI may persist and in acpi_isa_pnp_probe()
2256 while (ids && ids->ip_id) { in acpi_isa_pnp_probe()
2257 if (lid == ids->ip_id) { in acpi_isa_pnp_probe()
2262 if (cids[i] == ids->ip_id) { in acpi_isa_pnp_probe()
2271 if (result == 0 && ids->ip_desc) in acpi_isa_pnp_probe()
2272 device_set_desc(child, ids->ip_desc); in acpi_isa_pnp_probe()
2282 * On non-x86 architectures (arm64 for now), this will be done from the
2297 end = (ACPI_MCFG_ALLOCATION *)((char *)hdr + hdr->Length); in acpi_enable_pcie()
2300 pcie_cfgregopen(alloc->Address, alloc->PciSegment, in acpi_enable_pcie()
2301 alloc->StartBusNumber, alloc->EndBusNumber); in acpi_enable_pcie()
2314 /* 0811B06E-4A27-44F9-8D60-3CBBC22E7B48 */ in acpi_platform_osc()
2363 /* Pre-allocate resources for our rman from any sysresource devices. */ in acpi_probe_children()
2473 * breadth-first. Orders less than ACPI_DEV_BASE_ORDER in acpi_probe_child()
2531 ad->ad_cls_class = 0xffffff; in acpi_probe_child()
2533 if ((devinfo->Valid & ACPI_VALID_CLS) != 0 && in acpi_probe_child()
2534 devinfo->ClassCode.Length >= ACPI_PCICLS_STRING_SIZE) { in acpi_probe_child()
2535 ad->ad_cls_class = strtoul(devinfo->ClassCode.String, in acpi_probe_child()
2543 ad->ad_domain = d; in acpi_probe_child()
2575 device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n", in acpi_shutdown_final()
2579 device_printf(sc->acpi_dev, "Powering system off\n"); in acpi_shutdown_final()
2584 device_printf(sc->acpi_dev, "power-off failed - %s\n", in acpi_shutdown_final()
2589 device_printf(sc->acpi_dev, "power-off failed - timeout\n"); in acpi_shutdown_final()
2591 } else if ((howto & RB_HALT) == 0 && sc->acpi_handle_reboot) { in acpi_shutdown_final()
2596 device_printf(sc->acpi_dev, "reset failed - timeout\n"); in acpi_shutdown_final()
2598 device_printf(sc->acpi_dev, "reset failed - %s\n", in acpi_shutdown_final()
2600 } else if (sc->acpi_do_disable && !KERNEL_PANICKED()) { in acpi_shutdown_final()
2605 device_printf(sc->acpi_dev, "Shutting down\n"); in acpi_shutdown_final()
2621 device_printf(sc->acpi_dev, "Power Button (fixed)\n"); in acpi_enable_fixed_events()
2628 device_printf(sc->acpi_dev, "Sleep Button (fixed)\n"); in acpi_enable_fixed_events()
2636 * be attached to. This requires the present, enabled, UI-visible
2637 * and diagnostics-passed bits to be set.
2653 * only returns non-zero for the OS string "Windows 2015". Otherwise it in acpi_DeviceIsPresent()
2712 if ((devinfo->Valid & ACPI_VALID_HID) != 0) in acpi_has_hid()
2714 else if ((devinfo->Valid & ACPI_VALID_CID) != 0) in acpi_has_hid()
2715 if (devinfo->CompatibleIdList.Count > 0) in acpi_has_hid()
2740 if ((devinfo->Valid & ACPI_VALID_HID) != 0 && in acpi_MatchHid()
2741 strcmp(hid, devinfo->HardwareId.String) == 0) in acpi_MatchHid()
2743 else if ((devinfo->Valid & ACPI_VALID_CID) != 0) in acpi_MatchHid()
2744 for (i = 0; i < devinfo->CompatibleIdList.Count; i++) { in acpi_MatchHid()
2745 if (strcmp(hid, devinfo->CompatibleIdList.Ids[i].String) == 0) { in acpi_MatchHid()
2800 buf->Length = size; in acpi_AllocBuffer()
2801 buf->Pointer = (void *)(buf + 1); in acpi_AllocBuffer()
2874 p = (ACPI_OBJECT *)bufp->Pointer; in acpi_ConvertBufferToInteger()
2875 if (p->Type == ACPI_TYPE_INTEGER) { in acpi_ConvertBufferToInteger()
2876 *number = p->Integer.Value; in acpi_ConvertBufferToInteger()
2879 if (p->Type != ACPI_TYPE_BUFFER) in acpi_ConvertBufferToInteger()
2881 if (p->Buffer.Length > sizeof(int)) in acpi_ConvertBufferToInteger()
2885 val = p->Buffer.Pointer; in acpi_ConvertBufferToInteger()
2886 for (i = 0; i < p->Buffer.Length; i++) in acpi_ConvertBufferToInteger()
2904 if (pkg == NULL || pkg->Type != ACPI_TYPE_PACKAGE) in acpi_ForeachPackageObject()
2909 comp = pkg->Package.Elements; in acpi_ForeachPackageObject()
2910 for (; i < pkg->Package.Count; i++, comp++) in acpi_ForeachPackageObject()
2925 rp = (ACPI_RESOURCE *)buf->Pointer; in acpi_FindIndexedResource()
2927 while (i-- > 0) { in acpi_FindIndexedResource()
2929 if (rp > (ACPI_RESOURCE *)((u_int8_t *)buf->Pointer + buf->Length)) in acpi_FindIndexedResource()
2933 if (rp->Type == ACPI_RESOURCE_TYPE_END_TAG || rp->Length == 0) in acpi_FindIndexedResource()
2960 if (buf->Pointer == NULL) { in acpi_AppendBufferResource()
2961 buf->Length = ACPI_INITIAL_RESOURCE_BUFFER_SIZE; in acpi_AppendBufferResource()
2962 if ((buf->Pointer = AcpiOsAllocate(buf->Length)) == NULL) in acpi_AppendBufferResource()
2964 rp = (ACPI_RESOURCE *)buf->Pointer; in acpi_AppendBufferResource()
2965 rp->Type = ACPI_RESOURCE_TYPE_END_TAG; in acpi_AppendBufferResource()
2966 rp->Length = ACPI_RS_SIZE_MIN; in acpi_AppendBufferResource()
2976 rp = (ACPI_RESOURCE *)buf->Pointer; in acpi_AppendBufferResource()
2979 if (rp >= (ACPI_RESOURCE *)((u_int8_t *)buf->Pointer + buf->Length)) in acpi_AppendBufferResource()
2981 if (rp->Type == ACPI_RESOURCE_TYPE_END_TAG || rp->Length == 0) in acpi_AppendBufferResource()
2997 while ((((u_int8_t *)rp - (u_int8_t *)buf->Pointer) + in acpi_AppendBufferResource()
2998 res->Length + ACPI_RS_SIZE_NO_DATA + in acpi_AppendBufferResource()
2999 ACPI_RS_SIZE_MIN) >= buf->Length) { in acpi_AppendBufferResource()
3000 if ((newp = AcpiOsAllocate(buf->Length * 2)) == NULL) in acpi_AppendBufferResource()
3002 bcopy(buf->Pointer, newp, buf->Length); in acpi_AppendBufferResource()
3004 ((u_int8_t *)rp - (u_int8_t *)buf->Pointer)); in acpi_AppendBufferResource()
3005 AcpiOsFree(buf->Pointer); in acpi_AppendBufferResource()
3006 buf->Pointer = newp; in acpi_AppendBufferResource()
3007 buf->Length += buf->Length; in acpi_AppendBufferResource()
3011 bcopy(res, rp, res->Length + ACPI_RS_SIZE_NO_DATA); in acpi_AppendBufferResource()
3015 rp->Type = ACPI_RESOURCE_TYPE_END_TAG; in acpi_AppendBufferResource()
3016 rp->Length = ACPI_RS_SIZE_MIN; in acpi_AppendBufferResource()
3051 switch (obj->Type) { in acpi_DSMQuery()
3053 for (i = 0; i < MIN(obj->Buffer.Length, sizeof(ret)); i++) in acpi_DSMQuery()
3054 ret |= (((uint64_t)obj->Buffer.Pointer[i]) << (i * 8)); in acpi_DSMQuery()
3059 ret = obj->Integer.Value; in acpi_DSMQuery()
3062 ACPI_WARNING((AE_INFO, "Unexpected return type %u\n", obj->Type)); in acpi_DSMQuery()
3154 if (ret->Buffer.Length != count * sizeof(*caps_out)) { in acpi_EvaluateOSC()
3158 bcopy(ret->Buffer.Pointer, caps_out, ret->Buffer.Length); in acpi_EvaluateOSC()
3188 if (entry->Length < sizeof(ACPI_SUBTABLE_HEADER)) in acpi_walk_subtables()
3192 entry = ACPI_ADD_PTR(ACPI_SUBTABLE_HEADER, entry, entry->Length); in acpi_walk_subtables()
3209 device_printf(sc->acpi_dev, in acpi_SetSleepState()
3222 if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_stype))) in acpi_sleep_force_task()
3223 device_printf(sc->acpi_dev, "force sleep state %s failed\n", in acpi_sleep_force_task()
3224 power_stype_to_name(sc->acpi_next_stype)); in acpi_sleep_force_task()
3232 device_printf(sc->acpi_dev, in acpi_sleep_force()
3240 device_printf(sc->acpi_dev, "AcpiOsExecute() for sleeping failed\n"); in acpi_sleep_force()
3266 if (rebooting || sc->acpi_next_stype != POWER_STYPE_AWAKE || in acpi_ReqSleepState()
3271 while (sc->acpi_sleep_disabled) { in acpi_ReqSleepState()
3277 sc->acpi_next_stype = stype; in acpi_ReqSleepState()
3279 /* S5 (soft-off) should be entered directly with no waiting. */ in acpi_ReqSleepState()
3287 STAILQ_FOREACH(clone, &sc->apm_cdevs, entries) { in acpi_ReqSleepState()
3288 clone->notify_status = APM_EV_NONE; in acpi_ReqSleepState()
3289 if ((clone->flags & ACPI_EVF_DEVD) == 0) { in acpi_ReqSleepState()
3290 selwakeuppri(&clone->sel_read, PZERO); in acpi_ReqSleepState()
3291 KNOTE_LOCKED(&clone->sel_read.si_note, 0); in acpi_ReqSleepState()
3309 callout_reset(&sc->susp_force_to, 10 * hz, acpi_sleep_force, sc); in acpi_ReqSleepState()
3325 * error argument is non-zero, it indicates suspend should be cancelled
3338 sc = clone->acpi_sc; in acpi_AckSleepState()
3339 if (sc->acpi_next_stype == POWER_STYPE_AWAKE) { in acpi_AckSleepState()
3346 sc->acpi_next_stype = POWER_STYPE_AWAKE; in acpi_AckSleepState()
3347 callout_stop(&sc->susp_force_to); in acpi_AckSleepState()
3348 device_printf(sc->acpi_dev, in acpi_AckSleepState()
3350 devtoname(clone->cdev)); in acpi_AckSleepState()
3358 * are writable since read-only devices couldn't ack the request. in acpi_AckSleepState()
3361 clone->notify_status = APM_EV_ACKED; in acpi_AckSleepState()
3362 STAILQ_FOREACH(clone, &sc->apm_cdevs, entries) { in acpi_AckSleepState()
3363 if ((clone->flags & ACPI_EVF_WRITE) != 0 && in acpi_AckSleepState()
3364 clone->notify_status != APM_EV_ACKED) { in acpi_AckSleepState()
3372 callout_stop(&sc->susp_force_to); in acpi_AckSleepState()
3376 if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_stype))) in acpi_AckSleepState()
3399 sc->acpi_sleep_disabled = FALSE; in acpi_sleep_enable()
3412 status = sc->acpi_sleep_disabled ? AE_ERROR : AE_OK; in acpi_sleep_disable()
3413 sc->acpi_sleep_disabled = TRUE; in acpi_sleep_disable()
3430 * Currently we support S1-S5 but S4 is only S4BIOS
3447 device_printf(sc->acpi_dev, "Sleep type %s not supported on this " in acpi_EnterSleepState()
3454 /* Re-entry once we're suspending is not allowed. */ in acpi_EnterSleepState()
3457 device_printf(sc->acpi_dev, in acpi_EnterSleepState()
3496 sc->acpi_stype = stype; in acpi_EnterSleepState()
3506 * XXX Note that a better two-pass approach with a 'veto' pass in acpi_EnterSleepState()
3511 device_printf(sc->acpi_dev, "device_suspend failed\n"); in acpi_EnterSleepState()
3518 device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n", in acpi_EnterSleepState()
3524 if (sc->acpi_sleep_delay > 0) in acpi_EnterSleepState()
3525 DELAY(sc->acpi_sleep_delay * 1000000); in acpi_EnterSleepState()
3535 * by ACPI platform (BIOS, firmware) to its pre-sleep state. in acpi_EnterSleepState()
3547 * Prevent mis-interpretation of the wakeup by power button in acpi_EnterSleepState()
3563 device_printf(sc->acpi_dev, in acpi_EnterSleepState()
3575 if (sleep_result == -1) in acpi_EnterSleepState()
3578 /* Re-enable ACPI hardware on wakeup from hibernate. */ in acpi_EnterSleepState()
3586 device_printf(sc->acpi_dev, "AcpiEnterSleepState failed - %s\n", in acpi_EnterSleepState()
3602 sc->acpi_stype = POWER_STYPE_AWAKE; in acpi_EnterSleepState()
3616 sc->acpi_next_stype = POWER_STYPE_AWAKE; in acpi_EnterSleepState()
3654 (void)timecounter->tc_get_timecount(timecounter); in acpi_resync_clock()
3655 inittodr(time_second + sc->acpi_sleep_delay); in acpi_resync_clock()
3700 /* Check that this is a wake-capable device and get its GPE. */ in acpi_wake_sleep_prep()
3739 * Check that this is a wake-capable device and get its GPE. Return in acpi_wake_run_prep()
3752 * disabled before going to sleep so re-enable it. If it was enabled, in acpi_wake_run_prep()
3758 device_printf(dev, "run_prep re-enabled %s\n", acpi_name(handle)); in acpi_wake_run_prep()
3777 acpi_wake_sleep_prep(ctx->sc, handle, ctx->stype); in acpi_wake_prep()
3779 acpi_wake_run_prep(ctx->sc, handle, ctx->stype); in acpi_wake_prep()
3799 /* Walk the tree rooted at acpi0 to attach per-device wake sysctls. */
3843 if (error != 0 || req->newptr == NULL) in acpi_wake_set_sysctl()
3885 if (acpi_PkgInt32(res, 1, &prw->lowest_wake) != 0) in acpi_parse_prw()
3891 switch (res->Package.Elements[0].Type) { in acpi_parse_prw()
3899 prw->gpe_handle = NULL; in acpi_parse_prw()
3900 prw->gpe_bit = res->Package.Elements[0].Integer.Value; in acpi_parse_prw()
3917 res2 = &res->Package.Elements[0]; in acpi_parse_prw()
3920 prw->gpe_handle = acpi_GetReference(NULL, &res2->Package.Elements[0]); in acpi_parse_prw()
3921 if (prw->gpe_handle == NULL) in acpi_parse_prw()
3923 if (acpi_PkgInt32(res2, 1, &prw->gpe_bit) != 0) in acpi_parse_prw()
3932 power_count = res->Package.Count - 2; in acpi_parse_prw()
3937 prw->power_res_count = power_count; in acpi_parse_prw()
3939 prw->power_res[i] = res->Package.Elements[i]; in acpi_parse_prw()
3967 * totally pass an ACPI S-state to an enum power_stype. in acpi_system_eventhandler_sleep()
3971 device_printf(sc->acpi_dev, in acpi_system_eventhandler_sleep()
4019 acpi_invoke_sleep_eventhandler, &sc->acpi_power_button_stype))) in acpi_event_power_button_sleep()
4036 acpi_invoke_wake_eventhandler, &sc->acpi_power_button_stype))) in acpi_event_power_button_wake()
4049 acpi_invoke_sleep_eventhandler, &sc->acpi_sleep_button_stype))) in acpi_event_sleep_button_sleep()
4062 acpi_invoke_wake_eventhandler, &sc->acpi_sleep_button_stype))) in acpi_event_sleep_button_wake()
4069 * use this for single-threaded callers.
4086 * Debugging/bug-avoidance. Avoid trying to fetch info on various
4123 * Debugging/bug-avoidance. Disable ACPI subsystem components.
4209 hp->cmd = cmd; in acpi_register_ioctl()
4210 hp->fn = fn; in acpi_register_ioctl()
4211 hp->arg = arg; in acpi_register_ioctl()
4231 if (hp->cmd == cmd && hp->fn == fn) in acpi_deregister_ioctl()
4263 sc = dev->si_drv1; in acpiioctl()
4271 if (hp->cmd == cmd) in acpiioctl()
4276 return (hp->fn(cmd, addr, hp->arg)); in acpiioctl()
4279 * Core ioctls are not permitted for non-writable user. in acpiioctl()
4292 device_printf(sc->acpi_dev, "power off via acpi ioctl not supported\n"); in acpiioctl()
4297 error = acpi_AckSleepState(sc->acpi_clone, error); in acpiioctl()
4325 sstate = sname[1] - '0'; in acpi_sname_to_sstate()
4330 return (-1); in acpi_sname_to_sstate()
4369 struct acpi_softc *sc = oidp->oid_arg1; in acpi_suspend_state_sysctl()
4377 if (err != 0 || req->newptr == NULL) in acpi_suspend_state_sysctl()
4400 old_sstate = *(int *)oidp->oid_arg1; in acpi_sleep_state_sysctl()
4403 if (error == 0 && req->newptr != NULL) { in acpi_sleep_state_sysctl()
4411 *(int *)oidp->oid_arg1 = new_sstate; in acpi_sleep_state_sysctl()
4424 old_stype = *(enum power_stype *)oidp->oid_arg1; in acpi_stype_sysctl()
4427 if (err != 0 || req->newptr == NULL) in acpi_stype_sysctl()
4439 "S-state has been passed to it. This functionality is " in acpi_stype_sysctl()
4451 *(enum power_stype *)oidp->oid_arg1 = new_stype; in acpi_stype_sysctl()
4558 /* Exceptionally verbose output -- also used in the global "DebugLevel" */
4590 l = ep - cp; in acpi_parse_debug()
4608 if (cold) { in acpi_set_debugging()
4643 char temp[128]; in acpi_debug_sysctl() local
4647 if (strcmp(oidp->oid_arg1, "debug.acpi.layer") == 0) { in acpi_debug_sysctl()
4659 } else if (req->newptr == NULL) { in acpi_debug_sysctl()
4660 for (; tag->name != NULL; tag++) { in acpi_debug_sysctl()
4661 if ((*dbg & tag->value) == tag->value) in acpi_debug_sysctl()
4662 sbuf_printf(&sb, "%s ", tag->name); in acpi_debug_sysctl()
4667 strlcpy(temp, sbuf_data(&sb), sizeof(temp)); in acpi_debug_sysctl()
4670 error = sysctl_handle_string(oidp, temp, sizeof(temp), req); in acpi_debug_sysctl()
4673 if (error == 0 && req->newptr != NULL) { in acpi_debug_sysctl()
4675 kern_setenv((char *)oidp->oid_arg1, temp); in acpi_debug_sysctl()
4701 if (error != 0 || req->newptr == NULL) in acpi_debug_objects_sysctl()
4742 iface->data = malloc(sizeof(*iface->data) * j, M_TEMP, M_WAITOK); in acpi_parse_interfaces()
4743 iface->num = j; in acpi_parse_interfaces()
4749 iface->data[j] = p + i; in acpi_parse_interfaces()
4761 free(iface->data[0], M_TEMP); in acpi_free_interfaces()
4762 free(iface->data, M_TEMP); in acpi_free_interfaces()
4829 if (!cold || resource_disabled("acpi", 0)) in acpi_pm_register()