mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
Kernel: Add a MMIO class for aarch64
It doesn't do anything yet except figure out the peripheral base address. Very likely belongs in Kernel, not Prekernel, eventually.
This commit is contained in:
parent
3a24eb323f
commit
d0b9c7a20b
Notes:
sideshowbarker
2024-07-18 03:40:29 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/d0b9c7a20b2 Pull-request: https://github.com/SerenityOS/serenity/pull/10133 Reviewed-by: https://github.com/linusg
4 changed files with 54 additions and 3 deletions
26
Kernel/Prekernel/Arch/aarch64/MMIO.cpp
Normal file
26
Kernel/Prekernel/Arch/aarch64/MMIO.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Nico Weber <thakis@chromium.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <Kernel/Prekernel/Arch/aarch64/MMIO.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/MainIdRegister.h>
|
||||
|
||||
namespace Prekernel {
|
||||
|
||||
MMIO::MMIO()
|
||||
: m_base_address(0xFE00'0000)
|
||||
{
|
||||
MainIdRegister id;
|
||||
if (id.part_num() <= MainIdRegister::RaspberryPi3)
|
||||
m_base_address = 0x3F00'0000;
|
||||
}
|
||||
|
||||
MMIO& MMIO::the()
|
||||
{
|
||||
static MMIO instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
}
|
25
Kernel/Prekernel/Arch/aarch64/MMIO.h
Normal file
25
Kernel/Prekernel/Arch/aarch64/MMIO.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Nico Weber <thakis@chromium.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Prekernel {
|
||||
|
||||
// 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.
|
||||
// https://datasheets.raspberrypi.org/bcm2836/bcm2836-peripherals.pdf (RPi3)
|
||||
// https://datasheets.raspberrypi.org/bcm2711/bcm2711-peripherals.pdf (RPi4 Model B)
|
||||
class MMIO {
|
||||
public:
|
||||
static MMIO& the();
|
||||
|
||||
private:
|
||||
MMIO();
|
||||
|
||||
unsigned int m_base_address;
|
||||
};
|
||||
|
||||
}
|
|
@ -5,15 +5,14 @@
|
|||
*/
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/MainIdRegister.h>
|
||||
#include <Kernel/Prekernel/Arch/aarch64/MMIO.h>
|
||||
|
||||
extern "C" [[noreturn]] void halt();
|
||||
|
||||
extern "C" [[noreturn]] void init();
|
||||
extern "C" [[noreturn]] void init()
|
||||
{
|
||||
Prekernel::MainIdRegister id;
|
||||
[[maybe_unused]] unsigned part_num = id.part_num();
|
||||
[[maybe_unused]] auto& MMIO = Prekernel::MMIO::the();
|
||||
halt();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ if ("${SERENITY_ARCH}" STREQUAL "aarch64")
|
|||
|
||||
${SOURCES}
|
||||
Arch/aarch64/MainIdRegister.cpp
|
||||
Arch/aarch64/MMIO.cpp
|
||||
Arch/aarch64/init.cpp
|
||||
)
|
||||
else()
|
||||
|
|
Loading…
Reference in a new issue