Skip to content

Commit 3d7f72e

Browse files
authored
Merge pull request #580 from phip1611/bump-uart
deps: bump uart_16550 to 0.8.0 + fix UEFI weirdness
2 parents 610301b + 954b18b commit 3d7f72e

37 files changed

Lines changed: 188 additions & 329 deletions

File tree

‎Cargo.lock‎

Lines changed: 38 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ members = [
1919
"tests/runner",
2020
]
2121
exclude = ["examples/basic", "examples/test_framework", "tests/test_kernels/"]
22+
resolver = "3"
2223

2324
[workspace.package]
2425
# don't forget to update `workspace.dependencies` below

‎Changelog.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Unreleased
22

3+
- When booting on UEFI, whatever is written to the UEFI console
4+
(e.g., via the SIMPLE_TEXT_OUTPUT_PROTOCOL) is no longer replicated to the
5+
serial device. The bootloader's own logger now takes full ownership of the
6+
serial device, ensuring safe and reliable logging.
7+
38
# 0.11.17 - 2026-07-27
49

510
* [Revert `uart_16550` version bump to 0.6.0](https://github.com/rust-osdev/bootloader/pull/575)

‎common/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ xmas-elf = "0.8.0"
1919
raw-cpuid = "10.2.0"
2020
rand = { version = "0.8.6", default-features = false }
2121
rand_hc = "0.3.1"
22-
uart_16550 = "0.3.2"
22+
uart_16550 = "0.8.0"
2323
log = "0.4.17"
2424

2525
[dependencies.noto-sans-mono-bitmap]

‎common/src/lib.rs‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ pub mod level_4_entries;
3434
pub mod load_kernel;
3535
/// Provides a logger that logs output as text in various formats.
3636
pub mod logger;
37-
/// Provides a type that logs output as text to a Serial Being port.
38-
pub mod serial;
3937

4038
const PAGE_SIZE: u64 = 4096;
4139

‎common/src/logger.rs‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
use crate::{framebuffer::FrameBufferWriter, serial::SerialPort};
1+
use crate::framebuffer::FrameBufferWriter;
22
use bootloader_api::info::FrameBufferInfo;
33
use conquer_once::spin::OnceCell;
44
use core::fmt::Write;
55
use spinning_top::Spinlock;
6+
use uart_16550::backend::PioBackend;
7+
use uart_16550::{Config, Uart16550Tty};
68

79
/// The global logger instance used for the `log` crate.
810
pub static LOGGER: OnceCell<LockedLogger> = OnceCell::uninit();
911

1012
/// A logger instance protected by a spinlock.
1113
pub struct LockedLogger {
1214
framebuffer: Option<Spinlock<FrameBufferWriter>>,
13-
serial: Option<Spinlock<SerialPort>>,
15+
serial: Option<Spinlock<Uart16550Tty<PioBackend>>>,
1416
}
1517

1618
impl LockedLogger {
@@ -27,7 +29,17 @@ impl LockedLogger {
2729
};
2830

2931
let serial = match serial_logger_status {
30-
true => Some(Spinlock::new(unsafe { SerialPort::init() })),
32+
true => {
33+
// SAFETY: We have exclusive access to the device.
34+
//
35+
// This returns `None` if the config is invalid or the self-test fails.
36+
// We do not panic here because we want to continue booting.
37+
unsafe {
38+
Uart16550Tty::new_port(0x3f8, Config::default())
39+
.ok()
40+
.map(Spinlock::new)
41+
}
42+
}
3143
false => None,
3244
};
3345

‎common/src/serial.rs‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)