[fix] Serial & PFPrint

This commit is contained in:
2026-05-24 19:48:37 +08:00
Unverified
parent 4fc02d296f
commit 2c17e426c1
4 changed files with 35 additions and 57 deletions
-5
View File
@@ -1,7 +1,5 @@
#include <serial.h>
#include <efilib.h>
#include <fonts/pixel_font.h>
#include <BUILD_INFOS.h>
serial_context g_serial;
@@ -11,14 +9,12 @@ void serial_init(EFI_SERIAL_IO_PROTOCOL *SerialIo) {
}
void serial_write_char(char c) {
// 不要直接调用,ENABLE_SERIAL_PRINTS有问题,因此不会打印DEBUG
if (!g_serial.SerialIo) {
uefi_call_wrapper((void*)ST->ConOut->OutputString, 2, ST->ConOut, L"serial: null io\n");
return;
}
UINTN size = 1;
EFI_STATUS status = uefi_call_wrapper((void*)g_serial.SerialIo->Write, 3, g_serial.SerialIo, &size, &c);
// if (ENABLE_SERIAL_PRINTS) pf_print((const char*) c);
if (status != EFI_SUCCESS) {
uefi_call_wrapper((void*)ST->ConOut->OutputString, 2, ST->ConOut, L"serial: write failed\n");
}
@@ -29,7 +25,6 @@ void serial_write(const char *str) {
uefi_call_wrapper((void*)ST->ConOut->OutputString, 2, ST->ConOut, L"serial: null io\n");
return;
}
if (ENABLE_SERIAL_PRINTS) pf_print(str);
while (*str) {
serial_write_char(*str++);
}