Commit Graph

617 Commits

Author SHA1 Message Date
Nate Lawson
f6cb6ecd55 Clean up rev 1.49 by using the temperature conversion for _PSV also and
wrap a long line.
2004-09-08 19:36:07 +00:00
Nate Lawson
f387ed7e06 Don't change the state of the system in acpi_tz_establish(). Before, we
would turn off all fans when initializing a zone.  However, the HP Omnibook
500 generates a notify saying the zone needs to be re-evaluated whenever
its fan is switched on or off.  This produced an infinite loop.  Also, note
that running _SCP can generate the same notify.

Since we need to make sure old fan references are turned off when getting
new ones, run acpi_tz_monitor() first.  This will turn off any unneeded
fans.  Then, check for new settings.  After that, run acpi_tz_monitor()
again to turn on/off any fans referenced by the new settings.

Tested by:	brooks
2004-09-07 17:02:08 +00:00
Nate Lawson
a67e6f3ab1 Instead of trusting _STA from power resources, cache the first value
returned and then infer the state from calls to _ON/_OFF.  This works
around a problem in systems that don't correctly report the state (i.e.
the HP Omnibook 500 reports "on" for its fan always after it has been
turned on once).
2004-09-07 16:58:12 +00:00
Nate Lawson
2df0b34b24 Don't enter the debugger when executing an AML breakpoint instruction
unless ACPI_DEBUG is defined.  Users don't typically care about errant
breakpoint instructions.  The HP Pavilion 7915 has this in its PCI0
_INI method for rev 0x6040000 of the RSDT.
2004-09-02 04:28:05 +00:00
Nate Lawson
0c601400a3 Disable links after getting the possible resources. Even though _DIS
should only affect current resources, it seems best to wait until all
configuration is done before disabling it.  If this fixes any problems, it
is a MT5 candidate.
2004-09-01 17:59:29 +00:00
Peter Wemm
c591d41f7c Add a suffix descriptor for the acpi thermal values as a hint for the userland
sysctl tool to print a more readable value for temperatures.
2004-08-30 22:42:10 +00:00
Nate Lawson
85cdc19d00 Always set the status and move a printf under bootverbose.
Tested by:	gj
2004-08-27 00:53:11 +00:00
Nate Lawson
59506cd39a If getting the current setting after modifying the link failed, we assume
it succeeded.  However, we also need to set the status to AE_OK.
2004-08-26 17:14:36 +00:00
Nate Lawson
b0e7e61135 Remove code to initialize the lid state at boot. It interfered with lid
operation for some users with pure GPE lid switches (vs. embedded
controller.)

Tested by:	Anish Mistry <mistry.7_at_osu.edu>
MFC after:	3 days
2004-08-25 20:09:15 +00:00
Nate Lawson
adad474471 Rework sysresource management. Instead of having each sysresource object
hold its own values, pass them up to the parent (acpi0) and merge/uniq them
on the way.  After the namespace evaluation, acpi will reserve these
resources and manage them via rman before bus_generic_probe() and
bus_generic_attach().  This is necessary because some systems specify
conflicting resources in separate sysresource objects.  It's also cleaner
in that the interface between sysresource and acpi is now merely the parent's
resource list.  This code handles the following cases:

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

Tested by:	Pawel Worach <sajd_at_telia.com>
Tested by:	Radek Kozlowski <radek_at_raadradd.com>
MFC after:	5 days
2004-08-23 16:28:42 +00:00
Nate Lawson
85bafe5ec3 Fix PCI link irq programming on resume. A logic bug prevented a device
match, inverting which links actually got resumed.

Submitted by:	Hiroyuki Aizu <eyes_at_navi.org>
MFC after:	3 days
2004-08-21 18:18:32 +00:00
Nate Lawson
1531578c50 Use the new start for the offset, not the old end. 2004-08-20 17:04:49 +00:00
Nate Lawson
d22e9c6e0d Correctly handle BIOS resources that are duplicated (!). There are many
systems that have overlapping regions specified in their sysresource
objects.  This patch fixes ATA DMA and acpi_timer allocation for such
sysctems.  It should eventually be moved to resource_list_add() if it is
a valid generalized approach.  The minimal approach for 5.3 is:

"Loop through all current resources to see if the new one overlaps
any existing ones.  If so, the old one always takes precedence and
the new one is adjusted (or rejected).  We check for three cases:

