Commit Graph

169 Commits

Author SHA1 Message Date
Matthew Dillon
d32e27a9f4 Tests by numerous people have shown that many chipsets do not properly
latch the acpi timer, resulting in weird deltas.  The problem is severe
enough to adversely effect the timecounter code.

Default to the 'safe' version of the get-timecount function.  The probe
will override it if a known-good chipset is found.  This is temporary
until a more complete solution is found.

Reviewed by:	phk
2002-02-24 22:58:15 +00:00
Mike Smith
222c49a4c7 AcpiOsPrintf and AcpiOsVprintf now return void. 2002-02-23 05:32:51 +00:00
Mike Smith
9232a543e6 AcpiOsCallocate is no longer required. 2002-02-23 05:32:10 +00:00
Mike Smith
72e5754cfb Match namespace cleanup changes in ACPI CA 20020217 update. 2002-02-23 05:31:38 +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
Mike Smith
1a6f2d2ab3 Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Convert to using a kthread rather than timeout() to avoid problems
with the interpreter sleeping.
2002-02-23 05:29:23 +00:00
Mike Smith
741ef403c2 Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.
2002-02-23 05:28:22 +00:00
Mike Smith
c1b1f7874c Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Use _ADR as well as _BBN to get our bus number.
2002-02-23 05:27:49 +00:00
Mike Smith
9127281c88 Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
2002-02-23 05:26:45 +00:00
Mike Smith
dbd0058a4e Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.

The ACPI global lock acquire takes a timeout value.  I'm not sure what
we should do about timeouts on it; a deadlock against this lock is
catastrophic.
2002-02-23 05:26:31 +00:00
Mike Smith
595a08978c Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Kill off the timeouts that used to read _BIF and _BST.  These are
invoked when the battery is actually read.  timeout() is dangerous
in combination with ACPI, as the interpreter can block.

This driver still needs more work.
2002-02-23 05:24:14 +00:00
Mike Smith
b53f277167 Match namespace cleanup changes in ACPI CA 20020217 update.
Use ACPI_SUCCESS/ACPI_FAILURE consistently.
The AcpiGetInto* interfaces are obsoleted by ACPI_ALLOCATE_BUFFER.

Add AcpiBatteryIsPresent helper to determine whether a battery device
is inserted.

Add ACPI_ALL_DRIVERS to the list of debug layers, now that we own the
namespace for this.

Pr:
2002-02-23 05:21:56 +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
Takanori Watanabe
f8372ade81 Fix error handling.
PR:30665
Submitted by:TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp>
2002-01-31 01:23:22 +00:00
Mike Smith
b6b6d662bc find_devclass -> devclass_find. 2002-01-08 19:14:59 +00:00
Mike Smith
3273b00523 Staticise devclasses and some unnecessarily global variables. 2002-01-08 06:46:01 +00:00
John Baldwin
c86b6ff551 Change the preemption code for software interrupt thread schedules and
mutex releases to not require flags for the cases when preemption is
not allowed:

The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent
switching to a higher priority thread on mutex releease and swi schedule,
respectively when that switch is not safe.  Now that the critical section
API maintains a per-thread nesting count, the kernel can easily check
whether or not it should switch without relying on flags from the
programmer.  This fixes a few bugs in that all current callers of
swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from
fast interrupt handlers and the swi_sched of softclock needed this flag.
Note that to ensure that swi_sched()'s in clock and fast interrupt
handlers do not switch, these handlers have to be explicitly wrapped
in critical_enter/exit pairs.  Presently, just wrapping the handlers is
sufficient, but in the future with the fully preemptive kernel, the
interrupt must be EOI'd before critical_exit() is called.  (critical_exit()
can switch due to a deferred preemption in a fully preemptive kernel.)

I've tested the changes to the interrupt code on i386 and alpha.  I have
not tested ia64, but the interrupt code is almost identical to the alpha
code, so I expect it will work fine.  PowerPC and ARM do not yet have
interrupt code in the tree so they shouldn't be broken.  Sparc64 is
broken, but that's been ok'd by jake and tmm who will be fixing the
interrupt code for sparc64 shortly.

Reviewed by:	peter
Tested on:	i386, alpha
2002-01-05 08:47:13 +00:00
Mike Smith
3e759f3681 If the CLK_VAL register is 0 bits wide, the system does not support
CPU throttling, so don't do some bogus math to check it.
2002-01-02 10:53:10 +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
931a10c9d2 Add a couple of minor changes.
- set sc->acpi_s4bios to 1 by default for hibernation until
   OS-initiated S4 transition is implemented.
 - change the behavior of acpi_sleep_state_sysctl() if new value is
   the same as old one, do nothing instead of EINVAL.
2001-11-30 16:06:00 +00:00
Mitsuru IWASAKI
b9c780d64e Yet another synch with minor changes in the ACPI CA 20011120 snapshot.
We need to call AcpiEnterSleepStatePrep() before AcpiEnterSleepState().
2001-11-28 12:09:42 +00:00
Mike Smith
76f2b644fd Synch with minor changes in the ACPI CA 20011120 snapshot. 2001-11-28 04:36:29 +00:00
Mitsuru IWASAKI
6397624d9b Validate requested sleep state in acpi_SetSleepState() to avoid reentry
during wakeup procedure.
2001-11-23 05:57:03 +00:00
Mitsuru IWASAKI
dc2183bf5c Add disabling code via the debug.acpi.disable environment variable. 2001-11-22 17:43:15 +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
964679ce58 Fix re-enabling ACPI on wakeup from hibernation. The problem was that
acpi_Disable() cleared all GPE events.
Some old ACPI implementaions still need current re-enabling code.
2001-11-15 15:12:08 +00:00
Mitsuru IWASAKI
e0157e3edc Two minor changes.
- Change _ACx sysctl oid from ten of _AC[0-9] to one _ACx.
 - Better error printing on _TMP evaluation.

Reviewed by:    msmith
2001-11-15 12:00:48 +00:00
Mitsuru IWASAKI
b8670bed9b Remove "S4B" from sleep_state_names and add "NONE" instead.
Now you can say;
 # sysctl hw.acpi.lid_switch_state=NONE
instead of specifying unsupported _Sx object in the system.

Actually, S4B is going to disappear in ACPICA and we already have
hw.acpi.s4bios to distinguish BIOS hibernation or OS hibernation.
2001-11-15 11:59:25 +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
09e97d2f24 Remove unnecessary WAK_STS bit waiting code for S1 sleep.
It was duplicated with AcpiEnterSleepState() since acpica-unix-20010816.
2001-11-05 14:51:58 +00:00
Mitsuru IWASAKI
3fa010222f Oops, deleted wrong BIF acquisition timeout invocation by mistake
in my previous commit.
acpi_cmbat_get_bif() from taskqueue calls acpi_cmbat_timeout() so it's
better for startup.
2001-11-01 22:20:41 +00:00
Mitsuru IWASAKI
f9390180fe Some fix for the recent apm module changes.
- Now that apm loadable module can inform its existence to other kernel
   components  (e.g. i386/isa/clock.c:startrtclock()'s TCS hack).
 - Exchange priority of SI_SUB_CPU and SI_SUB_KLD for above purpose.
 - Add simple arbitration mechanism for APM vs. ACPI.  This prevents
   the kernel enables both of them.
 - Remove obsolete `#ifdef DEV_APM' related code.
 - Add abstracted interface for Powermanagement operations.  Public apm(4)
   functions, such as apm_suspend(), should be replaced new interfaces.
   Currently only power_pm_suspend (successor of apm_suspend) is implemented.

Reviewed by:	peter, arch@ and audit@
2001-11-01 16:34:07 +00:00
Mitsuru IWASAKI
a296c021c2 Style(9) fix, mainly white spaces. 2001-10-30 15:51:52 +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
John Baldwin
282873e2c0 - Change the taskqueue locking to protect the necessary parts of a task
while it is on a queue with the queue lock and remove the per-task locks.
- Remove TASK_DESTROY now that it is no longer needed.
- Go back to inlining TASK_INIT now that it is short again.

Inspired by:	dfr
2001-10-26 18:46:48 +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
John Baldwin
1de1c550b1 Add locking to taskqueues. There is one mutex per task, one mutex per
queue, and a mutex to protect the global list of taskqueues.  The only
visible change is that a TASK_DESTROY() macro has been added to mirror
the TASK_INIT() macro to destroy a task before it is free'd.

Submitted by:	Andrew Reiter <awr@watson.org>
2001-10-26 06:32:21 +00:00
John Baldwin
76e7a78292 Use TASK_INIT to initialize taskqueue task instead of violating the
abstraction.

Submitted by:	Andrew Reiter <arr@watson.org>
2001-10-25 19:56:02 +00:00
John Baldwin
e5e5b51f9f Allow hw.acpi.cpu.{economy,performance}_speed to be set from the loader
via tunables.
2001-10-23 22:37:36 +00:00
Mitsuru IWASAKI
c7a9768031 Reduce frequency of Battery info (_BIF) acquisition. This helps
avoiding EC read errors on some laptops.
 - Stop updating Battery info for all user requests
 - Update Battery info by notify events and resume method
 - Poll Battery info every one minute

Suggested by:	takawata
2001-10-22 18:01:37 +00:00
John Baldwin
7106ca0d1a Add missing includes of sys/lock.h. 2001-10-11 17:52:20 +00:00
Doug Rabson
a067d21032 Make the interrupt routing a bit less chatty unless bootverbose is set. 2001-10-07 18:25:43 +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
Peter Wemm
555143d0df Fix a stack trashing bug when int != sizeof(pointer)
This fixes the ia64 boot!  We have scsi disks!
2001-10-06 03:49:38 +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
b0ee13ad5a Add busspace hacks for ia64. 2001-10-04 08:33:16 +00:00