summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
-}
-
}