Commit Graph

44 Commits

Author SHA1 Message Date
Mitsuru IWASAKI
2d64460768 Some small improvements of ACPI thermal driver.
- Give a guaranteed minimum cooling run time to avoid too frequent
   cooling system On/Off switching.  The minimum cooling run time can be
   specified by hw.acpi.thermal.min_runtime in sec.
 - Refine message printing (_AC-1 -> NONE).
 - Add verbose mode enable/disable capability by hw.acpi.verbose in bool.

Reviewed by:	acpi-jp@ folks
2001-10-29 18:09:43 +00:00
Mitsuru IWASAKI
f86214b6b8 Add APM compatibility feature to ACPI.
This emulates APM device node interface APIs (mainly ioctl) and
provides APM services for the applications.  The goal is to support
most of APM applications without any changes.
Implemented ioctls in this commit are:
 - APMIO_SUSPEND (mapped ACPI S3 as default but changable by sysctl)
 - APMIO_STANDBY (mapped ACPI S1 as default but changable by sysctl)
 - APMIO_GETINFO and APMIO_GETINFO_OLD
 - APMIO_GETPWSTATUS

With above, many APM applications which get batteries, ac-line
info. and transition the system into suspend/standby mode (such as
wmapm, xbatt) should work with ACPI enabled kernel (if ACPI works well :-)

Reviewed by:	arch@, audit@ and some guys
2001-10-26 17:43:05 +00:00
Mike Smith
43896e913a Update usage of AcpiEnableEvent to reflect a new argument.
Fix acpi_DeviceIsPresent to check for valid _STA data and to check
the "present" and "functioning" bits.

Use acpi_DeviceIsPresent in acpi_pcib rather than rolling our own
(also broken) version.
2001-10-04 23:21:09 +00:00
Doug Rabson
ed136da6f4 Check the compatible ID as well as the hardware ID in acpi_MatchHid. 2001-10-04 08:31:17 +00:00
Mitsuru IWASAKI
23b4e251d0 Call acpi_DeviceIsPresent() only for devices. This should make
non-ACPI_TYPE_DEVICE devices (such as acpi_tz and acpi_cpu) enabled
again.

Reviewed by:	msmith
2001-09-17 15:11:55 +00:00
Mike Smith
b519f9d660 Disable devices that are not present; at a later stage we can then enable
them if the device arrives.

This should solve the problem where devices that have been disabled eg. in
the BIOS show up with nonsense resources and hang the bootstrap process.
2001-09-15 04:14:31 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Mike Smith
b525621aed Should check debug.acpi.avoid, not .disable. 2001-09-07 03:54:37 +00:00
Mike Smith
32d18aa566 Allow the ACPI subsystem to be disabled with a hint.
Avoid fully initialising the ACPI namespace if we are attempting to avoid
parts of it.  This is a workaround for some systems that still crash
the interpreter.

Implement the ISA_IVAR_LOGICALID for ISA compatibility.  Implement stubs
for other PnP ID-related ivars.
2001-09-07 02:57:29 +00:00
John Baldwin
0c7da7acfa Add a hack to acpi_EvaluateInteger() to handle the case of a method
returning a Buffer that contains an Integer rather an an Integer directly.

Submitted by:	msmith
Approved by:	msmith
2001-09-06 23:16:55 +00:00
Mitsuru IWASAKI
dd081ed5d0 Fix typo; CTLFLAG_RO -> CTLFLAG_RD. 2001-09-02 06:28:20 +00:00
Mike Smith
dde24897d2 Add a MODULE_VERSION declaration. This should prevent duplicate loading
of the module, and allows other modules to depend on and link against
the ACPI module.

Add a sysctl that allows us to retrieve the ACPI CA version number as
well.
2001-09-01 22:41:53 +00:00
Takanori Watanabe
ff741bef86 Call OS-independent resume routine to execute _WAK .. etc.
This should also recover GPE bit,comment says, though not implemented yet.
2001-08-31 05:36:48 +00:00
Mike Smith
bc0f21954b Add support for attaching PnP-aware ISA drivers to ACPI.
Always parse ACPI device resource settings (current resources only)
and attach the resources to the device before probe/attaching.
2001-08-30 00:50:58 +00:00
Mike Smith
4c1cdee628 Updates to match the ACPI CA 20010816 import:
- New debug macro (ACPI_DEBUG_PRINT), reducing debug-case code size.
 - New debug level/subsystem codes.
2001-08-26 22:50:15 +00:00
Mike Smith
a692219d8a Move the resource pointer when we reallocate the buffer.
Submitted by:	"neckpain@nettaxi.com" <neckpain@nettaxi.com>
2001-08-03 08:38:11 +00:00
Mike Smith
6d63101a75 - Prevent the ACPI code from being loaded as a module other than at
boot time.  Loading as a module once the system is up and running
   doesn't make any sense.

 - Fix acpi_FindIndexedResource (it would only check the first resource),
   changes the calling interface.

 - Add a new helper function (acpi_AppendBufferResource) to help building
   buffers containing resources.
