Commit Graph

305 Commits

Author SHA1 Message Date
Nate Lawson
6c0e8467af Add necessary newlines. 2003-09-18 05:12:45 +00:00
Nate Lawson
a0e5a00957 Shorten the message announcing fixed power/sleep buttons. 2003-09-18 05:01:03 +00:00
Mitsuru IWASAKI
526b5e659d Add pci_resume() to reestablish interrupt routing after
suspend/resume.
Especially after hibernation, interrupt routing went back to initial
status on some machines.
2003-09-17 08:32:44 +00:00
Nate Lawson
c87cfaedf2 Bump the EC timeout from 50 to 100 ms. I believe the underlying issue is
global lock contention as symptoms only appear under heavy load (i.e. the
nightly periodic run).
2003-09-15 21:20:55 +00:00
Nate Lawson
2d610c4638 Only enable S4BIOS by default if the FACS says it is available. The
user can override this with a sysctl.

Be sure to return the acpi_SetSleepState return value to userland.
2003-09-15 06:29:31 +00:00
Nate Lawson
5f7e1e2f82 Print notify values as hex. 2003-09-14 17:47:44 +00:00
Nate Lawson
64fdad2352 Add the -i flag to acpiconf(8) to retrieve battery information.
Rename a few structure elements.
2003-09-13 20:13:01 +00:00
Nate Lawson
5c5967082f Add a system notify handler in addition to the device notify handler.
At least some Toshiba notebooks use a Notify of 0 or 1 for this.

PR:
Submitted by:	Hiroyuki Aizu <aizu@navi.org>
2003-09-11 03:17:33 +00:00
Marcel Moolenaar
24752c4291 Extend the ACPI resource handling to make use of the BUS_CONFIG_INTR()
method. This is necessary on ia64 where it's known that serial interfaces
described in the ACPI namespace may not have the well-known IRQs assigned
to them. This confuses us in thinking they are PCI based interrupts and
wrongly program the APIC.
2003-09-10 22:06:41 +00:00
John Baldwin
42a12b2bd8 Move the definitions for ACPI MADT table entries not present in the ACPICA
distribution to a MI header so it can be shared with other architectures.
2003-09-10 06:32:27 +00:00
Nate Lawson
9817561470 Disallow attempts to suspend to S0. It was only enabled for testing.
Print a more informative message if a sleep state is not supported by BIOS.
Add comments.
2003-09-09 04:09:25 +00:00
Nate Lawson
f97739da4d Don't free the buffer if it wasn't actually allocated. 2003-09-04 15:55:41 +00:00
Nate Lawson
ad1fdf57d2 Use the ACPICA AcpiEnterSleepStateS4bios instead of rolling our own. This
change also disables interrupts around non-S4 suspends whereas before we
did not do this.  Our version of AcpiEnterSleepStateS4bios was almost
identical to the ACPICA version.
2003-08-29 04:02:19 +00:00
John Baldwin
729d7ffbcf - Rename PCIx_HEADERTYPE* to PCIx_HDRTYPE* so the constants aren't so long.
- Add a new PCIM_HDRTYPE constant for the field in PCIR_HDRTYPE that holds
  the header type.
- Replace several magic numbers with appropriate constants for the header
  type register and a couple of PCI_FUNCMAX.
- Merge to amd64 the fix to the i386 bridge code to skip devices with
  unknown header types.

Requested by:	imp (1, 2)
2003-08-28 21:22:25 +00:00
Nate Lawson
be2b179704 Style and whitespace changes. Also, make the ivar functions non-inline
since inlining failed due to the size of BUS_*
2003-08-28 16:06:30 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
cace7a2a4d Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 06:06:16 +00:00
Takanori Watanabe
f09e4e876e Update my mail address on copyright notice.
Noticed by: njl
2003-08-19 01:54:34 +00:00
Poul-Henning Kamp
78a49a45bc Give timecounters a numeric quality field.
A timecounter will be selected when registered if its quality is
not negative and no less than the current timecounters.

Add a sysctl to report all available timecounters and their qualities.

Give the dummy timecounter a solid negative quality of minus a million.

Give the i8254 zero and the ACPI 1000.

The TSC gets 800, unless APM or SMP forces it negative.

Other timecounters default to zero quality and thereby retain current
selection behaviour.
2003-08-16 08:23:53 +00:00
Nate Lawson
92aa3b6885 Revert part of rev. 1.16 -- reinstate system notify handler. It turns out
at least the Casio FIVA requires this.

Requested by:	takawata
2003-08-15 06:33:11 +00:00
Nate Lawson
ec2e60b457 De-inline functions which do not need to be inline. Move the DEVMETHOD
block to where it is in similar drivers.
2003-08-15 02:18:15 +00:00
Nate Lawson
e9247df73d Don't install a system notify handler. Move the device notify handler
installation to just before we're ready to handle events.  Make a loop
more readable (no functional change).
2003-08-15 02:17:23 +00:00
Nate Lawson
59ddeb18b8 Fix a couple changes that were incorrect in updating for 0619. Only unlock
the hardware mutex if it is held.  Re-add calls to Enable/Clear fixed events.

