summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
AgeCommit message (Collapse)Author
2020-06-20Shifts (<<) of more than 32 bits must be done on 64-bit values.Kenneth R Westerback
COVERITY 1491295 ok kettenis@
2020-06-17needs param.h, not types.hTheo de Raadt
2020-06-10Give userland a consistent battery and A/C state after resumeJeremie Courreges-Anglas
Previously we refreshed the state of acpiac(4) and acpibat(4)/acpisbs(4) by queueing fake ACPI events to be processed by the acpi thread. acpibat(4) using ACPIDEV_POLL meant that its status could be refreshed first, resulting in an APM_POWER_CHANGE event sent to userland before the state of acpiac(4) was up to date. Because of this, apmd(8) could see A/C unplugged when it was in fact plugged, possibly leading to a wrong decision. Instead of using fake ACPI events, refresh the status of acpiac(4) and acpibat(4)/acpisbs(4) right away at DVACT_WAKEUP time. To reuse the existing refresh code of those drivers, make their ACPI *_notify() handlers responsible for sending APM_POWER_CHANGE events instead. Also queue an APM_POWER_CHANGE event right after resume to retain existing behavior. This fixes the consistency of data shown to userland, and makes those drivers less special. Initially discussed last year (!) with mpi@ at Miod's place. Feedback and ok jcs@, deraadt@ agrees with the use of DVACT_WAKEUP here.
2020-06-02disable debugging by default and only print unknown events whenJoshua Stein
debug is enabled
2020-06-02add acpihid(4) for ACPI HID event and 5-button array devicesJoshua Stein
ok kettenis
2020-05-29dev/rndvar.h no longer has statistical interfaces (removed during variousTheo de Raadt
conversion steps). it only contains kernel prototypes for 4 interfaces, all of which legitimately belong in sys/systm.h, which are already included by all enqueue_randomness() users.
2020-05-27limit clflush before monitor errata workaround to IntelJonathan Gray
no functional change as clflush is currently only done on Intel
2020-05-22Use the parsed address and interrupt information fromMark Kettenis
struct acpi_attach_args. tpm(4) tested by kn@ ok jmatthew@
2020-05-19Don't provide backlight control if the list returned by _BCL is empty.Mark Kettenis
Prevents crashes on broken AML. ok jcs@
2020-05-14Bring back the acpi(4) changes. This time around only use the ACPI _CRSMark Kettenis
information on ACPI 5.0 and later. ok krw@, patrick@
2020-05-11More accurate remaining power reporting with disparate batteriesJeremie Courreges-Anglas
Overall remaining power was computed as the average of the remaining power of each battery, in percents. This doesn't work with batteries of different capacity, so use the total capacity and remaining power instead. Reported by lidstah, successful tests by lidstah and benno@, ok kettenis@
2020-05-09aml_die() doesn't return, hint the compilerJeremie Courreges-Anglas
Avoids an uninitialized variable warning. ok kettenis@
2020-05-09No need to look at _STA here, all we care about is _PSR.Jeremie Courreges-Anglas
Rename surrounding code to reflect that. ok kettenis@
2020-05-08Move parsing of _CRS into acpi(4) and pass the parsed address and interruptMark Kettenis
information in struct acpi_attach_args. ok mpi@
2020-04-19Move logic to change brightness level in reasonable steps from acpivout(4)Mark Kettenis
into wsdisplay(4). This code is now exposed through wsdisplay_brightness_{step,zero,cycle} functions that can be called by any driver that handles brightnes "hotkeys". These functions take a wsdisplay(4) device pointer as their first argument, which should be provided if a clear association between events and a particular display exist. This is used in wskbd(4). Otherwise NULL can be passed and the code will direct the request at the first wsdisplay(4) that implements brightness adjustment. Tested by many. Fixes brightness keys on x395 and other thinkpads with AMD graphics. ok patrick@
2020-04-18Remove useless return statement.Mark Kettenis
2020-04-14Add bse(4), a driver for the Broadcom GENET v5 network interface found onMark Kettenis
the Raspberry Pi4. ok patrick@
2020-04-14Implement acpi_getprop(), the ACPI equivalent of OF_getprop().Mark Kettenis
ok patrick@
2020-04-12Add support for the _CCA method. This method indicates whether DMA isMark Kettenis
cache-coherent or not. To implement this, acpi(4) gets two bus_dma tags and passes the appropriate one when attaching devices based on _CCA. On i386/amd64, where for all practical purpose DMA is always cache-coherent, the two tags are the same. But on arm64 they are distinct. ok patrick@
2020-04-11Use acpi_getsta(); avoids printing "no _STA method" messages and assumesMark Kettenis
the device is present instead. ok deraadt@
2020-04-10The Raspberry Pi4 (suing UEFI firmware in ACPI mode) uses QWord()Mark Kettenis
resource descriptors. Add support for this. ok deraadt@
2020-04-07Abstract the head of knote lists. This allows extending the lists,Visa Hankala
for example, with locking assertions. OK mpi@, anton@
2020-04-06acpi(4): acpi_sleep(): tsleep(9) -> tsleep_nsec(9)cheloha
kettenis@ notes that ACPI integers are supposed to be unsigned, but ours are signed. This is a much deeper problem than what I'm looking to change with this conversion. To work around the issue for now we can round the sleep interval up to 1 millisecond. There is a very nasty-looking rwsleep(9) call elsewhere in dev/acpi/dsdt.c that I'm going to leave as-is for now to avoid breaking something. With input from pirofti@, kettenis@, and mortimer@. Tested by Lucas Raab, Moises Simon, mortimer@, and gkoehler@. ok kettenis@
2020-04-06Update my email address.Paul Irofti
2020-04-03Fix incoherencies of errors returned by various *kqfilter routines.Martin Pieuchot
EOPNOTSUPP is returned when there's no "filterops" for a given fd. EINVAL when the requested filter isn't supported by the "filterops". ENXIO means the underlying device is no longer valid/present. ok visa@
2020-03-29Add glue to make ipmi(4) attach to FDT.Mark Kettenis
ok deraadt@
2020-03-23Fix brightness control on machines where initial brigness unknown.Alexandre Ratchov
On certain machines (like the ASUS 1001PXD) _BQC returns an out of range value. Make acpivout_get_brightness() always return a valid value in order to not break brightness controls, like the display.brightness control in wsconsctl(8). ok patrick
2020-03-16fix a bunch of weird indentations and extra whitespace; no binary changeJasper Lievisse Adriaanse
2020-02-20Replace field f_isfd with field f_flags in struct filterops to allowVisa Hankala
adding more filter properties without cluttering the struct. OK mpi@, anton@
2020-02-18Cleanup <sys/kthread.h> and <sys/proc.h> includes.Martin Pieuchot
Do not include <sys/kthread.h> where it is not needed and stop including <sys/proc.h> in it. ok visa@, anton@
2020-02-08On the Lenovo X395 acpivout(4) does not attach since there isPatrick Wildt
no _BQC method. But we need it to attach, since it provides the events for the brightness keys. Thus, make acpivout(4) attach enough to register the event handler, but return early so that it doesn't register itself as ws_[gs]et_param. ok kettenis@
2020-01-28Make acpivout(4) call ws_[gs]et_param instead of directlyPatrick Wildt
calling the ACPI methods. On some machines, like my X395, those ACPI methods don't allow changing the brightness, so this allows acpivout(4) to e.g. use amdgpu(4)'s code. In comparison to the previously committed and backed out version we now schedule the brightness change on the ACPI task queue so that we don't run into any recursive locking issues. Additionally the diff has been modified according to the recent commit where we make sure that a 5% brightness change does not result in the same brightness level. ok jcs@ kn@
2020-01-27Send APM_POWER_CHANGE events to userland after refreshing battery infoJeremie Courreges-Anglas
Tested by and ok jcs@
2020-01-26In amdgpio_pin_intr() disable pins a pending interrupt is seen for whichJonathan Gray
have no interrupt handler registered. Avoids interrupt storm on Matebook D reported by brynet@ From James Hastings. ok kettenis@ brynet@
2020-01-14Fix screen brightness adjustment through function keyskn
Not all machines provide levels that scale linearly, e.g. an ThinkPad X230 has 16 levels of exponential scale that end with [50, 67, 100]. Make acpivout_find_brightness() return the BCL's index instead of its value such that acpivout_brightness_step() is able to fall back to the lower next value by index in case the 5% heuristic fails. Tested by Tracey Emery with an T470s OK patrick jcs
2020-01-09Convert sleeps of 1sec or more to tsleep_nsec(9).Martin Pieuchot
ok bluhm@
2020-01-06Allow ipmi(4) to attach using mmio. Use the IPMI revision provided by theMark Kettenis
_SRV method if present. tested by sthen@ ok jmatthew@
2019-12-31Use C99 designated initializers with struct filterops. In addition,Visa Hankala
make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
2019-12-31Convert infinite sleeps to {m,t}sleep_nsec(9).Martin Pieuchot
ok kn@
2019-12-31include sys/sensors.h for sensor useJonathan Gray
don't depend on indirect inclusion from acpidev.h
2019-12-23Add amdgpio(4), a driver for the GPIO controller found on newer AMDMark Kettenis
AMD SoCs/chipsets. From James Hastings
2019-12-14Revert previous. When we get an ACPI notification we already have thePatrick Wildt
ACPI lock and when we call our own ws_[gs]et_param functions we cannot take the lock again, because it's non-recursive. Thus we need to find another way, like not taking the lock if we already have it. But the solutions need to be discussed first, so back it out in the meantime.
2019-12-13Make acpivout(4) call ws_[gs]et_param instead of directlyPatrick Wildt
calling the ACPI methods. On some machines, like my X395, those ACPI methods don't allow changing the brightness, so this allows acpivout(4) to e.g. use amdgpu(4)'s code. ok kettenis@
2019-10-21On newer ThinkPads reporting HKEY version > 1, don't claim wsconsJoshua Stein
backlight controls so that acpivout can. This allows using all of the fine-grained backlight BCL steps defined in ACPI (usually 100) instead of the dozen or so available through acpithinkpad's proprietary ACPI or CMOS interfaces. This is also needed for future amdgpu work.
2019-10-21When incrementing or decrementing screen brightness, don't justJoshua Stein
adjust by 1 BCL level as there may be 100 levels. Find the next brightness level that is at least 5% up or down and use that. ok kettenis
2019-10-16Add a few newer _OSI strings to the parser.Mike Larkin
Early in the release cycle is the right time to do this. "yes please" jcs@. ok deraadt@
2019-10-16Remove trailing whitespace from a lineMike Larkin
2019-10-13Move ws_get_param/ws_set_param into wsdisplay code.Mark Kettenis
ok deraadt@, jsg@
2019-10-12Print version number.Mark Kettenis
ok patrick@
2019-10-10Make reading past the end of an AML array not a panic.Mike Larkin
Several machines have broken AML which reads past the end the end of an array. Previously this was an aml_die/panic. acpica just warns on such accesses, so this diff makes us do the same. ok kettenis, jcs, deraadt