Kernel: Add HID over I²C support via the OpenCores I²C controller used in RVVM#26612
Open
spholz wants to merge 9 commits intoSerenityOS:masterfrom
Open
Kernel: Add HID over I²C support via the OpenCores I²C controller used in RVVM#26612spholz wants to merge 9 commits intoSerenityOS:masterfrom
spholz wants to merge 9 commits intoSerenityOS:masterfrom
Conversation
This allows you to easily convert those types to ReadonlyBytes.
A similar struct is also defined in Drivers/HID.cpp, where it's actually used.
We never query devices by their name, so using a HashMap is unnecessary. Additionally, the next commit will make it possible for drivers to scan for new child devices and probe drivers on them. This means that the HashMap will then potentially resize while the parent driver is still being probed, causing Device references to get invalid. Now that this code doesn't use a HashMap anymore, we need to ensure that every device is only scanned once, so I added a comment mentioning that requirement. Alternatively, we could store a bool somewhere whether the device was already scanned or not. But there's no good place to put that other than in LibDeviceTree's Node class. However, I don't think we should modify LibDeviceTree for this kernel-specific use case.
This will be necessary for bus drivers like I²C, where bus nodes have
children that get registered by the bus driver.
For reference, this is what an I²C controller node with its child
devices could look like:
```dts
i2c@deadbeef {
compatible = "some,i2c-controller";
reg = <0xdeadbeef>;
i2c-device@8 {
compatible = "some,i2c-device";
reg = <0x8>;
};
};
```
DeviceTree::Management will initially only scan for devices in the root
node and all child "simple-bus" nodes. For other bus nodes, bus drivers
are responsible for registering child devices since there is no simple
address translation for these kinds of buses and the bus driver might
need to initialize the bus first.
For I²C, the `reg` properties contain the I²C addresses. I²C controller
nodes don't have a `ranges` property since there is no address mapping
between the child and parent address space.
Similar to the API for interrupt controllers, this allows I²C drivers to obtain a reference to its parent I²C controller.
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
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.
This makes mouse and keyboard input work in RVVM!
Both the I²C abstraction and the OpenCores I²C controller driver is currently very basic.
(Note: Serenity currently hangs during boot in the latest released RVVM version, 0.6. I made a PR to cherry-pick a fix for this into our RVVM port: #26611)