summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/dsdt.c
AgeCommit message (Collapse)Author
2024-09-20remove unneeded semicolons; checked by millert@Jonathan Gray
2024-08-06Some laptops will generate an EC event shortly after we attempt to enterMark Kettenis
a low power S0 idle state. Since we register the EC GPE as a wakeup GPE this means we'll wake up immediately. Unfortunately we have to register that GPE as a wakeup GPE otherwise many laptops won't wake up when the user opens the lid (and some laptops won't wake up at all). So add some code to handle EC events while suspended and introduce the concept of wakeup AML notify handlers. Register the acpibtn(4) notify handlers as wakeup notify handlers such that we wake up. We'll go back to sleep immediately if we wake up for any other EC event. ok mlarkin@, deraadt@
2024-06-26return type on a dedicated line when declaring functionsJonathan Gray
ok mglocker@
2024-05-14remove prototypes with no matching functionJonathan Gray
2024-05-13remove prototypes with no matching functionJonathan Gray
ok mpi@
2024-04-13correct indentationJonathan Gray
no functional change, found by smatch warnings ok miod@ bluhm@
2024-01-08Implement RootPathString support in the LoadTable() AML function. FixesMark Kettenis
booting OpenBSD on some (ancient?) Hyper-V version. Tested by Henryk Paluch ok mlarkin@
2021-12-09Broken ACPI tables containing scopes that are larger than their outer shellPatrick Wildt
are caught by our ACPI parser. Unfortunately in such cases our reaction was to start parsing AML somewhere outside our current scope. The intention was to clamp down the inner scope to the maximum of the outer one. So, rectify it. This issue has shown up in EDK2's QEMU SBSA target, where the SSDT table was generated incorrectly. Surprisingly neither Linux nor ACPICA's iASL noticed that the table was broken. ok kettenis@ millert@
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-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-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-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-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
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-09-27Add workaround for Lenovo X1 gen 8 which has AML that tries to invokeMark Kettenis
ToHexString() on a Package. Should probably be replaced by a better solution after release. ok deraadt@
2020-09-16disable acpivout brightness control on machines aware of Windows 8Jonathan Gray
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@
2020-08-26Let aml_copyvalue() handle AML_OBJTYPE_DEVICE.Mark Kettenis
ok jmatthew@
2020-08-26Declare hw_{prod,serial,uuid,vendor,ver} in <sys/systm.h>.Visa Hankala
OK deraadt@, mpi@
2020-07-21acpi can use IPL_BIO (a low interrupt) since it only enqueues operations forTheo de Raadt
later processing. The use of a high interrupt will predate suspend/resume efforts, we had to redesign acpi to be non-reentrant obviously discussed with kettenis, in snaps for more than a week
2020-05-09aml_die() doesn't return, hint the compilerJeremie Courreges-Anglas
Avoids an uninitialized variable warning. ok kettenis@
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@
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-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
2019-10-10Remove trailing whitespaceMike Larkin
2019-07-31aml_find_node: perform callback on matched direct-child nodes beforeJoshua Stein
recursing into child devices looking for matches. This ensures that when walking nodes with acpi_inidev, a method like \_SB_.PCI0._INI will be executed before \_SB_.PCI0.I2C1.TPL1._INI. This matches how ACPICA walks nodes and a commonly-used DSDT template assumes that \OSYS has been initialized in \_SB_.PCI0._INI before being used by other device _INI methods. This should also help to execute \_INI and \_SB_._INI first, if present, which ACPICA does explicitly. Tested in snaps, ok deraadt
2019-07-31The ACPI 3 spec says the ToHexString and ToDec(imal)StringJoshua Stein
operators can take a data argument of Integer, String, or Buffer types, not just Integer. ok kettenis, deraadt
2019-01-10Properly implement (as far as we can) Event()/Signal()/Wait() AML operations.Mark Kettenis
ok mpi@, tedu@, deraadt@
2018-08-19Add support for multiple PCI segments. Only really implemented for arm64Mark Kettenis
for now as amd64/i386 firmware still caters for legacy OSes that only support a single PCI segment. ok patrick@
2018-06-29Use <stdint.h> types.Mark Kettenis
ok mpi@, jung@, krw@, deraadt@
2018-06-12Don't panic on I/O to unregistered regionspaces. Needed to unbreak the GPDMike Larkin
pocket which has a questionable BIOS. The code will now simply printf and return to the caller without doing any I/O in this case. The spec defines this to be undefined behaviour anyway. ok kettenis, deraadt, pirofti
2018-05-19Fix GenericSerialBus support by parsing ExtendedAccessField correctly.Mark Kettenis
ok mlarkin@
2018-05-17Sprinkle some #ifndef SMALL_KERNEL such that RAMDISK kernels cuild again.Mark Kettenis
pointed out by stsp@
2018-05-17Implement GenericSerialBus OpRegion support.Mark Kettenis
ok mlarkin@
2018-05-17Implement LoadTable().Mark Kettenis
ok mlarkin@
2017-11-29Revise OperatingRegion code to make it extensible and have chvgpio(4)Mark Kettenis
provide the OEM defined regions that are used by the AML on some Cherryview-based machines. ok mlarkin@
2017-10-12Add missing size to free(); ok deraadt@ mpi@anton
2017-05-28Remove a redundant assignment introduced in revision 1.219 but favor theanton
assignment outside of the conditional. ok stsp@
2017-04-15Fix format string in ACPI_MEMDEBUG blockPhilip Guenther
From Anton Lindqvist (anton.lindqvist(at)gmail.com)
2017-04-08Two prototypes for acpi_maptable; merge to one placeTheo de Raadt
2017-02-16On Apple hardware, claim an OSI of Darwin and no other OSesJoshua Stein
The DSDT on at MacBooks takes many different and beneficial code paths when the OS reports to be Darwin, but due to the way it checks OSI, we can't just add Darwin to the aml_valid_osi array since later checks for Windows variants will supersede the Darwin check. Fixes suspend and keeps Thunderbolt ports powered up after resume. One regression is that the acpibat driver no longer attaches and will require an ACPI Smart Battery driver, which is in the works. Adapted from a similar change in the Linux kernel from 2014. ok deraadt
2017-01-14Revert aml_rdpciaddr changes; breaks several machines that were workingMark Kettenis
before.
2017-01-08Make aml_rdpciaddr() work for for devices behind bridges. The code nowMark Kettenis
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@
2016-12-18Remove comparison of array which is always non-NULL. Fixes clang warning.Mark Kettenis
ok jca@ (a while back)
2016-10-25Add the resource index to aml_parse_resource() callback function.Paul Irofti
This is needed by an upcoming acpiec commit that handles machines breaking the current ACPI specifications. Change suggested by and ok kettenis@, guenther@
2016-10-21Add support for the ACPI timer opcode.Joris Vink
ok kettenis@
2016-09-27Print the type of operation space that failed as there seem to be more ofMike Larkin
these occurring recently.
2016-09-02Remove unused argument in aml_showvalue().Paul Irofti
The second argument of aml_showvalue() was probably supposed to set the verbosity level through dnprintf() but in fact it does nothing. OK deraadt@
2016-05-08Add support for writing gpio pins.Mark Kettenis
2016-05-07Implement ACPI 5.0 GeneralPurposeIo OpRegion support. This basically allowsMark Kettenis
AML to peek and poke at GPIO pins as if it were reading and writing registers. For now this only implements peeking at pins. It will print a message if AML attempt to poke at a pin. And it will panic if the assumptions made in the code are violated. ok mlarkin@