EFI default console support
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
parent
09e4edc026
commit
9d7491c732
@ -8,6 +8,7 @@ include_directories(
|
||||
|
||||
# Specify list of source code files
|
||||
list(APPEND XTLDR_SOURCE
|
||||
${XTLDR_SOURCE_DIR}/console.c
|
||||
${XTLDR_SOURCE_DIR}/xtldr.c)
|
||||
|
||||
# Add executable
|
||||
|
75
xtldr/console.c
Normal file
75
xtldr/console.c
Normal file
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtldr/console.c
|
||||
* DESCRIPTION: EFI console support
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <xtbl.h>
|
||||
|
||||
|
||||
/**
|
||||
* This routine clears the UEFI console screen.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
VOID
|
||||
BlConsoleClearScreen()
|
||||
{
|
||||
EfiSystemTable->ConOut->ClearScreen(EfiSystemTable->ConOut);
|
||||
}
|
||||
|
||||
/**
|
||||
* This routine initializes the EFI console.
|
||||
*
|
||||
* @return This routine returns status code.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
EFI_STATUS
|
||||
BlConsoleInitialize()
|
||||
{
|
||||
/* Check the console support */
|
||||
if(!EfiSystemTable->ConOut)
|
||||
{
|
||||
return STATUS_EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/* Clear console buffers */
|
||||
EfiSystemTable->ConIn->Reset(EfiSystemTable->ConIn, TRUE);
|
||||
EfiSystemTable->ConOut->Reset(EfiSystemTable->ConOut, TRUE);
|
||||
EfiSystemTable->StdErr->Reset(EfiSystemTable->StdErr, TRUE);
|
||||
|
||||
/* Clear screen */
|
||||
BlConsoleClearScreen();
|
||||
|
||||
/* Enable cursor */
|
||||
EfiSystemTable->ConOut->EnableCursor(EfiSystemTable->ConOut, TRUE);
|
||||
|
||||
/* Return success */
|
||||
return STATUS_EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a character to the default EFI console.
|
||||
*
|
||||
* @param Character
|
||||
* The integer promotion of the character to be written.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
VOID
|
||||
BlConsolePutChar(IN USHORT Character)
|
||||
{
|
||||
USHORT Buffer[2];
|
||||
|
||||
/* Write character to the screen console */
|
||||
Buffer[0] = Character;
|
||||
Buffer[1] = 0;
|
||||
EfiSystemTable->ConOut->OutputString(EfiSystemTable->ConOut, Buffer);
|
||||
}
|
@ -18,6 +18,15 @@ EXTERN EFI_HANDLE EfiImageHandle;
|
||||
/* EFI System Table */
|
||||
EXTERN EFI_SYSTEM_TABLE *EfiSystemTable;
|
||||
|
||||
VOID
|
||||
BlConsoleClearScreen();
|
||||
|
||||
EFI_STATUS
|
||||
BlConsoleInitialize();
|
||||
|
||||
VOID
|
||||
BlConsolePutChar(IN USHORT Character);
|
||||
|
||||
EFI_STATUS
|
||||
XtLoaderStartup(IN EFI_HANDLE ImageHandle,
|
||||
IN PEFI_SYSTEM_TABLE SystemTable);
|
||||
|
@ -32,10 +32,20 @@ EFI_STATUS
|
||||
XtLoaderStartup(IN EFI_HANDLE ImageHandle,
|
||||
IN PEFI_SYSTEM_TABLE SystemTable)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
/* Set the system table and image handle */
|
||||
EfiImageHandle = ImageHandle;
|
||||
EfiSystemTable = SystemTable;
|
||||
|
||||
/* Initialize EFI console */
|
||||
Status = BlConsoleInitialize();
|
||||
if(Status != STATUS_EFI_SUCCESS) {
|
||||
/* TODO: Display error message on the serial console */
|
||||
/* Temporarily return error code */
|
||||
return STATUS_EFI_INCOMPATIBLE_VERSION;
|
||||
}
|
||||
|
||||
/* Infinite bootloader loop */
|
||||
for(;;);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user