Commit graph

64571 commits

Author SHA1 Message Date
Linus Groh
5db1ddc677 Meta: Ignore title length of revert commits
Even if a commit message title previously fit into the 72 character
limit it may go over that with 'Revert ""' added - asking the author to
tweak the commit message is not appropriate in that case.

Since additional context can be added to the commit message body the
usual length restriction applies to the remaining lines.

Also restructure the code to group checks based on the line number we're
currently looking at.
2024-12-16 22:08:51 +01:00
Sönke Holz
7bcf97c8e8 Kernel/aarch64: Implement microseconds_delay
This simple delay loop uses the EL1 virtual timer to wait for the given
amount of time.
2024-12-15 15:26:40 +01:00
Sönke Holz
6517eabb5f Kernel/aarch64: Rename AUX.{h,cpp} to AUXPeripherals.{h,cpp}
The file name "AUX" is reserved on Windows.
2024-12-15 02:06:23 +01:00
Sönke Holz
b88cd185a0 Kernel/aarch64: Use the EL1 virtual timer for ARMv8Timer
The physical timer might not be accessible to us if we are running in a
hypervisor.
2024-12-14 19:40:02 +01:00
Sönke Holz
4cc9bea86d Kernel/aarch64: Reject ARMv8Timers with the "interrupt-names" property
Our current check `interrupts.size() != 4` doesn't always work because
timers with the "interrupt-names" property can define 4 timers at the
same indices mapping to different interrupts.

The old devicetree binding only allowed 4 interrupts, so keep the old
check as well.
2024-12-14 19:40:02 +01:00
implicitfield
98f26fac1b Kernel/AHCI: Don't use [[gnu::packed]] on register structs
The AHCI specification accounts for common alignment rules, so we don't
actually need to pack these structs. In fact, packing some of these
structs actually causes misaligned accesses on aarch64.
2024-12-14 18:18:02 +01:00
implicitfield
b5491e58f1 Kernel/aarch64: Implement interrupt reservation 2024-12-14 18:18:02 +01:00
implicitfield
7fb4396cba Kernel/aarch64: Initialize interrupts during processor bringup 2024-12-14 18:18:02 +01:00
implicitfield
47114b11e8 Kernel/aarch64: Share the PCI initialization routine with RISC-V 2024-12-14 18:18:02 +01:00
Sönke Holz
056cba3c0c Kernel: Use MemoryType::IO for DMA regions everywhere
Drivers using DMA buffers are currently broken on bare metal since
d3a0ae5c57 and b3bae90e71 made DMA buffers use the NonCacheable memory
type.

We should investigate each of these drivers and and add proper fences
where needed.

The only place where MemoryType::IO definitely isn't needed is the xHCI
scratchpad regions, as they are only accessed by the device.
2024-12-12 16:07:25 +01:00
Sönke Holz
10c217070f Kernel/MM: Allow setting the memory type for DMA regions 2024-12-12 16:07:25 +01:00
Sönke Holz
0d6d716e94 Kernel/aarch64: Add ARMv8Timer support
This timer is used by the Raspberry Pi 3+4 and the QEMU virt machine.

Remove the `#if ARCH`s from HardwareTimerType, as all other enum values
would otherwise have to be updated to keep the values consistent across
all architectures.
2024-12-12 15:06:28 +01:00
Sönke Holz
ebe5b0df03 Kernel/aarch64: Add GICv2 support
GICs are used by many ARM systems, including the Pi 4+5 and the QEMU
virt machine.
2024-12-12 15:06:28 +01:00
Sönke Holz
27ff852387 Kernel/aarch64: Support more than 64 interrupts
GICv2s can have up to 1020 interrupts.

AArch64 IRQControllers previously returned a bit field of pending
interrupts. Change the API to return one pending interrupt at a time
instead.

We still truncate the interrupt number to 8 bit in a lot of other places
in the kernel. This is something that needs to be addressed in a future
commit.
2024-12-12 15:06:28 +01:00
Sönke Holz
f33f7f91de Kernel: Handle devicetree drivers with multiple compatible strings 2024-12-12 15:06:28 +01:00
Sönke Holz
300c132f47 Kernel/USB: Remove never-initialized USB::Device::m_{vendor,product}_id
These members were never set and are redundant because you can just read
them directly from the device descriptor.
2024-12-11 18:57:54 -05:00
Zhaoming Luo
d126092002 Kernel/x86_64: Fix the number in a comment in RTC 2024-12-11 20:11:11 +01:00
Sönke Holz
a3af84c5e6 Kernel/aarch64: Get RPi timer address and IRQ number from the devicetree 2024-12-10 16:25:46 +01:00
Sönke Holz
0eec585596 Kernel/aarch64: Get RPi interrupt controller address from the devicetree 2024-12-10 16:25:46 +01:00
Sönke Holz
053d1cb79c Kernel: Add a helper to get devicetree resources 2024-12-10 16:25:46 +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
ed097d87da LibDeviceTree: Make FlattenedDeviceTreeTokenType an enum class
This will be necessary in the next commit to avoid a name conflict.
2024-12-10 16:25:46 +01:00
Sönke Holz
fe6d785e91 LibDeviceTree: Remove DeviceTreeNodeView::child()
This (confusingly named) function will probably never be used, since you
normally should know whether you are looking for a child or property.
2024-12-10 16:25:46 +01:00
Pavel Shliak
4f6f65d1f9 AK: Fix InsertionSort to respect specified bounds
Previously, it ignored 'start', sorting from the array's
beginning. This caused unintended changes and slower
performance. Fix ensures sorting stays within 'start'
and 'end' indices only.