2001-07-30 08:59:43 +00:00
Mitsuru IWASAKI
56d8cb57b9 Don't do sleep state transition if specified sleep state is not
supported by the system.
2001-07-22 19:13:54 +00:00
Mike Smith
bfae45aa43 Convert from acpi_strerror() to AcpiFormatException()
Fix dangling include of the dear departed acpi_ecreg.h
2001-07-21 10:24:37 +00:00
Mike Smith
acf72ef4f1 The API for loading tables changed (we no longer explicitly search for the
RSDP, it's now found via a callback).

AcpiOsSleepUsec() went away, use AcpiOsSleep() instead (we could use
AcpiOsStall() too)

AcpiFormatException() was changed to make more sense (it behaves like
our old acpi_strerror() did), so throw acpi_strerror() away (still
#defined in acpivar.h though, we need to sweep these seperately).
2001-07-21 04:04:03 +00:00
Takanori Watanabe
6161544ca7 Add ACPI S2-S4BIOS Suspend/Resume code.
Some problems may remain.

Reviewed by:iwasaki
2001-07-20 06:07:34 +00:00
Mike Smith
7d3bcec9fb Add acpi_GetTableIntoBuffer, to aid in fetching tables. 2001-07-07 10:20:17 +00:00
Mike Smith
6f69255b9f Add a new helper function for finding resources in resource buffers.
Move the ACPI generic battery code into a new file.
2001-07-05 07:14:30 +00:00
Mike Smith
cb9b0d80fb Update to synch with the 20010615 ACPI CA import.
Add an ACPI subsystem mutex, and macros for handling it.  Because it's
not possible to differentiate between ACPI CA acquiring mutexes for
internal use and for use by AML, and because AML in the field doesn't
handle mutexes correctly, we can't use the ACPI subsystem's internal
locking.  In addition, we have other private data of our own to lock.

Add initial locking to the ACPI driver code and the thermal module.
These locks are currently inoperative.

Pull some errant style back into line.
2001-06-29 20:29:59 +00:00
Mike Smith
c5ba0be495 Sync to my work in progress:
- Reorder the acpi_* functions in a sensible fashion
 - Add acpi_ForeachPackageObject and acpi_GetHandleInScope
 - Use the new debugging layer/level names
 - Implement most of the guts of the acpi_thermal module; passive cooling
   isn't there yet, but active cooling should work.
 - Implement power resource handling (acpi_powerres.c)

This compiles and mostly works, but my test coverage is small, so feedback
is welcome.
2001-06-28 06:17:16 +00:00
Mitsuru IWASAKI
a5d1879b32 - Swap order of "S4B" and "S5" in sleep_state_names. They already
changed in ACPICA actypes.h.
- Use ACPI_S_STATES_MAX instead of ACPI_STATE_S5.
2001-06-24 02:37:38 +00:00
Mitsuru IWASAKI
4eb77744b5 Add sysctl interface (Read-only) for temprature, AC-line and Battery.
Patches for acpi_cmbat.c submitted by Munehiro Matsuda.
2001-06-23 10:38:25 +00:00
Mike Smith
2a4ac806d7 - Updates for new constant naming in the ACPI CA 20010518 update.
- Use __func__ instead of __FUNCTION.
 - Support power-off to S3 or S5 (takawata)
 - Enable ACPI debugging earlier (with a sysinit)
 - Fix a deadlock in the EC code (takawata)
 - Improve arithmetic and reduce the risk of spurious wakeup in
   AcpiOsSleep.
 - Add AcpiOsGetThreadId.
 - Simplify mutex code (still disabled).
2001-05-29 20:13:42 +00:00
Mark Murray
fb919e4d5a Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by:	bde (with reservations)
2001-05-01 08:13:21 +00:00
John Baldwin
606e1d6816 Remove bogus block device major now that bdev majors are gone. 2001-04-02 23:36:36 +00:00
John Baldwin
f34fa851e0 Catch up to header include changes:
- <sys/mutex.h> now requires <sys/systm.h>
- <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
2001-03-28 09:17:56 +00:00
Mitsuru IWASAKI
c30382df80 Bring our local hack for wakeup back from
sys/contrib/dev/acpica/Subsystem/Hardware/Attic/hwxface.c to the proper
location after AcpiEnterSleepState().

 - Wait for the WAK_STS bit
 - Evaluate the _WAK method and check result code
2001-03-07 15:22:14 +00:00
Mike Smith
91467fc61d ACPI_NUMBER becomes ACPI_INTEGER. acpi_EvaluateNumber becomes
acpi_EvaluateInteger.

Use acpi_EvaluateInteger instead of doing things the hard way where
possible.

AcpiSetSystemSleepState (unofficial) becomes AcpiEnterSleepState.

Use the AcpiGbl_FADT pointer rather than searching for the FADT.
2001-01-31 09:30:57 +00:00
John Baldwin
1d073b1d43 Add 3 new dynamic sysctl's to control the sleep states switched to on a
power button, sleep button, or lid close event.  The sysctl's use the
ACPI sleep state names S0, S1, S2, S3, S4, S4B, and S5.

Reviewed by:	iwasaki
2001-01-13 21:28:57 +00:00
Mitsuru IWASAKI
13d4f7bae3 Enable fixed event at not only boot but also wakeup.
Reported and patch tested by:	Peter Dufault <dufault@hda.hda.com>
2001-01-10 18:01:51 +00:00
Mitsuru IWASAKI
917d44c856 Add ioctls to acpi_cmbat and acpi_acad. These use mike's acpi_register_ioctl().
Fix wrong AML method calling in acpi_cmbat.
2000-12-24 19:12:10 +00:00
Mitsuru IWASAKI
5f3e417548 Fix testing reboot howto flags in acpi_shutdown_final().
This sould make the system power-off correctly where the howto had
more bits set than RB_POWEROFF, e.g. RB_NOSYNC.

Submitted by:	Peter Pentchev <roam@orbitel.bg>
2000-12-19 15:45:11 +00:00
Mitsuru IWASAKI
b2c9c0dab2 Catch up with the recent conversion the per-eventhandler list mutex to
a lockmgr lock.
2000-12-12 14:20:27 +00:00
Mike Smith
0ae554237c - Convert a lot of homebrew debugging output to use the ACPI CA debugging
infrastructure.  It's not perfect, but it's a lot better than what
   we've been using so far.  The following rules apply to this:
    o BSD component names should be capitalised
    o Layer names should be taken from the non-CA set for now.  We
      may elect to add some new BSD-specific layers later.

 - Make it possible to turn off selective debugging flags or layers
   by listing them in debug.acpi.layer or debug.acpi.level prefixed
   with !.

 - Fully implement support for avoiding nodes in the ACPI namespace.
   Nodes may be listed in the debug.acpi.avoid environment variable;
   these nodes and all their children will be ignored (although still
   scanned over) by ACPI functions which scan the namespace.  Multiple
   nodes can be specified, separated by whitespace.

 - Implement support for selectively disabling ACPI subsystem components
   via the debug.acpi.disable environment variable.  The following
   components can be disabled:
    o bus	creation/scanning of the ACPI 'bus'
    o children	attachment of children to the ACPI 'bus'
    o button	the acpi_button control-method button driver
    o ec	the acpi_ec embedded-controller driver
    o isa	acpi replacement of PnP BIOS for ISA device discovery
    o lid	the control-method lid switch driver
    o pci	pci root-bus discovery
    o processor CPU power/speed management
    o thermal	system temperature detection and control
    o timer	ACPI timecounter
   Multiple components may be disabled by specifying their name(s)
   separated by whitespace.

 - Add support for ioctl registration.  ACPI subsystem components may
   register ioctl handlers with the /dev/acpi generic ioctl handler,
   allowing us to avoid the need for a multitude of /dev/acpi* control
   devices, etc.
2000-12-08 09:16:20 +00:00
Mike Smith
4d3329891c ACPI HID's aren't limited to 7 characters. Don't check the length of the
HID passed in as an argument at all; callers are typically going to be
sending us static strings anyway.

Submitted by:	Munehiro Matsuda <haro@tk.kubota.co.jp>
2000-12-05 00:19:10 +00:00
Mike Smith
042283a67b Update to work with the new ACPI CA snapshot.
- Use ACPI_PHYSICAL_ADDRESS
 - RSDT -> XSDT
 - FACP -> FADT
 - No APIC table support
 - Don't install a global EC handler; this has bad side-effects
   (it invokes _REG in *all* EC spaces in the namespace!)
 - Check for PCI bus instances already existing before adding them
2000-12-01 10:18:57 +00:00
Mike Smith
aef8008768 Remove unused PCI includes. 2000-11-06 22:33:49 +00:00
Takanori Watanabe
840f9b5317 If acpica driver is loaded using kldload(8), warn and just ignore. 2000-10-31 11:54:10 +00:00
Mike Smith
15e32d5d03 Initial FreeBSD OSPM (operating system power management) modules for
ACPICA.  Most of these are still works in progress.  Support exists for:

 - Fixed feature and control method power, lid and sleep buttons.
 - Detection of ISA PnP devices using ACPI namespace.
 - Detection of PCI root busses using ACPI namespace.
 - CPU throttling and sleep states (incomplete)
 - Thermal monitoring and cooling control (incomplete)
 - Interface to platform embedded controllers (mostly complete)
 - ACPI timer (incomplete)
 - Simple userland control of sleep states.
 - Shutdown and poweroff.
2000-10-28 06:59:48 +00:00