History log of /freebsd-current/sys/dev/acpica/acpivar.h
Revision Date Author Comments
# 0e1246e3 09-Feb-2024 John Baldwin <jhb@FreeBSD.org>

acpi: Cleanup handling of suballocated resources

For resources suballocated from the system resource rmans, handle
those in the ACPI bus driver without passing them up to the parent.
This means using bus_generic_rman_* for several bus methods for
operations on suballocated resources. For bus_map/unmap_resource,
find the system resource allocated from the parent bus (nexus) that
contains the range being mapped and request a mapping of that parent
resource.

This avoids a layering violation where nexus drivers were previously
asked to manage the activation and mapping of resources created
belonging to the ACPI resource managers.

Note that this does require passing RF_ACTIVE (with RF_UNMAPPED) when
allocating system resources from the parent.

While here, don't assume that the parent bus (nexus) provides a
resource list that sysres resources are placed on. Instead, create a
dedicated resource_list in the ACPI bus driver's softc to hold sysres
resources.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43687


# 0e72b8d3 09-Feb-2024 John Baldwin <jhb@FreeBSD.org>

acpi: Use kobj typedefs for new-bus method prototypes

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D43685


# c6a48851 09-Jan-2024 John Baldwin <jhb@FreeBSD.org>

acpi: Only reserve resources enumerated via _CRS

In particular, don't reserve resources added by drivers via other
means (e.g. acpi_bus_alloc_gas which calls bus_alloc_resource
right after adding the resource).

The intention of reserved resources is to ensure that a resource range
that a bus driver knows is assigned to a device is reserved by the
system even if no driver is attached to the device. This prevents
other "wildcard" resource requests from conflicting with these
resources. For ACPI, the only resources the bus driver knows about
for unattached devices are the resources returned from _CRS. All of
these resources are already reserved now via acpi_reserve_resources
called from acpi_probe_children.

As such, remove the logic from acpi_set_resource to try to reserve
resources when they are set. This permits RF_SHAREABLE to work with
acpi_bus_alloc_gas without requiring hacks like the current one for
CPU device resources in acpi_set_resource.

Reported by: gallatin (RF_SHAREABLE not working)
Diagnosed by: jrtc27


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# cae7d9ec 28-Feb-2022 Warner Losh <imp@FreeBSD.org>

bus: Add ACPI locator support

Add support for printing ACPI paths. This is a bit of a degenerate case
for this interface since it's always just the device handle if the
device has one. But it is illustrtive of how to do this for a few nodes
in the tree.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D32748


# b91fc6c4 27-Jul-2021 Bartlomiej Grzesik <bag@semihalf.com>

acpica: add ACPI_GET_PROPERTY to access Device Specific Data (DSD)

Add lazy acquiring of DSD package, which allows accessing Device
Specific Data.

Reviewed by: manu, mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31596


# d178b1f8 07-Aug-2021 Dmitry Salychev <dsl@mcusim.org>

Parse named nodes from IORT ACPI on arm64

Add the ability to map named components from IORT to their
SMMU or ITS node in order to setup interrupts.
It is now possible to find a node by its name (substring) and
resource ID similar to PCI nodes.
This is needed by work on a driver for NXP's Second Generation
Data Path Acceleration Architecture (DPAA2).

Reviewed by: andrew
MFC after: 2 weeks
Differential Revision:: https://reviews.freebsd.org/D31267


# ddfc9c4c 22-Jun-2021 Warner Losh <imp@FreeBSD.org>

newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf

Now that the upper layers all go through a layer to tie into these
information functions that translates an sbuf into char * and len. The
current interface suffers issues of what to do in cases of truncation,
etc. Instead, migrate all these functions to using struct sbuf and these
issues go away. The caller is also in charge of any memory allocation
and/or expansion that's needed during this process.

Create a bus_generic_child_{pnpinfo,location} and make it default. It
just returns success. This is for those busses that have no information
for these items. Migrate the now-empty routines to using this as
appropriate.

Document these new interfaces with man pages, and oversight from before.

Reviewed by: jhb, bcr
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29937


# 9c6e3774 31-Oct-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

Add plug and play information macroses for ACPI and I2C buses.

Matching table format is compatible with ACPI_ID_PROBE bus method.

Note that while ACPI_ID_PROBE matches against _HID and all _CIDs, current
acpi_pnpinfo_str() exports only _HID and first _CID. That means second
and further _CIDs should be added to both acpi_pnpinfo_str() and
ACPICOMPAT_PNP_INFO if device matching against them is required.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26824


# ae2b074b 31-Oct-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

acpi(9): Add EVENTHANDLERs for video and AC adapter events.

They are required for coming ACPI support in LinuxKPI.

Reviewed by: hselasky, manu (as part of D26603)


# fe64ff3c 31-Oct-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

acpi: Tweak _DSM method evaluation helpers.

- Use ACPI style for _DSM evaluation helper parameter types.
- Constify UUID parameter.
- Increase size of returned DSM function bitmap by acpi_DSMQuery() up to 64
items. Old limit of 8 functions is not sufficient for JEDEC JESD245 NVDIMMs.
- Add new acpi_EvaluateDSMTyped() helper which performs additional return
value type check as compared with acpi_EvaluateDSM().
- Reimplement acpi_EvaluateDSM() on top of the acpi_EvaluateDSMTyped() call.

Reviewed by: scottph, manu
Differential Revision: https://reviews.freebsd.org/D26602


# 82c28121 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

acpica: clean up empty lines in .c and .h files


# f3856e68 17-Jul-2020 Ruslan Bukin <br@FreeBSD.org>

Add acpi_iort_map_pci_smmuv3().

This new function allows us to find the SMMU instance assigned
for a particular PCI RID.

Reviewed by: andrew
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D25687


# e76aab6a 14-May-2020 Mark Johnston <markj@FreeBSD.org>

Call acpi_pxm_set_proximity_info() slightly earlier on x86.

This function is responsible for setting pc_domain in each pcpu
structure. Call it from the main function that starts APs, rather than
a separate SYSINIT. This makes it easier to close the window where
UMA's per-CPU slab allocator may be called while pc_domain is
uninitialized. In particular, the allocator uses pc_domain to allocate
domain-local pages, so allocations before this point end up using domain
0 for everything.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24757


# ddf8c230 09-Mar-2020 Vladimir Kondratyev <wulf@FreeBSD.org>

acpi: Export functions required by upcoming acpi_iicbus driver.


# 294de6bb 18-Feb-2020 Hiroki Sato <hrs@FreeBSD.org>

Add _BIX (Battery Information Extended) object support.

ACPI Control Method Batteries have a _BIF and/or _BIX object which
provide static properties of the battery. FreeBSD acpi_cmbat module
supported _BIF object only, which was deprecated as of ACPI 4.0.
_BIX is an extended version of _BIF defined in ACPI 4.0 or later.

As of writing, _BIX has two revisions. One is in ACPI 4.0 (rev.0) and
another is in ACPI 6.0 (rev.1). It seems that hardware vendors still
stick to _BIF only or _BIX rev.0 + _BIF for the maximum compatibility.
Microsoft requires _BIX rev.0 for Windows machines, so there are some
laptop machines with _BIX rev.0 only. In this case, FreeBSD does not
recognize the battery information.

After this change, the acpi_cmbat module gets battery information from
_BIX or _BIF object and internally uses _BIX rev.1 data structure as
the primary information store in the kernel. ACPIIO_BATT_GET_BI[FX]
returns an acpi_bi[fx] structure built by using information obtained
from a _BIF or a _BIX object found on the system. The revision number
field can be used to check which field is available. The acpiconf(8)
utility will show additional information if _BIX is available.

Although ABIs of ACPIIO_BATT_* were changed, the existing APIs for
userland utilities are not changed and the backward-compatible ABIs
are provided. This means that older versions of acpiconf(8) can also
work with the new kernel. The (union acpi_battery_ioctl_arg) was
padded to 256 byte long to avoid another ABI change in the future.
A _BIX object with its revision number >1 will be treated as
compatible with the rev.1 _BIX format.

Reviewed by: takawata
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D23728


# a5e5548c 18-Aug-2019 Jeff Roberson <jeff@FreeBSD.org>

Allocate all per-cpu datastructures in domain correct memory.

Reviewed by: kib, gallatin (some objections)
Tested by: pho
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21242


# e2e050c8 19-May-2019 Conrad Meyer <cem@FreeBSD.org>

Extract eventfilter declarations to sys/_eventfilter.h

This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h"
in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header
pollution substantially.

EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c
files into appropriate headers (e.g., sys/proc.h, powernv/opal.h).

As a side effect of reduced header pollution, many .c files and headers no
longer contain needed definitions. The remainder of the patch addresses
adding appropriate includes to fix those files.

LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by
sys/mutex.h since r326106 (but silently protected by header pollution prior
to this change).

No functional change (intended). Of course, any out of tree modules that
relied on header pollution for sys/eventhandler.h, sys/lock.h, or
sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped.


# 9088a475 06-Feb-2019 Jayachandran C. <jchandra@FreeBSD.org>

arm64 acpi: Add support for IORT table

Add new file arm64/acpica/acpi_iort.c to support the "IO Remapping
Table" (IORT). The table is specified in ARM document "ARM DEN 0049D"
titled "IO Remapping Table Platform Design Document". The IORT table
has information on the associations between PCI root complexes, SMMU
blocks and GIC ITS blocks in the system.

The changes are to parse and save the information in the IORT table.
The API to use this information is added to sys/dev/acpica/acpivar.h.

