diff --git a/Pixel3XL/Library/InMemorySerialPortLib/InMemorySerialPortLib.c b/Pixel3XL/Library/InMemorySerialPortLib/InMemorySerialPortLib.c index b1c3b7a..542b1db 100644 --- a/Pixel3XL/Library/InMemorySerialPortLib/InMemorySerialPortLib.c +++ b/Pixel3XL/Library/InMemorySerialPortLib/InMemorySerialPortLib.c @@ -33,9 +33,23 @@ SerialPortInitialize ( VOID ) { + UINT8* base = (UINT8*)0xa1a10000ull; + for (UINTN i = 0; i < 0x200000; i++) { + base[i] = 0; + } return RETURN_SUCCESS; } +static void mem_putchar(UINT8 c) { + static const UINTN size = 0x200000; + static UINTN offset = 0; + UINT8* base = (UINT8*)0xa1a10000ull; + base[offset++] = c; + if (offset >= size) { + offset = 0; + } +} + /** Write data from buffer to serial device. @@ -60,7 +74,10 @@ SerialPortWrite ( IN UINTN NumberOfBytes ) { - return 0; + for (UINTN i = 0; i < NumberOfBytes; i++) { + mem_putchar(Buffer[i]); + } + return NumberOfBytes; } diff --git a/Pixel3XL/Pixel3XL.dsc b/Pixel3XL/Pixel3XL.dsc index f8c5b2e..10fcc4f 100644 --- a/Pixel3XL/Pixel3XL.dsc +++ b/Pixel3XL/Pixel3XL.dsc @@ -43,7 +43,7 @@ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf - SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf + SerialPortLib|Pixel3XL/Library/InMemorySerialPortLib/InMemorySerialPortLib.inf RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf