Commit Graph

617 Commits

Author SHA1 Message Date
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Nate Lawson
2f3f3112c8 Minor cleanup: Reduce stack usage in probe method. Outdent probe. Use
TRUE/FALSE instead of 1/0 for booleans.  Remove trailing and extra whitespace.
2004-12-27 05:42:32 +00:00
Nate Lawson
d05fa56bb3 Remove trailing whitespace. 2004-12-27 05:36:47 +00:00
Nate Lawson
8c702862e4 Only use the current value if there's one IRQ. Some systems return
multiple IRQs (which is nonsense for _CRS) when the link hasn't been
programmed.  Before, this was a KASSERT.  A ServerWorks system was
seen returning IRQs of 0, 2 in response to _CRS before link setup.
Thanks to sam@ for quick testing and turnaround on this.

Tested by:	sam
2004-12-20 10:46:56 +00:00
Nate Lawson
54640fac34 Only report a critical battery level once until it's gone non-critical.
An improvement would be to check all batteries for critical state before
printing a message.

Reported by:	Kevin Oberman (oberman at es net)
2004-12-20 05:03:41 +00:00
Nate Lawson
276cd9216d Unify ACPI_DEBUG support for all OEM drivers under ACPI_OEM. Since more than
one will never be supported on the same platform, this does not hurt
debugging.

MFC after:	3 days
2004-12-13 23:31:46 +00:00
Nate Lawson
6c69283ca8 Re-enable link programming on resume. It appears the previous bounds
error had caused the hang and it has been corrected now.
2004-12-13 06:59:34 +00:00
Scott Long
82d4da0f73 Allow the acpi_ibm module to be built with ACPI_DEBUG. 2004-12-13 03:22:11 +00:00
Nate Lawson
5d3d03f152 Grab Giant around calls to DEVICE_SUSPEND/RESUME in acpi_SetSleepState().
If we are resuming non-MPSAFE drivers, they need Giant held for them.
This may fix some obscure suspend/resume problems.  It has fixed keyrate
setting problems that were triggered by cardbus (MPSAFE) changing the
ordering for syscons resume (non-MPSAFE).  Also, add some asserts that
Giant is held in our suspend/resume and shutdown methods.

Found by:	iedowse
MFC after:	2 days
2004-12-05 01:35:18 +00:00
Nate Lawson
834a79de94 Enable the relaxed behavior for op regions and other workarounds for
non-standard BIOSen.  We used to implement this in local patches but
now that ACPI-CA has merged/re-implemented most of our fixes, they were
no longer needed and we just needed to turn this knob on.  Also, remove
an unnecessary cast.

Tested by:	phk
2004-12-03 08:01:09 +00:00
Nate Lawson
10ce62b975 Turn ACPI and PCI devices off or to a lower power state in suspend and
back on again in resume.  Override the default of D3 with the value the
BIOS specifies in _SxD, if present.  Skip serial devices (PNP05xx) since
they seem to hang when set to D3 and may require special driver support.
Also, skip non-type 0 PCI devices (i.e., bridges) since our we don't yet
save/restore their config space and that seems to be necessary.

If this gives you trouble with suspend/resume, you can disable the new
ACPI and PCI power behavior separately with these tunables & sysctls:
    debug.acpi.do_powerstate
    hw.pci.do_powerstate

Approved by:	imp (pci)
Tested by:	acpi@ (numerous)
2004-12-02 08:07:12 +00:00
Nate Lawson
ef205c82ca Add the ACPI_PWR_FOR_SLEEP method. It takes a device and outputs the
appropriate power (Dx) state, if the BIOS suggests one.

MFC after:	3 weeks
2004-12-02 08:04:57 +00:00
Mark Santcroos
f8c60df7a6 Catch up with AcpiOsSleep() interface change.
Catch up with some #define's renaming.
Implement AcpiOsGetTimer() as per ACPI 3.0.

Approved by:	njl
MFC after:	1 week
2004-12-02 00:25:35 +00:00
John Baldwin
7e1f562e2a - Do a better job of handling any Dependent Functions (aka DPFs) that appear
in the _PRS or _CRS of link devices.  If faced with multiple DPFs in a
  _PRS, we just use the first one.  We assume that if _CRS has DPF tags they
  only contain a single set since multiple DPFs wouldn't make any sense.  In
  practice, the only DPFs I've seen so far for link devices are that the one
  IRQ resource is surrounded by a DPF tag pair for no apparent reason, and
  this should handle that case fine now.
- Only allocate link structures for IRQ resources for link devices rather
  than allocating a link structure for every resource.

Reviewed by:	njl
Tested by:	phk
2004-12-01 21:05:02 +00:00
Nate Lawson
ba1c3b5304 Completely back out 1.37. Something else is going on and John wants to
keep the locking and solve the real problem.
2004-12-01 05:49:26 +00:00
David E. O'Brien
0297d51ea3 Fix "Lock ACPI PCI link not exclusively locked
@sys/dev/acpica/acpi_pci_link.c:153" panic by backing out rev 1.37 in the SMP
case.  It appears that on a dual-proc machine the assertions in the rev 1.37
commit log hold true.
2004-12-01 04:34:08 +00:00
Nate Lawson
06faf06ac5 Don't bother locking in attach(). At boot time, we're single-threaded
anyway and for some reason, witness seems confused about what's already
locked and triggers a false panic.
2004-11-30 17:48:10 +00:00
Nate Lawson
ad71daf0cb Make sure the link array is big enough to hold both _CRS and _PRS
resource lists.  It used to be sized based only on _CRS, hence _PRS could
perform an out-of-bounds access if it was larger (i.e., when there are
dependent functions).  Add asserts to detect this case.  Note, this is
only a temporary fix and I believe _PRS and _CRS should have separate
arrays.

Also, fix a typo where the wrong irq was being check for the APIC case.

Submitted by:	tegge
2004-11-30 06:55:43 +00:00
Nate Lawson
a811035e4f Instead of translating PCI to ACPI power states, just use a CTASSERT
that they are equivalent.
2004-11-29 18:48:51 +00:00
Nate Lawson
4a29e1698c Temporarily disable programming IRQ links on resume. The new code hangs
several of my systems.
2004-11-26 23:31:59 +00:00
John Baldwin
2dacd5d401 - Remove some no longer used constants.
- Sort function prototypes.
2004-11-23 22:30:03 +00:00
John Baldwin
5e1ba6d4ae Rework the ACPI PCI link code.
- Use a new-bus device driver for the ACPI PCI link devices.  The devices
  are called pci_linkX.  The driver includes suspend/resume support so that
  the ACPI bridge drivers no longer have to poke the links to get them
  to handle suspend/resume.  Also, the code to handle which IRQs a link is
  routed to and choosing an IRQ when a link is not already routed is all
  contained in the link driver.  The PCI bridge drivers now ask the link
  driver which IRQ to use once they determine that a _PRT entry does not
  use a hardwired interrupt number.
- The new link driver includes support for multiple IRQ resources per
  link device as well as preserving any non-IRQ resources when adjusting
  the IRQ that a link is routed to.
- The entire approach to routing when using a link device is now
  link-centric rather than pci bus/device/pin specific.  Thus, when
  using a tunable to override the default IRQ settings, one now uses
  a single tunable to route an entire link rather than routing a single
  device that uses the link (which has great foot-shooting potential if
  the user tries to route the same link to two different IRQs using two
  different pci bus/device/pin hints).  For example, to adjust the IRQ
  that \_SB_.LNKA uses, one would set 'hw.pci.link.LNKA.irq=10' from the
  loader.
- As a side effect of having the link driver, unused link devices will now
  be disabled when they are probed.
- The algorithm for choosing an IRQ for a link that doesn't already have an
  IRQ assigned is now much closer to the one used in $PIR routing.  When a
  link is routed via an ISA IRQ, only known-good IRQs that the BIOS has
  already used are used for routing instead of using probabilities to
  guess at which IRQs are probably not used by an ISA device.  One change
  from $PIR is that the SCI is always considered a viable ISA IRQ, so that
  if the BIOS does not setup any IRQs the kernel will degenerate to routing
  all interrupts over the SCI.  For non ISA IRQs, interrupts are picked
  from the possible pool using a simplistic weighting algorithm.

Tested by:	ru, scottl, others on acpi@
Reviewed by:	njl
2004-11-23 22:26:44 +00:00
Nate Lawson
ae56b59f8b Enable throttling/C3 quirks for PIIX4 parts. Defer checking quirks until
after boot so that PCI is initialized and we can probe for the problem
chipsets.  Note that while probed but unusable states are disabled, they
aren't freed yet.  In the future, it may make sense to detach them.

Tested by:	Adam K Kirchoff <adamk at voicenet com>
MFC after:	2 days
2004-11-16 18:47:42 +00:00
Warner Losh
c2aed5122b After discussions with Nate, repo copy the acpi assist drivers from
i386 to dev/acpi_support.  In theory, these devices could be found
other than in i386 machines only as amd64 becomes more popular.  These
drivers don't appear to do anything i386 specific, so move them to
dev/acpi_support.  Move config lines to files so that those
architectures that don't support kernel modules can build them into
the kernel.  At the same time, rename acpi_snc to acpi_sony to follow
the lead of all the other specialty devices.
2004-11-15 05:54:15 +00:00
Don Lewis
f38e4909dd s/return_VALUE/return / to fix build breakage when ACPI_DEBUG is
defined.
2004-11-14 20:37:41 +00:00
Warner Losh
f454a309d3 Kill ACPI_FUNCTION_TRACE. It is killing the tinderbox build, and it
isn't worth adding to the modules lists that we have to hard code for
this to work.  Since we print PID right away, we have a trace point
already.

Minor knf while I'm here.
2004-11-13 23:39:56 +00:00
Warner Losh
dbacb6c44d Commit takawata-san's Sony Notebook Controller driver, integrated into
the tree.  Small tweaks were made by myself to eliminate unnecessary
includes and some other minor issues.  Last time I asked takawata-san
about this driver, he suggested I commit it.

Submitted by: takawata
2004-11-11 22:54:58 +00:00
John Baldwin
20447d54c4 Only warn about missing _PRT tables if bootverbose is set. I've yet to see
a bridge without a _PRT were a _PRT was needed.  Instead, the warning in
dmesg is a false warning and only serves to cause unnecessary concern.

MFC after:	1 week
2004-11-11 22:33:08 +00:00
Nate Lawson
5b8c471915 unsigned long -> u_long 2004-11-09 07:02:33 +00:00
Nate Lawson
cbd886065b Tell the BIOS we want to handle brightness switching as well as output
switching.  Don't initialize variables in their declaration.  Reduce stack
usage for device names.  Minor style cleanups.

MFC after:	1 week
2004-11-09 04:41:30 +00:00
Poul-Henning Kamp
2a921b0543 Make the bootverbose output from qualitydetermination of the ACPI timer
take up only one line.
2004-11-03 09:09:13 +00:00
Dag-Erling Smørgrav
b0e1e474f7 Add TUNABLE_LONG and TUNABLE_ULONG, and use the latter for the
hw.pci.host_mem_start tunable.  Add comments to TUNABLE_INT and
TUNABLE_QUAD recommending against their use.

MFC after:	3 weeks
2004-10-31 15:50:33 +00:00
Dag-Erling Smørgrav
38228f7221 Whitespace cleanup 2004-10-31 15:02:53 +00:00
Nate Lawson
2c8d3b23ed Print before the footer, not after. 2004-10-13 07:29:29 +00:00
Nate Lawson
a91c5fa830 If flags are present, print them like ISA does.
MFC after:	1 day
2004-10-13 07:27:21 +00:00
Nate Lawson
9e0dd54fea Attach the device description for ISA devices on the ACPI bus.
MFC after:	1 day
2004-10-12 21:33:08 +00:00
Nate Lawson
f435261d6d Update C3 support when BM control is not present.
* Fix a bug where caches were flushed on non-C3 transitions.
* Be sure a working flush cache instruction is present before using it.
* Disable C3 completely if it isn't present.
2004-10-11 21:15:10 +00:00
Warner Losh
fd492ee0e6 Make the lower range of the memory area 0x80000000 again. Also
introduce hw.{pci,acpi}.host_mem_start tunable to change this.

MFC: ASAP
2004-10-11 21:10:23 +00:00
Nate Lawson
a0885d3f14 Notify the user when the battery is critically low. In the future, we
may want to shut down here but the chance of BIOS vendors getting this
wrong is high.  They're only supposed to announce this when all batteries
hit their critical level but past experience indicates we should be
conservative about this for now.
2004-10-11 06:18:07 +00:00
Nate Lawson
18ececa0b8 If bus mastering control is not available (PM2_BLK), don't just disable
C3.  Instead, flush caches before entering C3.  This may be slower but
provides good power savings.
2004-10-11 06:06:42 +00:00
Nate Lawson
31ad3b8802 Move the code for halting the CPU (acpi_cpu_c1) into machdep files.
This removes the last MD portion of acpi_cpu.c.

MFC after:	2 weeks
2004-10-11 05:39:15 +00:00
Nate Lawson
4f8c4e4d53 Update a quirk for the ASUS P5A to disable the timer. It appears to work fine
with acpi but the timer runs twice as fast.  Note that the main problem
(system doesn't work properly with acpi disabled) should be fixed separately.

Changes:
* Add a quirk to disable the timer
* Merge the P5A and P5A-B quirks since they appear to be based on the
  same ASL.

PR:		i386/72450
Tested by:	Kevin Oberman <oberman es.net>
MFC after:	3 days
2004-10-08 17:56:47 +00:00
Warner Losh
5cee9db399 For older systems with ACPI which don't have a pci <-> pci bridge,
allocate unallocated memory resources from the top 32MB of the address
space rather than the top 2GB.  While the latter works on some
chipsets, it fails badly on others.  32MB is more conservative and
matches what cheap harware from this era is hardwired to pass.
2004-10-06 07:26:52 +00:00
Nate Lawson
67e87637df When the user overrides the DSDT, replace any SSDTs with a simple no-op
table.  acpidump(8) concatenates the body of the DSDT and SSDTs so an
edited ASL will contain all the necessary information.  We can't use a
completely empty table since ACPI-CA reports this as a problem.

MFC after:	3 days
2004-10-05 20:41:44 +00:00
Nate Lawson
6e1151b6ab Allow routing to the SCI even if it's not in the list of valid IRQs.
MFC if:		no problems
2004-09-25 06:15:56 +00:00
John Baldwin
e0a9358679 Add a couple of macros to extract the PCI slot (device) and function from
an ACPI _ADR value and use that rather than inlining the same shifts and
masks everywhere.
2004-09-22 15:46:16 +00:00
Nate Lawson
95c973ff52 Initialize the flags value properly. We used to do this in acpi_tz_all_off()
but that function has been removed.  This avoids a potential unnecessary
fan switch on boot.  Also remove some commented out code.

MFC after:	3 days
2004-09-21 18:39:10 +00:00
Nate Lawson
ba36768b22 Don't disable acpi in shutdown if we're panicing (panicstr != NULL). This
may help with double panics.
2004-09-21 17:19:38 +00:00
Nate Lawson
520467d3ba Record a problem we can't workaround for now regarding duplicate interrupts
because of links left enabled while in APIC mode.  A large scale rework of
irq links is underway by jhb@ which should fix this eventually.
2004-09-20 05:56:01 +00:00
Nate Lawson
ad7b13796e Don't print a warning message if the _CRS value is empty. This is already
covered by other printfs under ACPI_DEBUG and is not a failure case.

MFC after:	3 days
2004-09-16 17:19:16 +00:00