-
-
Notifications
You must be signed in to change notification settings - Fork 173
Implement rest of Pci Root Bridge Io protocol #1705
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
Draft
tmvkrpxl0
wants to merge
12
commits into
rust-osdev:main
Choose a base branch
from
tmvkrpxl0:pci_protocol
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
+778
−85
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # Cargo.lock # uefi-test-runner/Cargo.toml
Currently |
This allows PciRootBridgeIo to be used as `protocol.copy_mem` instead of `PciRootBridgeIo::copy_mem(protocol, ...)`
I switched to GhostCell and finally got rid of that weird design where the self parameter can only be |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I decided to implement missing features of Pci IO root bridge. It's not complete yet and I'm opening this PR beforehand to get a review.
Protocols to implement
Design Questions
I had to use RefCell for allocate, free, map, unmap and copy because I wanted allocated buffer and mapped region to clean themselves after they're dropped by calling free/unmap, and track their lifetimes so that they do not outlive protocol which allocated them (as it's required to free themselves), and for map function, do not outlive region they map.I couldn't just use normal reference because copy method requires mutable pointer. I wasn't sure if I can turn this into const pointer because some other functions inPciRootBridgeIoProtocol
struct takes in const pointer, so the original author for it must considered implications of this and I figured I should follow it.However it's quite ugly now and users must use these functions likePciRootBridgeIo::map
instead ofprotocol.map
Ideally it should work like this:
Fixed by switching to GhostCell
Does using GhostCell feel good?
Currently the test methods are written as such:
Now all methods of
PciRootBridgeIo
only needs shared reference to itself but all of them also take in either shared or mutable reference toGhostToken
And the
GhostToken
is wrapped inRefCell
as some types likePciMappedRegion
orPciBuffer
needs mutable reference toGhostToken
but I don't want these to block others from using it either.Checklist