Commit Graph

863 Commits

Author SHA1 Message Date
jruoho a86a868599 Add the _COMPONENT definition for ACPI_DEBUG. 2010-01-30 18:35:48 +00:00
jruoho d569343003 Add the _COMPONENT definition for ACPI_DEBUG. 2010-01-30 18:07:06 +00:00
jruoho b875c5c314 If we failed to obtain the brightness level during suspend, do not try to
restore it with a possible garbage value during resume.
2010-01-29 12:22:00 +00:00
jruoho ab77a1af1f Replace all AcpiEvaluateObject() calls with acpi_eval_set_integer().
(As the return buffers are not used for anything, no need to make
unnecessary temporary allocations.)

Compile tested only.

ok jmcneill@
2010-01-29 11:57:37 +00:00
jruoho 545590ff33 Fix a memory leak in the resume handler. 2010-01-29 11:23:25 +00:00
drochner 30d27f4f07 the "Battery Present Rate" is only required to be valid if the battery
is discharging; it might make sense when charging, but it doesn't
make sense if neither is the case -- remove a wrong assertion and
arrange the code to make this obvious
(actually, the ACPI spec says that the requirement is only for
rechargeable batteries)
2010-01-27 22:17:28 +00:00
jruoho e6056a8df3 * Reintroduce a state variable. From njoly@.
* Always mark the charge state sensor as valid.
2010-01-24 11:32:13 +00:00
jruoho 3f1f18b1bd Cleanup:
* Remove ACPI_BAT_DEBUG.
  * Reduce the amount of error reporting.
  * Remove the internal bookkeeping flags.
  * Remove the debugging functions used to print status and information
    changes. This information is fully conveyed in the output of envstat(8).
  * Always evaluate _STA. If it fails or the battery is not present, mark
    all remaining sensors as invalid. This will eliminate the convoluted
    update routine.
  * Semantics.

Over 200 LOC was eliminated, but functional change should again be minimal.

ok jmcneill@, pgoyette@
2010-01-23 15:06:47 +00:00
jruoho 2327840926 Correct the type also in the WMI write method. 2010-01-23 13:32:45 +00:00
jruoho f55e7ab193 * Fix the type of the input buffer in the WMI method call.
* Do not error out if the flags field is is 0x00. Observed by cegger@.
2010-01-23 12:48:19 +00:00
jruoho 791571cbd1 In preparation for upcoming changes:
* Provide proper definitions and use these.
  * Clarify the evaluation of _STA.
  * Mark the state of a sensor according to the return value from _STA.
  * Share the basic object evaluation in _BIF and _BST.
  * Verify the object types before using the objects.
  * Be aware of bogus values from _BIF and _BST, as noted in the
    specification.

Despite of the list, functional change should be minimal. Ok pgoyette@.
2010-01-21 08:57:17 +00:00
jruoho f4cdb6678e Fix and improve several comments. 2010-01-18 18:49:27 +00:00
jruoho e5a9d901c0 Use acpi_eval_reference_handle() to simplify code. No functional change.
ok jmcneill@, pgoyette@
2010-01-18 18:36:49 +00:00
jruoho 81e1657ee2 Introduce acpi_eval_reference_handle() --
an utility function to evaluate reference handles from package elements.

ok jmcneill@, pgoyette@
2010-01-18 18:06:31 +00:00
jruoho 8391833e8a Ensure that the return string is NUL-terminated in acpi_eval_string().
ok jmcneill@, pgoyette@
2010-01-18 17:34:37 +00:00
jruoho 91262361ae Add definitions for volume keys.
ok jmcneill@
2010-01-18 17:11:00 +00:00
jruoho 517e16fb9b Fix a minor bug where a reference handle is used for error reporting even
though it may not be present. While here, convert few lines to aprint_*().

ok pgoyette@
2010-01-18 17:09:17 +00:00
jruoho 25608cae55 regen. 2010-01-18 16:50:08 +00:00
jruoho 71c4a74b58 Add some ACPI 4.0 devices.
ok jmcneill@, pgoyette@
2010-01-18 16:34:47 +00:00
jruoho 3708b81bde Properly evaluate the _PRW object in case we have a package inside a
package.

ok jmcneill@
2010-01-12 12:21:04 +00:00
jruoho ad7b6ed9be Add "ACPI fans" to the list of ignored HIDs, as discussed on port-i386@. 2010-01-09 15:43:12 +00:00
jruoho 6e01648990 Fix the casts in the event handler. 2010-01-09 15:34:59 +00:00
dyoung cd6e1fbf91 Expand PMF_FN_* macros. 2010-01-08 19:53:10 +00:00
dyoung e94f23b742 Move all copies of ifattr_match() to sys/kern/subr_autoconf.c. 2010-01-08 00:09:44 +00:00
jruoho 57bb616085 Fix a memory leak/corruption by commenting out the evaluation of the _PSL
control method. If it is needed in the future, the output buffer must be
freed after use.