1. Tail of new resource overlaps head of old resource:  truncate the
   new resource so it is contiguous with the start of the old.
2. New resource wholly contained within the old resource:  error.
3. Head of new resource overlaps tail of old resource:  truncate the
   new resource so it is contiguous, following the old."

Tested by:	Radek Kozlowski <radek_at_raadradd.com>
Discussed with:	imp
MFC after:	4 days
2004-08-20 16:52:44 +00:00
Nate Lawson
7ecd49c463 If _CRS fails, assume that it succeeded. The ASUS K8V (and others) defines
single-entry irq links even though it uses an APIC.  It appears that it
ignores _SRS when in APIC mode but returns a valid irq at other times.
2004-08-18 16:39:59 +00:00
Nate Lawson
071339e2d1 Call AcpiLeaveSleepState() before DEVICE_RESUME(). The former calls the
BFS and WAK methods, which are needed to initialize some devices before
the driver can resume them.  This was the original order.

MFC after:	2 days
2004-08-18 07:00:43 +00:00
Nate Lawson
e079f9491a Remove the ACPIIO_ENABLE and ACPIIO_DISABLE ioctls as well as all
callers.  These ioctls attempted to enable and disable the ACPI
interpreter at runtime.  In practice, it is not possible to boot with
ACPI and then disable it on many systems and trying to do so can cause
crashes, interrupt storms, etc.  Binary compatibility with userland is
retained.

MFC after:	2 days
2004-08-18 05:48:24 +00:00
Nate Lawson
4c37803a89 Fix a deadlock on boot for some systems where reading the battery status
also generates a notify.  Since we held the lock over this call, the
notify never got to run and the battery status read never returned.
Document this also.

Tested by:	Maxim Maximov <mcsi_at_mcsi.pp.ru>
Approved by:	re (scottl)
2004-08-17 18:36:07 +00:00
Nate Lawson
c2c373f9a0 Fix building for the ACPI_DEBUG case. 2004-08-13 19:27:21 +00:00
Nate Lawson
e1ebe17579 Record the new status after checking if it has changed, not before. This
fixes lost AC line transition events.

Bug report:	Kevin Oberman
2004-08-13 17:47:40 +00:00
Nate Lawson
25d32a9b77 MPSAFE locking
* Simplify taskqueue locking.
* Don't acquire Giant around calls to the taskqueue function.
* Remove 4.x compatibility routines.
2004-08-13 06:22:26 +00:00
Nate Lawson
e13cc46e0c MPSAFE locking
* Remove the interrupt wrapper that locked Giant and call the handler
  directly.  Mark the handler as MPSAFE.
* Don't attempt to detect if a handler is installed.  Leave that to the
  bus_alloc_resource() function.
2004-08-13 06:22:24 +00:00
Nate Lawson
5bfe5826f0 MPSAFE locking
* Serialize operations in acpi_video_bind_outputs(), acpi_video_detach(),
  acpi_video_notify_handler(), acpi_video_power_profile(), and the sysctls.
  The main goal is to protect the shared device list and prevent conflicting
  settings.
* Add assertions that the sx lock is held in the leaf functions.
2004-08-13 06:22:20 +00:00
Nate Lawson
956690d41b MPSAFE locking
* Restructure the event handling path.  acpi_tz_thread() now calls
  acpi_tz_timeout() any time an event occurs.  acpi_tz_timeout() checks
  the flags and calls acpi_tz_power_profile(), acpi_tz_establish(), and
  acpi_tz_monitor() as appropriate.  Notifies only do a wakeup and let
  acpi_tz_thread() do the actual work.  This path is cleaner and allows
  locking since the call path is now always a D.A.G.
* Add the acpi_tz_signal() function to set flags and wake the thread.
* Remove the tz_tmp_updating flag since calls are serialized by
  acpi_tz_thread().
* Remove Giant locking.
2004-08-13 06:22:17 +00:00
Nate Lawson
cece02d7b3 MPSAFE locking: Add a comment that we need resource list and device_t
refcounting/locking.
2004-08-13 06:22:13 +00:00
Nate Lawson
d317428f44 MPSAFE locking
* Serialize acpi_pwr_switch_consumer() and acpi_pwr_wake_enable().
* Make acpi_pwr_switch_consumer() have a single exit point.
* Add assertions to the leaf functions they call.
* Fix a memory leak in acpi_pwr_deregister_consumer().  However, it is
  currently ifdefed out so this code was unused.
2004-08-13 06:22:10 +00:00
Nate Lawson
bbf7c27a9c MPSAFE locking
* Serialize calls to acpi_pcib_route_interrupt().
* Note that acpi_pcib_attach() should not be called concurrently.
2004-08-13 06:22:07 +00:00
Nate Lawson
86b697a70b MPSAFE locking
* Serialize access to acpi_pci_link_config(), acpi_pci_find_prt(),
  acpi_pci_link_route(), and acpi_pci_link_resume().
* Add lock assertions to all functions called by them.
2004-08-13 06:22:03 +00:00
Nate Lawson
f4e6d08d46 MPSAFE locking
* Serialize access to acpi_pci_set_powerstate_method().
2004-08-13 06:21:58 +00:00
Nate Lawson
2014ed9841 MPSAFE locking
* Serialize notifying the user in acpi_lid_notify_status_changed().  This
  way multiple lid events occur in order.
* Add an initialization pass to get the lid status at boot-time.  This
  pass does not notify any apps but gets the initial status.
2004-08-13 06:21:55 +00:00
Nate Lawson
f4b7de154d MPSAFE locking
* Use the common serialization macros instead of rolling our own.
* Increase the coverage of the lock in EcSpaceHandler() to cover the entire
  loop to avoid dropping the lock when reading more than one byte.
2004-08-13 06:21:53 +00:00
Nate Lawson
d92a2ebdb2 MPSAFE locking
* Hold the ACPI lock over table register writes.
* Serialize calls to acpi_cpu_throttle_set() and the sysctls.
2004-08-13 06:21:47 +00:00
Nate Lawson
98b2573f26 MPSAFE locking
* Serialize ops in acpi_cmbat_notify_handler(), acpi_cmbat_ioctl(),
  acpi_cmbat_init_battery(), and acpi_cmbat_get_battinfo().
* Get the softc directly in acpi_cmbat_get_total_battinfo() rather than
  build an array of them.
* Don't queue a _BIF query after receiving a notify.  Since we clear the
  timespec, a _BIF query will be done in the context of the next caller.
* Add asserts to leaf functions that operate on shared data.
* Remove the bst/bif updating flags now that we hold the lock over the
  full query.
* Explain various comments in more detail.
2004-08-13 06:21:44 +00:00
Nate Lawson
07d4077ebf MPSAFE locking
* Serialize acpi_battery_get_battdesc(), acpi_battery_register(), and
  acpi_battery_remove().
* Assert that the sx lock is held in acpi_batteries_init().
* Remove check for device_get_softc() returning NULL.
2004-08-13 06:21:41 +00:00
Nate Lawson
99eaaec19e MPSAFE locking
* Serialize notification of acline changes in acpi_acad_get_status().
* Remove the initializing flag.  With the locking, we don't need to
  push off requests for the acline before initialization is done.
* Don't check device_get_softc(), it can't return NULL.
2004-08-13 06:21:36 +00:00
Nate Lawson
15e2f34f90 MPSAFE locking
* Serialize calls to acpi_alloc_resource(), acpi_release_resource(),
  acpi_Enable(), acpi_Disable(), and acpi_debug_sysctl().
* Acquire the ACPI mutex in acpi_register_ioctl(), acpi_deregister_ioctl(),
  and acpiioctl().
* Acquire the mutex while disabling subsequent requests to enter a
  sleep state in acpi_SetSleepState().
* Be sure to re-enable sleep requests and don't run resume methods when
  the current request fails.
* Don't check if sleep requests are disabled in the ACPIIO_SETSLPSTATE
  ioctl.  acpi_SetSleepState() does this for us.
* Remove the acquisition of Giant from the struct cdevsw.
* Remove the ACPI_USE_THREADS option.
2004-08-13 06:21:32 +00:00
Nate Lawson
3a9865dd34 MPSAFE locking
* Add and comment our locking primitives.  The mutex primitives use a
  a static mutex and the serialization ones use a static sx lock.  A global
  acpi_mutex is used for access to global resources (i.e., writes to the
  SMI_CMD register.)
* Remove 4.x compat defines.
2004-08-13 06:21:19 +00:00
Nate Lawson
56a7639b91 Skip dependent functions when finding the resource from _PRS to use for
later calls to _SRS.  Add note that this code should be centralized at
some point.