This is not known to have caused problems.  Bug symptoms might have included
instability after an aborted suspend attempt or power/sleep buttons not
being enabled.
2003-08-15 02:10:38 +00:00
Nate Lawson
798fb860d5 Style cleanups to match the rest of this directory. For acpi_battery.c,
remove unused includes.
2003-08-11 15:34:43 +00:00
Nate Lawson
bf0c18ec43 Default to 5 seconds before sleeping to give some machines time to stabilize.
This doesn't break anything on my laptop and some claim it helps them.
2003-08-08 03:19:22 +00:00
John Baldwin
8b149b5131 Consistently use the BSD u_int and u_short instead of the SYSV uint and
ushort.  In most of these files, there was a mixture of both styles and
this change just makes them self-consistent.

Requested by:	bde (kern_ktrace.c)
2003-08-07 15:04:27 +00:00
Nate Lawson
a329ebca91 Add and document the hw.acpi.ec.poll_timeout tunable. 2003-07-30 16:22:53 +00:00
Takanori Watanabe
62d4c42b21 Enable wake up GPE before shutdown, not only for sleeping. 2003-07-26 09:54:17 +00:00
Nate Lawson
44904c4020 Add an informational debugging printf of the maximum time spent in
EcEventWait().  If you get AE_HARDWARE_NO_RESPONSE errors, please enable
this info by setting hw.acpi.verbose=1 in loader.conf.
2003-07-25 16:49:46 +00:00
Nate Lawson
c72508e283 Do not call acpi_MatchHid() for all probe cases since it accesses the
namespace.  To compensate for it only being used in the !ECDT case, use
a more robust approach to indicate a device was probed via ECDT by setting
the private ivar to be &acpi_ec_devclass.  Without the acpi_MatchHid() call
now, it might have been possible for a non-EC device to have had its magic
match our previous flag.

Pointed out by:		takawata
2003-07-20 21:12:21 +00:00
Nate Lawson
3a371f32b3 Close a race condition by passing status retrieved via a non-SCI call
to EcGpeQueryHandler on to any waiting threads through the softc.  Similar
behavior was in the original version.

Also:
* Merge EcQuery into EcGpeQueryHandler to simplify locking
* Hold EcLock from the initial read of the CSR down to the wakeup or
  until after the query command has been processed.
* ec_gpebit only needs to be a UINT8
2003-07-20 21:11:32 +00:00
Nate Lawson
e1a90ae12f Clarify the ACPI shutdown messages. 2003-07-20 00:52:57 +00:00
Nate Lawson
f8335e3a97 Add ECDT (ACPI 2.0) support. This allows the EC to be enabled before the
namespace has been evaluated.  Machines with ACPI 2.0 expect this behavior
and have AML which calls EC functions early in the boot process.  If the
ECDT is not available, fall back to original probe behavior.

Other minor changes:
* Add GPE bit and GLK usage to the device announcement
* Always use the global lock in the ECDT case, but potentially downgrade to
  not using it if _GLK is 0 once the namespace is available.  This is
  announced with "Changing GLK from 1 to 0"
* Remove the acpi_object_list definitions which were earlier deprecated

Ideas from:	takawata
2003-07-20 00:48:38 +00:00
John Baldwin
9e66b98a4a Fix a bogon in the previous commit. When suppressing multiple isab
devices, we have to allow for the case when the isab0 device is ourselves.

Tested by:	markm
2003-07-17 19:13:41 +00:00
Nate Lawson
ff40920e9e Change the msleep part of EcWaitEvent to be a separate loop, fixing a
problem that for some very slow ECs (~6 ms occasionally) causes a
timeout.  Also finish resource cleanup in the error case in attach.

Tested by:	ume
2003-07-15 19:24:36 +00:00
Nate Lawson
fa1045a79d Remove old defines since they are no longer used. 2003-07-15 19:19:54 +00:00
Marcel Moolenaar
6613111b55 Fix build breakage on ia64. The second argument of AcpiOsReadable()
and AcpiOsWritable() have type ACPI_SIZE and not UINT32.
2003-07-14 02:42:15 +00:00
Nate Lawson
6fca9360db Update code to work with 0619 dist
* Use ACPI_BUFFER as the type for AcpiGetObjectInfo
* Remove AcpiEnableEvent/AcpiClearEvent for ACPI_EVENT_FIXED (power/sleep
  buttons) as they are no longer needed
* Change calls to use the new GPE functions
* Add AcpiOs*Lock functions
2003-07-13 22:57:16 +00:00
Nate Lawson
1f04e8f501 Rewrite much of the embedded controller driver.
* Always use polled mode.  The intr approach did not work for many
  controllers and required the hw.acpi.ec.event_driven workaround.
* Only use an edge (not level) triggered GPE handler
* Add sc->ec_mtx for locking operations to a single EC.  There were
  many race conditions earlier between an SCI event and EcRead/Write.
