diff --git a/sdk/xtdk/bltypes.h b/sdk/xtdk/bltypes.h index c441a01..e20e2b9 100644 --- a/sdk/xtdk/bltypes.h +++ b/sdk/xtdk/bltypes.h @@ -121,7 +121,7 @@ typedef EFI_STATUS (*PBL_EXECIMAGE_RELOCATE_IMAGE)(IN PVOID ImagePointer, IN EFI typedef EFI_STATUS (*PBL_EXECIMAGE_UNLOAD_IMAGE)(IN PVOID ImagePointer); typedef EFI_STATUS (*PBL_EXECIMAGE_VERIFY_IMAGE)(IN PVOID ImagePointer); typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_DISPLAY_DRIVER)(OUT PEFI_GRAPHICS_PROTOCOL Protocol); -typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_DISPLAY_INFORMATION)(OUT PXTBL_FRAMEBUFFER_INFORMATION FbInfo); +typedef EFI_STATUS (*PBL_FRAMEBUFFER_GET_DISPLAY_INFORMATION)(OUT PEFI_PHYSICAL_ADDRESS FrameBufferBase, OUT PULONG_PTR FrameBufferSize, OUT PXTBL_FRAMEBUFFER_MODE_INFORMATION ModeInfo); typedef EFI_STATUS (*PBL_FRAMEBUFFER_INITIALIZE)(); typedef EFI_STATUS (*PBL_FRAMEBUFFER_SET_SCREEN_RESOLUTION)(IN UINT Width, IN UINT Height); @@ -246,6 +246,31 @@ typedef struct _XTBL_STATUS CPPORT SerialPort; } XTBL_STATUS, *PXTBL_STATUS; +/* XT framebuffer video mode information structure definition */ +typedef struct _XTBL_FRAMEBUFFER_MODE_INFORMATION +{ + UINT Width; + UINT Height; + UINT Depth; + UINT RefreshRate; + UINT BitsPerPixel; + UINT BytesPerPixel; + UINT PixelsPerScanLine; + UINT Pitch; + EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; + struct + { + USHORT BlueMask; + USHORT BlueShift; + USHORT GreenMask; + USHORT GreenShift; + USHORT RedMask; + USHORT RedShift; + USHORT ReservedMask; + USHORT ReservedShift; + } PixelInformation; +} XTBL_FRAMEBUFFER_MODE_INFORMATION, *PXTBL_FRAMEBUFFER_MODE_INFORMATION; + /* XT framebuffer information structure definition */ typedef struct _XTBL_FRAMEBUFFER_INFORMATION { @@ -259,29 +284,7 @@ typedef struct _XTBL_FRAMEBUFFER_INFORMATION PEFI_GRAPHICS_OUTPUT_PROTOCOL Gop; PEFI_UNIVERSAL_GRAPHICS_ADAPTER_PROTOCOL Uga; } Driver; - struct - { - UINT Width; - UINT Height; - UINT Depth; - UINT RefreshRate; - UINT BitsPerPixel; - UINT BytesPerPixel; - UINT PixelsPerScanLine; - UINT Pitch; - EFI_GRAPHICS_PIXEL_FORMAT PixelFormat; - struct - { - USHORT BlueMask; - USHORT BlueShift; - USHORT GreenMask; - USHORT GreenShift; - USHORT RedMask; - USHORT RedShift; - USHORT ReservedMask; - USHORT ReservedShift; - } PixelInformation; - } ModeInfo; + XTBL_FRAMEBUFFER_MODE_INFORMATION ModeInfo; } XTBL_FRAMEBUFFER_INFORMATION, *PXTBL_FRAMEBUFFER_INFORMATION; /* XTLDR ACPI protocol structure */ diff --git a/sdk/xtdk/xtfw.h b/sdk/xtdk/xtfw.h index ca518e7..b40be10 100644 --- a/sdk/xtdk/xtfw.h +++ b/sdk/xtdk/xtfw.h @@ -94,7 +94,6 @@ typedef struct _FIRMWARE_INFORMATION_BLOCK typedef struct _LOADER_GRAPHICS_INFORMATION_BLOCK { BOOLEAN Initialized; - EFI_GRAPHICS_PROTOCOL Protocol; PVOID Address; ULONG_PTR BufferSize; UINT Width; diff --git a/sdk/xtdk/xtstruct.h b/sdk/xtdk/xtstruct.h index ba4d612..002db7e 100644 --- a/sdk/xtdk/xtstruct.h +++ b/sdk/xtdk/xtstruct.h @@ -289,6 +289,7 @@ typedef struct _XTBL_CONFIG_SECTION XTBL_CONFIG_SECTION, *PXTBL_CONFIG_SECTION; typedef struct _XTBL_DIALOG_HANDLE XTBL_DIALOG_HANDLE, *PXTBL_DIALOG_HANDLE; typedef struct _XTBL_EXECUTABLE_IMAGE_PROTOCOL XTBL_EXECUTABLE_IMAGE_PROTOCOL, *PXTBL_EXECUTABLE_IMAGE_PROTOCOL; typedef struct _XTBL_FRAMEBUFFER_INFORMATION XTBL_FRAMEBUFFER_INFORMATION, *PXTBL_FRAMEBUFFER_INFORMATION; +typedef struct _XTBL_FRAMEBUFFER_MODE_INFORMATION XTBL_FRAMEBUFFER_MODE_INFORMATION, *PXTBL_FRAMEBUFFER_MODE_INFORMATION; typedef struct _XTBL_FRAMEBUFFER_PROTOCOL XTBL_FRAMEBUFFER_PROTOCOL, *PXTBL_FRAMEBUFFER_PROTOCOL; typedef struct _XTBL_KNOWN_BOOT_PROTOCOL XTBL_KNOWN_BOOT_PROTOCOL, *PXTBL_KNOWN_BOOT_PROTOCOL; typedef struct _XTBL_LOADER_PROTOCOL XTBL_LOADER_PROTOCOL, *PXTBL_LOADER_PROTOCOL; diff --git a/xtldr/modules/framebuf/framebuf.c b/xtldr/modules/framebuf/framebuf.c index 4dd6c52..57eef90 100644 --- a/xtldr/modules/framebuf/framebuf.c +++ b/xtldr/modules/framebuf/framebuf.c @@ -55,7 +55,9 @@ FbGetDisplayDriver(OUT PEFI_GRAPHICS_PROTOCOL Protocol) */ XTCDECL EFI_STATUS -FbGetDisplayInformation(OUT PXTBL_FRAMEBUFFER_INFORMATION FbInfo) +FbGetDisplayInformation(OUT PEFI_PHYSICAL_ADDRESS FrameBufferBase, + OUT PULONG_PTR FrameBufferSize, + OUT PXTBL_FRAMEBUFFER_MODE_INFORMATION ModeInfo) { /* Check if framebuffer is initialized */ if(!FbpDisplayInfo.Initialized) @@ -64,19 +66,21 @@ FbGetDisplayInformation(OUT PXTBL_FRAMEBUFFER_INFORMATION FbInfo) return STATUS_EFI_NOT_READY; } - /* Copy framebuffer information */ - FbInfo->ModeInfo.BitsPerPixel = FbpDisplayInfo.ModeInfo.BitsPerPixel; - FbInfo->ModeInfo.BytesPerPixel = FbpDisplayInfo.ModeInfo.BytesPerPixel; - FbInfo->ModeInfo.PixelFormat = FbpDisplayInfo.ModeInfo.PixelFormat; - FbInfo->ModeInfo.PixelInformation = FbpDisplayInfo.ModeInfo.PixelInformation; - FbInfo->ModeInfo.PixelsPerScanLine = FbpDisplayInfo.ModeInfo.PixelsPerScanLine; - FbInfo->ModeInfo.Width = FbpDisplayInfo.ModeInfo.Width; - FbInfo->ModeInfo.Height = FbpDisplayInfo.ModeInfo.Height; - FbInfo->ModeInfo.Pitch = FbpDisplayInfo.ModeInfo.Pitch; - FbInfo->FrameBufferBase = FbpDisplayInfo.FrameBufferBase; - FbInfo->FrameBufferSize = FbpDisplayInfo.FrameBufferSize; - FbInfo->Protocol = FbpDisplayInfo.Protocol; - FbInfo->Initialized = FbpDisplayInfo.Initialized; + /* Set basic framebuffer information */ + *FrameBufferBase = FbpDisplayInfo.FrameBufferBase; + *FrameBufferSize = FbpDisplayInfo.FrameBufferSize; + + /* Set framebuffer mode information */ + ModeInfo->Width = FbpDisplayInfo.ModeInfo.Width; + ModeInfo->Height = FbpDisplayInfo.ModeInfo.Height; + ModeInfo->Depth = FbpDisplayInfo.ModeInfo.Depth; + ModeInfo->RefreshRate = FbpDisplayInfo.ModeInfo.RefreshRate; + ModeInfo->BitsPerPixel = FbpDisplayInfo.ModeInfo.BitsPerPixel; + ModeInfo->BytesPerPixel = FbpDisplayInfo.ModeInfo.BytesPerPixel; + ModeInfo->PixelsPerScanLine = FbpDisplayInfo.ModeInfo.PixelsPerScanLine; + ModeInfo->Pitch = FbpDisplayInfo.ModeInfo.Pitch; + ModeInfo->PixelFormat = FbpDisplayInfo.ModeInfo.PixelFormat; + ModeInfo->PixelInformation = FbpDisplayInfo.ModeInfo.PixelInformation; /* Return success */ return STATUS_EFI_SUCCESS; diff --git a/xtldr/modules/framebuf/includes/framebuf.h b/xtldr/modules/framebuf/includes/framebuf.h index 4253861..f93605c 100644 --- a/xtldr/modules/framebuf/includes/framebuf.h +++ b/xtldr/modules/framebuf/includes/framebuf.h @@ -20,7 +20,9 @@ FbGetDisplayDriver(OUT PEFI_GRAPHICS_PROTOCOL Protocol); XTCDECL EFI_STATUS -FbGetDisplayInformation(OUT PXTBL_FRAMEBUFFER_INFORMATION FbInfo); +FbGetDisplayInformation(OUT PEFI_PHYSICAL_ADDRESS FrameBufferBase, + OUT PULONG_PTR FrameBufferSize, + OUT PXTBL_FRAMEBUFFER_MODE_INFORMATION ModeInfo); XTCDECL EFI_STATUS diff --git a/xtldr/modules/xtos_o/xtos.c b/xtldr/modules/xtos_o/xtos.c index 0ad41e8..05e1b2f 100644 --- a/xtldr/modules/xtos_o/xtos.c +++ b/xtldr/modules/xtos_o/xtos.c @@ -38,17 +38,18 @@ XTBL_BOOT_PROTOCOL XtBootProtocol; XTCDECL VOID XtGetDisplayInformation(OUT PLOADER_GRAPHICS_INFORMATION_BLOCK InformationBlock, - IN PXTBL_FRAMEBUFFER_INFORMATION FrameBufferInfo) + IN PEFI_PHYSICAL_ADDRESS FrameBufferBase, + IN PULONG_PTR FrameBufferSize, + IN PXTBL_FRAMEBUFFER_MODE_INFORMATION FrameBufferModeInfo) { - InformationBlock->Initialized = FrameBufferInfo->Initialized; - InformationBlock->Protocol = FrameBufferInfo->Protocol; - InformationBlock->Address = (PVOID)FrameBufferInfo->FrameBufferBase; - InformationBlock->BufferSize = FrameBufferInfo->FrameBufferSize; - InformationBlock->Width = FrameBufferInfo->ModeInfo.Width; - InformationBlock->Height = FrameBufferInfo->ModeInfo.Height; - InformationBlock->BitsPerPixel = FrameBufferInfo->ModeInfo.BitsPerPixel; - InformationBlock->PixelsPerScanLine = FrameBufferInfo->ModeInfo.PixelsPerScanLine; - InformationBlock->Pitch = FrameBufferInfo->ModeInfo.Pitch; + InformationBlock->Initialized = TRUE; + InformationBlock->Address = (PVOID)*FrameBufferBase; + InformationBlock->BufferSize = *FrameBufferSize; + InformationBlock->Width = FrameBufferModeInfo->Width; + InformationBlock->Height = FrameBufferModeInfo->Height; + InformationBlock->BitsPerPixel = FrameBufferModeInfo->BitsPerPixel; + InformationBlock->PixelsPerScanLine = FrameBufferModeInfo->PixelsPerScanLine; + InformationBlock->Pitch = FrameBufferModeInfo->Pitch; } XTCDECL @@ -417,10 +418,11 @@ XtpInitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap, { EFI_GUID FrameBufGuid = XT_FRAMEBUFFER_PROTOCOL_GUID; PXTBL_FRAMEBUFFER_PROTOCOL FrameBufProtocol; - PXTBL_FRAMEBUFFER_INFORMATION FrameBufInfo = NULL; + XTBL_FRAMEBUFFER_MODE_INFORMATION FbModeInfo; PKERNEL_INITIALIZATION_BLOCK LoaderBlock; - EFI_PHYSICAL_ADDRESS Address; + EFI_PHYSICAL_ADDRESS Address, FbAddress; // PVOID RuntimeServices; + ULONG_PTR FbSize; EFI_STATUS Status; EFI_HANDLE ProtocolHandle; UINT BlockPages, FrameBufferPages; @@ -453,16 +455,17 @@ XtpInitializeLoaderBlock(IN PXTBL_PAGE_MAPPING PageMap, if(Status == STATUS_EFI_SUCCESS) { /* Get FrameBuffer information */ - FrameBufProtocol->GetDisplayInformation(FrameBufInfo); - - /* Store information about FrameBuffer device */ - XtGetDisplayInformation(&LoaderBlock->LoaderInformation.FrameBuffer, FrameBufInfo); + Status = FrameBufProtocol->GetDisplayInformation(&FbAddress, &FbSize, &FbModeInfo); + if(Status == STATUS_EFI_SUCCESS) + { + /* Store information about FrameBuffer device */ + XtGetDisplayInformation(&LoaderBlock->LoaderInformation.FrameBuffer, &FbAddress, &FbSize, &FbModeInfo); + } } - else + if(Status != STATUS_EFI_SUCCESS) { /* No FrameBuffer available */ LoaderBlock->LoaderInformation.FrameBuffer.Initialized = FALSE; - LoaderBlock->LoaderInformation.FrameBuffer.Protocol = NONE; } /* Close FrameBuffer protocol */