The acpi_iort.c also has code to check the GIC ITS nodes seen in the
IORT table with corresponding entries in MADT table (for validity)
and with entries in SRAT table (for proximity information).

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D18002


# 9417fa9e 08-Dec-2018 Jayachandran C. <jchandra@FreeBSD.org>

acpica : move SRAT/SLIT parsing to sys/dev/acpica

This moves the architecture independent parts of sys/x86/acpica/srat.c
to sys/dev/acpica/acpi_pxm.c, to be used later on arm64. The function
declarations are moved to sys/dev/acpica/acpivar.h

We also need to update sys/conf/files.{i386,amd64} to use the new file.
No functional changes.

Reviewed by: markj, imp
Differential Revision: https://reviews.freebsd.org/D17941


# d4d6ad3f 18-Nov-2018 Jayachandran C. <jchandra@FreeBSD.org>

acpica: rework INTRNG interrupts

On arm64 (where INTRNG is enabled), the interrupts have to be mapped
with ACPI_BUS_MAP_INTR() before adding them as resources to devices.

The earlier code did the mapping before calling acpi_set_resource(),
which bypassed code that checked for PCI link interrupts.

To fix this, move the call to map interrupts into acpi_set_resource()
and that requires additional work to lookup interrupt properties.
The changes here are to:
* extend acpi_lookup_irq_handler() to lookup an irq in the ACPI
resources
* create a helper function acpi_map_intr() which uses the updated
acpi_lookup_irq_handler() to look up an irq, and then map it
with ACPI_BUS_MAP_INTR()
* use acpi_map_intr() in acpi_pcib_route_interrupt() to map
pci link interrupts.

With these changes, we can drop the ifdefs in acpi_resource.c, and
we can also drop the call for mapping interrupts in generic_timer.c

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D17790


# 5efca36f 25-Oct-2018 Takanori Watanabe <takawata@FreeBSD.org>

Distinguish _CID match and _HID match and make lower priority probe
when _CID match.

Reviewed by: jhb, imp
Differential Revision:https://reviews.freebsd.org/D16468


# 8fd10880 21-Oct-2018 Ben Widawsky <bwidawsk@FreeBSD.org>

acpi: Add an interface to obtain DSM information

The Device Specific Method (_DSM) is on optional object that defines
device specific controls. This will be useful for our power management
controller in upcoming patches. More information can be found in ACPI
spec 6.2 section 9.1.1

https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf

This patch had a minor modification changing ENOMEM to AE_NO_MEMORY
after it got review and approval but before committing.

Test Plan: Tested in my s0ix branch

Reviewed by: kib
Approved by: emaste (mentor)
Differential Revision: https://reviews.freebsd.org/D17121


# ba425ae4 14-Mar-2018 Jung-uk Kim <jkim@FreeBSD.org>

Remove local definitions for _STA method in favor of ACPICA.

These macros were added in ACPICA 20051216, more than a decade ago.


# 224c3776 11-Jan-2018 Andrew Turner <andrew@FreeBSD.org>

Add the start of INTRNG support for ACPI.

This adds a new acpi_bus interface with a map_intr method. This is similar
to the Open Firmware map_intr method and allows us to create the needed
mapping from ACPI space to INTRNG space.

Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8617


# 1ffd07bd 27-Apr-2017 John Baldwin <jhb@FreeBSD.org>

Various fixes for PCI _OSC handling so HotPlug works again.

- Rename the default implementation of 'pcib_request_feature' and add
a pcib_request_feature() wrapper function (as is often done for
new-bus APIs implemented via kobj) that accepts a single function.
Previously the call to pcib_request_feature() ended up invoking the
method on the great-great-grandparent of the bridge device instead
of the grandparent. For a bridge that was a direct child of pci0 on
x86 this resulted in the method skipping over the Host-PCI bridge
driver and being invoked against nexus0
- When invoking _OSC from a Host-PCI bridge driver, invoke
device_get_softc() against the Host-PCI bridge device instead of the
child bridge that is requesting HotPlug. Using the wrong softc data
resulted in garbage being passed for the ACPI handle causing the
_OSC call to fail.
- While here, perform some other cleanups to _OSC handling in the ACPI
Host-PCI bridge driver:
- Don't invoke _OSC when requesting a control that has already been
granted by the firmware.
- Don't set the first word of the capability array before invoking
_OSC. This word is always set explicitly by acpi_EvaluateOSC()
since it is UUID-independent.
- Don't modify the set of granted controls unless _OSC doesn't exist
(which is treated as always successful), or the _OSC method
doesn't fail.
- Don't require an _OSC status of 0 for success. _OSC always
returns the updated control mask even if it returns a non-zero
status in the first word.
- Whine if _OSC ever tries to revoke a previously-granted control.
(It is not supposed to do that.)
- While here, add constants for the _OSC status word in acpivar.h
(though currently unused).

Reported by: adrian
Reviewed by: imp
MFC after: 1 week
Tested on: Lenovo x220
Differential Revision: https://reviews.freebsd.org/D10520


# 0e68afe5 16-Dec-2016 Andrew Turner <andrew@FreeBSD.org>

Add support to read the _CLS entry if it's present. It is used by
memory-mapped devices that are normally PCIe drives. Devices can then use
the existing pci_get_class, etc. accessors to query this data.

The ivar values are different enough from the existing ACPI and ISA values
to not conflict.

Reviewed by: jhb
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D8721


# 8d791e5a 09-May-2016 John Baldwin <jhb@FreeBSD.org>

Add a new bus method to fetch device-specific CPU sets.

bus_get_cpus() returns a specified set of CPUs for a device. It accepts
an enum for the second parameter that indicates the type of cpuset to
request. Currently two valus are supported:

- LOCAL_CPUS (on x86 this returns all the CPUs in the package closest to
the device when DEVICE_NUMA is enabled)
- INTR_CPUS (like LOCAL_CPUS but only returns 1 SMT thread for each core)

For systems that do not support NUMA (or if it is not enabled in the kernel
config), LOCAL_CPUS fails with EINVAL. INTR_CPUS is mapped to 'all_cpus'
by default. The idea is that INTR_CPUS should always return a valid set.

Device drivers which want to use per-CPU interrupts should start using
INTR_CPUS instead of simply assigning interrupts to all available CPUs.
In the future we may wish to add tunables to control the policy of
INTR_CPUS (e.g. should it be local-only or global, should it ignore
SMT threads or not).

The x86 nexus driver exposes the internal set of interrupt CPUs from the
the x86 interrupt code via INTR_CPUS.

The ACPI bus driver and PCI bridge drivers use _PXM to return a suitable
LOCAL_CPUS set when _PXM exists and DEVICE_NUMA is enabled. They also and
the global INTR_CPUS set from the nexus driver with the per-domain set from
_PXM to generate a local INTR_CPUS set for child devices.

Compared to the r298933, this version uses 'struct _cpuset' in
<sys/bus.h> instead of 'cpuset_t' to avoid requiring <sys/param.h>
(<sys/_cpuset.h> still requires <sys/param.h> for MAXCPU even though
<sys/_bitset.h> does not after recent changes).


# 8a08b7d3 02-May-2016 John Baldwin <jhb@FreeBSD.org>

Revert bus_get_cpus() for now.

I really thought I had run this through the tinderbox before committing,
but many places need <sys/types.h> -> <sys/param.h> for <sys/bus.h> now.


# bc153c69 02-May-2016 John Baldwin <jhb@FreeBSD.org>

Add a new bus method to fetch device-specific CPU sets.

bus_get_cpus() returns a specified set of CPUs for a device. It accepts
an enum for the second parameter that indicates the type of cpuset to
request. Currently two valus are supported:

- LOCAL_CPUS (on x86 this returns all the CPUs in the package closest to
the device when DEVICE_NUMA is enabled)
- INTR_CPUS (like LOCAL_CPUS but only returns 1 SMT thread for each core)

For systems that do not support NUMA (or if it is not enabled in the kernel
config), LOCAL_CPUS fails with EINVAL. INTR_CPUS is mapped to 'all_cpus'
by default. The idea is that INTR_CPUS should always return a valid set.

Device drivers which want to use per-CPU interrupts should start using
INTR_CPUS instead of simply assigning interrupts to all available CPUs.
In the future we may wish to add tunables to control the policy of
INTR_CPUS (e.g. should it be local-only or global, should it ignore
SMT threads or not).

The x86 nexus driver exposes the internal set of interrupt CPUs from the
the x86 interrupt code via INTR_CPUS.

The ACPI bus driver and PCI bridge drivers use _PXM to return a suitable
LOCAL_CPUS set when _PXM exists and DEVICE_NUMA is enabled. They also and
the global INTR_CPUS set from the nexus driver with the per-domain set from
_PXM to generate a local INTR_CPUS set for child devices.

Reviewed by: wblock (manpage)
Differential Revision: https://reviews.freebsd.org/D5519


# 1b424b56 27-Apr-2016 John Baldwin <jhb@FreeBSD.org>

Adjust prototypes for NUMA-related functions to match the style of the
rest of this file.


# 4c26ac69 22-Apr-2016 John Baldwin <jhb@FreeBSD.org>

Optionally return the output capabilities list from _OSC.

Both of the callers were expecting the input cap_set to be modified.
This fixes them to request cap_set to be updated with the returned buffer.

Reviewed by: jkim
Differential Revision: https://reviews.freebsd.org/D6040


# cad6d222 20-Apr-2016 Jung-uk Kim <jkim@FreeBSD.org>

Remove query flag from acpi_EvaluateOSC(). This function does not support
return buffer (yet).


