History log of /freebsd-11-stable/sys/dev/acpica/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
367457 07-Nov-2020 dim

MFC r344855 (by jhb):

Drop "All rights reserved" from my copyright statements.

Reviewed by: rgrimes
Differential Revision: https://reviews.freebsd.org/D19485


/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_mips64el.c
/freebsd-11-stable/lib/libdevctl/devctl.3
/freebsd-11-stable/lib/libdevctl/devctl.c
/freebsd-11-stable/lib/libdevctl/devctl.h
/freebsd-11-stable/lib/libkvm/kvm_aarch64.h
/freebsd-11-stable/lib/libkvm/kvm_amd64.h
/freebsd-11-stable/lib/libkvm/kvm_arm.h
/freebsd-11-stable/lib/libkvm/kvm_i386.h
/freebsd-11-stable/lib/libkvm/kvm_mips.h
/freebsd-11-stable/lib/libkvm/kvm_native.3
/freebsd-11-stable/lib/libkvm/kvm_sparc64.h
/freebsd-11-stable/lib/libsysdecode/errno.c
/freebsd-11-stable/lib/libsysdecode/signal.c
/freebsd-11-stable/lib/libsysdecode/syscallnames.c
/freebsd-11-stable/lib/libsysdecode/sysdecode.3
/freebsd-11-stable/lib/libsysdecode/sysdecode.h
/freebsd-11-stable/lib/libsysdecode/sysdecode_abi_to_freebsd_errno.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_cap_rights.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_enum.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_fcntl_arg.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_ioctlname.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_kevent.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_mask.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_quotactl_cmd.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_sigcode.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_socket_protocol.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_sockopt_name.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_syscallnames.3
/freebsd-11-stable/lib/libsysdecode/sysdecode_utrace.3
/freebsd-11-stable/lib/libutil/kinfo_getvmobject.3
/freebsd-11-stable/sbin/hastd/refcnt.h
/freebsd-11-stable/share/man/man3/sigevent.3
/freebsd-11-stable/share/man/man4/ktr.4
/freebsd-11-stable/share/man/man4/witness.4
/freebsd-11-stable/share/man/man9/BUS_GET_CPUS.9
/freebsd-11-stable/share/man/man9/BUS_RESCAN.9
/freebsd-11-stable/share/man/man9/atomic.9
/freebsd-11-stable/share/man/man9/bus_map_resource.9
/freebsd-11-stable/share/man/man9/critical_enter.9
/freebsd-11-stable/share/man/man9/ithread.9
/freebsd-11-stable/share/man/man9/ktr.9
/freebsd-11-stable/share/man/man9/runqueue.9
/freebsd-11-stable/share/man/man9/scheduler.9
/freebsd-11-stable/share/man/man9/sleepqueue.9
/freebsd-11-stable/share/man/man9/swi.9
/freebsd-11-stable/stand/efi/libefi/devpath.c
/freebsd-11-stable/stand/i386/cdboot/cdboot.S
/freebsd-11-stable/stand/i386/libi386/pxe.c
/freebsd-11-stable/stand/i386/libi386/pxe.h
/freebsd-11-stable/stand/i386/pxeldr/pxeldr.S
/freebsd-11-stable/sys/amd64/include/intr_machdep.h
/freebsd-11-stable/sys/arm/arm/ptrace_machdep.c
acpi_isab.c
acpi_pcivar.h
/freebsd-11-stable/sys/dev/pci/vga_pci.c
/freebsd-11-stable/sys/dev/rc/rc.c
/freebsd-11-stable/sys/dev/rc/rcreg.h
/freebsd-11-stable/sys/i386/pci/pci_pir.c
/freebsd-11-stable/sys/kern/kern_ktr.c
/freebsd-11-stable/sys/kern/kern_rwlock.c
/freebsd-11-stable/sys/kern/subr_lock.c
/freebsd-11-stable/sys/kern/subr_sleepqueue.c
/freebsd-11-stable/sys/kern/subr_smp.c
/freebsd-11-stable/sys/sys/_rwlock.h
/freebsd-11-stable/sys/sys/refcount.h
/freebsd-11-stable/sys/sys/rwlock.h
/freebsd-11-stable/sys/sys/sleepqueue.h
/freebsd-11-stable/sys/sys/turnstile.h
/freebsd-11-stable/sys/x86/acpica/madt.c
/freebsd-11-stable/sys/x86/include/apicvar.h
/freebsd-11-stable/sys/x86/include/intr_machdep.h
/freebsd-11-stable/sys/x86/isa/atpic.c
/freebsd-11-stable/sys/x86/isa/elcr.c
/freebsd-11-stable/sys/x86/x86/intr_machdep.c
/freebsd-11-stable/sys/x86/x86/io_apic.c
/freebsd-11-stable/sys/x86/x86/local_apic.c
/freebsd-11-stable/sys/x86/x86/mptable.c
/freebsd-11-stable/sys/x86/x86/mptable_pci.c
/freebsd-11-stable/sys/x86/xen/pvcpu_enum.c
/freebsd-11-stable/tests/sys/capsicum/ioctls_test.c
/freebsd-11-stable/tests/sys/kern/ptrace_test.c
/freebsd-11-stable/tools/tools/decioctl/decioctl.c
/freebsd-11-stable/usr.sbin/devctl/devctl.8
/freebsd-11-stable/usr.sbin/devctl/devctl.c
359652 06-Apr-2020 hselasky

MFC r333806:
Use NULL for SYSINIT's last arg, which is a pointer type

Sponsored by: The FreeBSD Foundation

359076 18-Mar-2020 hrs

MFC of r355574, r358095, and r358395:

Add ACPI battery subsystem man page.

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.

Add workaround for models which do not follow the ACPI specification strictly.
Extra objects are now simply ignored instead of rejecting everything.

Differential Revision: https://reviews.freebsd.org/D22556
Differential Revision: https://reviews.freebsd.org/D23728

358884 11-Mar-2020 hselasky

MFC r358537:
Expose the ACPI power button, sleep button and LID state as evdev's.

This allows libinput to disable touchpads when the lid is closed and
various desktop environments can show power-off dialogs when the power
button is pressed. While the latter is doable with devd a
cross-platform solution is nicer.

Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D23863
Sponsored by: Mellanox Technologies

358536 02-Mar-2020 hselasky

MFC r358219 and r358270:
Make sure the ACPI lid state is updated during boot and after resume.
While at it update the sysctl(9) description for the lid state.

Always check return value from acpi_GetInteger().
If a failure happens reading the lid state, assume the lid is opened.

Differential Revision: https://reviews.freebsd.org/D23724
PR: 240881
Submitted by: Yuri Pankov <yuripv@yuripv.me>
Sponsored by: Mellanox Technologies

358535 02-Mar-2020 hselasky

MFC r315166:
Export the actual LID state via sysctl. This allows more complex
policies about when to suspend based on other events happening AND the
lid being closed through the use of clever devd or other scripts.

357656 07-Feb-2020 mav

MFC r326956 (by cem):
Implement ACPI CPU support when Processor object is not present

By the ACPI standard (ACPI 5 chapter 8.4 Declaring Processors) Processors
can be implemented in 2 distinct ways:

* Through a Processor object type (which provides P_BLK)
* Through a Device object type

Prior to this change, the FreeBSD driver only supported the former. AMD
Epyc / Poweredge systems we are testing both implement the latter only. Add
the missing support.

Because P_BLK is not defined in the device object case, C-states entering
must be completely controlled via _CST methods rather than P_LVL2/3.

John Baldwin points out that ACPI 6.0 formally deprecates the Processor
keyword, so eventually processors will only be enumerated as Device objects.

354107 25-Oct-2019 jhb

MFC 353585,353586: Support hot insertion and removal of PCI devices on EC2.

353585:
Export pci_attach() and pci_detach().

353586:
Support hot insertion and removal of PCI devices on EC2.

Install ACPI notify handlers on PCI devices with an _EJ0 method. This
handler is invoked when devices are added or removed.

- When an ACPI_NOTIFY_DEVICE_CHECK event posts, rescan the parent bus
device. Note that strictly speaking we only need to rescan the
specified device, but BUS_RESCAN is what is available, so we rescan
the entire bus.
- When an ACPI_NOTIFY_EJECT_REQUEST event posts, detach the device
associated with the ACPI handle, invoke the _EJ0 method, and then
delete the device.

Eventually this might be changed to vector notify events to devd in
userspace where devctl can be used instead to permit more complex
actions such as graceful unmounting of filesystems.

354058 25-Oct-2019 jhb

MFC 350662:
Detect invalid PCI devices more correctly in PCI interrupt router drivers.

- Check for an invalid device (vendor is invalid) before reading the
header type register when examining function 0 of a possible device.
- When iterating over functions of a device, reject any device whose
16-bit vendor is invalid rather than requiring the full 32-bit
vendor+device to be all 1's. In practice the latter check is
probably fine, but checking the vendor is what the PCI spec
recommends.

348726 06-Jun-2019 allanjude

MFC r348065:

Correct the way remaining battery life is calculated

Previously, if a system had multiple batteries, the remaining life
percentage was calculated as the average of each battery's percent
remaining. This results in rather incorrect values when you consider the
case of the Thinkpad X270 that has a small 3 cell internally battery, and
a hot-swappable 9 cell battery that is used first. Battery 0 is at 100%,
but battery 1 is at 10%, you do not infact have 55% of your capacity
remaining.

The new method calculates the percentage based on remaining capacity
out of total capacity, giving a much more accurate reading.

PR: 229818
Submitted by: Keegan Drake H.P. <kd-dev@pm.me>
Sponsored by: Klara Systems
Event: Waterloo Hackathon 2019
Approved by: re (gjb)

346999 01-May-2019 jhb

MFC 346063: Don't pre-reserve resources for CPU devices when they are set.

CPUs can use shared (RF_SHAREABLE) resources for the I/O port used for
entering and exiting C states. If this I/O port is included in an ACPI
system resource device, then this happens to still work, but if the port
wasn't part of a system resource device, only the first CPU could allocate
the I/O port and use C states since resource_list_reserve() was always
allocating the resource from nexus0 without RF_SHAREABLE. By avoiding
the reservation, the flags from the bus_alloc_resource() in the CPU driver
(which include RF_SHAREABLE) are honored.

PR: 236513

342712 03-Jan-2019 jhb

MFC 339899: Make battery emptying rate available as sysctl variable.

Curiously, the in-kernel routines always use the design voltage to
convert from mA to mW, but acpiconf in userland uses the current
voltage. As a result, this can report a different mW rate than
acpiconf.

340145 04-Nov-2018 mmacy

Backport of r338074 - generalize uart_bus_probe and add SNPS support to x86

Submitted by: Rajesh Kumar
Differential Revision: https://reviews.freebsd.org/D17381


/freebsd-11-stable/sys/arm/at91/uart_bus_at91usart.c
/freebsd-11-stable/sys/arm/cavium/cns11xx/uart_bus_ec.c
/freebsd-11-stable/sys/arm/nvidia/tegra_uart.c
/freebsd-11-stable/sys/arm/xscale/i8134x/uart_bus_i81342.c
/freebsd-11-stable/sys/arm/xscale/ixp425/uart_bus_ixp425.c
/freebsd-11-stable/sys/arm/xscale/pxa/uart_bus_pxa.c
acpi.c
/freebsd-11-stable/sys/dev/uart/uart.h
/freebsd-11-stable/sys/dev/uart/uart_bus.h
/freebsd-11-stable/sys/dev/uart/uart_bus_acpi.c
/freebsd-11-stable/sys/dev/uart/uart_bus_ebus.c
/freebsd-11-stable/sys/dev/uart/uart_bus_fdt.c
/freebsd-11-stable/sys/dev/uart/uart_bus_isa.c
/freebsd-11-stable/sys/dev/uart/uart_bus_pccard.c
/freebsd-11-stable/sys/dev/uart/uart_bus_pci.c
/freebsd-11-stable/sys/dev/uart/uart_bus_puc.c
/freebsd-11-stable/sys/dev/uart/uart_bus_scc.c
/freebsd-11-stable/sys/dev/uart/uart_core.c
/freebsd-11-stable/sys/dev/uart/uart_cpu.h
/freebsd-11-stable/sys/dev/uart/uart_cpu_acpi.h
/freebsd-11-stable/sys/dev/uart/uart_cpu_fdt.c
/freebsd-11-stable/sys/dev/uart/uart_cpu_fdt.h
/freebsd-11-stable/sys/dev/uart/uart_dev_ns8250.c
/freebsd-11-stable/sys/dev/uart/uart_dev_pl011.c
/freebsd-11-stable/sys/dev/uart/uart_dev_snps.c
/freebsd-11-stable/sys/mips/adm5120/uart_bus_adm5120.c
/freebsd-11-stable/sys/mips/alchemy/uart_bus_alchemy.c
/freebsd-11-stable/sys/mips/atheros/uart_bus_ar71xx.c
/freebsd-11-stable/sys/mips/atheros/uart_bus_ar933x.c
/freebsd-11-stable/sys/mips/broadcom/uart_bus_chipc.c
/freebsd-11-stable/sys/mips/cavium/uart_bus_octeonusart.c
/freebsd-11-stable/sys/mips/idt/uart_bus_rc32434.c
/freebsd-11-stable/sys/mips/malta/uart_bus_maltausart.c
/freebsd-11-stable/sys/mips/rmi/uart_bus_xlr_iodi.c
/freebsd-11-stable/sys/mips/rt305x/uart_bus_rt305x.c
/freebsd-11-stable/sys/modules/uart/Makefile
/freebsd-11-stable/sys/pc98/include/acpica_machdep.h
/freebsd-11-stable/sys/powerpc/psim/uart_iobus.c
/freebsd-11-stable/sys/sparc64/pci/sbbc.c
337121 02-Aug-2018 avg

MFC r335934: remove unneeded inclusion of sys/interrupt.h from several files

337117 02-Aug-2018 avg

MFC r334479: call AcpiLeaveSleepStatePrep after re-enabling interrupts

335657 26-Jun-2018 avg

MFC r334204,r334338: re-synchronize TSC-s on SMP systems after resume

335656 26-Jun-2018 avg

MFC r333994: stop and restart kernel event timers in the suspend / resume cycle

335554 22-Jun-2018 avg

MFC r332918, r333222: go deeper for ACPI suspend bounce test

debug.acpi.suspend_bounce sysctl now allows a deeper dive into the sleep
abyss. The system will execute the suspend sequence up to the call to
AcpiEnterSleepState(). That includes saving processor contexts and
parking APs. Then, instead of actually entering the sleep state, the
BSP will call resumectx() to emulate the wakeup. The APs should get
restarted by the sequence of Init and Startup IPIs that BSP sends to
them.

AcpiOsEnterSleep() is used to implement this feature.

Joint work with jkim.

335533 22-Jun-2018 avg

MFC r333209: hpet: use macros instead of magic values for the timer mode

333080 28-Apr-2018 jhb

MFC 332733:
Workaround fixed I/O port resources encoded as I/O port ranges in _CRS.

ACPI I/O port descriptors use _MIN and _MAX fields to specify the set
of allowable base (start) addresses for an I/O port resource along with
a _LEN field specifying the length. A fixed resource is supposed to be
encoded with _MIN == _MAX, but some buggy firmwares instead set _MAX to
the end of the fixed range. Relocating I/O ranges only make sense in
_PRS (possible resource settings), not in _CRS (current resource settings),
so if an I/O port range with _MAX set set to the end of the range is
present in _CRS, treat it as a fixed I/O port resource starting at
_MIN.

PR: 224096

332830 20-Apr-2018 jtl

MFC r313447:
Ensure the idle thread's loop services interrupts in a timely way when
using the ACPI C1/mwait sleep method.

Previously, the mwait instruction would return when an interrupt was
pending; however, the idle loop did not actually enable interrupts when
this occurred. This led to a situation where the idle loop could quickly
spin through the C1/mwait sleep method a number of times when an interrupt
was pending. (Eventually, the situation corrected itself when something
other than an interrupt triggered the idle loop to either enable
interrupts or schedule another thread.)

Sponsored by: Netflix, Inc.

328386 25-Jan-2018 pkelsey

MFC r316648:

Corrected misspelled versions of rendezvous.

The MFC maintains smp_no_rendevous_barrier() as a symbol alias of
smp_no_rendezvous_barrier().

__FreeBSD_version bumped to indicate presence of the new name
smp_no_rendezvous_barrier().

Reviewed by: gnn, jhb (email), kib
Differential Revision: https://reviews.freebsd.org/D10313

327557 04-Jan-2018 jkim

MFC: r323076, r324502, r325670, r326866

Merge ACPICA 20171214.


/freebsd-11-stable/sys/conf/files
/freebsd-11-stable/sys/contrib/dev/acpica/changes.txt
/freebsd-11-stable/sys/contrib/dev/acpica/common/adfile.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/adisasm.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahtable.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmswitch.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtable.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtables.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtbdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtbinfo.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslallocate.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcache.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcodegen.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompile.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompiler.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompiler.l
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asldebug.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asldefine.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslerror.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslfiles.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslhelp.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslload.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmain.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmapenter.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmaputils.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmessages.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmessages.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmethod.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asloperands.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslopt.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asloptions.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslparseop.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslprintf.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslresource.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrules.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslstartup.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslsupport.l
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltree.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltypes.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvcompiler.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvdisasm.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvparser.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtcompile.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtcompiler.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtexpress.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtfield.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtio.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtparser.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtsubtable.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttable.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttable1.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttable2.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttemplate.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttemplate.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prexpress.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prmacros.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prparser.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prscan.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbconvert.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbexec.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbfileio.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbinput.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswexec.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswload.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswload2.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evgpe.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evregion.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exconcat.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exconvrt.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exmisc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exresop.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwgpe.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwregs.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwtimer.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwvalid.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsaccess.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsconvert.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsnames.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nssearch.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsxfeval.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psargs.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utdebug.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utdecode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/uterror.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utinit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utmath.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utmutex.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utnonansi.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utosi.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/uttrack.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utxferror.c
/freebsd-11-stable/sys/contrib/dev/acpica/include/acapps.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acconfig.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acdebug.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acdisasm.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acexcep.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acglobal.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/achware.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acinterp.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/aclocal.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acmacros.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acnamesp.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acpixf.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl1.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl2.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actypes.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acutils.h
/freebsd-11-stable/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c
acpi_cpu.c
/freebsd-11-stable/usr.sbin/acpi/acpidb/Makefile
/freebsd-11-stable/usr.sbin/acpi/iasl/Makefile
327556 04-Jan-2018 jkim

MFC: r324501

Do not check whether AcpiOsGetTimer() is called during boot.

322877 25-Aug-2017 jkim

MFC: r319365, r321670

Merge ACPICA 20170728.


/freebsd-11-stable/sys/conf/files
/freebsd-11-stable/sys/contrib/dev/acpica/changes.txt
/freebsd-11-stable/sys/contrib/dev/acpica/common/acfileio.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/adfile.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/adisasm.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/adwalk.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahids.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahpredef.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahtable.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahuuids.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmextern.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmrestag.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmswitch.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtable.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtbdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtbinfo.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslanalyze.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslascii.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslbtypes.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcodegen.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompile.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompiler.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompiler.l
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcstyle.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asldefine.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslerror.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslexternal.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslfold.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslglobal.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslhelp.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslhelpers.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslkeywords.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asllength.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asllisting.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslload.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asllookup.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmain.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmap.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmapoutput.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmessages.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmessages.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmethod.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asloffset.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslopcodes.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslopt.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asloptions.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslparseop.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslparser.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslpld.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslpredef.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslprimaries.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslprintf.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslresource.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslresources.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype2s.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrules.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslstartup.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslsupport.l
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslsupport.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltokens.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltransform.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltree.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltypes.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltypes.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslwalks.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslxref.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvcompiler.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvdisasm.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvparser.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtcompile.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtcompiler.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtfield.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttable1.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttable2.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttemplate.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prmacros.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbdisply.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbexec.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsargs.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswexec.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswload.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswload2.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evxfevnt.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/excreate.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exdebug.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exmisc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exoparg1.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exoparg2.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exresolv.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwregs.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsaccess.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsarguments.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsinit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsnames.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsprepkg.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsxfeval.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psloop.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psopcode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psparse.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rscalc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsinfo.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsmisc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsserial.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbdata.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbfadt.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbinstal.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbxfload.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utdecode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/uthex.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utmath.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utmisc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utownerid.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utresdecode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utresrc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utstate.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/uttrack.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utxfmutex.c
/freebsd-11-stable/sys/contrib/dev/acpica/include/acapps.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acdisasm.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acdispat.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acglobal.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/aclocal.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acnames.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acobject.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acopcode.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acpi.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acpixf.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acpredef.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acresrc.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acrestyp.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actables.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl1.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl2.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl3.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actypes.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acutils.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acuuid.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/amlcode.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/amlresrc.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/platform/acenv.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/platform/acfreebsd.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/platform/acgcc.h
/freebsd-11-stable/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c
acpi.c
/freebsd-11-stable/usr.sbin/acpi/acpidb/Makefile
/freebsd-11-stable/usr.sbin/acpi/iasl/Makefile
320744 06-Jul-2017 markj

MFC r320690:
Defer ACPI taskqueue creation to SI_SUB_KICK_SCHEDULER.

PR: 220277

318392 17-May-2017 sephe

MFC 318136

hyperv/vmbus: Reorganize vmbus device tree

For GEN1 Hyper-V, vmbus is attached to pcib0, which contains the
resources for PCI passthrough and SR-IOV. There is no
acpi_syscontainer0 on GEN1 Hyper-V.

For GEN2 Hyper-V, vmbus is attached to acpi_syscontainer0, which
contains the resources for PCI passthrough and SR-IOV. There is
no pcib0 on GEN2 Hyper-V.

The ACPI VMBUS device now only holds its _CRS, which is empty as
of this commit; its existence is mainly for upward compatibility.

Device tree structure is suggested by jhb@.

Tested-by: dexuan@
Collabrated-wth: dexuan@
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D10565

316303 30-Mar-2017 jkim

MFC: r306686, r308953, r311462, r311529, r312438, r314611

- Merge ACPICA 20170303.
- Remove '-vd' option to make iasl(8) reproducible.

Relnotes: yes


/freebsd-11-stable/sys/arm64/acpica/OsdEnvironment.c
/freebsd-11-stable/sys/conf/files
/freebsd-11-stable/sys/contrib/dev/acpica/acpica_prep.sh
/freebsd-11-stable/sys/contrib/dev/acpica/changes.txt
/freebsd-11-stable/sys/contrib/dev/acpica/common/acfileio.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/acgetline.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/adfile.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/adisasm.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/adwalk.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahids.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahpredef.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahtable.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/ahuuids.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/cmfsize.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmextern.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmrestag.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtable.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtables.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtbdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/dmtbinfo.c
/freebsd-11-stable/sys/contrib/dev/acpica/common/getopt.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslanalyze.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslascii.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslbtypes.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcodegen.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompile.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompiler.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcompiler.l
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslcstyle.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asldebug.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asldefine.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslerror.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslexternal.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslfileio.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslfiles.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslfold.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslglobal.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslhelp.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslhelpers.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslhex.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslkeywords.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asllength.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asllisting.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asllistsup.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslload.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asllookup.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmain.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmap.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmapenter.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmapoutput.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmaputils.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmessages.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmessages.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslmethod.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslnamesp.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asloffset.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslopcodes.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asloperands.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslopt.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asloptions.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslparser.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslpld.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslpredef.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslprepkg.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslprimaries.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslprintf.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslprune.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslresource.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslresources.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype1.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype1i.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype2.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype2d.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype2e.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype2q.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype2s.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrestype2w.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslrules.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslstartup.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslstubs.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslsupport.l
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslsupport.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltokens.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltransform.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltree.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltypes.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asltypes.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/asluuid.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslwalks.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslxref.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/aslxrefout.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvcompiler.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvdisasm.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/cvparser.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtcompile.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtcompiler.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtexpress.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtfield.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtio.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtparser.l
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtparser.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtsubtable.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttable.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttable1.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttable2.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttemplate.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dttemplate.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/dtutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/preprocess.h
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prexpress.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prmacros.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prparser.l
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prparser.y
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prscan.c
/freebsd-11-stable/sys/contrib/dev/acpica/compiler/prutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbcmds.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbconvert.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbdisply.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbexec.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbfileio.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbhistry.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbinput.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbmethod.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbnames.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbstats.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbtest.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/debugger/dbxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmcstyle.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmnames.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmresrcs.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/disassembler/dmwalk.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsargs.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsdebug.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsinit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsmethod.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsmthdat.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsopcode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dsutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswexec.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswload.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswload2.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswscope.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/dispatcher/dswstate.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evevent.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evglock.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evgpe.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evgpeblk.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evgpeinit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evgpeutil.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evhandler.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evmisc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evregion.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evrgnini.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evsci.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evxfevnt.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evxfgpe.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/events/evxfregn.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exconcat.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exconfig.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exconvrt.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/excreate.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exdebug.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exfield.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exfldio.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exmisc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exmutex.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exnames.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exoparg1.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exoparg2.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exoparg3.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exoparg6.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exprep.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exregion.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exresnte.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exresolv.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exresop.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exstore.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exstoren.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exstorob.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exsystem.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/extrace.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/executer/exutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwacpi.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwesleep.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwgpe.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwpci.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwregs.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwsleep.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwtimer.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwvalid.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsaccess.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsalloc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsarguments.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsconvert.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nseval.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsinit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsload.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsnames.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsparse.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nspredef.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsprepkg.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsrepair.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsrepair2.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nssearch.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nswalk.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsxfeval.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsxfname.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/namespace/nsxfobj.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psargs.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psloop.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psopcode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psopinfo.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psparse.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psscope.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/pstree.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/pswalk.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/parser/psxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsaddr.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rscalc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rscreate.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsdump.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsdumpinfo.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsinfo.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsio.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsirq.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rslist.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsmemory.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsmisc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsserial.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/resources/rsxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbdata.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbfadt.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbfind.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbinstal.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbprint.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbutils.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbxfload.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/tables/tbxfroot.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utaddress.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utalloc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utascii.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utbuffer.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utcache.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utcopy.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utdebug.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utdecode.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utdelete.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/uterror.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/uteval.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utexcep.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utglobal.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/uthex.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utids.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utinit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utlock.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utmath.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utmisc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utmutex.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utnonansi.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utobject.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utosi.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utownerid.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utpredef.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utprint.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utresrc.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utstate.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utstring.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/uttrack.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utuuid.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utxface.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utxferror.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utxfinit.c
/freebsd-11-stable/sys/contrib/dev/acpica/components/utilities/utxfmutex.c
/freebsd-11-stable/sys/contrib/dev/acpica/include/acapps.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acbuffer.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acclib.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/accommon.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acconfig.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acconvert.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acdebug.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acdisasm.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acdispat.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acevents.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acexcep.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acglobal.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/achware.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acinterp.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/aclocal.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acmacros.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acnames.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acnamesp.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acobject.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acopcode.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acoutput.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acparser.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acpi.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acpiosxf.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acpixf.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acpredef.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acresrc.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acrestyp.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acstruct.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actables.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl1.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl2.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actbl3.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/actypes.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acutils.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/acuuid.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/amlcode.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/amlresrc.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/platform/acenv.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/platform/acenvex.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/platform/acfreebsd.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/platform/acgcc.h
/freebsd-11-stable/sys/contrib/dev/acpica/include/platform/acgccex.h
/freebsd-11-stable/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c
/freebsd-11-stable/sys/contrib/dev/acpica/os_specific/service_layers/oslibcfs.c
/freebsd-11-stable/sys/contrib/dev/acpica/os_specific/service_layers/osunixxf.c
Osd/OsdDebug.c
Osd/OsdHardware.c
Osd/OsdTable.c
/freebsd-11-stable/sys/x86/acpica/OsdEnvironment.c
/freebsd-11-stable/sys/x86/acpica/madt.c
/freebsd-11-stable/sys/x86/acpica/srat.c
/freebsd-11-stable/sys/x86/xen/pvcpu_enum.c
/freebsd-11-stable/usr.sbin/acpi/acpidb/Makefile
/freebsd-11-stable/usr.sbin/acpi/acpidb/acpidb.c
/freebsd-11-stable/usr.sbin/acpi/iasl/Makefile
315263 14-Mar-2017 hselasky

MFC r314328:

Fix startup race initialising ACPI CM battery structures on MacBookPro.

During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.

Reviewed by: avg @

315020 10-Mar-2017 vangyzen

MFC r313817

acpica: remove a superfluous NULL check

The address-of operator can't produce NULL (in practice).
Remove an unnecessary NULL check.

Sponsored by: Dell EMC

314999 10-Mar-2017 kib

MFC r314211:
Remove cpu_deepest_sleep variable.

310487 23-Dec-2016 jhb

MFC 309588: Don't attach to Host-PCI bridges with a bad bus number.

If the bus number assigned to a Host-PCI bridge doesn't match the first
bus number in the associated producer range from _CRS, print a warning and
fail to attach rather than panicking due to an assertion failure.

At least one single-socket Dell machine leaves a "ghost" Host-PCI bridge
device in the ACPI namespace that seems to correspond to the I/O hub in
the second socket of a two-socket machine. However, the BIOS doesn't
configure the settings for this "ghost" bridge correctly, nor does it have
any PCI devices behind it.

310253 19-Dec-2016 hselasky

MFC r309400:
Fix for endless recursion in the ACPI GPE handler during boot.

When handling a GPE ACPI interrupt object the EcSpaceHandler()
function can be called which checks the EC_EVENT_SCI bit and then
recurse on the EcGpeQueryHandler() function. If there are multiple GPE
events pending the EC_EVENT_SCI bit will be set at the next call to
EcSpaceHandler() causing it to recurse again via the
EcGpeQueryHandler() function. This leads to a slow never ending
recursion during boot which prevents proper system startup, because
the EC_EVENT_SCI bit never gets cleared in this scenario.

The behaviour is reproducible with the ALASKA AMI in combination with
a newer Skylake based mainboard in the following way:

Enter BIOS and adjust the clock one hour forward. Save and exit the
BIOS. System fails to boot due to the above mentioned bug in
EcGpeQueryHandler() which was observed recursing multiple times.

This patch adds a simple recursion guard to the EcGpeQueryHandler()
function and also also adds logic to detect if new GPE events occurred
during the execution of EcGpeQueryHandler() and then loop on this
function instead of recursing.

Reviewed by: jhb

305866 16-Sep-2016 kib

MFC r304285:
Implement userspace gettimeofday(2) with HPET timecounter.

305538 07-Sep-2016 kib

MFC r304279:
By default, allow all to read the HPET registers pages. At the same
time, by, by default disallow writes to the mmaped HPET pages.

302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
301562 07-Jun-2016 cem

Fix a minor leak in ACPI thermal

Introduced in r301518.

Reported by: Coverity
CID: 1356266
Sponsored by: EMC / Isilon Storage Division


301518 06-Jun-2016 jhb

Defer the creation of ACPI thermal kthreads to a startup sysinit.

The SYSINIT runs at SI_SUB_KICK_SCHEDULER after the scheduler is fully
initialized and timers are working. This fixes booting in the
EARLY_AP_STARTUP case.


301418 05-Jun-2016 adrian

[acpi] graphics drivers want access to acpi lid handle

the graphics drivers can benefit from access to the lid handle for querying and getting notifications

Submitted by: kmacy
Differential Revision: https://reviews.freebsd.org/D6643


300421 22-May-2016 loos

Fix the deciKelvin to Celsius conversion in kernel.

After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C
reference and as result, the temperature read in sysctl(8) now exibits a
+0.1C difference.

This commit fix the kernel references to match the reference value used in
sysctl(8) after r285994.

Sponsored by: Rubicon Communications (Netgate)


300249 20-May-2016 jhb

Implement a proper detach method for the PCI-PCI bridge driver.

- Add a pcib_detach() function for the PCI-PCI bridge driver. It
tears down the NEW_PCIB and hotplug state including destroying
resource managers, deleting child devices, and disabling hotplug
events.
- Add a detach method to the ACPI PCI-PCI bridge driver which calls
pcib_detach() and then frees the copy of the _PRT interrupt routing
table.
- Add a detach method to the PCI-Cardbus bridge driver which frees
the PCI bus resources in addition to calling cbb_detach().
- Explicitly clear any pending hotplug events during attach to ensure
future events will generate an interrupt.
- If a the Command Completed bit is set in the slot status register
when the command completion timeout fires, treat it as if the
command completed and the completion interrupt was just lost rather
than forcing a detach.
- Don't wait for a Command Completed notification if Command Completion
interrupts are disabled. The spec explicitly says no interrupt is
enabled when clearing CCIE, and on my T400 no interrupt is generated
when CCIE is changed from cleared to set, either. In addition, the
T400 doesn't appear to set the Command Completed bit in the cases
where it doesn't generate an interrupt, so don't schedule the timer
either. (If the CC bit were always set, one could always set the timer
and rely on the logic of treating CC set as a missed interrupt.)

Reviewed by: imp (older version)
Differential Revision: https://reviews.freebsd.org/D6424


299977 16-May-2016 jhb

Use polling spin loops for timeouts during early boot.

Some ACPI operations such as mutex acquires and event waits accept a
timeout. The ACPI OSD layer implements these timeouts by using regular
sleep timeouts. However, this doesn't work during early boot before
event timers are setup. Instead, use polling combined with DELAY()
to spin.

This fixes booting on upcoming Intel systems with Kaby Lake processors.

Tested by: "Jeffrey E Pieper" <jeffrey.e.pieper@intel.com>
Reviewed by: jimharris
MFC after: 1 week


299746 14-May-2016 jhb

Add an EARLY_AP_STARTUP option to start APs earlier during boot.

Currently, Application Processors (non-boot CPUs) are started by
MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until
SI_SUB_SMP at which point they are released to run kernel threads.
SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter
the scheduler and start running threads until fairly late in the
boot.

This change moves SI_SUB_SMP up to just before software interrupt
threads are created allowing the APs to start executing kernel
threads much sooner (before any devices are probed). This allows
several initialization routines that need to perform initialization
on all CPUs to now perform that initialization in one step rather
than having to defer the AP initialization to a second SYSINIT run
at SI_SUB_SMP. It also permits all CPUs to be available for
handling interrupts before any devices are probed.

This last feature fixes a problem on with interrupt vector exhaustion.
Specifically, in the old model all device interrupts were routed
onto the boot CPU during boot. Later after the APs were released at
SI_SUB_SMP, interrupts were redistributed across all CPUs.

However, several drivers for multiqueue hardware allocate N interrupts
per CPU in the system. In a system with many CPUs, just a few drivers
doing this could exhaust the available pool of interrupt vectors on
the boot CPU as each driver was allocating N * mp_ncpu vectors on the
boot CPU. Now, drivers will allocate interrupts on their desired CPUs
during boot meaning that only N interrupts are allocated from the boot
CPU instead of N * mp_ncpu.

Some other bits of code can also be simplified as smp_started is
now true much earlier and will now always be true for these bits of
code. This removes the need to treat the single-CPU boot environment
as a special case.

As a transition aid, the new behavior is available under a new kernel
option (EARLY_AP_STARTUP). This will allow the option to be turned off
if need be during initial testing. I plan to enable this on x86 by
default in a followup commit in the next few days and to have all
platforms moved over before 11.0. Once the transition is complete,
the option will be removed along with the !EARLY_AP_STARTUP code.

These changes have only been tested on x86. Other platform maintainers
are encouraged to port their architectures over as well. The main
things to check for are any uses of smp_started in MD code that can be
simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in
the EARLY_AP_STARTUP case (e.g. the interrupt shuffling).

PR: kern/199321
Reviewed by: markj, gnn, kib
Sponsored by: Netflix


299353 10-May-2016 trasz

Remove misc NULL checks after M_WAITOK allocations.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation


299286 09-May-2016 jhb

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).


299142 05-May-2016 jhb

Native PCI-express HotPlug support.

PCI-express HotPlug support is implemented via bits in the slot
registers of the PCI-express capability of the downstream port along
with an interrupt that triggers when bits in the slot status register
change.

This is implemented for FreeBSD by adding HotPlug support to the
PCI-PCI bridge driver which attaches to the virtual PCI-PCI bridges
representing downstream ports on HotPlug slots. The PCI-PCI bridge
driver registers an interrupt handler to receive HotPlug events. It
also uses the slot registers to determine the current HotPlug state
and drive an internal HotPlug state machine. For simplicty of
implementation, the PCI-PCI bridge device detaches and deletes the
child PCI device when a card is removed from a slot and creates and
attaches a PCI child device when a card is inserted into the slot.

The PCI-PCI bridge driver provides a bus_child_present which claims
that child devices are present on HotPlug-capable slots only when a
card is inserted. Rather than requiring a timeout in the RC for
config accesses to not-present children, the pcib_read/write_config
methods fail all requests when a card is not present (or not yet
ready).

These changes include support for various optional HotPlug
capabilities such as a power controller, mechanical latch,
electro-mechanical interlock, indicators, and an attention button.
It also includes support for devices which require waiting for
command completion events before initiating a subsequent HotPlug
command. However, it has only been tested on ExpressCard systems
which support surprise removal and have none of these optional
capabilities.

PCI-express HotPlug support is conditional on the PCI_HP option
which is enabled by default on arm64, x86, and powerpc.

Reviewed by: adrian, imp, vangyzen (older versions)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D6136


299126 05-May-2016 jkim

Fix intmax_t to uintptr_t casting on 32-bit platforms. Found by GCC.

Submitted by: bde


298955 03-May-2016 pfg

sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.


298951 03-May-2016 jhb

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.


298933 02-May-2016 jhb

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


298754 28-Apr-2016 jhb

Only count CPU devices that are using the ACPI CPU driver.

Arguably we should only be doing the probe/attach to children of
these devices as well.

Tested by: Michal Stanek <mst_semihalf.com> (arm64)
Differential Revision: https://reviews.freebsd.org/D6133


298722 27-Apr-2016 jhb

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


298714 27-Apr-2016 jkim

Merge ACPICA 20160422.


298711 27-Apr-2016 jhb

Add a pcib_attach_child() method to manage adding the child "pci" device.

This allows the PCI-PCI bridge driver to save a reference to the child
device in its softc.

Note that this required moving the "pci" device creation out of
acpi_pcib_attach(). Instead, acpi_pcib_attach() is renamed to
acpi_pcib_fetch_prt() as it's sole action now is to fetch the PCI
interrupt routing table.

Differential Revision: https://reviews.freebsd.org/D6021


298484 22-Apr-2016 jhb

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


298425 21-Apr-2016 jhb

Queue the CPU-probing task after all acpi_cpu devices are attached.

Eventually with earlier AP startup this code will change to call the
startup function synchronously instead of queueing the task. Moving
the time we queue the task should be a no-op since taskqueue threads
don't start executing tasks until much later, but this reduces the diff
with the earlier AP startup patches.

Sponsored by: Netflix


298380 20-Apr-2016 jkim

Prefer sizeof(*pointer) over sizeof(type). No funtional change.


298379 20-Apr-2016 jkim

There is no need to use array any more. No functional change.


298377 20-Apr-2016 jkim

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


298372 20-Apr-2016 jhb

Invoke _OSC on Host-PCI bridges.

Tell the firmware that we support PCI-express config space access
and MSI.

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


298370 20-Apr-2016 jhb

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


298029 15-Apr-2016 jhb

Add a new PCI bus interface method to alloc the ivars (dinfo) for a device.

The ACPI and OFW PCI bus drivers as well as CardBus override this to
allocate the larger ivars to hold additional info beyond the stock PCI ivars.

This removes the need to pass the size to functions like pci_add_iov_child()
and pci_read_device() simplifying IOV and bus rescanning implementations.

As a result of this and earlier changes, the ACPI PCI bus driver no longer
needs its own device_attach and pci_create_iov_child methods but can use
the methods in the stock PCI bus driver instead.

Differential Revision: https://reviews.freebsd.org/D5891


297748 09-Apr-2016 jhb

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


297679 07-Apr-2016 jhb

Associate device_t objects with ACPI handles via PCI_CHILD_ADDED().

Previously, the ACPI PCI bus driver did a single pass over the devices in
the namespace that were a child of a given PCI bus to associate the
PCI bus-enumerated device_t devices with the corresponding ACPI handles.
However, this meant that handles were only established at runtime for devices
found during the initial PCI bus scan.

PCI_IOV adds devices that show up after the initial PCI bus scan, and coming
changes to add a bus rescan can also add devices after the initial scan.

This change adds a pci_child_added() callback to the ACPI PCI bus that walks
the namespace to find the ACPI handle for each device that is added. Using
a callback means that the handle is correctly set for any device no matter
how it is added (initial scan, IOV, or a bus rescan).


297608 06-Apr-2016 jhb

Convert pci_delete_child() to a bus_child_deleted() method.

Instead of providing a wrapper around device_delete_child() that the PCI
bus and child bus drivers must call explicitly, move the bulk of the logic
from pci_delete_child() into a bus_child_deleted() method
(pci_child_deleted()). This allows PCI devices to be safely deleted via
device_delete_child().
- Add a bus_child_deleted method to the ACPI PCI bus which clears the
device_t associated with the corresponding ACPI handle in addition to
the normal PCI bus cleanup.
- Change cardbus_detach_card to call device_delete_children() and move
CardBus-specific delete logic into a new cardbus_child_deleted() method.
- Use device_delete_child() instead of pci_delete_child() in the SRIOV code.
- Add a bus_child_deleted method to the OpenFirmware PCI bus drivers which
frees the OpenFirmware device info for each PCI device.

Reviewed by: imp
Tested on: amd64 (CardBus and PCI-e hotplug)
Differential Revision: https://reviews.freebsd.org/D5831


297000 18-Mar-2016 jhibbits

Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.

On some architectures, u_long isn't large enough for resource definitions.
Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but
type `long' is only 32-bit. This extends rman's resources to uintmax_t. With
this change, any resource can feasibly be placed anywhere in physical memory
(within the constraints of the driver).

Why uintmax_t and not something machine dependent, or uint64_t? Though it's
possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on
32-bit architectures. 64-bit architectures should have plenty of RAM to absorb
the increase on resource sizes if and when this occurs, and the number of
resources on memory-constrained systems should be sufficiently small as to not
pose a drastic overhead. That being said, uintmax_t was chosen for source
clarity. If it's specified as uint64_t, all printf()-like calls would either
need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t
aren't horrible, but it would also bake into the API for
resource_list_print_type() either a hidden assumption that entries get cast to
uintmax_t for printing, or these calls would need the PRI*64 macros. Since
source code is meant to be read more often than written, I chose the clearest
path of simply using uintmax_t.

Tested on a PowerPC p5020-based board, which places all device resources in
0xfxxxxxxxx, and has 8GB RAM.
Regression tested on qemu-system-i386
Regression tested on qemu-system-mips (malta profile)

Tested PAE and devinfo on virtualbox (live CD)

Special thanks to bz for his testing on ARM.

Reviewed By: bz, jhb (previous)
Relnotes: Yes
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D4544


296372 04-Mar-2016 jhibbits

Remove default initializations for rman, a'la r296331


295940 23-Feb-2016 jkim

Silence PVS-Studio warning (V595).


295939 23-Feb-2016 jkim

Silence PVS-Studio warning (V595).


295938 23-Feb-2016 jkim

Remove brightness notify handler before reinstalling new one.


295936 23-Feb-2016 jkim

Fix white spaces.


295935 23-Feb-2016 jkim

Fix style(9) bugs.


295841 20-Feb-2016 kib

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


295839 20-Feb-2016 kib

Switch /dev/hpet to use make_dev_s(9). Device needs si_drv1
initializated, do it correctly even though hpet cannot be loaded as
module.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week


295832 20-Feb-2016 jhibbits

Introduce a RMAN_IS_DEFAULT_RANGE() macro, and use it.

This simplifies checking for default resource range for bus_alloc_resource(),
and improves readability.

This is part of, and related to, the migration of rman_res_t from u_long to
uintmax_t.

Discussed with: jhb
Suggested by: marcel


295791 19-Feb-2016 adrian

document some ACPI related sysctls.

Submitted by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
Sponsored by: HardenedBSD
Differential Revision: https://reviews.freebsd.org/D5263


295777 18-Feb-2016 jkim

Remove a bogus bzero() call.

Found by: PVS-Studio


294883 27-Jan-2016 jhibbits

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


288446 01-Oct-2015 cperciva

Disable suspend when we're shutting down. This solves the "tell FreeBSD
to shut down; close laptop lid" scenario which otherwise tended to end
with a laptop overheating or the battery dying.

The implementation uses a new sysctl, kern.suspend_blocked; init(8) sets
this while rc.suspend runs, and the ACPI sleep code ignores requests while
the sysctl is set.

Discussed on: freebsd-acpi (35 emails)
MFC after: 1 week


287882 16-Sep-2015 zbb

Add domain support to PCI bus allocation

When the system has more than a single PCI domain, the bus numbers
are not unique, thus they cannot be used for "pci" device numbering.
Change bus numbers to -1 (i.e. to-be-determined automatically)
wherever the code did not care about domains.

Reviewed by: jhb
Obtained from: Semihalf
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3406


287168 26-Aug-2015 jkim

Merge ACPICA 20150818.


285799 22-Jul-2015 jkim

Catch up with ACPICA 20150717.


284273 11-Jun-2015 andrew

Add basic support for ACPI. It splits out the nexus driver to two new
drivers, one for fdt, one for acpi. It then uses this to decide if it will
use fdt or acpi.

The GICv2 (interrupt controller) and Generic Timer drivers have been
updated to handle both cases.

As this is early code we still need FDT to find the kernel console, and
some parts are still missing, including PCI support.

Differential Revision: https://reviews.freebsd.org/D2463
Reviewed by: jhb, jkim, emaste
Obtained from: ABT Systems Ltd
Relnotes: Yes
Sponsored by: The FreeBSD Foundation


284195 09-Jun-2015 jkim

Check status of AcpiReadBitRegister() calls.

Reported by: Coverity
CID: 1306132


283291 22-May-2015 jkim

CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head. However, it is continuously misused as the mpsafe argument
for callout_init(9). Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision: https://reviews.freebsd.org/D2613
Reviewed by: jhb
MFC after: 2 weeks


283261 21-May-2015 jkim

Do not probe Intel PIIX4 south bridge quirks on amd64. These quirky south
bridges only supported Intel Pentium and Pentium II era processors and there
is no reason for hardware virtualizations to emulate these quirks.

MFC after: 1 week


282771 11-May-2015 andrew

Hide code only used on i386 and amd64.


282678 09-May-2015 kib

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


282538 06-May-2015 andrew

AcpiGbl_FACS will not be defined when building using the reduced hardware
model. This may be the case on ARM.


282537 06-May-2015 andrew

If the power management timer is unsupported the PmTimerLength value will
be zero.


282149 28-Apr-2015 andrew

There may not be an FACS table, check for this before accessing it.

Sponsored by: The FreeBSD Foundation


281747 19-Apr-2015 adrian

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.


281462 12-Apr-2015 kib

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


281396 11-Apr-2015 jkim

Merge ACPICA 20150410.


281159 06-Apr-2015 jhb

Move the message complaining about failed system resource allocations
under bootverbose. Every example I've seen to date has been due to
an ACPI system resource device reserving a range that overlaps with
system memory (which ram0 attempts to reserve) or a local or I/O APIC
(which apic0 attempts to reserve). These are always harmless but look
scary to users.

MFC after: 1 week


279703 06-Mar-2015 jhb

Fix a typo.


279447 01-Mar-2015 rstone

Implement interface to create SR-IOV Virtual Functions

Implement the interace to create SR-IOV Virtual Functions (VFs).
When a driver registers that they support SR-IOV by calling
pci_setup_iov(), the SR-IOV code creates a new node in /dev/iov
for that device. An ioctl can be invoked on that device to
create VFs and have the driver initialize them.

At this point, allocating memory I/O windows (BARs) is not
supported.

Differential Revision: https://reviews.freebsd.org/D76
Reviewed by: jhb
MFC after: 1 month
Sponsored by: Sandvine Inc.


278871 16-Feb-2015 kib

Array cannot be NULL, remove always true comparision. ACPI spec
identifies the tested condition for _PRT as "BYTE value of 0", so the
remaining part of the conditionals is sufficient.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week


278320 06-Feb-2015 jhb

Add a new device control utility for new-bus devices called devctl. This
allows the user to request administrative changes to individual devices
such as attach or detaching drivers or disabling and re-enabling devices.
- Add a new /dev/devctl2 character device which uses ioctls for device
requests. The ioctls use a common 'struct devreq' which is somewhat
similar to 'struct ifreq'.
- The ioctls identify the device to operate on via a string. This
string can either by the device's name, or it can be a bus-specific
address. (For unattached devices, a bus address is the only way to
locate a device.) Bus drivers register an eventhandler to claim
unrecognized device names that the driver recognizes as a valid address.
Two buses currently support addresses: ACPI recognizes any device
in the ACPI namespace via its full path starting with "\" and
the PCI bus driver recognizes an address specification of
'pci[<domain>:]<bus>:<slot>:<func>' (identical to the PCI selector
strings supported by pciconf).
- To make it easier to cut and paste, change the PnP location string
in the PCI bus driver to output a full PCI selector string rather
than 'slot=<slot> function=<func>'.
- Add a devctl(3) interface in libdevctl which provides a wrapper around
the ioctls and is the preferred interface for other userland code.
- Add a devctl(8) program which is a simple wrapper around the requests
supported by devctl(3).
- Add a device_is_suspended() function to check DF_SUSPENDED.
- Add a resource_unset_value() function that can be used to remove a
hint from the kernel environment. This is used to clear a
hint.<driver>.<unit>.disabled hint when re-enabling a boot-time
disabled device.

Reviewed by: imp (parts)
Requested by: imp (changing PCI location string)
Relnotes: yes


277796 27-Jan-2015 avg

hook userland threads suspend + resume into acpi suspend code

Also, split power_suspend into power_suspend and power_suspend_early.

power_suspend_early is called before the userland is frozen.
power_suspend is called after the userland is frozen.

Currently only VT switching is hooked to power_suspend_early.
This is needed because switching away from X server requires its
cooperation, so obviously X server must not be frozen when that happens.

Freezing userland during ACPI suspend is useful because not all drivers
correctly handle suspension concurrent with other activity. This is
especially applicable to drivers ported from other operating systems
that suspend all software activity between placing drivers and hardware
into suspended state.
In particular drm2/radeon (radeonkms) depends on the described
procedure. The driver does not have any internal synchronization
between suspension activities and processing of userland requests.

Many thanks to kib for the code that allows to freeze and thaw all
userland threads.

Note that ideally we also need to park / inhibit (non-special) kernel
threads as well to ensure that they do not call into drivers.

MFC after: 17 days


277594 23-Jan-2015 jkim

Simplify retry loops. No functional change.


277579 23-Jan-2015 jkim

Revert r216942. This commit was premature and caused too many complaints.

PR: 162859
MFC after: 3 days


277318 18-Jan-2015 cperciva

When disabling C3+ CPU states due to the CPU_QUIRK_NO_C3 quirk, don't
accidentally enable non-existent states.

This bug was triggered if ACPI advertises the presence of a C2 state
which we fail to parse via acpi_PkgGas due to our lack of support for
FFixedHW resources, and causes an immediate panic when an attempt is
made to enter the (NULL) state.

One affected platform is the EC2 c4.8xlarge VM instance type; there
may be others.

MFC after: 1 week
Thanks to: jkim, @_msw_


276724 05-Jan-2015 jhb

On some Intel CPUs with a P-state but not C-state invariant TSC the TSC
may also halt in C2 and not just C3 (it seems that in some cases the BIOS
advertises its C3 state as a C2 state in _CST). Just play it safe and
disable both C2 and C3 states if a user forces the use of the TSC as the
timecounter on such CPUs.

PR: 192316
Differential Revision: https://reviews.freebsd.org/D1441
No objection from: jkim
MFC after: 1 week


274397 11-Nov-2014 jkim

Use the correct device. Note this commit complements r274386.

PR: 194884


274386 11-Nov-2014 adrian

Use the correct device (child) when asking the bus layer about which power
state said device should go into.

This was a snafu introduced in the ACPI/PCI awareness separation.

When putting a device into a power state, the bus (and thus firmware,
eg ACPI) should be asked before hand to check whether the device
can indeed go into that power state.

There's a set of nodes in ACPI under each device - the _SxD nodes - which
state which ACPI power state to put the device into when the system is
going into power save state 'x'. So when going into S3, the existence
of an _S3D node would override whatever the system was trying to do.

By default the PCI code wants to put devices into D3 before suspending.

I have a laptop here (Asus Zenbook - check the PR) whose EHCI controller
really wants to be in D2 during suspend, not D3. So if we put it into
D3 and then try to enter S3, everything hangs. The device itself
can go into D3 - it just can't be there when the call to ACPI to enter
S3 occurs. The PCI patch fixes this.

jkim@ noticed that the same is needed for the ACPI child device
enumeration.

Thankyou to Matt Dillon (the programmer, not the actor) for buying me
this particular laptop so I could debug the issues with the Atheros
AR9485 that is in it. It's his fault that I ended up with this
laptop and was sufficiently annoyed by the lack of USB suspend
to go down this rabbit hole.

Tested:

* Thinkpad T400
* Thinkpad X230
* Thinkpad T42
* Thinkpad T60
* Asus Zenbook (see PR)
* Asus EEEPC 701
* Asus EEEPC 1001PX

TODO:

* Figure out what we should do about devices we unload drivers for
that want to be in a specific state when entering S3 / S4 -
the "put devices into D3 if they're not bound to a driver" option
may also mess with things.

PR: kern/194884
Reviewed by: jhb, jkim
MFC after: 1 week
Relnotes: yes
Sponsored by: Matt Dillon <dillon@apollo.backplane.com> (hardware)


273773 28-Oct-2014 hselasky

The SYSCTL data pointers can come from userspace and must not be
directly accessed. Although this will work on some platforms, it can
throw an exception if the pointer is invalid and then panic the kernel.

Add a missing SYSCTL_IN() of "SCTP_BASE_STATS" structure.

MFC after: 3 days
Sponsored by: Mellanox Technologies


273647 25-Oct-2014 kib

Set the caching mode for the usermode mapping of the HPET registers
page to uncached.

Reviewed by: rpaulo
Sponsored by: The FreeBSD Foundation
MFC after: 1 week


273607 24-Oct-2014 rpaulo

Add a sysctl to control the HPET allow_write behaviour.

Requested by: kib


273602 24-Oct-2014 rpaulo

HPET: avoid handling the multiple file-descriptor case.

It had two bugs: one where mmap was still allowed and another where
D_TRACKCLOSE doesn't handle all cases.

Thanks to jhb and kib for pointing them out.
MFC after: 1 week


273598 24-Oct-2014 rpaulo

HPET: create /dev/hpetN as a way to access HPET from userland.

In some cases, TSC is broken and special applications might benefit
from memory mapping HPET and reading the registers to count time.
Most often the main HPET counter is 32-bit only[1], so this only gives
the application a 300 second window based on the default HPET
interval.
Other applications, such as Intel's DPDK, expect /dev/hpet to be
present and use it to count time as well.

Although we have an almost userland version of gettimeofday() which
uses rdtsc in userland, it's not always possible to use it, depending
on how broken the multi-socket hardware is.

Install the acpi_hpet.h so that applications can use the HPET register
definitions.

[1] I haven't found a system where HPET's main counter uses more than
32 bit. There seems to be a discrepancy in the Intel documentation
(claiming it's a 64-bit counter) and the actual implementation (a
32-bit counter in a 64-bit memory area).

MFC after: 1 week
Relnotes: yes


273174 16-Oct-2014 davide

Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by: kmacy
Tested by: make universe


272799 09-Oct-2014 adrian

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


272444 02-Oct-2014 jkim

Merge ACPICA 20140926.


272360 01-Oct-2014 will

Add sysctl to track the resource consumption of ACPI interrupts.

Submitted by: gibbs
MFC after: 1 month
Sponsored by: Spectra Logic
MFSpectraBSD: 636827 on 2012/09/28


272310 30-Sep-2014 royger

msi: add Xen MSI implementation

This patch adds support for MSI interrupts when running on Xen. Apart
from adding the Xen related code needed in order to register MSI
interrupts this patch also makes the msi_init function a hook in
init_ops, so different MSI implementations can have different
initialization functions.

Sponsored by: Citrix Systems R&D

xen/interface/physdev.h:
- Add the MAP_PIRQ_TYPE_MULTI_MSI to map multi-vector MSI to the Xen
public interface.

x86/include/init.h:
- Add a hook for setting custom msi_init methods.

amd64/amd64/machdep.c:
i386/i386/machdep.c:
- Set the default msi_init hook to point to the native MSI
initialization method.

x86/xen/pv.c:
- Set the Xen MSI init hook when running as a Xen guest.

x86/x86/local_apic.c:
- Call the msi_init hook instead of directly calling msi_init.

xen/xen_intr.h:
x86/xen/xen_intr.c:
- Introduce support for registering/releasing MSI interrupts with
Xen.
- The MSI interrupts will use the same PIC as the IO APIC interrupts.

xen/xen_msi.h:
x86/xen/xen_msi.c:
- Introduce a Xen MSI implementation.

x86/xen/xen_nexus.c:
- Overwrite the default MSI hooks in the Xen Nexus to use the Xen MSI
implementation.

x86/xen/xen_pci.c:
- Introduce a Xen specific PCI bus that inherits from the ACPI PCI
bus and overwrites the native MSI methods.
- This is needed because when running under Xen the MSI messages used
to configure MSI interrupts on PCI devices are written by Xen
itself.

dev/acpica/acpi_pci.c:
- Lower the quality of the ACPI PCI bus so the newly introduced Xen
PCI bus can take over when needed.

conf/files.i386:
conf/files.amd64:
- Add the newly created files to the build process.


271963 22-Sep-2014 jhb

Convert from timeout(9) to callout(9).


271889 20-Sep-2014 adrian

Populate the device info string with _PXM (proximity domain) information.

This is primarily useful for debugging right now - it'll show up in
devinfo.

Reviewed by: jhb


271717 17-Sep-2014 jhb

Revert unrelated changes accidentally committed in r271192.


271192 06-Sep-2014 jhb

Create a separate structure for per-CPU state saved across suspend and
resume that is a superset of a pcb. Move the FPU state out of the pcb and
into this new structure. As part of this, move the FPU resume code on
amd64 into a C function. This allows resumectx() to still operate only on
a pcb and more closely mirrors the i386 code.

Reviewed by: kib (earlier version)


269897 13-Aug-2014 neel

Fix typo when displaying the HPET timer unit number.


269515 04-Aug-2014 royger

xen: add ACPI bus to xen_nexus when running as Dom0

Also disable a couple of ACPI devices that are not usable under Dom0.
To this end a couple of booleans are added that allow disabling ACPI
specific devices.

Sponsored by: Citrix Systems R&D
Reviewed by: jhb

x86/xen/xen_nexus.c:
- Return BUS_PROBE_SPECIFIC in the Xen Nexus attachement routine to
force the usage of the Xen Nexus.
- Attach the ACPI bus when running as Dom0.

dev/acpica/acpi_cpu.c:
dev/acpica/acpi_hpet.c:
dev/acpica/acpi_timer.c
- Add a variable that gates the addition of the devices.

x86/include/init.h:
- Declare variables that control the attachment of ACPI cpu, hpet and
timer devices.


268351 07-Jul-2014 marcel

Remove ia64.

This includes:
o All directories named *ia64*
o All files named *ia64*
o All ia64-specific code guarded by __ia64__
o All ia64-specific makefile logic
o Mention of ia64 in comments and documentation

This excludes:
o Everything under contrib/
o Everything under crypto/
o sys/xen/interface
o sys/sys/elf_common.h

Discussed at: BSDcan


267992 28-Jun-2014 hselasky

Pull in r267961 and r267973 again. Fix for issues reported will follow.


267985 27-Jun-2014 gjb

Revert r267961, r267973:

These changes prevent sysctl(8) from returning proper output,
such as:

1) no output from sysctl(8)
2) erroneously returning ENOMEM with tools like truss(1)
or uname(1)
truss: can not get etype: Cannot allocate memory


267961 27-Jun-2014 hselasky

Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after: 2 weeks
Sponsored by: Mellanox Technologies


267910 26-Jun-2014 hselasky

Remove not needed initialisation code.


267883 25-Jun-2014 jhb

Expand r261243 even further and ignore any I/O port resources assigned to
PCI root bridges except for the one known-valid case on x86 where bridges
claim the I/O port registers used for PCI config space access.

Tested by: Hilko Meyer <hilko.meyer@gmx.de>
MFC after: 1 week


267647 19-Jun-2014 jhb

Trust the state of a power resource that get from a working _STA method
instead of trying to cache it.

Previously, we only trusted the state if we did not have a cached state.
However, once a state was cached, the _STA method was always ignored.
Specifically, once a power resource had been turned on once (e.g.
during resume), the driver assumed it was always on even if _STA said it
was off and never turned it back on. This prevented the power resource
from being turned back on if a laptop was resumed twice, for example.

To fix, just remove the cached state entirely and always use the results
of _STA. The loops already skip any resources where _STA fails.

Submitted by: trasz (initial patch to invoke _ON)
MFC after: 1 week


264883 24-Apr-2014 smh

Remove duplicate SYSCTL_DECL(_debug_acpi) which was breaking tinderbox

MFC after: 2 weeks
X-MFC-With: r264849


264878 24-Apr-2014 smh

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


264849 24-Apr-2014 smh

Exposed debug.acpi.max_tasks and debug.acpi.max_threads via sysctls so their
values can be viewed.


264250 08-Apr-2014 adrian

Add a basic set of data points which count the number of sleep entries
that are being done by the OS.

For now this'll match up with the "wakeups"; although I'll dig deeper into
this to see if we can determine which sleep state the CPU managed to get
into. Most things I've seen these days only expose up to C2 or C3 via
ACPI even though the CPU goes all the way down to C6 or C7.


263975 31-Mar-2014 imp

Turns out name was used here when ACPI_DEBUG was defined, so refine my
previous patch.


263954 30-Mar-2014 imp

Remove instances of variables that were set, but never used. gcc 4.9
warns about these by default.


261790 12-Feb-2014 jhb

Add support for managing PCI bus numbers. As with BARs and PCI-PCI bridge
I/O windows, the default is to preserve the firmware-assigned resources.
PCI bus numbers are only managed if NEW_PCIB is enabled and the architecture
defines a PCI_RES_BUS resource type.
- Add a helper API to create top-level PCI bus resource managers for each
PCI domain/segment. Host-PCI bridge drivers use this API to allocate
bus numbers from their associated domain.
- Change the PCI bus and CardBus drivers to allocate a bus resource for
their bus number from the parent PCI bridge device.
- Change the PCI-PCI and PCI-CardBus bridge drivers to allocate the
full range of bus numbers from secbus to subbus from their parent bridge.
The drivers also always program their primary bus register. The bridge
drivers also support growing their bus range by extending the bus resource
and updating subbus to match the larger range.
- Add support for managing PCI bus resources to the Host-PCI bridge drivers
used for amd64 and i386 (acpi_pcib, mptable_pcib, legacy_pcib, and qpi_pcib).
- Define a PCI_RES_BUS resource type for amd64 and i386.

Reviewed by: imp
MFC after: 1 month


261243 28-Jan-2014 jhb

Some BIOSes incorrectly use standard memory resource ranges to list
the memory ranges that they decode for downstream devices rather than
creating ResourceProducer range resource entries. The result is that
we allocate the full range to the PCI root bridge device causing
allocations in child devices to all fail.

As a workaround, ignore any standard memory resources on a PCI root
bridge device. It is normal for a PCI root bridge to allocate an I/O
resource for the I/O ports used for PCI config access, but I have not
seen any PCI root bridges that legitimately allocate a memory resource.

Reviewed by: jkim
MFC after: 1 week


258780 30-Nov-2013 eadler

Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit. Instead use (1U << 31) which gets the
expected result.

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.

Discussed with: -arch, rdivacky
Reviewed by: cperciva


258164 15-Nov-2013 mav

Handle case when ACPI reports HPET device, but does not provide memory
resource for it. In such case take the address range from the HPET table.

This fixes hpet(4) driver attach on Asrock C2750D4I board.


257341 29-Oct-2013 nwhitehorn

More BUS_PROBE_NOWILDCARD sweeping. Some devices here (if_ath_ahb and siba)
resist easy conversion since they implement a great deal of their attach
logic inside probe(). Some of this could be fixed by moving it to attach(),
but some requires something more subtle than BUS_PROBE_NOWILDCARD.


257251 28-Oct-2013 kib

Import the driver for VT-d DMAR hardware, as specified in the revision
1.3 of Intelб╝ Virtualization Technology for Directed I/O Architecture
Specification. The Extended Context and PASIDs from the rev. 2.2 are
not supported, but I am not aware of any released hardware which
implements them. Code does not use queued invalidation, see comments
for the reason, and does not provide interrupt remapping services.

Code implements the management of the guest address space per domain
and allows to establish and tear down arbitrary mappings, but not
partial unmapping. The superpages are created as needed, but not
promoted. Faults are recorded, fault records could be obtained
programmatically, and printed on the console.

Implement the busdma(9) using DMARs. This busdma backend avoids
bouncing and provides security against misbehaving hardware and driver
bad programming, preventing leaks and corruption of the memory by wild
DMA accesses.

By default, the implementation is compiled into amd64 GENERIC kernel
but disabled; to enable, set hw.dmar.enable=1 loader tunable. Code is
written to work on i386, but testing there was low priority, and
driver is not enabled in GENERIC. Even with the DMAR turned on,
individual devices could be directed to use the bounce busdma with the
hw.busdma.pci<domain>:<bus>:<device>:<function>.bounce=1 tunable. If
DMARs are capable of the pass-through translations, it is used,
otherwise, an identity-mapping page table is constructed.

The driver was tested on Xeon 5400/5500 chipset legacy machine,
Haswell desktop and E5 SandyBridge dual-socket boxes, with ahci(4),
ata(4), bce(4), ehci(4), mfi(4), uhci(4), xhci(4) devices. It also
works with em(4) and igb(4), but there some fixes are needed for
drivers, which are not committed yet. Intel GPUs do not work with
DMAR (yet).

Many thanks to John Baldwin, who explained me the newbus integration;
Peter Holm, who did all testing and helped me to discover and
understand several incredible bugs; and to Jim Harris for the access
to the EDS and BWG and for listening when I have to explain my
findings to somebody.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month


255726 20-Sep-2013 gibbs

Add support for suspend/resume/migration operations when running as a
Xen PVHVM guest.

Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D
Reviewed by: gibbs
Approved by: re (blanket Xen)
MFC after: 2 weeks

sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
- Make sure that are no MMU related IPIs pending on migration.
- Reset pending IPI_BITMAP on resume.
- Init vcpu_info on resume.

sys/amd64/include/intr_machdep.h:
sys/i386/include/intr_machdep.h:
sys/x86/acpica/acpi_wakeup.c:
sys/x86/x86/intr_machdep.c:
sys/x86/isa/atpic.c:
sys/x86/x86/io_apic.c:
sys/x86/x86/local_apic.c:
- Add a "suspend_cancelled" parameter to pic_resume(). For the
Xen PIC, restoration of interrupt services differs between
the aborted suspend and normal resume cases, so we must provide
this information.

sys/dev/acpica/acpi_timer.c:
sys/dev/xen/timer/timer.c:
sys/timetc.h:
- Don't swap out "suspend safe" timers across a suspend/resume
cycle. This includes the Xen PV and ACPI timers.

sys/dev/xen/control/control.c:
- Perform proper suspend/resume process for PVHVM:
- Suspend all APs before going into suspension, this allows us
to reset the vcpu_info on resume for each AP.
- Reset shared info page and callback on resume.

sys/dev/xen/timer/timer.c:
- Implement suspend/resume support for the PV timer. Since FreeBSD
doesn't perform a per-cpu resume of the timer, we need to call
smp_rendezvous in order to correctly resume the timer on each CPU.

sys/dev/xen/xenpci/xenpci.c:
- Don't reset the PCI interrupt on each suspend/resume.

sys/kern/subr_smp.c:
- When suspending a PVHVM domain make sure there are no MMU IPIs
in-flight, or we will get a lockup on resume due to the fact that
pending event channels are not carried over on migration.
- Implement a generic version of restart_cpus that can be used by
suspended and stopped cpus.

sys/x86/xen/hvm.c:
- Implement resume support for the hypercall page and shared info.
- Clear vcpu_info so it can be reset by APs when resuming from
suspension.

sys/dev/xen/xenpci/xenpci.c:
sys/x86/xen/hvm.c:
sys/x86/xen/xen_intr.c:
- Support UP kernel configurations.

sys/x86/xen/xen_intr.c:
- Properly rebind per-cpus VIRQs and IPIs on resume.


255077 30-Aug-2013 dumbbell

acpi_thermal: Warn about insane _TMP temperature only once

A warning is emitted again if the temperature became briefly valid
meanwhile. This avoids spamming the user when the sensor is broken.

Other values (ie. not _TMP) always raise a warning.


254300 13-Aug-2013 jkim

Tidy up global locks for ACPICA. There is no functional change.


253392 16-Jul-2013 jhb

Workaround some broken BIOSes that specify edge-sensitive but active-low
settings for ACPI-enumerated serial ports by forcing any IRQs that use
an ISA IRQ value with these settings to active-high instead of active-low.

This is known to occur with the BIOS on an Intel D2500CCE motherboard.

Tested by: Robert Ames <robertames@hotmail.com>, lev
Submitted by: Juergen Weiss weiss at uni-mainz.de (original patch)


252576 03-Jul-2013 jhb

Don't perform the acpi_DeviceIsPresent() check for PCI-PCI bridges. If
we are probing a PCI-PCI bridge it is because we found one by enumerating
the devices on a PCI bus, so the bridge is definitely present. A few
BIOSes report incorrect status (_STA) for some bridges that claimed they
were not present when in fact they were.

While here, move this check earlier for Host-PCI bridges so attach fails
before doing any work that needs to be torn down.

PR: kern/91594
Tested by: Jack Vogel @ Intel
MFC after: 1 week


252276 27-Jun-2013 jkim

Consistently cast ACPICA 64-bit integer types when we print them.


250838 20-May-2013 jkim

Merge ACPICA 20130517.


250834 20-May-2013 jkim

- Prefer ACPI_COMPARE_NAME(a, b) macro over strncmp(a, b, ACPI_NAME_SIZE).
- Make sure the predefined name is a string type.
- Return slightly more useful errors.


250833 20-May-2013 jkim

Fix white spaces.


249767 22-Apr-2013 jhb

- Some BIOSes use an Extended IRQ resource descriptor in _PRS for a link
that uses non-ISA IRQs but use a plain IRQ resource in _CRS. However,
a non-ISA IRQ can't fit into a plain IRQ resource. If we encounter a
link like this, build the resource buffer from _PRS instead of _CRS.
- Set the correct size of the end tag in a resource buffer.

Tested by: Benjamin Lee <ben@b1c1l1.com>
MFC after: 2 weeks


248415 17-Mar-2013 rpaulo

Fix a typo in a comment.


248170 11-Mar-2013 mav

Add "else" missed at r248154.


248154 11-Mar-2013 mav

Reduce HPET eventtimer priority on systems with 8 or more cores. Price of
the lock congestion may be too high there (2.5% on 4x4 core AMD Opteron).


247463 28-Feb-2013 mav

MFcalloutng:
Switch eventtimers(9) from using struct bintime to sbintime_t.
Even before this not a single driver really supported full dynamic range of
struct bintime even in theory, not speaking about practical inexpediency.
This change legitimates the status quo and cleans up the code.


247460 28-Feb-2013 davide

MFcalloutng (r247427 by mav):
We don't need any precision here. Let it be fast and dirty shift then
slow and excessively precise 64-bit division.


247454 28-Feb-2013 davide

MFcalloutng:
When CPU becomes idle, cpu_idleclock() calculates time to the next timer
event in order to reprogram hw timer. Return that time in sbintime_t to
the caller and pass it to acpi_cpu_idle(), where it can be used as one
more factor (quite precise) to extimate furter sleep time and choose
optimal sleep state. This is a preparatory change for further callout
improvements will be committed in the next days.

The commmit is not targeted for MFC.


246252 02-Feb-2013 avg

revert accidentally committed unneeded changes from r246250

MFC after: 7 days
X-MFC with: r246250


246251 02-Feb-2013 avg

acpi: clear power button status bit after waking up...

so that it is not confused for a new power off request.

Learned from: Linux and ACPI specification
Tested by: gjb
MFC after: 12 days


246250 02-Feb-2013 avg

acpi: after wakeup from a state > S1 re-enable SCI_EN with a direct write

This hack is picked up from Linux, which claims that it follows
Windows behavior.

PR: amd64/174409
Tested by: Sergey V. Dyatko <sergey.dyatko@gmail.com>,
KAHO Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>,
Slawa Olhovchenkov <slw@zxy.spb.ru>
MFC after: 13 days


246128 30-Jan-2013 sbz

Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays

Reviewed by: cognet
Approved by: cognet


246042 28-Jan-2013 jkim

Fix two misusages of return_*() macros for ACPICA.

Noticed by: avg


246041 28-Jan-2013 jkim

Fix white spaces for style consistency.


245582 18-Jan-2013 jkim

Merge ACPICA 20130117.


245266 10-Jan-2013 mav

Remove not very useful printf, that can be too chatty.

ASUS P8Z77-V board reports _AC2, _AC3 and _AC4 setpoints as 0C. With active
cooling already automatically set to _AC2, that still caused driver to print
two useless lines about temperature above _AC3 and _AC4 every ten seconds.
Three setponts of 0C is probably a board bug, but the same spam could happen
also in correct case if system is runnign not with the lowest cooling level.


243761 01-Dec-2012 avg

acpi_cpu_notify: disable acpi_cpu_idle while updating C-state data

... to avoid any races or inconsistencies.
This should fix a regression introduced in r243404.

Also, remove a stale comment that has not been true for quite a while
now.

Pointyhat to: avg
Teested by: trociny, emaste, dumbbell (earlier version)
MFC after: 1 week


243760 01-Dec-2012 avg

acpi_cpu: change cpu_disable_idle to be a per-cpu flag...

and make it safe to manipulate and check the flag

With help from: jhb
Tested by: trociny, emaste, dumbbell
MFC after: 1 week


243404 22-Nov-2012 avg

acpi_cpu: use fixed resource ids for cx state i/o resources

... instead of the ever increasing ones.
Also, do free old resources when allocating new ones when cx states
change.

Tested by: Tom Lislegaard <Tom.Lislegaard@proact.no>
Obtained from: jkim
MFC after: 1 week


242922 12-Nov-2012 sbruno

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


241973 23-Oct-2012 jkim

Merge ACPICA 20121018.


241885 22-Oct-2012 eadler

This isn't functionally identical. In some cases a hint to disable
unit 0 would in fact disable all units.

This reverts r241856

Approved by: cperciva (implicit)


241856 22-Oct-2012 eadler

Now that device disabling is generic, remove extraneous code from the
device drivers that used to provide this feature.

Reviewed by: des
Approved by: cperciva
MFC after: 1 week


241748 19-Oct-2012 jhb

When checking to see if a video output's _ADR matches an entry in the
parent adapter's _DOD list, only check the low 16 bits of both _ADR and
_DOD. The language in the ACPI spec seems to indicate that the _ADR values
should exactly match the entries in _DOD. However, I assume that the
masking added to _DOD values was added to work around some known busted
machines (the commit history doesn't indicate either way), and the ACPI
spec does require that the low 16 bits are unique for all video outputs,
so only check the low 16 bits should be fine.

This fixes recognition of video outputs that use the new standardized
device ID scheme in ACPI 3.0 that set bit 31 such as certain Dell laptops.

Tested by: Juergen Lock nox jelal kn-bremen de
MFC after: 3 days


241538 14-Oct-2012 avg

acpi_thermal: when _ACx is tripped, all _ALi i>= x should be on

... and not just _ALx as it is now.

MFC after: 20 days


241386 10-Oct-2012 neel

Grab the softc from the ACPI host-pci bridge device instead of from the pci
endpoint device.

Reviewed by: jhb


240634 18-Sep-2012 avg

acpi_cpu: explicitly notify userland about c-state changes

... after they are committed.
A notification is sent per CPU.

Reviewed by: imp
MFC after: 3 weeks


240367 11-Sep-2012 avg

revert r240344: cpu_devices[] is used in other functions and must be kept

Reported by: gjb, glebius
Pointyhat to: avg
MFC after: 1 day
X-MFC note: fake MFC, reminder to never MFC r240344


240344 11-Sep-2012 avg

acpi_cpu: free result of device_get_children

MFC after: 1 week


240286 09-Sep-2012 mav

At least from A70M FCH chipsets AMD started to use their real vendor ID
(1022) in HPET. But according to report they still haven't fixed problem
with level-triggered interrupts.
Make workaround used for earlier chipsets apply to this new ID also.

PR: amd64/171355
MFC after: 3 days


239340 16-Aug-2012 jkim

Merge ACPICA 20120816.


238943 31-Jul-2012 mav

Add several performance optimizations to acpi_cpu_idle().

For C1 and C2 states use cpu_ticks() to measure sleep time instead of much
slower ACPI timer. We can't do it for C3, as TSC may stop there. But it is
less important there as wake up latency is high any way.

For C1 and C2 states do not check/clear bus mastering activity status, as
it is important only for C3. As side effect it can make CPU enter C2 instead
of C3 if last BM activity was two sleeps back (unlike one before), but
that may be even good because of collecting more statistics. Premature BM
wakeup from C3, entered because of overestimation, can easily be worse then
entering C2 from both performance and power consumption points of view.

Together on dual Xeon E5645 system on sequential 512 bytes read test this
change makes cpu_idle_acpi() as fast as simplest cpu_idle_hlt() and only
few percents slower then cpu_idle_mwait(), while deeper states are still
actively used during idle periods.

To help with diagnostics, add C-state type into dev.cpu.X.cx_supported.

Sponsored by: iXsystems, Inc.


238418 13-Jul-2012 avg

acpi_cpu: separate a notion of current deepest allowed+available Cx level

... from a user-set persistent limit on the said level.
Allow to set the user-imposed limit below current deepest available level
as the available levels may be dynamically changed by ACPI platform
in both directions.
Allow "Cmax" as an input value for cx_lowest sysctls to mean that there
is not limit and OS can use all available C-states.
Retire global cpu_cx_count as it no longer serves any meaningful
purpose.

Reviewed by: jhb, gianni, sbruno
Tested by: sbruno, Vitaly Magerya <vmagerya@gmail.com>
MFC after: 2 weeks


238229 08-Jul-2012 avg

acpi_cpu: we are able to handle _CST change notifications...

so un-ifdef code that is supposed to tell ACPI platform about that

Tested by: Taku YAMAMOTO <taku@tackymt.homeip.net>
MFC after: 2 weeks


238199 07-Jul-2012 eadler

Remove variables which are initialized but never used thereafter
reported by gcc46 warning

Approved by: cperciva
MFC after: 1 week


238194 07-Jul-2012 avg

acpi_cpu_generic_cx_probe: for consistency set cpu_non_c3 here too

although by default only C1 is enabled (cx_lowest=0) and enabling deeper
states goes through acpi_cpu_set_cx_lowest which re-evaluates cpu_non_c3

MFC after: 2 weeks


238193 07-Jul-2012 avg

acpi_cpu_cx_list: there is no need to re-evaluate cpu_non_c3 here

cpu_non_c3 is already evaluated in acpi_cpu_cx_cst and in
acpi_cpu_set_cx_lowest.
Besides acpi_cpu_cx_list is not protected by any locking.

As a result also move setting of cpu_can_deep_sleep to more appropriate
places.

MFC after: 2 weeks


238192 07-Jul-2012 avg

acpi_cpu_cx_cst: consistently use cpu_cx_count during state enumeration

cpu_cx_count is an index into accepted states, while i is an index into
original _CST states

MFC after: 1 week


238009 02-Jul-2012 sbruno

Revert r238004 as more review has come in and there is now a discussion
on how to best proceed.


238004 02-Jul-2012 sbruno

Cosmetic display change of Cx states via cx_supported sysctl entries.

Adjust power_profile script to handle the new world order as well.

Some vendors are opting out of a C2 state and only defining C1 & C3. This
leads the acpi_cpu display to indicate that the machine supports C1 & C2
which is caused by the (mis)use of the index of the cx_state array as the
ACPI_STATE_CX value.

e.g. the code was pretending that cx_state[i] would
always convert to i by subtracting 1.

cx_state[2] == ACPI_STATE_C3
cx_state[1] == ACPI_STATE_C2
cx_state[0] == ACPI_STATE_C1

however, on certain machines this would lead to
cx_state[1] == ACPI_STATE_C3
cx_state[0] == ACPI_STATE_C1

This didn't break anything but led to a display of:
* dev.cpu.0.cx_supported: C1/1 C2/96

Instead of
* dev.cpu.0.cx_supported: C1/1 C3/96

MFC after: 2 weeks


237197 17-Jun-2012 iwasaki

Resotre LCD brightness level on resuming.

MFC after: 3 days


236772 09-Jun-2012 iwasaki

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@


236424 01-Jun-2012 jkim

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


236408 01-Jun-2012 jkim

Execute AcpiLeaveSleepStatePrep() for S1 and reduce code duplication.

MFC after: 3 days


236403 01-Jun-2012 iwasaki

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


236221 29-May-2012 iwasaki

Reorder resume procedures.

DEVICE_RESUME() should be done before AcpiLeaveSleepState() because
PCI config space evaluation can be occurred during control method
executions.

This should fix one of the hang up problems on resuming.

MFC after: 3 days


236220 29-May-2012 iwasaki

Fix the problem acpi_sleep_force() hang.

Suspending from callout cause the freeze in DEVICE_SUSPEND().
Suspend from acpi_task thread in stead.

MFC after: 3 days


235945 24-May-2012 jkim

Merge ACPICA 20120518.


235845 23-May-2012 jkim

Restore Processor object path for verbose boot message.


235834 23-May-2012 jhb

Rework the previous change to honor MADT processor IDs when probing
processor objects. Instead of forcing the new-bus CPU objects to use
a unit number equal to pc_cpuid, adjust acpi_pcpu_get_id() to honor the
MADT IDs by default. As with the previous change, setting
debug.acpi.cpu_unordered to 1 in the loader will revert to the old
behavior.

Tested by: jimharris
MFC after: 1 month


235772 22-May-2012 iwasaki

Ignore the power button press event for resuming rather than starting
shutdown.

MFC after: 2 days


235692 20-May-2012 iwasaki

Don't start the sleep state transition procedure while sleep is
disabled or the system is in shutdown procedure.

This should fix the problem which kernel never response to the sleep
button press events after the message `suspend request ignored (not
ready yet)'.

MFC after: 3 days


235556 17-May-2012 jhb

Centralize declaration of the debug.acpi sysctl node.


235029 04-May-2012 jkim

Complete commit message for r235024:

Use MADT to match ACPI Processor objects to CPUs. MADT and DSDT/SSDTs may
list CPUs in different orders, especially for disabled logical cores. Now
we match ACPI IDs from the MADT with Processor objects, strictly order CPUs
accordingly, and ignore disabled cores. This prevents us from executing
methods for other CPUs, e. g., _PSS for disabled logical core, which may not
exist. Unfortunately, it is known that there are a few systems with buggy
BIOSes that do not have unique ACPI IDs for MADT and Processor objects. To
work around these problems, 'debug.acpi.cpu_unordered' tunable is added.
Set this to a non-zero value to restore the old behavior.
Many thanks to jhb for pointing me to the right direction and the manual
page change.

Reported by: Harris, James R (james dot r dot harris at intel dot com)
Tested by: Harris, James R (james dot r dot harris at intel dot com)
Reviewed by: jhb
MFC after: 1 month


235024 04-May-2012 jkim

Use MADT to match ACPI Processor objects to CPUs. MADT and DSDT/SSDTs may
list CPUs in different orders, especially for disabled logical cores. Now
we match ACPI IDs from the MADT with Processor objects, strictly order CPUs
accordingly, and ignore disabled cores. This prevents us from executing
methods for other CPUs, e. g., _PSS for disabled logical core, which may not
exist. Unfortunately, it is known that there are a few systems with buggy
BIOSes that do not have unique ACPI IDs for MADT and Processor objects. To
work around these problems


233676 29-Mar-2012 jhb

Use a more proper fix for enabling HT MSI mapping windows on Host-PCI
bridges. Rather than blindly enabling the windows on all of them, only
enable the window when an MSI interrupt is enabled for a device behind
the bridge, similar to what already happens for HT PCI-PCI bridges.

To implement this, each x86 Host-PCI bridge driver has to be able to
locate it's actual backing device on bus 0. For ACPI, use the _ADR
method to find the slot and function of the device. For the non-ACPI
case, the legacy(4) driver already scans bus 0 looking for Host-PCI
bridge devices. Now it saves the slot and function of each bridge that
it finds as ivars that the Host-PCI bridge driver can then use in its
pcib_map_msi() method.

This fixes machines where non-MSI interrupts were broken by the previous
round of HT MSI changes.

Tested by: bapt
MFC after: 1 week


233579 27-Mar-2012 jkim

Restore interrupt state after executing AcpiEnterSleepState().


233313 22-Mar-2012 jkim

Add ACPI_LV_REPAIR debug level, available since ACPICA 20091214 (r200553).

MFC after: 3 days


233250 20-Mar-2012 jkim

Merge ACPICA 20120320.


232797 10-Mar-2012 mav

ServerWorks HT1000 HPET reported to have problems with IRQs >= 16.
Lower (ISA) IRQs are working, but allowed mask is not set correctly.
Block both by default to allow HP BL465c G6 blade system to boot.

Reported by: Attila Nagy <bra@fsn.hu>
MFC after: 1 week


232403 02-Mar-2012 jhb

- Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge.
The tag enforces a single restriction that all DMA transactions must not
cross a 4GB boundary. Note that while this restriction technically only
applies to PCI-express, this change applies it to all PCI devices as it
is simpler to implement that way and errs on the side of caution.
- Add a softc structure for PCI bus devices to hold the bus_dma tag and
a new pci_attach_common() routine that performs actions common to the
attach phase of all PCI bus drivers. Right now this only consists of
a bootverbose printf and the allocate of a bus_dma tag if necessary.
- Adjust all PCI bus drivers to allocate a PCI bus softc and to call
pci_attach_common() from their attach routines.

MFC after: 2 weeks


232132 24-Feb-2012 jkim

Fix a long-standing bug for AcpiOsGetTimer(). time_t is 32-bit on i386 and
it needs proper casting before multiplication.

MFC after: 3 days


231844 16-Feb-2012 jkim

Merge ACPICA 20120215.


231474 10-Feb-2012 jkim

De-obfuscate acpi_acquire_global_lock(). It seems the function was directly
translated from i386 assembly version.


231295 09-Feb-2012 jkim

Refine r231226. Swap timecounters before suspending any device drivers.


231227 08-Feb-2012 jkim

Reset clock after atrtc(4) is properly resumed.


231226 08-Feb-2012 jkim

Revert r211288 and move the logic to the acpi_timer itself.


231161 07-Feb-2012 jkim

- 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.


228961 29-Dec-2011 jhb

Further relax the strictness of enforcing allocations to only come from
decoded ranges. Pass any request for a specific range that fails because
it is not in a decoded range for an ACPI Host-PCI bridge up to the parent
to see if it can still be allocated. This is based on the assumption that
many BIOSes are inconsistent/broken and that settings programmed into BARs
or resources assigned to other built-in components are more trustworthy than
the list of decoded resource ranges in _CRS. This effectively limits the
decoded ranges to only being used for "wildcard" ranges when allocating
fresh resources for a BAR, etc. At some point I would like to only be
this permissive during an early scan of firmware-assigned resources during
boot and to be strict about all later allocations, but that isn't viable
currently.

MFC after: 2 weeks


227992 26-Nov-2011 dumbbell

Prevent a division by zero with some broken batteries

This problem was seen on a laptop with a dead battery.


227843 22-Nov-2011 marius

- There's no need to overwrite the default device method with the default
one. Interestingly, these are actually the default for quite some time
(bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
since r52045) but even recently added device drivers do this unnecessarily.
Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
Discussed with: jhb
- Also while at it, use __FBSDID.


227642 17-Nov-2011 eadler

- be more precise about the unit of measurement

Approved by: jhb
MFC after: 3 days


227626 17-Nov-2011 eadler

- be more precise about the unit of measurement

Submitted by: Oliver Pinter <oliver.pntr@gmail.com>
Approved by: jhb
MFC after: 3 days


227309 07-Nov-2011 ed

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


227293 07-Nov-2011 ed

Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.

This means that their use is restricted to a single C file.


226302 12-Oct-2011 jhb

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


225533 13-Sep-2011 brueffer

Improve the sleep_delay sysctl description by specifying which unit
the number is in.

PR: 159975
Submitted by: gcooper
Approved by: re (kib)
MFC after: 1 week


224919 16-Aug-2011 mav

Always check current HPET counter value after comparator programming to
avoid lost timer interrupts. Previous optimization attempt doing it only
for intervals less then 5000 ticks (~300us) reported to be unreliable by
some people. Probably because of some heavy SMI code on their boards.
Introduce additional safety interval of 128 counter ticks (~9us) between
programmed comparator and counter values to cover different cases of
delayed write found on some chipsets.

Approved by: re (kib)


224254 21-Jul-2011 jhb

Allow non-fixed endpoints for a producer address range if the length of
the resource covers the entire range. Some BIOSes appear to mark
endpoints as non-fixed incorrectly (non-fixed endpoints are supposed to
be used in _PRS when OSPM is allowed to allocate a certain chunk of
address space within a larger range, I don't believe it is supposed to be
used for _CRS).

Approved by: re (kib)


224130 17-Jul-2011 jhb

Don't ignore negatively decoded address ranges.

Reported by: scottl


224069 15-Jul-2011 jhb

Respect the BIOS/firmware's notion of acceptable address ranges for PCI
resource allocation on x86 platforms:
- Add a new helper API that Host-PCI bridge drivers can use to restrict
resource allocation requests to a set of address ranges for different
resource types.
- For the ACPI Host-PCI bridge driver, use Producer address range resources
in _CRS to enumerate valid address ranges for a given Host-PCI bridge.
This can be disabled by including "hostres" in the debug.acpi.disabled
tunable.
- For the MPTable Host-PCI bridge driver, use entries in the extended
MPTable to determine the valid address ranges for a given Host-PCI
bridge. This required adding code to parse extended table entries.

Similar to the new PCI-PCI bridge driver, these changes are only enabled
if the NEW_PCIB kernel option is enabled (which is enabled by default on
amd64 and i386).

Approved by: re (kib)


223624 28-Jun-2011 kevlo

Remove duplicate header includes


223527 25-Jun-2011 marcel

Now that ia64 has been switched to the event timers, remove the
conditional compilation work-arounds.


223502 24-Jun-2011 jhb

Typo.


223449 22-Jun-2011 jkim

Fix build on ia64 after r223426.


223426 22-Jun-2011 jkim

Set negative quality to TSC timecounter when C3 state is enabled for Intel
processors unless the invariant TSC bit of CPUID is set. Intel processors
may stop incrementing TSC when DPSLP# pin is asserted, according to Intel
processor manuals, i. e., TSC timecounter is useless if the processor can
enter deep sleep state (C3/C4). This problem was accidentally uncovered by
r222869, which increased timecounter quality of P-state invariant TSC, e.g.,
for Core2 Duo T5870 (Family 6, Model f) and Atom N270 (Family 6, Model 1c).

Reported by: Fabian Keil (freebsd-listen at fabiankeil dot de)
Ian FREISLICH (ianf at clue dot co dot za)
Tested by: Fabian Keil (freebsd-listen at fabiankeil dot de)
- Core2 Duo T5870 (C3 state available/enabled)
jkim - Xeon X5150 (C3 state unavailable)


223424 22-Jun-2011 jhb

Add a helper routine to conditionally modify the start address of a
resource allocation from an x86 Host-PCI bridge driver so that it can be
reused by the ACPI Host-PCI bridge driver (and eventually the MPTable
Host-PCI bridge driver) instead of duplicating the same logic. Note that
this means that hw.acpi.host_mem_start is now replaced with the
hw.pci.host_mem_start tunable that was already used in the non-ACPI case.
This also removes hw.acpi.host_mem_start on ia64 where it was not
applicable (the implementation was very x86-specific).

While here, adjust the logic to apply the new start address on any
"wildcard" allocation even if that allocation comes from a subset of
the allowable address range.

Reviewed by: imp (1)


223383 21-Jun-2011 jhb

Fix build with ACPI_DEBUG defined.

Submitted by: jkim
Pointy hat to: jhb


223370 21-Jun-2011 jhb

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)


223207 17-Jun-2011 jhb

Don't create a device_t object or parse current resources (via _CRS) for
ACPI Device() objects that do not have any device IDs available via the
_HID or _CID methods. Without a device ID a device driver cannot attach
to the device anyway. Namespace objects that are devices but not of
type ACPI_TYPE_DEVICE are not affected.

A few BIOSes have also attached a _CRS method to a PCI device to
allocate resources that are not managed via a BAR. With the previous
code those resources are allocated from acpi0 directly which can interfere
with the new PCI-PCI bridge driver (since the PCI device in question may
be behind a bridge and its resources should be allocated from that
bridge's windows instead). The resources were also orphaned and
and would end up associated with some other random device whose device_t
reused the pointer of the original ACPI-enumerated device (after it was
free'd by the ACPI PCI bus driver) in devinfo output which was confusing.
If we want to handle _CRS on PCI devices we can adjust the ACPI PCI bus
driver to do that in the future and associate the resources with the
proper device object respecting PCI-PCI bridges, etc.

Note that with this change the ACPI PCI bus driver no longer has to
delete ACPI-enumerated device_t devices that mirror PCI devices since
they should in general not exist. There are rare cases when a BIOS
will give a PCI device a _HID (e.g. I've seen a PCI-ISA bridge given
a _HID for a system resource device). In that case we leave both the
ACPI and PCI-enumerated device_t objects around just as in the previous
code.


222929 10-Jun-2011 jhb

Implement BUS_ADJUST_RESOURCE() for the x86 drivers that sit between the
Host-PCI bridge drivers and nexus.


222544 31-May-2011 jkim

Merge ACPICA 20110527.


222222 23-May-2011 jkim

Decrease ACPI-fast timecounter quality to 900 and increase HPET timecounter
quality to 950. HPET on modern platforms usually have better resolution and
lower latency than ACPI timer. Effectively this changes default timecounter
hardware from ACPI-fast to HPET by default when both are available.

Discussed with: avg


221393 03-May-2011 jhb

Reimplement how PCI-PCI bridges manage their I/O windows. Previously the
driver would verify that requests for child devices were confined to any
existing I/O windows, but the driver relied on the firmware to initialize
the windows and would never grow the windows for new requests. Now the
driver actively manages the I/O windows.

This is implemented by allocating a bus resource for each I/O window from
the parent PCI bus and suballocating that resource to child devices. The
suballocations are managed by creating an rman for each I/O window. The
suballocated resources are mapped by passing the bus_activate_resource()
call up to the parent PCI bus. Windows are grown when needed by using
bus_adjust_resource() to adjust the resource allocated from the parent PCI
bus. If the adjust request succeeds, the window is adjusted and the
suballocation request for the child device is retried.

When growing a window, the rman_first_free_region() and
rman_last_free_region() routines are used to determine if the front or
end of the existing I/O window is free. From using that, the smallest
ranges that need to be added to either the front or back of the window
are computed. The driver will first try to grow the window in whichever
direction requires the smallest growth first followed by the other
direction if that fails.

Subtractive bridges will first attempt to satisfy requests for child
resources from I/O windows (including attempts to grow the windows). If
that fails, the request is passed up to the parent PCI bus directly
however.

The PCI-PCI bridge driver will try to use firmware-assigned ranges for
child BARs first and only allocate a "fresh" range if that specific range
cannot be accommodated in the I/O window. This allows systems where the
firmware assigns resources during boot but later wipes the I/O windows
(some ACPI BIOSen are known to do this) to "rediscover" the original I/O
window ranges.

The ACPI Host-PCI bridge driver has been adjusted to correctly honor
hw.acpi.host_mem_start and the I/O port equivalent when a PCI-PCI bridge
makes a wildcard request for an I/O window range.

The new PCI-PCI bridge driver is only enabled if the NEW_PCIB kernel option
is enabled. This is a transition aide to allow platforms that do not
yet support bus_activate_resource() and bus_adjust_resource() in their
Host-PCI bridge drivers (and possibly other drivers as needed) to use the
old driver for now. Once all platforms support the new driver, the
kernel option and old driver will be removed.

PR: kern/143874 kern/149306
Tested by: mav


221336 02-May-2011 jhb

The ACPI Host-PCI bridge driver actually supports multiple domains via
the optional _SEG function. Return that value (ap->segment) rather than
0 for the pcib domain ivar.


221324 02-May-2011 jhb

Add implementations of BUS_ADJUST_RESOURCE() to the PCI bus driver,
generic PCI-PCI bridge driver, x86 nexus driver, and x86 Host to PCI bridge
drivers.


220871 19-Apr-2011 mdf

Correctly output the entire array for hw.acpi.thermal._ACx.

Reported by: Taku YAMAMOTO < taku AT tackymt DOT homeip DOT net >
Tested by: Nick Ulen < uncle AT wolfman DOT devio DOT us >


220805 18-Apr-2011 jkim

Do not assume PM timer GAS type is I/O or memory. It may be an unsupported
type, i. e., a broken table. Also, do not hardcode ACPI timer frequency in
device description.


220798 18-Apr-2011 mdf

Fix a few acpi sysctls that want "IK" formatting to specify CTLTYPE_INT.
This got broken after r217586.

Pointy hat: to me
Tested by: David Wolfskill < davit AT catwhisker DOT org >


220647 14-Apr-2011 jkim

Add event handlers for (ACPI) suspend/resume events. Suspend event handlers
are invoked right before device drivers go into sleep state and resume event
handlers are invoked right after all device drivers are waken up.


220613 14-Apr-2011 jkim

Add some tunable descriptions about x86 timers.

Requested by: arundel


220433 07-Apr-2011 jkim

Use atomic load & store for TSC frequency. It may be overkill for amd64 but
safer for i386 because it can be easily over 4 GHz now. More worse, it can
be easily changed by user with 'machdep.tsc_freq' tunable (directly) or
cpufreq(4) (indirectly). Note it is intentionally not used in performance
critical paths to avoid performance regression (but we should, in theory).
Alternatively, we may add "virtual TSC" with lower frequency if maximum
frequency overflows 32 bits (and ignore possible incoherency as we do now).


220369 05-Apr-2011 jkim

Lower the bar for ACPI-fast on real machines slightly. Empirical evidences
show that there are perfectly working PM timers with occasional "hiccups",
probably because of an SMI. Now we ignore the maximum if it happens once in
the test loop and the width is small enough. Also, relax normal width a bit
to count in a boundary case.


220338 04-Apr-2011 jkim

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


220336 04-Apr-2011 jkim

Always check the current minimum value to make the test more predictable.
Use INT32_MAX instead of an arbitrary big number for the initial minimum.


220334 04-Apr-2011 jkim

Fix bogus logic to calculate delta between two values from ACPI timers.


220333 04-Apr-2011 jkim

Lower the bar for ACPI-fast on virtual machines. The current logic depends
on the fact that real hardware has almost fixed cost to read the ACPI timer.
It is virtually always false for hardware emulation and it makes no sense to
read it multiple times, which is already quite expensive for full emulation.


220331 04-Apr-2011 jkim

Add inline to acpi_timer_read() to reduce unnecessary jumps and calls.


219037 25-Feb-2011 jkim

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


218687 14-Feb-2011 jkim

Rework r218685. Copy just enough data for the resource type.

Reviewed by: jhb, mdf


218685 14-Feb-2011 mdf

Prevent reading from the ACPI_RESOURCE past its actual end. For
paranoia limit to the size of the ACPI_RESOURCE as well.

Reviewd by: jhb (in spirit)
MFC after: 1 week


218660 13-Feb-2011 marcel

Use the preload_fetch_addr() and preload_fetch_size() convenience
functions to obtain the address and size of the overriding DSDT.

Sponsored by: Juniper Networks.


217566 19-Jan-2011 mdf

Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier.


217537 18-Jan-2011 jhb

Remove bogus check. pcib_get_bus() (like other BUS_ACCESSOR() methods)
doesn't "fail", it may merely return garbage if it is not a valid ivar
for a given device. Our parent device must be a 'pcib' device, so we
can just assume it implements pcib IVARs, and all pcib devices have a
bus number.

Submitted by: clang via rdivacky


217279 11-Jan-2011 jkim

Work around a witness(4) panic introduced in r217238.

Reported by: jh


217278 11-Jan-2011 jkim

Fix a witness(4) warning introduced in r217238.


217241 10-Jan-2011 jkim

Remove impossible error conditions.


217240 10-Jan-2011 jkim

Add forgotten free(9) in the previous commit for an error case.


217238 10-Jan-2011 jkim

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.


217236 10-Jan-2011 jkim

Prefer KASSERT(9) over panic(9) as it was never seen in reality.


216965 04-Jan-2011 jkim

Clarify the previous commit. AcpiFinishGpe() will not clear GPE for us
because we set it to edge-trigger.


216942 04-Jan-2011 jkim

Clear GPE from a query handler if the task was deferred.


216940 03-Jan-2011 jkim

Fix parameters for wakeup(9) and tsleep(9).

MFC after: 3 days


216680 23-Dec-2010 jhb

Don't try to reserve a resource that is already allocated. If the ECDT
table is present, then the acpi_ec(4) driver will allocate its resources
from nexus0 before the acpi0 device reserves resources for child devices.

Reviewed by: jkim


216674 22-Dec-2010 jhb

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.


216503 17-Dec-2010 avg

small cleanup of acpi battery status setting and checking

This is based on the patch submitted by Yuri Skripachov.
Overview of the changes:
- clarify double-use of some ACPI_BATT_STAT_* definitions
- clean up undefined/extended status bits returned by _BST
- warn about charging+discharging bits being set at the same time

PR: kern/124744
Submitted by: Yuri Skripachov <y.skripachov@gmail.com>
Tested by: Yuri Skripachov <y.skripachov@gmail.com>
MFC after: 2 weeks


216490 16-Dec-2010 jhb

Small style fixes:
- Avoid side-effect assignments in if statements when possible.
- Don't use ! to check for NULL pointers, explicitly check against NULL.
- Explicitly check error return values against 0.
- Don't use INTR_MPSAFE for interrupt handlers with only filters as it is
meaningless.
- Remove unneeded function casts.


216488 16-Dec-2010 jhb

Spelling fix.


216471 15-Dec-2010 jkim

Merge ACPICA 20101209.


216443 14-Dec-2010 jkim

Stop lying about supporting cpu_est_clockrate() when TSC is invariant. This
function always returned the nominal frequency instead of current frequency
because we use RDTSC instruction to calculate difference in CPU ticks, which
is supposedly constant for the case. Now we support cpu_get_nominal_mhz()
for the case, instead. Note it should be just enough for most usage cases
because cpu_est_clockrate() is often times abused to find maximum frequency
of the processor.


216263 07-Dec-2010 jhb

Use proper resource ID's for HPET IRQ resources. This mostly consists of
looking to see if there is an existing IRQ resource for a given IRQ
provided by the BIOS and using that RID if so. Otherwise, allocate a new
RID for the new IRQ.

Reviewed by: mav (a while ago)


215473 18-Nov-2010 jhb

Various small typos and grammar nits in comments.


215188 12-Nov-2010 jkim

Create C1 state when _CST is valid but _CST does not have one. Some BIOSes
do not report C1 state in _CST object, probably because it is a mandatory
state with or without existence of the optional _CST.

Reviewed by: avg


215097 10-Nov-2010 jkim

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.


215072 10-Nov-2010 jkim

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.


214998 08-Nov-2010 jkim

Consistently use padding `_' in the comment.


214849 05-Nov-2010 jkim

Add a forgotten change from the previous commit.


214848 05-Nov-2010 jkim

Fix a use-after-free bug for extended IRQ resource[1]. When _PRS buffer is
copied as a template for _SRS, a string pointer for descriptor name is also
copied and it becomes stale as soon as it gets de-allocated[2]. Now _CRS is
used as a template for _SRS as ACPI specification suggests if it is usable.
The template from _PRS is still utilized but only when _CRS is not available
or broken. To avoid use-after-free the problem in this case, however, only
mandatory fields are copied, optional data is removed, and structure length
is adjusted accordingly.

Reported by: hps[1]
Analyzed by: avg[2]
Tested by: hps


214765 03-Nov-2010 jkim

Adjust a comment to clarify why \_SB_ and \_TZ_ are defined as device type
in ACPICA. Reshuffle the code a bit to make sure this kludge only applies
to these two specical cases and to make it cleaner.


214390 26-Oct-2010 jkim

Add two new loader tunables 'hw.acpi.install_interface' and
'hw.acpi.remove_interface'. hw.acpi.install_interface lets you install new
interfaces. Conversely, hw.acpi.remove_interface lets you remove OS
interfaces from the pre-defined list in ACPICA. For example,

hw.acpi.install_interface="FreeBSD"

lets _OSI("FreeBSD") method to return 0xffffffff (or success) and

hw.acpi.remove_interface="Windows 2009"

lets _OSI("Windows 2009") method to return zero (or failure). Both are
comma-separated lists and leading white spaces are ignored. For example,
the following examples are valid:

hw.acpi.install_interface="Linux, FreeBSD"
hw.acpi.remove_interface="Windows 2006, Windows 2006.1"


214110 20-Oct-2010 jkim

Introduce a new tunable 'hw.pci.do_power_suspend'. This tunable lets you
avoid PCI power state transition from D0 to D3 for suspending case. Default
is 1 or enabled.


214076 19-Oct-2010 jkim

Remove undocumented and stale debug.acpi.do_powerstate tunable. It was
added with hw.pci.do_powerstate but the PCI version was splitted into two
separate tunables later and now this is completely stale. To make it worse,
PCI devices enumerated in ACPI tree ignore this tunable as it is handled by
a function in acpi_pci.c instead.


214072 19-Oct-2010 jkim

Remove PCI_SET_POWERSTATE method from acpi.c and eradicate all PCI-specific
knowledges from the file. All PCI devices enumerated in ACPI tree must use
correct one from acpi_pci.c any way. Reduce duplicate codes as we did for
pci.c in r213905. Do not return ESRCH from PCIB_POWER_FOR_SLEEP method.
When the method is not found, just return zero without modifying the given
default value as it is completely optional. As a side effect, the return
state must not be NULL. Note there is actually no functional change by
removing ESRCH because acpi_pcib_power_for_sleep() always returns zero.
Adjust debugging messages and add new ones under bootverbose to help
debugging device power state related issues.

Reviewed by: jhb, imp (earlier versions)


214068 19-Oct-2010 jkim

Make any PCI devices enumerated in ACPI tree honor do_power_resume as well.


213787 13-Oct-2010 jkim

Clean up unused headers.


213783 13-Oct-2010 jkim

Remove acpi_bus_number() completely. It had to be removed in r212761.

Pointed out by: jhb


213772 13-Oct-2010 rpaulo

Mark acpi_bus_number() as __unused. This allows clang to this file
without any warnings.


213755 13-Oct-2010 jkim

Use AcpiReset() from ACPICA instead of rolling our own, which is actually
incomplete. If FADT says the register is available, enable the capability
by default. Remove the previous default value from acpi(4).


213737 12-Oct-2010 avg

acpi_ec: changes in communication with hardware

Short description of the changes:
- attempt to retry some commands for which it is possible (read, query)
- always make a short sleep before checking EC status in polled mode
- periodically poll EC status in interrupt mode
- change logic for detecting broken interrupt delivery and falling back
to polled mode
- check that EC is ready for input before starting a new command, wait
if necessary

This commit is based on the original patch by David Naylor.

PR: kern/150517
Submitted by: David Naylor <naylor.b.david@gmail.com>
Reviewed by: jkim
MFC after: 3 weeks


213302 30-Sep-2010 mav

Do not use regular interrupts on NVidia HPETs. NVidia MCP5x chipsets have
number of unexplained interrupt problems. For some reason, using HPET
interrupts there breaks HDA sound. Legacy route mode interrupts reported
to work fine there.


212997 22-Sep-2010 mav

Quick fix for unmotivated C2 state usage during boot, introduced at r212541.
That caused LAPIC timer failure and huge delays during boot on some systems.


212993 22-Sep-2010 avg

acpi_attach: do not explicitly install default handlers for default
address spaces

There has been no need to do that starting with ACPICA 20040427 as
AcpiEnableSubsystem() installs the handlers automatically.
Additionaly, explicitly calling AcpiInstallAddressSpaceHandler before
AcpiEnableSubsystem is not supported by ACPICA and leads to too early
execution of _REG methods in some DSDTs, which may result in problems.

Big thanks to Robert Moore of ACPICA/Intel for explaining the above.

Reported by: Daniel Bilik <daniel.bilik@neosystem.cz>
Tested by: Daniel Bilik <daniel.bilik@neosystem.cz>
Reviewed by: jkim
Suggested by: "Moore, Robert" <robert.moore@intel.com>
MFC after: 1 week


212761 16-Sep-2010 jkim

Merge ACPICA 20100915.


212549 13-Sep-2010 avg

acpi_cpu: do not apply P_LVLx_LAT rules to latencies returned by _CST

ACPI specification sates that if P_LVL2_LAT > 100, then a system doesn't
support C2; if P_LVL3_LAT > 1000, then C3 is not supported.
But there are no such rules for Cx state data returned by _CST. If a
state is not supported it should not be included into the return
package. In other words, any latency value returned by _CST is valid,
it's up to the OS and/or user to decide whether to use it.

Submitted by: nork
Suggested by: mav
MFC after: 1 week


212541 13-Sep-2010 mav

Refactor timer management code with priority to one-shot operation mode.
The main goal of this is to generate timer interrupts only when there is
some work to do. When CPU is busy interrupts are generating at full rate
of hz + stathz to fullfill scheduler and timekeeping requirements. But
when CPU is idle, only minimum set of interrupts (down to 8 interrupts per
second per CPU now), needed to handle scheduled callouts is executed.
This allows significantly increase idle CPU sleep time, increasing effect
of static power-saving technologies. Also it should reduce host CPU load
on virtualized systems, when guest system is idle.

There is set of tunables, also available as writable sysctls, allowing to
control wanted event timer subsystem behavior:
kern.eventtimer.timer - allows to choose event timer hardware to use.
On x86 there is up to 4 different kinds of timers. Depending on whether
chosen timer is per-CPU, behavior of other options slightly differs.
kern.eventtimer.periodic - allows to choose periodic and one-shot
operation mode. In periodic mode, current timer hardware taken as the only
source of time for time events. This mode is quite alike to previous kernel
behavior. One-shot mode instead uses currently selected time counter
hardware to schedule all needed events one by one and program timer to
generate interrupt exactly in specified time. Default value depends of
chosen timer capabilities, but one-shot mode is preferred, until other is
forced by user or hardware.
kern.eventtimer.singlemul - in periodic mode specifies how much times
higher timer frequency should be, to not strictly alias hardclock() and
statclock() events. Default values are 2 and 4, but could be reduced to 1
if extra interrupts are unwanted.
kern.eventtimer.idletick - makes each CPU to receive every timer interrupt
independently of whether they busy or not. By default this options is
disabled. If chosen timer is per-CPU and runs in periodic mode, this option
has no effect - all interrupts are generating.

As soon as this patch modifies cpu_idle() on some platforms, I have also
refactored one on x86. Now it makes use of MONITOR/MWAIT instrunctions
(if supported) under high sleep/wakeup rate, as fast alternative to other
methods. It allows SMP scheduler to wake up sleeping CPUs much faster
without using IPI, significantly increasing performance on some highly
task-switching loads.

Tested by: many (on i386, amd64, sparc64 and powerc)
H/W donated by: Gheorghe Ardelean
Sponsored by: iXsystems, Inc.


212533 13-Sep-2010 mav

Add tunable 'hint.hpet.X.per_cpu' to specify how much per-CPU timers driver
should provide if there is sufficient hardware. Default is 1.


212491 12-Sep-2010 mav

Instead of storing last event timestamp, store the next event timestamp.
It corrects handling of the first event offset in emulated periodic mode.


212413 10-Sep-2010 avg

bus_add_child: change type of order parameter to u_int

This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to: r212213
MFC after: 10 days


212323 08-Sep-2010 mav

During SMP startup there is time window, when SMP started, but interrupts
are still bound to BSP. It confuses timer management logic in per-CPU mode
and may cause timer not being reloaded. Check such cases on interrupt
arival and reload timer to give system some more time to manage proper
binding.


212238 05-Sep-2010 mav

Several improvements to HPET driver:
- Add special check for case when time expires before being programmed.
This fixes interrupt loss and respectively timer death on attempt to
program very short interval. Increase minimal supported period to more
realistic value.
- Add support for hint.hpet.X.allowed_irqs tunable, allowing manually
specify which interrupts driver allowed to use. Unluckily, many BIOSes
program wrong allowed interrupts mask, so driver tries to stay on safe
side by not using unshareable ISA IRQs. This option gives control over
this limitation, allowing more per-CPU timers to be provided, when FSB
interrupts are not supported. Value of this tunable is bitmask.
- Do not use regular interrupts on virtual machines. QEMU and VirtualBox
do not support them properly, that may cause problems. Stay safe by default.
Same time both QEMU and VirtualBox work fine in legacy_route mode.
VirtualBox also works fine if manually specify allowed ISA IRQs with above.


212172 03-Sep-2010 avg

acpi: update stale comments about order of cpu devices probing

These comments should have been updated in r203776 when the order was
changed.

Pointyhat to: avg
MFC after: 3 days


211430 17-Aug-2010 jhb

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


210977 06-Aug-2010 jkim

When EC burst mode is activated and multiple bytes are accessed, do not
disable and enable repeatedly, just do it once per call. It also reduces
code duplication. Check all parameters early and fail immediately.


210976 06-Aug-2010 jkim

Merge ACPICA 20100806.


210864 05-Aug-2010 jhb

- Retire acpi_pcib_resume(). It is has just been an alias for
bus_generic_resume() since the pci_link(4) driver was added.
- Change the ACPI PCI-PCI bridge driver to inherit most of its methods
from the generic PCI-PCI bridge driver. In particular, this will now
restore PCI config registers for ACPI PCI-PCI bridges.

Tested by: Oleg Sharoyko osharoiko of gmail


210298 20-Jul-2010 mav

Fix several un-/signedness bugs of r210290 and r210293. Add one more check.


210290 20-Jul-2010 mav

Extend timer driver API to report also minimal and maximal supported period
lengths. Make MI wrapper code to validate periods in request. Make kernel
clock management code to honor these hardware limitations while choosing hz,
stathz and profhz values.


210157 16-Jul-2010 jkim

Simplify AcpiOsReadPort() and AcpiOsWritePort() with iodev_read_*() and
iodev_write_*(). This removes unnecessary uses of temporary macros as well.
There is no functional change after this (verified with md5(1) on amd64).


210155 16-Jul-2010 jkim

Use pmap_mapdev()/pmap_unmapdev() to map device memory instead of using
AcpiOsMapMemory()/AcpiOsUnmapMemory() (-> pmap_mapbios()/pmap_unmapbios())
for AcpiOsReadMemory() and AcpiOsWriteMemory(). Although they do not sound
too obvious, these functions are exclusively used to access memory mapped
IO in ACPICA.


210150 15-Jul-2010 jkim

If there is any pending sleep request, disallow entering S5 state.
Otherwise, bad things may happen. ;-)


210137 15-Jul-2010 jkim

- AcpiOsReadPciConfiguration() needs similar fixes as r209965 and r210129.
According to ACPICA User Guide and Programmer Reference, the read data must
be zero extended to fill the 64-bit return value even if the bit width of
the location is less than 64.
- Return error when 64-bit access is requested as we do not support 64-bit
PCI register access (yet). XXX We may have to split it up into two 32-bit
accesses if it is really required.


210129 15-Jul-2010 jkim

- AcpiOsReadMemory() needs similar fixes as r209965. [1]
According to ACPICA User Guide and Programmer Reference, the read data must
be zero extended to fill the 32-bit return value even if the bit width of
the port is less than 32.
- Remove 64-bit read/write from AcpiOsReadMemory() and AcpiOsWriteMemory().
These functions do not support 64-bit access (yet). Clean up style nits
and unnecessary bit masking while I am here.

Reported by: Liu, Jinsong (jinsong dot liu at intel dot com) via
Lin Ming (ming dot m dot lin at intel dot com) [1]


210003 13-Jul-2010 jkim

Make SMP code path conditional at run-time.


209990 13-Jul-2010 mav

Rise knowledge about curthread->td_intr_frame by one step. Make timer
callback argument really opaque. Not repeat interrupt handler's problem
in case somebody will ever need to have both argument and frame.


209966 13-Jul-2010 jkim

Fix white spaces.


209965 13-Jul-2010 jkim

According to ACPICA User Guide and Programmer Reference, the read data must
be zero extended to fill the 32-bit return value even if the bit width of
the port is less than 32.


209747 06-Jul-2010 jkim

Fix mis-merges in the previous commit.


209746 06-Jul-2010 jkim

Merge ACPICA 20100702.


209440 22-Jun-2010 mav

Add "legacy route" support to HPET driver. When enabled, this mode makes
HPET to steal IRQ0 from i8254 and IRQ8 from RTC timers. It can be suitable
for HPETs without FSB interrupts support, as it gives them two unshared
IRQs. It allows them to provide one per-CPU event timer on dual-CPU system,
that should be suitable for further tickless kernels.

To enable it, such lines may be added to /boot/loader.conf:
hint.atrtc.0.clock=0
hint.attimer.0.clock=0
hint.hpet.0.legacy_route=1


209431 22-Jun-2010 mav

Do not set level-triggered interrupt mode if we are not going to use it.
This fixes QEMU crash due to unsupported level-triggered HPET interrupts.

Reported by: kib@


209402 21-Jun-2010 mav

Fix ia64 build broken by r209371.
ia64, same as amd64 has ACPI and always has APIC.

Submitted by: jhb@


209371 20-Jun-2010 mav

Implement new event timers infrastructure. It provides unified APIs for
writing event timer drivers, for choosing best possible drivers by machine
independent code and for operating them to supply kernel with hardclock(),
statclock() and profclock() events in unified fashion on various hardware.

Infrastructure provides support for both per-CPU (independent for every CPU
core) and global timers in periodic and one-shot modes. MI management code
at this moment uses only periodic mode, but one-shot mode use planned for
later, as part of tickless kernel project.

For this moment infrastructure used on i386 and amd64 architectures. Other
archs are welcome to follow, while their current operation should not be
affected.

This patch updates existing drivers (i8254, RTC and LAPIC) for the new
order, and adds event timers support into the HPET driver. These drivers
have different capabilities:
LAPIC - per-CPU timer, supports periodic and one-shot operation, may
freeze in C3 state, calibrated on first use, so may be not exactly precise.
HPET - depending on hardware can work as per-CPU or global, supports
periodic and one-shot operation, usually provides several event timers.
i8254 - global, limited to periodic mode, because same hardware used also
as time counter.
RTC - global, supports only periodic mode, set of frequencies in Hz
limited by powers of 2.

Depending on hardware capabilities, drivers preferred in following orders,
either LAPIC, HPETs, i8254, RTC or HPETs, LAPIC, i8254, RTC.
User may explicitly specify wanted timers via loader tunables or sysctls:
kern.eventtimer.timer1 and kern.eventtimer.timer2.
If requested driver is unavailable or unoperational, system will try to
replace it. If no more timers available or "NONE" specified for second,
system will operate using only one timer, multiplying it's frequency by few
times and uing respective dividers to honor hz, stathz and profhz values,
set during initial setup.


209330 19-Jun-2010 mav

Oops! Add " / hz" missed in r209328. Assume interrupt rate hz/2, not 1/2.


209328 19-Jun-2010 mav

While we indeed can't precisely measure time spent in C1, we can consider
measured interval as upper bound. It should be more precise then just
assuming hz/2. For idle CPU it should be quite precise, for busy - not
worse then before.


209213 15-Jun-2010 jhb

When updating individual CPU's lowest Cx state to use, never set it to a
state lower than the lowest one supported by the current CPU. This closes
some races with changes to the hw.acpi.cpu_cx_lowest sysctl while Cx
states for individual CPUs were changing (e.g. unplugging the AC adapter
of a laptop) that could result in panics.

Submitted by: Giovanni Trematerra
Tested by: David Demelier demelier dot david of gmail
MFC after: 3 days


209065 11-Jun-2010 jkim

Simplify a function for getting brightness levels.


209064 11-Jun-2010 jkim

Remove unused assignment.

Found by: clang static analyzer
Found by: Coverity Prevent[tm] (CID 4537, 4538, 4539)


209062 11-Jun-2010 avg

fix a few cases where a string is passed via format argument instead of
via %s

Most of the cases looked harmless, but this is done for the sake of
correctness. In one case it even allowed to drop an intermediate buffer.

Found by: clang
MFC after: 2 week


209059 11-Jun-2010 jhb

Update several places that iterate over CPUs to use CPU_FOREACH().


208925 08-Jun-2010 jhb

The lock associated with the /dev/apm knote is already held, so use
KNOTE_LOCKED() instead of KNOTE_UNLOCKED().

Reported by: mav
MFC after: 3 days


208722 01-Jun-2010 jkim

Remove unnecessary pointer type castings, shift operations and dead code.


208438 23-May-2010 mav

Oops, HPET ID optionally stored in _UID, not in _ADR.


208436 23-May-2010 mav

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.


207344 28-Apr-2010 jkim

Merge ACPICA 20100428.


206117 02-Apr-2010 jkim

Merge ACPICA 20100331 (and four additional upstream patches).


204965 10-Mar-2010 jkim

Fix white spaces.


204916 09-Mar-2010 jkim

- 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.


204773 05-Mar-2010 jkim

Merge ACPICA 20100304.


203936 15-Feb-2010 jkim

Rename some macros to clarify their intentions and fix style nits.


203935 15-Feb-2010 jkim

Add support for `cycle' and `zero' events for LCD brightness control.

Submitted by: Daniel Walter (d dot walter at 0x90 dot at) (intial version)


203813 13-Feb-2010 jkim

Make sanity check slightly more useful and tweak an error message.


203810 13-Feb-2010 jkim

Implement LCD brightness control notify handler.

Submitted by: Daniel Walter(d dot walter at 0x90 dot at) (intial version)


203785 11-Feb-2010 avg

acpi: drop the second bus_generic_attach pass

It is belived that that pass s not needed anymore.
Specifically it is not required now for the reasons that were given
in the removed comment.

Discussed with: jhb
MFC after: 4 weeks


203776 11-Feb-2010 avg

acpi cpu: probe+attach before all other enumerated children on acpi bus

Some current systems dynamically load SSDT(s) when _PDC/_OSC method
of Processor is evaluated. Other devices in ACPI namespace may access
objects defined in the dynamic SSDT. Drivers for such devices might
have to have a rather high priority, because of other dependencies.
Good example is acpi_ec driver for EC.
Thus we attach to Processors as early as possible to load the SSDTs
before any other drivers may try to evaluate control methods.
It also seems to be a natural order for a processor in a device
hierarchy.

On the other hand, some child devices on acpi cpu bus need to access
other system resources like PCI configuration space of chipset devices,
so they need to be probed and attached rather late.
For this reason we probe and attach the cpu bus at
SI_SUB_CONFIGURE:SI_ORDER_MIDDLE SYSINIT level.
In the future this could be done more elegantly via multipass.

Please note that acpi drivers that might access ACPI namespace from
device_identify will do that before _PDC/_OSC of Processors are evaluated.

Legacy cpu driver is not affected by this change.

PR: kern/142561 (in part)
Reviewed by: jhb
Silence from: acpi@
MFC after: 5 weeks


203546 06-Feb-2010 avg

acpi_cpu: prefer _OSC over _PDC, just in case

_PDC was deprecated in favor of _OSC long time ago, but it
seems that they still peacefully coexist and in some case
only _PDC is present.
Still _OSC provides a reacher interface and is capable to
report back its status.
If the status is non-zero, then report it, we may find
it useful to understand what firmware expects from OS.
Also clean up some comments that became less useful over time.

Reviewed by: njl, jhb, rpaulo
MFC after: 3 weeks


203430 03-Feb-2010 avg

acpi_cpu: correct capabilities arguments for Processor _OSC evaluation

Populate capabilities buffer according to
Intel Processor Vendor-Specific ACPI Interface Specification.

MFC after: 2 weeks


203062 27-Jan-2010 avg

acpi_hpet: correctly get number of timers/comparators in a timer block

Also, account for a quirk of AMD/ATI HPET which reports number of timers
instead of id of the last timer as manadated by the specification.
Currently this has no effect on functionality but in the future we may
make actual use of the HPET timers, not only of its timecounter.

MFC after: 2 weeks


202771 21-Jan-2010 jkim

Merge ACPICA 20100121.


202567 18-Jan-2010 avg

acpi_ec: remove redundant acpi_disabled check in probe method

MFC after: 4 days


202558 18-Jan-2010 avg

acpi_ec: clean up 'private' ivar when freeing memory to which it points

This is not only a prudent thing to do, but also makes sure that probe
method is not confused by non-NULL 'private', if the previous attach
attempt fails for any reason.

PR: kern/142561
Tested by: Alex Goncharov <alex-goncharov@comcast.net>
MFC after: 4 days


199337 16-Nov-2009 jkim

Merge ACPICA 20091112.


199016 07-Nov-2009 avg

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


197649 30-Sep-2009 jhb

Do not hold the ACPI A/C adapter lock when changing the power profile.

MFC after: 2 weeks


197648 30-Sep-2009 jhb

Split the 'video' ACPI lock up into two locks to resolve a LOR with the
sysctl lock. The 'video' lock now protects the 'bus' of video output
devices attached to a graphics adapter. It is used when iterating over
the list of outputs, etc. The 'video_output' lock is used to lock the
output-specific data similar to a driver lock for the individual video
outputs.

MFC after: 2 weeks


197536 27-Sep-2009 jkim

Copy apm(4) emulation from sys/i386/acpica/acpi_machdep.c and
install apm(8) and apm_bios.h on amd64.


197439 23-Sep-2009 jhb

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.


197438 23-Sep-2009 jhb

Uninline an instance of STAILQ_FOREACH_SAFE().


197105 11-Sep-2009 jkim

Catch up with ACPICA 20090903.


196520 24-Aug-2009 jhb

Tweak the way that the ACPI and ISA bus drivers match hint devices to
BIOS-enumerated devices:
- Assume a device is a match if the memory and I/O ports match even if the
IRQ or DRQ is wrong or missing. Some BIOSes don't include an IRQ for
the atrtc device for example.
- Add a hack to better match floppy controller devices. Many BIOSes do not
include the starting port of the floppy controller listed in the hints
(0x3f0) in the resources for the device. So far, however, all the BIOS
variations encountered do include the 'port + 2' resource (0x3f2), so
adjust the matching for "fdc" devices to look for 'port + 2'.

Reviewed by: imp
MFC after: 3 days


196403 20-Aug-2009 jhb

Temporarily revert the new-bus locking for 8.0 release. It will be
reintroduced after HEAD is reopened for commits by re@.

Approved by: re (kib), attilio


196037 02-Aug-2009 attilio

Make the newbus subsystem Giant free by adding the new newbus sxlock.
The newbus lock is responsible for protecting newbus internIal structures,
device states and devclass flags. It is necessary to hold it when all
such datas are accessed. For the other operations, softc locking should
ensure enough protection to avoid races.

Newbus lock is automatically held when virtual operations on the device
and bus are invoked when loading the driver or when the suspend/resume
take place. For other 'spourious' operations trying to access/modify
the newbus topology, newbus lock needs to be automatically acquired and
dropped.

For the moment Giant is also acquired in some key point (modules subsystem)
in order to avoid problems before the 8.0 release as module handlers could
make assumptions about it. This Giant locking should go just after
the release happens.

Please keep in mind that the public interface can be expanded in order
to provide more support, if there are really necessities at some point
and also some bugs could arise as long as the patch needs a bit of
further testing.

Bump __FreeBSD_version in order to reflect the newbus lock introduction.

Reviewed by: ed, hps, jhb, imp, mav, scottl
No answer by: ariff, thompsa, yongari
Tested by: pho,
G. Trematerra <giovanni dot trematerra at gmail dot com>,
Brandon Gooch <jamesbrandongooch at gmail dot com>
Sponsored by: Yahoo! Incorporated
Approved by: re (ksmith)


195666 13-Jul-2009 jkim

Match PCI Express root bridge _HID directly instead of
relying on _CID.

Reviewed by: jhb
Approved by: re (kib)


194639 22-Jun-2009 jkim

Add a missing return in NULL mutex case.

Submitted by: Pawel Worach (pawel dot worach at gmail dot com)


194011 11-Jun-2009 jkim

- Remove unnecessary read memory barriers from atomic operations[1].
- Define a macro to make my intention more clearer.

Submitted by: jhb [1]


193963 10-Jun-2009 jkim

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.


193829 09-Jun-2009 jhb

Rework the _BBN handling for Host-PCI bridges. Previously we only trusted
a _BBN value of 0 if it was for the first bridge encountered since some
older systems returned _BBN of 0 for all bridges. However, some newer
systems enumerate bridges with non-zero _BBN before bus 0 which is
perfectly valid. Handle both cases by trusting the first bridge that has
a _BBN of 0 and falling back to reading from non-standard config registers
only for subsequent bridges with a _BBN of 0. We also only perform this
check for segment (domain) 0. We assume that _BBN is always correct
for segments other than 0.

Tested by: Josef Moellers josef.moellers at fujitsu
MFC after: 1 week


193753 08-Jun-2009 jkim

Remove redundant checks for ACPI_WAIT_FOREVER cases.


193750 08-Jun-2009 jkim

Rewrite OsdSynch.c to reflect the latest ACPICA more closely:

- Implement ACPI semaphore (ACPI_SEMAPHORE) with condvar(9) and mutex(9).
- Implement ACPI mutex (ACPI_MUTEX) with mutex(9).
- Implement ACPI lock (ACPI_SPINLOCK) with spin mutex(9).


193530 05-Jun-2009 jkim

Import ACPICA 20090521.


192450 20-May-2009 imp

We no longer need to use d_thread_t, migrate to struct thread *.


191764 03-May-2009 mav

Make dev.cpu.X.cx_usage sysctl also report current average of sleep time.


191763 03-May-2009 mav

Remove unused variable and fix spelling in comment.


191760 02-May-2009 mav

Avoid comparing negative signed to positive unsignad values. It was
leading to a bug, when C-state does not decrease on sleep shorter then
declared transition latency. Fixing this deprecates workaround for broken
C-states on some hardware.

By the way, change state selecting logic a bit. Instead of last sleep
time use short-time average of it. Global interrupts rate in system is a
quite random value, to corellate subsequent sleeps so directly.


191699 30-Apr-2009 jkim

Fix off-by-one bug. S5 state must be checked as well.


191697 30-Apr-2009 jkim

Fix style(9).


191696 30-Apr-2009 jkim

Prefer device_printf() over printf() where ever possible.


191695 30-Apr-2009 jkim

General sleep state change clean up.

- Probe supported sleep states from acpi_attach() just once and do not
call AcpiGetSleepTypeData() again. It is redundant because
AcpiEnterSleepStatePrep() does it any way.
- Treat UNKNOWN sleep state as NONE, i.e., "do nothing", and remove obscure
NONE state (ACPI_S_STATES_MAX + 1) to avoid confusions.
- Do not set unsupported sleep states as default button/switch events.
If the default sleep state is not supported, just set it as UNKNOWN/NONE.
- Do not allow sleep state change if the system is not fully up and running.
This should prevent entering S5 state multiple times, which causes strange
behaviours later.
- Make sleep states case-insensitive when they are used with sysctl(8).
For example,

sysctl hw.acpi.lid_switch_state=s1
sysctl hw.acpi.sleep_button_state=none

are now legal and equivalent to the uppercase ones.


191627 28-Apr-2009 avg

acpi: do not run resume/backout code when entering S0/S5 states

This change adds (possibly redundant) early check for invalid
state input parameter (including S0). Handling of S5 request
is reduced to simply calling shutdown_nice(). As a result
control flow of acpi_EnterSleepState is somewhat simplified
and resume/backout half of the function is not executed
for S5 (soft poweroff) request and invalid state requests.

Note: it seems that shutdown_nice may act as nop when initproc
is already initialized (to grab pid of 1), but init process is in
"pre-natal" state.

Tested by: Fabian Keil <fk@fabiankeil.de>
Reviewed by: njl, jkim
Approved by: rpaulo


190454 26-Mar-2009 jhb

Move the code to update cpu_cx_count out of acpi_cpu_generic_cx_probe() and
into acpi_cpu_startup() which is where all the other code to update this
global variable lives. This fixes a bug where cpu_cx_count was not updated
correctly if acpi_cpu_generic_cx_probe() returned early.

PR: kern/108581
Debugged by: Bruce Cran
Reviewed by: avg, njl, sepotvin
MFC after: 3 days


190340 23-Mar-2009 jkim

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.


190339 23-Mar-2009 jkim

Check whether devd is running before calling resume notifier and
reshuffle code to reduce unnecessary locking coverage.


189903 17-Mar-2009 jkim

Initial suspend/resume support for amd64.

This code is heavily inspired by Takanori Watanabe's experimental SMP patch
for i386 and large portion was shamelessly cut and pasted from Peter Wemm's
AP boot code.


188814 19-Feb-2009 avg

acpi_cpu: fixup for PIIX4E PCI config related to C2

This is triggered only if BIOS configures ACPI_BITREG_BUS_MASTER_RLD
aka BRLD_EN_BM to 1.
Rationale:
1. we do not support C3 on PIIX4E
2. bus master activity need not break out of C2 state
3. because of CPU_QUIRK_NO_BM_CTRL quirk we may reset bus master
status which would result in immediate break out from C2

So if you have seen
cpu0: too many short sleeps, backing off to C1
with this chipset before you may want to try cx_lowest of C2 again.

Reviewed by: rpaulo (mentor), njl
Approved by: rpaulo (mentor)


188163 05-Feb-2009 imp

pcib_read_config and pcib_write_config take u_int params.


187368 17-Jan-2009 mav

Convert battery capacity/rate from mA to mW only when summary is requested.
Unconditional conversion causes incorrect rate units reported by acpiconf.

MFC after: 2 weeks


186031 13-Dec-2008 silby

Quick change to r186026. One of the conditionals was:

if (batt_sleep_ms)
AcpiOsSleep(1);

where the rest are all:

if (batt_sleep_ms)
AcpiOsSleep(batt_sleep_ms);

I can't recall why that one was different, so change it
to match the rest.

Pointed out by: Christoph Mallon
MFC after: 2 weeks


186026 13-Dec-2008 silby

Add the sysctl debug.acpi.batt.batt_sleep_ms.

On some laptops with smart batteries, enabling battery monitoring
software causes keystrokes from atkbd to be lost. This has also been
reported on Linux, and is apparently due to the keyboard and I2C line
for the battery being routed through the same chip. Whether that's
accurate or not, adding extra sleeps to the status checking code
causes the problem to go away.

I've been running this for nearly six months now on my laptop,
it works like a charm.

Reviewed by: Nate Lawson (in a previous revision)
MFC after: 2 weeks


185308 25-Nov-2008 ganbold

Remove unused variable.

Found with: Coverity Prevent(tm)
CID: 3678

Approved by: njl


185103 19-Nov-2008 jkim

Make sure legacy replacement route is turned off when enbling HPET.

Reviewed by: jhb


185059 18-Nov-2008 jhb

Allow device hints to wire the unit numbers of devices.
- An "at" hint now reserves a device name.
- A new BUS_HINT_DEVICE_UNIT method is added to the bus interface. When
determining the unit number of a device, this method is invoked to
let the bus driver specify the unit of a device given a specific
devclass. This is the only way a device can be given a name reserved
via an "at" hint.
- Implement BUS_HINT_DEVICE_UNIT() for the acpi(4) and isa(4) bus drivers.
Both of these busses implement this by comparing the resources for a
given hint device with the resources enumerated by ACPI/PnPBIOS and
wire a unit if the hint resources are a subset of the "real" resources.
- Use bus_hinted_children() for adding hinted devices on isa(4) busses
now instead of doing it by hand.
- Remove the unit kludging from sio(4) as it is no longer necessary.

Prodding from: peter, imp
OK'd by: marcel
MFC after: 1 month


184596 03-Nov-2008 mav

Remove " + 1".
Thread ID can't be zero anyway while increment may give owerflow.


184563 02-Nov-2008 imp

Make the no driver stuff an ifdef.


184558 02-Nov-2008 mav

As soon as we have several threads per process now, it is not correct to
use process ID as ACPI thread ID. Concurrent requests with equal thread
IDs broke ACPI mutexes operation causing unpredictable errors including
AE_AML_MUTEX_NOT_ACQUIRED that I have seen.

Use kernel thread ID instead of process ID for ACPI thread.


183190 19-Sep-2008 jkim

Clean up DSDT and XSDT correctly instead of FADT when the tables are bad.

Submitted by: jhb
Tested by: olli
MFC after: 3 days


182071 23-Aug-2008 imp

Handle errors from device_get_children.


181987 22-Aug-2008 jhb

Extend the support for PCI-e memory mapped configuration space access:
- Rename pciereg_cfgopen() to pcie_cfgregopen() and expose it to the
rest of the kernel. It now also accepts parameters via function
arguments rather than global variables.
- Add a notion of minimum and maximum bus numbers and reject requests for
an out of range bus.
- Add more range checks on slot/func/reg/bytes parameters to the cfg reg
read/write routines. Don't panic on any invalid parameters, just fail
the request (writes do nothing, reads return -1). This matches the
behavior of the other cfg mechanisms.
- Port the memory mapped configuration space access to amd64. On amd64
we simply use the direct map (via pmap_mapdev()) for the memory mapped
window.
- During acpi_attach() just after loading the ACPI tables, check for a
MCFG table. If it exists, call pciereg_cfgopen() on each subtable
(memory mapped window). For now we only support windows for domain 0
that start with bus 0. This removes the need for more chipset-specific
quirks in the MD code.
- Remove the chipset-specific quirks for the Intel 5000P/V/Z chipsets
since these machines should all have MCFG tables via ACPI.
- Updated pci_cfgregopen() to DTRT if ACPI had invoked pcie_cfgregopen()
earlier.

MFC after: 2 weeks


181299 04-Aug-2008 jhb

Fix a typo.


180760 23-Jul-2008 jhb

Further refine the probe order of devices to more closely match the previous
behavior. Specifically, probe Host-PCI bridges in the order they are
encountered in the tree. For CPUs, just use an order of 100000 and assume
that no Host-PCI bridges will be more than 10000 levels deep in the
namespace. This fixes an issue on some boxes where the HPET timer stopped
attaching.


178506 25-Apr-2008 rpaulo

Initialize tz_active to a new constant TZ_ACTIVE_UNKNOWN and make no
assumptions about the state of the cooling devices. Instead, switch them
off on init and, only after that, we are in TZ_ACTIVE_NONE.

Submited by: Andriy Gapon <avg at icyb.net.ua>
Reviewed by: njl


178146 12-Apr-2008 rpaulo

Update the list of Cx states when ACPICA notifies us. Usually, this
notification is sent when the AC plug is plugged in/out.

This is required on some laptops, namely the MacBooks.

Silence on: freebsd-acpi


177985 07-Apr-2008 jhb

Revert back to probing Host-PCI bridges in the order we encounter them in
the tree rather than sorting them by their address on PCI bus 0.

Reported by: kan


177934 05-Apr-2008 takawata

GPE lock may recurse on resume path.


177157 13-Mar-2008 jhb

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@


177041 10-Mar-2008 jhb

Probe CPUs after the PCI hierarchy on i386, amd64, and ia64. This allows
the cpufreq drivers to reliably use properties of PCI devices for quirks,
etc.
- For the legacy drivers, add CPU devices via an identify routine in the
CPU driver itself rather than in the legacy driver's attach routine.
- Add CPU devices after Host-PCI bridges in the acpi bus driver.
- Change the ichss(4) driver to use pci_find_bsf() to locate the ICH and
check its device ID rather than having a bogus PCI attachment that only
checked for the ID in probe and always failed. As a side effect, you
can now kldload ichss after boot.
- Fix the ichss(4) driver to use the correct device_t for the ICH (and not
for ichss0) when doing PCI config space operations to enable SpeedStep.

MFC after: 2 weeks
Reviewed by: njl, Andriy Gapon avg of icyb.net.ua


176972 09-Mar-2008 rpaulo

Some PIIX4 chipsets need to be told to generate Stop Breaks by setting
the appropriate bit in the DEVACTB register.
This change allows the C2 state on those systems to work as expected.

Reviewed by: njl
Submitted by: Andriy Gapon <avg at icyb.net.ua>
MFC after: 1 week


176329 16-Feb-2008 ume

Create a thread to handle passive cooling for 1st zone which has _PSV,
_TSP, _TC1 and _TC2.

Contirmed by: "Alexandre \"Sunny\" Kovalenko" <alex.kovalenko_at_verizon.net>
Reviewed by: njl
MFC after: 1 week


176327 16-Feb-2008 rpaulo

Allow the user to override the current active cooling state if state
is currently TZ_ACTIVE_NONE.

Submitted by: Andriy Gapon <avg at icyb.net.ua>
Reviewed by: njl (mentor)
Approved by: njl (mentor)
Requested by: njl (mentor)
MFC after: 3 days


176326 16-Feb-2008 rpaulo

Skip validation of the C3 state if we disabled C3 by software (i.e.,
via quirk).

Submitted by: Andriy Gapon <avg at icyb.net.ua>
Reviewed by: njl (mentor)
Approved by: njl (mentor)
Requested by: njl (mentor)
MFC after: 3 days


176205 12-Feb-2008 jhb

Fix a typo when testing for the NO_C3 quirk.

MFC after: 3 days


175732 28-Jan-2008 iwasaki

Return errno value rather than boolean in this context.

MFC after: 1 week


175727 27-Jan-2008 iwasaki

Enter the sleep state immediately without waiting for timeout if
devd(8) is not running such as the system in single user mode.

MFC after: 1 week


175385 16-Jan-2008 jhb

Add a header containing constants for the various HPET registers and their
fields and update the code to match. The PR served more as an inspiration
than providing the actual diffs.

MFC after: 1 week
PR: kern/112544


175361 15-Jan-2008 jhb

Fix a few minor issues based on a bug report and reading over the HPET
spec:
- Use read/modify/write cycles to enable and disable the HPET instead of
writing 0 to reserved bits.
- Shutdown the HPET during suspend as encouraged by the spec.
- Fail to attach to an HPET with a period of zero.

MFC after: 1 week
PR: kern/119675 [3]
Reported by: Leo Bicknell | bicknell ufp.org


175256 12-Jan-2008 njl

Fix GPE livelock that occurs on HP/Compaq laptops, mostly in the thermal
zone code. The GPE handler method (i.e. _L00) generates various Notify
events that need to be run to completion before the GPE is re-enabled.
In ACPI-CA, we queue an asynch callback at the same priority as a Notify
so that it will only run after all Notify handlers have completed. The
callback re-enables the GPE afterwards. We also changed the priority of
Notifies to be the same as GPEs, given the possibility that another GPE
could arrive before the Notifies have completed and we don't want it to
get queued ahead of the rest.

The ACPI-CA change was submitted by Alexey Starikovskiy (SUSE) and will
appear in a later release. Special thanks to him for helping track this
bug down.

MFC after: 1 week
Tested by: jhb, Yousif Hassan <yousif / alumni.jmu.edu>


175014 31-Dec-2007 jhb

Use devclass_get_count() instead of devclass_get_maxunit() to get the
correct number of acpi_thermalX devices. Having this wrong caused the
acpi_thermal thread to realloc the array of devices on each loop iteration.

MFC after: 1 week
PR: kern/118497
Submitted by: Pasi Parviainen


174898 25-Dec-2007 rwatson

Add a new 'why' argument to kdb_enter(), and a set of constants to use
for that argument. This will allow DDB to detect the broad category of
reason why the debugger has been entered, which it can use for the
purposes of deciding which DDB script to run.

Assign approximate why values to all current consumers of the
kdb_enter() interface.


174889 24-Dec-2007 ume

Add sysctl mibs for _TSP, _TC1 and _TC2 which is user overridable
but is blocked on user_override mib.
Not a few people want to use a passive cooling without their ACPI
BIOS support.

Reviewed by: njl


173782 20-Nov-2007 jkim

Check battery presence first before trying to get battery information.

PR: kern/117591
Tested by: Jessica Mahoney (root at varusonline dot com)


173480 08-Nov-2007 njl

Whitespace only.


173284 02-Nov-2007 njl

Fix a shutdown hang on some SMP systems. The previous logic was to IPI all
CPUs to make sure idle threads are evicted from the softc before returning
from acpi_cpu_shutdown(). However, this is unnecessary since stop_cpus()
handles this for itself and at this point it's possible that our IPI will be
blocked (interrupts disabled).

Thanks to: Glen Leeder <glen.leeder / nokia.com>
MFC after: 3 days


173082 27-Oct-2007 jhb

Don't return an error from resume() if execution of _DIS fails for some
reason (not all BIOSen have _DIS methods for all link devices for example).
This matches the behavior of attach() with respect to _DIS as well.

Submitted by: njl


173062 27-Oct-2007 jhb

Don't destroy an ACPI device_t for a PCI device and reassign the ACPI
handle to the PCI device_t if the ACPI device_t is already attached to a
driver. This happens on the Tablet TC1000 which for some reason includes
two PCI-ISA bridges and treats the second bridge as an ACPI system resource
device.

Reviewed by: njl (a while ago)
MFC after: 3 days


173058 27-Oct-2007 jhb

Don't always re-route IRQs on resume. If this link hasn't been used, then
disable it with _DIS rather than assigning it an IRQ on resume.

MFC after: 1 week


172987 25-Oct-2007 takawata

More style nit.
Pointed out by: njl.


172978 25-Oct-2007 takawata

Fix variable name to be clear what it means.


172973 25-Oct-2007 takawata

Turn EC into poll mode before device_resume invoked .


172836 20-Oct-2007 julian

Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0 so that we can eventually MFC the
new kthread_xxx() calls.


172490 09-Oct-2007 njl

When the EC times out (common with Compaqs), it may report a design
voltage of 0. This can result in a divide by zero trap. Add a guard
for this case. The value of lfcap is checked in acpi_battery_bif_valid()
just before this, so it is safe.

Reportd by: sam
Approved by: re
MFC after: 3 days


172489 09-Oct-2007 njl

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


172394 30-Sep-2007 marius

Make the PCI code aware of PCI domains (aka PCI segments) so we can
support machines having multiple independently numbered PCI domains
and don't support reenumeration without ambiguity amongst the
devices as seen by the OS and represented by PCI location strings.
This includes introducing a function pci_find_dbsf(9) which works
like pci_find_bsf(9) but additionally takes a domain number argument
and limiting pci_find_bsf(9) to only search devices in domain 0 (the
only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are
changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order
to no longer report false positives when searching for siblings and
dupe devices in the same domain respectively.
Along with this change the sole host-PCI bridge driver converted to
actually make use of PCI domain support is uninorth(4), the others
continue to use domain 0 only for now and need to be converted as
appropriate later on.
Note that this means that the format of the location strings as used
by pciconf(8) has been changed and that consumers of <sys/pciio.h>
potentially need to be recompiled.

Suggested by: jhb
Reviewed by: grehan, jhb, marcel
Approved by: re (kensmith), jhb (PCI maintainer hat)


172313 24-Sep-2007 njl

Rewrite the EC driver event model. The main goal is to avoid
polling/interrupt-driven fallback and instead use polling only during
boot and pure interrupt-driven mode after boot. Polled mode could be
relegated completely to a legacy role if we could enable interrupts
during boot. Polled mode can be forced after boot by setting
debug.acpi.ec.polled="1", i.e. if there are timeouts.

- Use polling only during boot, shutdown, or if requested by the user.
Otherwise, use a generation count of GPEs, incremented atomically. This
prevents an old status value from being used if the EC is really slow
and the same condition (i.e. multiple IBEs for a write transaction) is
being checked.
- Check for and run the query handler directly if the SCI bit is set in
the status register during boot. Previously, the query handler wouldn't
run until interrupts were finally enabled late in boot.
- During boot and after starting a command, check if the event appears
to already have occurred before we even start waiting. If so, it's
possible the EC is very slow and we might accept an old status value.
Print a warning in this case. Once we've booted, interrupt-driven mode
should work just fine but polled mode could be unreliable. There's not
much more we can do about this until interrupts are enabled during boot.
- In the above case, we also do one final check if the interrupt-driven
mode gets a timeout. If the status is complete, it will force the
system back into polled mode since interrupt mode doesn't work. For
polled mode during boot, if the status appears to be already complete
before beginning the check loop, it waits 10 us before actually checking
the status, just in case the EC is really slow and hasn't gotten to work
on the new request yet.
- Use upper-case hex for the _Qxx method
- Use device_printf for errors, don't hide them under verbose
- Increase default total timeout to 750 ms and decrease polling interval
to 5 us.
- Don't pass the status value via the softc. Just read it directly.
- Remove the mutex. We use the sx lock for transaction serialization
with the query handler.
- Remove the Intel copyright notice as no code of theirs was ever
present in this file (verified against rev 1.1)
- Allow KTR module-only builds for ease of testing

Thanks to jkim and Alexey Starikovskiy for helpful discussions and testing.

Approved by: re
MFC after: 2 weeks


172153 13-Sep-2007 njl

Reject requests to start or ack a suspend sequence on platforms that do not
support suspend/resume, currently all except i386.

Tested by: jkim
Approved by: re


172022 30-Aug-2007 njl

Evaluate _OSC on boot to indicate our OS capabilities to ACPI. This is
needed at least to convince the BIOS to give us access to CPU freq
control on MacBooks.

Submitted by: Rui Paulo <rpaulo / fnop.net>
Approved by: re
MFC after: 5 days


171657 30-Jul-2007 njl

Dynamically choose the quality of the ACPI timer depending on whether
the fast or safe/slow method is in use. Fast remains at 1000, slow is
now at 850 (always preferred to TSC). Since the HPET has proven slower
than ACPI-fast on some systems, drop its quality to 900. In the future,
it is hoped that HPET performance will improve as it is the main
timer Intel supports. HPET may move back to 2000 in -current once RELENG_7
is branched to ensure that it gets tested.

Approved by: re


171547 22-Jul-2007 njl

The HPET appears to be broken on silby's Acer Pentium M system, never
advancing. Read from the timer before attaching to be sure it advances
in 1 us. Since the slowest rate allowed by the spec is 10 MHz, the
timer is guaranteed to change in this interval if it is working.

Tested by: Rui Paulo
Approved by: re
MFC after: 3 days


171119 30-Jun-2007 njl

My previous commit introduced a spurious warning for the case where a
switch (i.e. lid) is set to have an action of NONE. This is not an
invalid state, so silently return. This fixes the warning:
"acpi: request to enter state S6 failed (err 22)"

Approved by: re


170976 21-Jun-2007 njl

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


170783 15-Jun-2007 njl

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


170289 04-Jun-2007 dwmalone

Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export.
The type must always be an int or an unsigned int.

Remove the instances where a sizeof(variable) is passed to stop
people accidently cut and pasting these examples.

In a few places this was sysctl_handle_int was being used on 64 bit
types, which would truncate the value to be exported. In these
cases use sysctl_handle_quad to export them and change the format
to Q so that sysctl(1) can still print them.


170228 03-Jun-2007 njl

Disable CPU idle states during suspend and reenable them during resume.
While in the suspend path, this means the idle thread will just return
immediately rather than trying to enter C1-n. This helps in the case where
the chipset is powered down before the rest of the system and reads from
the cpu sleep registers begin returning immediately, causing the logic that
catches bad C2/C3 behavior to kick in. Observed on my Panasonic Y4.

MFC after: 3 days


170214 02-Jun-2007 njl

Fix a bug introduced in the per-CPU Cx states commit. The wrong loop var
(j/i) was being used and it was being incremented, not decremented as before.
Factor out this code into a common function and call it from both the common
and per-CPU case.

MFC after: 1 day


170211 02-Jun-2007 njl

AcpiAcquireGlobalLock() can sometimes sleep if the mutex is contested.
The global lock is a memory region shared with the BIOS and thus
has some strange behavior like the fact that the sleep is 1 ms max.
We use standard mutexes to synchronize with the SCI so acquiring
the global lock after locking the mutex resulted in a witness
warning.

To deal with this for now, acquire the global lock before all other
locks, similar to Giant. This should fix the witness "sleeping
with mutex held" issue on boot that occurred after the last ACPI-CA
import. In the future, we hope to move to the new mutex interface
in ACPI-CA instead of the pseudo-semaphore version we have now.

Reviewed by: jkim


170148 31-May-2007 takawata

Use ACPICA defined value for notification rather than locally defined one.


170143 31-May-2007 njl

Remove "acpi_bus_number: can't get _ADR" message. It usually appears as
we traverse \_SB and \ in the namespace, which won't have _ADR anyway.
Use a proper extern instead of our own private copy.

MFC after: 1 week


169973 25-May-2007 njl

Add a sysctl, 'debug.acpi.suspend_bounce', that causes the system to bounce
back in a simulated resume instead of entering the requested suspend state.
This helps in testing drivers separately from the acpi suspend code. To
test your drivers, set debug.acpi.suspend_bounce=1 and then run
acpiconf -s3 (or 4).

MFC after: 1 day


169592 16-May-2007 njl

Fix a logic bug added in last commit where PNP0103 devices would no longer
be probed but table-based devs would be ok. General style cleanup also.

MFC after: 5 days


169574 15-May-2007 takawata

Add ACPI HPET table support.

Reviewed by:njl


169377 08-May-2007 marks

Set the debug.acpi.acpi_ca_version sysctl even if ACPI support is not
available.


169221 02-May-2007 jhb

Revamp the MSI/MSI-X code a bit to achieve two main goals:
- Simplify the amount of work that has be done for each architecture by
pushing more of the truly MI code down into the PCI bus driver.
- Don't bind MSI-X indicies to IRQs so that we can allow a driver to map
multiple MSI-X messages into a single IRQ when handling a message
shortage.

The changes include:
- Add a new pcib_if method: PCIB_MAP_MSI() which is called by the PCI bus
to calculate the address and data values for a given MSI/MSI-X IRQ.
The x86 nexus drivers map this into a call to a new 'msi_map()' function
in msi.c that does the mapping.
- Retire the pcib_if method PCIB_REMAP_MSIX() and remove the 'index'
parameter from PCIB_ALLOC_MSIX(). MD code no longer has any knowledge
of the MSI-X index for a given MSI-X IRQ.
- The PCI bus driver now stores more MSI-X state in a child's ivars.
Specifically, it now stores an array of IRQs (called "message vectors" in
the code) that have associated address and data values, and a small
virtual version of the MSI-X table that specifies the message vector
that a given MSI-X table entry uses. Sparse mappings are permitted in
the virtual table.
- The PCI bus driver now configures the MSI and MSI-X address/data
registers directly via custom bus_setup_intr() and bus_teardown_intr()
methods. pci_setup_intr() invokes PCIB_MAP_MSI() to determine the
address and data values for a given message as needed. The MD code
no longer has to call back down into the PCI bus code to set these
values from the nexus' bus_setup_intr() handler.
- The PCI bus code provides a callout (pci_remap_msi_irq()) that the MD
code can call to force the PCI bus to re-invoke PCIB_MAP_MSI() to get
new values of the address and data fields for a given IRQ. The x86
MSI code uses this when an MSI IRQ is moved to a different CPU, requiring
a new value of the 'address' field.
- The x86 MSI psuedo-driver loses a lot of code, and in fact the separate
MSI/MSI-X pseudo-PICs are collapsed down into a single MSI PIC driver
since the only remaining diff between the two is a substring in a
bootverbose printf.
- The PCI bus driver will now restore MSI-X state (including programming
entries in the MSI-X table) on device resume.
- The interface for pci_remap_msix() has changed. Instead of accepting
indices for the allocated vectors, it accepts a mini-virtual table
(with a new length parameter). This table is an array of u_ints, where
each value specifies which allocated message vector to use for the
corresponding MSI-X message. A vector of 0 forces a message to not
have an associated IRQ. The device may choose to only use some of the
IRQs assigned, in which case the unused IRQs must be at the "end" and
will be released back to the system. This allows a driver to use the
same remap table for different shortage values. For example, if a driver
wants 4 messages, it can use the same remap table (which only uses the
first two messages) for the cases when it only gets 2 or 3 messages and
in the latter case the PCI bus will release the 3rd IRQ back to the
system.

MFC after: 1 month


169039 25-Apr-2007 jhb

Use a tighter check to see if a resource allocation request is for a
specific request and thus should first try to be allocated from the
sys_resource pool. This avoids using the sys_resource pool for wildcard
requests that have bounded ranges coming from cbb(4) and Host-PCI pcib(4)
drivers.

Tested by: Andrea Bittau <a.bittau of cs.ucl.ac.uk fame>
Sleuthing by: Andrea Bittau as well


168191 31-Mar-2007 jhb

Optimize sx locks to use simple atomic operations for the common cases of
obtaining and releasing shared and exclusive locks. The algorithms for
manipulating the lock cookie are very similar to that rwlocks. This patch
also adds support for exclusive locks using the same algorithm as mutexes.

A new sx_init_flags() function has been added so that optional flags can be
specified to alter a given locks behavior. The flags include SX_DUPOK,
SX_NOWITNESS, SX_NOPROFILE, and SX_QUITE which are all identical in nature
to the similar flags for mutexes.

Adaptive spinning on select locks may be enabled by enabling the
ADAPTIVE_SX kernel option. Only locks initialized with the SX_ADAPTIVESPIN
flag via sx_init_flags() will adaptively spin.

The common cases for sx_slock(), sx_sunlock(), sx_xlock(), and sx_xunlock()
are now performed inline in non-debug kernels. As a result, <sys/sx.h> now
requires <sys/lock.h> to be included prior to <sys/sx.h>.

The new kernel option SX_NOINLINE can be used to disable the aforementioned
inlining in non-debug kernels.

The size of struct sx has changed, so the kernel ABI is probably greatly
disturbed.

MFC after: 1 month
Submitted by: attilio
Tested by: kris, pjd


168010 28-Mar-2007 njl

Re-enable the HPET timer after a resume.

Submitted by: Andrea Bittau <a.bittau@cs.ucl.ac.uk>
MFC after: 3 days


167918 26-Mar-2007 jkim

- Use '*h' instead of 'struct acpi_spinlock' for sizeof[1].
- Add a missing 'else' for 'if'[2].

Requested by: njl[1]
Submitted by: njl[2]


167915 26-Mar-2007 jkim

Correct ACPI semaphore function parameters.


167911 26-Mar-2007 jkim

Free the handle, not the lock. Pointy hat to me.


167910 26-Mar-2007 jkim

Correct ACPI spinlock function parameters and use known ACPI spinlock names.


167908 26-Mar-2007 njl

Use a unique name for each mutex now that acpi-ca is creating more than
one (hardware & global lock). This should address witness complaints that
a duplicate mutex is being acquired. Be sure to free the mutex to fix a
potential memory leak.

MFC after: 3 days


167814 22-Mar-2007 jkim

Catch up with ACPI-CA 20070320 import.


167768 21-Mar-2007 jhb

Change acpi's handling of suballocating system resources to be a little
simpler. It now can just use rman_is_region_manager() during
acpi_release_resource() to see if the the resource is suballocated from
a system resource. Also, the driver no longer needs MD knowledge about
how to setup bus space tags and handles when doing a suballocation, but
can simply rely on bus_activate_resource() in the parent setting all that
up.


167742 20-Mar-2007 jhb

Tweak the probe/attach order of devices on the x86 nexus devices.
Various BIOS-related psuedo-devices are added at an order of 5. acpi0 is
added at an order of 10, and legacy0 is added at an order of 11.


167730 20-Mar-2007 njl

If we got an OBE/IBF event, we failed to re-enable the GPE. This would
cause the EC to stop handling future events because the GPE stayed masked.
Set a flag when queueing a GPE handler since it will ultimately re-enable
the GPE. In all other cases, re-enable it ourselves. I reworked the
patch from the submitter.

Submitted by: Rong-en Fan <grafan@gmail.com>


167671 18-Mar-2007 njl

Disable burst mode by default. Testing has shown that while it works on
most systems, it causes the EC not to respond for some Acer and Compaq/HP
laptops. This is the default value for Linux also. For systems that need
it, burst mode can be enabled via the tunable/sysctl:
debug.acpi.ec.burst="1"


167573 14-Mar-2007 njl

Only enter the debugger on a Fatal op if this is a debug build of the
acpi module. Also clean up print of args a little.

This was accidentally committed as 1.9.2.3 in the stable branch. Since it
is harmless, I will let the "insta-MFC" stand unless there is a problem.


167249 05-Mar-2007 njl

Check the _TMP value for sanity also. On some systems (HP NX laptops), the
EC occasionally times out and provides bogus values (3000C). This change
prevents those systems from prematurely shutting down while we work on the
underlying problem. Also, bump the sanity value to 0...200C from 0...150C.


167044 27-Feb-2007 njl

Rework EC I/O approach. Implement burst mode, including proper handling of
case where it asynchronously exits burst mode on its own. Handle different
values of hz in sleep loop. Provide more debugging options to tune EC
behavior. These tunables/sysctls may be temporary and are not for user
access if the EC is working properly. Burst mode is now on by default for
testing and the poll interval has been increased from 100 to 500 us and
total timeout from 100 to 500 ms.

Hopefully this should be the first step of addressing reports of timeout
errors during battery or thermal access, especially on HP/Compaq laptops.
It is reasonably stable and should not cause a loss of functionality or
performance on systems that were previously working. Testing shows an
increase of responsiveness by ~75% on one system.

PR: kern/98171


166909 23-Feb-2007 jhb

Use 'pause' in several places rather than trying to tsleep() on NULL (which
triggers a KASSERT) or local variables. In the case of kern_ndis, the
tsleep() actually used a common sleep address (curproc) making it
susceptible to a premature wakeup.


166901 23-Feb-2007 piso

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


166881 22-Feb-2007 njl

Improve readability of the version string.


166184 23-Jan-2007 njl

Add missing function trace for debug prints.


166176 22-Jan-2007 jhb

Expand the MSI/MSI-X API to address some deficiencies in the MSI-X support.
- First off, device drivers really do need to know if they are allocating
MSI or MSI-X messages. MSI requires allocating powerof2() messages for
example where MSI-X does not. To address this, split out the MSI-X
support from pci_msi_count() and pci_alloc_msi() into new driver-visible
functions pci_msix_count() and pci_alloc_msix(). As a result,
pci_msi_count() now just returns a count of the max supported MSI
messages for the device, and pci_alloc_msi() only tries to allocate MSI
messages. To get a count of the max supported MSI-X messages, use
pci_msix_count(). To allocate MSI-X messages, use pci_alloc_msix().
pci_release_msi() still handles both MSI and MSI-X messages, however.
As a result of this change, drivers using the existing API will only
use MSI messages and will no longer try to use MSI-X messages.
- Because MSI-X allows for each message to have its own data and address
values (and thus does not require all of the messages to have their
MD vectors allocated as a group), some devices allow for "sparse" use
of MSI-X message slots. For example, if a device supports 8 messages
but the OS is only able to allocate 2 messages, the device may make the
best use of 2 IRQs if it enables the messages at slots 1 and 4 rather
than default of using the first N slots (or indicies) at 1 and 2. To
support this, add a new pci_remap_msix() function that a driver may call
after a successful pci_alloc_msix() (but before allocating any of the
SYS_RES_IRQ resources) to allow the allocated IRQ resources to be
assigned to different message indices. For example, from the earlier
example, after pci_alloc_msix() returned a value of 2, the driver would
call pci_remap_msix() passing in array of integers { 1, 4 } as the
new message indices to use. The rid's for the SYS_RES_IRQ resources
will always match the message indices. Thus, after the call to
pci_remap_msix() the driver would be able to access the first message
in slot 1 at SYS_RES_IRQ rid 1, and the second message at slot 4 at
SYS_RES_IRQ rid 4. Note that the message slots/indices are 1-based
rather than 0-based so that they will always correspond to the rid
values (SYS_RES_IRQ rid 0 is reserved for the legacy INTx interrupt).
To support this API, a new PCIB_REMAP_MSIX() method was added to the
pcib interface to change the message index for a single IRQ.

Tested by: scottl


166027 15-Jan-2007 njl

Clean up some debug prints from last commit and move one under boot -v.
Reminded by: bruno


165882 08-Jan-2007 njl

Fix LINT and ACPI_DEBUG builds and add print for use of flush cache inst.


165875 07-Jan-2007 njl

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


165457 22-Dec-2006 imp

ACPIIO_BATT_GET_UNITS would always return ENXIO. However, it should never
return an error since it returns a count of battery devices in the system.
Set it to 0 explicitly, since it is the only switch branch that doesn't set
it.

# I guess no one uses it.


165128 12-Dec-2006 jhb

Give Host-PCI bridge drivers their own pcib_alloc_msi() and
pcib_alloc_msix() methods instead of using the method from the generic
PCI-PCI bridge driver as the PCI-PCI methods will be gaining some PCI-PCI
specific logic soon.


164264 13-Nov-2006 jhb

First cut at MI support for PCI Message Signalled Interrupts (MSI):
- Add 3 new functions to the pci_if interface along with suitable wrappers
to provide the device driver visible API:
- pci_alloc_msi(dev, int *count) backed by PCI_ALLOC_MSI(). '*count'
here is an in and out parameter. The driver stores the desired number
of messages in '*count' before calling the function. On success,
'*count' holds the number of messages allocated to the device. Also on
success, the driver can access the messages as SYS_RES_IRQ resources
starting at rid 1. Note that the legacy INTx interrupt resource will
not be available when using MSI. Note that this function will allocate
either MSI or MSI-X messages depending on the devices capabilities and
the 'hw.pci.enable_msix' and 'hw.pci.enable_msi' tunables. Also note
that the driver should activate the memory resource that holds the
MSI-X table and pending bit array (PBA) before calling this function
if the device supports MSI-X.
- pci_release_msi(dev) backed by PCI_RELEASE_MSI(). This function
releases the messages allocated for this device. All of the
SYS_RES_IRQ resources need to be released for this function to succeed.
- pci_msi_count(dev) backed by PCI_MSI_COUNT(). This function returns
the maximum number of MSI or MSI-X messages supported by this device.
MSI-X is preferred if present, but this function will honor the
'hw.pci.enable_msix' and 'hw.pci.enable_msi' tunables. This function
should return the largest value that pci_alloc_msi() can return
(assuming the MD code is able to allocate sufficient backing resources
for all of the messages).
- Add default implementations for these 3 methods to the pci_driver generic
PCI bus driver. (The various other PCI bus drivers such as for ACPI and
OFW will inherit these default implementations.) This default
implementation depends on 4 new pcib_if methods that bubble up through
the PCI bridges to the MD code to allocate IRQ values and perform any
needed MD setup code needed:
- PCIB_ALLOC_MSI() attempts to allocate a group of MSI messages.
- PCIB_RELEASE_MSI() releases a group of MSI messages.
- PCIB_ALLOC_MSIX() attempts to allocate a single MSI-X message.
- PCIB_RELEASE_MSIX() releases a single MSI-X message.
- Add default implementations for these 4 methods that just pass the
request up to the parent bus's parent bridge driver and use the
default implementation in the various MI PCI bridge drivers.
- Add MI functions for use by MD code when managing MSI and MSI-X
interrupts:
- pci_enable_msi(dev, address, data) programs the MSI capability address
and data registers for a group of MSI messages
- pci_enable_msix(dev, index, address, data) initializes a single MSI-X
message in the MSI-X table
- pci_mask_msix(dev, index) masks a single MSI-X message
- pci_unmask_msix(dev, index) unmasks a single MSI-X message
- pci_pending_msix(dev, index) returns true if the specified MSI-X
message is currently pending
- Save the MSI capability address and data registers in the pci_cfgreg
block in a PCI devices ivars and restore the values when a device is
resumed. Note that the MSI-X table is not currently restored during
resume.
- Add constants for MSI-X register offsets and fields.
- Record interesting data about any MSI-X capability blocks we come
across in the pci_cfgreg block in the ivars for PCI devices.

Tested on: em (i386, MSI), bce (amd64/i386, MSI), mpt (amd64, MSI-X)
Reviewed by: scottl, grehan, jfv
MFC after: 2 months


164128 09-Nov-2006 jhb

Reformat the bootverbose messages that dump out the status of pci_link
devices during attach to be more compact.

MFC after: 1 week


162597 24-Sep-2006 hrs

Disable an overly-verbose warning message by default.

Suggested by: njl
MFC after: 3 days


162531 21-Sep-2006 jhb

Fix a sign bug in acpi_release_resource(). acpi_sysres_find() returns !=
NULL if the specified resource is a sub-alloc of a system resource.


162225 11-Sep-2006 jhb

Give the ACPI I/O rman's unique description strings to make 'devinfo -u'
output less confusing.

MFC after: 3 days


161951 03-Sep-2006 ume

Support Celsius (nn.nC), Fahrenheit (nn.nF) and Kelvin (nnnn) to
specify temperature.

Reviewed by: njl
MFC after: 3 days


161223 11-Aug-2006 jhb

First pass at allowing memory to be mapped using cache modes other than
WB (write-back) on x86 via control bits in PTEs and PDEs (including making
use of the PAT MSR). Changes include:
- A new pmap_mapdev_attr() function for amd64 and i386 which takes an
additional parameter (relative to pmap_mapdev()) specifying the cache
mode for this mapping. Note that on amd64 only WB mappings are done with
the direct map, all other modes result in a private mapping.
- pmap_mapdev() on i386 and amd64 now defaults to using UC (uncached)
mappings rather than WB. Previously we relied on the BIOS setting up
MTRR's to enforce memio regions being treated as UC. This might make
hw.cbb_start_memory unnecessary in some cases now for example.
- A new pmap_mapbios()/pmap_unmapbios() API has been added to allow places
that used pmap_mapdev() to map non-device memory (such as ACPI tables)
to do so using WB as before.
- A new pmap_change_attr() function for amd64 and i386 that changes the
caching mode for a range of KVA.

Reviewed by: alc


161211 11-Aug-2006 des

Raise the quality of the HPET timer to 2000 so it will be the preferred
choice on systems which support it.

No objection by: phk


161184 10-Aug-2006 bruno

Improve the way we'll detect video devices as per ACPI 3.0.

PR: 100271
Requested by: john AT utzweb DOT net
Submitted by: hrs
Reviewed by: njl
Approved by: njl
MFC after: 3 days


161065 08-Aug-2006 njl

Remove the global dock variable. Each dock device should be able to
function independently. This change is not only load-tested since I don't
have hardware that supports acpi_dock. Clean up comments and a name a
few constants.


161051 07-Aug-2006 jhb

When a user uses a hint to specify the IRQ for a link device, accept IRQs
that aren't listed as valid in the link device's set of possible IRQs.
This allows the hints to be used to work around broken BIOSes that don't
specify the correct ste of possible IRQs. A warning is issued in the
dmesg in this case to be consistent with the $PIR handling code.

MFC after: 1 week


160824 29-Jul-2006 njl

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


160657 25-Jul-2006 njl

Add support for overriding the values for _CRT, _HOT, and _PSV via sysctl.
Prevent casual modification by requiring hw.acpi.thermal.user_override to
be set first. Fix printing of negative temperatures in the K->C conversion.
Document the remaining thermal sysctls.

MFC after: 3 days


160381 15-Jul-2006 bruno

Eliminate duplicate p-states entries

Reported and tested by: ales dot rom at kabelnet dot net
Reviewed by: njl
Approved by: njl, imp (mentor)
MFC after: 3 days


159855 22-Jun-2006 njl

Clean up style and some printf messages. Note that returning anything other
than 0 for probe seems to cause a panic somewhere in sysctl kern.


159543 12-Jun-2006 njl

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


159524 11-Jun-2006 njl

By default, don't disable ACPI during reboot. This appears to hang some
systems. Introduce a new sysctl "hw.acpi.disable_on_reboot" that allows
users to re-enable the old behavior in case it's needed for some systems.
We never disable in the power-off path.

Original approach submitted by Alexander Logvinov <abuse@akavia.ru> with
reworking by Jung-uk Kim and myself.


159476 10-Jun-2006 njl

Minor sysctl cleanup. The RW flag means read|write and so it is redundant
to add the RD flag. Also, the debug node does not need to be writable.


159217 04-Jun-2006 njl

Clean up many of the debugging messages and move them under bootverbose.
Move the code for printing timer statistics into a test function instead of
an ifdef (accessible via the debug.acpi.hpet_test tunable). Also use defines
for register offsets instead of magic values.

Courtesy of: slow flight to HK


158651 16-May-2006 phk

Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.


158457 11-May-2006 jhb

Fixup some comments to allow for the fact that PCI domains are not specific
to Alpha hoses.


158346 07-May-2006 njl

Don't attach special devices in the order they appear in the AML tree.
If the embedded controller exists before the sysresource devices, for
example, it will be attached first. Instead, let the normal device
order function work as we first desired. [1]

There still remained a problem where we couldn't allocate resources in
acpi0 that were passed up by the sysresource pseudo-devices. These
devices had to probe/attach first to give their resources to acpi, then
acpi would allocate them before probing/attaching other devices. To
work around this, we attach them from acpi_sysres_alloc(). A better
approach would be to implement multi-pass probe/attach in newbus but
that's a much bigger task.

Suggested by: jhb [1]
Hardware from: Centaur Technologies
MFC after: 1 week


157947 21-Apr-2006 jkim

Remove unnecessary assignment.

Coverity ID: 553
Found by: Coverity Prevent


157897 20-Apr-2006 imp

Set the rid for the resoruce obtained from rman_reserve_resource.


157792 16-Apr-2006 maxim

o Correct a path to include.


157778 15-Apr-2006 iwasaki

Oops, untested code was included accidentally.
Fixed.


157774 15-Apr-2006 iwasaki

Import ACPI Dock Station support. Note that this is still very young.
Additional detach implementaions (or maybe improvement) for other
deivce drivers is required.

Reviewed by: njl, imp
MFC after: 1 week


157452 04-Apr-2006 njl

Fix an off-by-one error in the port range detection. Cleanup some old
whitespace.


157307 30-Mar-2006 scottl

Revert to using acpi_max_threads instead of the hardcoded value of '3'.


157269 29-Mar-2006 njl

Fix printf arg on 64-bit arch by casting to an int. The IO port is never
more than a couple digits anyway.

Pointy hat to: njl


157245 29-Mar-2006 njl

Add a blacklist for bad IO ports that AML should never touch. It seems
some systems were designed so that AML writes to various resources shared
with OS drivers, including the RTC, PIC, PCI, etc. These writes could
collide with writes by the OS and should never be performed. For now, we
print a message if such an access occurs, but do not block it. To block
the access, the tunable "debug.acpi.block_bad_io" can be set to 1. In the
future, we will flip the switch and this will become the default.

Information about this problem was found in Microsoft KB 283649. They
block IO accesses if the BIOS indicates via _OSI that it is Windows 2001
or higher. They always block accesses to the PIC, cascaded PIC, and ELCRs,
no matter how old the BIOS.


157244 29-Mar-2006 njl

Add reset register support. This is the only method to reboot some new
systems (blade servers). On most systems, this is implemented as an IO
write to the SMI port and the BIOS generates the actual reset.

PR: kern/94939
Submitted by: dodell@ixsystems.com
Reviewed by: jhb
MFC after: 3 weeks


155869 21-Feb-2006 njl

Remove unused variable.

Coverity ID: 548
Found by: Coverity Prevent


155868 21-Feb-2006 njl

Remove unused variable.

Coverity ID: 546
Found by: Coverity Prevent


154600 20-Jan-2006 jhb

Make the ACPI and OpenFirmware PCI bus drivers subclasses of the generic
PCI bus driver.


154333 14-Jan-2006 scottl

Add the following to the taskqueue api:

taskqueue_start_threads(struct taskqueue **, int count, int pri,
const char *name, ...);

This allows the creation of 1 or more threads that will service a single
taskqueue. Also rework the taskqueue_create() API to remove the API change
that was introduced a while back. Creating a taskqueue doesn't rely on
the presence of a process structure, and the proc mechanics are much better
encapsulated in taskqueue_start_threads(). Also clean up the
taskqueue_terminate() and taskqueue_free() functions to safely drain
pending tasks and remove all associated threads.

The TASKQUEUE_DEFINE and TASKQUEUE_DEFINE_THREAD macros have been changed
to use the new API, but drivers compiled against the old definitions will
still work. Thus, recompiling drivers is not a strict requirement.


154273 12-Jan-2006 bruno

* fix bst.status. We mark some bits, but forgot to reset all of them
before. The symptom is that the battery inform us its charge and discharge
at the same time...

* fix bst.rate to correctly output the (dis)charging rate. We'll use
the current average over one minute command and not the at_rate command.
Note that this method is not correct if the capacity_mode is set, but
since we don't set it ourself, it is not a problem.

The at_rate do not give the actual rate but is used to compute the
estimated time for (dis)charging a battery. We should actually
write an estimation of the actual rate using at_rate cmd and then
perform a read to the various estimators.

Approved by: njl
MFC after: 2 days


154079 06-Jan-2006 jhb

- Make pcib_devclass private to sys/dev/pci/pci_pci.c and change all the
various pcib drivers to use their own private devclass_t variables for
their modules.
- Use the DEFINE_CLASS_0() macro to declare drivers for the various pcib
drivers while I'm here.


154071 06-Jan-2006 jhb

Be a little more forgiving of lame BIOS writers. If a link device that
doesn't have any actual interrupts is listed in a _PRT entry, only print
a warning rather than panic'ing when we walk the _PRT's to build up count
of entries that reference a given link (the counts are used as weights so
that we can attempt to balance the load across IRQs used by link devices).
Instead, only panic if we attempt to use the _PRT entry to route an
interrupt for a device.

PR: i386/89545
Tested by: anders


153994 03-Jan-2006 jhb

Release the pci_link acpi serial lock if a link device has no actual links.

MFC after: 3 days


153706 24-Dec-2005 trhodes

Make tv_sec a time_t on all platforms but alpha. Brings us more in line with
POSIX. This also makes the struct correct we ever implement an i386-time64
architecture. Not that we need too.

Reviewed by: imp, brooks
Approved by: njl (acpica), des (no objects, touches procfs)
Tested with: make universe


153578 20-Dec-2005 jhb

Attach to the vgapci device rather than pci.


153560 20-Dec-2005 jhb

Add a new method PCI_FIND_EXTCAP() to the pci bus interface that is used
to search for a specific extended capability. If the specified capability
is found for the given device, then the function returns success and
optionally returns the offset of that capability. If the capability is
not found, the function returns an error.


153336 12-Dec-2005 bruno

Don't flood kernel logs with "invalid _PSS package" messages.

Approved by: njl, imp (mentor)


153172 06-Dec-2005 njl

Revert two changes I was testing regarding polling delay.


153171 06-Dec-2005 njl

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


153122 05-Dec-2005 jhb

If pci_link has been disabled via the acpi_disable tunable, then bail
immediately from acpi_pci_link_route_interrupt() since we aren't going
to have a valid pci_link device to talk to try to route interrupts. This
fixes a page fault if you disable just pci_link. Note that trying to use
ACPI without pci_link is probably not advised however.

MFC after: 1 week
Tested by: Eugene Grosbein eugen at kuzbass dot ru


153066 03-Dec-2005 jhb

Force any hardwire-routed interrupts to level trigger and active low
polarity. Some machines route PCI IRQs to an ISA IRQ but fail to include
an interrupt override entry to set the polarity and trigger of the given
ISA IRQ in their MADT table.

PR: usb/74989
Reported by: Julien Gabel jpeg at thilelli dot net
MFC after: 1 week


153016 02-Dec-2005 jhb

Add a missing newline to a printf.

MFC after: 1 week


152818 26-Nov-2005 njl

Add a locking stub to call acpi_cmbat_get_bif() now that it is directly
run from the taskqueue. There should probably be a better way to do this
later, but this suffices for now.

Submitted by: yongari


152744 24-Nov-2005 njl

Only copy out the battery status/info if there was no error.


152719 23-Nov-2005 jhb

- Quiet the pci_link(4) devices so that they don't show up in dmesg now.
- Improve panic message if we fail to read the PCI bus number from a bridge
device.
- Don't try to lookup a BIOS IRQ for a link unless the link is routed via
an ISA IRQ since BIOSen currently only route PCI link devices via ISA
IRQs.

Tested by: Mathieu Prevot bsdhack at club-internet dot fr
MFC after: 1 week


152705 23-Nov-2005 njl

Try to fix problems with periodic hangs by never directly calling _BIF.
Instead, re-evaluate _BIF only when we get a notify and use the cached
results. We also still evaluate _BIF once on boot. Also, optimize the
init loop a little by only querying for a particular info if it's not valid.

MFC after: 2 days


152703 23-Nov-2005 njl

Simplify checks for valid battery info via DeMorgan's Rule. No
functional change.


152677 22-Nov-2005 ume

Cache the result of battery info retrieval from smbat as well
as cmbat.

Reviewed by: njl
MFC after: 3 days


152667 21-Nov-2005 jhb

Fix the code to look up the BIOS IRQ for a given link device by reading
the IRQ set by the BIOS in existing devices to actually get the correct
bus number of the child PCI bus. I was not reading the bus number from
the bridge device correctly. The __BUS_ACCESSOR() macros (from which
pcib_get_bus() is built) assume that the passed in argument is a child
device. However, at the time I'm reading the bus there is no child
device yet, so I was passing in the pcib device as the child device.
The parent of the pcib device probably returned an error in the case of
a host bridge, thus resulting in random stack garbage for the bus number.
For PCI-PCI bridges, the bus number being used was actually the subvendor
of the PCI-PCI bridge device itself.

MFC after: 1 week


152171 07-Nov-2005 jhb

*sigh* Revert stuff that wasn't supposed to be committed. The
acpi_resource change was a minor nit offered as an early candidate for
the recent ACPICA import problem and the acpi.c change is one I need to
test still that makes the ordered probing of system devices actually work
as advertised (probe devices in order based on the type of device rather
than in the order we encounter them in the device tree).


152170 07-Nov-2005 jhb

Work around at least one busted BIOS. If we get a source index in a _PRT
entry that is not zero, assume that it is really a hard-wired IRQ (commonly
used for APIC routing) and not a source index. In practice, we've only
ever seen source indices of 0 for legitimate non-hard-wired _PRT entries.

Reviewed by: njl
Tested by: Alex Lyashkov shadow at psoft dot net
MFC after: 2 weeks


151948 01-Nov-2005 jkim

Catch up with ACPI-CA 20051021 import


151935 01-Nov-2005 scottl

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


151931 01-Nov-2005 scottl

Add proper debugging infrastructure for acpi_hpet.c.


151912 31-Oct-2005 phk

Add a basic HPET timecounter.

It has -200 quality for now so it will not get automatically selected.


151897 31-Oct-2005 rwatson

Normalize a significant number of kernel malloc type names:

- Prefer '_' to ' ', as it results in more easily parsed results in
memory monitoring tools such as vmstat.

- Remove punctuation that is incompatible with using memory type names
as file names, such as '/' characters.

- Disambiguate some collisions by adding subsystem prefixes to some
memory types.

- Generally prefer lower case to upper case.

- If the same type is defined in multiple architecture directories,
attempt to use the same name in additional cases.

Not all instances were caught in this change, so more work is required to
finish this conversion. Similar changes are required for UMA zone names.


151678 25-Oct-2005 njl

If we're trying to use C2/3 and reads from the register are returning
immediately, back off to the next higher Cx sleep state. Some machines
with a Via chipset report a valid C3 but a register read doesn't actually
halt the CPU. This would cause the machine to appear unresponsive as it
repeatedly called cpu_idle() which immediately returned. Causing interrupts
(i.e. by pressing the power button) would cause the system to make forward
progress, showing that it wasn't actually hung.

Also, enable interrupts a little earlier. We don't need them disabled
to calculate the delta time for the read.

Reported by: silby
MFC after: 2 weeks


151627 24-Oct-2005 njl

Invert the check logic. No functional change, but I prefer this version.


151610 24-Oct-2005 njl

If no AC line devices are found, go ahead and notify devd that the system
is on AC power (i.e. not a laptop). This allows power_profile to run once
for desktop systems as well, for instance, to set C3 or CPU frequency.

MFC after: 2 weeks


151591 23-Oct-2005 njl

Add prototype to be consistent.


151566 23-Oct-2005 njl

Add a hack to get around PCI link devices that report "present" but not
"functional" (i.e., if they are disabled). We should probe them anyway
since we may enable them later.

Tested by: thompsa
MFC after: 3 days


151564 23-Oct-2005 njl

Import ACPI smart battery support. Newer systems (Acer, mostly) do not
support the CM-battery interface. Smart batteries can eventually be
supported without ACPI via a separate SMBus interface. The ACPI interface
uses the embedded controller for reading/writing to the SMBus, and normal
ASL definitions for locating the battery controller (since SMBus can't be
enumerated.) Also import definitions for the smart battery interface.

This was written by Hans Petter Selasky with minor cleanups from myself.

Submitted by: Hans Petter Selasky <hselasky / c2i.net>


151563 23-Oct-2005 njl

Cleanups and support code for importing smart battery support.

* Use ACPI_BATT_UNKNOWN instead of constants
* Use maxunit instead of a count of devices since we may have sparse
battery devices in the future. Only userland should be using unit
numbers anyway, so provide a translation function. (Kernel use of
batteries should be restricted to looking up a device_t and calling
methods directly.
* Don't check acpi_BatteryIsPresent() in acpi_battery. Leave it up to
the hardware-specific driver (i.e. cmbat) since smart batteries seem
to not report the "battery present" flag.
* Convert mA to mW if the battery uses those units. CM-batteries only
used mW so this deficiency went unnoticed.
* Clean strings reported in the battery info from any control chars.
* Only dereference the unit from ioctl_arg if the full struct is present.
Unit wouldn't have been used later if it wasn't present but this is
cleaner. Translate the unit if it's not ACPI_BATTERY_ALL_UNITS.
* bzero structs before returning them to usermode for future compat.

Most of this work was submitted by Hans Petter Selasky and then majorly
reworked by myself.

Submitted by: Hans Petter Selasky <hselasky / c2i.net>


150203 16-Sep-2005 imp

Commit a workaround to a problem with resource allocation. This helps
with some Dell servers that booted w/o a problem[*] on 5.4, but failed
with 6.0-BETA.

On the PCI bus, when we do lazy resource allocation, we narrow the
range requested as we pass through bridges to reflect how the bridges
are programmed and what addresses they pass. However, when we're
doing an allocation on a bus that's directly connected to a host
bridge, no such translation can take place. We already had a fallback
range for memory requests, but none for ioports. As such, provide a
fallback for I/O ports so we don't allocate location 0, which will
have undesired side effects when the resources are actually used.

This fixes a problem with booting a Dell server with usb in the
kernel. However, it is an unsatisfying solution. I don't like the
hard coded value, and I think we should start narrowing the resources
returned to not be in the so-called isa alias area (where the ranage &
0x0300 must be 0 iirc). Doing such filtering will have to wait for
another day.

This may be a good 6 candidate, maybe after its had a chance to be
refined.

Tested by: glebius@


150003 11-Sep-2005 obrien

Canonize the include of acpi.h.


149482 26-Aug-2005 kan

Unbreak compiles with ACPI_DEBUG.


149450 25-Aug-2005 ume

get current temperature from _TMP during passive cooling is active.
it makes CPU freq transition smooth.


149449 25-Aug-2005 ume

initialize only ACPI_BUFFER to avoid race condition with passive
cooling thread which refers psv, tc1, tc2 and tsp. The previous
code made the period where sc->tz_zone.tsp was zero, and it caused
panic at msleep().

Reported by: keramida
Tested by: keramida


149201 17-Aug-2005 ume

don't raise cpu speed over the value when passive cooling is in
effect. since CPU speed is restored by degrees, we cannot use
the facility of saving cpu speed by CPUFREQ_set() effectively.
so, we need to save the value when passive cooling is in effect.

Repoeted by: Kevin Oberman <oberman__at__es.net>


148968 11-Aug-2005 njl

Modify the fix in rev 1.16 slightly. Instead of setting the cap to zero,
just skip summing it if it's unknown.

MFC after: 1 day


148742 05-Aug-2005 njl

When summing capacities, skip info from batteries that weren't present.
Previously, we used all info (including -1 or "not present") which would
keep the system from reaching 100% when charging.

Reported by: Eric Anderson
MFC after: 2 days


148703 04-Aug-2005 ume

don't do mutex locking around kthread_create() call.

Reported by: Maxim Maximov <mcsi__at__mcsi.pp.ru>


148492 28-Jul-2005 njl

Add descriptions for the sysctls.

MFC after: 1 day


148489 28-Jul-2005 njl

Zero the _BST, _BIF, and battinfo allocations. This is needed since we
later sum capacities for all batteries, even those that weren't actually
present. We only need to do this for _BST but do it for all of them.

Reported by: Eric Anderson
MFC after: 1 day


148449 27-Jul-2005 jhb

Correct the order of some if tests so that we don't complain about being
unable to route an IRQ when we do route an IRQ ok but bootverbose is off.

Reported by: Ben Kaduk minimarmot at gmail dot com


148400 25-Jul-2005 njl

Correct minor output bug. When the battery being queried is charging or
the overall discharge rate is 0, mark the battery remaining time as
"unknown", not 0.

Reported by: Eric Kjeldergaard
MFC after: 4 days


148352 23-Jul-2005 njl

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


148318 22-Jul-2005 njl

Standardize __FBSDID identifiers.

MFC after: 2 days


148138 18-Jul-2005 ume

Implement passive cooling. It is enabled for tz0 by default where
it is available.

Reviewed by: njl


147612 26-Jun-2005 dwmalone

Add a quirk for a motherboard whose acpi timer runs too fast.

Approved by: re (scottl)
Approved by: nate
MFC after: 2 weeks


146949 03-Jun-2005 imp

In newbus land, ivars can only be accessed for direct child, or when
the driver has unholy private knowledge of its great-*cgrandchildren.
The ACPI allocation routine lacked such knowledge when it tried to do
a default allocation for all descendants, rather than just its
immeidate children, so would access grandchild's ivar in an unsafe
way. This could lead to a panic when devices were present which had
no addresses setup by the BIOS, but which were later allocated in a
lazy manner via pci_alloc_map. As such, only do the default
allocation adjustments for immediate children. The manner that
acpi_sysres_find accesses the resource list, used later in
acpi_alloc_resource, is safe and proper so no additional test is
needed there.

This fixes a panic when probing an disabled ata controller on some
newer intel blades.

Reported by: dwhite


146734 29-May-2005 nyan

Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64. The optimization is a trivial on recent machines.

Reviewed by: -arch (imp, marcel, dfr)


146431 20-May-2005 njl

If devclass_get_devices() returns success but a count of 0, free the
pointer. If kernel malloc(0) returns a valid pointer, it needs to be
freed. If it returns NULL, it's ok to free this also.

Submitted by: pjd
Reviewed by: imp, dfr
Obtained from: Coverity Prevent


146373 19-May-2005 takawata

Use General definition for general notify.


146166 12-May-2005 njl

If there is a problem during probe, be sure to free up any resources
allocated for it. The normal exit case handles this correctly so we
use it as well for errors.

Submitted by: pjd
Obtained from: Coverity Prevent


146021 09-May-2005 marks

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


145352 21-Apr-2005 njl

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


145059 14-Apr-2005 marks

Use AcpiUtStrupr() instead of strupr() as the latter will disappear in
future versions of acpica.

MFC after: 2 weeks


145058 14-Apr-2005 jhb

Probe PCI link devices early so that we turn them all off via _DIS before
we start turning any of them back on again. This works around a bug in
some BIOSen that alias two different link devices for APIC vs ATPIC modes
onto the same physical hardware link.

Submitted by: njl
Tested by: Antoine Brodin antoine dot brodin at laposte dot net


144882 10-Apr-2005 njl

Set CPU speed to 100% in acpi_throttle attach. This is needed for some
systems that boot with this value at the lowest setting. Change the
default boot config back to "leave frequency as BIOS set it". Also, fix
buglet where acpi_throttle wouldn't be used if p4tcc was present but
disabled by the user.

MFC after: 1 week


144878 10-Apr-2005 njl

Advertise that we can handle unified SMP control of processor power
states, idling, etc. This has been supported since the cpufreq import.


144875 10-Apr-2005 njl

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.


144752 07-Apr-2005 njl

Revert part of 1.19. We do want to set the count to 0 since otherwise
it would give false info to other parts of the driver.


144684 05-Apr-2005 jhb

Don't free the _PSS buffer until after we check to see if we have no valid
states as otherwise we will try to free the buffer twice.


144629 04-Apr-2005 njl

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.


144414 31-Mar-2005 njl

Always free the returned env pointer even it doesn't indicate we're in
verbose mode.

Found by: Coverity Prevent (via sam)


144197 27-Mar-2005 njl

Clean up resources properly if acpi_perf fails to attach. First, change
acpi_bus_alloc_gas() to delete the resource it set if alloc fails. Then,
change acpi_perf to delete the resource after releasing it if alloc fails.
This should make probe and attach both fully restartable if either fails.


144193 27-Mar-2005 njl

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


144170 27-Mar-2005 njl

If a device_add_child fails (i.e. low memory situation), be sure to free
the unused ivars also.

Submitted by: pjd
Obtained from: Coverity Prevent analysis


144145 26-Mar-2005 njl

Check for invalid frequencies after parsing the package. Keep a running
count of valid frequencies and use that as the final package count, don't
give up when the first invalid state is found. Also, add 0x9999 and expand
our upper check to >= 0xffff Mhz [2].

Submitted by: Bruno Ducrot, Jung-uk Kim [2]


143997 22-Mar-2005 njl

Add support for bus_delete_resource() and make acpi_bus_alloc_gas() do
this before setting a new resource.


143865 20-Mar-2005 njl

Attach acpi_perf early. Especially when it is being used to provide info
to other devices, it needs to be attached first. (Multi-pass newbus
probes would be a better solution.)


143861 20-Mar-2005 njl

Add the acpi_ec_read and write methods. This allows an external driver
(like an EC/SMbus controller) to access the EC address space. Access
is synchronized by the EcLock/Unlock routines in EcSpaceHandler().

Tested by: Hans Petter Selasky


143801 18-Mar-2005 phk

s/SLIST/STAILQ/
/imp/a\
pointy hat
.


143771 17-Mar-2005 njl

Introduce a general name for the previously cmbat-only ioctls. It has the
same value as the previous ioctls so no binary change. Also, make a few
style changes to reduce diffs to my tree.

Loosely based on code from: Hans Petter Selasky


143301 08-Mar-2005 jhb

- If we fail to find an entry in the PRT, output a warning message.
- Fix a bug in the same condition where we forgot to drop the ACPI pcib
lock. This fixes hangs after the pcib0 attach on some machines.

Tested by: sos (2)


143135 04-Mar-2005 njl

On i386 platforms at least, ACPI throttling is accomplished by the chipset
modulating the STPCLK# pin based on the duty cycle. Since p4tcc uses the
same mechanism (but internal to the CPU), we triggered a hang on some
systems at low frequencies when both were in use. Now, disable
acpi_throttle when p4tcc is also present.

Tested by: Kevin Oberman


143119 04-Mar-2005 njl

Check for some impossible frequencies that some systems use to indicate
they don't actually support Px states.


143002 02-Mar-2005 obrien

Fix SCM ID's.


142984 02-Mar-2005 njl

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


142753 28-Feb-2005 njl

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


142625 27-Feb-2005 njl

Make a pass through all drivers checking specs for desired behavior on
SMP systems. It appears all drivers except ichss should attach to each
CPU and that settings should be performed on each CPU. Add comments about
this. Also, add a guard for p4tcc's identify method being called more than
once.


142587 26-Feb-2005 njl

Don't bother with cpufreq_register if we're info-only.

Suggested by: Jung-uk Kim


142516 25-Feb-2005 njl

Remove unused variable.

Noticed by: Coverity tool


142480 25-Feb-2005 njl

Instead of assuming units of bytes, it seems more likely that this is
a bitfield.


142278 23-Feb-2005 njl

If a register width is less than 8, assume the BIOS author thought it was
in units of bytes and adjust accordingly. This is found at least on the
Sony PCG-505BX.


142258 22-Feb-2005 jhb

Add a entry for the Compaq R3000Z to indicate that it has the weird MADT
IRQ 0 quirk.


142257 22-Feb-2005 jhb

- 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


142204 22-Feb-2005 njl

Increase the maximum to wait for a transition from 1 to 10 ms. In some
modes, systems may take longer. If the status values don't match, try
matching just the lowest 8 bits if no bits above 8 are set in the desired
value. The IBM R32 has other bits set in the status register that are
irrelevant to the expected value.


142203 22-Feb-2005 njl

Support disabling individual cpufreq drivers with hints, e.g.,
hint.ichss.0.disabled="1"


142195 22-Feb-2005 njl

Set the start of the cooling time later on, when we're actually performing
the switch. Other interim tests (i.e., for minimum runtime) could
invalidate the start time. This fixes transitions to cooler states in that
now they go to the next active state (_AC0 -> _AC1) instead of going
straight to off (_AC0 -> off).

Submitted by: Alexandre "Sunny" Kovalenko (Alex.Kovalenko / verizon.net)


142191 21-Feb-2005 njl

Since the GPE handler is directly called by ACPI-CA and it may have unknown
locks held, specify the ACPI_ISR flag to keep it from acquiring any more
mutexes (which could potentially sleep.) This should fix "could sleep"
warning messages on the following path:

msleep()
AcpiOsWaitSemaphore()
AcpiUtAcquireMutex()
AcpiDisableGpe()
EcGpeHandler()
AcpiEvGpeDispatch()
AcpiEvGpeDetect()
AcpiEvGpeDetect()
AcpiEvSciXruptHandler()


142073 19-Feb-2005 njl

Add a new field to struct cf_setting for special values. These are driver-
specific values that other components may want to use. Add support to
acpi_perf(4) to export the control and status values via this field.


142032 18-Feb-2005 njl

Introduce a new method, cpufreq_drv_type(), that returns the type of the
driver. This used to be handled by cpufreq_drv_settings() but it's
useful to get the type/flags separately from getting the settings.
(For example, you don't have to pass an array of cf_setting just to find
the driver type.)

Use this new method in our in-tree drivers to detect reliably if acpi_perf
is present and owns the hardware. This simplifies logic in drivers as well
as fixing a bug introduced in my last commit where too many drivers attached.


142024 17-Feb-2005 njl

Check for the address space type first before validating it. In particular,
we want to return EOPNOTSUPP for FFixedHW no matter what the address.

Submitted by: Bruno Ducrot


142003 17-Feb-2005 njl

The correct error value for not having enough storage is E2BIG, not
ENOMEM. The manpage and ichss(4) are correct.


141830 13-Feb-2005 njl

Allow users to manually override quirks with the tunable "debug.acpi.quirks".
Suggested by: Jung-uk Kim


141824 13-Feb-2005 njl

Add support for the CPUFREQ_FLAG_INFO_ONLY flag. Devices that report this
are not added to the list(s) of available settings. However, other drivers
can call the CPUFREQ_DRV_SETTINGS() method on those devices directly to
get info about available settings.

Update the acpi_perf(4) driver to use this flag in the presence of
"functional fixed hardware." Thus, future drivers like Powernow can
query acpi_perf for platform info but perform frequency transitions
themselves.


141780 13-Feb-2005 njl

Be sure to register with cpufreq(4). On systems that only supported
throttling, neglecting to do this kept the sysctls from appearing.
Attach an acpi_throttle device to each CPU that supports it.
Don't add a device if the P_BLK is invalid or if _PTC is not present.
This removes extraneous probe/attach failure messages on some machines.
Make the cpu throttle state local to the softc to account for partial
successes when changing the clock rate on MP machines.


141779 13-Feb-2005 njl

Attach an acpi_perf device for every processor that offers the right
methods.


141429 07-Feb-2005 njl

Remove handling _PSS notifies from acpi_cpu and let acpi_perf handle them.


141415 06-Feb-2005 njl

Remove acpi throttling support from the acpi_cpu(4) driver now that this
is supported by acpi_throttle(4).


141414 06-Feb-2005 njl

Break out acpi throttling support into a new relative cpufreq driver,
acpi_throttle(4).


141411 06-Feb-2005 njl

Notify the OS that we're taking over Px states in acpi_perf(4) instead of
doing it in the cpu driver. The previous code was incorrect anyway since
this value controls Px states, not throttling as the comment said. Since
we didn't support Px states before, there was no impact. Also, note that
we delay the write to SMI_CMD until after booting is complete since it
sometimes triggers a change in the frequency and we want to have all
drivers ready to detect/handle this.


141380 06-Feb-2005 njl

Staticize the legacy cpu devclasses and revert the name for the acpi_cpu
devclass. As pointed out by dfr@, devclasses don't have to share the same
linkage if multiple drivers have the same name. Newbus should match the
devclasses based on name and allocate non-conflicting unit numbers.


141373 05-Feb-2005 njl

Convert to the new GAS APIs to allow for detach in the future. Also, check
the PERF_CTRL register in our probe method so that we can tell earlier
that another driver should handle this device due to FFixedHW. This avoids
scaring users when attach failed when we really wanted probe to fail.


141372 05-Feb-2005 njl

Convert to the new GAS API so that we can free registers in the future.


141371 05-Feb-2005 njl

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.


141295 04-Feb-2005 njl

Don't print out a failure message when an attach for FFixedHW fails.
Instead, just fail to attach so another hardware-specific driver can
claim the device. Also, clean up some small memory leaks in the failure
case.


141294 04-Feb-2005 njl

Return a special status of "not supported" for functional fixed hardware
since this type of register should be handled by another driver.


141251 04-Feb-2005 njl

Make the devclass static for now until deciding whether to share them.


141242 04-Feb-2005 njl

Add the ACPI Performance states driver. This driver offers two or more
settings as exported via the ACPI _PSS method. OEMs use this interface
to encapsulate chipset or processor-specific methods (e.g., SpeedStep or
Powernow) and export their settings in a standard way. On systems that
have valid ACPI Performance states and a hardware-specific driver (e.g.,
ichss), acpi_perf(4) is preferred.


141238 04-Feb-2005 njl

Update the CPU attachments to return CPU_IVAR_PCPU as well as pass on
appropriate requests to any children.


140916 27-Jan-2005 njl

Consistently use pcib for a printf.


140449 18-Jan-2005 jhb

Don't create new-bus resources for ACPI extended IRQ resources that are
producers rather than consumers as new-bus resources only handle consumed
resources. We already do this for the other ACPI resource types that
support the producer/consumer attribute.


140447 18-Jan-2005 jhb

For the sake of consistency, look up link devices relative to the root
object (/) rather than the pci bus object when walking the _PRT to force
attach devices. We already look up relative to the root object when doing
interrupt routing.

Suggested by: njl


140446 18-Jan-2005 jhb

- Add support for link devices where _CRS just outright fails to execute.
For such devices, we require _PRS to exist and we warn if any of the
resources in _PRS are not IRQ resources (since we'll have no way of knowing
which of those resources to use without a working _CRS). When it does
come time to set resources, we build up a resource buffer from scratch
as we do for devices with _CRS that only have IRQ resources.
- Fix a bug with setting extended IRQ resources where we set the IRQ value
in the wrong resource structure meaning that whichever IRQ was listed in
_PRS was used instead. This might fix some weird issues on certain boxes
where IRQs > 16 don't seem to work when using ACPI.
- Fix a bug with how we walked the resource buffer after _SRS to call
config_intr() in that the 'end' variable was not properly updated, so we
could either terminate the loop early or loop after the end of the
buffer.

Tested by: pjd


139900 08-Jan-2005 njl

In total violation of at least 4 sections in the ACPI spec, some systems
place device objects in \ (in this case, PCI links.) Work around this by
starting our probe from \. To avoid attaching system scope objects,
explicitly skip them. (I think it's an ACPI-CA bug that \_SB and \_TZ have
device and thermal object types.) Thanks to pjd@ for testing.

MFC after: 2 weeks


139749 06-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


139340 27-Dec-2004 njl

Minor cleanup: Reduce stack usage in probe method. Outdent probe. Use
TRUE/FALSE instead of 1/0 for booleans. Remove trailing and extra whitespace.


139339 27-Dec-2004 njl

Remove trailing whitespace.


139065 20-Dec-2004 njl

Only use the current value if there's one IRQ. Some systems return
multiple IRQs (which is nonsense for _CRS) when the link hasn't been
programmed. Before, this was a KASSERT. A ServerWorks system was
seen returning IRQs of 0, 2 in response to _CRS before link setup.
Thanks to sam@ for quick testing and turnaround on this.

Tested by: sam


139057 20-Dec-2004 njl

Only report a critical battery level once until it's gone non-critical.
An improvement would be to check all batteries for critical state before
printing a message.

Reported by: Kevin Oberman (oberman at es net)


138825 13-Dec-2004 njl

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


138783 13-Dec-2004 njl

Re-enable link programming on resume. It appears the previous bounds
error had caused the hang and it has been corrected now.


138774 13-Dec-2004 scottl

Allow the acpi_ibm module to be built with ACPI_DEBUG.


138378 05-Dec-2004 njl

Grab Giant around calls to DEVICE_SUSPEND/RESUME in acpi_SetSleepState().
If we are resuming non-MPSAFE drivers, they need Giant held for them.
This may fix some obscure suspend/resume problems. It has fixed keyrate
setting problems that were triggered by cardbus (MPSAFE) changing the
ordering for syscons resume (non-MPSAFE). Also, add some asserts that
Giant is held in our suspend/resume and shutdown methods.

Found by: iedowse
MFC after: 2 days


138333 03-Dec-2004 njl

Enable the relaxed behavior for op regions and other workarounds for
non-standard BIOSen. We used to implement this in local patches but
now that ACPI-CA has merged/re-implemented most of our fixes, they were
no longer needed and we just needed to turn this knob on. Also, remove
an unnecessary cast.

Tested by: phk


138306 02-Dec-2004 njl

Turn ACPI and PCI devices off or to a lower power state in suspend and
back on again in resume. Override the default of D3 with the value the
BIOS specifies in _SxD, if present. Skip serial devices (PNP05xx) since
they seem to hang when set to D3 and may require special driver support.
Also, skip non-type 0 PCI devices (i.e., bridges) since our we don't yet
save/restore their config space and that seems to be necessary.

If this gives you trouble with suspend/resume, you can disable the new
ACPI and PCI power behavior separately with these tunables & sysctls:
debug.acpi.do_powerstate
hw.pci.do_powerstate

Approved by: imp (pci)
Tested by: acpi@ (numerous)


138305 02-Dec-2004 njl

Add the ACPI_PWR_FOR_SLEEP method. It takes a device and outputs the
appropriate power (Dx) state, if the BIOS suggests one.

MFC after: 3 weeks


138300 02-Dec-2004 marks

Catch up with AcpiOsSleep() interface change.
Catch up with some #define's renaming.
Implement AcpiOsGetTimer() as per ACPI 3.0.

Approved by: njl
MFC after: 1 week


138280 01-Dec-2004 jhb

- Do a better job of handling any Dependent Functions (aka DPFs) that appear
in the _PRS or _CRS of link devices. If faced with multiple DPFs in a
_PRS, we just use the first one. We assume that if _CRS has DPF tags they
only contain a single set since multiple DPFs wouldn't make any sense. In
practice, the only DPFs I've seen so far for link devices are that the one
IRQ resource is surrounded by a DPF tag pair for no apparent reason, and
this should handle that case fine now.
- Only allocate link structures for IRQ resources for link devices rather
than allocating a link structure for every resource.

Reviewed by: njl
Tested by: phk


138251 01-Dec-2004 njl

Completely back out 1.37. Something else is going on and John wants to
keep the locking and solve the real problem.


138248 01-Dec-2004 obrien

Fix "Lock ACPI PCI link not exclusively locked
@sys/dev/acpica/acpi_pci_link.c:153" panic by backing out rev 1.37 in the SMP
case. It appears that on a dual-proc machine the assertions in the rev 1.37
commit log hold true.


138233 30-Nov-2004 njl

Don't bother locking in attach(). At boot time, we're single-threaded
anyway and for some reason, witness seems confused about what's already
locked and triggers a false panic.


138218 30-Nov-2004 njl

Make sure the link array is big enough to hold both _CRS and _PRS
resource lists. It used to be sized based only on _CRS, hence _PRS could
perform an out-of-bounds access if it was larger (i.e., when there are
dependent functions). Add asserts to detect this case. Note, this is
only a temporary fix and I believe _PRS and _CRS should have separate
arrays.

Also, fix a typo where the wrong irq was being check for the APIC case.

Submitted by: tegge


138200 29-Nov-2004 njl

Instead of translating PCI to ACPI power states, just use a CTASSERT
that they are equivalent.


138125 26-Nov-2004 njl

Temporarily disable programming IRQ links on resume. The new code hangs
several of my systems.


138035 23-Nov-2004 jhb

- Remove some no longer used constants.
- Sort function prototypes.


138033 23-Nov-2004 jhb

Rework the ACPI PCI link code.
- Use a new-bus device driver for the ACPI PCI link devices. The devices
are called pci_linkX. The driver includes suspend/resume support so that
the ACPI bridge drivers no longer have to poke the links to get them
to handle suspend/resume. Also, the code to handle which IRQs a link is
routed to and choosing an IRQ when a link is not already routed is all
contained in the link driver. The PCI bridge drivers now ask the link
driver which IRQ to use once they determine that a _PRT entry does not
use a hardwired interrupt number.
- The new link driver includes support for multiple IRQ resources per
link device as well as preserving any non-IRQ resources when adjusting
the IRQ that a link is routed to.
- The entire approach to routing when using a link device is now
link-centric rather than pci bus/device/pin specific. Thus, when
using a tunable to override the default IRQ settings, one now uses
a single tunable to route an entire link rather than routing a single
device that uses the link (which has great foot-shooting potential if
the user tries to route the same link to two different IRQs using two
different pci bus/device/pin hints). For example, to adjust the IRQ
that \_SB_.LNKA uses, one would set 'hw.pci.link.LNKA.irq=10' from the
loader.
- As a side effect of having the link driver, unused link devices will now
be disabled when they are probed.
- The algorithm for choosing an IRQ for a link that doesn't already have an
IRQ assigned is now much closer to the one used in $PIR routing. When a
link is routed via an ISA IRQ, only known-good IRQs that the BIOS has
already used are used for routing instead of using probabilities to
guess at which IRQs are probably not used by an ISA device. One change
from $PIR is that the SCI is always considered a viable ISA IRQ, so that
if the BIOS does not setup any IRQs the kernel will degenerate to routing
all interrupts over the SCI. For non ISA IRQs, interrupts are picked
from the possible pool using a simplistic weighting algorithm.

Tested by: ru, scottl, others on acpi@
Reviewed by: njl


137780 16-Nov-2004 njl

Enable throttling/C3 quirks for PIIX4 parts. Defer checking quirks until
after boot so that PCI is initialized and we can probe for the problem
chipsets. Note that while probed but unusable states are disabled, they
aren't freed yet. In the future, it may make sense to detach them.

Tested by: Adam K Kirchoff <adamk at voicenet com>
MFC after: 2 days


137715 15-Nov-2004 imp

After discussions with Nate, repo copy the acpi assist drivers from
i386 to dev/acpi_support. In theory, these devices could be found
other than in i386 machines only as amd64 becomes more popular. These
drivers don't appear to do anything i386 specific, so move them to
dev/acpi_support. Move config lines to files so that those
architectures that don't support kernel modules can build them into
the kernel. At the same time, rename acpi_snc to acpi_sony to follow
the lead of all the other specialty devices.


137701 14-Nov-2004 truckman

s/return_VALUE/return / to fix build breakage when ACPI_DEBUG is
defined.


137681 13-Nov-2004 imp

Kill ACPI_FUNCTION_TRACE. It is killing the tinderbox build, and it
isn't worth adding to the modules lists that we have to hard code for
this to work. Since we print PID right away, we have a trace point
already.

Minor knf while I'm here.


137593 11-Nov-2004 imp

Commit takawata-san's Sony Notebook Controller driver, integrated into
the tree. Small tweaks were made by myself to eliminate unnecessary
includes and some other minor issues. Last time I asked takawata-san
about this driver, he suggested I commit it.

Submitted by: takawata


137590 11-Nov-2004 jhb

Only warn about missing _PRT tables if bootverbose is set. I've yet to see
a bridge without a _PRT were a _PRT was needed. Instead, the warning in
dmesg is a false warning and only serves to cause unnecessary concern.

MFC after: 1 week


137444 09-Nov-2004 njl

unsigned long -> u_long


137438 09-Nov-2004 njl

Tell the BIOS we want to handle brightness switching as well as output
switching. Don't initialize variables in their declaration. Reduce stack
usage for device names. Minor style cleanups.

MFC after: 1 week


137151 03-Nov-2004 phk

Make the bootverbose output from qualitydetermination of the ACPI timer
take up only one line.


137099 31-Oct-2004 des

Add TUNABLE_LONG and TUNABLE_ULONG, and use the latter for the
hw.pci.host_mem_start tunable. Add comments to TUNABLE_INT and
TUNABLE_QUAD recommending against their use.

MFC after: 3 weeks


137098 31-Oct-2004 des

Whitespace cleanup


136476 13-Oct-2004 njl

Print before the footer, not after.


136475 13-Oct-2004 njl

If flags are present, print them like ISA does.

MFC after: 1 day


136455 12-Oct-2004 njl

Attach the device description for ISA devices on the ACPI bus.

MFC after: 1 day


136398 11-Oct-2004 njl

Update C3 support when BM control is not present.

* Fix a bug where caches were flushed on non-C3 transitions.
* Be sure a working flush cache instruction is present before using it.
* Disable C3 completely if it isn't present.


136397 11-Oct-2004 imp

Make the lower range of the memory area 0x80000000 again. Also
introduce hw.{pci,acpi}.host_mem_start tunable to change this.

MFC: ASAP


136369 11-Oct-2004 njl

Notify the user when the battery is critically low. In the future, we
may want to shut down here but the chance of BIOS vendors getting this
wrong is high. They're only supposed to announce this when all batteries
hit their critical level but past experience indicates we should be
conservative about this for now.


136368 11-Oct-2004 njl

If bus mastering control is not available (PM2_BLK), don't just disable
C3. Instead, flush caches before entering C3. This may be slower but
provides good power savings.


136366 11-Oct-2004 njl

Move the code for halting the CPU (acpi_cpu_c1) into machdep files.
This removes the last MD portion of acpi_cpu.c.

MFC after: 2 weeks


136270 08-Oct-2004 njl

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


136189 06-Oct-2004 imp

For older systems with ACPI which don't have a pci <-> pci bridge,
allocate unallocated memory resources from the top 32MB of the address
space rather than the top 2GB. While the latter works on some
chipsets, it fails badly on others. 32MB is more conservative and
matches what cheap harware from this era is hardwired to pass.


136161 05-Oct-2004 njl

When the user overrides the DSDT, replace any SSDTs with a simple no-op
table. acpidump(8) concatenates the body of the DSDT and SSDTs so an
edited ASL will contain all the necessary information. We can't use a
completely empty table since ACPI-CA reports this as a problem.

MFC after: 3 days


135785 25-Sep-2004 njl

Allow routing to the SCI even if it's not in the list of valid IRQs.

MFC if: no problems


135574 22-Sep-2004 jhb

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.


135548 21-Sep-2004 njl

Initialize the flags value properly. We used to do this in acpi_tz_all_off()
but that function has been removed. This avoids a potential unnecessary
fan switch on boot. Also remove some commented out code.

MFC after: 3 days


135545 21-Sep-2004 njl

Don't disable acpi in shutdown if we're panicing (panicstr != NULL). This
may help with double panics.


135501 20-Sep-2004 njl

Record a problem we can't workaround for now regarding duplicate interrupts
because of links left enabled while in APIC mode. A large scale rework of
irq links is underway by jhb@ which should fix this eventually.


135308 16-Sep-2004 njl

Don't print a warning message if the _CRS value is empty. This is already
covered by other printfs under ACPI_DEBUG and is not a failure case.

MFC after: 3 days


134961 08-Sep-2004 njl

Clean up rev 1.49 by using the temperature conversion for _PSV also and
wrap a long line.


134909 07-Sep-2004 njl

Don't change the state of the system in acpi_tz_establish(). Before, we
would turn off all fans when initializing a zone. However, the HP Omnibook
500 generates a notify saying the zone needs to be re-evaluated whenever
its fan is switched on or off. This produced an infinite loop. Also, note
that running _SCP can generate the same notify.

Since we need to make sure old fan references are turned off when getting
new ones, run acpi_tz_monitor() first. This will turn off any unneeded
fans. Then, check for new settings. After that, run acpi_tz_monitor()
again to turn on/off any fans referenced by the new settings.

Tested by: brooks


134908 07-Sep-2004 njl

Instead of trusting _STA from power resources, cache the first value
returned and then infer the state from calls to _ON/_OFF. This works
around a problem in systems that don't correctly report the state (i.e.
the HP Omnibook 500 reports "on" for its fan always after it has been
turned on once).


134628 02-Sep-2004 njl

Don't enter the debugger when executing an AML breakpoint instruction
unless ACPI_DEBUG is defined. Users don't typically care about errant
breakpoint instructions. The HP Pavilion 7915 has this in its PCI0
_INI method for rev 0x6040000 of the RSDT.


134606 01-Sep-2004 njl

Disable links after getting the possible resources. Even though _DIS
should only affect current resources, it seems best to wait until all
configuration is done before disabling it. If this fixes any problems, it
is a MT5 candidate.


134541 30-Aug-2004 peter

Add a suffix descriptor for the acpi thermal values as a hint for the userland
sysctl tool to print a more readable value for temperatures.


134359 27-Aug-2004 njl

Always set the status and move a printf under bootverbose.

Tested by: gj


134352 26-Aug-2004 njl

If getting the current setting after modifying the link failed, we assume
it succeeded. However, we also need to set the status to AE_OK.


134305 25-Aug-2004 njl

Remove code to initialize the lid state at boot. It interfered with lid
operation for some users with pure GPE lid switches (vs. embedded
controller.)

Tested by: Anish Mistry <mistry.7_at_osu.edu>
MFC after: 3 days


134217 23-Aug-2004 njl

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


134126 21-Aug-2004 njl

Fix PCI link irq programming on resume. A logic bug prevented a device
match, inverting which links actually got resumed.

Submitted by: Hiroyuki Aizu <eyes_at_navi.org>
MFC after: 3 days


134088 20-Aug-2004 njl

Use the new start for the offset, not the old end.


134086 20-Aug-2004 njl

Correctly handle BIOS resources that are duplicated (!). There are many
systems that have overlapping regions specified in their sysresource
objects. This patch fixes ATA DMA and acpi_timer allocation for such
sysctems. It should eventually be moved to resource_list_add() if it is
a valid generalized approach. The minimal approach for 5.3 is:

"Loop through all current resources to see if the new one overlaps
any existing ones. If so, the old one always takes precedence and
the new one is adjusted (or rejected). We check for three cases:

1. Tail of new resource overlaps head of old resource: truncate the
new resource so it is contiguous with the start of the old.
2. New resource wholly contained within the old resource: error.
3. Head of new resource overlaps tail of old resource: truncate the
new resource so it is contiguous, following the old."

Tested by: Radek Kozlowski <radek_at_raadradd.com>
Discussed with: imp
MFC after: 4 days


133977 18-Aug-2004 njl

If _CRS fails, assume that it succeeded. The ASUS K8V (and others) defines
single-entry irq links even though it uses an APIC. It appears that it
ignores _SRS when in APIC mode but returns a valid irq at other times.


133943 18-Aug-2004 njl

Call AcpiLeaveSleepState() before DEVICE_RESUME(). The former calls the
BFS and WAK methods, which are needed to initialize some devices before
the driver can resume them. This was the original order.

MFC after: 2 days


133933 18-Aug-2004 njl

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


133919 17-Aug-2004 njl

Fix a deadlock on boot for some systems where reading the battery status
also generates a notify. Since we held the lock over this call, the
notify never got to run and the battery status read never returned.
Document this also.

Tested by: Maxim Maximov <mcsi_at_mcsi.pp.ru>
Approved by: re (scottl)


133664 13-Aug-2004 njl

Fix building for the ACPI_DEBUG case.


133661 13-Aug-2004 njl

Record the new status after checking if it has changed, not before. This
fixes lost AC line transition events.

Bug report: Kevin Oberman


133627 13-Aug-2004 njl

MPSAFE locking

* Simplify taskqueue locking.
* Don't acquire Giant around calls to the taskqueue function.
* Remove 4.x compatibility routines.


133626 13-Aug-2004 njl

MPSAFE locking

* Remove the interrupt wrapper that locked Giant and call the handler
directly. Mark the handler as MPSAFE.
* Don't attempt to detect if a handler is installed. Leave that to the
bus_alloc_resource() function.


133625 13-Aug-2004 njl

MPSAFE locking

* Serialize operations in acpi_video_bind_outputs(), acpi_video_detach(),
acpi_video_notify_handler(), acpi_video_power_profile(), and the sysctls.
The main goal is to protect the shared device list and prevent conflicting
settings.
* Add assertions that the sx lock is held in the leaf functions.


133624 13-Aug-2004 njl

MPSAFE locking

* Restructure the event handling path. acpi_tz_thread() now calls
acpi_tz_timeout() any time an event occurs. acpi_tz_timeout() checks
the flags and calls acpi_tz_power_profile(), acpi_tz_establish(), and
acpi_tz_monitor() as appropriate. Notifies only do a wakeup and let
acpi_tz_thread() do the actual work. This path is cleaner and allows
locking since the call path is now always a D.A.G.
* Add the acpi_tz_signal() function to set flags and wake the thread.
* Remove the tz_tmp_updating flag since calls are serialized by
acpi_tz_thread().
* Remove Giant locking.


133623 13-Aug-2004 njl

MPSAFE locking: Add a comment that we need resource list and device_t
refcounting/locking.


133622 13-Aug-2004 njl

MPSAFE locking

* Serialize acpi_pwr_switch_consumer() and acpi_pwr_wake_enable().
* Make acpi_pwr_switch_consumer() have a single exit point.
* Add assertions to the leaf functions they call.
* Fix a memory leak in acpi_pwr_deregister_consumer(). However, it is
currently ifdefed out so this code was unused.


133621 13-Aug-2004 njl

MPSAFE locking

* Serialize calls to acpi_pcib_route_interrupt().
* Note that acpi_pcib_attach() should not be called concurrently.


133620 13-Aug-2004 njl

MPSAFE locking

* Serialize access to acpi_pci_link_config(), acpi_pci_find_prt(),
acpi_pci_link_route(), and acpi_pci_link_resume().
* Add lock assertions to all functions called by them.


133619 13-Aug-2004 njl

MPSAFE locking

* Serialize access to acpi_pci_set_powerstate_method().


133618 13-Aug-2004 njl

MPSAFE locking

* Serialize notifying the user in acpi_lid_notify_status_changed(). This
way multiple lid events occur in order.
* Add an initialization pass to get the lid status at boot-time. This
pass does not notify any apps but gets the initial status.


133617 13-Aug-2004 njl

MPSAFE locking

* Use the common serialization macros instead of rolling our own.
* Increase the coverage of the lock in EcSpaceHandler() to cover the entire
loop to avoid dropping the lock when reading more than one byte.


133616 13-Aug-2004 njl

MPSAFE locking

* Hold the ACPI lock over table register writes.
* Serialize calls to acpi_cpu_throttle_set() and the sysctls.


133615 13-Aug-2004 njl

MPSAFE locking

* Serialize ops in acpi_cmbat_notify_handler(), acpi_cmbat_ioctl(),
acpi_cmbat_init_battery(), and acpi_cmbat_get_battinfo().
* Get the softc directly in acpi_cmbat_get_total_battinfo() rather than
build an array of them.
* Don't queue a _BIF query after receiving a notify. Since we clear the
timespec, a _BIF query will be done in the context of the next caller.
* Add asserts to leaf functions that operate on shared data.
* Remove the bst/bif updating flags now that we hold the lock over the
full query.
* Explain various comments in more detail.


133614 13-Aug-2004 njl

MPSAFE locking

* Serialize acpi_battery_get_battdesc(), acpi_battery_register(), and
acpi_battery_remove().
* Assert that the sx lock is held in acpi_batteries_init().
* Remove check for device_get_softc() returning NULL.


133613 13-Aug-2004 njl

MPSAFE locking

* Serialize notification of acline changes in acpi_acad_get_status().
* Remove the initializing flag. With the locking, we don't need to
push off requests for the acline before initialization is done.
* Don't check device_get_softc(), it can't return NULL.


133612 13-Aug-2004 njl

MPSAFE locking

* Serialize calls to acpi_alloc_resource(), acpi_release_resource(),
acpi_Enable(), acpi_Disable(), and acpi_debug_sysctl().
* Acquire the ACPI mutex in acpi_register_ioctl(), acpi_deregister_ioctl(),
and acpiioctl().
* Acquire the mutex while disabling subsequent requests to enter a
sleep state in acpi_SetSleepState().
* Be sure to re-enable sleep requests and don't run resume methods when
the current request fails.
* Don't check if sleep requests are disabled in the ACPIIO_SETSLPSTATE
ioctl. acpi_SetSleepState() does this for us.
* Remove the acquisition of Giant from the struct cdevsw.
* Remove the ACPI_USE_THREADS option.


133611 13-Aug-2004 njl

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.


133586 12-Aug-2004 njl

Skip dependent functions when finding the resource from _PRS to use for
later calls to _SRS. Add note that this code should be centralized at
some point.

Bug from: Jiawei Ye <leafy7382_AT_gmail.com>


133585 12-Aug-2004 njl

Only print the link name if there is a link. For the hardwired case, don't
bother printing it. This fixes a panic and acpi_name() has been more robust
as well.

Bug from: Tai-hwa Liang <avatar-at-mmlab.cse.yzu.edu.tw>


133584 12-Aug-2004 njl

Allow null handles to be passed into acpi_name().


133533 12-Aug-2004 njl

Fix the PRT entry code in acpi_pci_link to always add the entry, even if
there is no irq link. Since we now use the stored copy of PRT, not the
one that used to be passed into acpi_pcib_route_interrupt(), we need it in
the list. [1]

Fix a bug in acpi_pci_find_prt() where we weren't checking the bus, thus
choosing the wrong PRT entry to use for routing the link. Also, add a
printf for the case where the PRT entry is not found as this should not
happen.

Tested by: marcel [1]


133519 11-Aug-2004 njl

Add some more verbose warning/error messages to help with users reporting
problems with irq routing.


133500 11-Aug-2004 njl

Re-work ACPI PCI IRQ routing (_PRT, link devices). The old approach was
incomplete in that the PRT routing was not aware of link programming.
Fix this by doing all routing through the link devices. The new algorithm
for setting up links is:

1. Read _CRS to get current setting. If invalid (not in _PRS), then set
to 0.
2. Attempt to call _DIS on the link. If successful, mark the link as not
routed. Otherwise, assume it still is.

Then when a routing request occurs:

3. Update weights for all IRQs
4. Attempt to route the initial IRQ if valid
5. If that fails, walk through the sorted list, attempting to route IRQs.
6. Configure the trigger/polarity based on _PRS.

Other changes:
* Add acpi_pci_find_prt() to look up the PRT entry for a given device and
acpi_pci_link_route() to select/route the best IRQ for it.
* Remove duplicated code in acpi_pcib_route_interrupt() that picked the
first IRQ from _PRS.
* Remove unneeded arguments from acpi_pcib_resume() and friends.
* Ignore _STA on link devices but report if it seems strange.
* Add a prt_source handle to the PRT structure since the ACPI struct
ACPI_PCI_ROUTING_TABLE uses a fixed-size entry for it. We'll need to
dynamically size this object if we want to use it the same way ACPI-CA
does. Null-terminate the source.

Tested by: Luo Hong <luohong99_at_mails.tsinghua.edu.cn>,
Jeffrey Katcher <jmkatcher_at_yahoo.com>
Info from: jhb, Len Brown (Intel)


133455 10-Aug-2004 njl

Don't call DEVICE_RESUME a second time if DEVICE_SUSPEND fails. The
bus_generic_suspend method does this for us. Disable interrupts before
entering S1. This may help some systems suspend to S1 successfully.


133193 06-Aug-2004 njl

Refine updates to PCI irq routing. Check _STA and _CRS but only print a
message if they are incorrect. Also, remove the hack of allowing the
initial irq setting to not be in _PRS. As before, the old behavior can be
regained by defining ACPI_OLD_PCI_LINK.


133188 06-Aug-2004 njl

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


133157 05-Aug-2004 njl

Work around non-compliant BIOS PCI link devices. Some systems have the
following behavior:

* Link devices return invalid status (_STA) values. The results are very
unreliable -- sometimes never present. Just ignore the status and pick
the best configuration from _PRS.

* Link devices return invalid current settings (_CRS). Even after setting
the link value, many systems still return a different setting for _CRS.
When setting an IRQ, don't bother to check _CRS to see if we succeeded.
Note that we still check _CRS before routing and this should be addressed
as well.

Since this is a sensitive area, leave the old behavior accessible via
uncommenting the define for ACPI_OLD_PCI_LINK at the top of the file. Once
this has been thoroughly tested, this option and the code it covers will
be removed.

Thanks to Len Brown at Intel for informing us of these issues as he worked
around them in Linux.


133081 03-Aug-2004 njl

Fix the ACPI_DEBUG case by removing a now unused variable.


133075 03-Aug-2004 obrien

Initialize variables to fix kernel build on AMD64.


133051 03-Aug-2004 njl

/tmp/m


132651 26-Jul-2004 njl

Don't force an immediate probe/attach for all devices when compiled with
ACPI_DEBUG. This upset the ordering that acpi_probe_order() was meant to
provide, causing devices to attach before the sysresource object. This
debugging feature has been unnecessary for a while so just remove it.

Testing by: marcel


132605 24-Jul-2004 njl

Fix a bug where an item was being removed from a list without using
FOREACH_SAFE. Remove bad cast of retp and instead use an additional
arg to pass back the number of valid outputs. Use the package convenience
functions for parsing packages.


132528 22-Jul-2004 njl

Reinsert the bus space handle and tag, they are needed for the timer test.


132527 22-Jul-2004 njl

Instead of doing everything in identify, do a proper probe/attach. Also,
don't add another device if identify is called twice. Minor reworking by
myself.

Submitted by: marcel


132526 22-Jul-2004 njl

Remove unused (and bogus) locking, style cleanup, remove unnecessary casts.


132261 16-Jul-2004 njl

Use ACPI_ALL_NOTIFY instead of registering handlers separately.


132256 16-Jul-2004 njl

Fix acpi_video loading. When we started cleaning up the duplicate handles
left around after the PCI probe, acpi_video stopped attaching because while
it was an acpi child device, it really is a PCI device. Fix this by making
it a PCI child.

* Remove non-handle ivars accesses since child busses only implement
acpi_get_handle().
* Access the acpi softc directly through the devclass instead of through
the implied parent.
* Clean up a potential panic on unload by freeing the sysctl context before
storing NULL in the OID.

Found by: marks


132212 15-Jul-2004 njl

Update the interface for child drivers. Add acpi_scan_children, which
allows a bus to re-enumerate its child handles and optionally replace
them with new children, arranged to the bus's liking. (The current device
space is flat with all devices immediately under acpi0). Add comments
for each interface.


132158 14-Jul-2004 marks

Some laptops report the "design-capacity" instead of the "real-capacity"
when the battery is fully charged. That breaks some of the arithmetic in
calculating the remaining capacity (ends up with more than 100%).
This commit makes sure the max is 100.

Approved by: njl


132136 14-Jul-2004 takawata

Follow PnP location string change in acpi.c.


132115 13-Jul-2004 njl

Clean up our pnpinfo and location strings.


132114 13-Jul-2004 njl

Call device_identify routines after doing the namespace walk. This is
needed so that sysresource objects are created first to reserve all regions,
then other devices can allocate from them. Otherwise, acpi_timer (the only
ACPI device with an identify routine), would allocate its resources from
the nexus, causing the later sysresource reserve to fail.

Debugging by: Taku YAMAMOTO, Andrea Campi


132049 12-Jul-2004 njl

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


131910 10-Jul-2004 marcel

Update for the KDB framework:
o Call kdb_enter() instead of Debugger().


131577 04-Jul-2004 imp

Make the default memory range in the top 2GB of ram in the hopes that
this more accurately reflects what the underlying hardware of most
acpi machines that don't have children pci busses.

We still need a better way to get this information from acpi/hardware.


131480 02-Jul-2004 njl

Remove duplicate FreeBSD id.


131474 02-Jul-2004 njl

Get rid of the strict aliasing error by retrieving the ECDT via a table
header pointer and then casting it to the ecdt pointer. This fixes the
-O2 build. I'm unsure what changed recently to reveal this error since
this code has been unchanged for months.


131417 01-Jul-2004 imp

After re-exporting rman, et al, __RMAN_RESOURCE_VISIBLE is no longer
necessary for this file. It just needed the size and guts of struct
rman.


131398 01-Jul-2004 jhb

Trim a few things from the dmesg output and stick them under bootverbose to
cut down on the clutter including PCI interrupt routing, MTRR, pcibios,
etc.

Discussed with: USENIX Cabal


131384 01-Jul-2004 njl

Rework the code that waits for a response from the EC. Use an sx lock
instead of a mutex so we do not unblock it in msleep(). If we do this,
another event could occur, resetting the status register since reads
reset it. While I'm here, remove the backoff approach. Instead, sleep
in 10 ms chunks for up to the configured timeout using either DELAY (if
we aren't booted yet) or tsleep.

Help from: dillon
Tested by: Andrew Thompson andy AT fud.org.nz


131366 30-Jun-2004 njl

Add missing function debug trace macros to the new powerres functions.

Reported by: phk


131344 30-Jun-2004 imp

Hide struct resource and struct rman. You must define
__RMAN_RESOURCE_VISIBLE to see inside these now.

Reviewed by: dfr, njl (not njr)


131341 30-Jun-2004 njl

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).


131340 30-Jun-2004 njl

Add a method for referencing/switching power resources based on _PRW.
This brings us into line with the standard, which requires power resources
be enabled when wake is enabled for a given device. Move the dereferencing
code into its own function, +acpi_pwr_dereference_resource().


131339 30-Jun-2004 njl

Disable the EC GPE in the shutdown path. This is correct but is not known
to fix any bug.


131336 30-Jun-2004 njl

Diff reduction for style.


131315 30-Jun-2004 njl

Add new quirk code that disables problem BIOS versions. Remove old quirk
code that was never really used. Print a message when disabling ACPI via
a quirk. Allow the user to override the blacklist decision by setting
hint.acpi.0.disabled="0". Add missing AcpiTerminate() calls; they are
needed to clean up if bailing out after AcpiInitializeSubsystem().


131313 30-Jun-2004 njl

Add the table quirk matching code. It matches rules defined in acpi_quirks
and sets the flags. It also calls the machdep quirk code first. This
allows table quirks (or whitelists) to override machdep quirks.


131312 30-Jun-2004 njl

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


131283 29-Jun-2004 njl

Staticize acpi_MatchHid() and include acpi_if.h


131282 29-Jun-2004 njl

Use the acpi_id_probe() method instead of acpi_MatchHid(), which is now
static.


131281 29-Jun-2004 njl

Add implementation of the ACPI methods which hands them off to ACPI-CA.
acpi_id_probe() returns NULL for no match or the ID string that matched
if the driver should attach.


131276 29-Jun-2004 njl

Add acpi methods for HID/CID probing, evaluating objects, and walking the
namespace. This is to allow decoupling of attachments from ACPI where they
need some functionality when ACPI is present but do not want to require ACPI
to always be loaded.


131269 29-Jun-2004 njl

Use a default of the FADT for matching CreatorId quirks. Use XSDT to mean
"match either RSDT or XSDT."


131258 29-Jun-2004 njl

Include isa/pnpvar.h and remove a duplicate copy of PNP_EISAID.


131257 28-Jun-2004 njl

While booting, use DELAY() for waiting for the EC to respond instead of
msleep(). Until we're finally up, msleep is a no-op.

Explained by: peter


131221 28-Jun-2004 imp

rman_reserve_resource doesn't set the bushandle, so we have to do it here.

Badness noted by: njl
Perforce reply not read by: imp


131189 27-Jun-2004 imp

MFp4: Set the bus handle to the bus handle of the resource, not the
starting value. This is more pedantically correct (since the handle
isn't always identical to the start of the resource) and also doesn't
access the innards of struct resource direct (which I forbid in my
tree). We need to do this for all resource types, not just ioport.

Reviewed by: njl


131039 24-Jun-2004 njl

Update some comments and remove non-standard notation.


131036 24-Jun-2004 njl

Add a quirks array based on matching ACPI tables. The entries in this file
are currently all bad BIOS revisions that will never be able to support
ACPI. They were derived by examining which BIOS's are blacklisted by other
operating systems. Other types of quirks will be possible here as well.


131009 24-Jun-2004 njl

Attach the correct handle, not the one that was just deleted. Also,
remove some duplicated code.


131004 24-Jun-2004 njl

Run the power off code directly instead of using indirection through
smp_rendezvous() to ensure we run on the BSP. This reverts rev 1.128.
Add a comment indicating that MI code should be the one that runs all
shutdown functions on the BSP with the APs halted. This should work
around problems in power off while waiting for the MI code to be improved.


131002 24-Jun-2004 njl

Use uintmax_t for CPU statistics and add a cast to prevent truncation of
the statistics in a multiply.

Pointed out by: YONETANI Tomokazu


130981 23-Jun-2004 jhb

- 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)


130978 23-Jun-2004 jhb

Now that we associate a device_t with ACPI device handles, lookup the
device associated with any PCI devices that are enumerated in the ACPI
tree when adding children to an ACPI PCI bus and remove the duplicate
ACPI-only device_t and replace the device_t associated with the handle with
the ACPI and PCI aware device_t.


130914 22-Jun-2004 brueffer

Fix typos and add spaces before `(' in some comments

Submitted by: markus
Approved by: njl
MFC after: 3 days


130704 19-Jun-2004 njl

Add more precision to the cx_usage sysctl output and special-case 0%.

Submitted by: YONETANI Tomokazu <qhwt+freebsd-acpi AT les.ath.cx>


130695 18-Jun-2004 njl

Remove compat code and unused lock declarations.


130694 18-Jun-2004 njl

Remove compat defines.


130585 16-Jun-2004 phk

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


130486 14-Jun-2004 jhb

Revert the removal of the initial_irq hack for now as this code is more
broken than I thought and doesn't do a good job of routing virgin
interrupts at all.


130451 14-Jun-2004 njl

Remove disable_on_poweroff and our pre-sync shutdown handler. Disabling
of GPEs is now done in acpi_shutdown() and so we no longer need the option
of disabling ACPI in the poweroff case.


130450 14-Jun-2004 njl

Clean up acpi_probe_order() a bit and clarify some comments.


130448 14-Jun-2004 njl

Don't probe/attach in the ACPI_DEBUG case.


130439 13-Jun-2004 njl

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.


130417 13-Jun-2004 njl

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.


130210 07-Jun-2004 njl

Remove accidental change.


130208 07-Jun-2004 njl

Avoid printing extraneous warning messages when trying to switch a device
which doesn't support ACPI power states. Return AE_NOT_FOUND for these
cases and don't print the warning message. Also, print the name of the
handle instead of device when unable to switch states. The device is often
not attached at this point and so its name is NULL, which doesn't help
debugging.


130196 07-Jun-2004 jhb

- Use PCI_INVALID_IRQ macro rather than a magic number.
- Remove obsolete comment about APIC_IO routing.


130119 05-Jun-2004 njl

Don't forget to pass shutdown events down to children first now that we
handle them at the bus level too.


130114 05-Jun-2004 njl

Disable wake GPEs in the reboot path as well as poweroff path. This fixes
"stray irq 9" messages on my Thinkpad. It may also help with general
reboot consistency although the recent hang on reboot was solved by
acpi_cpu.c rev 1.39.


130113 05-Jun-2004 njl

Rework acpi_cpu_idle() to select the next idle state before sleeping, not
after. Unify the paths for all Cx states. Remove cpu_idle_busy and
instead do the little profiling we need before re-enabling interrupts.
Use 1 quantum as estimate for C1 sleep duration since the timer interrupt
is the main reason we wake.

While here, change the cx_history sysctl to cx_usage and report statistics
for which idle states were used in terms of percent. This seems more
intuitive than counters. Remove the cx_stats structure since it's no
longer used. Update the man page.

Change various types which do not need explicit size.


130080 04-Jun-2004 peter

Work around the preemption problem in acpi_cpu.c for shutting down.

Submitted by: nate / jhb


129879 30-May-2004 phk

Add missing <sys/module.h> includes


129831 29-May-2004 njl

Decrease sleep_delay default to 1 second now that the machines that
required the 5 second delay have been fixed.


129829 29-May-2004 njl

Style cleanups, don't set the device description before the probe routine
has completed successfully.


129813 28-May-2004 jhb

Don't assume that the current setting (_CRS) of a PCI link device is
correct. Instead, check it against the possible settings (_PRS) when
the link is probed. This is important when using APIC mode but link
devices still have PIC mode settings. This is also what Linux does.

Additional prodding by: Len Brown len dot brown at intel dot com


129811 28-May-2004 njl

Style fixes.


129807 28-May-2004 njl

Now that we properly disable GPEs before entering a sleep state, including
S5 (soft off), we don't need to disable ACPI when powering off. This may
fix some systems that don't power off correctly.


129806 28-May-2004 njl

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


129805 28-May-2004 njl

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.


129804 28-May-2004 njl

Pass a pointer to the sleep state instead of casting gymnastics to pass
the value itself in the pointer.


129803 28-May-2004 njl

Fix paste-o.


129802 28-May-2004 njl

Attach per-device sysctls to allow users to set whether or not a given
device can wake the system. For example:

dev.root0.nexus0.acpi0.acpi_lid0.wake: 1
dev.root0.nexus0.acpi0.acpi_button0.wake: 1
dev.root0.nexus0.acpi0.pcib0.wake: 0
dev.root0.nexus0.acpi0.sio0.wake: 0


129800 28-May-2004 marcel

Fix LP64 environments: cast a pointer type to intptr_t before casting
to int and vice versa.


129783 27-May-2004 njl

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.


129724 25-May-2004 njl

Enable GPE at runtime rather than suspend time. This is to match the
new behavior in ACPI-CA that defers GPE configuration. This is a temporary
measure while reworking the GPE interface.


129696 25-May-2004 njl

Remove call to _INI for thermal devices. ACPI-CA now calls _INI for
Devices, ThermalZones, and Processors.


129692 25-May-2004 njl

Changes to implement 20040514:

* Add calls to AcpiSetGpeType. We use wake/run as the type for lid and
button switches since wake-only causes Thinkpads to immediately wake on
the second suspend. Note that with wake/run, some systems return both
wake and device-specific notifies so we don't register for system notifies
for lid and button switches.
* Remove the hw.acpi.osi_method tunable since it is not needed.
* Always print unknown notifies for all types.
* Add more cleanup for the EC if it fails to attach.
* Use the GPE handle now that we parse it. This allows GPEs to be defined
in AML GPE blocks.
* Always use ACPI_NOT_ISR since it's ok to acquire a mutex in our thread
which processes queued requests.


129594 22-May-2004 njl

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


129395 18-May-2004 njl

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


129197 14-May-2004 njl

Add support for GPE being a package of { reference, gpe bit }.
Rework the ECDT probe to pass all the parameters in a temporary struct.
Note why we are mostly ok evaluating _GLK so early.


129168 13-May-2004 njl

Add support for retrieving _GLK in the ECDT probe. Now we no longer always
use the global lock at the beginning of the ECDT probe. Instead, we use
the handle from the ECDT to call _GLK. Also, unify the device description.


129093 10-May-2004 jhb

If an ACPI PCI-PCI bridge doesn't have a _PRT object, fall back to using
the swizzle method for routing PCI interrupts across the bridge. This
fixes problems with motherboards (typically laptops) whose BIOS doesn't
provide a PRT for the AGP bridge even though there is a device entry for
the bridge in the ACPI namespace.

Tested by: Kenneth Culver culverk at sweetdreamsracing dot biz


129021 07-May-2004 njl

Change hw.acpi.cpu.cx_lowest to accept values in the form of C1,
C2, ... Update power_profile to use the new format. Update the
man page to reflect this and give more info on Cx states.


129014 06-May-2004 njl

Rename acpi_cpu to cpu. Change the probe routine to early on reject
devices it cannot attach to. This gets rid of extraneous but harmless
device_probe_and_attach() errors. While I'm here, make the device
description more useful. The !acpi case for cpu is handled by legacy0.


128993 06-May-2004 njl

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.


128991 06-May-2004 njl

Add back sys/reboot.h which is needed.


128990 06-May-2004 njl

Make unnecessary globals static and remove unused includes.

Pointed out by: cscout


128989 06-May-2004 njl

Fix setting debug strings via sysctl. Also, clean up the way we print
debug strings.


128981 05-May-2004 njl

Remove extra parentheses.


128979 05-May-2004 njl

Add an MI implementation of the ACPI global lock routines and retire the
individual asm versions. The global lock is shared between the BIOS and
OS and thus cannot use our mutexes. It is defined in section 5.2.9.1 of
the ACPI specification.

Reviewed by: marcel, bde, jhb


128656 26-Apr-2004 takawata

Fix build breakage.

Submitted by: Xin LI <delphij@frontfree.net>
PR: 65979


128655 26-Apr-2004 njl

Move the call to AcpiEnterSleepStatePrep() to before we select the BSP
(cpuid 0) as the processor. It mallocs some data and smp_rendezvous
calls functions with locks held.


128652 26-Apr-2004 imp

Fix two typos from PR: 65694

1) In pci.c, we need to check the child device's state, not the parent
device's state.
2) In acpi_pci.c, we have to run the power state change after the acpi
method when the old_state is > new state, not the other way around.

Submitted by: Dmitry Remesov
PR: 65694


128607 24-Apr-2004 njl

Disable interrupts while testing the timer. Not doing this unnecessarily
added an arbitrary delay to our readings, causing us to use the ACPI-safe
read method when not necessary. Submitted by: bde

Old:
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks BAD min = 3, max = 19, width = 16
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks BAD min = 3, max = 19, width = 16
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 4, width = 1
Timecounter "ACPI-safe" frequency 3579545 Hz quality 1000

New:
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000

Also, reduce unnecesary overhead in ACPI-fast by remove the barrier for
reads. The timer in the ACPI-fast case is known to increase monotonically
so there is no need to serialize access to it.


128561 22-Apr-2004 philip

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)


128543 22-Apr-2004 njl

Fix stepping in ddb by not checking for a maximum interval. The ACPI-safe
workaround was for hardware where the clock was not latched, not for
hardware that was too slow. Also, make variable names more specific for ddb
printing.


128528 21-Apr-2004 njl

Add comments, including restoring the PIIX4 errata comment, to indicate
what the ACPI-safe workaround is intended to fix. Requested by phk.

Set the bushandle and tag when attaching the timer, don't do it each time
in read_counter(). Pointed out by bde.

Move test_counter() to the end. Staticize acpi_timer_reg.


128506 21-Apr-2004 njl

Fix several bugs where 32-bit timers and wraparound were not properly
supported. Symptoms of this bug included unnecessary use of ACPI-safe
and a dmesg that has deltas of about 2^24:

ACPI timer looks BAD min = 2, max = 16777206, width = 16777204
ACPI timer looks BAD min = 2, max = 7, width = 5
ACPI timer looks GOOD min = 4, max = 5, width = 1
ACPI timer looks BAD min = 2, max = 16777206, width = 16777204
ACPI timer looks BAD min = 2, max = 7, width = 5
ACPI timer looks BAD min = 2, max = 16777210, width = 16777208
ACPI timer looks BAD min = 4, max = 16777189, width = 16777185
ACPI timer looks GOOD min = 4, max = 5, width = 1
ACPI timer looks BAD min = 2, max = 7, width = 5
ACPI timer looks BAD min = 4, max = 16777189, width = 16777185

To fix this:
* Use a 32 bit timecounter mask when the timer is 32 bits.
* In test_counter(), use the acpi_TimerDelta function which handles 24/32
bit timers and wraparound.

Miscellaneous fixes:
* Use C99 initializers for timecounter struct.
* Use u_int and uint32_t where appropriate instead of unsigned.
* Remove whitespace-only lines
* Remove the old PIIX4 PCI workaround. The timecounter testing code has
been in use for long enough to prove it's functional.


128504 21-Apr-2004 njl

Remove extran parens.


128503 21-Apr-2004 njl

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.


128487 20-Apr-2004 njl

Style fixes.


128468 20-Apr-2004 njl

Allow the AC adapter device to be disabled with debug.acpi.disable="acad".
Even though documented, this option was never enabled even in rev 1.1.

Submitted by: sos


128436 19-Apr-2004 njl

Add a temporary workaround for acpi_AppendBufferResource() returning with
a NULL crsbuf pointer. This shouldn't happen if it returns AE_OK. We'll
figure out why this is happening later.

Submitted by: Bruno Ducrot <ducrot@poupinou.org>


128319 16-Apr-2004 njl

Disable the new wake GPE behavior. With it enabled, my laptop won't stay
suspended after the second try. Intel is working on a fix to properly
differentiate the non-standard wake/runtime GPEs from wake-only GPEs.


128252 14-Apr-2004 njl

Return an error immediately if asked to switch a non-existent consumer.


128249 14-Apr-2004 njl

Remove a non-variable static and move other static variables to the same
location.


128248 14-Apr-2004 njl

Fix some warnings by commenting out unused code.


128247 14-Apr-2004 njl

Only try to set the ACPI power state if the handle is valid. There was
probably no problem with this except it may have had the side effect of
registering a NULL consumer.


128240 14-Apr-2004 njl

Unbreak the DDB build by replacing #includes that were deleted.

Pointed out by: Tai-hwa Liang, Xin LI
Pointed hat to: njl


128228 14-Apr-2004 njl

Style cleanups, M_ZERO instead of bzero.


128227 14-Apr-2004 njl

Style cleanups, use M_ZERO instead of bzero, unify the !semaphore and
semaphore return paths.


128226 14-Apr-2004 njl

Style cleanup, plus properly backup partial resource allocation in
AcpiOsInstallInterruptHandler() in the case of failure to initialize.


128225 14-Apr-2004 njl

Style cleanups to reduce diffs to locking tree.


128224 14-Apr-2004 njl

Style and printf message cleanups.


128222 14-Apr-2004 njl

Use TRUE for a boolean and a style nit.


128220 14-Apr-2004 njl

Update the name for edge triggered for the 20040402 import.


128150 12-Apr-2004 njl

Remove a check for the return value added in rev 1.41. It's not an error
to fail to turn off a fan, since the case is that it's usually already off.


128071 09-Apr-2004 njl

Add MODULE_DEPEND entries so some of these drivers can eventually be
loaded separately from ACPI (i.e., embedded use).


128058 09-Apr-2004 imp

Omnibus PCI commit:
o Save and restore bars for suspend/resume as well as for D3->D0
transitions.
o preallocate resources that the PCI devices use to avoid resource
conflicts
o lazy allocation of resources not allocated by the BIOS.
o set unattached drivers to state D3. Set power state to D0
before probe/attach. Right now there's two special cases
for this (display and memory devices) that need work in other
areas of the tree.

Please report any bugs to me.


128047 09-Apr-2004 njl

Replace more ad-hoc versions of acpi_GetReference(). Since the type of
Reference objects changed from ACPI_TYPE_ANY to ACPI_TYPE_LOCAL_REFERENCE
in Oct. 2002, this may help systems where switching the cooler on failed.
We support both types for now until this sorts out.


128046 09-Apr-2004 njl

Include the prototype for acpi_GetReference.


128045 09-Apr-2004 njl

Add support for packages as the first element of _PRW. This may allow
some machines to enable wake events for more devices although I haven't
seen a system yet that uses this form. Also, introduce acpi_GetReference()
which retrieves an object reference from various types.


128036 08-Apr-2004 njl

Unify on version 1 to be similar to the rest of the tree. After 5-stable
branches, increment version on any API change visible to other modules.


128016 07-Apr-2004 jhb

Implement an ACPI-aware pci_set_powerstate() method for PCI busses that
are enumerated in the ACPI device tree. In addition to the normal PCI
powerstate functionality, the ACPI _PSx methods are executed and ACPI
PowerResources are switched on and off via the acpi_pwr_switch_consumer()
function.

Glanced at by: imp, njl


127700 01-Apr-2004 njl

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.


127681 31-Mar-2004 njl

Staticize pnp methods, style fixes. Remove unused variable to unbreak
kernel build.


127680 31-Mar-2004 takawata

Add ACPI path in location string for ACPI namespace aware PCI device.


127679 31-Mar-2004 njl

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:


127678 31-Mar-2004 takawata

Style fix.

Pointed out by: njl


127609 30-Mar-2004 njl

Disable serialize_methods and enable _OSI support by default. The former
is necessary because some IBMs use recursive methods (pointed out by
Robert Moore from Intel). The latter was a typo on my part. It was disabled
by default when it should have been enabled.


127488 27-Mar-2004 takawata

Add ACPI PnP string. This affects devinfo(8) output with -v option.


127316 22-Mar-2004 njl

Use the correct length for appending an extended irq resource. This may
have broken APIC routing. This bug has been present since rev 1.33.


127315 22-Mar-2004 njl

Shorten some printfs to fit better. No other functional changes.


127314 22-Mar-2004 njl

Whitespace and comment changes. No MD5 change to the object file.


127240 20-Mar-2004 njl

Fix loop termination condition for parsing resources in _PRS buffers.
This completes the effort to handle dependent functions, which are used
in some machines for irq link resources. Also, clean up some nearby
comments while I'm at it.


127193 19-Mar-2004 njl

Move the poweroff handler to a separate function. Make sure it is run
on the boot processor (cpuid == 0). Some chipsets do not power off the
system if the shutdown handler runs on an AP.


127184 18-Mar-2004 njl

Add tunables for disabling serialized method execution and disabling the
new _OSI method. These can be used if these new features end up causing
regression for users.


127156 18-Mar-2004 njl

Support the DPF (start dependent function) resource type in parsing _PRS.
This should fix this error people get attaching cardbus controllers:

pcib0: _PRS resource entry has unsupported type 2


127147 17-Mar-2004 njl

Fix border error to allow systems that specify 100 for latency also use
C2 and 1000 to use C3.

Submitted by: Bruno Ducrot <ducrot@poupinou.org>
Tested by: Scott Lambert <lambert@lambertfam.org>


127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


126767 09-Mar-2004 njl

Simplify some logic in converting a buffer to an integer.


126766 09-Mar-2004 njl

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

Pointed out by: le


126663 05-Mar-2004 njl

Document a sysctl.

Submitted by: Craig Rodrigues <rodrigc@crodrigues.org>


126662 05-Mar-2004 njl

A user can set tz_requested via the hw.acpi.thermal.tzX.active sysctl.
The previous logic meant that if a user sets it to a minimal cooling value
acpi_thermal will not use higher cooling levels. Reverse the logic so that
the user requesting a level (say, 2) also gets 0 - 1 also.

PR: kern/61592
Submitted by: Andrew Thompson <andy@fud.org.nz>


126578 04-Mar-2004 njl

Fix an off-by-one error and rework our EC space handler. Writing to address
0xFF would fail previously as AE_BAD_PARAMETER. It's unknown if this caused
any actual problems.


126575 04-Mar-2004 njl

Don't disable Cx support and throttling on machines with a P_BLK_LEN != 6
even though the spec mandates this. Some have a value of 5 to indicate
throttling + C2 and some have 7 to indicate an extra C3 state. Support
throttling if the value is >= 4, C2 for >= 5, and C3 for >= 6.


126573 04-Mar-2004 njl

Add a "quirks" value to disable quirks handling for a given boot.
Also, disable quirks if booting with a custom DSDT. Add a quirk
to disable loading ACPI so known bad systems can be completely
blacklisted.


126560 03-Mar-2004 njl

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

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


126517 03-Mar-2004 njl

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.


126430 01-Mar-2004 njl

Add the ACPI standard video extensions driver. I've done some style cleanup
but a bit more reamins to be done. For now, it is usable.

Submitted by: Taku YAMAMOTO <taku@cent.saitama-u.ac.jp>


126388 28-Feb-2004 njl

Call _INI on Thermal Zones as well as devices.


126080 21-Feb-2004 phk

Device megapatch 4/6:

Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.


126076 21-Feb-2004 phk

Device megapatch 1/6:

Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.


126015 19-Feb-2004 njl

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


126014 19-Feb-2004 njl

Do not remove the fixed handlers. Several systems (e.g., ASUS) only
return events on the fixed handler even after defining a duplicate in the
AML. While this violates the spec, hopefully we can get by with leaving
both installed.


125986 19-Feb-2004 njl

Fix problem caused by previous commit where some users' buttons
stopped returning events. Don't disable the event when removing
the handler because it still needs to be enabled for the other
handler. Also, remove duplicate AcpiEnableEvent calls since the
install function now does this for us.


125795 14-Feb-2004 njl

Fix hw.acpi.os_name by renaming it to hw.acpi.osname. The "_name" suffix
is reserved by the loader, and thus any tunable name with that suffix will
be silently discarded.

Document this in the header and man page so that other developers do not
develop so many bumps on the head after banging it against the wall.

Detective work by: Mark Santcroos, grehan


125745 12-Feb-2004 jhb

Fix a whitespace nit.


125679 11-Feb-2004 njl

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:


125526 06-Feb-2004 philip

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)


125366 03-Feb-2004 njl

Notify the user (at kern.emerg) that the system will be shutting down if
it is still above the critical temperature on the next poll cycle. This
is a 10 second advance notice by default. Document the private
(non-standard) notify we will be using with devd(8).


125335 02-Feb-2004 njl

If the temperature is at _HOT or _CRT for 3 sequential readings, shutdown
the system. Also, decrease the poll interval to 10 seconds from 30
seconds. This is needed because some systems will report an invalid high
temperature for one poll cycle. It is suspected this is due to the
embedded controller timing out. A typical value is 138C for one cycle on a
system that is otherwise 65C. This prevents the system from prematurely
shutting down after one invalid reading. It will still shut down after 30
seconds of high temperature, which is the same as previous default
behavior.

Tested by: Scott Lambert <lambert AT lambertfam.org>


125135 28-Jan-2004 roam

Add an ACPI_FUNCTION_TRACE() to the newly-added acpi_Startup() routine
to get the ACPI_DEBUG case (and LINT in particular) to build.

Reviewed by: jhb, njl
Approved by: jhb


125067 27-Jan-2004 njl

Add TUNABLE_STR to make "hw.acpi.os_name" more correct. However, the call
to getenv_string() still doesn't work.


125047 26-Jan-2004 jhb

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


124760 20-Jan-2004 jhb

Use getenv_int() rather than reimplementing it.


124497 13-Jan-2004 jhb

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


124439 12-Jan-2004 njl

Bite the bullet and uncomment the shutdown() in case we hit the _CRT or
_HOT temperatures. We have to do this at some point to keep from getting
imp(tm) melted hardware.


124314 09-Jan-2004 njl

Clean up the acpi announce message of trailing spaces.


124310 09-Jan-2004 njl

Expand the check for overriding the OS name to override _OS* (including
_OS_, _OS, and _OSI). This should fix this option for people who reported
it not changing anything.


124091 03-Jan-2004 njl

Delete the region we are passed if that is the requested operation.
This should fix the problem with removing an address space handler
although we don't currently use that capability so it's unlikely anyone
saw this problem.


124029 31-Dec-2003 njl

Use the appropriate values for the notifies. No change in behavior
since both notifies result in the same function being called.

Found by: documenting the code


123942 28-Dec-2003 njl

Don't attach throttling if the P_BLK is 0, even if the P_BLK_LEN is 6.
This is more strict but no known systems have this problem.


123867 26-Dec-2003 jhb

Fix acpi_MatchHid() to check the compatibility ID's if the hardware ID
doesn't match.

Submitted by: marcel


123781 23-Dec-2003 njl

Fix locking broken by recent _CID changes. Always be sure to unlock
in the error case.


123777 23-Dec-2003 njl

Update to use the new package routines instead of rolling our own
macros.


123776 23-Dec-2003 njl

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


123738 23-Dec-2003 peter

Don't use NULL (pointer) when we're testing for a count of 0 (integer).


123642 18-Dec-2003 kan

Initialize acpi buffer structs early in order to avoid freeing
unallocated pointers later in done: section.


123624 18-Dec-2003 njl

Remove power profile support from acpi_cpu, it will be managed by a
script run from devd(8).


123619 18-Dec-2003 njl

Add support for multiple CIDs since _CID can contain a package of values.
Implement this in acpi_MatchHid() and acpi_isa_get_compatid(). This
should fix mouse support for some users.

Move all users of AcpiGetObjectInfo() to use dynamic storage instead of
a devinfo on the stack. This is necessary since ACPI-CA needs to
allocate different sized arrays for the CompatList.


123496 12-Dec-2003 njl

Fix throttling to use the proper mask. The bug resulted in only two
throttling values being available regardless of the CPU's capabilities.
This has been broken since rev 1.1. Also clarify a comment.

Submitted by: Taku YAMAMATO <taku@cent.saitama-u.ac.jp>


123400 10-Dec-2003 jhb

Trim trailing whitespace.


123337 09-Dec-2003 njl

Use sbufs instead of snprintf for parsing debug strings.


123334 09-Dec-2003 njl

Delete madt.h since definitions are now used from actbl.h


123325 09-Dec-2003 njl

We don't need to call _INI on processor objects now that ACPI-CA does
this as it should.


123132 03-Dec-2003 jhb

Update this driver to be more module friendly:
- Dynamically allocate the cpu_softc[] array based on mp_maxid instead of
using a statically sized array that depended on 'options SMP'.
- Use mp_maxid rather than MAXCPU when walking all the CPUs looking for a
match.
- Always call smp_rendezvous() since UP kernels now provide this.
- Use mp_ncpus rather than cpu_ndevices when determining if we need to
disable C3 for SMP machines.

Approved by: re (rwatson)
Reviewed by: njl


123007 27-Nov-2003 njl

* If a processor's softc is NULL, use C1 since there is no ACPI
processor object for this CPU. This occurs for logical CPUs which
do not have an associated processor object (e.g., HTT).

Approved by: re (rwatson)


122995 26-Nov-2003 njl

* Add acpi_pcpu_get_id(idx, *acpi_id, *cpu_id) which fetches the
idx'th present CPU with pc_acpi_id equal to *acpi_id. If *acpi_id
does not match that processor's pc_acpi_id, return the value for
ProcId derived from the MADT in *acpi_id. If pc_acpi_id is 0xffffffff,
always override it with the value of *acpi_id. Finally, return
pc_cpuid in *cpu_id and use that as our primary key.

* Use pc_cpuid as our unique key because we know it is valid since
MD code set it. The values for ProcId in the ASL and MADT don't
match up on some machines (!), forcing us to fall back to ordered
probing in that case.

* Remove some #ifdef SMP since the refcount doesn't hurt performance
and will be needed for dynamic _CST objects. Only one #ifdef SMP
(for smp_rendezvous) remains.

* Hook up SMP in the compile flags in the Makefile.

Tested by: marcel, truckman
Approved by: re (scottl)


122928 20-Nov-2003 jhb

Fix a typo in my patches to support extended IRQ resources that broke the
type checking for _PRS for a link device's interrupt resources.

Approved by: re (scottl)


122926 20-Nov-2003 jhb

Try all of the possible interrupts for a link device when programming
boot-disabled devices instead of skipping the last interrupt. This is
especially important for devices that only have one interrupt as this
bug was keeping any interrupt from being tried at all.

Reviewed by: msmith
Approved by: re (scottl)


122904 19-Nov-2003 njl

* Add a DEVMETHOD for acpi so that child detach methods get called. Add
an acpi_cpu method for shutdown that disables entry to acpi_cpu_idle
and then IPIs/waits for threads to exit. This fixes a panic late in
reboot in the SMP case.

* In the !SMP case, don't use the processor id filled out by the MADT
since there can only be one processor. This was causing a panic in
acpi_cpu_idle if the id was 1 since the data was being dereferenced from
cpu_softc[1] even though the actual data was in cpu_softc[0] (which is
correct).

* Rework the initialization functions so that cpu_idle_hook is written
late in the boot process.

* Make the P_BLK, P_BLK_LEN, and cpu_cx_count all softc-local variables.
This will help SMP boxes that have _CST or multiple P_BLKs. No such
boxes are known at this time.

* Always allocate the C1 state, even if the P_BLK is invalid. This means
we will always take over idling if enabled. Remove the value -1 as
valid for cx_lowest since this is redundant with machdep.cpu_idle_hlt.

* Reduce locking for the throttle initialization case to around the write
to the smi_cmd port. Add disabled code to write the CST_CNT. It will
be enabled once _CST re-evaluation is tested (post 5.2R).

Thank you: dfr, imp, jhb, marcel, peter
Tested by: rwatson, Harald Schmalzbauer <h@schmalzbauer.de>
Approved by: re (rwatson)


122766 15-Nov-2003 njl

Implement Cx CPU idle states and updated throttling support.

* Use the cpu_idle_hook() to do idling for C1-C3.
* Use both _CST and the FADT to detect Cx states.
* Use both _PTC and P_CNT for controlling throttling.
* Add a notify handler to detect changes in _CST and _PSS
* Call the _INI function for each processor if present. This will be
done by ACPI-CA in the future.
* Fix a bug on SMP systems where CPUs will attach multiple times if the
bus is rescan.
* Document new sysctls for controlling idling.


122765 15-Nov-2003 njl

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.


122764 15-Nov-2003 njl

Add acpi_bus_alloc_gas() for allocating a memory or IO resource from its
Generic Address Structure.


122706 14-Nov-2003 jhb

Improve support for extended IRQ resources:
- For acpi_pci_link_entry_dump(), add a few helper functions to display
the trigger mode, polarity, and sharemode of an individual IRQ resource.
These functions are then called for both regular and extended IRQ
resources.
- In acpi_pci_link_set_irq(), use the same type of IRQ resource
(regular vs. extended) for the new current resource as the type of
the resources from _PRS.
- When routing an interrupt don't ignore extended IRQ resources. Also,
use the same type of IRQ resource (regular vs. extended) for the new
current resource when as the type of the resource from _PRS.

Tested by: peter


122577 12-Nov-2003 jhb

Fix some typos.


122565 12-Nov-2003 jhb

Reindent to non-style(9) compliant 4 space indent to match rest of file.


122564 12-Nov-2003 jhb

Add an ACPI_FUNCTION_TRACE() invocation to acpi_OverrideInterruptLevel()
to fix compile with ACPI_DEBUG.

Reported by: tinderbox


122500 11-Nov-2003 jhb

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


121493 25-Oct-2003 njl

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.


121239 19-Oct-2003 njl

Disable irqs before entering the power-off state. This is not known
to fix any problems but is similar to how Linux implements this
function.


120662 02-Oct-2003 njl

If requested to Sleep for less than our hz granularity (e.g., 10 ms),
use DELAY instead of tsleep.

Submitted by: peter


120607 30-Sep-2003 njl

Revert 1.24. It causes a hang on shutdown for Marcel. This is due to
AcpiEnterSleepState() calling a long AcpiOsStall() with interrupts
disabled. This fix will instead be added to ACPI-CA.

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


120571 29-Sep-2003 njl

If asked to stall for more than 100 us (which is specified as the max in
the ACPI standard), call sleep instead since that is probably what the
caller meant.

Mentioned by: peter


120494 26-Sep-2003 njl

Make debug.acpi.level and debug.acpi.layer sysctls that can be set with
the strings found in acpi(4). Also make acpi_ca_version a string so it
is more readable.


120453 26-Sep-2003 njl

Consistently print attach messages.


120450 26-Sep-2003 njl

Sort debugging levels and update the man page to match reality. Also
update man page to reflect iasl(8) import.


120327 22-Sep-2003 njl

Fix the ACPI_DEBUG case.

Reported by: Larry Rosenman <ler@lerctr.org>
PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:


120317 21-Sep-2003 phk

Make this compile.


120308 21-Sep-2003 njl

Add support for fixed event buttons defined in the DSDT (HID "ACPI_FSB"
and "ACPI_FPB").

Pointed out by: Linux


120186 18-Sep-2003 njl

Add necessary newlines.


120185 18-Sep-2003 njl

Shorten the message announcing fixed power/sleep buttons.


120155 17-Sep-2003 iwasaki

Add pci_resume() to reestablish interrupt routing after
suspend/resume.
Especially after hibernation, interrupt routing went back to initial
status on some machines.


120103 15-Sep-2003 njl

Bump the EC timeout from 50 to 100 ms. I believe the underlying issue is
global lock contention as symptoms only appear under heavy load (i.e. the
nightly periodic run).


120087 15-Sep-2003 njl

Only enable S4BIOS by default if the FACS says it is available. The
user can override this with a sysctl.

Be sure to return the acpi_SetSleepState return value to userland.


120061 14-Sep-2003 njl

Print notify values as hex.


120036 13-Sep-2003 njl

Add the -i flag to acpiconf(8) to retrieve battery information.
Rename a few structure elements.


119974 11-Sep-2003 njl

Add a system notify handler in addition to the device notify handler.
At least some Toshiba notebooks use a Notify of 0 or 1 for this.

PR:
Submitted by: Hiroyuki Aizu <aizu@navi.org>


119969 10-Sep-2003 marcel

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.


119946 10-Sep-2003 jhb

Move the definitions for ACPI MADT table entries not present in the ACPICA
distribution to a MI header so it can be shared with other architectures.


119903 09-Sep-2003 njl

Disallow attempts to suspend to S0. It was only enabled for testing.
Print a more informative message if a sleep state is not supported by BIOS.
Add comments.


119739 04-Sep-2003 njl

Don't free the buffer if it wasn't actually allocated.


119549 29-Aug-2003 njl

Use the ACPICA AcpiEnterSleepStateS4bios instead of rolling our own. This
change also disables interrupts around non-S4 suspends whereas before we
did not do this. Our version of AcpiEnterSleepStateS4bios was almost
identical to the ACPICA version.


119539 28-Aug-2003 jhb

- Rename PCIx_HEADERTYPE* to PCIx_HDRTYPE* so the constants aren't so long.
- Add a new PCIM_HDRTYPE constant for the field in PCIR_HDRTYPE that holds
the header type.
- Replace several magic numbers with appropriate constants for the header
type register and a couple of PCI_FUNCMAX.
- Merge to amd64 the fix to the i386 bridge code to skip devices with
unknown header types.

Requested by: imp (1, 2)


119529 28-Aug-2003 njl

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


119418 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


119281 22-Aug-2003 imp

Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.


119097 19-Aug-2003 takawata

Update my mail address on copyright notice.

Noticed by: njl


118987 16-Aug-2003 phk

Give timecounters a numeric quality field.

A timecounter will be selected when registered if its quality is
not negative and no less than the current timecounters.

Add a sysctl to report all available timecounters and their qualities.

Give the dummy timecounter a solid negative quality of minus a million.

Give the i8254 zero and the ACPI 1000.

The TSC gets 800, unless APM or SMP forces it negative.

Other timecounters default to zero quality and thereby retain current
selection behaviour.


118937 15-Aug-2003 njl

Revert part of rev. 1.16 -- reinstate system notify handler. It turns out
at least the Casio FIVA requires this.

Requested by: takawata


118926 15-Aug-2003 njl

De-inline functions which do not need to be inline. Move the DEVMETHOD
block to where it is in similar drivers.


118925 15-Aug-2003 njl

Don't install a system notify handler. Move the device notify handler
installation to just before we're ready to handle events. Make a loop
more readable (no functional change).


118924 15-Aug-2003 njl

Fix a couple changes that were incorrect in updating for 0619. Only unlock
the hardware mutex if it is held. Re-add calls to Enable/Clear fixed events.

This is not known to have caused problems. Bug symptoms might have included
instability after an aborted suspend attempt or power/sleep buttons not
being enabled.


118783 11-Aug-2003 njl

Style cleanups to match the rest of this directory. For acpi_battery.c,
remove unused includes.


118642 08-Aug-2003 njl

Default to 5 seconds before sleeping to give some machines time to stabilize.
This doesn't break anything on my laptop and some claim it helps them.


118607 07-Aug-2003 jhb

Consistently use the BSD u_int and u_short instead of the SYSV uint and
ushort. In most of these files, there was a mixture of both styles and
this change just makes them self-consistent.

Requested by: bde (kern_ktrace.c)


118216 30-Jul-2003 njl

Add and document the hw.acpi.ec.poll_timeout tunable.


118049 26-Jul-2003 takawata

Enable wake up GPE before shutdown, not only for sleeping.


118018 25-Jul-2003 njl

Add an informational debugging printf of the maximum time spent in
EcEventWait(). If you get AE_HARDWARE_NO_RESPONSE errors, please enable
this info by setting hw.acpi.verbose=1 in loader.conf.


117810 20-Jul-2003 njl

Do not call acpi_MatchHid() for all probe cases since it accesses the
namespace. To compensate for it only being used in the !ECDT case, use
a more robust approach to indicate a device was probed via ECDT by setting
the private ivar to be &acpi_ec_devclass. Without the acpi_MatchHid() call
now, it might have been possible for a non-EC device to have had its magic
match our previous flag.

Pointed out by: takawata


117809 20-Jul-2003 njl

Close a race condition by passing status retrieved via a non-SCI call
to EcGpeQueryHandler on to any waiting threads through the softc. Similar
behavior was in the original version.

Also:
* Merge EcQuery into EcGpeQueryHandler to simplify locking
* Hold EcLock from the initial read of the CSR down to the wakeup or
until after the query command has been processed.
* ec_gpebit only needs to be a UINT8


117796 20-Jul-2003 njl

Clarify the ACPI shutdown messages.


117795 20-Jul-2003 njl

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


117699 17-Jul-2003 jhb

Fix a bogon in the previous commit. When suppressing multiple isab
devices, we have to allow for the case when the isab0 device is ourselves.

Tested by: markm


117649 15-Jul-2003 njl

Change the msleep part of EcWaitEvent to be a separate loop, fixing a
problem that for some very slow ECs (~6 ms occasionally) causes a
timeout. Also finish resource cleanup in the error case in attach.

Tested by: ume


117648 15-Jul-2003 njl

Remove old defines since they are no longer used.


117534 14-Jul-2003 marcel

Fix build breakage on ia64. The second argument of AcpiOsReadable()
and AcpiOsWritable() have type ACPI_SIZE and not UINT32.


117530 13-Jul-2003 njl

Update code to work with 0619 dist

* Use ACPI_BUFFER as the type for AcpiGetObjectInfo
* Remove AcpiEnableEvent/AcpiClearEvent for ACPI_EVENT_FIXED (power/sleep
buttons) as they are no longer needed
* Change calls to use the new GPE functions
* Add AcpiOs*Lock functions


117384 10-Jul-2003 njl

Rewrite much of the embedded controller driver.
* Always use polled mode. The intr approach did not work for many
controllers and required the hw.acpi.ec.event_driven workaround.
* Only use an edge (not level) triggered GPE handler
* Add sc->ec_mtx for locking operations to a single EC. There were
many race conditions earlier between an SCI event and EcRead/Write.
* Use 1 ms as the global lock timeout
* Only acquire global lock if _GLK != 0
* Update EcWaitEvent to use an incremental backoff delay in its
poll loop. Wait 50 ms max instead of 10. Most ECs respond
in < 5 us (50 us when heavily loaded). However, some time out
occasionally even with a 10 ms timeout. For delays past 1 ms, use
msleep instead of DELAY to give SCI interrupts a chance to occur.
* Add EcCommand to send a command and wait for the appropriate event.
* The hw.acpi.ec.event_driven tunable is no longer applicable and
has been removed.

Ideas from: Linux


117358 09-Jul-2003 jhb

- Fix a typo in the call to acpi_disabled() in probe() by removing an
extra trailing space.
- Don't bother probing a generic ISA bus device if isab0 already exists.
Some BIOSes place an ACPI psuedo-device with the HID of a generic ISA bus
device under the PCI-ISA bridge device. This is not the best solution
but will work for now. The isa bus driver only allows for one ISA bus
anyways.


117339 08-Jul-2003 jhb

Add an ACPI to ISA psuedo bridge driver. It attaches an isab(4) device to
ACPI nodes with the plug and play ID's defined for a "Generic ISA Bus
Device" as defined in section 10.7 of the ACPI 2.0 specification. This
gives machines like the Libretto that contain a fake ISA bus that is not
connected via a PCI-ISA bridge an ISA bus for ISA devices to attach to.

Tested by: markm


117167 02-Jul-2003 jhb

- Use the new resource_disabled() helper function to see if devices are
disabled.
- Change the apm driver to match the acpi driver's behavior by checking to
see if the device is disabled in the identify routine instead of in the
probe routine. This way if the device is disabled it is never created.

Note that a few places (ips(4), Alpha SMP) used "disable" instead of
"disabled" for their hint names, and these hints must be changed to
"disabled". If this is a big problem, resource_disabled() can always be
changed to honor both names.


117115 01-Jul-2003 tmm

Add a new PCI interface method, assign_interrupt, to determine the
interrupt to be used for a device. This is intended solely for internal
use of PCI bus implementations, and exists so that PCI bus drivers
implementing special interrupt assignment methods which require
additional work at the bus level to work right can be easily derived
from the generic driver (or any other one) without resorting to hacks.

It will be used in the sparc64 ofw_pcibus driver, which will be
committed shortly.

Make use of this method in the generic implementation, and add it to
the method table of bus drivers derived from the PCI one.

Reviewed by: imp, -hackers


116927 27-Jun-2003 njl

Whitespace cleanups (verified with MD5 1832ce5ede6c58c844dfb53fd48f0eea).
Also clarify a macro expansion with an XXX. I will be fixing access to
Acpi Global Lock in a subsequent commit.


115427 31-May-2003 peter

Add the MD ifdefs for amd64 to point to the IO space bustag/handle.

Approved by: re ("safe" amd64 support)


114977 13-May-2003 jhb

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

Approved by: re (rwatson/bmah)


114949 12-May-2003 njl

Move some printfs under bootverbose since they are not true errors.

Approved by: re (bmah)


114442 01-May-2003 jhb

Catch up to reworked debugging levels in latest Intel import.


114277 30-Apr-2003 marcel

o Don't announce that the timer is good when in fact it isn't timing
at all (ie reads yield constant values). Display the width as the
difference between max and min so that constant timers have width
zero.
o Get the address of the timer from the XPmTmrBlk field instead of
the V1_PmTmrBlk field. The former is a generic address and can
specify a memory mapped I/O address. Remove <machine/bus_pio.h>
to account for this. The timer is now properly configured on
machines with ACPI v2 tables, whether PIO or MEMIO. Note that
the acpica code converts v1 tables into v2 tables so the address
is always present in XPmTmrBlk.
o Replace the TIMER_READ macro with a call to the read_counter()
function and add a barrier to make sure that we observe proper
ordering of the reads.


114246 29-Apr-2003 njl

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


113366 11-Apr-2003 iwasaki

Add new sysctl MIB (hw.acpi.supported_sleep_state) to indicate
the list of supported sleep state.
This should help people understand what following message means.

acpi0: AcpiGetSleepTypeData failed - AE_NOT_FOUND

MFC after: 3 days


112581 25-Mar-2003 jake

Fix 2 vm_offset_t -> vm_paddr_t missed in previous commit.

Sponsored by: DARPA, Network Associates Laboratories


111948 06-Mar-2003 takawata

Add integer value of _CID handling.
If _CID is string, it will need more complicated
handling to distinguish bus other than ISA.

Submitted by: Paul Wankadia <junyer@gmx.net>


111815 03-Mar-2003 phk

Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by: re(scottl)


111750 02-Mar-2003 phk

Use canonical form for cdevsw initialization.


111056 17-Feb-2003 imp

Move the pnp and location info into the common pci bus. Make all known
pci busses implement this.

Also minor comment smithing in cardbus. Fix copyright to this year
with my name on it since I've been doing a lot to this file.

Reviewed by: jhb


110894 15-Feb-2003 takawata

Allow non-privilaged user to retrive battery or AC line information.

Reviewed by: rwatson


109760 23-Jan-2003 njl

More useful announce message containing current speed of CPU


109247 14-Jan-2003 njl

For the cpu throttling message, s/enabled/available

Requested by: many


108533 01-Jan-2003 schweikh

Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.


108345 28-Dec-2002 rwatson

Change ACPI make_dev() calls to use UID_ and GID_ constants rather
than hard-coded uids and gids.

Switch the device to a group of wheel instead of operator.

Narrow down the permissions on the device to require root privilege
to manipulate the system power state. It may be that we can broaden
access to the device after review of the access control in ACPI.

Submitted by: kris
Reviewed by: takawata


108196 23-Dec-2002 marcel

Fix a De Morgan bug: If we only expect a memory range OR an
I/O port range, then we should ignore a resource if it's NOT
a memory range AND NOT an I/O port range.
The OR in the condition caused us to ignore perfectly valid
memory addresses.

While here, remove redundant parenthesis and reindent the
debug print to avoid long lines.


107753 11-Dec-2002 takawata

Add sysctl knob to stop disabling acpi on shutdown.

Approved by: re(jhb)


107328 27-Nov-2002 iwasaki

Resolve conflicts arising from the ACPI CA 20021118 import.


107307 27-Nov-2002 iwasaki

Disable debug output from acpi_pci_link.
There were no serious problem reports on this in spite of my concern.

To get debug output from acpi_pci_link, just enable bootverbose flag
in usual manner (boot -v).

Approved by: re


107249 25-Nov-2002 jhb

- Assume a bus number of zero if evaluating _BBN fails, not if it succeeds.
This was effectively rendering _BBN useless.
- Cleanup handling of the busok variable a bit.

Submitted by: marcel (1)
Approved by: re (rwatson)


107199 24-Nov-2002 iwasaki

Add `if (!cold)' checkings for functions which is called via SYSINIT.
Loading acpi.ko with kldload is disallowed, however some
functions were executed unexpectedly.

Approved by: re


107173 22-Nov-2002 jhb

According to the ACPI spec, the bus number of the child PCI bus of a host
to PCI bridge can be read be evaluating the _BBN method of the host to PCI
device. Unfortunately, there appear to be some lazy/ignorant/moronic/
whatever BIOS writers that return 0 for _BBN for all host to PCI bridges in
the system. On a system with a single host to PCI bridge this is not a
problem as the child bus of that single bridge will be bus 0 anyway.
However, on systems with multiple host to PCI bridges and l/i/m/w BIOS
writers this is a major problem resulting in all but the first host to
PCI bridge failing to attach. So, this adds a workaround.

If the _BBN of a host to PCI bridge is zero and pcib0 already exists
and is not us, the we use _ADR to look up our PCI function and slot
(we currently assume we are on bus 0) and use that to call
host_pcib_get_busno() to try and extract our bus number from config
registers on the host to PCI bridge device. If that fails, then we make
an evil assumption that ACPI's _SB_ namespace lays out the host to PCI
bridges in ascending order and use our pcib unit number as our bus
number.

Approved by: re


106377 03-Nov-2002 iwasaki

Add status initialization code for acpi_cmbat and acpi_acad,
acpi_cmbat_init_battery() and acpi_cmbat_init_acline() respectively.
Call acpi_cmbat_init_battery() from acpi_cmbat_resume() too just in
case.
This is a workaround for embedded controller operations which is
unstable for about a minute (typically 30 or 40 sec.) at boot time.


106262 31-Oct-2002 iwasaki

Don't examine ACPI_STA_ENABLE bit of device's_STA object on initial
state. Instead, use ACPI_STA_PRESENT and ACPI_STA_FUNCTIONAL for it.
In some ACPI BIOS implementations, boot disabled devices don't have
ACPI_STA_ENABLE bit in _STA object.
Also it is not fatal if getting current IRQ of boot disabled devices
is failed in initial state.

And minor fixes.


106261 31-Oct-2002 iwasaki

Interpret new loader tunable "hw.acpi.verbose" to turn
verbose mode on at boot time.


106255 31-Oct-2002 iwasaki

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.


106158 29-Oct-2002 jhb

Add a missing newline to the end of a device_printf().

Reported by: Michael G. Petry <petry@NetMasters.Com>


105857 24-Oct-2002 iwasaki

Add new loader tunable hw.acpi.ec.event_driven so that we control
EcWaitEventIntr()'s behavior.
Some EC controllers require this for working properly (including
sleep/wakeup).


105282 16-Oct-2002 jhb

Catch up to changes in acpivar.h to add support for using ACPI on
4-stable systems.

Sponsored by: The Weather Channel


105281 16-Oct-2002 jhb

struct timecounter is defined in sys/time.h on 4-stable.

Sponsored by: The Weather Channel


105280 16-Oct-2002 jhb

- 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


105279 16-Oct-2002 jhb

- In AcpiOsGetThreadId(), allow for curproc to be NULL on 4-stable systems.
In that case use proc0's pid to return the thread ID.
- For 4-stable, use the generic swi taskqueue for ACPI events rather than
implementing our own.

Sponsored by: The Weather Channel


105278 16-Oct-2002 jhb

Implement the internal locks of an ACPI semaphore with splhigh() on
4-stable. -current uses a mutex for this purpose.

Sponsored by: The Weather Channel


105259 16-Oct-2002 iwasaki

Fix a possible bug about freeing non-malloc'ed pointer.

Suggested by: jhb (in -current ML)


104727 09-Oct-2002 jhb

Use d_thread_t for cdevsw functions instead of struct thread * so that it
is easier to share this code with 4-stable.


104726 09-Oct-2002 jhb

Include <dev/acpica/acpivar.h> instead of <acpica/acpivar.h> like all the
other sys/dev/acpica files.


104677 08-Oct-2002 jhb

Don't panic for a bad ivar request, just return ENOENT.


104496 05-Oct-2002 iwasaki

Make sure that ACPI PCI driver probe routine call pci_cfgregopen()
before start accessing PCI config space.

Reviewed by: jhb


104495 05-Oct-2002 iwasaki

Oops, forgot to add main file for my previous commit :-)


104494 05-Oct-2002 iwasaki

Add code for ACPI PCI link object manipulation.
This allocate the best IRQ to boot-disable devices (have IRQ 0).
Allocated IRQ will be used for PCI interrupt routing when ACPI is
enabled.

Note that verbose messaging enabled for the time being so that
people can easily notice the strange behavior if it happened.


104432 04-Oct-2002 peter

Oops, missed this one. Fix a printf format error on 64 bit systems
where sizes are long instead of int.


104431 04-Oct-2002 peter

Fix printf format errors on 64 bit systems where sizes are long
instead of just int.


104430 04-Oct-2002 peter

Display the name of the acpi node that we do not find the pci interrupt
routing table for.


104354 02-Oct-2002 scottl

Some kernel threads try to do significant work, and the default KSTACK_PAGES
doesn't give them enough stack to do much before blowing away the pcb.
This adds MI and MD code to allow the allocation of an alternate kstack
who's size can be speficied when calling kthread_create. Passing the
value 0 prevents the alternate kstack from being created. Note that the
ia64 MD code is missing for now, and PowerPC was only partially written
due to the pmap.c being incomplete there.
Though this patch does not modify anything to make use of the alternate
kstack, acpi and usb are good candidates.

Reviewed by: jake, peter, jhb


103869 23-Sep-2002 jhb

Now that we only probe host-PCI bridges once, we no longer have to check to
see if we have been probed before by checking for a pciX bus device.


103022 06-Sep-2002 jhb

Attach ACPI children a bit later in attach(), specifically after performing
any machine dependent initialization. This allows the MD code to set the
interrupt routing model so that PCI interrupts are routed correctly when
using an APIC or SAPIC for example.


103015 06-Sep-2002 jhb

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.


102977 05-Sep-2002 jhb

Make the printf messages when routing interrupts more consistent in the
various PCI bridge drivers.


102919 04-Sep-2002 jhb

- Make pci_load_vendor_data() static and do it during MOD_LOAD instead of
when the first PCI bus attaches.
- Create /dev/pci during MOD_LOAD as well.
- Destroy /dev/pci during MOD_UNLOAD (not that you can kldunload pci, but
might as well get the code right)


102918 04-Sep-2002 jhb

Use resource_list_print_types() instead of duplicating the code.


102612 30-Aug-2002 iwasaki

s/hint.acpi.0.disable/hint.acpi.0.disabled/

Fix device hints entry for disabling acpi(4).
This also should fix the arbitration with apm(4) when both drivers
are enabled.

Note that your /boot/device.hints needs to be updated if you want to
stop auto-loading acpi.ko or disable acpi(4).


102553 29-Aug-2002 iwasaki

Resolve conflicts arising from the ACPI CA 20020815 import.


102535 28-Aug-2002 iwasaki

Change default value of hw.acpi.sleep_delay to 0.
This caused problems (reset or lock up) at wakeup.


102470 27-Aug-2002 iwasaki

Fix a bug about the cooling system controlling in acpi_thermal driver.
Recent version of ACPI CA returns the package object which contains
object reference elements if the elements are named objects.
We need to be careful when you use acpi_ForeachPackageObject() in new
code...


102447 26-Aug-2002 jhb

Overhaul the ACPI PCI bridge driver a bit:
- Add an ACPI PCI-PCI bridge driver (the previous driver just handled
Host-PCI bridges) that is a PCI driver that is a subclass of the generic
PCI-PCI bridge driver. It overrides probe, attach, read_ivar, and
pci_route_interrupt.
- The probe routine only succeeds if our parent is an ACPI PCI bus which
we test for by seeing if we can read our ACPI_HANDLE as an ivar.
- The attach routine saves a copy of our handle and calls the new
acpi_pcib_attach_common() function described below.
- The read_ivar routine handles normal PCI-PCI bridge ivars and adds an
ivar to return the ACPI_HANDLE of the bus this bridge represents.
- The route_interrupt routine fetches the _PRT (PCI Interrupt Routing
Table) from the bridge device's softc and passes it off to
acpi_pcib_route_interrupt() to route the interrupt.
- Split the old ACPI Host-PCI bridge driver into two pieces. Part of
the attach routine and most of the route_interrupt routine remain in
acpi_pcib.c and are shared by both ACPI PCI bridge drivers.
- The attach routine verifies the PCI bridge is present, reads in
the _PRT for the bridge, and attaches the child PCI bus.
- The route_interrupt routine uses the passed in _PRT to route a PCI
interrupt.
The rest of the driver is the ACPI Host-PCI bridge specific bits that
live in acpi_pcib_acpi.c.
- We no longer duplicate pcib_maxslots but use it directly.
- The driver now uses the pcib devclass instead of its own devclass.
This means that PCI busses are now only children of pcib devices.
- Allow the ACPI_HANDLE for the child PCI bus to be read as an ivar
of the child bus.
- Fetch the _PRT for routing PCI interrupts directly from our softc
instead of walking the devclass to find ourself and then fetch our
own softc.

With this change and the new ACPI PCI bus driver, ACPI can now properly
route interrupts for devices behind PCI-PCI bridges. That is, the
Itanium2 with like 10 PCI busses can now boot ok and route all the PCI
interrupts. Hopefully this will also fix problems people are having with
CardBus bridges behind PCI-PCI bridges not properly routing interrupts
when ACPI is used.

Tested on: i386, ia64


102445 26-Aug-2002 jhb

Add an ACPI PCI bus driver that is a subclass of the generic PCI bus
driver. This driver overrides the probe, attach, and read_ivar methods.

If the parent bridge is an ACPI PCI bridge, then the probe routine will
match, otherwise it will fail. It tests this by seeing if it can get
the ACPI_HANDLE ivar from the bridge device.

In the attach routine, it uses pci_add_children() to add all the child
devices (but with a slightly larger ivar so it can store ACPI_HANDLE's
for child devices) and then walks through the ACPI namespace below the
bus device to cache ACPI_HANDLE's for all child devices present in the
namespace. It does this by comparing the pci slot and function to the
address encoded in _ADR of the devices in the ACPI namespace.

The read_ivar routine passes most requests off to pci_read_ivar()
and adds a new request so that the ACPI_HANDLE for a child device can
be read.

To add proper power support the power methods can be overridden as well,
but that is not currently implemented. Also, there are cases where a
device may show in the ACPI namespace as a PCI device that the PCI probe
does not find. Currently such devices are ignored.

Tested on: i386, ia64


102439 26-Aug-2002 jhb

In acpi_pcib_route_interrupt(), the code claims to check to see if a PCI
LNK device (interrupt source provider sort of) is present before using it,
but the code actually tested the status (_STA) of the PCI bridge device
doing the routing, not the actual LNK device. Fix it to check the status
of the LNK device.


102402 25-Aug-2002 iwasaki

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.


102222 21-Aug-2002 jhb

Use the _STA method of a battery control method to see if a battery is
present or not. My laptop now properly notices when a battery is removed.

Reviewed by: iwasaki


101763 12-Aug-2002 imp

don't include redunant \n in panic message


101560 09-Aug-2002 iwasaki

Fix wrong member variable ordering of struct acpi_bif.


100969 30-Jul-2002 iwasaki

Resolve conflicts arising from the ACPI CA 20020725 import.


100539 23-Jul-2002 iwasaki

Add NULL check for the output buffer from AcpiEvaluateObject().

Submitted by: jon


100497 22-Jul-2002 iwasaki

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.


99682 09-Jul-2002 iwasaki

Resolve conflicts arising from the ACPI CA 20020611 import.


99492 06-Jul-2002 iwasaki

Fix wrong use of ACPI_NO_UNIT_LIMIT which is for as_maxunits, not as_units.


99243 02-Jul-2002 takawata

Make interrupt driven EC transaction optional.


99149 30-Jun-2002 iwasaki

Resolve conflicts arising from the ACPI CA 20020404 import.


97274 25-May-2002 bde

Fixed printf format errors which apparently crept in while -Wformat was
disabled for gcc-3.


96947 19-May-2002 iwasaki

Terminate ACPI subsystem on reboot.
Some machines stuck on reboot if ACPI sleep/wakeup was executed.


96926 19-May-2002 peter

Brutally deal with __func__ being 'const char *' on gcc-3.1.


96277 09-May-2002 jhb

Fix acpi_avoid() to call freeenv() on the original char * returned from
getenv().

Reported by: joe
Tested by: joe


95814 30-Apr-2002 phk

Don't export timecounter structures under debug. with sysctl, they
contain no truly interesting data anymore.


95489 26-Apr-2002 phk

Remove the tc_update() function. Any frequency change to the
timecounter will be used starting at the next second, which is
good enough for sysctl purposes. If better adjustment is needed
the NTP PLL should be used.


95384 24-Apr-2002 mux

Don't call freeenv() on a modified pointer.

Submitted by: Alexander Kabaev <ak03@gte.com>
Reviewed by: phk
Pointy hat to: mux


95081 19-Apr-2002 mike

Fix compiling of acpica when debugging is enabled. In the previous
revision, two getenv()s were accidentally changed to use testenv().

Pointy hat to: mux


94936 17-Apr-2002 mux

Rework the kernel environment subsystem. We now convert the static
environment needed at boot time to a dynamic subsystem when VM is
up. The dynamic kernel environment is protected by an sx lock.

This adds some new functions to manipulate the kernel environment :
freeenv(), setenv(), unsetenv() and testenv(). freeenv() has to be
called after every getenv() when you have finished using the string.
testenv() only tests if an environment variable is present, and
doesn't require a freeenv() call. setenv() and unsetenv() are self
explanatory.

The kenv(2) syscall exports these new functionalities to userland,
mainly for kenv(1).

Reviewed by: peter


94168 08-Apr-2002 takawata

Print DRQ resource in boot message.


93818 04-Apr-2002 jhb

Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on: i386, alpha, sparc64


93093 24-Mar-2002 phk

Hide the ACPI counter probing printf behind bootverbose.

The conclusion is that this method really can tell the perfect from the
less than perfect ACPI counters.

It is in fact probably a bit more discriminative than that, but we
will rather condemn some otherwise perfect counters to the slightly
slower "-safe" version, than certify a counter as perfect which
will let us down later.

Many thanks to all the people who sent email reports!


92849 21-Mar-2002 msmith

Fix error introduced in the 20020217 update, where GetPossibleResources
was spammed with GetCurrentResources.

Submitted by: Munehiro Matsuda <haro@h4.dion.ne.jp>


92739 20-Mar-2002 alfred

Remove __P.


92666 19-Mar-2002 peter

Fix a gcc-3.1+ warning.
warning: deprecated use of label at end of compound statement

ie: you cannot do this anymore:
switch(foo) {
....

default:
}


92135 12-Mar-2002 dfr

Only i386 has wbinvd().


92120 12-Mar-2002 peter

Do not concatenate __func__ with strings, because it is not a string.
Later gcc's blow up on this.


92119 12-Mar-2002 peter

Do not do string concatenation with __func__ (which is not a string)


92118 12-Mar-2002 peter

Recent acpica imports have changed the lengths from UINT32 to ACPI_SIZE,
which is 64 bit on ia64. Fix it.


91640 04-Mar-2002 iwasaki

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


91237 25-Feb-2002 phk

Add a new test_counter() function which tries to determine the width of
the inter-value histogram for 2000 samples. If the width is 3 or less
for 10 consequtive samples, we trust the counter to be good, otherwise
we use the *_safe() method.

This method may be too strict, but the worst which can happen is that
we take the performance hit of the *_safe() method when we should not.

Make the *_safe() method more discriminating by mandating that the three
samples do not span more than 15 ticks on the counter.

Disable the PCI-ident based probing as a means to recognize good
counters.

Inspiration from: dillon and msmith


91215 25-Feb-2002 msmith

The thermal thread needs to take Giant before it does anything with the
interpreter.

Submitted by: Magnus B{ckstr|m <b@etek.chalmers.se>


91204 24-Feb-2002 dillon

Tests by numerous people have shown that many chipsets do not properly
latch the acpi timer, resulting in weird deltas. The problem is severe
enough to adversely effect the timecounter code.

Default to the 'safe' version of the get-timecount function. The probe
will override it if a known-good chipset is found. This is temporary
until a more complete solution is found.

Reviewed by: phk


91130 23-Feb-2002 msmith

AcpiOsPrintf and AcpiOsVprintf now return void.


91129 23-Feb-2002 msmith

AcpiOsCallocate is no longer required.


91128 23-Feb-2002 msmith

Match namespace cleanup changes in ACPI CA 20020217 update.


91127 23-Feb-2002 msmith

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

Fix a typo to be less appropriate.


91126 23-Feb-2002 msmith

Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Convert to using a kthread rather than timeout() to avoid problems
with the interpreter sleeping.


91125 23-Feb-2002 msmith

Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.


91124 23-Feb-2002 msmith

Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Use _ADR as well as _BBN to get our bus number.


91123 23-Feb-2002 msmith

Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.


91122 23-Feb-2002 msmith

Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.

The ACPI global lock acquire takes a timeout value. I'm not sure what
we should do about timeouts on it; a deadlock against this lock is
catastrophic.


91121 23-Feb-2002 msmith

Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Kill off the timeouts that used to read _BIF and _BST. These are
invoked when the battery is actually read. timeout() is dangerous
in combination with ACPI, as the interpreter can block.

This driver still needs more work.


91120 23-Feb-2002 msmith

Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Add AcpiBatteryIsPresent helper to determine whether a battery device
is inserted.

Add ACPI_ALL_DRIVERS to the list of debug layers, now that we own the
namespace for this.

Pr:


90014 31-Jan-2002 takawata

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.


90005 31-Jan-2002 takawata

Fix error handling.

PR:30665
Submitted by:TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp>


89088 08-Jan-2002 msmith

find_devclass -> devclass_find.


89054 08-Jan-2002 msmith

Staticise devclasses and some unnecessarily global variables.


88900 05-Jan-2002 jhb

Change the preemption code for software interrupt thread schedules and
mutex releases to not require flags for the cases when preemption is
not allowed:

The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent
switching to a higher priority thread on mutex releease and swi schedule,
respectively when that switch is not safe. Now that the critical section
API maintains a per-thread nesting count, the kernel can easily check
whether or not it should switch without relying on flags from the
programmer. This fixes a few bugs in that all current callers of
swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from
fast interrupt handlers and the swi_sched of softclock needed this flag.
Note that to ensure that swi_sched()'s in clock and fast interrupt
handlers do not switch, these handlers have to be explicitly wrapped
in critical_enter/exit pairs. Presently, just wrapping the handlers is
sufficient, but in the future with the fully preemptive kernel, the
interrupt must be EOI'd before critical_exit() is called. (critical_exit()
can switch due to a deferred preemption in a fully preemptive kernel.)

I've tested the changes to the interrupt code on i386 and alpha. I have
not tested ia64, but the interrupt code is almost identical to the alpha
code, so I expect it will work fine. PowerPC and ARM do not yet have
interrupt code in the tree so they shouldn't be broken. Sparc64 is
broken, but that's been ok'd by jake and tmm who will be fixing the
interrupt code for sparc64 shortly.

Reviewed by: peter
Tested on: i386, alpha


88808 02-Jan-2002 msmith

If the CLK_VAL register is 0 bits wide, the system does not support
CPU throttling, so don't do some bogus math to check it.


88470 25-Dec-2001 iwasaki

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


88420 22-Dec-2001 iwasaki

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.


87566 09-Dec-2001 iwasaki

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.


87134 30-Nov-2001 iwasaki

Add a couple of minor changes.
- set sc->acpi_s4bios to 1 by default for hibernation until
OS-initiated S4 transition is implemented.
- change the behavior of acpi_sleep_state_sysctl() if new value is
the same as old one, do nothing instead of EINVAL.


87055 28-Nov-2001 iwasaki

Yet another synch with minor changes in the ACPI CA 20011120 snapshot.
We need to call AcpiEnterSleepStatePrep() before AcpiEnterSleepState().


87036 28-Nov-2001 msmith

Synch with minor changes in the ACPI CA 20011120 snapshot.


86802 23-Nov-2001 iwasaki

Validate requested sleep state in acpi_SetSleepState() to avoid reentry
during wakeup procedure.


86786 22-Nov-2001 iwasaki

Add disabling code via the debug.acpi.disable environment variable.


86552 18-Nov-2001 iwasaki

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.


86401 15-Nov-2001 iwasaki

Fix re-enabling ACPI on wakeup from hibernation. The problem was that
acpi_Disable() cleared all GPE events.
Some old ACPI implementaions still need current re-enabling code.


86399 15-Nov-2001 iwasaki

Two minor changes.
- Change _ACx sysctl oid from ten of _AC[0-9] to one _ACx.
- Better error printing on _TMP evaluation.

Reviewed by: msmith


86398 15-Nov-2001 iwasaki

Remove "S4B" from sleep_state_names and add "NONE" instead.
Now you can say;
# sysctl hw.acpi.lid_switch_state=NONE
instead of specifying unsupported _Sx object in the system.

Actually, S4B is going to disappear in ACPICA and we already have
hw.acpi.s4bios to distinguish BIOS hibernation or OS hibernation.


86133 06-Nov-2001 iwasaki

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.


86083 05-Nov-2001 iwasaki

Remove unnecessary WAK_STS bit waiting code for S1 sleep.
It was duplicated with AcpiEnterSleepState() since acpica-unix-20010816.


85846 01-Nov-2001 iwasaki

Oops, deleted wrong BIF acquisition timeout invocation by mistake
in my previous commit.
acpi_cmbat_get_bif() from taskqueue calls acpi_cmbat_timeout() so it's
better for startup.


85835 01-Nov-2001 iwasaki

Some fix for the recent apm module changes.
- Now that apm loadable module can inform its existence to other kernel
components (e.g. i386/isa/clock.c:startrtclock()'s TCS hack).
- Exchange priority of SI_SUB_CPU and SI_SUB_KLD for above purpose.
- Add simple arbitration mechanism for APM vs. ACPI. This prevents
the kernel enables both of them.
- Remove obsolete `#ifdef DEV_APM' related code.
- Add abstracted interface for Powermanagement operations. Public apm(4)
functions, such as apm_suspend(), should be replaced new interfaces.
Currently only power_pm_suspend (successor of apm_suspend) is implemented.

Reviewed by: peter, arch@ and audit@


85738 30-Oct-2001 iwasaki

Style(9) fix, mainly white spaces.


85729 30-Oct-2001 iwasaki

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.


85699 29-Oct-2001 iwasaki

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


85560 26-Oct-2001 jhb

- Change the taskqueue locking to protect the necessary parts of a task
while it is on a queue with the queue lock and remove the per-task locks.
- Remove TASK_DESTROY now that it is no longer needed.
- Go back to inlining TASK_INIT now that it is short again.

Inspired by: dfr


85556 26-Oct-2001 iwasaki

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


85521 26-Oct-2001 jhb

Add locking to taskqueues. There is one mutex per task, one mutex per
queue, and a mutex to protect the global list of taskqueues. The only
visible change is that a TASK_DESTROY() macro has been added to mirror
the TASK_INIT() macro to destroy a task before it is free'd.

Submitted by: Andrew Reiter <awr@watson.org>


85503 25-Oct-2001 jhb

Use TASK_INIT to initialize taskqueue task instead of violating the
abstraction.

Submitted by: Andrew Reiter <arr@watson.org>


85387 23-Oct-2001 jhb

Allow hw.acpi.cpu.{economy,performance}_speed to be set from the loader
via tunables.


85325 22-Oct-2001 iwasaki

Reduce frequency of Battery info (_BIF) acquisition. This helps
avoiding EC read errors on some laptops.
- Stop updating Battery info for all user requests
- Update Battery info by notify events and resume method
- Poll Battery info every one minute

Suggested by: takawata


84811 11-Oct-2001 jhb

Add missing includes of sys/lock.h.


84630 07-Oct-2001 dfr

Make the interrupt routing a bit less chatty unless bootverbose is set.


84575 06-Oct-2001 peter

Fix some 64-bit uncleanliness.


84574 06-Oct-2001 peter

Fix some style bugs before fixing some real bugs.


84573 06-Oct-2001 peter

Fix a stack trashing bug when int != sizeof(pointer)
This fixes the ia64 boot! We have scsi disks!


84500 04-Oct-2001 msmith

Update usage of AcpiEnableEvent to reflect a new argument.

Fix acpi_DeviceIsPresent to check for valid _STA data and to check
the "present" and "functioning" bits.

Use acpi_DeviceIsPresent in acpi_pcib rather than rolling our own
(also broken) version.


84446 04-Oct-2001 dfr

Add busspace hacks for ia64.


84445 04-Oct-2001 dfr

Use return_PTR, not return_VALUE when returning pointers.


84444 04-Oct-2001 dfr

Check the compatible ID as well as the hardware ID in acpi_MatchHid.


83581 17-Sep-2001 iwasaki

Call acpi_DeviceIsPresent() only for devices. This should make
non-ACPI_TYPE_DEVICE devices (such as acpi_tz and acpi_cpu) enabled
again.

Reviewed by: msmith


83491 15-Sep-2001 msmith

Disable devices that are not present; at a later stage we can then enable
them if the device arrives.

This should solve the problem where devices that have been disabled eg. in
the BIOS show up with nonsense resources and hang the bootstrap process.


83366 12-Sep-2001 julian

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


83218 08-Sep-2001 iwasaki

Don't call tsleep from AcpiOsStall(), call DELAY() always instead.
Process switching during calling AcpiOsStall() caused fatal trap 12 at
sleeping/wakeup on some machines.


83183 07-Sep-2001 msmith

Should check debug.acpi.avoid, not .disable.


83180 07-Sep-2001 msmith

Allow the ACPI subsystem to be disabled with a hint.

Avoid fully initialising the ACPI namespace if we are attempting to avoid
parts of it. This is a workaround for some systems that still crash
the interpreter.

Implement the ISA_IVAR_LOGICALID for ISA compatibility. Implement stubs
for other PnP ID-related ivars.


83179 07-Sep-2001 msmith

Move OsdEnvironment.c into MD code; searching for the ACPI tables is not
portable.


83173 06-Sep-2001 msmith

Initialise the adapter status to an invalid state, so that the initial check
of the adapter object will always result in a change event.

This fixes the problem where a laptop booted without an AC adapter ran
at 100% CPU speed by default.

Submitted by: "Christopher N . Harrell" <cnh@netvmg.com>


83169 06-Sep-2001 jhb

Add a hack to acpi_EvaluateInteger() to handle the case of a method
returning a Buffer that contains an Integer rather an an Integer directly.

Submitted by: msmith
Approved by: msmith


83164 06-Sep-2001 msmith

Allocate system resource IRQs as shareable; this is the typical case.


82967 04-Sep-2001 iwasaki

Just print a message in acpi_tz_monitor() only when new active state
is different from the previous active state.
This reduce tons of 'acpi_tz0: _AC0: temperature 64.0 >= setpoint 64.0'
messages.

Reviewed by: msmith


82779 02-Sep-2001 iwasaki

Fix typo; CTLFLAG_RO -> CTLFLAG_RD.


82765 01-Sep-2001 msmith

Add a MODULE_VERSION declaration. This should prevent duplicate loading
of the module, and allows other modules to depend on and link against
the ACPI module.

Add a sysctl that allows us to retrieve the ACPI CA version number as
well.


82704 31-Aug-2001 msmith

Don't claim memory resources owned by a PNP0C01 device ("system memory")
as some systems claim the entire physical address space is owned by it.


82667 31-Aug-2001 msmith

Don't activate placeholder resources; it can be very expensive in the
SYS_RES_MEMORY case, and it shouldn't be necessary.


82630 31-Aug-2001 takawata

Call OS-independent resume routine to execute _WAK .. etc.
This should also recover GPE bit,comment says, though not implemented yet.


82537 30-Aug-2001 msmith

Add support for attaching PnP-aware ISA drivers to ACPI.

Always parse ACPI device resource settings (current resources only)
and attach the resources to the device before probe/attaching.


82536 30-Aug-2001 msmith

Retarget the resource parser slightly. We only fetch current resources
for the device now (we should really just be parsing a passed-in resource
buffer).

Wrap long lines so this is (more) readable.

Support Address16 and Address32 resources, in the CONSUMER case.

Support DRQs so that we can handle ISA devices.

Support ExtendedIrqs (we ignore most of their attributes)

Add a placeholder device for system memory and system resources. This
takes the place of the nexus placeholder, which only attaches to ISA.


82535 30-Aug-2001 msmith

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


82534 30-Aug-2001 msmith

Don't parse our resources ourself, the ACPI core code must do it.


82533 30-Aug-2001 msmith

Nuke the (fairly bogus) attachment of *all* ACPI devices to ISA.


82532 30-Aug-2001 msmith

Add missing acpi_disabled() call so that this driver can be disabled.


82372 26-Aug-2001 msmith

Updates to match the ACPI CA 20010816 import:

- New debug macro (ACPI_DEBUG_PRINT), reducing debug-case code size.
- New debug level/subsystem codes.


82084 21-Aug-2001 iwasaki

Fix error checking about device state transition from D0 to D3.
Turn off the resources listed in _PR0 to go to D3 if we don't have _PR3/_PS3.

Reviewed by: msmith


82043 21-Aug-2001 msmith

Remove noisy printfs from the notify handler; having these go off
every couple of seconds is not useful.


81172 05-Aug-2001 msmith

The Intel 440MX ACPI timer seems to work properly, so add it to the list
here. Restructure slightly so that adding more devices is easier.

Submitted by: Jose Gabriel J Marcelino <gabriel@maquina.com>


81096 03-Aug-2001 msmith

Reverse the logic here again with regards to "trusted" ACPI timer
implementations. More of them seem to be broken, so only "trust"
timers we know work.


81093 03-Aug-2001 msmith

Shoud build resources in the _CRS buffer. Oops.

Submitted by: "neckpain@nettaxi.com" <neckpain@nettaxi.com>


81092 03-Aug-2001 msmith

Move the resource pointer when we reallocate the buffer.

Submitted by: "neckpain@nettaxi.com" <neckpain@nettaxi.com>


80605 30-Jul-2001 msmith

The current resource buffer returned from an interrupt link device
in the case where there are no interrupts routed for it does not
contain enough space to use it to route an interrupt. In the case
where we need to route an interrupt, throw away the returned buffer
and create a new one containing the interrupt we want.


80604 30-Jul-2001 msmith

- 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.


80602 30-Jul-2001 msmith

Minor updates (no functional changes)

- Remove the beer-ware license (reqested by phk)
- Reorganise so that the PIIX4 workaround code is kept together, and
switch the workaround function via the timecounter struct, saving
a compare in the read-timecounter codepath. Also indicate that
the workaround is active by changing the timecounter hardware string.


80442 27-Jul-2001 msmith

The ACPI timer register corruption problem is resolved in the PIIX4
starting with the PIIX4M. Restrict enabling the workaround to those
chips known to be buggy.


80335 25-Jul-2001 iwasaki

Better checking of duplicated interrupt handler installation.

Reviewed by: msmith


80334 25-Jul-2001 iwasaki

Some minor fixes.
- Set system power profile only when AC-line status has canged.
- Get initial AC-line status after whole system is up.

Reviewed by: msmith


80160 22-Jul-2001 iwasaki

Don't do sleep state transition if specified sleep state is not
supported by the system.


80078 21-Jul-2001 msmith

Convert from acpi_strerror() to AcpiFormatException()

Fix dangling include of the dear departed acpi_ecreg.h


80071 21-Jul-2001 msmith

Update the OSD module to match the ACPI CA 20010717 import.

Submitted by: "Grover, Andrew" <andrew.grover@intel.com> (OsdHardware.c)


80070 21-Jul-2001 msmith

Implement a "proper" timecounter hung off the ACPI timer device.

This code is based on the mp_clock code by phk. It attempts to
detect the PIIX4 (see comments for details) and use a workaround
for its problems.

This code is experimental, and could use some testing and review by a
timekeeping enthusiast.


80069 21-Jul-2001 msmith

Merge the EC register definitions into the EC module proper, they're not
used anywhere else.

AcpiOsSleepUsec() -> AcpiOsStall()


80068 21-Jul-2001 msmith

Use our saved copy of the FADT rather than fetching it again.


80067 21-Jul-2001 msmith

Don't call ourselves a "control method" anything, that's not useful.

Move the "button pressed" diagnostics to the point where we can print
out which button was actually pressed.


80066 21-Jul-2001 msmith

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).


80034 20-Jul-2001 msmith

We haven't used this for ages, and we're not going to either.


80028 20-Jul-2001 takawata

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

Reviewed by:iwasaki


79493 09-Jul-2001 msmith

Whoops; we get an ACPI_OBJECT back from evaluating a method, not
an ACPI_OPERAND_OBJECT. Fix this so that the power resource type
can be properly checked, and we can get the system level and
resource order.


79409 07-Jul-2001 msmith

Nuke the ACPI APIC driver. The ACPI CA infrastructure it depended on
is gone, and it's not coming back, and the whole driver needed to be
rethrought to deal with a major chicken-and-egg consideration.


79401 07-Jul-2001 iwasaki

Fix typo in acpi_cpu_attach() and correct range checking in
acpi_cpu_speed_sysctl().


79388 07-Jul-2001 msmith

Kill the old processor driver; the ACPI CA functions it depended on
are not coming back any time soon. Implement a new 'acpi_cpu' driver
with support for CPU throttling and power policies.


79387 07-Jul-2001 msmith

Add acpi_GetTableIntoBuffer, to aid in fetching tables.


79386 07-Jul-2001 msmith

Get the ACPI softc before we potentially dereference it.


79385 07-Jul-2001 msmith

Quiet the complaint about the _SCP method if it doesn't exist; it's
not mandatory.


79384 07-Jul-2001 msmith

Oops, have to use AcpiSetCurrentResources, not invoke the _SRS method
directly.


79375 07-Jul-2001 msmith

Add support for user-requested override of cooling levels.

Monitor the system power profile, and use _SCP to adjust thermal zones
accordingly.

Simplify the behaviour of the timeout routine, and add some temporary
debugging.


79374 07-Jul-2001 msmith

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


79372 07-Jul-2001 msmith

Support for system "power profiles". Currently we support two profiles;
"economy" and "performance".


79357 06-Jul-2001 msmith

This was only half-implemented when I committed it, and certainly didn't
work. Now it's implemented and seems to work.


79285 05-Jul-2001 msmith

Improve some error messages slightly.


79284 05-Jul-2001 msmith

Implement PCI interrupt routing using the ACPI data attached to the
PCI bus object. This should deal both with already-routed interrupts
as well as devices that need an interrupt routed.

Note that it *doesn't* deal with interlocked interrupt dependancies, nor
does it select between interrupt options in a smart way. These are
optimisations that need further work.


79283 05-Jul-2001 msmith

Fix a couple of misunderstandings in the monitor code. Passive cooling
is a parallel adjunct to active cooling, not a lesser evil. The _ACx
levels sort from 0 being hottest, not coolest.

Sanity check the returned temperature values, since we are having
trouble reading them on some systems.

Rearrange sysctl nodes a bit; this is probably close to the final layout.


79282 05-Jul-2001 msmith

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

Move the ACPI generic battery code into a new file.


79000 29-Jun-2001 msmith

Wrap the interrupt handler so that we can get the ACPI lock.


78999 29-Jun-2001 msmith

Add ACPI lock support.

Pass the softc, not the device_t to the Notify handler.

Don't invoke the Interpreter from callout context, as it may sleep.
Use AcpiOsQueueForExecution, which is called from taskqueue_swi.


78994 29-Jun-2001 msmith

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


78993 29-Jun-2001 msmith

Update for new debug layer constant names in the ACPI CA 20010615
import.


78992 29-Jun-2001 msmith

Use msleep() when we sleep waiting for a GPE, since we are holding the
ACPI mutex.

Add some comments to EcWaitEventIntr.

Clean up deviant style, add debugging to be consistent.


78991 29-Jun-2001 msmith

Update to synch with the 20010615 ACPI CA import.

Add an ACPI subsystem mutex, and macros for handling it. Because it's
not possible to differentiate between ACPI CA acquiring mutexes for
internal use and for use by AML, and because AML in the field doesn't
handle mutexes correctly, we can't use the ACPI subsystem's internal
locking. In addition, we have other private data of our own to lock.

Add initial locking to the ACPI driver code and the thermal module.
These locks are currently inoperative.

Pull some errant style back into line.


78915 28-Jun-2001 msmith

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.


78690 24-Jun-2001 iwasaki

Reset timestamps of battery info. and status by thier notify handler.

Suggested by: takawata


78689 24-Jun-2001 iwasaki

- Swap order of "S4B" and "S5" in sleep_state_names. They already
changed in ACPICA actypes.h.
- Use ACPI_S_STATES_MAX instead of ACPI_STATE_S5.


78662 23-Jun-2001 iwasaki

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


77466 30-May-2001 msmith

What I get for "fixing" at the last minute. Correct a mis-merge of takawata's
timeout fix and put proc.h into the right file.

Submitted by: nnd@mail.nsk.ru


77432 29-May-2001 msmith

- 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).


76166 01-May-2001 markm

Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by: bde (with reservations)


75100 02-Apr-2001 jhb

Remove bogus block device major now that bdev majors are gone.


74914 28-Mar-2001 jhb

Catch up to header include changes:
- <sys/mutex.h> now requires <sys/systm.h>
- <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>


73962 07-Mar-2001 iwasaki

Bring our local hack for wakeup back from
sys/contrib/dev/acpica/Subsystem/Hardware/Attic/hwxface.c to the proper
location after AcpiEnterSleepState().

- Wait for the WAK_STS bit
- Evaluate the _WAK method and check result code


73108 26-Feb-2001 jhb

Properly protect the parameters to the EC_{GET,SET}_{DATA,CSR} macros with
parens.


73107 26-Feb-2001 jhb

- Use a loop to read consecutive bytes from the embedded controller to
handle read and write requests for widths of multiple bytes. This
can be used to read 16-bit battery status registers for example.
- Remove some unused variables and #if 0'd debugging cruft.
- Don't complain about a GPE query that fails due to AE_NOT_FOUND if the
query method was _Q00.


73106 26-Feb-2001 jhb

When ensuring the destination buffer is truncated for a string obtained
from a BIF, use the size of the destinatino buffer, not the length of the
string to determine where to put the nul char. As a side effect, the
old code would truncate the string by one character while it was possibly
overflowing the buffer.


72376 12-Feb-2001 jake

Implement a unified run queue and adjust priority levels accordingly.

- All processes go into the same array of queues, with different
scheduling classes using different portions of the array. This
allows user processes to have their priorities propogated up into
interrupt thread range if need be.
- I chose 64 run queues as an arbitrary number that is greater than
32. We used to have 4 separate arrays of 32 queues each, so this
may not be optimal. The new run queue code was written with this
in mind; changing the number of run queues only requires changing
constants in runq.h and adjusting the priority levels.
- The new run queue code takes the run queue as a parameter. This
is intended to be used to create per-cpu run queues. Implement
wrappers for compatibility with the old interface which pass in
the global run queue structure.
- Group the priority level, user priority, native priority (before
propogation) and the scheduling class into a struct priority.
- Change any hard coded priority levels that I found to use
symbolic constants (TTIPRI and TTOPRI).
- Remove the curpriority global variable and use that of curproc.
This was used to detect when a process' priority had lowered and
it should yield. We now effectively yield on every interrupt.
- Activate propogate_priority(). It should now have the desired
effect without needing to also propogate the scheduling class.
- Temporarily comment out the call to vm_page_zero_idle() in the
idle loop. It interfered with propogate_priority() because
the idle process needed to do a non-blocking acquire of Giant
and then other processes would try to propogate their priority
onto it. The idle process should not do anything except idle.
vm_page_zero_idle() will return in the form of an idle priority
kernel thread which is woken up at apprioriate times by the vm
system.
- Update struct kinfo_proc to the new priority interface. Deliberately
change its size by adjusting the spare fields. It remained the same
size, but the layout has changed, so userland processes that use it
would parse the data incorrectly. The size constraint should really
be changed to an arbitrary version number. Also add a debug.sizeof
sysctl node for struct kinfo_proc.


72200 09-Feb-2001 bmilekic

Change and clean the mutex lock interface.

mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)


71876 31-Jan-2001 msmith

Add some debugging.

Turn off semaphores. Nobody else implements them, and there is lots of
AML out there which does totally absurd things with them, meaning that
if we try to do the right thing we are guaranteed to fail.


71875 31-Jan-2001 msmith

Add some debugging statements.


71874 31-Jan-2001 msmith

Tidy up.

Don't print temperatures at attach time - they're usually wrong.

Use acpi_EvaluateInteger instead of doing things the hard way.


71873 31-Jan-2001 msmith

Add some debugging.

Use acpi_EvaluateInteger where possible.

Use FuncName rather than &FuncName when passing function addresses.

Don't evaluate the _REG method when we attach to an address space -
AcpiInstallAddressSpaceHandler does it for us.


71872 31-Jan-2001 msmith

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.


71462 23-Jan-2001 jhb

Axe unused local variable.


71461 23-Jan-2001 jhb

- Mark an unused function with __unused.
- Temporarily #if 0 some unused local variables.


71460 23-Jan-2001 jhb

Axe an unused static softc.


71459 23-Jan-2001 jhb

Move a temporary #ifdef of code (just the #ifdef part) up so that it is
above the local variable declaration to quiet warnings about unused
variables.


71418 23-Jan-2001 peter

In answer to the comment: /* XXX is it OK to block here? */, the answer
is definately NO! as we are in interrupt context and malloc() does a
KASSERT() to be sure.


71359 22-Jan-2001 msmith

Plug a memory leak in AcpiOsDeleteSemaphore where the mutex is not properly
destroyed.

Submitted by: bmilekic


71001 13-Jan-2001 jhb

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


70897 10-Jan-2001 iwasaki

Enable fixed event at not only boot but also wakeup.

Reported and patch tested by: Peter Dufault <dufault@hda.hda.com>


70591 02-Jan-2001 takawata

Change Embedded Controller lock to ACPI Global Lock.This is needed for
mutual execution between BIOS and OS.


70468 29-Dec-2000 msmith

Hack in interrupt routing support (using the core $PIR support, not using
ACPICA properly). This makes it possible to use ACPICA in conjunction with
CardBus before I get around to implementing ACPI/PCI interrupt routing.


70340 24-Dec-2000 iwasaki

Add ioctls to acpi_cmbat and acpi_acad. These use mike's acpi_register_ioctl().
Fix wrong AML method calling in acpi_cmbat.


70271 22-Dec-2000 takawata

Add ACPI AC adaptor and ACPI Control Method Battery.
And install notify handler for thermal zone .


70247 21-Dec-2000 takawata

Re-Enable OSD_PRIORITY_GPE. Now 20001215 has been commited.


70237 20-Dec-2000 iwasaki

Disable my previous committed code for a moment.

Note to myself: this needs to be enabled again when newer version of
ACPI is imported.


70236 20-Dec-2000 iwasaki

Add task priority definition for OSD_PRIORITY_GPE in AcpiOsQueueForExecution().
This is needed to next ACPICA import.


70232 20-Dec-2000 takawata

Change priority of procedure queueing.
This is needed to next ACPICA import.


70194 19-Dec-2000 iwasaki

Fix testing reboot howto flags in acpi_shutdown_final().
This sould make the system power-off correctly where the howto had
more bits set than RB_POWEROFF, e.g. RB_NOSYNC.

Submitted by: Peter Pentchev <roam@orbitel.bg>


70048 15-Dec-2000 takawata

Fix with debugging option.

Submitted by: haro@tk.kubota.co.jp


70018 14-Dec-2000 takawata

Make Embedded Controller driver interrupt driven.


69910 12-Dec-2000 iwasaki

Catch up with the recent conversion the per-eventhandler list mutex to
a lockmgr lock.


69776 08-Dec-2000 msmith

Staticise some malloc pools

Submitted by: phk


69744 08-Dec-2000 msmith

- 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.


69585 05-Dec-2000 msmith

ACPI HID's aren't limited to 7 characters. Don't check the length of the
HID passed in as an argument at all; callers are typically going to be
sending us static strings anyway.

Submitted by: Munehiro Matsuda <haro@tk.kubota.co.jp>


69505 02-Dec-2000 scottl

Revert attach() back to the old behaviour of calling bus_generic_attach().
The new way doesn't seem to work reliably and was causing devices to not
be seen.

Approved by: msmith


69459 01-Dec-2000 msmith

AcpiOsMem primitives as required by the new ACPI CA snapshot


69458 01-Dec-2000 msmith

Update to work with the new ACPI CA snapshot.

- Use ACPI_PHYSICAL_ADDRESS
- RSDT -> XSDT
- FACP -> FADT
- No APIC table support
- Don't install a global EC handler; this has bad side-effects
(it invokes _REG in *all* EC spaces in the namespace!)
- Check for PCI bus instances already existing before adding them


68406 06-Nov-2000 msmith

Remove unused PCI includes.


68067 31-Oct-2000 takawata

If acpica driver is loaded using kldload(8), warn and just ignore.


67761 28-Oct-2000 msmith

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.


67760 28-Oct-2000 msmith

FreeBSD-specific OSD (operating system dependant) modules for the Intel
ACPICA code.