summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpi/acpi.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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@
* Release the acpi lock around calls to wsdisplay_suspend() andkettenis2014-09-231-1/+9
| | | | | | | | | | | | | | wsdisplay_resume(). The X server may adjust the display brightness just before/after the VT switch when suspending/resuming. In fact, it may already be blocked adjusting the display brightness for some reason unrelated to the suspend request. The VT switch request will eventually time out, but the delay is annoying and the failed VT switch will lead to problems after resume. Needed for a future update of the xf86-video-intel driver. ok mlarkin@
* Use config_suspend_all(9).kettenis2014-09-191-6/+5
|
* Clear the PME Status bit on PCI devices in response to Device Wake events.kettenis2014-09-081-1/+27
| | | | | | | Fixes the interrupt storm on the 2009 Mac mini with WOL enabled on its nfe(4) interface. ok mlarkin@
* Support hibernating to softraid crypto volumes.mlarkin2014-07-201-2/+2
| | | | much help and ok from deraadt@
* Reenable hibernate RLE support and flush+zero all memory after unpack.mlarkin2014-07-161-2/+8
|
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-8/+8
| | | | after discussions with beck deraadt kettenis.
* Add a function to drop all clean pages on the page daemon queues and callkettenis2014-07-121-2/+4
| | | | | | it when we hibernate. ok mlarkin@, miod@, deraadt@
* It's init as a process that's special, not init's original thread.guenther2014-07-111-2/+2
| | | | | | Remember initprocess instead of initproc. ok matthew@ blambert@
* Flush the buffercache to 16MB on hibernate and restore its previous maxmlarkin2014-07-111-1/+7
| | | | | | size (kern.bufcachepercent) on resume, for better hibernate performance. ok beck@
* remove unneeded headerblambert2014-07-101-2/+1
| | | | ok mlarkin@
* Adding an additonal delay after each access to SystemMemory or SystemIOkettenis2014-07-011-9/+1
| | | | | | during autoconf makes no sense. ok deraadt@
* SystemMemory is used to access memory mapped registers on some machines, so wekettenis2014-06-231-27/+22
| | | | | | | must use the bus_space(9) API to access it instead of memcpy(9). Also make sure we properly align access to fields that need more than byte alignment. ok guenther@
* Fix invalid / missing format specifiers in several dnprintf statementsmlarkin2014-05-211-4/+4
| | | | | | | (used only when ACPI_DEBUG is enabled) From a diff on tech@ by Fabian Raetz, with a minor change by me, tested on i386 and amd64 with ACPI_DEBUG enabled and disabled.
* Defer the free of the hibernate structures until later, when it is safe tomlarkin2014-04-251-1/+9
| | | | | | | | | | do so. Freeing the hibernate structures too early leads to inadvertent calls into splx when we aren't ready for them yet. Found when trapping splx calls in the resume path. discussed with deraadt@ at m2k14
* Fix a badly worded debug message that implied the entire machine was goingmlarkin2014-04-131-2/+2
| | | | to sleep, instead of just the acpi thread going to sleep.
* Change the order of operations during a suspend/resume cycle andmpi2014-03-311-3/+4
| | | | | | | | | | | | | | call bufq_quiesce() after executing the DVACT_QUIESCE handlers. This should be safe since no disk nor controller drivers have such handler but it will allow us to detach sd(4) devices attached to a USB bus. Another benefit pointed out by kettenis@ is that drivers that need to read a firmware from the disk should be able to do it at resume time in a DVACT_WAKEUP handler. ok kettenis@, deraadt@
* get rid of the assumption that the head of the alldevs list is thedlg2014-03-131-5/+6
| | | | | | | | | | | "mainbus" device. this breaks when mpath is enabled because it attaches before mainbus and therefore takes the head position. have autoconf provide device_mainbus() which looks up mainbus_cd, and use that instead. discussed with deraadt who just wants mpath stuff to move forward despite there being many ways to shine this particular turd.
* Do the lid control further on in the resume sequence, since this isderaadt2014-02-211-2/+2
| | | | | | | AML, and will do WAITOK operations. While cold, that is a bad idea. We seem to be safe with respect to the spec, I do not see any event debounce issues here. ok kettenis, tested by many
* Instead of checking sc->sc_revision <= 1 check that theclaudio2014-01-201-2/+2
| | | | | | | | fadt->hdr_revision <= 1. This is a better check since it checks the version of the proper descriptor. This allows the alix APU to reboot since those boards have currently a wrong sc->sc_revision. Committing this now so that it can be tested easier. With and OK jsg@ also fine by derradt@
* If the FADT has its SMI_CMD set to zero, assume we're only ACPI-only hardwarekettenis2013-12-241-8/+22
| | | | | | and don't need to disable SMI ownership of the ACPI hardware registers. ok mlarkin@
* Revert previous commit. It makes resume hang on some MP systems runningkettenis2013-12-231-7/+1
| | | | GENERIC.MP.
* Restore hw.setperf upon resume like we do for apm(4) on i386. Seems we needkettenis2013-12-161-1/+7
| | | | | | to do this fairly late in the resume to avoid hangs. ok deraadt@, mlarkin@
* Add a DVACT_WAKEUP op to the *_activate() API. This is called after thederaadt2013-12-061-1/+4
| | | | | | | | kernel resumes normal (non-cold, able to run processes, etc) operation. Previously we were relying on specific DVACT_RESUME op's in drivers creating callback/threads themselves, but that has become too common, indicating the need for a built-in mechanism. ok dlg kettenis, tested by a sufficient amount of people
* Add support for Power Resources for Dx states and the necessary hookmpi2013-11-061-8/+84
| | | | | | | | | | | | | | | | for PCI devices. This hook should be called twice, before and after changing the power state of a PCI device. Before setting the device to the new state, the ACPI layer will notify every power resources linked to the device for that state and make sure they are turned "_ON". After changing the state of the device, it will decrement the reference of every power resources linked to that device for the old state and turn them "_OFF" if they are no longer referenced. This fixes the no-USB after resume problem seen on various ThinkPad, problem initialy diagnosed with Alexander Polakov. ok kettenis@, deraadt@
* Stop printing ACPI wakeup devices in dmesg after the 16th wakeup device.mlarkin2013-06-011-3/+9
| | | | | | Helps with VMware VMs that report hundreds of wakeup devices. ok reyk@, deraadt@