# 5f3dd91a 20-Apr-2016 John Baldwin <jhb@FreeBSD.org>

Add a wrapper for evaluating _OSC methods.

This wrapper does not translate errors in the first word to ACPI
error status returns. Use this wrapper in the acpi_cpu(4) driver in
place of the existing _OSC code. While here, fix a bug where the wrong
count of words was passed when invoking _OSC.

Reviewed by: jkim
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D6022


# 62d70a81 09-Apr-2016 John Baldwin <jhb@FreeBSD.org>

Add more fine-grained kernel options for NUMA support.

VM_NUMA_ALLOC is used to enable use of domain-aware memory allocation in
the virtual memory system. DEVICE_NUMA is used to enable affinity
reporting for devices such as bus_get_domain().

MAXMEMDOM must still be set to a value greater than for any NUMA support
to be effective. Note that 'cpuset -gd' always works if MAXMEMDOM is
enabled and the system supports NUMA.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D5782


# 2fe1339e 20-Feb-2016 Konstantin Belousov <kib@FreeBSD.org>

Some BIOSes ACPI bytecode needs to take (sleepable) acpi mutex for
acpi_GetInteger() execution. Intel DMAR interrupt remapping code
needs to know UID of the HPET to properly route the FSB interrupts
from the HPET, even when interrupt remapping is disabled, and the code
is executed under some non-sleepable mutexes.

Cache HPET UIDs in the device softc at the attach time and provide
lock-less method to get UID, use the method from the dmar hpet
handling code instead of calling GetInteger().

Reported and tested by: Larry Rosenman <ler@lerctr.org>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# 2dd1bdf1 26-Jan-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Convert rman to use rman_res_t instead of u_long

Summary:
Migrate to using the semi-opaque type rman_res_t to specify rman resources. For
now, this is still compatible with u_long.

This is step one in migrating rman to use uintmax_t for resources instead of
u_long.

Going forward, this could feasibly be used to specify architecture-specific
definitions of resource ranges, rather than baking a specific integer type into
the API.

This change has been broken out to facilitate MFC'ing drivers back to 10 without
breaking ABI.

Reviewed By: jhb
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D5075


# b57a73f8 08-May-2015 Konstantin Belousov <kib@FreeBSD.org>

If x86 CPU implementation of the MWAIT instruction reasonably
interacts with interrupts, query ACPI and use MWAIT for entrance into
Cx sleep states. Support C1 "I/O then halt" mode. See Intel'
document 302223-007 "Intelб╝ Processor Vendor-Specific ACPI Interface
Specification" for description.

Move the acpi_cpu_c1() function into x86/cpu_machdep.c and use
it instead of inlining "sti; hlt" sequence in several places.

In the acpi(4) man page, besides documenting the dev.cpu.N.cx_methods
sysctl, correct the names for dev.cpu.N.{cx_usage,cx_lowest,cx_supported}
sysctls.

Both jkim and avg have some other patches implementing the mwait
functionality; this work is unrelated. Linux does not rely on the
ACPI to provide correct tables describing Cx modes. Instead, the
driver has pre-defined knowledge of the CPU models, it was supplied by
Intel.

Tested by: pho (previous versions)
Sponsored by: The FreeBSD Foundation


# 5d18c60a 19-Apr-2015 Adrian Chadd <adrian@FreeBSD.org>

Refactor out the _PXM -> VM domain lookup done in ACPI, in preparation for
its use in upcoming code.

This is inspired by something in jhb's NUMA IRQ allocation patchset.

However, the tricky bit here is that the PXM lookup for a node may
fail, requiring a lookup on the parent node. So if it doesn't
exist, don't fail - just go up to the parent. Only error out of the
lookup is the ACPI lookup returns an error.

Sponsored by: Norse Corp, Inc.


# 4f1c1584 12-Apr-2015 Konstantin Belousov <kib@FreeBSD.org>

Define capabilities bits from the revision 007 of the document 302223
"Intelб╝ Processor Vendor-Specific ACPI Interface Specification",
issied Dec 2014. Previous revision 005 was from Sep 2006.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# ffcf962d 08-Oct-2014 Adrian Chadd <adrian@FreeBSD.org>

Add a bus method to fetch the VM domain for the given device/bus.

* Add a bus_if.m method - get_domain() - returning the VM domain or
ENOENT if the device isn't in a VM domain;
* Add bus methods to print out the domain of the device if appropriate;
* Add code in srat.c to save the PXM -> VM domain mapping that's done and
expose a function to translate VM domain -> PXM;
* Add ACPI and ACPI PCI methods to check if the bus has a _PXM attribute
and if so map it to the VM domain;
* (.. yes, this works recursively.)
* Have the pci bus glue print out the device VM domain if present.

Note: this is just the plumbing to start enumerating information -
it doesn't at all modify behaviour.

Differential Revision: D906
Reviewed by: jhb
Sponsored by: Norse Corp


# 802d215d 23-Apr-2014 Steven Hartland <smh@FreeBSD.org>

Increase ACPI_MAX_TASKS to be 4 x the number of CPU's as 2 x was still
insufficient on some machines

MFC after: 2 weeks


# 045d21a7 12-Nov-2012 Sean Bruno <sbruno@FreeBSD.org>

Update MAX_TASKS to scale a bit based on MAXCPU

This alleviates issues on newer Sandy/Ivy Bridge gear that seems to require
boatloads more ACPI resources than before.

Reviewed by: avg@
Obtained from: Yahoo! Inc.
MFC after: 2 weeks


# fb864578 08-Jun-2012 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Add x86/acpica/acpi_wakeup.c for amd64 and i386. Difference of
suspend/resume procedures are minimized among them.

common:
- Add global cpuset suspended_cpus to indicate APs are suspended/resumed.
- Remove acpi_waketag and acpi_wakemap from acpivar.h (no longer used).
- Add some variables in acpi_wakecode.S in order to minimize the difference
among amd64 and i386.
- Disable load_cr3() because now CR3 is restored in resumectx().

amd64:
- Add suspend/resume related members (such as MSR) in PCB.
- Modify savectx() for above new PCB members.
- Merge acpi_switch.S into cpu_switch.S as resumectx().

i386:
- Merge(and remove) suspendctx() into savectx() in order to match with
amd64 code.

Reviewed by: attilio@, acpi@


# 9ad56977 01-Jun-2012 Jung-uk Kim <jkim@FreeBSD.org>

Consistently use ACPI_SUCCESS() and ACPI_FAILURE() macros wherever possible.


# f0a101b7 01-Jun-2012 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Call AcpiLeaveSleepStatePrep() in interrupt disabled context
(described in ACPICA source code).

- Move intr_disable() and intr_restore() from acpi_wakeup.c to acpi.c
and call AcpiLeaveSleepStatePrep() in interrupt disabled context.
- Add acpi_wakeup_machdep() to execute wakeup MD procedures and call
it twice in interrupt disabled/enabled context (ia64 version is
just dummy).
- Rename wakeup_cpus variable in acpi_sleep_machdep() to suspcpus in
order to be shared by acpi_sleep_machdep() and acpi_wakeup_machdep().
- Move identity mapping related code to acpi_install_wakeup_handler()
(i386 version) for preparation of x86/acpica/acpi_wakeup.c
(MFC candidate).

Reviewed by: jkim@
MFC after: 2 days


# 424e6975 17-May-2012 John Baldwin <jhb@FreeBSD.org>

Centralize declaration of the debug.acpi sysctl node.


# a0a15716 08-Feb-2012 Jung-uk Kim <jkim@FreeBSD.org>

Reset clock after atrtc(4) is properly resumed.


# 404b0d10 07-Feb-2012 Jung-uk Kim <jkim@FreeBSD.org>

- Give all clocks and timers on acpi0 the equal probing order.
- Increase probing order for ECDT table to match HID-based probing.
- Decrease probing order for HPET table to match HID-based probing.
- Decrease probing order for CPUs and system resources.
- Fix ACPI_DEV_BASE_ORDER to reflect the reality.


# 5d0d779b 12-Oct-2011 John Baldwin <jhb@FreeBSD.org>

If an allocation for a specific resource range fails because it is not in
a decoded range for an ACPI Host-PCI bridge, try to allocate it from the
ACPI system resource range. If that works, permit the resource allocation
regardless.

MFC after: 1 week


# 4fc477aa 21-Jun-2011 John Baldwin <jhb@FreeBSD.org>

Use AcpiWalkResources() to parse the resource list from _CRS rather than
using a home-rolled loop. While here, add support for 64-bit address
range resources.

Silence on: acpi@ (older version)


# 059e2464 04-Apr-2011 Jung-uk Kim <jkim@FreeBSD.org>

Move a trivial acpi_TimerDelta() to acpivar.h to make it inlineable.


# 9fae4b2a 25-Feb-2011 Jung-uk Kim <jkim@FreeBSD.org>

Add more definitions for vendor-specific CPU capability bits to the last
revision, which is renamed to "Intel Processor Vendor-Specific ACPI".


# 82bf5557 10-Jan-2011 Jung-uk Kim <jkim@FreeBSD.org>

Allow AcpiOsInstallInterruptHandler() and AcpiOsRemoveInterruptHandler() to
install or remove non-SCI interrupt handlers per ACPI Component Architecture
User Guide and Programmer Reference. ACPICA may install such interrupt
handler when a GPE block device is found, for example. Add a wrapper for
ACPI_OSD_HANDLER, convert its return values to ours, and make it a filter.
Prefer KASSERT(9) over panic(9) as we have never seen those in reality.
Clean up some style(9) nits and add my copyright.


