summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_ec.c
Commit message (Collapse)AuthorAgeFilesLines
* Consistently use ACPI_SUCCESS() and ACPI_FAILURE() macros wherever possible.jkim2012-06-011-8/+8
|
* Centralize declaration of the debug.acpi sysctl node.jhb2012-05-171-1/+0
|
* - Give all clocks and timers on acpi0 the equal probing order.jkim2012-02-071-1/+1
| | | | | | | - Increase probing order for ECDT table to match HID-based probing. - Decrease probing order for HPET table to match HID-based probing. - Decrease probing order for CPUs and system resources. - Fix ACPI_DEV_BASE_ORDER to reflect the reality.
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+1
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Clarify the previous commit. AcpiFinishGpe() will not clear GPE for usjkim2011-01-041-1/+3
| | | | because we set it to edge-trigger.
* Clear GPE from a query handler if the task was deferred.jkim2011-01-041-8/+11
|
* Fix parameters for wakeup(9) and tsleep(9).jkim2011-01-031-2/+2
| | | | MFC after: 3 days
* Merge ACPICA 20101209.jkim2010-12-151-6/+11
|
* acpi_ec: changes in communication with hardwareavg2010-10-121-83/+89
| | | | | | | | | | | | | | | | | | Short description of the changes: - attempt to retry some commands for which it is possible (read, query) - always make a short sleep before checking EC status in polled mode - periodically poll EC status in interrupt mode - change logic for detecting broken interrupt delivery and falling back to polled mode - check that EC is ready for input before starting a new command, wait if necessary This commit is based on the original patch by David Naylor. PR: kern/150517 Submitted by: David Naylor <naylor.b.david@gmail.com> Reviewed by: jkim MFC after: 3 weeks
* When EC burst mode is activated and multiple bytes are accessed, do notjkim2010-08-061-54/+27
| | | | | disable and enable repeatedly, just do it once per call. It also reduces code duplication. Check all parameters early and fail immediately.
* Merge ACPICA 20100702.jkim2010-07-061-3/+2
|
* Remove unnecessary pointer type castings, shift operations and dead code.jkim2010-06-011-18/+17
|
* Merge ACPICA 20100331 (and four additional upstream patches).jkim2010-04-021-9/+3
|
* Merge ACPICA 20100121.jkim2010-01-211-7/+7
|
* acpi_ec: remove redundant acpi_disabled check in probe methodavg2010-01-181-2/+1
| | | | MFC after: 4 days
* acpi_ec: clean up 'private' ivar when freeing memory to which it pointsavg2010-01-181-0/+1
| | | | | | | | | | This is not only a prudent thing to do, but also makes sure that probe method is not confused by non-NULL 'private', if the previous attach attempt fails for any reason. PR: kern/142561 Tested by: Alex Goncharov <alex-goncharov@comcast.net> MFC after: 4 days
* acpi: remove 'magic' ivaravg2009-11-071-8/+6
| | | | | | | | | | | | | o acpi_hpet: auto-added 'wildcard' devices can be identified by non-NULL handle attribute. o acpi_ec: auto-add 'wildcard' devices can be identified by unset (NULL) private attribute. o acpi_cpu: use private instead of magic to store cpu id. Reviewed by: jhb Silence from: acpi@ MFC after: 2 weeks X-MFC-Note: perhaps the ivar should stay for ABI stability
* Import ACPICA 20090521.jkim2009-06-051-1/+3
|
* Initial suspend/resume support for amd64.jkim2009-03-171-1/+1
| | | | | | This code is heavily inspired by Takanori Watanabe's experimental SMP patch for i386 and large portion was shamelessly cut and pasted from Peter Wemm's AP boot code.
* Whitespace only.njl2007-11-081-2/+0
|
* More style nit.takawata2007-10-251-6/+3
| | | | Pointed out by: njl.
* Fix variable name to be clear what it means.takawata2007-10-251-3/+3
|
* Turn EC into poll mode before device_resume invoked .takawata2007-10-251-3/+34
|
* Rewrite the EC driver event model. The main goal is to avoidnjl2007-09-241-304/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | polling/interrupt-driven fallback and instead use polling only during boot and pure interrupt-driven mode after boot. Polled mode could be relegated completely to a legacy role if we could enable interrupts during boot. Polled mode can be forced after boot by setting debug.acpi.ec.polled="1", i.e. if there are timeouts. - Use polling only during boot, shutdown, or if requested by the user. Otherwise, use a generation count of GPEs, incremented atomically. This prevents an old status value from being used if the EC is really slow and the same condition (i.e. multiple IBEs for a write transaction) is being checked. - Check for and run the query handler directly if the SCI bit is set in the status register during boot. Previously, the query handler wouldn't run until interrupts were finally enabled late in boot. - During boot and after starting a command, check if the event appears to already have occurred before we even start waiting. If so, it's possible the EC is very slow and we might accept an old status value. Print a warning in this case. Once we've booted, interrupt-driven mode should work just fine but polled mode could be unreliable. There's not much more we can do about this until interrupts are enabled during boot. - In the above case, we also do one final check if the interrupt-driven mode gets a timeout. If the status is complete, it will force the system back into polled mode since interrupt mode doesn't work. For polled mode during boot, if the status appears to be already complete before beginning the check loop, it waits 10 us before actually checking the status, just in case the EC is really slow and hasn't gotten to work on the new request yet. - Use upper-case hex for the _Qxx method - Use device_printf for errors, don't hide them under verbose - Increase default total timeout to 750 ms and decrease polling interval to 5 us. - Don't pass the status value via the softc. Just read it directly. - Remove the mutex. We use the sx lock for transaction serialization with the query handler. - Remove the Intel copyright notice as no code of theirs was ever present in this file (verified against rev 1.1) - Allow KTR module-only builds for ease of testing Thanks to jkim and Alexey Starikovskiy for helpful discussions and testing. Approved by: re MFC after: 2 weeks
* Convert magic to a uintptr_t. This should get rid of some warnings onnjl2007-06-151-2/+2
| | | | gcc4.
* AcpiAcquireGlobalLock() can sometimes sleep if the mutex is contested.njl2007-06-021-13/+10
| | | | | | | | | | | | | | | | The global lock is a memory region shared with the BIOS and thus has some strange behavior like the fact that the sleep is 1 ms max. We use standard mutexes to synchronize with the SCI so acquiring the global lock after locking the mutex resulted in a witness warning. To deal with this for now, acquire the global lock before all other locks, similar to Giant. This should fix the witness "sleeping with mutex held" issue on boot that occurred after the last ACPI-CA import. In the future, we hope to move to the new mutex interface in ACPI-CA instead of the pseudo-semaphore version we have now. Reviewed by: jkim
* Optimize sx locks to use simple atomic operations for the common cases ofjhb2007-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | obtaining and releasing shared and exclusive locks. The algorithms for manipulating the lock cookie are very similar to that rwlocks. This patch also adds support for exclusive locks using the same algorithm as mutexes. A new sx_init_flags() function has been added so that optional flags can be specified to alter a given locks behavior. The flags include SX_DUPOK, SX_NOWITNESS, SX_NOPROFILE, and SX_QUITE which are all identical in nature to the similar flags for mutexes. Adaptive spinning on select locks may be enabled by enabling the ADAPTIVE_SX kernel option. Only locks initialized with the SX_ADAPTIVESPIN flag via sx_init_flags() will adaptively spin. The common cases for sx_slock(), sx_sunlock(), sx_xlock(), and sx_xunlock() are now performed inline in non-debug kernels. As a result, <sys/sx.h> now requires <sys/lock.h> to be included prior to <sys/sx.h>. The new kernel option SX_NOINLINE can be used to disable the aforementioned inlining in non-debug kernels. The size of struct sx has changed, so the kernel ABI is probably greatly disturbed. MFC after: 1 month Submitted by: attilio Tested by: kris, pjd
* Catch up with ACPI-CA 20070320 import.jkim2007-03-221-23/+10
|
* If we got an OBE/IBF event, we failed to re-enable the GPE. This wouldnjl2007-03-201-5/+14
| | | | | | | | | cause the EC to stop handling future events because the GPE stayed masked. Set a flag when queueing a GPE handler since it will ultimately re-enable the GPE. In all other cases, re-enable it ourselves. I reworked the patch from the submitter. Submitted by: Rong-en Fan <grafan@gmail.com>
* Disable burst mode by default. Testing has shown that while it works onnjl2007-03-181-2/+2
| | | | | | | most systems, it causes the EC not to respond for some Acer and Compaq/HP laptops. This is the default value for Linux also. For systems that need it, burst mode can be enabled via the tunable/sysctl: debug.acpi.ec.burst="1"
* Rework EC I/O approach. Implement burst mode, including proper handling ofnjl2007-02-271-109/+206
| | | | | | | | | | | | | | | | | case where it asynchronously exits burst mode on its own. Handle different values of hz in sleep loop. Provide more debugging options to tune EC behavior. These tunables/sysctls may be temporary and are not for user access if the EC is working properly. Burst mode is now on by default for testing and the poll interval has been increased from 100 to 500 us and total timeout from 100 to 500 ms. Hopefully this should be the first step of addressing reports of timeout errors during battery or thermal access, especially on HP/Compaq laptops. It is reasonably stable and should not cause a loss of functionality or performance on systems that were previously working. Testing shows an increase of responsiveness by ~75% on one system. PR: kern/98171
* Revert two changes I was testing regarding polling delay.njl2005-12-061-2/+2
|
* Add KTR support and move some performance debugging variables in the ECnjl2005-12-061-9/+8
| | | | to KTR. We're reusing the KTR_DEV level.
* Canonize the include of acpi.h.obrien2005-09-111-1/+1
|
* If there is a problem during probe, be sure to free up any resourcesnjl2005-05-121-2/+2
| | | | | | | | allocated for it. The normal exit case handles this correctly so we use it as well for errors. Submitted by: pjd Obtained from: Coverity Prevent
* Use AcpiUtStrupr() instead of strupr() as the latter will disappear inmarks2005-04-141-1/+1
| | | | | | future versions of acpica. MFC after: 2 weeks
* Add the acpi_ec_read and write methods. This allows an external drivernjl2005-03-201-0/+35
| | | | | | | (like an EC/SMbus controller) to access the EC address space. Access is synchronized by the EcLock/Unlock routines in EcSpaceHandler(). Tested by: Hans Petter Selasky
* Since the GPE handler is directly called by ACPI-CA and it may have unknownnjl2005-02-211-3/+8
| | | | | | | | | | | | | | | | locks held, specify the ACPI_ISR flag to keep it from acquiring any more mutexes (which could potentially sleep.) This should fix "could sleep" warning messages on the following path: msleep() AcpiOsWaitSemaphore() AcpiUtAcquireMutex() AcpiDisableGpe() EcGpeHandler() AcpiEvGpeDispatch() AcpiEvGpeDetect() AcpiEvGpeDetect() AcpiEvSciXruptHandler()
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+2
|
* Remove trailing whitespace.njl2004-12-271-1/+1
|
* MPSAFE lockingnjl2004-08-131-21/+19
| | | | | | * Use the common serialization macros instead of rolling our own. * Increase the coverage of the lock in EcSpaceHandler() to cover the entire loop to avoid dropping the lock when reading more than one byte.
* Remove duplicate FreeBSD id.njl2004-07-021-2/+0
|
* Get rid of the strict aliasing error by retrieving the ECDT via a tablenjl2004-07-021-2/+3
| | | | | | header pointer and then casting it to the ecdt pointer. This fixes the -O2 build. I'm unsure what changed recently to reveal this error since this code has been unchanged for months.
* Rework the code that waits for a response from the EC. Use an sx locknjl2004-07-011-48/+35
| | | | | | | | | | | instead of a mutex so we do not unblock it in msleep(). If we do this, another event could occur, resetting the status register since reads reset it. While I'm here, remove the backoff approach. Instead, sleep in 10 ms chunks for up to the configured timeout using either DELAY (if we aren't booted yet) or tsleep. Help from: dillon Tested by: Andrew Thompson andy AT fud.org.nz
* Disable the EC GPE in the shutdown path. This is correct but is not knownnjl2004-06-301-0/+13
| | | | to fix any bug.
* Use the acpi_id_probe() method instead of acpi_MatchHid(), which is nownjl2004-06-291-1/+3
| | | | static.
* While booting, use DELAY() for waiting for the EC to respond instead ofnjl2004-06-281-6/+13
| | | | | | msleep(). Until we're finally up, msleep is a no-op. Explained by: peter
* Add support to ACPI to manage its own resources. Previously, resourcenjl2004-06-131-1/+1
| | | | | | | | | | | | | | | | | allocation was passed up to nexus. Now, we probe sysresource objects and manage the resources they describe in a local rman pool. This helps devices which attach/detach varying resources (like the _CST object) and module loads/unloads. The allocation/release routines now check to see if the resource is described in a child sysresource object and if so, allocate from the local rman. Sysresource objects add their resources to the pool and reserve them upon boot. This means sysresources need to be probed before other ACPI devices. Changes include: * Add ordering to the child device probe. The current order is: system resource objects, embedded controllers, then everything else. * Make acpi_MatchHid take a handle instead of a device_t arg. * Replace acpi_{get,set}_resource with the generic equivalents.
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* Changes to implement 20040514:njl2004-05-251-20/+31
| | | | | | | | | | | | | | | * Add calls to AcpiSetGpeType. We use wake/run as the type for lid and button switches since wake-only causes Thinkpads to immediately wake on the second suspend. Note that with wake/run, some systems return both wake and device-specific notifies so we don't register for system notifies for lid and button switches. * Remove the hw.acpi.osi_method tunable since it is not needed. * Always print unknown notifies for all types. * Add more cleanup for the EC if it fails to attach. * Use the GPE handle now that we parse it. This allows GPEs to be defined in AML GPE blocks. * Always use ACPI_NOT_ISR since it's ok to acquire a mutex in our thread which processes queued requests.
OpenPOWER on IntegriCloud