ok pgoyette@, jmcneill@
2010-01-05 13:47:52 +00:00
jruoho 0398d5ad8e Use acpi_eval_struct() to simplify code.
ok pgoyette@, jmcneill@
2010-01-05 13:39:49 +00:00
jruoho 4979a58f9d Update the copyright. 2010-01-04 10:06:53 +00:00
jruoho 28fec82cc6 Two bug fixes:
- Use ACPI_ALL_NOTIFY instead of ACPI_DEVICE_NOTIFY.

	- Fix the data query method: this fails without input.

ok pgoyette@
2010-01-04 09:43:30 +00:00
jruoho 111b592d55 Cleanup:
- Provide the module declaration and use ACPI_FREE
	  as well as ACPI_ALLOCATE_LOCAL_BUFFER for ACPI_DEBUG.

	- Maintain the calling conventions of existing ACPI utility
	  functions by initializing the output buffer for the caller
	  in all applicable functions.

	- Remove superfluous const correctness. Additional semantics:
	  u_char -> char, u_int16_t -> uint16_t, and u_int64_t -> uint64_t.

	- Collect the validation of input parameters to a single function.

ok pgoyette@
2010-01-04 09:34:47 +00:00
jruoho 4053740fd1 Introduce acpiwmibus, a pseudo-bus to which the child WMI devices attach.
Multiple WMI mapper devices are supported, but each one can have only one
child device.

All exposed functions now require the parent mapper device as a parameter.

ok pgoyette@, jmcneill@
2010-01-03 17:53:15 +00:00
pgoyette 390d022573 Don't set sensor state to SWARNOVER here. Doing so based only on the
device's active cooling levels prevents the user from overriding these
limits with his own values.

XXX We should probably also change setting SCRITOVER state to SCRITICAL,
XXX but right now that just confuses things.  We currently don't have a
XXX way for a sensor to be both SCRITICAL and SCRITOVER.
2010-01-01 15:55:30 +00:00
jruoho 44a36c99e4 As the _PSW control method was deprecated in ACPI 3.0, augment the wake
event call with the newer _DSW control method.

ok pgoyette@, jmcneill@
2009-12-31 10:12:51 +00:00
jruoho 0cd8dc4d78 Remove unused locking variables.
ok pgoyette@, jmcneill@
2009-12-31 10:07:13 +00:00
jruoho 7baf4db1ca Add Intel HW Random Number Generator to the list of ignored HIDs.
ok pgoyette@, jmcneill@
2009-12-31 10:02:51 +00:00
pgoyette 5c06b9862c In ATZ_F_VERBOSE mode, log a message whenever the active cooling level
changes, even when the new level is ATZ_ACTIVE_NONE
2009-12-24 00:26:28 +00:00
pgoyette 07dad0134f Since we're using the active cooling levels as warning threshold, we
should store the value in the correct location.  We're already setting
the correct flag bit.

Should resolve problem reported by Frank Wille on current-users...
2009-12-23 02:29:46 +00:00
njoly 5d456b9df1 Fix NetBSD keyword expansion. 2009-12-04 10:42:39 +00:00
cegger 82b81a0cd1 Enumerate ACPI PCI devices. Allows to link PCI with ACPI devices.
Patch presented on tech-kern@
http://mail-index.netbsd.org/tech-kern/2009/11/28/msg006552.html

'nice work' Jukka Ruohonen
2009-12-03 21:04:29 +00:00
cegger 63ec7a18dd Introduce acpi_eval_set_integer().
Use it in various acpi drivers to simplify code.
Patch presented on tech-kern@:
http://mail-index.netbsd.org/tech-kern/2009/11/28/msg006552.html

No comments.

XXX Is there an acpi(9) manpage?
2009-11-29 21:32:50 +00:00
uebayasi c197134fb4 Remove a debug printf(). 2009-11-29 18:08:22 +00:00
cegger afba2142ee initialise -> initialize
unabled -> unable
wrap long line
2009-11-28 17:03:17 +00:00
cegger 0409ca03ee u_int32_t -> uint32_t
struct device * -> device_t
2009-11-28 17:02:14 +00:00
cegger 6f85be6a06 By reading the ACPI dump I figured out that my
HP Pavillion dv9700 laptop features a fan sensor
in the ACPI Thermal Zone which is beyond of the ACPI
Spec.

envstat shows
[acpitz0]
  Processor Thermal Zone:     56.000   95.000                       degC
                     FAN:       2840                                 RPM

envstat -W shows the limits
[acpitz0]
  Processor Thermal Zone:     55.000                                degC
                     FAN:       2570     4500     2000               RPM

Patch presented on tech-kern@.

No comments.
2009-11-25 13:54:23 +00:00
cegger 8ced747602 Add ACPI SLIT parser. This is part of NUMA support.
Tested on a 8-node machine.