Bug from:	Jiawei Ye <leafy7382_AT_gmail.com>
2004-08-12 17:06:05 +00:00
Nate Lawson
12f57103bb Only print the link name if there is a link. For the hardwired case, don't
bother printing it.  This fixes a panic and acpi_name() has been more robust
as well.

Bug from:	Tai-hwa Liang <avatar-at-mmlab.cse.yzu.edu.tw>
2004-08-12 17:04:19 +00:00
Nate Lawson
0a9a1f44ce Allow null handles to be passed into acpi_name(). 2004-08-12 17:02:53 +00:00
Nate Lawson
310953d935 Fix the PRT entry code in acpi_pci_link to always add the entry, even if
there is no irq link.  Since we now use the stored copy of PRT, not the
one that used to be passed into acpi_pcib_route_interrupt(), we need it in
the list. [1]

Fix a bug in acpi_pci_find_prt() where we weren't checking the bus, thus
choosing the wrong PRT entry to use for routing the link.  Also, add a
printf for the case where the PRT entry is not found as this should not
happen.

Tested by:	marcel [1]
2004-08-12 02:06:19 +00:00
Nate Lawson
8f24713075 Add some more verbose warning/error messages to help with users reporting
problems with irq routing.
2004-08-11 20:37:24 +00:00
Nate Lawson
e4116e931c Re-work ACPI PCI IRQ routing (_PRT, link devices). The old approach was
incomplete in that the PRT routing was not aware of link programming.
Fix this by doing all routing through the link devices.  The new algorithm
for setting up links is:

1. Read _CRS to get current setting.  If invalid (not in _PRS), then set
   to 0.
2. Attempt to call _DIS on the link.  If successful, mark the link as not
   routed.  Otherwise, assume it still is.

Then when a routing request occurs:

3. Update weights for all IRQs
4. Attempt to route the initial IRQ if valid
5. If that fails, walk through the sorted list, attempting to route IRQs.
6. Configure the trigger/polarity based on _PRS.

Other changes:
* Add acpi_pci_find_prt() to look up the PRT entry for a given device and
  acpi_pci_link_route() to select/route the best IRQ for it.
* Remove duplicated code in acpi_pcib_route_interrupt() that picked the
  first IRQ from _PRS.
* Remove unneeded arguments from acpi_pcib_resume() and friends.
* Ignore _STA on link devices but report if it seems strange.
* Add a prt_source handle to the PRT structure since the ACPI struct
  ACPI_PCI_ROUTING_TABLE uses a fixed-size entry for it.  We'll need to
  dynamically size this object if we want to use it the same way ACPI-CA
  does.  Null-terminate the source.

Tested by:	Luo Hong <luohong99_at_mails.tsinghua.edu.cn>,
		Jeffrey Katcher <jmkatcher_at_yahoo.com>
Info from:	jhb, Len Brown (Intel)
2004-08-11 14:52:50 +00:00
Nate Lawson
c7f88fc386 Don't call DEVICE_RESUME a second time if DEVICE_SUSPEND fails. The
bus_generic_suspend method does this for us.  Disable interrupts before
entering S1.  This may help some systems suspend to S1 successfully.
2004-08-10 22:02:52 +00:00
Nate Lawson
85524256ea Refine updates to PCI irq routing. Check _STA and _CRS but only print a
message if they are incorrect.  Also, remove the hack of allowing the
initial irq setting to not be in _PRS.  As before, the old behavior can be
regained by defining ACPI_OLD_PCI_LINK.
2004-08-06 04:50:56 +00:00
Nate Lawson
17dbe0f79f Add flags for _STA (status) methods and convenience macros for checking
the presence of batteries and devices.
2004-08-06 00:38:50 +00:00
Nate Lawson
298e3d15d7 Work around non-compliant BIOS PCI link devices. Some systems have the
following behavior:

* Link devices return invalid status (_STA) values.  The results are very
  unreliable -- sometimes never present.  Just ignore the status and pick
  the best configuration from _PRS.

* Link devices return invalid current settings (_CRS).  Even after setting
  the link value, many systems still return a different setting for _CRS.
  When setting an IRQ, don't bother to check _CRS to see if we succeeded.
  Note that we still check _CRS before routing and this should be addressed
  as well.

