summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2023-04-01 01:57:48 +0200
committerAndrew Kaster <andrewdkaster@gmail.com>2023-04-03 20:01:28 -0600
commit14d20618f10b717ac779b232522a85c168c4ec95 (patch)
tree47f29923e99c8f081772671d41b9159f307be82e
parent2613ac4cb4079b4030d5cf3eecb1ad97628f146c (diff)
downloadserenity-14d20618f10b717ac779b232522a85c168c4ec95.zip
Kernel/aarch64: Move query_firmware_version into RPi::Mailbox
This is for the upcoming commit that merges the x86_64 and aarch64 init.cpp files.
-rw-r--r--Kernel/Arch/aarch64/RPi/Mailbox.cpp26
-rw-r--r--Kernel/Arch/aarch64/RPi/Mailbox.h2
-rw-r--r--Kernel/Arch/aarch64/init.cpp32
3 files changed, 30 insertions, 30 deletions
diff --git a/Kernel/Arch/aarch64/RPi/Mailbox.cpp b/Kernel/Arch/aarch64/RPi/Mailbox.cpp
index 31be70f571..237ed89c17 100644
--- a/Kernel/Arch/aarch64/RPi/Mailbox.cpp
+++ b/Kernel/Arch/aarch64/RPi/Mailbox.cpp
@@ -104,4 +104,30 @@ bool Mailbox::send_queue(void* queue, u32 queue_size) const
return true;
}
+class QueryFirmwareVersionMboxMessage : RPi::Mailbox::Message {
+public:
+ u32 version;
+
+ QueryFirmwareVersionMboxMessage()
+ : RPi::Mailbox::Message(0x0000'0001, 4)
+ {
+ version = 0;
+ }
+};
+
+u32 Mailbox::query_firmware_version()
+{
+ struct __attribute__((aligned(16))) {
+ MessageHeader header;
+ QueryFirmwareVersionMboxMessage query_firmware_version;
+ MessageTail tail;
+ } message_queue;
+
+ if (!the().send_queue(&message_queue, sizeof(message_queue))) {
+ return 0xffff'ffff;
+ }
+
+ return message_queue.query_firmware_version.version;
+}
+
}
diff --git a/Kernel/Arch/aarch64/RPi/Mailbox.h b/Kernel/Arch/aarch64/RPi/Mailbox.h
index fb9d12c770..c1e67b6e17 100644
--- a/Kernel/Arch/aarch64/RPi/Mailbox.h
+++ b/Kernel/Arch/aarch64/RPi/Mailbox.h
@@ -49,6 +49,8 @@ public:
// Sends message queue to VideoCore
bool send_queue(void* queue, u32 queue_size) const;
+
+ u32 query_firmware_version();
};
}
diff --git a/Kernel/Arch/aarch64/init.cpp b/Kernel/Arch/aarch64/init.cpp
index 2b29b191b1..15d7dc7a71 100644
--- a/Kernel/Arch/aarch64/init.cpp
+++ b/Kernel/Arch/aarch64/init.cpp
@@ -47,8 +47,6 @@ READONLY_AFTER_INIT bool g_in_early_boot;
namespace Kernel {
-static u32 query_firmware_version();
-
extern "C" [[noreturn]] void halt();
extern "C" [[noreturn]] void init();
@@ -68,8 +66,8 @@ void init_stage2(void*)
{
Process::register_new(Process::current());
- auto firmware_version = query_firmware_version();
- dmesgln("Firmware version: {}", firmware_version);
+ auto firmware_version = RPi::Mailbox::the().query_firmware_version();
+ dmesgln("RPi: Firmware version: {}", firmware_version);
VirtualFileSystem::initialize();
@@ -179,30 +177,4 @@ extern "C" [[noreturn]] void init()
VERIFY_NOT_REACHED();
}
-class QueryFirmwareVersionMboxMessage : RPi::Mailbox::Message {
-public:
- u32 version;
-
- QueryFirmwareVersionMboxMessage()
- : RPi::Mailbox::Message(0x0000'0001, 4)
- {
- version = 0;
- }
-};
-
-static u32 query_firmware_version()
-{
- struct __attribute__((aligned(16))) {
- RPi::Mailbox::MessageHeader header;
- QueryFirmwareVersionMboxMessage query_firmware_version;
- RPi::Mailbox::MessageTail tail;
- } message_queue;
-
- if (!RPi::Mailbox::the().send_queue(&message_queue, sizeof(message_queue))) {
- return 0xffff'ffff;
- }
-
- return message_queue.query_firmware_version.version;
-}
-
}