(cherry picked from commit 356016c626546aeb51722fe9ca5bb6a769bfe762)
2024-12-08 13:24:15 -05:00
Pavel Shliak
141dfc53c2 LibGfx: Remove aligned_within from Rect
The CenterRight and TopCenter alignment cases were
mistakenly identical due to a copy-paste error,
causing the function to behave unexpectedly.
Rather than attempting to fix it, remove aligned_within entirely.

(cherry picked from commit 116e7baeada1184bb10c64aed3cd20315955c63a)
2024-12-08 13:18:07 -05:00
Sönke Holz
39c20b612b Kernel/aarch64: Add a platform init function for the virt machine 2024-12-07 16:56:12 +01:00
Sönke Holz
64ec4fab48 Kernel/aarch64: Rename RPi::UART to PL011 and move it out of the RPi dir
This PL011 driver doesn't have any RPi-specific code anymore.
Also change the documentation references to refer to the generic PL011
manual instead and adapt some register definitions.

Some definitions were previously named unused/unsupported. They were
mostly related to some hardware flow control lines and IrDA which the Pi
UARTs don't support.
2024-12-07 16:56:12 +01:00
Sönke Holz
9a58408fe7 Kernel/aarch64: Don't use RPi::MMIO for RPi::UART
Instead calculate the address in the platform init function.
2024-12-07 16:56:12 +01:00
Sönke Holz
e67330971c Kernel/aarch64: Use a platform init function for most of the RPi code
This required making the `debug_output` console configurable at runtime
by introducing a `DebugConsole` struct, which simply contains a callback
for printing a single character.
We should probably use something like this abstraction for all
architectures in the future.
2024-12-07 16:56:12 +01:00
Sönke Holz
d6d5379445 Kernel: Introduce a new abstraction for platform-specific init code
This new abstraction provides a simple solution for handling early
driver initialization without requiring some kind of dependency
management for devicetree drivers, which would otherwise be necessary.
2024-12-07 16:56:12 +01:00
Sönke Holz
240db03a27 AK: Make to_array work with zero-sized arrays
The other overload doesn't work for zero-sized arrays.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2024-12-07 16:56:12 +01:00
Ninad Sachania
46522b2efa Utilities/sed: Add tests for the transform command & comments 2024-12-05 10:08:43 -05:00
Ninad Sachania
ef6f3db1ca Utilities/sed: Add support for comments 2024-12-05 10:08:43 -05:00
Ninad Sachania
aa740e0db8 Utilities/sed: Implement the r file command 2024-12-05 10:08:43 -05:00
Ninad Sachania
039a515696 Utilities/sed: Implement the transform command 2024-12-05 10:08:43 -05:00
Ninad Sachania
40c629c419 Utilities/sed: Make blanks between [r|w] and file optional 2024-12-05 10:08:43 -05:00
Ninad Sachania
1924e94839 Utilities/sed: Add support for w file flag in the substitute command 2024-12-05 10:08:43 -05:00
Ninad Sachania
56f1661318 Utilities/sed: Dynamically calculate folding width based on term size 2024-12-05 10:08:43 -05:00
Ninad Sachania
8dfe2064f7 Utilities/sed: Wire up the the w file command 2024-12-05 10:08:43 -05:00
Ninad Sachania
754cbdbab0 Utilities/sed: Only quit after writing the output 2024-12-05 10:08:43 -05:00
Timothy Flynn
4a52145f8e LibWebView: Implement drag-and-drop for OutOfProcessWebView
Almost the entirety of drag-and-drop operations are handled within
LibWeb. This patch just hooks up the UI-side operations to trigger
the events.

A FIXME is left here to open files in the browser that were not accepted
by the web page.
2024-12-04 08:00:21 -05:00
Timothy Flynn
c3b1d533f6 LibWebView: Add explicit conversions between GUI and Web button codes
They happen to currently have the same values, but let's be explicit.
2024-12-04 08:00:21 -05:00
Timothy Flynn
81e469c911 LibGUI+WindowServer+Applications: Carry more data across drag events
To support drag-and-drop for LibWeb, the drag events need the full mime
data from WindowServer, not just the list of stringified mime types. We
only provided the full data in the drop events. This patch provides the
Core::MimeData type, as well as other mouse-event information needed for
LibWeb (what buttons / modifiers are pressed).

To do this, we add a specific WindowServer IPC to inform the Application
of the event. We previously tagged mouse-move events with some drag data
and formed the drag event client-side. That extra data is removed in
favor of this new IPC.
2024-12-04 08:00:21 -05:00
Sönke Holz
b499279162 LibELF+Kernel: Don't define SERENITY_PAGE_SIZE in ELFABI.h
ELFABI.h gets included during the toolchain build, so we shouldn't
include AK headers from that file.
SERENITY_PAGE_SIZE also isn't really related to ELF ABI, so move it to
the serenity_limits.h header.
2024-12-03 20:57:24 +01:00
implicitfield
5974f087ee LibELF: Introduce a SERENITY_PAGE_SIZE define for cross-compilation
Currently, LibELF uses the host's page size for validation (even on
Lagom), which causes issues with PrekernelPEImageGenerator, since that
always uses 4 KiB pages for cross-compilation purposes.
2024-12-02 10:24:36 -05:00
implicitfield
a3fc110ea8 Meta: Use the same disk size for genext2fs as for everything else
INODE_COUNT gets modified after it has been initially used to compute
DISK_SIZE_BYTES, so the approach introduced in caefb208 didn't actually
work as intended.
2024-12-02 10:24:36 -05:00
Sönke Holz
c385e8beb1 EFIPrekernel: Don't depend on install_libc_headers
This target was removed in 175f9dc5c3, but the dependency on it wasn't
removed from faeb9ff521 before PR #24995 was merged.
This should make everything build again.
2024-12-01 13:53:02 +01:00