# ea233199 22-Dec-2010 John Baldwin <jhb@FreeBSD.org>

Use resource_list_reserve() to reserve I/O port and memory resources for
ACPI devices even if they are not allocated by a device driver since the
resources are in use and should not be allocated to another device.


# 93a88474 10-Nov-2010 Jung-uk Kim <jkim@FreeBSD.org>

Make APM emulation look more closer to its origin. Use device_get_softc(9)
instead of hardcoding acpi(4) unit number as we have device_t for it.


# 7c2bf852 09-Nov-2010 Jung-uk Kim <jkim@FreeBSD.org>

Refactor acpi_machdep.c for amd64 and i386, move APM emulation into a new
file acpi_apm.c, and place it on sys/x86/acpica.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 62508c53 17-Aug-2010 John Baldwin <jhb@FreeBSD.org>

Add a new method to the PCI bridge interface, PCIB_POWER_FOR_SLEEP(). This
method is used by the PCI bus driver to query the power management system
to determine the proper device state to be used for a device during suspend
and resume. For the ACPI PCI bridge drivers this calls
acpi_device_pwr_for_sleep(). This removes ACPI-specific knowledge from
the PCI and PCI-PCI bridge drivers.

Reviewed by: jkim


# 3c4c08dc 23-May-2010 Alexander Motin <mav@FreeBSD.org>

Make table-based HPET identification more clever. Before creating fake
device, make sure we have no real HPET device entry with same ID.
As side effect, it potentially allows several HPETs to be attached.
Use first of them for timecounting, rest (if ever present) could later
be used as event sources.


# 44dd6ac2 26-Apr-2010 Jung-uk Kim <jkim@FreeBSD.org>

MFC: r204773
Merge ACPICA 20100304.

MFC: r204874
Update module Makefile for ACPICA 20100304.

MFC: r204877
Allow ACPI module build on amd64. Although we strongly recommend building
it into kernel, there is no need to prevent it from building at all.

MFC: r204916
- Allow users to enable dumping Debug objects without ACPI debugger.
Setting the new sysctl MIB "debug.acpi.enable_debug_objects" to a non-zero
value enables us to print Debug object when something is written to it.
- Allow users to disable interpreter slack mode. Setting the new tunable
"debug.acpi.interpreter_slack" to zero disables some workarounds for common
BIOS mistakes and enables strict ACPI implementations by the specification.

MFC: r204920
Since the interpreter slack mode is a tunable now, enable a local hack only
when it is set. Note the default behaviour does not change by this change.

MFC: r204965
Fix white spaces.

MFC: r206117
Merge ACPICA 20100331 (and four additional upstream patches).


# e21bbd17 05-Feb-2010 Andriy Gapon <avg@FreeBSD.org>

MFC r197104,197105,197106,197107,197688,198237,199337,199338,200553,200554,
202771,202773: bring acpica version to 20100121

MFC details:
r197104 | jkim | 2009-09-12 01:48:53 +0300 (Sat, 12 Sep 2009) | 4 lines
MFV: r196804
Import ACPICA 20090903

r197105 | jkim | 2009-09-12 01:49:34 +0300 (Sat, 12 Sep 2009) | 2 lines
Catch up with ACPICA 20090903.

r197106 | jkim | 2009-09-12 01:50:15 +0300 (Sat, 12 Sep 2009) | 2 lines
Catch up with ACPICA 20090903.

r197107 | jkim | 2009-09-12 01:56:08 +0300 (Sat, 12 Sep 2009) | 2 lines
Canonify include paths for newly added files.

r197688 | jkim | 2009-10-01 23:56:15 +0300 (Thu, 01 Oct 2009) | 4 lines
Compile ACPI debugger and disassembler for kernel modules
unconditionally.
These files will generate almost empty object files without
ACPI_DEBUG/DDB
options. As a result, size of acpi.ko will increase slightly.

r198237 | jkim | 2009-10-19 19:12:58 +0300 (Mon, 19 Oct 2009) | 2 lines
Merge ACPICA 20091013.

r199337 | jkim | 2009-11-16 23:47:12 +0200 (Mon, 16 Nov 2009) | 2 lines
Merge ACPICA 20091112.

r199338 | jkim | 2009-11-16 23:53:56 +0200 (Mon, 16 Nov 2009) | 2 lines
Add a forgotten module Makefile change from the previous commit.

r200553 | jkim | 2009-12-15 00:24:04 +0200 (Tue, 15 Dec 2009) | 2 lines
Merge ACPICA 20091214.

r200554 | jkim | 2009-12-15 00:28:32 +0200 (Tue, 15 Dec 2009) | 3 lines
Remove _FDE quirk handling as these quirks are automatically repaired
by ACPICA layer since ACPICA 20091214.

r202771 | jkim | 2010-01-21 23:14:28 +0200 (Thu, 21 Jan 2010) | 2 lines
Merge ACPICA 20100121.

r202773 | jkim | 2010-01-21 23:31:39 +0200 (Thu, 21 Jan 2010) | 2 lines
Fix a new header inclusion.

Discussed with: jkim, jhb
No objections from: acpi@


# f6eb382c 07-Nov-2009 Andriy Gapon <avg@FreeBSD.org>

acpi: remove 'magic' ivar

o acpi_hpet: auto-added 'wildcard' devices can be identified by
non-NULL handle attribute.
o acpi_ec: auto-add 'wildcard' devices can be identified by
unset (NULL) private attribute.
o acpi_cpu: use private instead of magic to store cpu id.

Reviewed by: jhb
Silence from: acpi@
MFC after: 2 weeks
X-MFC-Note: perhaps the ivar should stay for ABI stability


# ff5bfa3e 29-Oct-2009 John Baldwin <jhb@FreeBSD.org>

MFC 197439:
Extract the code to find and map the MADT ACPI table during early kernel
startup and genericize it so it can be reused to map other tables as well:
- Add a routine to walk a list of ACPI subtables such as those used in the
APIC and SRAT tables in the MI acpi(4) driver.
- Move the routines for mapping and unmapping an ACPI table as well as
mapping the RSDT or XSDT and searching for a table with a given signature
out into acpica_machdep.c for both amd64 and i386.


# d95e7f5a 23-Sep-2009 John Baldwin <jhb@FreeBSD.org>

Extract the code to find and map the MADT ACPI table during early kernel
startup and genericize it so it can be reused to map other tables as well:
- Add a routine to walk a list of ACPI subtables such as those used in the
APIC and SRAT tables in the MI acpi(4) driver.
- Move the routines for mapping and unmapping an ACPI table as well as
mapping the RSDT or XSDT and searching for a table with a given signature
out into acpica_machdep.c for both amd64 and i386.


# 92488a57 11-Sep-2009 Jung-uk Kim <jkim@FreeBSD.org>

Catch up with ACPICA 20090903.


# 3ff9febd 10-Jun-2009 Jung-uk Kim <jkim@FreeBSD.org>

Catch up with r193750 (OsdSynch.c locking changes):

- Preallocate some memory for ACPI tasks early enough. We cannot use
malloc(9) any more because spin mutex may be held here. The reserved
memory can be tuned via debug.acpi.max_tasks tunable or ACPI_MAX_TASKS
in kernel configuration. The default is 32 tasks.
- Implement a custom taskqueue_fast to wrap the new memory allocation.
This implementation is not the fastest in the world but we are being
conservative here.


# 0755473b 23-Mar-2009 Jung-uk Kim <jkim@FreeBSD.org>

Add a function to reset system time after resuming, which will be used
by amd64 shortly. It can be turned off by setting "debug.acpi.reset_clock"
tunable to zero.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 5217af30 13-Mar-2008 John Baldwin <jhb@FreeBSD.org>

Rework how the nexus(4) device works on x86 to better handle the idea of
different "platforms" on x86 machines. The existing code already handles
having two platforms: ACPI and legacy. However, the existing approach was
rather hardcoded and difficult to extend. These changes take the approach
that each x86 hardware platform should provide its own nexus(4) driver (it
can inherit most of its behavior from the default legacy nexus(4) driver)
which is responsible for probing for the platform and performing
appropriate platform-specific setup during attach (such as adding a
platform-specific bus device). This does mean changing the x86 platform
busses to no longer use an identify routine for probing, but to move that
logic into their matching nexus(4) driver instead.
- Make the default nexus(4) driver in nexus.c on i386 and amd64 handle the
legacy platform. It's probe routine now returns BUS_PROBE_GENERIC so it
can be overriden.
- Expose a nexus_init_resources() routine which initializes the various
resource managers so that subclassed nexus(4) drivers can invoke it from
their attach routine.
- The legacy nexus(4) driver explicitly adds a legacy0 device in its
attach routine.
- The ACPI driver no longer contains an new-bus identify method. Instead
it exposes a public function (acpi_identify()) which is a probe routine
that the MD nexus(4) drivers can use to probe for ACPI. All of the
probe logic in acpi_probe() is now moved into acpi_identify() and
acpi_probe() is just a stub.
- On i386 and amd64, an ACPI-specific nexus(4) driver checks for ACPI via
acpi_identify() and claims the nexus0 device if the probe succeeds. It
then explicitly adds an acpi0 device in its attach routine.
- The legacy(4) driver no longer knows anything about the acpi0 device.
- On ia64 if acpi_identify() fails you basically end up with no devices.
This matches the previous behavior where the old acpi_identify() would
fail to add an acpi0 device again leaving you with no devices.

Discussed with: imp
Silence on: arch@


# f74e3c98 09-Oct-2007 Nate Lawson <njl@FreeBSD.org>

