From 89943857af8575745d282f5a421bbe43b367e009 Mon Sep 17 00:00:00 2001 From: Berkus Decker Date: Sun, 12 Nov 2023 00:09:22 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Update=20rpi4=20target=20?= =?UTF-8?q?to=20use=20virtual=20MMIO=20bases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/raspberrypi/device_driver/arm/gicv2/gicc.rs | 8 ++++++-- .../platform/raspberrypi/device_driver/arm/gicv2/gicd.rs | 3 ++- .../platform/raspberrypi/device_driver/arm/gicv2/mod.rs | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/machine/src/platform/raspberrypi/device_driver/arm/gicv2/gicc.rs b/machine/src/platform/raspberrypi/device_driver/arm/gicv2/gicc.rs index 03db041..fc16736 100644 --- a/machine/src/platform/raspberrypi/device_driver/arm/gicv2/gicc.rs +++ b/machine/src/platform/raspberrypi/device_driver/arm/gicv2/gicc.rs @@ -5,7 +5,11 @@ //! GICC Driver - GIC CPU interface. use { - crate::{exception, platform::device_driver::common::MMIODerefWrapper}, + crate::{ + exception, + memory::{Address, Virtual}, + platform::device_driver::common::MMIODerefWrapper, + }, tock_registers::{ interfaces::{Readable, Writeable}, register_bitfields, register_structs, @@ -75,7 +79,7 @@ impl GICC { /// # Safety /// /// - The user must ensure to provide a correct MMIO start address. - pub const unsafe fn new(mmio_start_addr: usize) -> Self { + pub const unsafe fn new(mmio_start_addr: Address) -> Self { Self { registers: Registers::new(mmio_start_addr), } diff --git a/machine/src/platform/raspberrypi/device_driver/arm/gicv2/gicd.rs b/machine/src/platform/raspberrypi/device_driver/arm/gicv2/gicd.rs index 0ca56b4..c673fd5 100644 --- a/machine/src/platform/raspberrypi/device_driver/arm/gicv2/gicd.rs +++ b/machine/src/platform/raspberrypi/device_driver/arm/gicv2/gicd.rs @@ -9,6 +9,7 @@ use { crate::{ + memory::{Address, Virtual}, platform::device_driver::common::MMIODerefWrapper, state, synchronization::{self, IRQSafeNullLock}, @@ -131,7 +132,7 @@ impl GICD { /// # Safety /// /// - The user must ensure to provide a correct MMIO start address. - pub const unsafe fn new(mmio_start_addr: usize) -> Self { + pub const unsafe fn new(mmio_start_addr: Address) -> Self { Self { shared_registers: IRQSafeNullLock::new(SharedRegisters::new(mmio_start_addr)), banked_registers: BankedRegisters::new(mmio_start_addr), diff --git a/machine/src/platform/raspberrypi/device_driver/arm/gicv2/mod.rs b/machine/src/platform/raspberrypi/device_driver/arm/gicv2/mod.rs index e696d4a..9b49c41 100644 --- a/machine/src/platform/raspberrypi/device_driver/arm/gicv2/mod.rs +++ b/machine/src/platform/raspberrypi/device_driver/arm/gicv2/mod.rs @@ -81,6 +81,7 @@ mod gicd; use crate::{ cpu, drivers, exception, + memory::{Address, Virtual}, platform::{self, cpu::BOOT_CORE_ID, device_driver::common::BoundedUsize}, synchronization::{self, InitStateLock}, }; @@ -125,7 +126,10 @@ impl GICv2 { /// # Safety /// /// - The user must ensure to provide a correct MMIO start address. - pub const unsafe fn new(gicd_mmio_start_addr: usize, gicc_mmio_start_addr: usize) -> Self { + pub const unsafe fn new( + gicd_mmio_start_addr: Address, + gicc_mmio_start_addr: Address, + ) -> Self { Self { gicd: gicd::GICD::new(gicd_mmio_start_addr), gicc: gicc::GICC::new(gicc_mmio_start_addr),