Commit Graph

1152 Commits

Author SHA1 Message Date
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
Jung-uk Kim
337744d9a6 If there is any pending sleep request, disallow entering S5 state.
Otherwise, bad things may happen. ;-)
2010-07-15 23:24:06 +00:00
Jung-uk Kim
6e7661023a - 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.
2010-07-15 19:52:54 +00:00
Jung-uk Kim
89339b38d8 - 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]
2010-07-15 17:11:49 +00:00
Jung-uk Kim
36a483bbcd Make SMP code path conditional at run-time. 2010-07-13 16:35:41 +00:00
Alexander Motin
8a6870808d 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.
2010-07-13 12:46:06 +00:00
Jung-uk Kim
31bc79db46 Fix white spaces. 2010-07-13 02:48:42 +00:00
Jung-uk Kim
502e578cde 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.
2010-07-13 02:45:44 +00:00
Jung-uk Kim
3664686221 Fix mis-merges in the previous commit. 2010-07-06 21:41:08 +00:00
Jung-uk Kim
a88e22b7ad Merge ACPICA 20100702. 2010-07-06 20:57:28 +00:00
Alexander Motin
49ed68bbf3 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
2010-06-22 19:42:27 +00:00
Alexander Motin
e723056a58 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@
2010-06-22 16:10:48 +00:00
Alexander Motin
7ea5021353 Fix ia64 build broken by r209371.
ia64, same as amd64 has ACPI and always has APIC.

Submitted by:	jhb@
2010-06-21 20:27:32 +00:00
Alexander Motin
875b8844be 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.
2010-06-20 21:33:29 +00:00
Alexander Motin
3a18e1b6d7 Oops! Add " / hz" missed in r209328. Assume interrupt rate hz/2, not 1/2. 2010-06-19 08:46:17 +00:00
Alexander Motin
7150e67191 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.
2010-06-19 08:36:12 +00:00
John Baldwin
42040ff081 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
2010-06-15 19:14:39 +00:00
Jung-uk Kim
2e1bf57ca8 Simplify a function for getting brightness levels. 2010-06-11 19:58:41 +00:00
Jung-uk Kim
30363a9a9e Remove unused assignment.
Found by:	clang static analyzer
Found by:	Coverity Prevent[tm] (CID 4537, 4538, 4539)
2010-06-11 19:53:42 +00:00
Andriy Gapon
1bdfff2252 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
2010-06-11 19:27:21 +00:00
John Baldwin
3aa6d94e0c Update several places that iterate over CPUs to use CPU_FOREACH(). 2010-06-11 18:46:34 +00:00
John Baldwin
374d9c4d18 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
2010-06-08 21:27:05 +00:00
Jung-uk Kim
e115a49ff3 Remove unnecessary pointer type castings, shift operations and dead code. 2010-06-01 21:15:05 +00:00
Alexander Motin
b169c85e20 Oops, HPET ID optionally stored in _UID, not in _ADR. 2010-05-23 08:31:15 +00:00
Alexander Motin
3c4c08dce7 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.
2010-05-23 07:53:22 +00:00
Jung-uk Kim
3f5e024c14 Merge ACPICA 20100428. 2010-04-28 22:25:27 +00:00
Jung-uk Kim
8c8be05f00 Merge ACPICA 20100331 (and four additional upstream patches). 2010-04-02 23:04:31 +00:00
Jung-uk Kim
9c98a9acdd Fix white spaces. 2010-03-10 18:30:55 +00:00
Jung-uk Kim
2a18c71d03 - 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.
2010-03-09 19:02:02 +00:00
Jung-uk Kim
ca3cf4fa2c Merge ACPICA 20100304. 2010-03-05 21:39:16 +00:00
Jung-uk Kim
463537a097 Rename some macros to clarify their intentions and fix style nits. 2010-02-15 20:46:01 +00:00
Jung-uk Kim
aba311e1d4 Add support for cycle' and zero' events for LCD brightness control.
Submitted by:	Daniel Walter (d dot walter at 0x90 dot at) (intial version)
2010-02-15 19:30:28 +00:00
Jung-uk Kim
f29d6f75fa Make sanity check slightly more useful and tweak an error message. 2010-02-13 05:38:21 +00:00
Jung-uk Kim
35dd1ef75c Implement LCD brightness control notify handler.
Submitted by:	Daniel Walter(d dot walter at 0x90 dot at) (intial version)
2010-02-13 02:24:23 +00:00
Andriy Gapon
0430ba9e55 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
2010-02-11 18:24:00 +00:00
Andriy Gapon
aa83516001 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
2010-02-11 08:50:21 +00:00
Andriy Gapon
f4ab0cccce 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
2010-02-06 12:48:06 +00:00