Fix the HPET table probe routine to run from device_identify() instead
of directly from acpi0. Before it would attach prior to the sysresource
devices, causing the later allocation of its memory range to fail and
print a warning like "acpi0: reservation of fed00000, 1000 (3) failed".
Use an explicit define for our probe order base value of 10.

Help from: jhb
Tested by: Abdullah Ibn Hamad Al-Marri <almarrie / gmail.com>
MFC after: 3 days
Approved by: re


# 00a30448 21-Jun-2007 Nate Lawson <njl@FreeBSD.org>

Update the suspend/resume user API while maintaining backwards compat.

Improvements:
* /etc/rc.suspend,rc.resume are always run, no matter the source of the
suspend request (user or kernel, apm or acpi)
* suspend now requires positive user acknowledgement. If a user program
wants to cancel the suspend, they can. If one of the user programs
hangs or doesn't respond within 10 seconds, the system suspends anyway.
* /dev/apm is clonable, allowing multiple listeners for suspend events.
In the future, xorg-server can use this to be informed about suspend
even if there are other listeners (i.e. apmd).

Changes:
* Two new ACPI ioctls: REQSLPSTATE and ACKSLPSTATE. Request begins the
process of suspending by notifying all listeners. acpi is monitored by
devd(8) and /dev/apm listener(s) are also counted. Users register their
approval or disapproval via Ack. If anyone disapproves, suspend is vetoed.
* Old user programs or kernel modules that used SETSLPSTATE continue to
work. A message is printed once that this interface is deprecated.
* acpiconf gains the -k flag to ack the suspend request. This flag is
undocumented on purpose since it's only used by /etc/rc.suspend. It is
not intended to be a permanent change and will be removed once a better
power API is implemented.
* S5 (power off) is no longer supported via acpiconf -s 5 or apm -z/-Z.
This restores previous behavior of halt/shutdown -p being the interface.
* Miscellaneous improvements to error reporting

Approved by: re


# 70fa7bc0 15-Jun-2007 Nate Lawson <njl@FreeBSD.org>

Convert magic to a uintptr_t. This should get rid of some warnings on
gcc4.


# fffe371d 15-May-2007 Takanori Watanabe <takawata@FreeBSD.org>

Add ACPI HPET table support.

Reviewed by:njl


# 2be4e471 22-Mar-2007 Jung-uk Kim <jkim@FreeBSD.org>

Catch up with ACPI-CA 20070320 import.


# 907b6777 07-Jan-2007 Nate Lawson <njl@FreeBSD.org>

Re-work Cx handling to be per-cpu and asymmetrical, fixing support on
modern dual-core systems as well.

- Parse the _CST packages for each cpu and track all the states individually,
on a per-cpu basis.

- Revert to generic FADT/P_BLK based Cx control if the _CST package
is not present on all cpus. In that case, the new driver will
still support per-cpu Cx state handling. The driver will determine the
highest Cx level that can be supported by all the cpus and configure the
available Cx state based on that.

- Fixed the case where multiple cpus in the system share the same
registers for Cx state handling. To do that, added a new flag
parameter to the acpi_PkgGas and acpi_bus_alloc_gas functions that
enable the caller to add the RF_SHAREABLE flag. This flag could also be
useful to other callers (acpi_throttle?) in the tree but this change is
not yet made.

- For Core Duo cpus, both cores seems to be taken out of C3 state when
any one of the cores need to transition out. This broke the short sleep
detection logic. It is disabled now if there is more than one cpu in
the system for now as it fixed it in my case. This quirk may need to
be re-enabled later differently.

- Added support to control cx_lowest on a per-cpu basis. There is still
a generic cx_lowest to enable changing cx_lowest for all cpus with a single
sysctl and for ease of use. Sample output for the new sysctl:

dev.cpu.0.cx_supported: C1/1 C2/1 C3/57
dev.cpu.0.cx_lowest: C3
dev.cpu.0.cx_usage: 0.00% 43.16% 56.83%
dev.cpu.1.cx_supported: C1/1 C2/1 C3/57
dev.cpu.1.cx_lowest: C3
dev.cpu.1.cx_usage: 0.00% 45.65% 54.34%
hw.acpi.cpu.cx_lowest: C3

This work was done by Stephane E. Potvin with some simple reworking by
myself. Thank you.

Submitted by: Stephane E. Potvin <sepotvin / videotron.ca>
MFC after: 2 weeks


# d1b16e18 29-Jul-2006 Nate Lawson <njl@FreeBSD.org>

Add a new sysctl, hw.acpi.handle_reboot. If set, acpi will attempt to
perform the reboot action via the reset register instead of our legacy
method. Default is 0 (use legacy). This is needed because some systems
hang on reboot even though they claim to support the reset register.

MFC after: 2 days


# 4c452688 12-Jun-2006 Nate Lawson <njl@FreeBSD.org>

Check in file missed in last commit. It made it into the MFC properly
though.


# c4a9fa45 06-Dec-2005 Nate Lawson <njl@FreeBSD.org>

Add KTR support and move some performance debugging variables in the EC
to KTR. We're reusing the KTR_DEV level.


# e8d472a7 01-Nov-2005 Jung-uk Kim <jkim@FreeBSD.org>

Catch up with ACPI-CA 20051021 import


# 6a4810bd 01-Nov-2005 Scott Long <scottl@FreeBSD.org>

Move HPET debugging under ACPI_TIMER in order to save a bitfield.


# 5be4c55f 01-Nov-2005 Scott Long <scottl@FreeBSD.org>

Add proper debugging infrastructure for acpi_hpet.c.


# 76f6fe4f 23-Jul-2005 Nate Lawson <njl@FreeBSD.org>

Rewrite the acpi_battery interface to allow for other battery types
(i.e., smart battery) and fix various bugs found during the cleanup.

API changes:
* kernel access:
Access to individual batteries is now via devclass_find("battery").
Introduce new methods ACPI_BATT_GET_STATUS (for _BST-formatted data) and
ACPI_BATT_GET_INFO (for _BIF-formatted data). The helper function
acpi_battery_get_battinfo() now takes a device_t instead of a unit #
argument. If dev is NULL, this signifies all batteries.

* ioctl access:
The ACPIIO_BATT_GET_TYPE and ACPIIO_BATT_GET_BATTDESC ioctls have been
removed. Since there is now no need for a mapping between "virtual" unit
and physical unit, usermode programs can just specify the unit directly and
skip the old translation steps. In fact, acpiconf(8) was actually already
doing this and virtual unit was the same as physical unit in all cases
since there was previously only one battery type (acpi_cmbat). Additionally,
we now map the ACPIIO_BATT_GET_BIF and ACPIIO_BATT_GET_BST ioctls for all
batteries, if they provide the associated methods.

* apm compatibility device/ioctls: no change
* sysctl: no change

Since most third-party applications use the apm(4) compat interface, there
should be very few affected applications (if any).

Reviewed by: bruno
MFC after: 5 days


# 8518ed9e 09-May-2005 Mark Santcroos <marks@FreeBSD.org>

Simplify the ACPI taskqueue implementation. Use a thread queue type instead
of swi. This allows us to use the taskqueue_thread_* functions instead of
rolling our own. It also avoids a double trip through the queue.

Submitted by: njl
Reviewed by: sam


# 98cc1619 21-Apr-2005 Nate Lawson <njl@FreeBSD.org>

Add the tunable "debug.acpi.max_threads" to allow users to set the
number of task threads to start on boot. Go back to a default of 3
threads to work around lost battery state problems. Users that need
a setting of 1 can set this via the tunable. I am investigating the
underlying issues and this tunable can be removed once they are solved.

MFC after: 2 days


# bce92885 10-Apr-2005 Nate Lawson <njl@FreeBSD.org>

Fix support for _PDC by using the proper version/length format for the
buffer. Also, reference the Intel document where the _PDC values were
found. This now supports ACPI-assisted SpeedStep on my borrowed T42.


# b29224c2 04-Apr-2005 Nate Lawson <njl@FreeBSD.org>

Add the acpi_get_features() method. This method is called on child drivers
to see what features they may support before calling identify/probe/attach.
This is necessary because the ACPI 3.0 spec requires driver support be
advertised before running any methods. For now, the flags are as specified
in for the _PDC and _OSC methods but we can support private flags as needed.

Add an implementation of this for acpi_cpu. It checks all its children
(notably cpufreq drivers) and calls the _PDC method to report the results.


# b8a16648 27-Mar-2005 Nate Lawson <njl@FreeBSD.org>

Serialize task queue by starting only one thread instead of three. This
may help with various interdependencies between subsystems. More testing
is needed to understand what the underlying issues are here.

Tested by: Juho Vuori
MFC after: 2 days


# dad97fee 02-Mar-2005 David E. O'Brien <obrien@FreeBSD.org>

Fix SCM ID's.


# 2d810618 01-Mar-2005 Nate Lawson <njl@FreeBSD.org>

Protect acpivar.h with _KERNEL. No user parts inside currently.


# a885159f 27-Feb-2005 Nate Lawson <njl@FreeBSD.org>

Protect against multiple includes and use _KERNEL to protect the PCI fns.


# 373dd876 22-Feb-2005 John Baldwin <jhb@FreeBSD.org>

- Add a new quirk to indicate that pin 0 of the first I/O APIC is really
IRQ 0 and not an ExtINT pin. The MADT enumerators ignore the PC-AT flag
and ignore overrides that map IRQ 0 to pin 2 when this quirk is present.
- Add a block comment above the quirks to document each quirk so that we
can use more verbose descriptions quirks.

