Commit Graph

1288 Commits

Author SHA1 Message Date
John Baldwin
1f895058e4 Revert unrelated changes accidentally committed in r271192. 2014-09-17 18:55:39 +00:00
John Baldwin
b1d735ba4c 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)
2014-09-06 15:23:28 +00:00
Neel Natu
3c6f0322bb Fix typo when displaying the HPET timer unit number. 2014-08-13 00:18:16 +00:00
Roger Pau Monné
c2641d23e1 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.
2014-08-04 09:05:28 +00:00
Marcel Moolenaar
e7d939bda2 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
2014-07-07 00:27:09 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 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
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 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
2014-06-27 16:33:43 +00:00
Hans Petter Selasky
1ccbb263b5 Remove not needed initialisation code. 2014-06-26 10:48:01 +00:00
John Baldwin
d2dc06ca16 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
2014-06-25 20:30:47 +00:00
John Baldwin
2f951d2989 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
2014-06-19 18:35:14 +00:00
Steven Hartland
1ddd62d0a9 Remove duplicate SYSCTL_DECL(_debug_acpi) which was breaking tinderbox
MFC after:	2 weeks
X-MFC-With: r264849
2014-04-24 14:58:12 +00:00
Steven Hartland
802d215dc1 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
2014-04-24 12:38:07 +00:00
Steven Hartland
c9c13b5b77 Exposed debug.acpi.max_tasks and debug.acpi.max_threads via sysctls so their
values can be viewed.
2014-04-24 00:41:02 +00:00
Adrian Chadd
0d4700544f 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.
2014-04-08 02:36:27 +00:00
Warner Losh
c0753890d0 Turns out name was used here when ACPI_DEBUG was defined, so refine my
previous patch.
2014-03-31 19:37:39 +00:00
Warner Losh
8a27a339b6 Remove instances of variables that were set, but never used. gcc 4.9
warns about these by default.
2014-03-30 23:43:36 +00:00
John Baldwin
4edef187b8 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
2014-02-12 04:30:37 +00:00
John Baldwin
7e3343bfcf 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
2014-01-28 20:53:33 +00:00
Eitan Adler
7a22215c53 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
2013-11-30 22:17:27 +00:00
Alexander Motin
d46bdcabdb 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.
2013-11-15 11:32:19 +00:00
Nathan Whitehorn
feeec74df7 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.
2013-10-29 14:19:42 +00:00
Konstantin Belousov
86be9f0dd5 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
2013-10-28 13:33:29 +00:00
Justin T. Gibbs
428b7ca290 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.
2013-09-20 05:06:03 +00:00
Jean-Sébastien Pédron
b8833944fd 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.
2013-08-30 19:21:12 +00:00
Jung-uk Kim
3bd12ca8f1 Tidy up global locks for ACPICA. There is no functional change. 2013-08-13 21:34:03 +00:00
John Baldwin
9a7bf07ccd 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)
2013-07-16 14:42:16 +00:00
John Baldwin
8f4c2e526b 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
2013-07-03 17:26:05 +00:00
Jung-uk Kim
0c10b85a19 Consistently cast ACPICA 64-bit integer types when we print them. 2013-06-26 23:52:10 +00:00
Jung-uk Kim
a9d8d09c46 Merge ACPICA 20130517. 2013-05-20 23:52:49 +00:00
Jung-uk Kim
b3f35be0c6 - 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.
2013-05-20 22:18:18 +00:00
Jung-uk Kim
ec23b5bfe7 Fix white spaces. 2013-05-20 22:10:01 +00:00
John Baldwin
60d306f035 - 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
2013-04-22 15:51:06 +00:00
Rui Paulo
dd85724bc9 Fix a typo in a comment. 2013-03-17 07:28:17 +00:00
Alexander Motin
5fd81be1fc Add "else" missed at r248154. 2013-03-11 17:29:09 +00:00
Alexander Motin
98992b292b 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).
2013-03-11 12:02:03 +00:00
Alexander Motin
fdc5dd2d2f 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.
2013-02-28 13:46:03 +00:00
Davide Italiano
d9ddf0c057 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.
2013-02-28 11:27:01 +00:00
Davide Italiano
acccf7d8b4 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.
2013-02-28 10:46:54 +00:00
Andriy Gapon
ebbed20df4 revert accidentally committed unneeded changes from r246250
MFC after:	7 days
X-MFC with:	r246250
2013-02-02 12:52:43 +00:00
Andriy Gapon
b913a7d5d7 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
2013-02-02 12:44:19 +00:00
Andriy Gapon
b1a5c01749 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
2013-02-02 12:42:07 +00:00
Sofian Brabez
61bfd86762 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
2013-01-30 18:01:20 +00:00
Jung-uk Kim
c4f70e5117 Fix two misusages of return_*() macros for ACPICA.
Noticed by:	avg
2013-01-28 21:10:35 +00:00
Jung-uk Kim
fb29cf3724 Fix white spaces for style consistency. 2013-01-28 21:06:20 +00:00
Jung-uk Kim
efcc2a3054 Merge ACPICA 20130117. 2013-01-17 23:56:43 +00:00
Alexander Motin
f404e02afd 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.
2013-01-10 21:38:31 +00:00
Andriy Gapon
30bf6110b5 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
2012-12-01 18:06:05 +00:00
Andriy Gapon
09424d43c1 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
2012-12-01 18:01:01 +00:00
Andriy Gapon
f51d43fe01 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
2012-11-22 14:40:26 +00:00
Sean Bruno
045d21a728 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
2012-11-12 18:09:25 +00:00
Jung-uk Kim
8ef1a33100 Merge ACPICA 20121018. 2012-10-23 23:49:17 +00:00
Eitan Adler
a8de37b024 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)
2012-10-22 13:06:09 +00:00
Eitan Adler
76b7512247 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
2012-10-22 03:41:14 +00:00
John Baldwin
a18367634e 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
2012-10-19 19:17:43 +00:00
Andriy Gapon
9548b507cb 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
2012-10-14 09:32:38 +00:00
Neel Natu
af0d1ee939 Grab the softc from the ACPI host-pci bridge device instead of from the pci
endpoint device.

Reviewed by:	jhb
2012-10-10 00:06:31 +00:00
Andriy Gapon
154fc7b6c7 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
2012-09-18 08:17:29 +00:00
Andriy Gapon
31482433f4 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
2012-09-11 17:21:25 +00:00
Andriy Gapon
ccb92b3c78 acpi_cpu: free result of device_get_children
MFC after:	1 week
2012-09-11 06:26:20 +00:00
Alexander Motin
df980c683c 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
2012-09-09 20:00:00 +00:00
Jung-uk Kim
1df130f1d4 Merge ACPICA 20120816. 2012-08-16 20:54:52 +00:00
Alexander Motin
3c5c555957 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.
2012-07-31 10:58:50 +00:00
Andriy Gapon
d30b88af05 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
2012-07-13 08:11:55 +00:00
Andriy Gapon
029468d82c 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
2012-07-08 10:57:49 +00:00
Eitan Adler
7f489a9679 Remove variables which are initialized but never used thereafter
reported by gcc46 warning

Approved by:	cperciva
MFC after:	1 week
2012-07-07 17:13:09 +00:00
Andriy Gapon
987e5277f8 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
2012-07-07 08:19:34 +00:00
Andriy Gapon
412ef22084 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
2012-07-07 08:12:51 +00:00
Andriy Gapon
56101001b2 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
2012-07-07 07:59:14 +00:00
Sean Bruno
55fb7f3673 Revert r238004 as more review has come in and there is now a discussion
on how to best proceed.
2012-07-02 17:55:29 +00:00
Sean Bruno
7402aad3c7 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
2012-07-02 16:57:13 +00:00
Mitsuru IWASAKI
5e33d57ff1 Resotre LCD brightness level on resuming.
MFC after:	3 days
2012-06-17 16:19:09 +00:00
Mitsuru IWASAKI
fb864578af 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@
2012-06-09 00:37:26 +00:00
Jung-uk Kim
9ad569771a Consistently use ACPI_SUCCESS() and ACPI_FAILURE() macros wherever possible. 2012-06-01 21:33:33 +00:00
Jung-uk Kim
4d46ef51dd Execute AcpiLeaveSleepStatePrep() for S1 and reduce code duplication.
MFC after:	3 days
2012-06-01 17:00:33 +00:00
Mitsuru IWASAKI
f0a101b7e2 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
2012-06-01 15:26:32 +00:00
Mitsuru IWASAKI
e3b56b6604 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
2012-05-29 05:28:34 +00:00
Mitsuru IWASAKI
ffe3f1f8cc 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
2012-05-29 05:09:40 +00:00
Jung-uk Kim
a7a3b383f2 Merge ACPICA 20120518. 2012-05-24 23:12:30 +00:00
Jung-uk Kim
2aa7a9e686 Restore Processor object path for verbose boot message. 2012-05-23 17:03:09 +00:00
John Baldwin
e4cd9dcff6 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
2012-05-23 13:45:52 +00:00
Mitsuru IWASAKI
b12bc99f91 Ignore the power button press event for resuming rather than starting
shutdown.

