summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
AgeCommit message (Collapse)Author
2021-11-02knfTheo de Raadt
2021-10-30Change hw.perfpolicy=auto by default, at startup. If the system has ACTheo de Raadt
power connected (default is yes when no driver differentiates) then default to 100% performance. On battery, use the existing auto algorithm (which is admittedly somewhat unrefined). This change overrides the system/BIOS speed and puts OpenBSD in control. As this happens very early during boot, besides speedups in all usage usage patterns, some surprises: unhibernate and sysupgrade times are cut in half. note: on a few architectures, the setperf fn pointer is changed late, and thus the auto algorithm stops timeing out. kettenis and i will look for a solution. in snaps for more than a week. ok kettenis
2021-10-23tpm(4): add support for tpm2 CRB interfaceDave Voutila
Some modern tpm2 devices require or prefer drivers communicate via the CRB interface and not the TIS/fifo interface. This change adds basic support for detecting CRB start mode and using CRB to issue commands required for proper S4 hibernation. As a result, this also defines a new struct definition for the TPM2 acpi table required for start mode detection. This fixes recent S4 regressions on the Surface Go 2 caused by a change in firmware from Microsoft. Other CRB start methods may need implementing in the future to support additional hardware. tested by deraadt@ and many others, ok kettenis@
2021-09-29Add support for Cannon Lake H and Tiger Lake H platforms.Mark Kettenis
ok jcs@
2021-09-21During resume, also restore pins that we configured as GPIO interrupt pins.Mark Kettenis
Fixes issues with dead touchpads after resume on some machines. ok jcs@, deraadt@
2021-09-18Work around a BIOS bug on Lenovo Thinkpads based on Intel's Tiger LakeMark Kettenis
platforms where the GPIO pin that is used for the touchpad interrupt gets reset when entering S3 and isn't properly restored upon resume. ok deraadt@, jcs@
2021-09-11Identify TPM2.0 devices and perform the 2.0-specific "suspend" commandTheo de Raadt
(researched by mlarkin). With this, and the latest BIOS which added S3, the lenovo x1r9 and x1nano can resume. ok kettenis mlarkin
2021-08-30Remove magic offset from data structures. This makes it much easier toMark Kettenis
compare the data structures with the Linux code which unfortunately is the only documentation we have for the pin numbers used by ACPI. While there make the data structures const. ok jcs@
2021-08-24Fix ping group offsets.Mark Kettenis
ok jcs@
2021-08-24Fix compilation with debug enabled.Patrick Wildt
ok kettenis@
2021-08-10Add Tiger Lake LP (INT34C5) supportJoshua Stein
with James Hastings
2021-08-01whitespaceMark Kettenis
2021-07-24The I2C controller's clock- and bitrate properties used different namingPatrick Wildt
between ACPI and FDT. The ACPI tables have now been adjusted, so now we need to accept the new scheme as well. ok kettenis@
2021-07-20Fix trailing whitespace in a few places.Mike Larkin
No code change.
2021-05-22Fix aml_rwgsb(). My interpretation of the ACPI standard turned out to beMark Kettenis
wrong and the buffer size is implied by the field attribute instead of the field length like for normal OpRegion fields. Fixes various laptops where reading multiple bytes from AML over an i2c bus would overflow the buffer. Still fixes the Dell Precision 3640. ok tb@
2021-05-16panic does not require a \n at the end. When one is provided, it looks wrong.Theo de Raadt
2021-05-16correct prototype of acpi gpio intr_establish functionsJonathan Gray
ok kettenis@
2021-05-09Some x86 machines advertise the "hardware reduced" ACPI feature, advertiseMark Kettenis
S4 and S5 support, but fail to populate the SLEEP_CONTROL_REG and SLEEP_STATUS_REG descriptions in the FADT. An example of such a machine is the ASUS Zenbook 14 UM433DA. Any attempt to powerdown the machine will result in a kernel crash. It turns out that using the legacy ACPI PM registers works fine on this machien. So fall back on those registers if SLEEP_CONTROL_REG and/or SLEEP_STATUS_REG aren't provided. ok deraadt@, mpi@
2021-03-30Handle systems, such as the Dell Precision 3640, that accessMark Kettenis
GenericSerialBus operating regions witout checking whether they're really available. This needs to work on RAMDISK kernels as well. Since we don't want to pull in the i2c subsystem on those, provide a separate and much simpler dummy implementation of the GenericSerialBus access code when SMALL_KERNEL is defined. ok tb@
2021-03-23Pack the SPCR struct definition since the struct isn't naturally alignedPatrick Wildt
or padded, and hence e. g. the access to the PCI vendor/device id would be broken. The structs for the other tables all seem to be packed as well. ok kettenis@
2021-03-18Fix previous (1.258). It breaks if localX itself is an object reference.YASUOKA Masahiko
found and test by Rafael Avila de Espindola ok kettenis
2021-03-15Add acpi_iommu_device_map(), which replaces the DMA tag with one thatPatrick Wildt
is blessed with IOMMU magic, if available. This is mainly for arm64, since on amd64 and i386 the IOMMU only captures PCIe devices, as far as I know, which uses the pci_probe_device_hook(). This though is for non-PCI devices attached through ACPI. ok kettenis@
2021-03-15Add the IORT structure for named components. These give us the stream idsPatrick Wildt
used towards an smmu(4) for non-PCI devices. The references are provided as ASCII printable paths. ok kettenis@
2021-03-10Handle named references in acpi_getdevlist(). Fixes a regression in acpitztobhe
caused by the reference handling change from December. ok kettenis@ patrick@
2021-03-10Our ACPI namerefs are pointers to the byte structures for ACPI names.Patrick Wildt
These are not in a printable format, hence printing them as string is wrong. Additionally, aml_searchrel()/aml_searchname() expect the name to be passed in a printable format as well. Passing a nameref can lead to an out-of-bounds read, and the comparison can fail. Hence make sure that namerefs are passed to aml_getname() first, which returns printable strings. Note that aml_getname() uses a static buffer, so there are a few restrictions how the string can be used. ok kettenis@
2021-03-10Fix typo for ATS attribute member in IORT root complex struct.Patrick Wildt
2021-03-08Add support for sdhc(4) on Raspberry Pi in ACPI mode.Mark Kettenis
ok patrick@
2021-03-07Fix aml_store() to work properly when the lvalue is a reference ofYASUOKA Masahiko
LocalX. In that case, resolving the reference must be done before resetting the LocalX variable. test daniel ok kettenis
2021-03-07Pass standard DMA tag to acpi(4) table drivers.Patrick Wildt
ok kettenis@
2021-02-23timecounting: use C99-style initialization for all timecounter structscheloha
The timecounter struct is large and I think it may change in the future. Changing it later will be easier if we use C99-style initialization for all timecounter structs. It also makes reading the code a bit easier. For reasons I cannot explain, switching to C99-style initialization sometimes changes the hash of the resulting object file, even though the resulting struct should be the same. So there is a binary change here, but only sometimes. No behavior should change in either case. I can't compile-test this everywhere but I have been staring at the diff for days now and I'm relatively confident this will not break compilation. Fingers crossed. ok gnezdo@
2021-02-23remove unused acpiec_lock() acpiec_unlock() functionsJonathan Gray
ok kettenis@ pirofti@
2021-01-28tpm(4): fix delay unitscheloha
tpm(4) has timeout constants in milliseconds, e.g. #define TPM_ACCESS_TMO 2000 /* 2sec */ This is fine. The odd thing is that tpm(4) first converts these timeouts to counts of ticks via tpm_tmotohz() before using DELAY() to busy-wait. DELAY() takes a count of microseconds, which are not equivalent to ticks, so the units are all screwed up. Let's correct this: - Remove tpm_tmotohz(). We're not working with ticks so we don't it. - Multiply the timeouts to match the delay interval. tpm_request_locality() and tpm_getburst() use intervals of 10 microseconds, so multiply the millisecond timeouts by 100. In tpm_waitfor() the delay interval is 1 microsecond, so multiply the millisecond timeout by 1000. - Update the parameter name in tpm_waitfor() to note that we expect a count of milliseconds, not "tries". Discussion: https://marc.info/?l=openbsd-tech&m=160995671326406&w=2 Prompted by kettenis@. Suspend/resume tested by florian@ on an X1 Gen 2. For the record, it looks like this: tpm0 at acpi0 TPM_ addr 0xfed40000/0x5000, device 0x0000104a rev 0x4e Earlier versions of this patch were reviewed by kn@, but the patch became more ambitious when kettenis@ got involved so those reviews are no longer applicable. jcs@ notes (https://marc.info/?l=openbsd-tech&m=160834427630142&w=2) in a related discussion that this driver "sucks" and should be replaced with NetBSD's rewrite. This would get us a cleaner driver with TPM 2.0 support. So there is future work to do here. ok kettenis@
2021-01-23Fix IORT struct for Context and PMU interrupts. I misread bytes with bits.Patrick Wildt
ok kettenis@
2021-01-17Add defines for the various ARM SMMU models.Patrick Wildt
ok kettenis@
2021-01-15Add IORT structs for ARM SMMU versions 1 and 2.Patrick Wildt
ok kettenis@
2021-01-15Split the IORT struct into two, as the current version not only containedPatrick Wildt
the generic IORT node information but also the Root Complex's attributes. ok kettenis@
2021-01-15Add IORT id for ARM SMMUv3.Patrick Wildt
ok kettenis@
2021-01-15Move IO Remapping Table (IORT) struct defines to the common ACPI headerPatrick Wildt
so that it can be used by more drivers. ok kettenis@
2021-01-14Some BIOS seem to provide memory regions <16M in their reserved memoryPatrick Wildt
region reporting table. Since the extent only covered memory starting at 16M, these regions could not be reserved and would in turn cause a panic. Make the extent start at 0 and immediately reserve the first 16M right away, so that we can change the reserved memory allocator to EX_CONFLICTOK to make allocations succeed if they are already reserved. ok kettenis@
2020-12-27acpi_map_address() cannot be wrapped by SMALL_KERNEL anymore, asTheo de Raadt
it is used by acpihpet.c
2020-12-25Refactor klist insertion and removalVisa Hankala
Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
2020-12-24Extract clock frequency from _DSD properties.Patrick Wildt
ok kettenis@
2020-12-24Implement capability register overrides based on _DSD properties.Mark Kettenis
ok patrick@
2020-12-17Fix some issues with referencing named ACPI nodes from Packages.Mark Kettenis
These references need to be resolved at runtime rather than when they're parsed such that they pick up the right values for those nodes which can be changed when for example _INI methods run. The current approach is to replace these reference with a string that names the node in question. The problem with that is that packages can also contain normal strings. Which means that we need special code that depends on the context where the package is used. This diff takes a different approach by retaining a reference when parsing. Code that uses a package will need to resolve this reference but there is no ambiguiety anymore. ok patrick@
2020-12-12avoid uninitialised var by using dma tag from attach argsJonathan Gray
ok kettenis@
2020-12-12The asmc sensor update task currently consumes ~50ms on each refresh cycleMarcus Glocker
because the asmc read/write functions are timing out regularly on each cycle. Since the sensor task is executed during kernel lock, this can have a negative impact on time sensitive code, as seen with USB isoc transfers. Rewriting the asmc read/write functions to a similar execution pattern as the Linux driver does, entirely removes the timeouts, and hence reduces the asmc sensor update code to be executed within ~3ms. ok mpi@
2020-12-07Initialize handledgnezdo
ok kettenis@
2020-12-06Implement acpi_intr_disestablish() for arm64.Mark Kettenis
ok patrick@
2020-12-06Add dwgpio(4) a driver for the Synopsys DesignWare GPIO controller.Mark Kettenis
ok gnedzo@
2020-12-05Add support for the _EVT method to the GPIO support code.Mark Kettenis
ok patrick@