Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pl011-uart crate for aarch64 example. #168

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/aarch64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ edition = "2021"
buddy_system_allocator = "0.10.0"
flat_device_tree = "3.1.1"
log = "0.4.22"
pl011-uart = "0.1.0"
smccc = "0.1.1"
spin = "0.9.8"
virtio-drivers = { path = "../.." }
Expand Down
8 changes: 3 additions & 5 deletions examples/aarch64/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ mod exceptions;
mod hal;
mod logger;
#[cfg(platform = "qemu")]
mod pl011;
#[cfg(platform = "qemu")]
use pl011 as uart;
use pl011_uart as uart;
#[cfg(platform = "crosvm")]
mod uart8250;
#[cfg(platform = "crosvm")]
Expand Down Expand Up @@ -50,11 +48,11 @@ use virtio_drivers::{

/// Base memory-mapped address of the primary PL011 UART device.
#[cfg(platform = "qemu")]
pub const UART_BASE_ADDRESS: usize = 0x900_0000;
pub const UART_BASE_ADDRESS: *mut u32 = 0x900_0000 as _;

/// The base address of the first 8250 UART.
#[cfg(platform = "crosvm")]
pub const UART_BASE_ADDRESS: usize = 0x3f8;
pub const UART_BASE_ADDRESS: *mut u32 = 0x3f8 as _;

#[global_allocator]
static HEAP_ALLOCATOR: LockedHeap<32> = LockedHeap::new();
Expand Down
61 changes: 0 additions & 61 deletions examples/aarch64/src/pl011.rs

This file was deleted.

4 changes: 2 additions & 2 deletions examples/aarch64/src/uart8250.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ impl Uart {
/// The given base address must point to the 8 MMIO control registers of an appropriate UART
/// device, which must be mapped into the address space of the process as device memory and not
/// have any other aliases.
pub unsafe fn new(base_address: usize) -> Self {
pub unsafe fn new(base_address: *mut u32) -> Self {
Self {
base_address: base_address as *mut u8,
base_address: base_address.cast(),
}
}

Expand Down
Loading