summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpi/acpi.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert aml_rdpciaddr changes; breaks several machines that were workingkettenis2017-01-141-9/+13
| | | | before.
* Increase the size of the buffers used for _HID and _CID strings to bejsg2017-01-111-4/+4
| | | | | | able to fit "Hyper_V_Gen_Counter_V1". ok mlarkin@ deraadt@
* Make aml_rdpciaddr() work for for devices behind bridges. The code nowkettenis2017-01-081-13/+9
| | | | | | | | | | uses the mapping between AML nodes and PCI devices that we establish. Because _INIT methods may end up calling aml_rdpciaddr(), make sure we create that mapping early. Also handle devices that aren't actually present. These devices are now included in the mapping and reads will return an all-ones patterm whereas writes are a no-op.. ok mlarkin@
* Add the resource index to aml_parse_resource() callback function.pirofti2016-10-251-3/+3
| | | | | | | This is needed by an upcoming acpiec commit that handles machines breaking the current ACPI specifications. Change suggested by and ok kettenis@, guenther@
* If the APIC table (MADT) isn't present then ci_acpi_proc_id won't be setguenther2016-09-181-5/+1
| | | | | | | | | | | | when acpicpu tries to attach, leading to a NULL dereference. The ACPI processor object on the Dells where this was reported is bogus and useless anyway so apply the same test when deciding whether to attach to processor objects as acpicpu would when matching them to cpus. Problem reported by Eivind Eide (xenofil (at) gmail.com) and Johan Huldtgren (johan+openbsd-bugs (at) huldtgren.com). Testing by Eivind Eide. ok kettenis@ mlarkin@
* Write the system time back to the RTC every 30 minutes.naddy2016-09-031-1/+5
| | | | | | | This fixes the problem that long-running machines which were not shut down properly would reboot with a badly offset system time. hints and ok kettenis@
* Don't put a device in the wake device list if _STA says it's not there.mlarkin2016-08-311-1/+8
| | | | | | Fixes at least one machine that woke up from sleep / poweroff immediately. ok kettenis@, tested by kettenis and martijn@
* Store the acpi processor ID/UID in struct cpu_info, and use it to attachkettenis2016-07-281-3/+8
| | | | | | acpicpu(4) drivers to the right cpu(4). ok mlarkin@, guenther@
* The power management timer has been made optional in ACPI 5.0A, so don'tkettenis2016-06-101-2/+3
| | | | | | | | attempt to attach acpitimer(4) if the timer isn't present. Pointed out by jcs@ ok jcs@
* Make sure devices listed by a device's _DEP method are attached beforekettenis2016-05-081-2/+34
| | | | | | | | | | | we attach the device itself. The _DEP methode, introduced in ACPI 5.0, is a hint that the device in question depends on OpRegion support from the devices listed by _DEP, so we have to order them the proper way. To prevent us from attaching those devices again when we encounter them later walking down the device tree, keep track of our attempts to attach a device driver to them using aflag in the aml_node structure. ok guenther@
* We attach acpihpet(4) and acpiec(4) without using the HID, so do notpirofti2016-04-251-1/+3
| | | | | | report it in the dmesg. OK deraadt@, mlarkin@.
* Reduce dmesg spam by knocking out some acpi hardware IDs that don't need akettenis2016-04-021-2/+22
| | | | | | driver. ok mpi@
* Check if a device is present (using _STA) in acpi_foundhid. This preventskettenis2016-03-291-1/+8
| | | | | | | us from reporting devices as "not configured" that aren't actually present, and allows us to remove duplicated code from several drivers. ok deraadt@, ok jsg@
* Implement a cleaner way to prevent acpivout(4) from attaching if we havekettenis2016-03-291-21/+3
| | | | | | a platform-specific method of controlling the backlight. ok millert@, mlarkin@, jung@
* Adding each and every new acpi device driver to acpi_foundhid() iskettenis2016-03-281-25/+5
| | | | | | | | | | | | | | gettinga bit of the burden. And it really isn't how our autoconf framework is supposed to work for busses that can be enumerated. All the drivers already check for a matching _HID in their attach function. So we can just drop the checks in acpi_foundhid() and let the drivers sort themselves out. Print a "not configured" line for devices for which we don't attach adriver. This may be a bit much as there are devices for which we will not have a driver. This will be removed if it causes too much dmesg spam. ok deraadt@, mlarkin@
* Take acpi_foundhid() outside of #ifndef SMALL_KERNEL so the ramdiskjsg2016-01-171-9/+11
| | | | kernel can find and attach dwiic(4) and sdhc(4).
* remove an unused global variablejsg2016-01-171-2/+1
|
* Attach dwiic(4) on the Intel Bay Trail i2c controllers as well.kettenis2016-01-141-2/+3
|
* Improve emulation of PM registers on Hardware-redcued ACPI by emulatingkettenis2016-01-121-6/+56
| | | | | | | | SPL_TYPx, SLP_EN and WAK_STS using the new SLEEP_STATUS_REG and SLEEP_CONTROL_REG registers. Makes the transition into S5 (powerdown) work on the ASUS X205TA. ok deraadt@, mlarkin@
* Add dwiic, a driver for the Synopsys DesignWare i2c controller foundjcs2016-01-121-23/+45
| | | | | | | | | | | | | on the Samsung ATIV Book 9 laptop. This initial version only supports ACPI config/attachment. Add ihidev, a HID-over-i2c driver largely based on uhidev. dwiic handles attaching ihidev devices found in ACPI. Add ims, a HID-over-i2c mouse/trackpad driver to get basic cursor and button functionality from HID-compliant i2c trackpads. ok kettenis deraadt
* Make sdhc(4) attach to hardware IDs "80860F14" and "PNP0FFF".kettenis2016-01-111-2/+3
|
* Initial support for Hardware-Reduced ACPI. This skips the legacy mode checkskettenis2016-01-091-2/+21
| | | | | | | by emulating the PM_CNT register such that SCI_EN is always enabled. It also skip attaching acpitimer(4) since the relevant registers are no longer there. ok deraadt@, mlarkin@
* Follow the spec and check the SCI_EN bit to see if ACPI has alreadykettenis2016-01-061-7/+23
| | | | | | | | been enabled and don't bother enabling it again if it is. This should fix systems that don't implement legacy mode and therefore set ACPI_ENABLE and ACPI_DISABLE to zero. ok mlarkin@, yasuoka@
* Back out the CRITICAL change, turn it back from 10% to 25%. Somereyk2015-11-231-2/+2
| | | | | people with old/broken batteries didn't like this change, and the underlying heuristics are wrong.
* The "CRITICAL" APM battery level, that is exported/faked by the ACPIreyk2015-11-221-2/+2
| | | | | | | | | stack, is currently set to 25%. With 25% battery left, a typical modern laptop will have at least one hour runtime left. It is an arbitrary value, and other APM power layers in the kernel set CRITICAL to something like 5% or 10%, so set it to 10% for now. OK mlarkin@
* In low-level suspend routines, set cold=2. In tsleep(), use this toderaadt2015-09-281-2/+2
| | | | | | | | spit out a ddb trace to console. This should allow us to find suspend or resume routines which break the rules. It depends on the console output function being non-sleeping.... but that's another codepath which should try to be safe when cold is set. ok kettenis
* clarify malloc arguments (base + length...)deraadt2015-09-061-2/+2
|
* fairly simple sizes for free(); ok teduderaadt2015-08-281-6/+6
|
* Respect the access size when reading or writing to pci config space.kettenis2015-08-201-12/+83
| | | | | | | | | | This version also makes sure writes are properly aligned, preventing the panics seen with the previous incarnation of this change. Fixes battery status passthrough in vmware, brightness keys on my x220 and who knows what else. ok mlarkin@, deraadt@
* If we are setting ACPI_PM1_BM_RLD do it only once, and remember toderaadt2015-08-041-2/+5
| | | | | repeat this action at resume time. ok mlarkin guenther
* Something subtle in previous revision is locking up suspend or bootingderaadt2015-07-291-83/+11
| | | | | on some laptops. Mailing lists threads mention x220 and Asus machines. Reverting for now.
* iRespect the access size when reading or writing to pci config space.kettenis2015-07-211-11/+83
| | | | | | | | Fixes battery status passthrough in vmware and who knows what else. Tested by many. ok mlarkin@, deraadt@
* fix commentsmlarkin2015-07-171-3/+3
|
* Use the 0x10 extended capability to determine if the trackstickjsg2015-03-261-3/+1
| | | | | | | | | | | | | buttons are wired to the trackpad and need to be re-routed to the trackstick. Without this change the buttons on 2015 thinkpads get picked up as extended buttons that show up as scroll up/down. Remove the X1 Carbon 2015 (LEN0048) and X250 (LEN0046) from the top button area/soft buttons quirks list. Also avoid using the quirk list entirely if the capability bit is set. Based on work from jcs@ with feedback from mpi@ ok mpi@ jcs@
* The ACPI standard says that a PCI function number of FFFF can be used to referkettenis2015-03-201-1/+16
| | | | | | | | | | | | | to all functions on a device. This makes no sense in the context of accessing PCI config space. Nevertheless stsp@ has a machine with AML that tries to do config space reads from a device where _ADR encodes function number FFFF. This is almost certainly buggy AML, but since Linux (and presumably Windows) boot just fine on this machine we need to work around this. Linux effectively treats function FFFF as function 7, which isn't present on this machine. Instead we simulate a read from a non-existent device by returning a bit pattern of all ones. Writes to function FFFF will still panic. ok mlarkin@
* Reduce use of SMALL_KERNEL in acpi, bringing acpiec driver and more gpederaadt2015-03-161-147/+158
| | | | | | | handling into RAMDISK. This is now possible because the install media has ample room. The goal is to reduce special cases where we may be skipping (unknown) important operations... ok mlarkin kettenis
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* New framework that allows hibernate to pass in entropy from it's freshderaadt2015-02-071-2/+5
| | | | | boot. ok mlarkin
* Fix a hibernate crash on some machines due to unmapping a page thatmlarkin2015-02-061-2/+5
| | | | | | | | may not have been mapped previously (in the failure to hibernate case). Also ensure that the lowmem ptp is mapped in all cases (not just MP). ok kettenis
* resume_randomness() before spinning up other cpus...deraadt2015-01-171-2/+3
|
* Define a new wscons mouse type for Synaptics clickpad devices that lackjsg2015-01-151-2/+82
| | | | | | | | | | physical buttons. This will be used if the acpi pnpid for the mouse matches a list provided by Synaptics found in Linux. Combined with the xenocara changes this will remove the need for an xorg config file for the x240/t440/t540 generation of thinkpads. ok matthieu@ shadchin@ kettenis@
* Tolerate checksum errors in ACPI tables (but complain about them). Apparentlykettenis2015-01-111-5/+5
| | | | | | | | there are machines out there with broken BIOSen with such checksum errors in thier RSDT tables. Windows runs fine on these machines, so it probably does not check. Linux ignores checksum errors as well (and prints a warning). ok deraadt@, krw@
* suspend and resume the RNG (at what looks like the right spots)deraadt2014-12-181-1/+5
| | | | ok reyk djm
* Replace some malloc(n*size,...) calls with mallocarray().doug2014-12-091-2/+2
| | | | ok tedu@ deraadt@
* If "machdep.lidsuspend" is not set, do not go back to sleep if the lidmpi2014-12-061-2/+3
| | | | | | | is still closed when resuming. This allows docked laptop to be resumed without opening them. ok mlarkin@
* If a machine has no _LIDs, then none can be open. This diff fixes a problemmlarkin2014-11-231-5/+3
| | | | | | | | where machines without any _LIDs were going back to sleep after hibernate due to the recent suspend-if-lid-closed-on-resume diff. Noticed on qemu, which doesn't have any _LIDs. discussed with deraadt
* Nuke yet more obvious #include duplications.krw2014-11-181-2/+1
| | | | ok miod@
* If resuming from sleep (zzz/ZZZ) and the lid is still closed, go back tomlarkin2014-11-081-1/+7
| | | | | | | sleep. This prevents accidental lid flex or slight opening in a backpack from waking the machine up and leaving it resumed (powered on). ok deraadt@
* Rework piglet and pig allocation. Currently the piglet gets allocatedkettenis2014-09-261-11/+14
| | | | | | | | | | | | | | deep down in the suspend path, where it is really hard to recover from allocation failure. So allocate the piglet early on in the suspend path. Also change the piglet and piglet allocation functions to use km_alloc(9) instead of doing pmemrange magic. This removes a bunch of code which, in the case of the piglet allocation, is broken since it results in a NULL pointer dereference. Also switch the piglet allocation to not wait. If we can't allocate 16MB of phys contig memory on a halfway modern machine we're almost certainly under a lot of memory pressure and we're better off not trying to hibernate anyway. ok mlarkin@
* Bring back rev 1.249. Now that mp_setperf() has been fixed, it should bekettenis2014-09-251-1/+7
| | | | | | | | safe to restore perflevel when resuming. Should fix the issues people see with the processor running at full speed heating up the machine while the apm command reports that the CPUs are running at a low speed. ok dcoppa@, deraadt@