MFC after: 2 weeks


# e1c4bf3f 05-Feb-2005 Nate Lawson <njl@FreeBSD.org>

Convert the acpi_bus_alloc_gas() and acpi_PkgGas() APIs to output the memory
type. This is needed if the resource is to be released later. The RID is
still also present, though less necessary since rman_get_rid() can be used
to obtain it from the resource.


# 276cd921 13-Dec-2004 Nate Lawson <njl@FreeBSD.org>

Unify ACPI_DEBUG support for all OEM drivers under ACPI_OEM. Since more than
one will never be supported on the same platform, this does not hurt
debugging.

MFC after: 3 days


# 82d4da0f 12-Dec-2004 Scott Long <scottl@FreeBSD.org>

Allow the acpi_ibm module to be built with ACPI_DEBUG.


# 4f8c4e4d 08-Oct-2004 Nate Lawson <njl@FreeBSD.org>

Update a quirk for the ASUS P5A to disable the timer. It appears to work fine
with acpi but the timer runs twice as fast. Note that the main problem
(system doesn't work properly with acpi disabled) should be fixed separately.

Changes:
* Add a quirk to disable the timer
* Merge the P5A and P5A-B quirks since they appear to be based on the
same ASL.

PR: i386/72450
Tested by: Kevin Oberman <oberman es.net>
MFC after: 3 days


# e0a93586 22-Sep-2004 John Baldwin <jhb@FreeBSD.org>

Add a couple of macros to extract the PCI slot (device) and function from
an ACPI _ADR value and use that rather than inlining the same shifts and
masks everywhere.


# adad4744 23-Aug-2004 Nate Lawson <njl@FreeBSD.org>

Rework sysresource management. Instead of having each sysresource object
hold its own values, pass them up to the parent (acpi0) and merge/uniq them
on the way. After the namespace evaluation, acpi will reserve these
resources and manage them via rman before bus_generic_probe() and
bus_generic_attach(). This is necessary because some systems specify
conflicting resources in separate sysresource objects. It's also cleaner
in that the interface between sysresource and acpi is now merely the parent's
resource list. This code handles the following cases:

1. Unique resource: add it to the parent via bus_set_resource().
2. New wholly contained in old: discard new.
3. New tail overlaps old head: grow old head downward.
AND/OR
4. New head overlaps old tail: grow old tail upward.

Tested by: Pawel Worach <sajd_at_telia.com>
Tested by: Radek Kozlowski <radek_at_raadradd.com>
MFC after: 5 days


# e079f949 17-Aug-2004 Nate Lawson <njl@FreeBSD.org>

Remove the ACPIIO_ENABLE and ACPIIO_DISABLE ioctls as well as all
callers. These ioctls attempted to enable and disable the ACPI
interpreter at runtime. In practice, it is not possible to boot with
ACPI and then disable it on many systems and trying to do so can cause
crashes, interrupt storms, etc. Binary compatibility with userland is
retained.

MFC after: 2 days


# 3a9865dd 13-Aug-2004 Nate Lawson <njl@FreeBSD.org>

MPSAFE locking

* Add and comment our locking primitives. The mutex primitives use a
a static mutex and the serialization ones use a static sx lock. A global
acpi_mutex is used for access to global resources (i.e., writes to the
SMI_CMD register.)
* Remove 4.x compat defines.


# 17dbe0f7 05-Aug-2004 Nate Lawson <njl@FreeBSD.org>

Add flags for _STA (status) methods and convenience macros for checking
the presence of batteries and devices.


# 7a5230b8 12-Jul-2004 Nate Lawson <njl@FreeBSD.org>

Add the ability to detach a battery. Now batteries that are detached are
also removed from the battery list.


# d4b9ff91 30-Jun-2004 Nate Lawson <njl@FreeBSD.org>

Move flags into a private ivar so it can't collide with device flags.
Unify the code to disable GPEs with the enable code. Shutdown is handled
the same way. ACPI now does all wake/sleep prep for child devices so
now they no longer need to call external functions in the suspend/resume
path. Add the flags to non-ACPI busses (i.e., pci).


# 1a26ea7f 29-Jun-2004 Nate Lawson <njl@FreeBSD.org>

Add machdep quirks functions. On i386, this disables acpi on systems with
BIOS dates earlier than Jan 1, 1999. Add prototypes and quirks flags.


# 0e01bb05 29-Jun-2004 Nate Lawson <njl@FreeBSD.org>

Staticize acpi_MatchHid() and include acpi_if.h


# 95957f62 23-Jun-2004 John Baldwin <jhb@FreeBSD.org>

- Defer BUS_CONFIG_INTR() on ACPI IRQ resources until the resources are
actually used. For most ACPI devices this means deferring the call
until bus_alloc_resource().
- Add a function acpi_config_intr() to call BUS_CONFIG_INTR() for an
ACPI IRQ resource using the trigger mode and polarity information
stored in the ACPI resource object.
- Add a function acpi_lookup_irq_resource() to lookup the ACPI IRQ
resource that corresponds to a specified rid and new-bus resource.
- Have the ACPI PCI bridge driver call BUS_CONFIG_INTR() on interrupts
that it routes through link devices.
- Remove needactivate variable from acpi_alloc_resource() by changing the
function not modify the flags variable but just mask off RF_ACTIVE when
calling rman_reserve_resource().

Reviewed by: njl (1, an earlier version)


# 89c9c53d 16-Jun-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.


# 91233413 13-Jun-2004 Nate Lawson <njl@FreeBSD.org>

Add support to ACPI to manage its own resources. Previously, resource
allocation was passed up to nexus. Now, we probe sysresource objects and
manage the resources they describe in a local rman pool. This helps
devices which attach/detach varying resources (like the _CST object) and
module loads/unloads. The allocation/release routines now check to see if
the resource is described in a child sysresource object and if so,
allocate from the local rman. Sysresource objects add their resources to
the pool and reserve them upon boot. This means sysresources need to be
probed before other ACPI devices.

Changes include:
* Add ordering to the child device probe. The current order is: system
resource objects, embedded controllers, then everything else.
* Make acpi_MatchHid take a handle instead of a device_t arg.
* Replace acpi_{get,set}_resource with the generic equivalents.


# 59a890e6 13-Jun-2004 Nate Lawson <njl@FreeBSD.org>

Associate a device_t with an ACPI_HANDLE. This make AcpiWalkNamespace more
useful. If ACPI-CA allowed null object handlers, we wouldn't need the
placeholder function.


# 54af2f27 28-May-2004 Nate Lawson <njl@FreeBSD.org>

Style cleanups. "extern" is unneeded for function prototypes.


# cc85c78c 28-May-2004 Nate Lawson <njl@FreeBSD.org>

Update the new suspend/resume GPE methods to properly limit the GPE
based on the destination sleep state. Add a method to restore the old
state on resume. This is needed for the case of suspending to a very low
state disabling a GPE (i.e. S4), resuming, and then suspending to a higher
state (i.e. S3). This case should now keep the proper GPEs enabled.


# e8b4d56e 27-May-2004 Nate Lawson <njl@FreeBSD.org>

Restructure the wake GPE API. Now there are three functions:

acpi_wake_init:
Evaluate _PRW and set the GPE type
acpi_wake_set_enable:
Enable or disable a device's GPE.
acpi_wake_sleep_prep:
Perform any last-minute changes to the device to prepare it for
entering the given sleep state.

Also, walk the entire namespace when transitioning to a sleep state,
disabling any GPEs which aren't appropriate for the given state. Transition
acpi_lid and acpi_button to the new API.

This clears the way for non-ACPI-aware devices to wake the system (i.e.
modems) and fixes a problem where systems power up after shutdown when a
GPE is triggered.


# 12957d49 22-May-2004 Nate Lawson <njl@FreeBSD.org>

Revert the previous commit. The bus accessor macros do not check the
return value for BUS_READ_IVAR and thus don't generate the proper NULL
in cases where a device (i.e. on PCI) does not have a handle.

Found by: peadar, tjr


# 14e2b11f 18-May-2004 Nate Lawson <njl@FreeBSD.org>

Use the simpler __BUS_ACCESSOR macros for ivars instead of defining them
ourselves.


# ea27c63e 06-May-2004 Nate Lawson <njl@FreeBSD.org>

Select the highest valid (i.e., S3) sleep state for the default for the
sleep button. Change the default for the lid switch to NONE. This can
be overridden in /etc/sysctl.conf as desired.


# 9a1fc77e 22-Apr-2004 Philip Paeps <philip@FreeBSD.org>

Add the ACPI Asus extras driver. Provides support for cool ACPI-controled
gadgets (hotkeys, lcd, ...) on Asus laptops. I aim to closely track the
acpi4asus project which implements these features in the Linux kernel.

If this breaks your laptop, please let me know how it does it :-)

Approved by: njl (mentor)


# eea17c34 20-Apr-2004 Nate Lawson <njl@FreeBSD.org>

Move the timer difference convenience function from acpi_cpu.c to make it
globally available. acpi_TimerDelta() subtracts two readings from the
ACPI PM timer and returns the difference. It properly distinguishes between
24-bit and 32-bit timers and handles wraparound.


# c871a6da 13-Apr-2004 Nate Lawson <njl@FreeBSD.org>

Style cleanups to reduce diffs to locking tree.


# 4a74bb97 09-Apr-2004 Nate Lawson <njl@FreeBSD.org>

Include the prototype for acpi_GetReference.