Since this is a sensitive area, leave the old behavior accessible via
uncommenting the define for ACPI_OLD_PCI_LINK at the top of the file.  Once
this has been thoroughly tested, this option and the code it covers will
be removed.

Thanks to Len Brown at Intel for informing us of these issues as he worked
around them in Linux.
2004-08-05 06:54:16 +00:00
Nate Lawson
02a680b8f5 Fix the ACPI_DEBUG case by removing a now unused variable. 2004-08-03 17:16:30 +00:00
David E. O'Brien
a2e358988f Initialize variables to fix kernel build on AMD64. 2004-08-03 14:14:53 +00:00
Nate Lawson
bee4aa4ae5 /tmp/m 2004-08-03 05:13:56 +00:00
Nate Lawson
3fe12180a5 Don't force an immediate probe/attach for all devices when compiled with
ACPI_DEBUG.  This upset the ordering that acpi_probe_order() was meant to
provide, causing devices to attach before the sysresource object.  This
debugging feature has been unnecessary for a while so just remove it.

Testing by:	marcel
2004-07-26 06:04:35 +00:00
Nate Lawson
6b3322721c Fix a bug where an item was being removed from a list without using
FOREACH_SAFE.  Remove bad cast of retp and instead use an additional
arg to pass back the number of valid outputs.  Use the package convenience
functions for parsing packages.
2004-07-24 17:51:22 +00:00
Nate Lawson
14827d7eae Reinsert the bus space handle and tag, they are needed for the timer test. 2004-07-22 05:42:14 +00:00
Nate Lawson
be1841b4ae Instead of doing everything in identify, do a proper probe/attach. Also,
don't add another device if identify is called twice.  Minor reworking by
myself.

Submitted by:	marcel
2004-07-22 05:32:56 +00:00
Nate Lawson
c8f3591b78 Remove unused (and bogus) locking, style cleanup, remove unnecessary casts. 2004-07-22 05:18:05 +00:00
Nate Lawson
021730ab36 Use ACPI_ALL_NOTIFY instead of registering handlers separately. 2004-07-16 19:05:40 +00:00
Nate Lawson
7051c84dd3 Fix acpi_video loading. When we started cleaning up the duplicate handles
left around after the PCI probe, acpi_video stopped attaching because while
it was an acpi child device, it really is a PCI device.  Fix this by making
it a PCI child.

* Remove non-handle ivars accesses since child busses only implement
acpi_get_handle().
* Access the acpi softc directly through the devclass instead of through
the implied parent.
* Clean up a potential panic on unload by freeing the sysctl context before
storing NULL in the OID.

Found by:	marks
2004-07-16 16:59:32 +00:00
Nate Lawson
df8d2a326e Update the interface for child drivers. Add acpi_scan_children, which
allows a bus to re-enumerate its child handles and optionally replace
them with new children, arranged to the bus's liking.  (The current device
space is flat with all devices immediately under acpi0).  Add comments
for each interface.
2004-07-15 16:29:08 +00:00
Mark Santcroos
9b7b2aeff6 Some laptops report the "design-capacity" instead of the "real-capacity"
when the battery is fully charged. That breaks some of the arithmetic in
calculating the remaining capacity (ends up with more than 100%).
This commit makes sure the max is 100.

Approved by:	njl
2004-07-14 19:31:31 +00:00
Takanori Watanabe
8c4c207db4 Follow PnP location string change in acpi.c. 2004-07-14 06:58:39 +00:00
Nate Lawson
d40c0f5324 Clean up our pnpinfo and location strings. 2004-07-13 18:59:49 +00:00
Nate Lawson
edc136334b Call device_identify routines after doing the namespace walk. This is
needed so that sysresource objects are created first to reserve all regions,
then other devices can allocate from them.  Otherwise, acpi_timer (the only
ACPI device with an identify routine), would allocate its resources from
the nexus, causing the later sysresource reserve to fail.

Debugging by:	Taku YAMAMOTO, Andrea Campi
2004-07-13 17:57:41 +00:00
Nate Lawson
7a5230b8ad Add the ability to detach a battery. Now batteries that are detached are
also removed from the battery list.
2004-07-12 20:53:04 +00:00
Marcel Moolenaar
124ea6b5ac Update for the KDB framework:
o  Call kdb_enter() instead of Debugger().
2004-07-10 20:56:43 +00:00
Warner Losh
dfbaec0a6d Make the default memory range in the top 2GB of ram in the hopes that
this more accurately reflects what the underlying hardware of most
acpi machines that don't have children pci busses.