MFC after:	2 days
2012-05-22 05:18:30 +00:00
Mitsuru IWASAKI
f22377a8c7 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
2012-05-20 16:36:54 +00:00
John Baldwin
424e69759c Centralize declaration of the debug.acpi sysctl node. 2012-05-17 17:58:53 +00:00
Jung-uk Kim
92fa7e24cb 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
2012-05-04 18:54:51 +00:00
Jung-uk Kim
e5751426ad 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
2012-05-04 18:24:38 +00:00
John Baldwin
0d95597ca9 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
2012-03-29 19:03:22 +00:00
Jung-uk Kim
71804adc62 Restore interrupt state after executing AcpiEnterSleepState(). 2012-03-27 23:26:58 +00:00
Jung-uk Kim
cc6455afff Add ACPI_LV_REPAIR debug level, available since ACPICA 20091214 (r200553).
MFC after:	3 days
2012-03-22 17:01:25 +00:00
Jung-uk Kim
4c52cad2f9 Merge ACPICA 20120320. 2012-03-20 21:37:52 +00:00
Alexander Motin
fd94de5c9d 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
2012-03-10 21:08:07 +00:00
John Baldwin
1b1596a3b3 - 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
2012-03-02 20:38:04 +00:00
Jung-uk Kim
4fd3565a35 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
2012-02-24 23:15:21 +00:00
Jung-uk Kim
a159c266a9 Merge ACPICA 20120215. 2012-02-16 22:59:29 +00:00
Jung-uk Kim
731634f7fe De-obfuscate acpi_acquire_global_lock(). It seems the function was directly
translated from i386 assembly version.
2012-02-10 23:30:29 +00:00
Jung-uk Kim
6303ae4d5c Refine r231226. Swap timecounters before suspending any device drivers. 2012-02-09 17:38:08 +00:00
Jung-uk Kim
a0a15716df Reset clock after atrtc(4) is properly resumed. 2012-02-08 21:23:20 +00:00
Jung-uk Kim
cc43a851d2 Revert r211288 and move the logic to the acpi_timer itself. 2012-02-08 20:31:42 +00:00
Jung-uk Kim
404b0d10ae - 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.
2012-02-07 20:54:44 +00:00
John Baldwin
a74d695299 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
2011-12-29 16:23:14 +00:00
Jean-Sébastien Pédron
27fcbbcaaf Prevent a division by zero with some broken batteries
This problem was seen on a laptop with a dead battery.
2011-11-26 13:43:50 +00:00
Marius Strobl
4b7ec27007 - 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.
2011-11-22 21:28:20 +00:00
Eitan Adler
5d0d7ea8df - be more precise about the unit of measurement
Approved by:	jhb
MFC after:	3 days
2011-11-17 23:04:43 +00:00
Eitan Adler
f28cf62d17 - be more precise about the unit of measurement
Submitted by:	Oliver Pinter <oliver.pntr@gmail.com>
Approved by:	jhb
MFC after:	3 days
2011-11-17 15:46:37 +00:00
Ed Schouten
6472ac3d8a 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.
2011-11-07 15:43:11 +00:00
Ed Schouten
d745c852be Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.
This means that their use is restricted to a single C file.
2011-11-07 06:44:47 +00:00
John Baldwin
5d0d779b0e 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
2011-10-12 14:13:32 +00:00
Christian Brueffer
31f301d021 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
2011-09-13 15:57:29 +00:00
Alexander Motin
9839387616 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)
2011-08-16 21:51:29 +00:00
John Baldwin
e9f91b2b2a 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)
2011-07-21 20:43:43 +00:00
John Baldwin
30ee9e615d Don't ignore negatively decoded address ranges.
Reported by:	scottl
2011-07-17 12:42:51 +00:00
John Baldwin
34ff71eecd 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)
2011-07-15 21:08:58 +00:00
Kevin Lo
ee6eac62f7 Remove duplicate header includes 2011-06-28 08:36:48 +00:00
Marcel Moolenaar
6d064c9758 Now that ia64 has been switched to the event timers, remove the
conditional compilation work-arounds.
2011-06-25 02:49:47 +00:00
John Baldwin
f6133e7144 Typo. 2011-06-24 13:58:56 +00:00
Jung-uk Kim
624a5cc87e Fix build on ia64 after r223426. 2011-06-22 22:56:42 +00:00
Jung-uk Kim
a49399a903 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)
2011-06-22 16:40:45 +00:00
John Baldwin
38d7a61ba4 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)
2011-06-22 16:15:15 +00:00
John Baldwin
4c2ed94f96 Fix build with ACPI_DEBUG defined.
Submitted by:	jkim
Pointy hat to:	jhb
2011-06-21 21:30:20 +00:00
John Baldwin
4fc477aa52 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)
2011-06-21 19:29:27 +00:00
John Baldwin
183c8af32e 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.
2011-06-17 21:19:01 +00:00
John Baldwin
049dc0d1ff Implement BUS_ADJUST_RESOURCE() for the x86 drivers that sit between the
Host-PCI bridge drivers and nexus.
2011-06-10 12:30:16 +00:00
Jung-uk Kim
42e58c0372 Merge ACPICA 20110527. 2011-05-31 19:45:58 +00:00
Jung-uk Kim
ca5f1efdd9 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
2011-05-23 20:12:36 +00:00
John Baldwin
83c41143ca 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
2011-05-03 17:37:24 +00:00
John Baldwin
24c93a6fc4 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.
2011-05-02 19:02:30 +00:00
John Baldwin
d2c9344ff9 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.
2011-05-02 14:13:12 +00:00
Matthew D Fleming
6e6d95d1b9 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 >
2011-04-19 20:44:43 +00:00
Jung-uk Kim
6af444b118 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.
2011-04-18 23:12:41 +00:00
Matthew D Fleming
8db47cc0d4 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 >
2011-04-18 19:02:41 +00:00
Jung-uk Kim
4a8fa6fe58 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.
2011-04-14 22:17:39 +00:00
Jung-uk Kim
5331d61da4 Add some tunable descriptions about x86 timers.
Requested by:	arundel
2011-04-14 00:07:08 +00:00
Jung-uk Kim
3453537fa5 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).
2011-04-07 23:28:28 +00:00
Jung-uk Kim
9abd8cd05b 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.
2011-04-05 18:40:19 +00:00
Jung-uk Kim
059e24646a Move a trivial acpi_TimerDelta() to acpivar.h to make it inlineable. 2011-04-04 18:39:04 +00:00
Jung-uk Kim
aa977fc70e 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.
2011-04-04 17:44:26 +00:00
Jung-uk Kim
8defd647f2 Fix bogus logic to calculate delta between two values from ACPI timers. 2011-04-04 17:30:33 +00:00
Jung-uk Kim
d141bf6e2f 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.
2011-04-04 17:00:50 +00:00
Jung-uk Kim
93bd1f7e31 Add inline to acpi_timer_read() to reduce unnecessary jumps and calls. 2011-04-04 16:47:42 +00:00
Jung-uk Kim
9fae4b2a8c Add more definitions for vendor-specific CPU capability bits to the last
revision, which is renamed to "Intel Processor Vendor-Specific ACPI".
2011-02-25 18:29:57 +00:00
Jung-uk Kim
f6c05906ee Rework r218685. Copy just enough data for the resource type.
Reviewed by:	jhb, mdf
2011-02-14 20:05:37 +00:00
Matthew D Fleming
224e25e117 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
2011-02-14 17:20:20 +00:00
Marcel Moolenaar
efdb11cd58 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.
2011-02-13 19:24:04 +00:00
Matthew D Fleming
f4f04709ac Fix a few more SYSCTL_PROC() that were missing a CTLFLAG type specifier. 2011-01-19 00:57:58 +00:00
John Baldwin
4a26285ea1 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
2011-01-18 14:58:44 +00:00
Jung-uk Kim
b5854f5f59 Work around a witness(4) panic introduced in r217238.
Reported by:	jh
2011-01-11 19:26:39 +00:00
Jung-uk Kim
5947a0a3c8 Fix a witness(4) warning introduced in r217238. 2011-01-11 19:20:01 +00:00
Jung-uk Kim
ea5bef4942 Remove impossible error conditions. 2011-01-10 21:09:38 +00:00
Jung-uk Kim
bd532602ec Add forgotten free(9) in the previous commit for an error case. 2011-01-10 21:01:41 +00:00
Jung-uk Kim
82bf55575d 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.
2011-01-10 20:56:59 +00:00
Jung-uk Kim
b839a7f44b Prefer KASSERT(9) over panic(9) as it was never seen in reality. 2011-01-10 20:26:36 +00:00
Jung-uk Kim
000d939024 Clarify the previous commit. AcpiFinishGpe() will not clear GPE for us
because we set it to edge-trigger.
2011-01-04 17:06:03 +00:00
Jung-uk Kim
5568050d57 Clear GPE from a query handler if the task was deferred. 2011-01-04 00:10:29 +00:00
Jung-uk Kim
80b1151e82 Fix parameters for wakeup(9) and tsleep(9).
MFC after:	3 days
2011-01-03 23:37:42 +00:00
John Baldwin
0d81cf1227 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
2010-12-23 18:50:14 +00:00
John Baldwin
ea23319939 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.
2010-12-22 20:27:20 +00:00
Andriy Gapon
766d7e6539 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
2010-12-17 16:21:30 +00:00
John Baldwin
686b1e6bc0 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.
2010-12-16 17:05:28 +00:00
John Baldwin
5e66b8e231 Spelling fix. 2010-12-16 16:55:22 +00:00
Jung-uk Kim
5a77b11bd3 Merge ACPICA 20101209. 2010-12-15 23:48:45 +00:00
Jung-uk Kim
e1c9d39ebe 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.
2010-12-14 20:07:51 +00:00
John Baldwin
4a588c1ba7 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)
2010-12-07 18:49:11 +00:00
John Baldwin
d2014f5180 Various small typos and grammar nits in comments. 2010-11-18 22:17:20 +00:00
Jung-uk Kim
68d5e11c9f 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
2010-11-12 17:10:12 +00:00
Jung-uk Kim
93a8847473 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.
2010-11-10 18:50:12 +00:00
Jung-uk Kim
7c2bf852d7 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.
2010-11-10 01:29:56 +00:00
Jung-uk Kim
affa18265a Consistently use padding `_' in the comment. 2010-11-08 19:52:14 +00:00
Jung-uk Kim
e7bb9ab605 Add a forgotten change from the previous commit. 2010-11-05 20:24:26 +00:00
Jung-uk Kim
9fe3e6c023 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
2010-11-05 19:50:09 +00:00
Jung-uk Kim
495a414454 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.
2010-11-03 23:16:35 +00:00
Jung-uk Kim
ae19af49e0 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"
2010-10-26 18:59:50 +00:00
Jung-uk Kim
f3e0b10973 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.
2010-10-20 16:47:09 +00:00
Jung-uk Kim
220666153d 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.
2010-10-19 20:38:21 +00:00
Jung-uk Kim
a7a3177f27 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)
2010-10-19 19:53:06 +00:00
Jung-uk Kim
edc0cb7dc8 Make any PCI devices enumerated in ACPI tree honor do_power_resume as well. 2010-10-19 18:43:11 +00:00
Jung-uk Kim
1debbf5d79 Clean up unused headers. 2010-10-13 17:06:25 +00:00
Jung-uk Kim
e41724b279 Remove acpi_bus_number() completely. It had to be removed in r212761.
Pointed out by:	jhb
2010-10-13 16:30:41 +00:00
Rui Paulo
1d90e6b224 Mark acpi_bus_number() as __unused. This allows clang to this file
without any warnings.
2010-10-13 11:38:24 +00:00
Jung-uk Kim
ac731af567 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).
2010-10-13 00:21:53 +00:00
Andriy Gapon
5ff14fa9b4 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
2010-10-12 17:53:01 +00:00
Alexander Motin
3a2c9a26b5 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.
2010-09-30 16:23:01 +00:00
Alexander Motin
48fe2e6719 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.
2010-09-22 11:32:22 +00:00
Andriy Gapon
9c2d052943 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
2010-09-22 06:10:22 +00:00
Jung-uk Kim
42fecd1294 Merge ACPICA 20100915. 2010-09-16 20:08:00 +00:00
Andriy Gapon
09c22c66e1 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
2010-09-13 09:51:24 +00:00
Alexander Motin
a157e42516 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.
2010-09-13 07:25:35 +00:00
Alexander Motin
373d257ef0 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.
2010-09-13 06:32:56 +00:00
Alexander Motin
6184f8d60e Instead of storing last event timestamp, store the next event timestamp.
It corrects handling of the first event offset in emulated periodic mode.
2010-09-12 11:11:53 +00:00
Andriy Gapon
3d844eddb7 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
2010-09-10 11:19:03 +00:00
Alexander Motin
b28fc1b5c8 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.
2010-09-08 16:59:22 +00:00
Alexander Motin
09538b1020 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.
2010-09-05 19:24:32 +00:00
Andriy Gapon
b1f9b9965b 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
2010-09-03 08:07:04 +00:00
John Baldwin
62508c531e 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
2010-08-17 15:44:52 +00:00
Jung-uk Kim
34622ff1ab 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.
2010-08-06 23:35:33 +00:00
Jung-uk Kim
709fac0616 Merge ACPICA 20100806. 2010-08-06 23:11:19 +00:00
John Baldwin
7d23a9b3d5 - 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
2010-08-05 16:10:12 +00:00
Alexander Motin
599cf0f197 Fix several un-/signedness bugs of r210290 and r210293. Add one more check. 2010-07-20 15:48:29 +00:00
Alexander Motin
51636352b6 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.
2010-07-20 10:58:56 +00:00
Jung-uk Kim
69496408a5 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).
2010-07-16 04:27:38 +00:00
Jung-uk Kim
aa353b1b6b 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.
2010-07-16 03:59:50 +00:00