Kernel: Put Raspberry Pi devices into RPi namespace

This makes it clear in the code that these drivers are specific for the
Raspberry Pi devices.
This commit is contained in:
Timon Kruiper 2022-05-29 11:12:17 +02:00 committed by Linus Groh
parent 77f24056e0
commit 63ee2781fb
Notes: sideshowbarker 2024-07-17 10:30:54 +09:00
16 changed files with 27 additions and 27 deletions

View File

@ -142,7 +142,7 @@ static void build_identity_map(PageBumpAllocator& allocator)
u64 device_memory_flags = ACCESS_FLAG | PAGE_DESCRIPTOR | OUTER_SHAREABLE | DEVICE_MEMORY;
insert_identity_entries_for_physical_memory_range(allocator, level1_table, START_OF_NORMAL_MEMORY, END_OF_NORMAL_MEMORY, normal_memory_flags);
insert_identity_entries_for_physical_memory_range(allocator, level1_table, MMIO::the().peripheral_base_address(), MMIO::the().peripheral_end_address(), device_memory_flags);
insert_identity_entries_for_physical_memory_range(allocator, level1_table, RPi::MMIO::the().peripheral_base_address(), RPi::MMIO::the().peripheral_end_address(), device_memory_flags);
}
static void switch_to_page_table(u8* page_table)

View File

@ -8,7 +8,7 @@
#include <Kernel/Arch/aarch64/RPi/Framebuffer.h>
#include <Kernel/Arch/aarch64/RPi/FramebufferMailboxMessages.h>
namespace Kernel {
namespace Kernel::RPi {
Framebuffer::Framebuffer()
{

View File

@ -8,7 +8,7 @@
#include <AK/Types.h>
namespace Kernel {
namespace Kernel::RPi {
class Framebuffer {
public:

View File

@ -8,7 +8,7 @@
#include <Kernel/Arch/aarch64/RPi/Mailbox.h>
namespace Kernel {
namespace Kernel::RPi {
class FramebufferSetPhysicalSizeMboxMessage : public Mailbox::Message {
public:

View File

@ -8,7 +8,7 @@
#include <Kernel/Arch/aarch64/RPi/GPIO.h>
#include <Kernel/Arch/aarch64/RPi/MMIO.h>
namespace Kernel {
namespace Kernel::RPi {
// See BCM2835-ARM-Peripherals.pdf section "6 General Purpose I/O" or bcm2711-peripherals.pdf "Chapter 5. General Purpose I/O".

View File

@ -9,7 +9,7 @@
#include <AK/Array.h>
#include <AK/Types.h>
namespace Kernel {
namespace Kernel::RPi {
struct GPIOControlRegisters;

View File

@ -7,7 +7,7 @@
#include <Kernel/Arch/aarch64/MainIdRegister.h>
#include <Kernel/Arch/aarch64/RPi/MMIO.h>
namespace Kernel {
namespace Kernel::RPi {
MMIO::MMIO()
: m_base_address(0xFE00'0000)

View File

@ -8,7 +8,7 @@
#include <AK/Types.h>
namespace Kernel {
namespace Kernel::RPi {
// Knows about memory-mapped IO addresses on the Broadcom family of SOCs used in Raspberry Pis.
// RPi3 is the first Raspberry Pi that supports aarch64.

View File

@ -7,7 +7,7 @@
#include <Kernel/Arch/aarch64/RPi/MMIO.h>
#include <Kernel/Arch/aarch64/RPi/Mailbox.h>
namespace Kernel {
namespace Kernel::RPi {
// There's one mailbox at MBOX_BASE_OFFSET for reading responses from VideoCore, and one at MBOX_BASE_OFFSET + 0x20 for sending requests.
// Each has its own status word.

View File

@ -8,7 +8,7 @@
#include <AK/Types.h>
namespace Kernel {
namespace Kernel::RPi {
// Can exchange mailbox messages with the Raspberry Pi's VideoCore chip.
// https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface

View File

@ -9,7 +9,7 @@
#include <Kernel/Arch/aarch64/RPi/Mailbox.h>
#include <Kernel/Arch/aarch64/RPi/Timer.h>
namespace Kernel {
namespace Kernel::RPi {
// "12.1 System Timer Registers" / "10.2 System Timer Registers"
struct TimerRegisters {

View File

@ -8,7 +8,7 @@
#include <AK/Types.h>
namespace Kernel {
namespace Kernel::RPi {
struct TimerRegisters;

View File

@ -9,7 +9,7 @@
#include <Kernel/Arch/aarch64/RPi/Timer.h>
#include <Kernel/Arch/aarch64/RPi/UART.h>
namespace Kernel {
namespace Kernel::RPi {
// "13.4 Register View" / "11.5 Register View"
struct UARTRegisters {

View File

@ -9,7 +9,7 @@
#include <AK/Types.h>
namespace Kernel {
namespace Kernel::RPi {
struct UARTRegisters;

View File

@ -112,14 +112,14 @@ extern "C" [[noreturn]] void init()
dbgln("Initialize MMU");
init_prekernel_page_tables();
auto& framebuffer = Framebuffer::the();
auto& framebuffer = RPi::Framebuffer::the();
if (framebuffer.initialized()) {
draw_logo();
}
dbgln("Enter loop");
auto& timer = Timer::the();
auto& timer = RPi::Timer::the();
u64 start_musec = 0;
for (;;) {
u64 now_musec;
@ -130,12 +130,12 @@ extern "C" [[noreturn]] void init()
}
}
class QueryFirmwareVersionMboxMessage : Mailbox::Message {
class QueryFirmwareVersionMboxMessage : RPi::Mailbox::Message {
public:
u32 version;
QueryFirmwareVersionMboxMessage()
: Mailbox::Message(0x0000'0001, 4)
: RPi::Mailbox::Message(0x0000'0001, 4)
{
version = 0;
}
@ -144,12 +144,12 @@ public:
static u32 query_firmware_version()
{
struct __attribute__((aligned(16))) {
Mailbox::MessageHeader header;
RPi::Mailbox::MessageHeader header;
QueryFirmwareVersionMboxMessage query_firmware_version;
Mailbox::MessageTail tail;
RPi::Mailbox::MessageTail tail;
} message_queue;
if (!Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) {
if (!RPi::Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) {
return 0xffff'ffff;
}
@ -169,7 +169,7 @@ static void draw_logo()
dbgln("Boot logo size: {} ({} x {})", serenity_boot_logo_size, logo_parser.image.width, logo_parser.image.height);
auto& framebuffer = Framebuffer::the();
auto& framebuffer = RPi::Framebuffer::the();
auto fb_ptr = framebuffer.gpu_buffer();
auto image_left = (framebuffer.width() - logo_parser.image.width) / 2;
auto image_right = image_left + logo_parser.image.width;
@ -181,12 +181,12 @@ static void draw_logo()
for (u32 x = 0; x < framebuffer.width(); x++) {
if (x >= image_left && x < image_right && y >= image_top && y < image_bottom) {
switch (framebuffer.pixel_order()) {
case Framebuffer::PixelOrder::RGB:
case RPi::Framebuffer::PixelOrder::RGB:
fb_ptr[0] = logo_pixels[0];
fb_ptr[1] = logo_pixels[1];
fb_ptr[2] = logo_pixels[2];
break;
case Framebuffer::PixelOrder::BGR:
case RPi::Framebuffer::PixelOrder::BGR:
fb_ptr[0] = logo_pixels[2];
fb_ptr[1] = logo_pixels[1];
fb_ptr[2] = logo_pixels[0];

View File

@ -14,7 +14,7 @@ void kernelputstr(char const* characters, size_t length)
if (!characters)
return;
auto& uart = Kernel::UART::the();
auto& uart = Kernel::RPi::UART::the();
uart.print_str(characters, length);
}
@ -23,7 +23,7 @@ void kernelcriticalputstr(char const* characters, size_t length)
if (!characters)
return;
auto& uart = Kernel::UART::the();
auto& uart = Kernel::RPi::UART::the();
uart.print_str(characters, length);
}
@ -32,6 +32,6 @@ void kernelearlyputstr(char const* characters, size_t length)
if (!characters)
return;
auto& uart = Kernel::UART::the();
auto& uart = Kernel::RPi::UART::the();
uart.print_str(characters, length);
}