Commit Graph

617 Commits

Author SHA1 Message Date
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
Nate Lawson
59e472e952 Remove disable_on_poweroff and our pre-sync shutdown handler. Disabling
of GPEs is now done in acpi_shutdown() and so we no longer need the option
of disabling ACPI in the poweroff case.
2004-06-14 04:37:45 +00:00
Nate Lawson
b82ca9a91f Clean up acpi_probe_order() a bit and clarify some comments. 2004-06-14 04:01:12 +00:00
Nate Lawson
f504b6074b Don't probe/attach in the ACPI_DEBUG case. 2004-06-14 03:52:19 +00:00
Nate Lawson
9123341378 Add support to ACPI to manage its own resources. Previously, resource
allocation was passed up to nexus.  Now, we probe sysresource objects and
manage the resources they describe in a local rman pool.  This helps
devices which attach/detach varying resources (like the _CST object) and
module loads/unloads.  The allocation/release routines now check to see if
the resource is described in a child sysresource object and if so,
allocate from the local rman.  Sysresource objects add their resources to
the pool and reserve them upon boot.  This means sysresources need to be
probed before other ACPI devices.

Changes include:
* Add ordering to the child device probe.  The current order is:  system
resource objects, embedded controllers, then everything else.
* Make acpi_MatchHid take a handle instead of a device_t arg.
* Replace acpi_{get,set}_resource with the generic equivalents.
2004-06-13 22:52:30 +00:00
Nate Lawson
59a890e6a3 Associate a device_t with an ACPI_HANDLE. This make AcpiWalkNamespace more
useful.  If ACPI-CA allowed null object handlers, we wouldn't need the
placeholder function.
2004-06-13 17:29:35 +00:00
Nate Lawson
1f36889f63 Remove accidental change. 2004-06-07 21:44:01 +00:00
Nate Lawson
45e556cc69 Avoid printing extraneous warning messages when trying to switch a device
which doesn't support ACPI power states.  Return AE_NOT_FOUND for these
cases and don't print the warning message.  Also, print the name of the
handle instead of device when unable to switch states.  The device is often
not attached at this point and so its name is NULL, which doesn't help
debugging.
2004-06-07 21:39:15 +00:00
John Baldwin
4dc4ea2604 - Use PCI_INVALID_IRQ macro rather than a magic number.
- Remove obsolete comment about APIC_IO routing.
2004-06-07 17:36:22 +00:00
Nate Lawson
0e4148688c Don't forget to pass shutdown events down to children first now that we
handle them at the bus level too.
2004-06-05 09:56:04 +00:00
Nate Lawson
169b539a33 Disable wake GPEs in the reboot path as well as poweroff path. This fixes
"stray irq 9" messages on my Thinkpad.  It may also help with general
reboot consistency although the recent hang on reboot was solved by
acpi_cpu.c rev 1.39.
2004-06-05 07:25:58 +00:00
Nate Lawson
a2afe45a8a Rework acpi_cpu_idle() to select the next idle state before sleeping, not
after.  Unify the paths for all Cx states.  Remove cpu_idle_busy and
instead do the little profiling we need before re-enabling interrupts.
Use 1 quantum as estimate for C1 sleep duration since the timer interrupt
is the main reason we wake.

While here, change the cx_history sysctl to cx_usage and report statistics
for which idle states were used in terms of percent.  This seems more
intuitive than counters.  Remove the cx_stats structure since it's no
longer used.  Update the man page.

Change various types which do not need explicit size.
2004-06-05 07:02:18 +00:00
Peter Wemm
f2b6954343 Work around the preemption problem in acpi_cpu.c for shutting down.
Submitted by:  nate / jhb
2004-06-04 17:03:18 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Nate Lawson
2b9609ab9b Decrease sleep_delay default to 1 second now that the machines that
required the 5 second delay have been fixed.
2004-05-29 05:34:04 +00:00
Nate Lawson
5acd02180c Style cleanups, don't set the device description before the probe routine
has completed successfully.
2004-05-29 04:32:50 +00:00
John Baldwin
91c14f698c Don't assume that the current setting (_CRS) of a PCI link device is
correct.  Instead, check it against the possible settings (_PRS) when
the link is probed.  This is important when using APIC mode but link
devices still have PIC mode settings.  This is also what Linux does.

Additional prodding by:	Len Brown len dot brown at intel dot com
2004-05-28 17:31:32 +00:00
Nate Lawson
e3aa81b84d Style fixes. 2004-05-28 16:38:37 +00:00
Nate Lawson
043498df33 Now that we properly disable GPEs before entering a sleep state, including
S5 (soft off), we don't need to disable ACPI when powering off.  This may
fix some systems that don't power off correctly.
2004-05-28 07:16:52 +00:00
Nate Lawson
54af2f27c7 Style cleanups. "extern" is unneeded for function prototypes. 2004-05-28 07:15:55 +00:00
Nate Lawson
cc85c78ce3 Update the new suspend/resume GPE methods to properly limit the GPE
based on the destination sleep state.  Add a method to restore the old
state on resume.  This is needed for the case of suspending to a very low
state disabling a GPE (i.e. S4), resuming, and then suspending to a higher
state (i.e. S3).  This case should now keep the proper GPEs enabled.
2004-05-28 07:04:09 +00:00
Nate Lawson
44b8ae7193 Pass a pointer to the sleep state instead of casting gymnastics to pass
the value itself in the pointer.
2004-05-28 06:32:16 +00:00
Nate Lawson
5c9ea25e69 Fix paste-o. 2004-05-28 06:29:30 +00:00
Nate Lawson
88a79fc05b Attach per-device sysctls to allow users to set whether or not a given
device can wake the system.  For example:

    dev.root0.nexus0.acpi0.acpi_lid0.wake: 1
    dev.root0.nexus0.acpi0.acpi_button0.wake: 1
    dev.root0.nexus0.acpi0.pcib0.wake: 0
    dev.root0.nexus0.acpi0.sio0.wake: 0
2004-05-28 06:28:55 +00:00
Marcel Moolenaar
80c74f3d56 Fix LP64 environments: cast a pointer type to intptr_t before casting
to int and vice versa.
2004-05-28 02:50:43 +00:00
Nate Lawson
e8b4d56eb5 Restructure the wake GPE API. Now there are three functions:
acpi_wake_init:
    Evaluate _PRW and set the GPE type
acpi_wake_set_enable:
    Enable or disable a device's GPE.
acpi_wake_sleep_prep:
    Perform any last-minute changes to the device to prepare it for
    entering the given sleep state.

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

This clears the way for non-ACPI-aware devices to wake the system (i.e.
modems) and fixes a problem where systems power up after shutdown when a
GPE is triggered.
2004-05-27 18:38:45 +00:00
Nate Lawson
841caa96b4 Enable GPE at runtime rather than suspend time. This is to match the
new behavior in ACPI-CA that defers GPE configuration.  This is a temporary
measure while reworking the GPE interface.
2004-05-25 16:17:39 +00:00
Nate Lawson
09a98d8ce9 Remove call to _INI for thermal devices. ACPI-CA now calls _INI for
Devices, ThermalZones, and Processors.
2004-05-25 04:18:22 +00:00
Nate Lawson
f3fc4f8b4a Changes to implement 20040514:
* Add calls to AcpiSetGpeType.  We use wake/run as the type for lid and
button switches since wake-only causes Thinkpads to immediately wake on
the second suspend.  Note that with wake/run, some systems return both
wake and device-specific notifies so we don't register for system notifies
for lid and button switches.
* Remove the hw.acpi.osi_method tunable since it is not needed.
* Always print unknown notifies for all types.
* Add more cleanup for the EC if it fails to attach.
* Use the GPE handle now that we parse it.  This allows GPEs to be defined
in AML GPE blocks.
* Always use ACPI_NOT_ISR since it's ok to acquire a mutex in our thread
which processes queued requests.
2004-05-25 02:47:35 +00:00
Nate Lawson
12957d4991 Revert the previous commit. The bus accessor macros do not check the
return value for BUS_READ_IVAR and thus don't generate the proper NULL
in cases where a device (i.e. on PCI) does not have a handle.

Found by:	peadar, tjr
2004-05-22 17:19:59 +00:00
Nate Lawson
14e2b11f18 Use the simpler __BUS_ACCESSOR macros for ivars instead of defining them
ourselves.
2004-05-18 16:53:29 +00:00
Nate Lawson
0025fb0f4f Add support for GPE being a package of { reference, gpe bit }.
Rework the ECDT probe to pass all the parameters in a temporary struct.
Note why we are mostly ok evaluating _GLK so early.
2004-05-14 04:17:56 +00:00
Nate Lawson
c868ac7d12 Add support for retrieving _GLK in the ECDT probe. Now we no longer always
use the global lock at the beginning of the ECDT probe.  Instead, we use
the handle from the ECDT to call _GLK.  Also, unify the device description.
2004-05-13 03:17:08 +00:00
John Baldwin
fb0ac5433b If an ACPI PCI-PCI bridge doesn't have a _PRT object, fall back to using
the swizzle method for routing PCI interrupts across the bridge.  This
fixes problems with motherboards (typically laptops) whose BIOS doesn't
provide a PRT for the AGP bridge even though there is a device entry for
the bridge in the ACPI namespace.

Tested by:	Kenneth Culver culverk at sweetdreamsracing dot biz
2004-05-10 18:26:22 +00:00
Nate Lawson
ccc09458fa Change hw.acpi.cpu.cx_lowest to accept values in the form of C1,
C2, ...  Update power_profile to use the new format.  Update the
man page to reflect this and give more info on Cx states.
2004-05-07 05:22:38 +00:00
Nate Lawson
b0e2b625f2 Rename acpi_cpu to cpu. Change the probe routine to early on reject
devices it cannot attach to.  This gets rid of extraneous but harmless
device_probe_and_attach() errors.  While I'm here, make the device
description more useful.  The !acpi case for cpu is handled by legacy0.
2004-05-06 17:25:23 +00:00
Nate Lawson
ea27c63ec6 Select the highest valid (i.e., S3) sleep state for the default for the
sleep button.  Change the default for the lid switch to NONE.  This can
be overridden in /etc/sysctl.conf as desired.
2004-05-06 08:04:34 +00:00
Nate Lawson
2fb3498126 Add back sys/reboot.h which is needed. 2004-05-06 02:57:24 +00:00
Nate Lawson
869ec176fc Make unnecessary globals static and remove unused includes.
Pointed out by:	cscout
2004-05-06 02:18:58 +00:00
Nate Lawson
7e639165c2 Fix setting debug strings via sysctl. Also, clean up the way we print
debug strings.
2004-05-06 02:05:45 +00:00
Nate Lawson
c8dd768173 Remove extra parentheses. 2004-05-05 20:07:52 +00:00
Nate Lawson
65a7c90189 Add an MI implementation of the ACPI global lock routines and retire the
individual asm versions.  The global lock is shared between the BIOS and
OS and thus cannot use our mutexes.  It is defined in section 5.2.9.1 of
the ACPI specification.

Reviewed by:	marcel, bde, jhb
2004-05-05 20:04:14 +00:00
Takanori Watanabe
d33f4987f6 Fix build breakage.
Submitted by: Xin LI <delphij@frontfree.net>
PR: 65979
2004-04-26 08:49:11 +00:00
Nate Lawson
904bf0c2f7 Move the call to AcpiEnterSleepStatePrep() to before we select the BSP
(cpuid 0) as the processor.  It mallocs some data and smp_rendezvous
calls functions with locks held.
2004-04-26 05:25:06 +00:00
Warner Losh
1c168bb710 Fix two typos from PR: 65694
1) In pci.c, we need to check the child device's state, not the parent
   device's state.
2) In acpi_pci.c, we have to run the power state change after the acpi
   method when the old_state is > new state, not the other way around.

Submitted by: Dmitry Remesov
PR: 65694
2004-04-26 02:11:38 +00:00
Nate Lawson
c0b9a6de4a Disable interrupts while testing the timer. Not doing this unnecessarily
added an arbitrary delay to our readings, causing us to use the ACPI-safe
read method when not necessary.  Submitted by: bde

Old:
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks BAD  min = 3, max = 19, width = 16
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks BAD  min = 3, max = 19, width = 16
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 4, width = 1
Timecounter "ACPI-safe" frequency 3579545 Hz quality 1000

New:
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000

Also, reduce unnecesary overhead in ACPI-fast by remove the barrier for
reads.  The timer in the ACPI-fast case is known to increase monotonically
so there is no need to serialize access to it.
2004-04-24 16:25:00 +00:00
Philip Paeps
9a1fc77e3a Add the ACPI Asus extras driver. Provides support for cool ACPI-controled
gadgets (hotkeys, lcd, ...) on Asus laptops.  I aim to closely track the
acpi4asus project which implements these features in the Linux kernel.

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

Approved by:	njl (mentor)
2004-04-22 21:29:02 +00:00
Nate Lawson
d9b6df606a Fix stepping in ddb by not checking for a maximum interval. The ACPI-safe
workaround was for hardware where the clock was not latched, not for
hardware that was too slow.  Also, make variable names more specific for ddb
printing.
2004-04-22 01:50:08 +00:00
Nate Lawson
af807c0f33 Add comments, including restoring the PIIX4 errata comment, to indicate
what the ACPI-safe workaround is intended to fix.  Requested by phk.

Set the bushandle and tag when attaching the timer, don't do it each time
in read_counter().  Pointed out by bde.

Move test_counter() to the end.  Staticize acpi_timer_reg.
2004-04-21 18:07:21 +00:00
Nate Lawson
75988358a2 Fix several bugs where 32-bit timers and wraparound were not properly
supported.  Symptoms of this bug included unnecessary use of ACPI-safe
and a dmesg that has deltas of about 2^24:

    ACPI timer looks BAD  min = 2, max = 16777206, width = 16777204
    ACPI timer looks BAD  min = 2, max = 7, width = 5
    ACPI timer looks GOOD min = 4, max = 5, width = 1
    ACPI timer looks BAD  min = 2, max = 16777206, width = 16777204
    ACPI timer looks BAD  min = 2, max = 7, width = 5
    ACPI timer looks BAD  min = 2, max = 16777210, width = 16777208
    ACPI timer looks BAD  min = 4, max = 16777189, width = 16777185
    ACPI timer looks GOOD min = 4, max = 5, width = 1
    ACPI timer looks BAD  min = 2, max = 7, width = 5
    ACPI timer looks BAD  min = 4, max = 16777189, width = 16777185

To fix this:
* Use a 32 bit timecounter mask when the timer is 32 bits.
* In test_counter(), use the acpi_TimerDelta function which handles 24/32
  bit timers and wraparound.

Miscellaneous fixes:
* Use C99 initializers for timecounter struct.
* Use u_int and uint32_t where appropriate instead of unsigned.
* Remove whitespace-only lines
* Remove the old PIIX4 PCI workaround.  The timecounter testing code has
  been in use for long enough to prove it's functional.
2004-04-21 00:48:16 +00:00
Nate Lawson
8d01ceefd8 Remove extran parens. 2004-04-21 00:38:54 +00:00
Nate Lawson
eea17c34cd Move the timer difference convenience function from acpi_cpu.c to make it
globally available.  acpi_TimerDelta() subtracts two readings from the
ACPI PM timer and returns the difference.  It properly distinguishes between
24-bit and 32-bit timers and handles wraparound.
2004-04-21 00:36:15 +00:00
Nate Lawson
43813837ed Style fixes. 2004-04-20 17:13:08 +00:00
Nate Lawson
0b84952197 Allow the AC adapter device to be disabled with debug.acpi.disable="acad".
Even though documented, this option was never enabled even in rev 1.1.

Submitted by:	sos
2004-04-20 13:09:17 +00:00
Nate Lawson
4ed2b85d66 Add a temporary workaround for acpi_AppendBufferResource() returning with
a NULL crsbuf pointer.  This shouldn't happen if it returns AE_OK.  We'll
figure out why this is happening later.

Submitted by:	Bruno Ducrot <ducrot@poupinou.org>
2004-04-19 17:52:20 +00:00
Nate Lawson
a50f2c9f42 Disable the new wake GPE behavior. With it enabled, my laptop won't stay
suspended after the second try.  Intel is working on a fix to properly
differentiate the non-standard wake/runtime GPEs from wake-only GPEs.
2004-04-16 16:27:37 +00:00
Nate Lawson
a34ec6cdf6 Return an error immediately if asked to switch a non-existent consumer. 2004-04-14 17:58:19 +00:00
Nate Lawson
865b8d0bfd Remove a non-variable static and move other static variables to the same
location.
2004-04-14 17:48:33 +00:00
Nate Lawson
dfd36c130b Fix some warnings by commenting out unused code. 2004-04-14 17:47:42 +00:00
Nate Lawson
916dc0e20c Only try to set the ACPI power state if the handle is valid. There was
probably no problem with this except it may have had the side effect of
registering a NULL consumer.
2004-04-14 17:46:21 +00:00
Nate Lawson
0f4f8be30d Unbreak the DDB build by replacing #includes that were deleted.
Pointed out by:	Tai-hwa Liang, Xin LI
Pointed hat to:	njl
2004-04-14 16:24:28 +00:00
Nate Lawson
a3924cd9b4 Style cleanups, M_ZERO instead of bzero. 2004-04-14 03:45:20 +00:00
Nate Lawson
e4a5123464 Style cleanups, use M_ZERO instead of bzero, unify the !semaphore and
semaphore return paths.
2004-04-14 03:43:06 +00:00
Nate Lawson
e6f06f99f6 Style cleanup, plus properly backup partial resource allocation in
AcpiOsInstallInterruptHandler() in the case of failure to initialize.
2004-04-14 03:41:06 +00:00
Nate Lawson
c871a6da4c Style cleanups to reduce diffs to locking tree. 2004-04-14 03:39:08 +00:00
Nate Lawson
ea6b2bc923 Style and printf message cleanups. 2004-04-14 03:34:11 +00:00
Nate Lawson
c2b3a864be Use TRUE for a boolean and a style nit. 2004-04-14 03:30:09 +00:00
Nate Lawson
b7d13479aa Update the name for edge triggered for the 20040402 import. 2004-04-14 02:20:35 +00:00
Nate Lawson
881c6e063e Remove a check for the return value added in rev 1.41. It's not an error
to fail to turn off a fan, since the case is that it's usually already off.
2004-04-12 05:04:47 +00:00
Nate Lawson
64278df5e0 Add MODULE_DEPEND entries so some of these drivers can eventually be
loaded separately from ACPI (i.e., embedded use).
2004-04-09 18:14:32 +00:00
Warner Losh
cd8b53ed2d Omnibus PCI commit:
o Save and restore bars for suspend/resume as well as for D3->D0
	  transitions.
	o preallocate resources that the PCI devices use to avoid resource
	  conflicts
	o lazy allocation of resources not allocated by the BIOS.
	o set unattached drivers to state D3.  Set power state to D0
	  before probe/attach.  Right now there's two special cases
	  for this (display and memory devices) that need work in other
	  areas of the tree.

Please report any bugs to me.
2004-04-09 15:44:34 +00:00
Nate Lawson
aa95c5b148 Replace more ad-hoc versions of acpi_GetReference(). Since the type of
Reference objects changed from ACPI_TYPE_ANY to ACPI_TYPE_LOCAL_REFERENCE
in Oct. 2002, this may help systems where switching the cooler on failed.
We support both types for now until this sorts out.
2004-04-09 06:55:50 +00:00
Nate Lawson
4a74bb97ed Include the prototype for acpi_GetReference. 2004-04-09 06:53:50 +00:00
Nate Lawson
074a57f560 Add support for packages as the first element of _PRW. This may allow
some machines to enable wake events for more devices although I haven't
seen a system yet that uses this form.  Also, introduce acpi_GetReference()
which retrieves an object reference from various types.
2004-04-09 06:40:03 +00:00
Nate Lawson
a4ecd54325 Unify on version 1 to be similar to the rest of the tree. After 5-stable
branches, increment version on any API change visible to other modules.
2004-04-08 16:45:12 +00:00
John Baldwin
5233e9ffda Implement an ACPI-aware pci_set_powerstate() method for PCI busses that
are enumerated in the ACPI device tree.  In addition to the normal PCI
powerstate functionality, the ACPI _PSx methods are executed and ACPI
PowerResources are switched on and off via the acpi_pwr_switch_consumer()
function.

Glanced at by:	imp, njl
2004-04-07 19:42:21 +00:00
Nate Lawson
5eb09c7066 Move the ivar accessing routines back to inlines (reverting acpivar.h
rev 1.44 and acpi.c rev 1.96).  Now gcc can handle larger inlines and we
really need external drivers to be able to read their acpi ivars.
2004-04-01 04:21:33 +00:00
Nate Lawson
63600cc345 Staticize pnp methods, style fixes. Remove unused variable to unbreak
kernel build.
2004-03-31 17:35:28 +00:00
Takanori Watanabe
cd284d7a6a Add ACPI path in location string for ACPI namespace aware PCI device. 2004-03-31 17:27:19 +00:00
Nate Lawson
72ad60ada4 Add an interface to pass an argument to the resource parsing functions.
This is just groundwork for changing sysresource behavior.

PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:
2004-03-31 17:23:46 +00:00
Takanori Watanabe
247648affb Style fix.
Pointed out by: njl
2004-03-31 17:21:14 +00:00
Nate Lawson
c9b8d77d80 Disable serialize_methods and enable _OSI support by default. The former
is necessary because some IBMs use recursive methods (pointed out by
Robert Moore from Intel).  The latter was a typo on my part.  It was disabled
by default when it should have been enabled.
2004-03-30 07:35:18 +00:00
Takanori Watanabe
879d6c2306 Add ACPI PnP string. This affects devinfo(8) output with -v option. 2004-03-27 16:26:00 +00:00
Nate Lawson
e548abe75b Use the correct length for appending an extended irq resource. This may
have broken APIC routing.  This bug has been present since rev 1.33.
2004-03-22 20:39:20 +00:00
Nate Lawson
3dc52520c4 Shorten some printfs to fit better. No other functional changes. 2004-03-22 20:36:33 +00:00
Nate Lawson
3304735dd9 Whitespace and comment changes. No MD5 change to the object file. 2004-03-22 20:32:27 +00:00
Nate Lawson
8e1624b6f8 Fix loop termination condition for parsing resources in _PRS buffers.
This completes the effort to handle dependent functions, which are used
in some machines for irq link resources.  Also, clean up some nearby
comments while I'm at it.
2004-03-20 20:47:08 +00:00
Nate Lawson
eeb3a05f9a Move the poweroff handler to a separate function. Make sure it is run
on the boot processor (cpuid == 0).  Some chipsets do not power off the
system if the shutdown handler runs on an AP.
2004-03-19 07:05:01 +00:00
Nate Lawson
413081d79d Add tunables for disabling serialized method execution and disabling the
new _OSI method.  These can be used if these new features end up causing
regression for users.
2004-03-18 18:42:22 +00:00
Nate Lawson
d19b6e67ac Support the DPF (start dependent function) resource type in parsing _PRS.
This should fix this error people get attaching cardbus controllers:

    pcib0: _PRS resource entry has unsupported type 2
2004-03-18 02:33:58 +00:00
Nate Lawson
e5ada020f1 Fix border error to allow systems that specify 100 for latency also use
C2 and 1000 to use C3.

Submitted by:	Bruno Ducrot <ducrot@poupinou.org>
Tested by:	Scott Lambert <lambert@lambertfam.org>
2004-03-17 21:49:47 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Nate Lawson
dba55fa26d Simplify some logic in converting a buffer to an integer. 2004-03-09 05:44:47 +00:00
Nate Lawson
cc58e4ee5e Use an unsigned int instead of an int for the Get/Set Integer interface.
Pointed out by:	le
2004-03-09 05:41:28 +00:00
Nate Lawson
08b994c07e Document a sysctl.
Submitted by:	Craig Rodrigues <rodrigc@crodrigues.org>
2004-03-05 18:08:23 +00:00
Nate Lawson
9db195a8d1 A user can set tz_requested via the hw.acpi.thermal.tzX.active sysctl.
The previous logic meant that if a user sets it to a minimal cooling value
acpi_thermal will not use higher cooling levels.  Reverse the logic so that
the user requesting a level (say, 2) also gets 0 - 1 also.

PR:		kern/61592
Submitted by:	Andrew Thompson <andy@fud.org.nz>
2004-03-05 18:06:31 +00:00
Nate Lawson
4ed391b8d7 Fix an off-by-one error and rework our EC space handler. Writing to address
0xFF would fail previously as AE_BAD_PARAMETER.  It's unknown if this caused
any actual problems.
2004-03-04 05:58:50 +00:00
Nate Lawson
c181b89bc1 Don't disable Cx support and throttling on machines with a P_BLK_LEN != 6
even though the spec mandates this.  Some have a value of 5 to indicate
throttling + C2 and some have 7 to indicate an extra C3 state.  Support
throttling if the value is >= 4, C2 for >= 5, and C3 for >= 6.
2004-03-04 05:17:52 +00:00
Nate Lawson
4e376d58dc Add a "quirks" value to disable quirks handling for a given boot.
Also, disable quirks if booting with a custom DSDT.  Add a quirk
to disable loading ACPI so known bad systems can be completely
blacklisted.
2004-03-04 04:42:59 +00:00
Nate Lawson
c310653ea1 Change to acpi_{Get,Set}Integer to provide both methods. Convert all
callers to the new API.

Submitted by:	Mark Santcroos <marks@ripe.net>
2004-03-03 18:34:42 +00:00
Nate Lawson
3184cf5a6b Add support for quirks for acpi tables. Key off OEM vendor and revision.
Sort acpi debug values.  Change "disable" to "disabled" to match rest of
the kernel.  Remove debugging from acpi_toshiba since it was only used for
probe/attach.
2004-03-03 03:02:17 +00:00