# 5eb09c70 31-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Move the ivar accessing routines back to inlines (reverting acpivar.h
rev 1.44 and acpi.c rev 1.96). Now gcc can handle larger inlines and we
really need external drivers to be able to read their acpi ivars.


# 72ad60ad 31-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Add an interface to pass an argument to the resource parsing functions.
This is just groundwork for changing sysresource behavior.

PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:


# cc58e4ee 08-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Use an unsigned int instead of an int for the Get/Set Integer interface.

Pointed out by: le


# c310653e 03-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Change to acpi_{Get,Set}Integer to provide both methods. Convert all
callers to the new API.

Submitted by: Mark Santcroos <marks@ripe.net>


# 3184cf5a 02-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Add support for quirks for acpi tables. Key off OEM vendor and revision.
Sort acpi debug values. Change "disable" to "disabled" to match rest of
the kernel. Remove debugging from acpi_toshiba since it was only used for
probe/attach.


# abcbc5bc 19-Feb-2004 Nate Lawson <njl@FreeBSD.org>

Use ACPI_NEXT_RESOURCE instead of defining our own copy. The one provided
with ACPI-CA is identical now.


# 33febf93 10-Feb-2004 Nate Lawson <njl@FreeBSD.org>

Prefer buttons defined in the AML over the ones in the FADT. Some
systems define power/sleep buttons in both places but only deliver
notifies to the ones defined in the AML.

Also, reduce length of various function handler names.

PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:


# 1527dcc8 06-Feb-2004 Philip Paeps <philip@FreeBSD.org>

Make all ACPI debug layers unique again. This makes debugging a more
pleasant experience (for certain definition of 'pleasant').

Submitted by: Mark Santcroos <marks@ripe.net>
Approved by: njl (mentor)


# bbc2815c 26-Jan-2004 John Baldwin <jhb@FreeBSD.org>

Move the code to initialize ACPI-CA into a separate acpi_Startup() function
that other modules can call to initialize ACPI-CA before the new-bus probe
and change acpi_identify() to call it.

Reviewed by: njl


# 0657fe73 13-Jan-2004 John Baldwin <jhb@FreeBSD.org>

Add a component constant for ACPI_TOSHIBA to fix compilation of
acpi_toshiba(4) driver with ACPI_DEBUG and thus fix LINT on i386.


# 21cea91f 23-Dec-2003 Nate Lawson <njl@FreeBSD.org>

Remove the device_t parameter from package routines that only used it to
print an error message. Update all callers of the package routines.


# b5049ddb 15-Nov-2003 Nate Lawson <njl@FreeBSD.org>

Add acpi_package.c with routines for validating packages and pulling
various data types from them. This is loosely based on the acpi_cmbat
macros (by Mike Smith) and will eventually replace them.


# 801cc576 11-Nov-2003 John Baldwin <jhb@FreeBSD.org>

Add an acpi_OverrideInterruptLevel() method that OSPM can use to override
the InterruptLevel used for the SCI.


# 9b937d48 24-Oct-2003 Nate Lawson <njl@FreeBSD.org>

Add devctl(4) notify support to ACPI. Various subsystems now notify
userland whenever events occur. See the example in devd.conf below
to see how to use it.


# 24752c42 10-Sep-2003 Marcel Moolenaar <marcel@FreeBSD.org>

Extend the ACPI resource handling to make use of the BUS_CONFIG_INTR()
method. This is necessary on ia64 where it's known that serial interfaces
described in the ACPI namespace may not have the well-known IRQs assigned
to them. This confuses us in thinking they are PCI based interrupts and
wrongly program the APIC.


# be2b1797 28-Aug-2003 Nate Lawson <njl@FreeBSD.org>

Style and whitespace changes. Also, make the ivar functions non-inline
since inlining failed due to the size of BUS_*


# f8335e3a 19-Jul-2003 Nate Lawson <njl@FreeBSD.org>

Add ECDT (ACPI 2.0) support. This allows the EC to be enabled before the
namespace has been evaluated. Machines with ACPI 2.0 expect this behavior
and have AML which calls EC functions early in the boot process. If the
ECDT is not available, fall back to original probe behavior.

Other minor changes:
* Add GPE bit and GLK usage to the device announcement
* Always use the global lock in the ECDT case, but potentially downgrade to
not using it if _GLK is 0 once the namespace is available. This is
announced with "Changing GLK from 1 to 0"
* Remove the acpi_object_list definitions which were earlier deprecated

Ideas from: takawata


# fa1045a7 15-Jul-2003 Nate Lawson <njl@FreeBSD.org>

Remove old defines since they are no longer used.


# dea7cce5 13-May-2003 John Baldwin <jhb@FreeBSD.org>

Add some extra #ifdef stubs so that this compiles on 4.8.

Approved by: re (rwatson/bmah)


# 51773ddf 29-Apr-2003 Nate Lawson <njl@FreeBSD.org>

Support functions for the new ACPI import.
* AcpiOsDerivePciId(): finds a bus number, given the slot/func and the
acpi parse tree.
* AcpiOsPredefinedOverride(): use the sysctl hw.acpi.os_name to
override the value for _OS.

Ideas from: takawata, jhb
Reviewed by: takawata, marcel
Tested on: i386, ia64


# 07515f29 24-Mar-2003 Jake Burkholder <jake@FreeBSD.org>

Fix 2 vm_offset_t -> vm_paddr_t missed in previous commit.

Sponsored by: DARPA, Network Associates Laboratories


# c6a78e98 11-Dec-2002 Takanori Watanabe <takawata@FreeBSD.org>

Add sysctl knob to stop disabling acpi on shutdown.

Approved by: re(jhb)


# 91da7c40 31-Oct-2002 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Invoke 3 ACPI task threads as default if option ACPI_MAX_THREADS is
not defined.
To make previous default behavior (ACPI_MAX_THREADS undefined), define
option ACPI_MAX_THREADS as 0.


# 0b1d1f1a 16-Oct-2002 John Baldwin <jhb@FreeBSD.org>

- Include lock headers on current in this header instead of putting
#if's in all the other ACPI source files.
- Use splhigh() for the ACPI subsystem lock on 4-stable.

Sponsored by: The Weather Channel


# da14ac9f 06-Sep-2002 John Baldwin <jhb@FreeBSD.org>

Add a helper routine acpi_SetIntrModel() to call the _PIC method to set
the interrupt model in use so that ACPI can properly route interrupts for
machines using APIC's or SAPIC's.


# d62ab2f4 28-Aug-2002 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Resolve conflicts arising from the ACPI CA 20020815 import.


# ff01efb5 25-Aug-2002 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Add new sysctl MIB (hw.acpi.sleep_delay) to specify the delay (in
seconds) before ACPI sleep. Some machines might need this to sleep
by Hot-key.


# a1fccb47 21-Jul-2002 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Add device(power/sleep button and lid) wake function from sleeping state.
This is required for some Thinkpad (and maybe VAIO) machines to wake
the system up from sleep.

Currently partially implemented, more complete implementation will come later.


# e51a25f8 19-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove __P.


# 899ccf54 04-Mar-2002 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Add generalized power profile code.
This makes other power-management system (APM for now) to be able to
generate power profile change events (ie. AC-line status changes), and
other kernel components, not only the ACPI components, can be notified
the events.

- move subroutines in acpi_powerprofile.c (removed) to kern/subr_power.c
- call power_profile_set_state() also from APM driver when AC-line
status changes
- add call-back function for Crusoe LongRun controlling on power
profile changes for a example


# dd5d6508 22-Feb-2002 Mike Smith <msmith@FreeBSD.org>

Add our own private defines for driver debug layers.
Obsolete the acpi_GetInto* interfaces.

Fix a typo to be less appropriate.


# 85dff349 31-Jan-2002 Takanori Watanabe <takawata@FreeBSD.org>

Fix irq/drq handling. IRQ and DRQ resource information can be get
in one object for one resource. Array of values in a object means
possible values for the object.


# 3273b005 07-Jan-2002 Mike Smith <msmith@FreeBSD.org>

Staticise devclasses and some unnecessarily global variables.


# 586cd03a 24-Dec-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Oops, wrong option name. It's should be ACPI_MAX_THREADS,
not ACPI_NO_THREADS.


# c573e654 22-Dec-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Add OS layer ACPI mutex and threading support.
- Temporary fix a bug of Intel ACPI CA core code.
- Add OS layer ACPI mutex support. This can be disabled by
specifying option ACPI_NO_SEMAPHORES.
- Add ACPI threading support. Now that we have a dedicate taskqueue for
ACPI tasks and more ACPI task threads can be created by specifying option
ACPI_MAX_THREADS.
- Change acpi_EvaluateIntoBuffer() behavior slightly to reuse given
caller's buffer unless AE_BUFFER_OVERFLOW occurs. Also CM battery's
evaluations were changed to use acpi_EvaluateIntoBuffer().
- Add new utility function acpi_ConvertBufferToInteger().
- Add simple locking for CM battery and temperature updating.
- Fix a minor problem on EC locking.
- Make the thermal zone polling rate to be changeable.
- Change minor things on AcpiOsSignal(); in ACPI_SIGNAL_FATAL case,
entering Debugger is easier to investigate the problem rather than panic.


# ece50487 09-Dec-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Disable sleep requests for 5 sec after wakeup. This is needed for
some Toshiba and Thinkpad laptops.
Wakeup event is generated by power button or sleep button on some
laptops but this also generates SCI interrupt, and shutdown the system
as result. So this is introduced so that acpi driver ignore given
requests for certain period.