Patch presented on tech-kern@, port-i386@ and port-amd64@.

No comments.
2009-11-25 13:21:49 +00:00
cegger 688b7ce5ae Add ACPI SRAT parser. This is a part of NUMA support.
Tested on 1-node, 2-node and 8-node machines.
Patch presented on tech-kern@, port-i386@ and port-amd64@.

No comments.
2009-11-25 13:17:06 +00:00
cegger 29e2a7eb92 evaluate _RTV as preparation for passive cooling. 2009-11-23 14:42:39 +00:00
cegger 1225bb1b7a use __arraycount 2009-11-14 09:54:10 +00:00
dyoung 90c2b25e8f Don't use com_activate(), it's going away. 2009-11-12 20:30:10 +00:00
jmcneill 92ddd35b74 from Jukka Ruohonen:
- Remove redundant assertions.
 - Properly check for NULL pointers.
 - No real need to keep track whether the internal event handler is installed.
 - Add a missing function to pass possible extra information associated with
   an event. Mentioned in the specification.
2009-10-03 15:49:21 +00:00
jmcneill 23e8227b7c PR# kern/42139: ACPI WMI: new driver
Import acpiwmi(4) from Jukka Ruohonen. From the PR:

Attached is a driver that implements ACPI WMI API:

http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx

The WMI is used to provide a generic interface for OEMs to use certain
platform/laptop-specific additions to the standard ACPI in a somewhat
portable way. These can be hotkeys for additional buttons, different event
handlers (wireless kill switch, lid switch, etc.), and so on. At least HP
and Acer use it by default nowadays.

The benefit of this interface would be portability. For an example, instead
of hpqlb(4) that works only with certain HP models, we could have a generic
HP WMI-driver that should work in theory across all HP laptops. On many new
laptops WMI may also be the only way to access laptop/manufacturer-specific
features.
2009-10-02 16:47:52 +00:00
jmcneill 6c62f91733 Initial import of an SD/MMC driver for the Winbond W83L518D (and probably
W83L519D) Integrated Media Reader with PNP bus attachment glue.
2009-09-30 20:44:49 +00:00
jmcneill 5be9fd621d If the driver thinks a battery is not present, poll for present status.
Workaround for firmware that doesn't report battery present status
immediately at boot and doesn't issue a subsequent notify when the
information becomes available.
2009-09-29 21:41:38 +00:00
jmcneill d3bc4066df regen for PNP0C14 2009-09-27 14:11:58 +00:00
jmcneill cc62b1fb8e Add PNP0C14 (WMI mapper device) 2009-09-27 14:11:07 +00:00
dyoung 5fe0eded9b Use deviter_first()/deviter_next() instead of accessing alldevs
directly.  Compile-tested, only.
2009-09-25 20:26:26 +00:00
dyoung 36fffd8d02 In pmf(9), improve the implementation of device self-suspension
and make suspension by self, by drvctl(8), and by ACPI system sleep
play nice together.  Start solidifying some temporary API changes.

1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and
   #include it from <sys/pmf.h> instead of <sys/device.h> to break the
   circular dependency between <sys/device.h> and <sys/pmf.h>.

2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF
   suspend/resume call.  Start to replace instances of PMF_FN_PROTO,
   PMF_FN_ARGS, et cetera, with a pmf_qual_t.

3. Introduce the notion of a "suspensor," an entity that holds a
   device in suspension.  More than one suspensor may hold a device
   at once.  A device stays suspended as long as at least one
   suspensor holds it.  A device resumes when the last suspensor
   releases it.

   Currently, the kernel defines three suspensors,

   3a the system-suspensor: for system suspension, initiated
      by 'sysctl -w machdep.sleep_state=3', by lid closure, by
      power-button press, et cetera,

   3b the drvctl-suspensor: for device suspension by /dev/drvctl
      ioctl, e.g., drvctl -S sip0.

   3c the system self-suspensor: for device drivers that suspend
      themselves and their children.  Several drivers for network
      interfaces put the network device to sleep while it is not
      administratively up, that is, after the kernel calls if_stop(,
      1).  The self-suspensor should not be used directly.  See
      the description of suspensor delegates, below.

   A suspensor can have one or more "delegates".  A suspensor can
   release devices that its delegates hold suspended.  Right now,
   only the system self-suspensor has delegates.  For each device
   that a self-suspending driver attaches, it creates the device's
   self-suspensor, a delegate of the system self-suspensor.

   Suspensors stop a system-wide suspend/resume cycle from waking
   devices that the operator put to sleep with drvctl before the cycle.
   They also help self-suspension to work more simply, safely, and in
   accord with expectations.

4. Add the notion of device activation level, devact_level_t,
   and a routine for checking the current activation level,
   device_activation().  Current activation levels are DEVACT_LEVEL_BUS,
   DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively
   indicate that the device's bus is active, that the bus and device are
   active, and that the bus, device, and the functions of the device's
   class (network, audio) are active.

   Suspend/resume calls can be qualified with a devact_level_t.
   The power-management framework treats a devact_level_t that
   qualifies a device suspension as the device's current activation
   level; it only runs hooks to reduce the activation level from
   the presumed current level to the fully suspended state.  The
   framework treats a devact_level_t qualifying device resumption
   as the target activation level; it only runs hooks to raise the
   activation level to the target.

5. Use pmf_qual_t, devact_level_t, and self-suspensors in several
   drivers.

6. Temporarily add an unused power-management workqueue that I will
   remove or replace, soon.
2009-09-16 16:34:49 +00:00
mlelstv 23ab96a36b Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.
2009-09-16 10:47:54 +00:00
drochner a25cd7ae3a fix undefined return values of Read/WriteMemory, found by clang
static analyzer
2009-09-15 19:41:30 +00:00
cube 76ccaa8650 Don't reference files that don't exist, and cvs diff before commit. 2009-08-31 14:48:41 +00:00
jmcneill 9ec52a2279 PR# port-i386/39671: panic while booting with an acpi kernel on a 790GX board
If the firmware describes duplicate keyboard controller nodes, don't panic
when the driver fails to map registers.
2009-08-29 19:17:44 +00:00
jmcneill 80adfeb08d PR# kern/41179: Incorrect return values from AcpiOsExecute()
ACPICA functions return ACPI_STATUS instead of int, so use it for
consistency.
2009-08-25 10:34:08 +00:00
jmcneill ec32b60246 When ACPI is not present, free any resources used by the ACPICA. Also,
no need to complain (unless we're debugging) that ACPI is not present.
2009-08-23 15:16:16 +00:00
jmcneill 21d93c9335 Adapt for ACPICA API changes. 2009-08-19 00:31:16 +00:00
christos 2ba6b9d22f the new acpi code seems to return NULL for the hardwareId string. 2009-08-19 00:19:37 +00:00
cegger 326b502d87 Update for API changes with new ACPICA.
Makes i386 ALL kernel build.
2009-08-18 21:38:41 +00:00
cegger da8e01ab65 with new ACPICA, idstr may be NULL.
Check against NULL, this fixes a crash on my HP Pavilion dv9700 Laptop.
While here simplify the loop via __arraycount()
2009-08-18 21:33:29 +00:00
jmcneill b0fb7abfad Switch to ACPICA 20090730, and update for API changes. 2009-08-18 16:41:02 +00:00
christos 833455e99c spic has moved. 2009-08-09 19:36:28 +00:00
christos a401f72096 - pass unsigned char to toupper
- set snprintf did not bother to uppercase the name. Simplify and fix.
2009-08-09 17:42:48 +00:00
jmcneill bb3158c0b1 Reading the fan speed is expensive, so set the undocumented SME_POLL_ONLY
flag on this sensor to ensure that the data is only refreshed on demand.
2009-08-04 23:23:39 +00:00
jmcneill 5baf678bf3 remove extra semicolon, spotted by snj 2009-08-04 17:06:10 +00:00
jmcneill f5e82b659b add hw.wake.* sysctl subtree for toggling which devices are allowed to
restore the system from sleep. set/clear wake GPEs as specified before
entering sleep.

by default, the following devices are enabled for wake:
 - sleep/power buttons
 - lid switch
 - pc kbd controller

reviewed by: joerg
2009-08-04 14:20:40 +00:00
jmcneill 52624b6009 don't call asus_sysctl_setup from asus_init because that is called from
the resume handler, instead call it directly from asus_attach
2009-08-03 16:33:55 +00:00
jmcneill bd96ad5f60 add missing return, silences 'failed to add sysctl nodes. (0)' message when
setup was successful
2009-08-03 12:43:46 +00:00
jmcneill dd4c27f39b - add experimental cpu fan/voltage switching support (sysctl hw.asus0.*)
- add fan sensor
- rename asus_softc_t -> struct asus_softc
- add detach method
- update copyright for 2009
2009-08-03 10:30:29 +00:00
kiyohara f68c771081 com@acpi supports memory space.
It tested on HP zx6000(ia64).
2009-07-13 12:57:04 +00:00
kiyohara e14284f196 ACPI resource supports Extended IRQ From FreeBSD. 2009-07-13 12:55:21 +00:00
joerg ac7c4cf146 Ignore breakpoints in the DSDT even if DDB is present.
A new option ACPI_BREAKPOINT reenables them.
2009-07-06 12:36:31 +00:00
alc 3fb1b3bc21 Add a pmf(9) shutdown hook to acpiec(4) to use polling on shutdown.
This fixes DIAGNOSTIC's assertion failure:

cpu_switchto(): switching above IPL_SCHED

during ACPI shutdown.

OK'd by joerg@
2009-07-06 00:54:00 +00:00
pgoyette de4ed96bf9 Use a macro to define the conversion between ACPI temperatures and those
used by sysmon_envsys(4).

No functional change.
2009-07-04 13:36:49 +00:00
pgoyette caff4fea85 Remove an unused mutex. This was left-over from two years ago when
driver was updated to sysmon_envsys V2;  a simple_lock was turned into
a mutex.  But the only code that ever used the simple_lock was removed
so the mutex can also be removed.

Noticed by njoly@
2009-07-03 21:18:40 +00:00
pgoyette 2d29649a47 Properly convert ACPI zone values to uKelvins.
Patch from njoly@
2009-07-03 15:34:10 +00:00
pgoyette 5de2729099 Change acpi_tz sensor behavior as follows:
1. ENVSYS_WARNOVER event is generated whenever any active cooling level
   is exceeded.

2. ENVSYS_CRITOVER event is generated whenever _HOT limit is exceeded;
   if the _HOT limit is not defined, then ENVSYS_CRITOVER will be
   generated when the _CRT limit is exceeded.

3. For Passive Cooling Only mode, there will be no change in behavior.

Additionally, since there are specific actions taken at each of the Active
Cooling Levels (powering parts of a zone on or off), and the limits are not
user-programmable,

4. The {warn,crit}{min,max} threshold levels will be specified only
   by the device itself;  event reporting thresholds may not be set
   from userland.

No comments received for two weeks after proposing these changes on both
current-users@ and tech-kern@
2009-06-30 16:14:49 +00:00
pgoyette 7c25ce0d52 Explicitly set sensor's units to ENVSYS_STEMP rather than having
it work only because ENVSYS_STEMP is #defined to 0
2009-06-03 22:34:18 +00:00
pgoyette 5a84f3060e Since we no longer have individual events for each sensor value limit,
we don't need individual flag bits.  Clean up extra bit definitions.
Bump kernel version - welcome to 5.99.13
2009-06-01 20:08:44 +00:00
cegger 93dfc06da9 struct device * -> device_t, no functional changes intended. 2009-05-12 09:50:28 +00:00
cegger e5339e11d4 struct cfdata * -> cfdata_t, no functional changes intended. 2009-05-12 09:29:46 +00:00
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
dyoung 5b0576e7eb Add acpitimer_detach() to eventually support acpi(4) detachment. 2009-04-08 00:15:45 +00:00
dyoung 1fb1e79dd5 During shutdown, detach attimer at acpi. 2009-04-07 17:59:18 +00:00
drochner 0785c6f16e avoid tsleep also during shutdown (and in particular ACPI poweroff),
should fix PR kern/39141 by Takahiro Kambe and PR port-i386/41110
by Reinoud Zandijk
2009-03-31 17:17:47 +00:00
cegger f7d20361b0 ansify function definitions 2009-03-15 15:40:33 +00:00
dsl 454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
jmcneill 8cf7d77c2c Don't assume ACPI == x86, from kiyohara@kk.iij4u.or.jp 2009-03-14 13:56:41 +00:00
jmcneill 74dd0aeee0 Change a confusing attach message; if the embedded controller was attached
via ECDT, we would print:
  acpiec0 at acpi0 (EC, PHP0C09-0): ACPI Embedded Controller (disabled)
The embedded controller isn't actually disabled, but instead this driver
instance, so change the message to read:
  acpiec0 at acpi0 (EC, PHP0C09-0): using acpiecdt0
2009-02-28 19:40:23 +00:00
jmcneill c315121ad0 Cut the amount of spam from acpi devices in roughly half by printing
resources on the same line as autoconf messages. Things like:
  pcppi1 at acpi0 (SPKR, PNP0800)
  pcppi1: io 0x61
become:
  pcppi1 at acpi0 (SPKR, PNP0800): io 0x61
2009-02-17 12:46:01 +00:00
jmcneill 3c220ee07d Use aprint_debug 2009-02-17 12:30:31 +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
christos d2ebfa6451 PR/40471: Pierre Pronchery: ASUS CUR-DLS board found on HP NetServer E800 box
has broken ACPI BIOS. Disable it.
2009-01-25 02:26:30 +00:00
jnemeth 45ff970e0f add a comment explaining how to regenerate acpidevs_data.h 2009-01-21 14:15:43 +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
joerg a5be52d405 On resum-from-RAM explicitly restore PCI link device state before
reenabling interrupts. At least one BIOS doesn't do this automatically
as reported by Christoph Egger.
2008-11-17 23:29:49 +00:00
pgoyette 7355d18b97 Leave the task of displaying sensor states to envsys_sysmon() unless we
are in debug mode.
2008-11-09 13:54:06 +00:00
pgoyette 18913ef363 Temp sensor should report a critical-overtemp condition (ENVSYS_SCRITOVER)
not a simple critical (ENVSYS_SCRITICAL) condition.
2008-11-09 03:36:04 +00:00
hans f8681c958c Initialize sc->sc_dev before using it, and use it as argument for the
interrupt handler. Makes this work again. OK by christos.
2008-11-01 20:31:26 +00:00
hans f86fa4502c Make the driver work (except for setting display brightness) on older
machines by removing the check for the CMOS method from thinkpad_match.
OK by jmcneill.
2008-11-01 19:22:25 +00:00
apb 96230fab84 Use ${TOOL_AWK} instead of ${AWK} or plain "awk" in make commands.
Pass AWK=${TOOL_AWK:Q} to shell scripts that use awk.
2008-10-19 22:05:19 +00:00
jmcneill e38f75f075 Add fan sensor support, from Thomas E. Spanjaard 2008-10-18 16:35:40 +00:00
jmcneill c175112638 Remember previous display brightness across suspend/resume; now we don't
need X to restore the display for us.
2008-09-21 21:15:28 +00:00
jmcneill 13e32ea2ea Revert previous. 2008-09-19 11:15:50 +00:00
pgoyette d17c220979 Add another touchpad device - this one found in my Acer2413WLCi laptop.
Tested by me.
OK garbled@
2008-09-16 11:24:55 +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
jmcneill 25b0c73dd3 Clarify some printfs in error cases so we at least know what subsystem
reported them.
2008-07-28 12:20:35 +00:00
dyoung 2e4b9b5581 Make acpilid(4) detachable. 2008-07-15 16:19:37 +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
cegger 17dbee905c use device_lookup_private to get softc 2008-06-12 21:46:21 +00:00
jmcneill 976a12aad4 Fix a mis-tabbed brace, no functional change. 2008-06-04 21:37:03 +00:00
joerg bd8a810c44 Before 1.46, the EC driver would try to send a command again to the EC
after a timeout. This was removed, but the loops remained, so fix them
up as well.
2008-06-03 15:12:39 +00:00
jmcneill fc993c6a36 Reintroduce acpibat_refresh, only have it refresh battery status (not info,
we will get notified for changes there). Use SME_POLL_ONLY so applications
that use GTREDATA don't cause trouble, and don't use SME_INIT_REFRESH as it
appears to be completely broken.
2008-06-03 15:02:31 +00:00
jmcneill edd4ea5b7d Refresh battery info/status on resume. 2008-06-03 12:16:34 +00:00
jmcneill daaa85a781 Simplify SME usage within acpibat:
* No need for sme_refresh callback; GPE handler will tell us when the
    device status changed (otherwise we can refresh data up to once a second,
    and that can take time!)
  * Since sme_refresh callback is gone, mutex is no longer required to
    synchronize GPE handlers and refresh thread, so nuke it.
  * Don't do any more work in GPE handler than required; use AcpiOsExecute
    to clear battery status/information in the sysmon_task_queue along with
    the refresh.

With these changes running GNOME's battstat-applet-2 no longer causes
my mouse to stutter once a second, and significantly reduces its CPU usage.
2008-06-03 01:11:18 +00:00
jmcneill 7eba414472 Don't reload usageid on resume, this should never change. 2008-06-01 23:35:18 +00:00
joerg 42fe28f522 Fix compilation with ACPI_EXTRA_DEBUG. 2008-06-01 19:01:57 +00:00
jmcneill 9f877bc707 Don't use cv_timedwait_sig if (cold) 2008-05-31 21:38:02 +00:00
jmcneill 70b1702726 Remove powerhook_establish calls; this functionality has been broken since
4.99.42 and nobody has complained. Newer systems with ioapic shouldn't
need this, and older non-ioapic systems should properly restore PCI IRQ
routing within their PCI-ISA bridge drivers.
2008-05-31 15:31:05 +00:00
jmcneill ce25e3c5e1 lpt(4): register NULL pmf handler. 2008-05-31 14:07:03 +00:00
jmcneill 10f75496ad MI implementation of AcpiAcquireGlobalLock and AcpiReleaseGlobalLock. 2008-05-24 22:16:20 +00:00
cegger 256cdaf669 correct wrong comment: envsys(4) wants uK 2008-05-20 14:46:31 +00:00
cegger 33e33b567c acpidalb(4): Driver for PNP0C32 Hotkeys aka "Direct Application Launch Buttons".
"awesome" jmcneill
2008-05-18 22:05:59 +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
jmcneill 05f909b7fa Fix memory leak on attach/resume. 2008-05-14 12:15:47 +00:00
ad bf21e0a741 Noisy printf. 2008-05-11 22:16:45 +00:00
jmcneill 729313d52c Use 2-clause license. 2008-05-05 00:12:49 +00:00
jmcneill 35033371fe Use M_ZERO instead of malloc+memset 2008-05-03 16:14:40 +00:00
simonb 96093a0d4f Sprinkle a teeny bit of KNF goodness.. 2008-05-02 01:53:33 +00:00
cegger d9b775927c hpqlb(4): driver for HP Quick Launch buttons - found on HP Pavilion Notebooks 2008-05-01 20:18:18 +00:00
simonb c3325defad Be consistent with #define<space-or-tab>. 2008-05-01 16:06:41 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
jmcneill da01aef3c1 Use isareg constants in thinkpad_brightness_read where possible 2008-04-26 01:19:15 +00:00
jmcneill dd8d5fe840 Define ACPI_THREAD_ID as uintptr_t, and return curlwp instead of
curlwp->l_lid from AcpiOsGetThreadId(), as suggested by ad@
2008-04-24 21:42:05 +00:00
jmcneill 50629393a5 s/struct cfdata */cfdata_t/ 2008-04-23 11:19:09 +00:00
jmcneill fd495c5ce3 AcpiOsGetThreadId should return lwpid, not pid -- otherwise we always return
the same value! Fixes the AE_AML_MUTEX_NOT_ACQUIRED issue when evaluating
_BST on ASUS Eee PC. Who knows what other mysterious bugs this has caused
over the years...
2008-04-22 02:02:50 +00:00
xtraeme a7315e0fc1 Misc cleanups from Geoff Wing. 2008-04-21 14:25:48 +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
xtraeme 2930df439c Make this work again, now that ACPI_TYPE_ANY returns NULL objects
after recent ACPICA update.

Applied patch from Geoff Wing on current-users@.
2008-04-17 19:57:27 +00:00
cegger 376411d2dd device_t / softc split. From Hans Rosenfeld. 2008-04-16 09:39:01 +00:00
cegger b849cd90e5 device_t / softc split. From Hans Rosenfeld 2008-04-15 15:02:28 +00:00
jmcneill 76fcb78d00 Compatibility with ACPICA 20080321; from the release notes:
All Reference Objects returned via the AcpiEvaluateObject interface are now
marked as type "REFERENCE" instead of "ANY". The type ANY is now reserved for
NULL objects - either NULL package elements or unresolved named references.
2008-04-14 00:30:30 +00:00
jmcneill 75aae009fe Cosmetic aprintification fix, as noted by Thomas Klausner on current-users 2008-04-07 10:16:59 +00:00
cegger 335ec2beb5 use aprint_*_dev and device_xname 2008-04-05 21:44:50 +00:00
xtraeme bc77ebea72 Remove useless returns at the end of void functions. 2008-03-31 15:28:47 +00:00
jmcneill 4fab67daa7 Add ASUS ACPI hotkey driver, as found in the Eee PC. 2008-03-31 15:17:21 +00:00
jmcneill 2529ffb3cf Fix printf in ACPI_DEBUG case, pointed out by mlelstv@ 2008-03-29 13:33:12 +00:00
xtraeme 0ab2da71ce Split device_t/softc for mpu(4) and its attachments, plus other
related cosmetic changes.

Reviewed by cube@.
2008-03-27 10:22:00 +00:00
jmcneill fcb7a4511a Split device_t and softc 2008-03-27 02:51:26 +00:00
xtraeme 71c3052b91 Split device_t/softc and related cosmetic changes. 2008-03-26 18:35:17 +00:00
xtraeme 701c2ae0a3 Split device_t/softc for joy(4) and all its attachments. Also
use device_lookup_private() and related cosmetic changes.

Reviewed by cube@.
2008-03-26 18:27:07 +00:00
xtraeme 678337ef71 acpitz_get_zone expects now a device_t not a softc. 2008-03-26 16:48:53 +00:00
xtraeme 8bea7f6b6e Split device_t/softc for ug(4) and other related cosmetic changes. 2008-03-26 16:09:37 +00:00
xtraeme 2be2546b16 Split device_t/softc and related cosmetic changes. 2008-03-26 15:31:59 +00:00
xtraeme 6405ed23e5 acpiacad_get_status: move sc_notifysent to the correct place, otherwise
the notify might not be sent.
2008-03-23 18:38:57 +00:00
xtraeme a7e669727a Register a resume pmf(9) handler that clears the status. It is needed
to always fetch new status after resuming, otherwise if AACAD_F_AVAILABLE
is set, acpiacad_get_status() won't be called.

Also use the SME_INIT_REFRESH flag to fetch sensor data once in the
autoconf(9) process.

Ok'ed by <jmcneill>.
2008-03-23 16:22:00 +00:00
xtraeme 6e9673dcb2 Use the SME_INIT_REFRESH flag to fetch sensor data once in the
autoconf(9) process.
2008-03-23 16:12:45 +00:00
xtraeme 5a14ef4138 Add missing acpilid_wake_event() proto. 2008-03-23 14:20:15 +00:00
xtraeme c280868dfa Split device_t/softc for all hpet consumers. 2008-03-21 13:28:14 +00:00
cube fa7e4a28ef Don't assume a struct device is embedded in the softc. 2008-03-16 15:22:05 +00:00
yamt d28c692afa fix compilation 2008-03-16 13:58:22 +00:00
cube bb192d4cfd Split device_t and softc for the ... wait for it ... [air quotes] MI
variant of fdc(4)/fd(4).  Other cosmetic changes as appropriate.
2008-03-16 00:58:56 +00:00
cube a22d8d4abb Split device_t and softc for pckbc(4) and its attachments. 2008-03-15 13:23:24 +00:00
cube 607ead0ef4 Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend).  Use proper types and ansify where appropriate.
2008-03-14 15:09:09 +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
cube 3c5e53b4e2 Split device_t/softc for i386's apm(4), and other related cosmetic changes. 2008-03-07 21:45:07 +00:00
cube 8ecf8999bf Split the softc from the device_t for all lpt(4) variants and attachments
except the ppbus stuff (which doesn't compile) and ulpt(4) which is
unrelated and can be dealt with separately.

As usual, it comes with related cosmetic changes.
2008-03-07 17:15:51 +00:00
cube 926915cf40 - Split device_t and softc for pcppi(4) and attimer(4)
- Change the attimer <-> pcppi communication using device_t so that
  pcppi(4) doesn't have to know about the contents of struct attimer_softc.

XXX pcppi's childdet function is completely wrong.  This has to be
XXX revisited later.
2008-03-04 16:35:18 +00:00
dyoung e4f3892584 Use pmf_device_register1() instead of shutdownhook_establish() to
register com_cleanup() as the shutdown hook.

Add a generic suspend routine.  Suspend and resume com@isa.

Protect against dereferencing a NULL softc in comioctl().

Destroy both a mutex and a callout in com_detach().

Cosmetic: use aprint_*_dev().  Use PMF_FN_ARGS, PMF_FN_PROTO.
2008-02-29 07:02:04 +00:00
dyoung 61ad1dd43b Use PMF_FN_ARGS, PMF_FN_PROTO. 2008-02-29 06:35:40 +00:00
dyoung 36f58dc899 Use aprint_*_dev(), device_t and accessors. Constify a bit. 2008-02-18 06:19:50 +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
xtraeme 74a0270856 aiboost_getcomp: use Package.Count to allocate and iterate over
the elements rather than Integer.Value, which sometimes doesn't
match and gives unexpected results on the error path.

This fixes the kmem_poison_check on DEBUG kernels (finally). Patch
by Fukumoto Atsushi. Thanks!
2008-02-01 23:12:30 +00:00
xtraeme d187549ef6 Pass the same size to kmem_alloc(9) and kmem_free(9), this fixes
the kmem_poison_check panic on DEBUG kernels.
2008-01-29 19:35:05 +00:00
jmcneill b7cf8d358c The Thinkpad T61/x61 family powers off the USB power resource on resume
from S3 sleep. Until we get proper ACPI power resource support, simply
call \\_SB.PCI0.LPC.EC.PUBS._ON() on resume if the method exists.

Fixes kern/37279 by Steven M Bellovin.
2008-01-28 20:31:55 +00:00
joerg 3615cf7715 Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
2008-01-20 18:09:03 +00:00
jmcneill 8761d09319 Don't be so aggressive in polling the EC when cold, port-i386/37790. 2008-01-18 01:03:24 +00:00
jmcneill 91a074d893 If we are in polling mode, do not try to spin forever in the state machine
waiting for a read or write to complete. Workaround an issue on my VAIO,
but we really need to figure out why it is failing in the first place.
2008-01-18 00:33:54 +00:00
dyoung 636e434283 Support pcppi(4) detachment.
Use device_t, device_private().  Get rid of a struct device * cast.
2008-01-10 07:58:39 +00:00
xtraeme 53fd152fd5 Remove useless returns at the end of void functions. 2008-01-09 14:52:52 +00:00
tnn 303f9ebb5b Make the ACPI_MADT_DEBUG code compile again. 2008-01-07 06:04:07 +00:00
christos d1b79165fa clamp min/max values properly. 2008-01-06 19:42:03 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
dyoung 09fd56f9ec Detach attimer at acpi, attimer at isa. 2008-01-03 01:21:44 +00:00
dyoung 95bf02050e Use device_t, device_private(). 2008-01-02 20:47:28 +00:00
jmcneill 13f097963d Always enable the Fn key quirk if a device node for the Sony Programmable
Interrupt Controller (SNY6001) is not present.
2007-12-23 18:03:02 +00:00
jmcneill 9f7f6d9be0 Move Sony Notebook Controller (sony(4)) driver from MD to MI directory,
as it can be used on amd64 as well.
2007-12-23 17:29:26 +00:00
jmcneill 8fce0f055c Move display switching out of the kernel; deliver this (and other) events
to sysmon so a powerd script can handle them.
2007-12-22 18:38:13 +00:00
jmcneill 6fffc8ef3c Add experimental display switching support. 2007-12-22 13:06:30 +00:00