summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpi (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Handle systems, such as the Dell Precision 3640, that accesskettenis2021-03-301-19/+87
| | | | | | | | | | 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@
* Pack the SPCR struct definition since the struct isn't naturally alignedpatrick2021-03-231-2/+2
| | | | | | | 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@
* Fix previous (1.258). It breaks if localX itself is an object reference.yasuoka2021-03-181-2/+5
| | | | | | found and test by Rafael Avila de Espindola ok kettenis
* Add acpi_iommu_device_map(), which replaces the DMA tag with one thatpatrick2021-03-152-2/+6
| | | | | | | | | 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@
* Add the IORT structure for named components. These give us the stream idspatrick2021-03-151-5/+13
| | | | | | | used towards an smmu(4) for non-PCI devices. The references are provided as ASCII printable paths. ok kettenis@
* Handle named references in acpi_getdevlist(). Fixes a regression in acpitztobhe2021-03-101-1/+11
| | | | | | caused by the reference handling change from December. ok kettenis@ patrick@
* Our ACPI namerefs are pointers to the byte structures for ACPI names.patrick2021-03-106-15/+20
| | | | | | | | | | | | 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@
* Fix typo for ATS attribute member in IORT root complex struct.patrick2021-03-101-2/+2
|
* Add support for sdhc(4) on Raspberry Pi in ACPI mode.kettenis2021-03-081-2/+8
| | | | ok patrick@
* Fix aml_store() to work properly when the lvalue is a reference ofyasuoka2021-03-071-3/+4
| | | | | | | LocalX. In that case, resolving the reference must be done before resetting the LocalX variable. test daniel ok kettenis
* Pass standard DMA tag to acpi(4) table drivers.patrick2021-03-071-1/+2
| | | | ok kettenis@
* timecounting: use C99-style initialization for all timecounter structscheloha2021-02-232-18/+18
| | | | | | | | | | | | | | | | | | 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@
* remove unused acpiec_lock() acpiec_unlock() functionsjsg2021-02-231-28/+1
| | | | ok kettenis@ pirofti@
* tpm(4): fix delay unitscheloha2021-01-281-18/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Fix IORT struct for Context and PMU interrupts. I misread bytes with bits.patrick2021-01-231-7/+5
| | | | ok kettenis@
* Add defines for the various ARM SMMU models.patrick2021-01-171-2/+8
| | | | ok kettenis@
* Add IORT structs for ARM SMMU versions 1 and 2.patrick2021-01-151-1/+35
| | | | ok kettenis@
* Split the IORT struct into two, as the current version not only containedpatrick2021-01-151-1/+4
| | | | | | the generic IORT node information but also the Root Complex's attributes. ok kettenis@
* Add IORT id for ARM SMMUv3.patrick2021-01-151-1/+2
| | | | ok kettenis@
* Move IO Remapping Table (IORT) struct defines to the common ACPI headerpatrick2021-01-151-1/+34
| | | | | | so that it can be used by more drivers. ok kettenis@
* Some BIOS seem to provide memory regions <16M in their reserved memorypatrick2021-01-141-5/+7
| | | | | | | | | | 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@
* acpi_map_address() cannot be wrapped by SMALL_KERNEL anymore, asderaadt2020-12-271-3/+3
| | | | it is used by acpihpet.c
* Refactor klist insertion and removalvisa2020-12-251-3/+3
| | | | | | | | | | | | 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@
* Extract clock frequency from _DSD properties.patrick2020-12-241-1/+3
| | | | ok kettenis@
* Implement capability register overrides based on _DSD properties.kettenis2020-12-241-2/+11
| | | | ok patrick@
* Fix some issues with referencing named ACPI nodes from Packages.kettenis2020-12-176-58/+65
| | | | | | | | | | | | | | | | | 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@
* avoid uninitialised var by using dma tag from attach argsjsg2020-12-121-2/+3
| | | | ok kettenis@
* The asmc sensor update task currently consumes ~50ms on each refresh cyclemglocker2020-12-121-18/+25
| | | | | | | | | | | | | 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@
* Initialize handledgnezdo2020-12-071-2/+2
| | | | ok kettenis@
* Implement acpi_intr_disestablish() for arm64.kettenis2020-12-061-1/+2
| | | | ok patrick@
* Add dwgpio(4) a driver for the Synopsys DesignWare GPIO controller.kettenis2020-12-063-4/+294
| | | | ok gnedzo@
* Add support for the _EVT method to the GPIO support code.kettenis2020-12-051-3/+12
| | | | ok patrick@
* Add ACPI support to imxiic(4).patrick2020-11-172-1/+235
| | | | ok kettenis@
* Add acpige(4), a driver for ACPI generic event devices. This is a ratherpatrick2020-11-152-1/+134
| | | | | | | | simple device that simply reacts to interrupts by invoking _EVT with the interrupt number. This is used on the HoneyComb LX2K to implement power button handling. ok kettenis@
* Add pchgpio(4), a driver for the GPIO controllers found on modern Intelkettenis2020-11-152-1/+369
| | | | | | PCHs. With help from James Hastings. ok deraadt@
* Adding IOMMU support for AMD Vi and Intel VTD (disabled)jordan2020-10-274-1/+3826
| | | | | | | This creates separate domains for each PCI device and can provide protection against invalid memory access. Needed for Passthrough PCI from vmd. ok deraadt@, kettenis@ : ----------------------------------------------------------------------
* Unbreak brightness setting on MacBooks introduced by abl(4).mglocker2020-10-251-1/+7
| | | | | | | | | MacBooks already handle the brightness through the drm driver. Therefore only attach abl(4) to iMacs. Issue initially reported by James Luigy. Discussed with kettenis@, ok jung@
* Add workaround for Lenovo X1 gen 8 which has AML that tries to invokekettenis2020-09-271-1/+4
| | | | | | | ToHexString() on a Package. Should probably be replaced by a better solution after release. ok deraadt@
* Make sure acpicpu(4) doesn't attach to Processor nodes that happen to havekettenis2020-09-271-2/+4
| | | | | | | | | a _HID. Should fix the issues with broken AML that Janne Johansson reported. This issue should be fixed in a more generic way, but that is too risky for the upcoming release. tested by jmc@ ok deraadt@
* disable acpivout brightness control on machines aware of Windows 8jsg2020-09-163-27/+71
| | | | | | | | | | | | | | | | | | On a HP ProBook 650 G1 acpivout backlight brightness control only works if we don't claim to be Windows 8. If we don't claim to be Windows 8 _BCL gives 21 levels with increments of 5, otherwise 101 levels (0-100) and a _BCM that does nothing. This is related to requirements Microsoft has for Windows 8 and later hardware certification. Having acpivout not fully attach lets inteldrm handle brightness ioctls. Brightness control via physical buttons will require a new acpi driver for the HP flavour of WMI. Add Windows 10 2004 _OSI value to the list while here. ok mpi@ kmos@ on an earlier version tested by kmos@ on 6460b and 6470b ProBooks which had the same problem feedback and ok kettenis@
* Add a command explaining that this driver uses the ACPI SMI command portkettenis2020-09-161-3/+6
| | | | and why we need magic to map it.
* abl(4) is a new driver to control the backlight brightness on Intel basedmglocker2020-09-152-1/+227
| | | | | | | | | Apple machines. The driver attaches through acpi(4) when the HID 'APP0002' is found. Thanks to kettenis@ for helping me sorting out the PCI bits. ok kettenis@
* Add acpi_ivhd_ext definitions to acpireg.hjordan2020-09-151-2/+21
| | | | ok kettenis@
* The SMC base address and i/o region size is now queried by acpi(4) andmglocker2020-09-131-4/+1
| | | | doesn't need to be hard coded anymore.
* Make asmc(4) attach through acpi(4) instead of isa(4).mglocker2020-09-122-1/+750
| | | | | | This e.g. makes the driver also work on iMac11,2. ok kettenis@, jung@
* Include <sys/systm.h> directly instead of relying on hidden UVM includes.mpi2020-09-111-4/+5
| | | | The header is being pulled via db_machdep.h -> uvm_extern.h -> uvm_map.h
* Reorder the acpi attach process so we look at Processor() CPU nodesjmatthew2020-08-273-6/+17
| | | | | | | | | after Device() ones, since we should prefer the newer node type. If we see any Device() nodes, don't attach acpicpu(4) to any Processor() nodes if they're also present. This also makes acpitz(4) and acpipwrres(4) devices attach slightly later. ok kettenis@, also tested by jmc@
* Let aml_copyvalue() handle AML_OBJTYPE_DEVICE.kettenis2020-08-262-2/+17
| | | | ok jmatthew@
* Declare hw_{prod,serial,uuid,vendor,ver} in <sys/systm.h>.visa2020-08-263-9/+3
| | | | OK deraadt@, mpi@
* Don't complain when child nodes don't have a _CRS method. This happens forkettenis2020-08-221-6/+4
| | | | | | | example for control method batteries that are attached to I2C but use an OperationRegion() to access the I2C device. ok jcs@, gnedzo@