Commit Graph

10 Commits

Author SHA1 Message Date
Sönke Holz
c382e2acb5 LibDeviceTree+Kernel: Rename interrupt_{identifier => specifier}
The correct term from the devicetree spec is "interrupt specifier".
2025-11-24 16:56:52 +01:00
Sönke Holz
5542998a79 AK+Kernel+Userland: Don't allow Vector copy constructors in the kernel
The copy constructors and copy assignment operators can't propagate
allocation failures.

As a replacement, introduce a new member function, Vector::clone() that
returns an ErrorOr<Vector>.

This commit replaces most usages of the Vector copy constructor by
either using .clone() or avoiding copies in the first place.
2025-11-22 19:51:20 +01:00
Sönke Holz
89e4f890d2 LibDeviceTree: Add support for the "interrupts-extended" property 2025-03-23 18:18:25 +01:00
Sönke Holz
5aa6136e02 LibDeviceTree: Add functions for accessing common interrupt properties 2024-12-10 16:25:46 +01:00
Sönke Holz
ddd9ab21e6 LibDeviceTree: Add functions for getting and translating addresses
I created this test file by running the following command:

    dtc -o address-translation.dtb <<EOF
    /dts-v1/;

    / {
        compatible = "serenity,address-translation-test";
        #address-cells = <2>;
        #size-cells = <1>;

        soc {
            compatible = "simple-bus";
            #address-cells = <1>;
            #size-cells = <1>;
            ranges = <0xa0000000 0xfe 0xd0000000 0x40000000>;

            usb@a0010000 {
                reg = <0xa0010000 0x100000>;
            };

            some-bus@b0000000 {
                compatible = "simple-bus";
                #address-cells = <2>;
                #size-cells = <2>;
                ranges = <0x02 0x00 0xb0000000 0x00 0x200000>;

                leds@200100000 {
                    reg = <0x02 0x100000 0x00 0x1000>;
                };
            };
        };
    };
    EOF
2024-12-10 16:25:46 +01:00
Sönke Holz
7d41d5191b LibDeviceTree: Rename DeviceTreeNodeView to Node
The class is in the DeviceTree namespace, so the prefix is redundant.
Calling it a 'View' is also somewhat misleading, as it is not simply a
cheap-to-copy reference to the underlying memory but is instead marked
as AK_MAKE_NONCOPYABLE.
2024-12-10 16:25:46 +01:00
Sönke Holz
81ede84131 LibDeviceTree: Rename DeviceTreeProperty to Property
The struct is in the DeviceTree namespace, so the prefix is redundant.
2024-12-10 16:25:46 +01:00
Sönke Holz
4c9b798543 LibDeviceTree: Add DeviceTreeNodeView::is_compatible_with 2024-11-02 13:53:10 -04:00
Hendiadyoin1
ffa9875fa6 LibDeviceTree: Fix stale pointers in phandle and parent handling
We need to set them after we've created the full tree, as otherwise the
HashMap containing the nodes may reallocate and invalidate the pointers.
2024-05-02 07:44:13 -06:00
Hediadyoin1
21a21c6a11 LibDeviceTree: Add a simple DeviceTree class
This makes it easier to work with device tree nodes and properties, then
writing simple state machines to parse the device tree.
This also makes the old slow traversal methods use the
DeviceTreeProperty helper class, and adds a simple test.
2024-02-24 16:43:44 -07:00