summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica
Commit message (Collapse)AuthorAgeFilesLines
* Make sure legacy replacement route is turned off when enbling HPET.jkim2008-11-191-2/+5
| | | | Reviewed by: jhb
* Allow device hints to wire the unit numbers of devices.jhb2008-11-181-0/+86
| | | | | | | | | | | | | | | | | | | | - An "at" hint now reserves a device name. - A new BUS_HINT_DEVICE_UNIT method is added to the bus interface. When determining the unit number of a device, this method is invoked to let the bus driver specify the unit of a device given a specific devclass. This is the only way a device can be given a name reserved via an "at" hint. - Implement BUS_HINT_DEVICE_UNIT() for the acpi(4) and isa(4) bus drivers. Both of these busses implement this by comparing the resources for a given hint device with the resources enumerated by ACPI/PnPBIOS and wire a unit if the hint resources are a subset of the "real" resources. - Use bus_hinted_children() for adding hinted devices on isa(4) busses now instead of doing it by hand. - Remove the unit kludging from sio(4) as it is no longer necessary. Prodding from: peter, imp OK'd by: marcel MFC after: 1 month
* Remove " + 1".mav2008-11-031-1/+1
| | | | Thread ID can't be zero anyway while increment may give owerflow.
* Make the no driver stuff an ifdef.imp2008-11-021-4/+9
|
* As soon as we have several threads per process now, it is not correct tomav2008-11-021-5/+1
| | | | | | | | use process ID as ACPI thread ID. Concurrent requests with equal thread IDs broke ACPI mutexes operation causing unpredictable errors including AE_AML_MUTEX_NOT_ACQUIRED that I have seen. Use kernel thread ID instead of process ID for ACPI thread.
* Clean up DSDT and XSDT correctly instead of FADT when the tables are bad.jkim2008-09-191-2/+2
| | | | | | Submitted by: jhb Tested by: olli MFC after: 3 days
* Handle errors from device_get_children.imp2008-08-231-4/+9
|
* Extend the support for PCI-e memory mapped configuration space access:jhb2008-08-221-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | - Rename pciereg_cfgopen() to pcie_cfgregopen() and expose it to the rest of the kernel. It now also accepts parameters via function arguments rather than global variables. - Add a notion of minimum and maximum bus numbers and reject requests for an out of range bus. - Add more range checks on slot/func/reg/bytes parameters to the cfg reg read/write routines. Don't panic on any invalid parameters, just fail the request (writes do nothing, reads return -1). This matches the behavior of the other cfg mechanisms. - Port the memory mapped configuration space access to amd64. On amd64 we simply use the direct map (via pmap_mapdev()) for the memory mapped window. - During acpi_attach() just after loading the ACPI tables, check for a MCFG table. If it exists, call pciereg_cfgopen() on each subtable (memory mapped window). For now we only support windows for domain 0 that start with bus 0. This removes the need for more chipset-specific quirks in the MD code. - Remove the chipset-specific quirks for the Intel 5000P/V/Z chipsets since these machines should all have MCFG tables via ACPI. - Updated pci_cfgregopen() to DTRT if ACPI had invoked pcie_cfgregopen() earlier. MFC after: 2 weeks
* Fix a typo.jhb2008-08-041-1/+1
|
* Further refine the probe order of devices to more closely match the previousjhb2008-07-231-9/+4
| | | | | | | | behavior. Specifically, probe Host-PCI bridges in the order they are encountered in the tree. For CPUs, just use an order of 100000 and assume that no Host-PCI bridges will be more than 10000 levels deep in the namespace. This fixes an issue on some boxes where the HPET timer stopped attaching.
* Initialize tz_active to a new constant TZ_ACTIVE_UNKNOWN and make norpaulo2008-04-251-1/+20
| | | | | | | | assumptions about the state of the cooling devices. Instead, switch them off on init and, only after that, we are in TZ_ACTIVE_NONE. Submited by: Andriy Gapon <avg at icyb.net.ua> Reviewed by: njl
* Update the list of Cx states when ACPICA notifies us. Usually, thisrpaulo2008-04-121-4/+24
| | | | | | | | notification is sent when the AC plug is plugged in/out. This is required on some laptops, namely the MacBooks. Silence on: freebsd-acpi
* Revert back to probing Host-PCI bridges in the order we encounter them injhb2008-04-071-18/+11
| | | | | | the tree rather than sorting them by their address on PCI bus 0. Reported by: kan
* GPE lock may recurse on resume path.takawata2008-04-051-1/+1
|
* Rework how the nexus(4) device works on x86 to better handle the idea ofjhb2008-03-132-45/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | different "platforms" on x86 machines. The existing code already handles having two platforms: ACPI and legacy. However, the existing approach was rather hardcoded and difficult to extend. These changes take the approach that each x86 hardware platform should provide its own nexus(4) driver (it can inherit most of its behavior from the default legacy nexus(4) driver) which is responsible for probing for the platform and performing appropriate platform-specific setup during attach (such as adding a platform-specific bus device). This does mean changing the x86 platform busses to no longer use an identify routine for probing, but to move that logic into their matching nexus(4) driver instead. - Make the default nexus(4) driver in nexus.c on i386 and amd64 handle the legacy platform. It's probe routine now returns BUS_PROBE_GENERIC so it can be overriden. - Expose a nexus_init_resources() routine which initializes the various resource managers so that subclassed nexus(4) drivers can invoke it from their attach routine. - The legacy nexus(4) driver explicitly adds a legacy0 device in its attach routine. - The ACPI driver no longer contains an new-bus identify method. Instead it exposes a public function (acpi_identify()) which is a probe routine that the MD nexus(4) drivers can use to probe for ACPI. All of the probe logic in acpi_probe() is now moved into acpi_identify() and acpi_probe() is just a stub. - On i386 and amd64, an ACPI-specific nexus(4) driver checks for ACPI via acpi_identify() and claims the nexus0 device if the probe succeeds. It then explicitly adds an acpi0 device in its attach routine. - The legacy(4) driver no longer knows anything about the acpi0 device. - On ia64 if acpi_identify() fails you basically end up with no devices. This matches the previous behavior where the old acpi_identify() would fail to add an acpi0 device again leaving you with no devices. Discussed with: imp Silence on: arch@
* Probe CPUs after the PCI hierarchy on i386, amd64, and ia64. This allowsjhb2008-03-101-6/+22
| | | | | | | | | | | | | | | | | the cpufreq drivers to reliably use properties of PCI devices for quirks, etc. - For the legacy drivers, add CPU devices via an identify routine in the CPU driver itself rather than in the legacy driver's attach routine. - Add CPU devices after Host-PCI bridges in the acpi bus driver. - Change the ichss(4) driver to use pci_find_bsf() to locate the ICH and check its device ID rather than having a bogus PCI attachment that only checked for the ID in probe and always failed. As a side effect, you can now kldload ichss after boot. - Fix the ichss(4) driver to use the correct device_t for the ICH (and not for ichss0) when doing PCI config space operations to enable SpeedStep. MFC after: 2 weeks Reviewed by: njl, Andriy Gapon avg of icyb.net.ua
* Some PIIX4 chipsets need to be told to generate Stop Breaks by settingrpaulo2008-03-091-0/+20
| | | | | | | | | the appropriate bit in the DEVACTB register. This change allows the C2 state on those systems to work as expected. Reviewed by: njl Submitted by: Andriy Gapon <avg at icyb.net.ua> MFC after: 1 week
* Create a thread to handle passive cooling for 1st zone which has _PSV,ume2008-02-161-19/+20
| | | | | | | | _TSP, _TC1 and _TC2. Contirmed by: "Alexandre \"Sunny\" Kovalenko" <alex.kovalenko_at_verizon.net> Reviewed by: njl MFC after: 1 week
* Allow the user to override the current active cooling state if staterpaulo2008-02-161-1/+2
| | | | | | | | | | is currently TZ_ACTIVE_NONE. Submitted by: Andriy Gapon <avg at icyb.net.ua> Reviewed by: njl (mentor) Approved by: njl (mentor) Requested by: njl (mentor) MFC after: 3 days
* Skip validation of the C3 state if we disabled C3 by software (i.e.,rpaulo2008-02-161-1/+1
| | | | | | | | | | via quirk). Submitted by: Andriy Gapon <avg at icyb.net.ua> Reviewed by: njl (mentor) Approved by: njl (mentor) Requested by: njl (mentor) MFC after: 3 days
* Fix a typo when testing for the NO_C3 quirk.jhb2008-02-121-1/+1
| | | | MFC after: 3 days
* Return errno value rather than boolean in this context.iwasaki2008-01-281-2/+6
| | | | MFC after: 1 week
* Enter the sleep state immediately without waiting for timeout ifiwasaki2008-01-271-0/+6
| | | | | | devd(8) is not running such as the system in single user mode. MFC after: 1 week
* Add a header containing constants for the various HPET registers and theirjhb2008-01-162-23/+84
| | | | | | | | fields and update the code to match. The PR served more as an inspiration than providing the actual diffs. MFC after: 1 week PR: kern/112544
* Fix a few minor issues based on a bug report and reading over the HPETjhb2008-01-151-3/+45
| | | | | | | | | | | | spec: - Use read/modify/write cycles to enable and disable the HPET instead of writing 0 to reserved bits. - Shutdown the HPET during suspend as encouraged by the spec. - Fail to attach to an HPET with a period of zero. MFC after: 1 week PR: kern/119675 [3] Reported by: Leo Bicknell | bicknell ufp.org
* Fix GPE livelock that occurs on HP/Compaq laptops, mostly in the thermalnjl2008-01-121-3/+7
| | | | | | | | | | | | | | | | | | zone code. The GPE handler method (i.e. _L00) generates various Notify events that need to be run to completion before the GPE is re-enabled. In ACPI-CA, we queue an asynch callback at the same priority as a Notify so that it will only run after all Notify handlers have completed. The callback re-enables the GPE afterwards. We also changed the priority of Notifies to be the same as GPEs, given the possibility that another GPE could arrive before the Notifies have completed and we don't want it to get queued ahead of the rest. The ACPI-CA change was submitted by Alexey Starikovskiy (SUSE) and will appear in a later release. Special thanks to him for helping track this bug down. MFC after: 1 week Tested by: jhb, Yousif Hassan <yousif / alumni.jmu.edu>
* Use devclass_get_count() instead of devclass_get_maxunit() to get thejhb2007-12-311-1/+1
| | | | | | | | | correct number of acpi_thermalX devices. Having this wrong caused the acpi_thermal thread to realloc the array of devices on each loop iteration. MFC after: 1 week PR: kern/118497 Submitted by: Pasi Parviainen
* Add a new 'why' argument to kdb_enter(), and a set of constants to userwatson2007-12-251-2/+2
| | | | | | | | | for that argument. This will allow DDB to detect the broad category of reason why the debugger has been entered, which it can use for the purposes of deciding which DDB script to run. Assign approximate why values to all current consumers of the kdb_enter() interface.
* Add sysctl mibs for _TSP, _TC1 and _TC2 which is user overridableume2007-12-241-0/+40
| | | | | | | | but is blocked on user_override mib. Not a few people want to use a passive cooling without their ACPI BIOS support. Reviewed by: njl
* Check battery presence first before trying to get battery information.jkim2007-11-201-3/+4
| | | | | PR: kern/117591 Tested by: Jessica Mahoney (root at varusonline dot com)
* Whitespace only.njl2007-11-081-2/+0
|
* Fix a shutdown hang on some SMP systems. The previous logic was to IPI allnjl2007-11-021-4/+6
| | | | | | | | | | CPUs to make sure idle threads are evicted from the softc before returning from acpi_cpu_shutdown(). However, this is unnecessary since stop_cpus() handles this for itself and at this point it's possible that our IPI will be blocked (interrupts disabled). Thanks to: Glen Leeder <glen.leeder / nokia.com> MFC after: 3 days
* Don't return an error from resume() if execution of _DIS fails for somejhb2007-10-271-3/+4
| | | | | | | reason (not all BIOSen have _DIS methods for all link devices for example). This matches the behavior of attach() with respect to _DIS as well. Submitted by: njl
* Don't destroy an ACPI device_t for a PCI device and reassign the ACPIjhb2007-10-271-2/+13
| | | | | | | | | | handle to the PCI device_t if the ACPI device_t is already attached to a driver. This happens on the Tablet TC1000 which for some reason includes two PCI-ISA bridges and treats the second bridge as an ACPI system resource device. Reviewed by: njl (a while ago) MFC after: 3 days
* Don't always re-route IRQs on resume. If this link hasn't been used, thenjhb2007-10-271-1/+16
| | | | | | disable it with _DIS rather than assigning it an IRQ on resume. MFC after: 1 week
* 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
|
* Rename the kthread_xxx (e.g. kthread_create()) callsjulian2007-10-201-3/+3
| | | | | | | | | | | to kproc_xxx as they actually make whole processes. Thos makes way for us to add REAL kthread_create() and friends that actually make theads. it turns out that most of these calls actually end up being moved back to the thread version when it's added. but we need to make this cosmetic change first. I'd LOVE to do this rename in 7.0 so that we can eventually MFC the new kthread_xxx() calls.
* When the EC times out (common with Compaqs), it may report a designnjl2007-10-091-2/+4
| | | | | | | | | | voltage of 0. This can result in a divide by zero trap. Add a guard for this case. The value of lfcap is checked in acpi_battery_bif_valid() just before this, so it is safe. Reportd by: sam Approved by: re MFC after: 3 days
* Fix the HPET table probe routine to run from device_identify() insteadnjl2007-10-093-11/+20
| | | | | | | | | | | | of directly from acpi0. Before it would attach prior to the sysresource devices, causing the later allocation of its memory range to fail and print a warning like "acpi0: reservation of fed00000, 1000 (3) failed". Use an explicit define for our probe order base value of 10. Help from: jhb Tested by: Abdullah Ibn Hamad Al-Marri <almarrie / gmail.com> MFC after: 3 days Approved by: re
* Make the PCI code aware of PCI domains (aka PCI segments) so we canmarius2007-09-302-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | support machines having multiple independently numbered PCI domains and don't support reenumeration without ambiguity amongst the devices as seen by the OS and represented by PCI location strings. This includes introducing a function pci_find_dbsf(9) which works like pci_find_bsf(9) but additionally takes a domain number argument and limiting pci_find_bsf(9) to only search devices in domain 0 (the only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order to no longer report false positives when searching for siblings and dupe devices in the same domain respectively. Along with this change the sole host-PCI bridge driver converted to actually make use of PCI domain support is uninorth(4), the others continue to use domain 0 only for now and need to be converted as appropriate later on. Note that this means that the format of the location strings as used by pciconf(8) has been changed and that consumers of <sys/pciio.h> potentially need to be recompiled. Suggested by: jhb Reviewed by: grehan, jhb, marcel Approved by: re (kensmith), jhb (PCI maintainer hat)
* 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
* Reject requests to start or ack a suspend sequence on platforms that do notnjl2007-09-131-0/+10
| | | | | | | support suspend/resume, currently all except i386. Tested by: jkim Approved by: re
* Evaluate _OSC on boot to indicate our OS capabilities to ACPI. This isnjl2007-08-301-7/+32
| | | | | | | | | needed at least to convince the BIOS to give us access to CPU freq control on MacBooks. Submitted by: Rui Paulo <rpaulo / fnop.net> Approved by: re MFC after: 5 days
* Dynamically choose the quality of the ACPI timer depending on whethernjl2007-07-302-2/+4
| | | | | | | | | | | the fast or safe/slow method is in use. Fast remains at 1000, slow is now at 850 (always preferred to TSC). Since the HPET has proven slower than ACPI-fast on some systems, drop its quality to 900. In the future, it is hoped that HPET performance will improve as it is the main timer Intel supports. HPET may move back to 2000 in -current once RELENG_7 is branched to ensure that it gets tested. Approved by: re
* The HPET appears to be broken on silby's Acer Pentium M system, nevernjl2007-07-221-4/+18
| | | | | | | | | | advancing. Read from the timer before attaching to be sure it advances in 1 us. Since the slowest rate allowed by the spec is 10 MHz, the timer is guaranteed to change in this interval if it is working. Tested by: Rui Paulo Approved by: re MFC after: 3 days
* My previous commit introduced a spurious warning for the case where anjl2007-06-301-0/+4
| | | | | | | | switch (i.e. lid) is set to have an action of NONE. This is not an invalid state, so silently return. This fixes the warning: "acpi: request to enter state S6 failed (err 22)" Approved by: re
* Update the suspend/resume user API while maintaining backwards compat.njl2007-06-213-13/+211
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improvements: * /etc/rc.suspend,rc.resume are always run, no matter the source of the suspend request (user or kernel, apm or acpi) * suspend now requires positive user acknowledgement. If a user program wants to cancel the suspend, they can. If one of the user programs hangs or doesn't respond within 10 seconds, the system suspends anyway. * /dev/apm is clonable, allowing multiple listeners for suspend events. In the future, xorg-server can use this to be informed about suspend even if there are other listeners (i.e. apmd). Changes: * Two new ACPI ioctls: REQSLPSTATE and ACKSLPSTATE. Request begins the process of suspending by notifying all listeners. acpi is monitored by devd(8) and /dev/apm listener(s) are also counted. Users register their approval or disapproval via Ack. If anyone disapproves, suspend is vetoed. * Old user programs or kernel modules that used SETSLPSTATE continue to work. A message is printed once that this interface is deprecated. * acpiconf gains the -k flag to ack the suspend request. This flag is undocumented on purpose since it's only used by /etc/rc.suspend. It is not intended to be a permanent change and will be removed once a better power API is implemented. * S5 (power off) is no longer supported via acpiconf -s 5 or apm -z/-Z. This restores previous behavior of halt/shutdown -p being the interface. * Miscellaneous improvements to error reporting Approved by: re
* Convert magic to a uintptr_t. This should get rid of some warnings onnjl2007-06-154-8/+8
| | | | gcc4.
OpenPOWER on IntegriCloud