Commit Graph

125 Commits

Author SHA1 Message Date
joerg 892f4bbba1 sprintf -> snprintf 2009-04-08 12:39:27 +00:00
dyoung 222f7adf37 Refactor slightly to create acpi_rescan(), a hook for rescanning the
devices that attach at acpi(4).

Begin deriving an acpi(4) device-detachment hook, acpi_detach(), from
acpi_attach().  The code between #if 0 and #endif still needs to be
turned to the opposite calls (enables to disables, maps to unmaps,
attaches to detaches), which should be run in the opposite order.
Somebody with deep ACPI knowledge can probably finish this off without
too much trouble.
2009-04-08 00:23:30 +00:00
jmcneill 0cc9fff237 PR# kern/38817: regression in acpi sleep on lifebook S6510
Switch to polling mode after the acpi(4) device has been suspended as
interrupts will be disabled later on and we may still need to execute
AML that tries to sleep or wait on a semaphore.
2009-01-30 12:51:03 +00:00
yamt b1fea83762 remove extra semicolons. 2009-01-03 03:43:21 +00:00
mlelstv 1f5b658b8a Handle printing of _STR attribute with non-string data type gracefully. 2008-12-07 10:53:57 +00:00
jmcneill 13e32ea2ea Revert previous. 2008-09-19 11:15:50 +00:00
jmcneill b1cb1c6dcb PR# 38683 - T61 cannot suspend with recent kernels
Don't restore spl until after AcpiLeaveSleepState.
2008-09-10 03:56:12 +00:00
dyoung 03df89373a Introduce acpi_clear_wake_gpe() to undo acpi_set_wake_gpe().
Extract common code from acpi_clear_wake_gpe() and acpi_set_wake_gpe(),
creating acpi_wake_gpe_helper().
2008-07-15 16:15:28 +00:00
joerg 42fe28f522 Fix compilation with ACPI_EXTRA_DEBUG. 2008-06-01 19:01:57 +00:00
jmcneill 86acf021ce For device nodes that we handle internally, do not bother calling
config_found_ia on the node to save a bunch of useless 'device NNN
not configured' messages at startup. While here, condense ACPI printfs
at attach time.
2008-05-17 15:42:25 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
jmcneill 865860bc30 Improve error reporting when we fail to enter a sleep state, eg:
acpi0: entering state 1
  acpi0: ACPI S1 not available on this platform
2008-04-20 16:26:36 +00:00
jmcneill fcb7a4511a Split device_t and softc 2008-03-27 02:51:26 +00:00
dyoung 3df2b2feb5 Use device_t and its accessors throughout. Use aprint_*_dev().
Improve PMF-ability.

        Add a 'flags' argument to suspend/resume handlers and
        callers such as pmf_system_suspend().

        Define a flag, PMF_F_SELF, which indicates to PMF that a
        device is suspending/resuming itself.  Add helper routines,
        pmf_device_suspend_self(dev) and pmf_device_resume_self(dev),
        that call pmf_device_suspend(dev, PMF_F_SELF) and
        pmf_device_resume(dev, PMF_F_SELF), respectively.  Use
        PMF_F_SELF to suspend/resume self in ath(4), audio(4),
        rtw(4), and sip(4).

        In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable
        callbacks, provided by the bus front-end, with
        self-suspension/resumption.  Also, clean up the bus
        front-ends.  Make sure that the interrupt handler is
        disestablished during suspension.  Get rid of driver-private
        flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use
        device_is_active()/device_has_power() calls, instead.

        In the network-class suspend handler, call if_stop(, 0)
        instead of if_stop(, 1), because the latter is superfluous
        (bus- and driver-suspension hooks will 'disable' the NIC),
        and it may cause recursion.

        In the network-class resume handler, prevent infinite
        recursion through if_init() by getting out early if we are
        self-suspending (PMF_F_SELF).

rtw(4) improvements:

        Destroy rtw(4) callouts when we detach it.  Make rtw at
        pci detachable.  Print some more information with the "rx
        frame too long" warning.

Remove activate() methods:

        Get rid of rtw_activate() and ath_activate().  The device
        activate() methods are not good for much these days.

Make ath at cardbus resume with crypto functions intact:

        Introduce a boolean device property, "pmf-powerdown".  If
        pmf-powerdown is present and false, it indicates that a
        bus back-end should not remove power from a device.

        Honor this property in cardbus_child_suspend().

        Set this property to 'false' in ath_attach(), since removing
        power from an ath at cardbus seems to lobotomize the WPA
        crypto engine.  XXX Should the pmf-powerdown property
        propagate toward the root of the device tree?

Miscellaneous ath(4) changes:

        Warn if ath(4) tries to write crypto keys to suspended
        hardware.

        Reduce differences between FreeBSD and NetBSD in ath(4)
        multicast filter setup.

        Make ath_printrxbuf() print an rx descriptor's status &
        key index, to help debug crypto errors.

        Shorten a staircase in ath_ioctl().  Don't check for
        ieee80211_ioctl() return code ERESTART, it never happens.
2008-03-12 18:02:21 +00:00
dyoung 73e95caf73 Use device_t and accessors. Use aprint_*_dev().
Add a method for detaching children.  XXX acpi(4) may leak some
resources for each child detached.  Needs attention from someone
who understands acpi(4).
2008-03-10 20:58:38 +00:00
jmcneill 80e26751e9 shutdownhook_establish is deprecated, but instead of converting to pmf,
just delete it as acpi_shutdown was empty.
2008-03-09 19:09:00 +00:00
jmcneill 95fc3f2649 Add hw.acpi.supported_states sysctl node:
$ sysctl hw.acpi.supported_states
  hw.acpi.supported_states = S0 S3 S4 S5
2008-02-13 15:27:55 +00:00
jmcneill a73b778622 Now that ACPI-CA doesn't parse the X/RSDT for us, we need to map it
ourselves.

Before:
  acpi0: X/RSDT: OemId <      ,        ,00000000>, AslId <    ,00000000>
After:
  acpi0: X/RSDT: OemId <LENOVO,TP-7L   ,00001260>, AslId < LTP,00000000>

ACPI can now access the X/RSDT using 'acpi_map_rsdt' and 'acpi_unmap_rsdt'.
2007-12-16 21:10:34 +00:00
jmcneill d72049ddbd Restore acpi_quirk functionality, lost in the latest ACPI-CA update. 2007-12-15 02:19:55 +00:00
jmcneill e692a6c76a Introduce pmf_system_bus_resume. In the ACPI S3 resume path, use this to
separate powering up devices from restoring their state. This is required
on some machines where AcpiLeaveSleepState can fail due to an attempt to
access a powered off device.
2007-12-14 01:29:29 +00:00
reinoud 3a44e8ad9d Add missing \n and remove surplus . 2007-12-10 22:56:29 +00:00
jmcneill 4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
ad 598ab03ad0 Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
2007-12-05 07:06:50 +00:00
cube 8b3327fe73 Print ACPI device name in a way that Jared McNeill and I find prettier.
I like it better because I get to see the name of the device as it appears
in the DSDT, which sometimes makes sense and that way it's easier to locate
the relevant code when debugging.

E.g.:

PIC (PNP0000) [AT Interrupt Controller] at acpipcib0 not configured
DMAD (PNP0200) [AT DMA Controller] at acpipcib0 not configured
attimer0 at acpipcib0 (TMR, PNP0100): AT Timer
RTC0 (PNP0B00) [AT Real-Time Clock] at acpipcib0 not configured
pckbc0 at acpipcib0 (PS2K, PNP0303): kbd port
acpibat0 at acpi0 (BAT0, PNP0C0A-0): ACPI Battery (Control Method)
2007-08-08 08:52:31 +00:00
ad 1d4a085a4a Initialize acpi_interrupt_list_mtx in acpi_probe(). 2007-02-19 22:31:05 +00:00
xtraeme 039f493e4b Replace a simple_lock with a mutex, reviewed by ad@. 2007-02-18 23:39:20 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
cube 35d885e59a Introduce acpi_check() to inform the caller whether the acpi driver is
still enabled, as it could have been disabled through USERCONF.