# 6971b3c7 18-Nov-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Cleanups of verbose printing. All the messages for the debugging is
disabled unless verbose flag is set. Also fix some messages in terms
of English.
The critical messages and error messages in probe/attach routine are
unchanged by this commit.


# 1611ea87 06-Nov-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Add S4BIOS sleep (BIOS hibernation) and DSDT overriding support.
- Add S4BIOS sleep implementation. This will works well if MIB
hw.acpi.s4bios is set (and of course BIOS supports it and hibernation
is enabled correctly).
- Add DSDT overriding support which is submitted by takawata originally.
If loader tunable acpi_dsdt_load="YES" and DSDT file is set to
acpi_dsdt_name (default DSDT file name is /boot/acpi_dsdt.aml),
ACPI CA core loads DSDT from given file rather than BIOS memory block.
DSDT file can be generated by iasl in ports/devel/acpicatools/.
- Add new files so that we can add our proposed additional code to Intel
ACPI CA into these files temporary. They will be removed when
similar code is added into ACPI CA officially.


# 9febbb40 30-Oct-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Some improvements of control method battery driver.
- Add a new MIB for battery info expire time in order to make it changeable.
Battery info expire time can be specified by
hw.acpi.battery.info_expire in sec.
- Add own MALLOC type and fix some potential memory leakages.
- Change some frequent printings to verbose printing.
- Stop timeout during acpi_cmbat_get_bst() too. This should reduce
the races with BIF evaluation.
- Remove acpi_cmbat_get_bif() invocation from acpi_cmbat_attach().
This was redundant because this should be called from
acpi_cmbat_timeout() now.


# 2d644607 29-Oct-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Some small improvements of ACPI thermal driver.
- Give a guaranteed minimum cooling run time to avoid too frequent
cooling system On/Off switching. The minimum cooling run time can be
specified by hw.acpi.thermal.min_runtime in sec.
- Refine message printing (_AC-1 -> NONE).
- Add verbose mode enable/disable capability by hw.acpi.verbose in bool.

Reviewed by: acpi-jp@ folks


# f86214b6 26-Oct-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Add APM compatibility feature to ACPI.
This emulates APM device node interface APIs (mainly ioctl) and
provides APM services for the applications. The goal is to support
most of APM applications without any changes.
Implemented ioctls in this commit are:
- APMIO_SUSPEND (mapped ACPI S3 as default but changable by sysctl)
- APMIO_STANDBY (mapped ACPI S1 as default but changable by sysctl)
- APMIO_GETINFO and APMIO_GETINFO_OLD
- APMIO_GETPWSTATUS

With above, many APM applications which get batteries, ac-line
info. and transition the system into suspend/standby mode (such as
wmapm, xbatt) should work with ACPI enabled kernel (if ACPI works well :-)

Reviewed by: arch@, audit@ and some guys


# 887f6fb8 05-Oct-2001 Peter Wemm <peter@FreeBSD.org>

Fix some 64-bit uncleanliness.


# cd5178be 05-Oct-2001 Peter Wemm <peter@FreeBSD.org>

Fix some style bugs before fixing some real bugs.


# d5519f12 29-Aug-2001 Mike Smith <msmith@FreeBSD.org>

Note that now that some ISA devices will attach to ACPI, we need to
keep the ivar indexes that ISA uses free.


# 6d63101a 30-Jul-2001 Mike Smith <msmith@FreeBSD.org>

- Prevent the ACPI code from being loaded as a module other than at
boot time. Loading as a module once the system is up and running
doesn't make any sense.

- Fix acpi_FindIndexedResource (it would only check the first resource),
changes the calling interface.

- Add a new helper function (acpi_AppendBufferResource) to help building
buffers containing resources.


# bfae45aa 21-Jul-2001 Mike Smith <msmith@FreeBSD.org>

Convert from acpi_strerror() to AcpiFormatException()

Fix dangling include of the dear departed acpi_ecreg.h


# acf72ef4 20-Jul-2001 Mike Smith <msmith@FreeBSD.org>

The API for loading tables changed (we no longer explicitly search for the
RSDP, it's now found via a callback).

AcpiOsSleepUsec() went away, use AcpiOsSleep() instead (we could use
AcpiOsStall() too)

AcpiFormatException() was changed to make more sense (it behaves like
our old acpi_strerror() did), so throw acpi_strerror() away (still
#defined in acpivar.h though, we need to sweep these seperately).


# 6161544c 20-Jul-2001 Takanori Watanabe <takawata@FreeBSD.org>

Add ACPI S2-S4BIOS Suspend/Resume code.
Some problems may remain.

Reviewed by:iwasaki


# 7d3bcec9 07-Jul-2001 Mike Smith <msmith@FreeBSD.org>

Add acpi_GetTableIntoBuffer, to aid in fetching tables.


# 59c82e8f 06-Jul-2001 Mike Smith <msmith@FreeBSD.org>

Add support for system power profiles; select "performance" when AC power
is available and "economy" when it is not.


# 6f69255b 05-Jul-2001 Mike Smith <msmith@FreeBSD.org>

Add a new helper function for finding resources in resource buffers.

Move the ACPI generic battery code into a new file.


# 03b5e198 29-Jun-2001 Mike Smith <msmith@FreeBSD.org>

Add ACPI subsystem mutex support, currently disabled. This implements
a private mutex we can use to wrap the ACPI subsystem proper.


# c5ba0be4 28-Jun-2001 Mike Smith <msmith@FreeBSD.org>

Sync to my work in progress:

- Reorder the acpi_* functions in a sensible fashion
- Add acpi_ForeachPackageObject and acpi_GetHandleInScope
- Use the new debugging layer/level names
- Implement most of the guts of the acpi_thermal module; passive cooling
isn't there yet, but active cooling should work.
- Implement power resource handling (acpi_powerres.c)

This compiles and mostly works, but my test coverage is small, so feedback
is welcome.


# 4eb77744 23-Jun-2001 Mitsuru IWASAKI <iwasaki@FreeBSD.org>

Add sysctl interface (Read-only) for temprature, AC-line and Battery.
Patches for acpi_cmbat.c submitted by Munehiro Matsuda.


# 2a4ac806 29-May-2001 Mike Smith <msmith@FreeBSD.org>

- Updates for new constant naming in the ACPI CA 20010518 update.
- Use __func__ instead of __FUNCTION.
- Support power-off to S3 or S5 (takawata)
- Enable ACPI debugging earlier (with a sysinit)
- Fix a deadlock in the EC code (takawata)
- Improve arithmetic and reduce the risk of spurious wakeup in
AcpiOsSleep.
- Add AcpiOsGetThreadId.
- Simplify mutex code (still disabled).


# 91467fc6 31-Jan-2001 Mike Smith <msmith@FreeBSD.org>

ACPI_NUMBER becomes ACPI_INTEGER. acpi_EvaluateNumber becomes
acpi_EvaluateInteger.

Use acpi_EvaluateInteger instead of doing things the hard way where
possible.

AcpiSetSystemSleepState (unofficial) becomes AcpiEnterSleepState.

Use the AcpiGbl_FADT pointer rather than searching for the FADT.


# 1d073b1d 13-Jan-2001 John Baldwin <jhb@FreeBSD.org>

Add 3 new dynamic sysctl's to control the sleep states switched to on a
power button, sleep button, or lid close event. The sysctl's use the
ACPI sleep state names S0, S1, S2, S3, S4, S4B, and S5.

Reviewed by: iwasaki


# 0ae55423 08-Dec-2000 Mike Smith <msmith@FreeBSD.org>

- Convert a lot of homebrew debugging output to use the ACPI CA debugging
infrastructure. It's not perfect, but it's a lot better than what
we've been using so far. The following rules apply to this:
o BSD component names should be capitalised
o Layer names should be taken from the non-CA set for now. We
may elect to add some new BSD-specific layers later.

- Make it possible to turn off selective debugging flags or layers
by listing them in debug.acpi.layer or debug.acpi.level prefixed
with !.

- Fully implement support for avoiding nodes in the ACPI namespace.
Nodes may be listed in the debug.acpi.avoid environment variable;
these nodes and all their children will be ignored (although still
scanned over) by ACPI functions which scan the namespace. Multiple
nodes can be specified, separated by whitespace.

- Implement support for selectively disabling ACPI subsystem components
via the debug.acpi.disable environment variable. The following
components can be disabled:
o bus creation/scanning of the ACPI 'bus'
o children attachment of children to the ACPI 'bus'
o button the acpi_button control-method button driver
o ec the acpi_ec embedded-controller driver
o isa acpi replacement of PnP BIOS for ISA device discovery
o lid the control-method lid switch driver
o pci pci root-bus discovery
o processor CPU power/speed management
o thermal system temperature detection and control
o timer ACPI timecounter
Multiple components may be disabled by specifying their name(s)
separated by whitespace.

- Add support for ioctl registration. ACPI subsystem components may
register ioctl handlers with the /dev/acpi generic ioctl handler,
allowing us to avoid the need for a multitude of /dev/acpi* control
devices, etc.


# 15e32d5d 28-Oct-2000 Mike Smith <msmith@FreeBSD.org>

Initial FreeBSD OSPM (operating system power management) modules for
ACPICA. Most of these are still works in progress. Support exists for:

- Fixed feature and control method power, lid and sleep buttons.
- Detection of ISA PnP devices using ACPI namespace.
- Detection of PCI root busses using ACPI namespace.
- CPU throttling and sleep states (incomplete)
- Thermal monitoring and cooling control (incomplete)
- Interface to platform embedded controllers (mostly complete)
- ACPI timer (incomplete)
- Simple userland control of sleep states.
- Shutdown and poweroff.