-
-
Notifications
You must be signed in to change notification settings - Fork 72
Rewrite acpi crate and entire AML interpreter
#246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I don't really understand why this had a lifetime instead of constructing the slice for the lifetime of `self`, but this cleans stuff up a fair bit both in the library and for users.
…e`, `DefMethod`, `DefExternal`
Still need to do a bunch of bit fiddling stuff to facilitate actually reading and storing to them.
To match NT's behaviour, we should just evaluate a namestring within a package definition to a string object. Also handles this change in PRT handling.
This is required for various special address space types (e.g. the PCC)
This was unneeded complexity in the end and came unstuck when we realised the library needs to do I/O port accesses for register accesses. Users can just not implement parts of the API they're unable/will not use and deal with the consequences. Also catches changes to cache a mapping to the FACS in the AML interpreter.
This requires the AML interpreter to have access to the fixed hardware registers, and so changes the convenience initialization method to take a `AcpiPlatform` instead of just the tables. I think this is fine in the long run - users can still manually construct an interpreter if needed.
|
🚀 Further work will be needed to support remaining opcodes, support correct behaviour of various existing bits of the library, and other bits. These can hopefully be done as non-breaking changes in the first instance. |
This (entirely too large) PR represents work I've been doing over the last few months to address a large number of bugs in both the
acpiandamlcrates, and generally improve the quality of the library. While this work is nowhere near complete, it represents the library getting back to a point where I think it is reasonable for projects to use it (in that it is more correct than the current interpreter in all circumstances), and is already too unwieldy to rebase against other PRs that are waiting for review/merging.For contributors awaiting PRs being merged, I apologise for this derailing your contributions, and I am happy to assist in rebasing your changes/creating new patches with you credited as authors. I will review current PRs when I have time.
Summary of changes
Firstly, the
acpicrate has undergone major reworking to simplify logic surrounding table mapping and RSDT enumeration. This should fix #245.Previous work on allowing fallible allocations has been removed, as it added significant complexity for little real-world gain at this time - if the ecosystem around fallible allocation in Rust improves in the future, I'm not against re-adding these capabilities. The split between the portion of the library that can be used without an allocator vs requiring one has been made clearer, with allocating methods being moved under the higher-level
platformmodule.This PR also deprecates the
amlcrate, bringing the interpreter into theacpicrate under a feature-flag. This simplifies the most common use-cases of the library, and was effectively required for ergonomic handling of some AML operations that require us to handle static ACPI tables. Future work with the ACPI event system will likely require closer coupling between the previously-separate parts of the library, as well.I am imagining that these changes will be published as
acpi v6.0.0, with theamlcrate being marked as deprecated and receiving no future updates.Remaining tasks
AcpiHandlervsacpi::aml::Handler- do we want to merge them, makeAcpiHandlera supertrait (perhaps being renamedRegionMapperor similar as this is the only functionality it needs to provide)?GenericAddressto have arbitrary field widths - apparently required by the PCC (see acpi: add support for PCC table #233)DefVarPackageDefToBufferDefToIntegerDefToStringDefToDecimalStringDefToHexStringTasks for future PRs
I have decided to push various functionality to future PRs to get this merged as it is a strict improvement on current
main.DefMatchDefLoadDefLoadTableDefDataRegionDefStorevsDefCopyObjectDefNotifyetc)Feedback
I would welcome feedback on the new APIs, crate layout, or changes I should consider before publishing a new major version of
acpi. I particularly welcome feedback + bug-reports from people who have integratedacpiinto a kernel or other project.cc @rw-vanc - I would be interested in any concerns re Redox moving to the new version of the crate, and any further work you'd be interested in.
cc @usadson - this should fix #245. Thank you for your report.