Use it in amd64 and i386 mainbus code and skip all ACPI processing in case
it is disabled.
2006-11-26 12:30:05 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
jmcneill 466af2f141 When resuming from S1 standby, don't try to release a mutex that we hadn't
previously acquired.
2006-09-26 01:50:43 +00:00
christos 0fe2e6efc3 PR/34116: Takuya SHIOZAKI: acpiapm(4) misuses config(9)
acpiapm(4) always matches the first node of AML, which is unrelated
with acpiapm. Separate acpi(4)'s children into two individual interface
attributes.
2006-08-06 15:46:54 +00:00
christos 01158ea892 Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI
2006-07-04 00:30:21 +00:00
christos 46e62b977f - use aprint instead of printf.
- centralize all the suspend/resume glue in one function.
2006-07-01 21:44:13 +00:00
tsarna d0e9109021 fix typo: idicator -> indicator 2006-06-24 23:40:50 +00:00
drochner c14d23ac86 First cut on an implementation of an ACPI power management counter
backend for timecounters.
Due to known bugs in some chipsets, always read until we get 3 successive
samples which are monotonic, as FreeBSD does in its "safe" variant.
This can be refined later, either by chipset quirks or by a test (as
FreeBSD does).
2006-06-21 17:47:23 +00:00
cube 8b8d583b02 When we consume a resource definition from _PRS, advance to the next one.
Otherwise, if there are two resources definitions of the same type in _CRS,
the same one from _PRS will be used twice, which of course leads to errors.

Note:  _PRS is Possible Resources Set
       _CRS is Current Resources Set

XXX acpi_allocate_resources is still very weak, e.g. it completely ignores
    StartDependentFn entries which are kind of a switch.  But at least it's
    slightly better that way.

Tested by jmcneill@.
2006-06-20 12:31:19 +00:00
jmcneill a3f69214b6 acpi_pci_fixup didn't work as well as I had hoped; don't bother for now. 2006-06-19 10:18:08 +00:00
jmcneill 3aa64055a0 Fixup PCI interrupt routing using ACPI tables on return from S3 sleep.
Requires options PCI_INTR_FIXUP in your kernel.
2006-06-19 02:32:12 +00:00
jmcneill 66bdce4546 EXPERIMENTAL: Add sysctl for triggering ACPI sleep. This interface is not
stable, so do not depend on it!

    To trigger sleep:
        # sysctl -w machdep.sleep_state=<n>
    Where <n> is typically 1 (standby), 3 (suspend), or 4 (hibernate).
2006-06-15 18:05:08 +00:00
cube 2d6c09f7a7 Resource lists end with END_TAG, not END_DEPENDENT. Makes the
PCI_INTR_FIXUP code "work" again.

Most of the time it will produce a warning about a misaligned resource
pointer, but it's harmless, and the warning was removed in the next version
of the ACPI-CA code.
2006-02-26 18:46:04 +00:00
wiz 078081c6ad Fix typo in aprint argument. 2006-02-23 17:38:03 +00:00
kochi 6f20259365 use aprint_* 2006-02-20 12:17:49 +00:00
kochi 9fca0c53be define acpi_dbgr as static 2006-02-16 09:23:23 +00:00
kochi 0cdeab4c58 remove ACPI_DISABLE_ON_POWEROFF option, which was there just for
compatibility of our old driver behavior, which is not necessary.
2006-01-31 09:30:06 +00:00
kochi 9e72fe1e5e adapt for ACPI-CA 20060113 2006-01-29 03:12:22 +00:00
cube 9af385388e machdep.acpi_root -> hw.acpi.root, as discussed on source-changes. 2005-12-13 23:27:31 +00:00
cube 3de4cab6f7 Move the (one liner) logic of AcpiOsGetRootPointer() out of acpica/Osd to
acpi.c and take the opportunity to create a sysctl node that contains the
address of the main ACPI table.

The name of the node, "machdep.acpi_root", is questionable but matches the
one FreeBSD has, which will make it easier to port their acpidump(8)
program.
2005-12-12 15:04:50 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
sekiya 13e5f23389 Fix up interrupt line when line == 0. Discussed with christos@ 2005-06-30 22:28:03 +00:00