We still need a better way to get this information from acpi/hardware.
2004-07-04 16:23:25 +00:00
Nate Lawson
5a66986def Remove duplicate FreeBSD id. 2004-07-02 20:15:53 +00:00
Nate Lawson
99eb9c8b3b Get rid of the strict aliasing error by retrieving the ECDT via a table
header pointer and then casting it to the ecdt pointer.  This fixes the
-O2 build.  I'm unsure what changed recently to reveal this error since
this code has been unchanged for months.
2004-07-02 19:17:27 +00:00
Warner Losh
d9aa98f83b After re-exporting rman, et al, __RMAN_RESOURCE_VISIBLE is no longer
necessary for this file.  It just needed the size and guts of struct
rman.
2004-07-01 17:21:18 +00:00
John Baldwin
39981fed82 Trim a few things from the dmesg output and stick them under bootverbose to
cut down on the clutter including PCI interrupt routing, MTRR, pcibios,
etc.

Discussed with:	USENIX Cabal
2004-07-01 07:46:29 +00:00
Nate Lawson
b0eefa38f9 Rework the code that waits for a response from the EC. Use an sx lock
instead of a mutex so we do not unblock it in msleep().  If we do this,
another event could occur, resetting the status register since reads
reset it.  While I'm here, remove the backoff approach.  Instead, sleep
in 10 ms chunks for up to the configured timeout using either DELAY (if
we aren't booted yet) or tsleep.

Help from:	dillon
Tested by:	Andrew Thompson andy AT fud.org.nz
2004-07-01 00:51:31 +00:00
Nate Lawson
3309d2fbc8 Add missing function debug trace macros to the new powerres functions.
Reported by:	phk
2004-06-30 20:31:13 +00:00
Warner Losh
0363a12688 Hide struct resource and struct rman. You must define
__RMAN_RESOURCE_VISIBLE to see inside these now.

Reviewed by: dfr, njl (not njr)
2004-06-30 16:54:10 +00:00
Nate Lawson
d4b9ff9179 Move flags into a private ivar so it can't collide with device flags.
Unify the code to disable GPEs with the enable code.  Shutdown is handled
the same way.  ACPI now does all wake/sleep prep for child devices so
now they no longer need to call external functions in the suspend/resume
path.  Add the flags to non-ACPI busses (i.e., pci).
2004-06-30 16:08:03 +00:00
Nate Lawson
d3b9d3d1d7 Add a method for referencing/switching power resources based on _PRW.
This brings us into line with the standard, which requires power resources
be enabled when wake is enabled for a given device.  Move the dereferencing
code into its own function, +acpi_pwr_dereference_resource().
2004-06-30 16:02:40 +00:00
Nate Lawson
340a7f6a9b Disable the EC GPE in the shutdown path. This is correct but is not known
to fix any bug.
2004-06-30 16:00:20 +00:00
Nate Lawson
346eda4f40 Diff reduction for style. 2004-06-30 15:10:02 +00:00
Nate Lawson
89fb5af803 Add new quirk code that disables problem BIOS versions. Remove old quirk
code that was never really used.  Print a message when disabling ACPI via
a quirk.  Allow the user to override the blacklist decision by setting
hint.acpi.0.disabled="0".  Add missing AcpiTerminate() calls; they are
needed to clean up if bailing out after AcpiInitializeSubsystem().
2004-06-30 04:49:54 +00:00
Nate Lawson
1bf4426682 Add the table quirk matching code. It matches rules defined in acpi_quirks
and sets the flags.  It also calls the machdep quirk code first.  This
allows table quirks (or whitelists) to override machdep quirks.
2004-06-30 04:45:32 +00:00
Nate Lawson
1a26ea7f2c Add machdep quirks functions. On i386, this disables acpi on systems with
BIOS dates earlier than Jan 1, 1999.  Add prototypes and quirks flags.
2004-06-30 04:42:29 +00:00
Nate Lawson
0e01bb0580 Staticize acpi_MatchHid() and include acpi_if.h 2004-06-29 19:03:50 +00:00
Nate Lawson
5fcc8a587e Use the acpi_id_probe() method instead of acpi_MatchHid(), which is now
static.
2004-06-29 19:02:27 +00:00
Nate Lawson
ce619b2e38 Add implementation of the ACPI methods which hands them off to ACPI-CA.
acpi_id_probe() returns NULL for no match or the ID string that matched
if the driver should attach.
2004-06-29 19:00:36 +00:00
Nate Lawson
d13e5a4065 Add acpi methods for HID/CID probing, evaluating objects, and walking the
namespace.  This is to allow decoupling of attachments from ACPI where they
need some functionality when ACPI is present but do not want to require ACPI
to always be loaded.
2004-06-29 18:56:14 +00:00
Nate Lawson
8c541590b6 Use a default of the FADT for matching CreatorId quirks. Use XSDT to mean
"match either RSDT or XSDT."
2004-06-29 14:32:06 +00:00
Nate Lawson
c796e27ba8 Include isa/pnpvar.h and remove a duplicate copy of PNP_EISAID. 2004-06-29 01:33:35 +00:00
Nate Lawson
636af3826f While booting, use DELAY() for waiting for the EC to respond instead of
msleep().  Until we're finally up, msleep is a no-op.

Explained by:	peter
2004-06-28 20:41:30 +00:00
Warner Losh
ed67d9de40 rman_reserve_resource doesn't set the bushandle, so we have to do it here.
Badness noted by: njl
Perforce reply not read by: imp
2004-06-28 03:36:37 +00:00
Warner Losh
a323657048 MFp4: Set the bus handle to the bus handle of the resource, not the
starting value.  This is more pedantically correct (since the handle
isn't always identical to the start of the resource) and also doesn't
access the innards of struct resource direct (which I forbid in my
tree).  We need to do this for all resource types, not just ioport.

Reviewed by: njl
2004-06-27 13:04:19 +00:00
Nate Lawson
bef5734687 Update some comments and remove non-standard notation. 2004-06-24 06:37:23 +00:00
Nate Lawson
e008d0c51c Add a quirks array based on matching ACPI tables. The entries in this file
are currently all bad BIOS revisions that will never be able to support
ACPI.  They were derived by examining which BIOS's are blacklisted by other
operating systems.  Other types of quirks will be possible here as well.
2004-06-24 06:27:05 +00:00
Nate Lawson
30d577a014 Attach the correct handle, not the one that was just deleted. Also,
remove some duplicated code.
2004-06-24 01:57:31 +00:00
Nate Lawson
80f0e4c265 Run the power off code directly instead of using indirection through
smp_rendezvous() to ensure we run on the BSP.  This reverts rev 1.128.
Add a comment indicating that MI code should be the one that runs all
shutdown functions on the BSP with the APs halted.  This should work
around problems in power off while waiting for the MI code to be improved.
2004-06-24 00:48:45 +00:00
Nate Lawson
4a03551ddd Use uintmax_t for CPU statistics and add a cast to prevent truncation of
the statistics in a multiply.

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

Reviewed by:	njl (1, an earlier version)
2004-06-23 17:21:02 +00:00
John Baldwin
81bb99d26b Now that we associate a device_t with ACPI device handles, lookup the
device associated with any PCI devices that are enumerated in the ACPI
tree when adding children to an ACPI PCI bus and remove the duplicate
ACPI-only device_t and replace the device_t associated with the handle with
the ACPI and PCI aware device_t.
2004-06-23 15:08:40 +00:00
Christian Brueffer
889608790b Fix typos and add spaces before `(' in some comments
Submitted by:	markus
Approved by:	njl
MFC after:	3 days
2004-06-22 08:23:26 +00:00
Nate Lawson
3e7fa136ea Add more precision to the cx_usage sysctl output and special-case 0%.
Submitted by:	YONETANI Tomokazu <qhwt+freebsd-acpi AT les.ath.cx>
2004-06-19 02:27:23 +00:00
Nate Lawson
98910d5551 Remove compat code and unused lock declarations. 2004-06-18 17:58:11 +00:00
Nate Lawson
c5fe3c3311 Remove compat defines. 2004-06-18 17:56:45 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
John Baldwin
522542cc9c Revert the removal of the initial_irq hack for now as this code is more
broken than I thought and doesn't do a good job of routing virgin
interrupts at all.
2004-06-14 18:54:14 +00:00