* Use 1 ms as the global lock timeout
* Only acquire global lock if _GLK != 0
* Update EcWaitEvent to use an incremental backoff delay in its
  poll loop.  Wait 50 ms max instead of 10.  Most ECs respond
  in < 5 us (50 us when heavily loaded).  However, some time out
  occasionally even with a 10 ms timeout.  For delays past 1 ms, use
  msleep instead of DELAY to give SCI interrupts a chance to occur.
* Add EcCommand to send a command and wait for the appropriate event.
* The hw.acpi.ec.event_driven tunable is no longer applicable and
  has been removed.

Ideas from:	Linux
2003-07-10 17:22:46 +00:00
John Baldwin
852989bdbf - Fix a typo in the call to acpi_disabled() in probe() by removing an
extra trailing space.
- Don't bother probing a generic ISA bus device if isab0 already exists.
  Some BIOSes place an ACPI psuedo-device with the HID of a generic ISA bus
  device under the PCI-ISA bridge device.  This is not the best solution
  but will work for now.  The isa bus driver only allows for one ISA bus
  anyways.
2003-07-09 18:28:53 +00:00
John Baldwin
6c525ee43c Add an ACPI to ISA psuedo bridge driver. It attaches an isab(4) device to
ACPI nodes with the plug and play ID's defined for a "Generic ISA Bus
Device" as defined in section 10.7 of the ACPI 2.0 specification.  This
gives machines like the Libretto that contain a fake ISA bus that is not
connected via a PCI-ISA bridge an ISA bus for ISA devices to attach to.

Tested by:	markm
2003-07-08 18:59:32 +00:00
John Baldwin
8a9bc9c03b - Use the new resource_disabled() helper function to see if devices are
disabled.
- Change the apm driver to match the acpi driver's behavior by checking to
  see if the device is disabled in the identify routine instead of in the
  probe routine.  This way if the device is disabled it is never created.

Note that a few places (ips(4), Alpha SMP) used "disable" instead of
"disabled" for their hint names, and these hints must be changed to
"disabled".  If this is a big problem, resource_disabled() can always be
changed to honor both names.
2003-07-02 16:09:02 +00:00
Thomas Moestl
3920999db7 Add a new PCI interface method, assign_interrupt, to determine the
interrupt to be used for a device. This is intended solely for internal
use of PCI bus implementations, and exists so that PCI bus drivers
implementing special interrupt assignment methods which require
additional work at the bus level to work right can be easily derived
from the generic driver (or any other one) without resorting to hacks.

It will be used in the sparc64 ofw_pcibus driver, which will be
committed shortly.

Make use of this method in the generic implementation, and add it to
the method table of bus drivers derived from the PCI one.

Reviewed by:	imp, -hackers
2003-07-01 14:08:33 +00:00
Nate Lawson
464c662efa Whitespace cleanups (verified with MD5 1832ce5ede6c58c844dfb53fd48f0eea).
Also clarify a macro expansion with an XXX.  I will be fixing access to
Acpi Global Lock in a subsequent commit.
2003-06-27 21:57:42 +00:00
Peter Wemm
151cd71608 Add the MD ifdefs for amd64 to point to the IO space bustag/handle.
Approved by:  re ("safe" amd64 support)
2003-05-31 06:45:28 +00:00
John Baldwin
dea7cce585 Add some extra #ifdef stubs so that this compiles on 4.8.
Approved by:	re (rwatson/bmah)
2003-05-13 16:59:46 +00:00
Nate Lawson
014ed75b27 Move some printfs under bootverbose since they are not true errors.
Approved by:	re (bmah)
2003-05-12 16:54:55 +00:00
John Baldwin
9501b60383 Catch up to reworked debugging levels in latest Intel import. 2003-05-01 18:51:43 +00:00
Marcel Moolenaar
214475d865 o Don't announce that the timer is good when in fact it isn't timing
at all (ie reads yield constant values). Display the width as the
   difference between max and min so that constant timers have width
   zero.
o  Get the address of the timer from the XPmTmrBlk field instead of
   the V1_PmTmrBlk field. The former is a generic address and can
   specify a memory mapped I/O address. Remove <machine/bus_pio.h>
   to account for this. The timer is now properly configured on
   machines with ACPI v2 tables, whether PIO or MEMIO. Note that
   the acpica code converts v1 tables into v2 tables so the address
   is always present in XPmTmrBlk.
o  Replace the TIMER_READ macro with a call to the read_counter()
   function and add a barrier to make sure that we observe proper
   ordering of the reads.
2003-04-30 05:27:01 +00:00
Nate Lawson
51773ddf47 Support functions for the new ACPI import.
* AcpiOsDerivePciId(): finds a bus number, given the slot/func and the
    acpi parse tree.
  * AcpiOsPredefinedOverride(): use the sysctl hw.acpi.os_name to
    override the value for _OS.

Ideas from:	takawata, jhb
Reviewed by:	takawata, marcel
Tested on:	i386, ia64
2003-04-29 18:50:34 +00:00