Commit Graph

665 Commits

Author SHA1 Message Date
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