Commit Graph

38 Commits

Author SHA1 Message Date
Takanori Watanabe
c6a78e9840 Add sysctl knob to stop disabling acpi on shutdown.
Approved by: re(jhb)
2002-12-11 18:48:50 +00:00
Mitsuru IWASAKI
91da7c40b2 Invoke 3 ACPI task threads as default if option ACPI_MAX_THREADS is
not defined.
To make previous default behavior (ACPI_MAX_THREADS undefined), define
option ACPI_MAX_THREADS as 0.
2002-10-31 17:58:39 +00:00
John Baldwin
0b1d1f1afb - Include lock headers on current in this header instead of putting
#if's in all the other ACPI source files.
- Use splhigh() for the ACPI subsystem lock on 4-stable.

Sponsored by:	The Weather Channel
2002-10-16 17:27:11 +00:00
John Baldwin
da14ac9fce Add a helper routine acpi_SetIntrModel() to call the _PIC method to set
the interrupt model in use so that ACPI can properly route interrupts for
machines using APIC's or SAPIC's.
2002-09-06 16:08:08 +00:00
Mitsuru IWASAKI
d62ab2f4a1 Resolve conflicts arising from the ACPI CA 20020815 import. 2002-08-29 01:52:27 +00:00
Mitsuru IWASAKI
ff01efb50d Add new sysctl MIB (hw.acpi.sleep_delay) to specify the delay (in
seconds) before ACPI sleep.  Some machines might need this to sleep
by Hot-key.
2002-08-25 06:13:53 +00:00
Mitsuru IWASAKI
a1fccb4765 Add device(power/sleep button and lid) wake function from sleeping state.
This is required for some Thinkpad (and maybe VAIO) machines to wake
the system up from sleep.

Currently partially implemented, more complete implementation will come later.
2002-07-22 12:52:54 +00:00
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Mitsuru IWASAKI
899ccf541a Add generalized power profile code.
This makes other power-management system (APM for now) to be able to
generate power profile change events (ie. AC-line status changes), and
other kernel components, not only the ACPI components, can be notified
the events.

 - move subroutines in acpi_powerprofile.c (removed) to kern/subr_power.c
 - call power_profile_set_state() also from APM driver when AC-line
   status changes
 - add call-back function for Crusoe LongRun controlling on power
   profile changes for a example
2002-03-04 18:46:13 +00:00
Mike Smith
dd5d65087b Add our own private defines for driver debug layers.
Obsolete the acpi_GetInto* interfaces.

Fix a typo to be less appropriate.
2002-02-23 05:30:54 +00:00
Takanori Watanabe
85dff349f4 Fix irq/drq handling. IRQ and DRQ resource information can be get
in one object for one resource. Array of values in a object means
possible values for the object.
2002-01-31 09:18:27 +00:00
Mike Smith
3273b00523 Staticise devclasses and some unnecessarily global variables. 2002-01-08 06:46:01 +00:00
Mitsuru IWASAKI
586cd03a19 Oops, wrong option name. It's should be ACPI_MAX_THREADS,
not ACPI_NO_THREADS.
2001-12-25 06:06:56 +00:00
Mitsuru IWASAKI
c573e654b7 Add OS layer ACPI mutex and threading support.
- Temporary fix a bug of Intel ACPI CA core code.
 - Add OS layer ACPI mutex support.  This can be disabled by
   specifying option ACPI_NO_SEMAPHORES.
 - Add ACPI threading support.  Now that we have a dedicate taskqueue for
   ACPI tasks and more ACPI task threads can be created by specifying option
   ACPI_MAX_THREADS.
 - Change acpi_EvaluateIntoBuffer() behavior slightly to reuse given
   caller's buffer unless AE_BUFFER_OVERFLOW occurs.  Also CM battery's
   evaluations were changed to use acpi_EvaluateIntoBuffer().
 - Add new utility function acpi_ConvertBufferToInteger().
 - Add simple locking for CM battery and temperature updating.
 - Fix a minor problem on EC locking.
 - Make the thermal zone polling rate to be changeable.
 - Change minor things on AcpiOsSignal(); in ACPI_SIGNAL_FATAL case,
   entering Debugger is easier to investigate the problem rather than panic.
2001-12-22 16:05:41 +00:00
Mitsuru IWASAKI
ece50487e9 Disable sleep requests for 5 sec after wakeup. This is needed for
some Toshiba and Thinkpad laptops.
Wakeup event is generated by power button or sleep button on some
laptops but this also generates SCI interrupt, and shutdown the system
as result.  So this is introduced so that acpi driver ignore given
requests for certain period.
2001-12-09 18:02:36 +00:00
Mitsuru IWASAKI
6971b3c7d1 Cleanups of verbose printing. All the messages for the debugging is
disabled unless verbose flag is set.  Also fix some messages in terms
of English.
The critical messages and error messages in probe/attach routine are
unchanged by this commit.
2001-11-18 18:12:07 +00:00
Mitsuru IWASAKI
1611ea8727 Add S4BIOS sleep (BIOS hibernation) and DSDT overriding support.
- Add S4BIOS sleep implementation.  This will works well if MIB
   hw.acpi.s4bios is set (and of course BIOS supports it and hibernation
   is enabled correctly).
 - Add DSDT overriding support which is submitted by takawata originally.
   If loader tunable acpi_dsdt_load="YES" and DSDT file is set to
   acpi_dsdt_name (default DSDT file name is /boot/acpi_dsdt.aml),
   ACPI CA core loads DSDT from given file rather than BIOS memory block.
   DSDT file can be generated by iasl in ports/devel/acpicatools/.
 - Add new files so that we can add our proposed additional code to Intel
   ACPI CA into these files temporary.  They will be removed when
   similar code is added into ACPI CA officially.
2001-11-06 15:00:30 +00:00
Mitsuru IWASAKI
9febbb4078 Some improvements of control method battery driver.
- Add a new MIB for battery info expire time in order to make it changeable.
   Battery info expire time can be specified by
   hw.acpi.battery.info_expire in sec.
 - Add own MALLOC type and fix some potential memory leakages.
 - Change some frequent printings to verbose printing.
 - Stop timeout during acpi_cmbat_get_bst() too.  This should reduce
   the races with BIF evaluation.
 - Remove acpi_cmbat_get_bif() invocation from acpi_cmbat_attach().
   This was redundant because this should be called from
   acpi_cmbat_timeout() now.
2001-10-30 14:24:26 +00:00
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
Peter Wemm
887f6fb8d4 Fix some 64-bit uncleanliness. 2001-10-06 04:09:26 +00:00
Peter Wemm
cd5178beb8 Fix some style bugs before fixing some real bugs. 2001-10-06 04:03:20 +00:00
Mike Smith
d5519f129a Note that now that some ISA devices will attach to ACPI, we need to
keep the ivar indexes that ISA uses free.
2001-08-30 00:45:42 +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
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
59c82e8fd0 Add support for system power profiles; select "performance" when AC power
is available and "economy" when it is not.
2001-07-07 01:46:40 +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
03b5e1982a Add ACPI subsystem mutex support, currently disabled. This implements
a private mutex we can use to wrap the ACPI subsystem proper.
2001-06-29 20:33:29 +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
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
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
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
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