Skip to content

Conversation

IsaacWoods
Copy link
Member

@IsaacWoods IsaacWoods commented Jul 4, 2020

This PR moves to a new representation of the namespace that stores values in a more efficient and, hopefully, also easier to query data structure. It also makes various changes to support this new representation.

cc @rust-osdev/acpi if anyone is interested, feel free to review / leave comments

IsaacWoods added 28 commits July 1, 2020 00:52
This needs to be carefully considered, but I think will reduce the number
of heap allocations (and also overall heap burden) on normal workloads.

This has not yet moved all the searching and insertion methods over to the
new representation yet, so won't build.
…amespace

In the new namespace, devices and scopes need to be registed as "levels"
before objects can be added to them. Devices also no longer exist as
`AmlValue`s, as they don't exist as leaf objects.
* Correctly handle trying to add the root level
* Change algorithm so we don't have to differentiate between levels on the
root level, and levels on sub-levels
* Correctly emit error in cases of colliding levels
* Change error emitted to be better
* Efficiently normalise path instead of making it the caller's problem
This actually prints the namespace in a much more useful format than we
could've before with the old data structure, indenting each level and
printing the objects nicely collected under their parents.
Turns out we had a OEM ID that was too long (must be a maximum of 6 chars)
but the old version of the compiler never picked it up. Also changed where
PCI0 is expected to be in the namespace to test nested scopes.
WARNING: this breaks semver compatibility and so will need a new major
version.
We literally get hundreds of `DefPackage`s in `_PRT` objects, so it uses
up an unreasonable amount of space and indentation to print these on `Scopes`.
* Comments would appear under module `aml`, but `comment_scopes` would
  appear under `aml::parser`, which throws off the indentation.
* Scopes that aren't printed because they don't meet the verbosity setting
  still contributed to the indent level, so stuff would be massively
  indented by scopes that aren't printed.
Legacy `Processor` objects can contain sub-objects, but also contain data,
so we need to define both a value and a namespace level.
I'm not sure if this is the right path to go down, but we can always rip
it out if it's not. ACPI 1.0 seems different enough that I think it's worth
separating out as a 'legacy' mode.
For whatever reason, rustfmt keeps trying to wrap comments to way shorter
than we've told it to. This is boring, so let's tell rustfmt to go away
for now.
They are already at the correct indent before adding another scope.
@IsaacWoods IsaacWoods marked this pull request as ready for review July 6, 2020 23:39
@IsaacWoods IsaacWoods merged commit bfac584 into rust-osdev:master Jul 7, 2020
@IsaacWoods IsaacWoods deleted the new_namespace branch July 7, 2020 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant