Initialize framebuffer device based on a system resource provided by boot loader
This commit is contained in:
parent
8a15d46198
commit
41bc673694
@ -101,6 +101,10 @@ XTAPI
|
|||||||
XTSTATUS
|
XTSTATUS
|
||||||
HlInitializeFrameBuffer(VOID)
|
HlInitializeFrameBuffer(VOID)
|
||||||
{
|
{
|
||||||
|
PSYSTEM_RESOURCE_FRAMEBUFFER FrameBufferResource;
|
||||||
|
PSYSTEM_RESOURCE_HEADER SystemResource;
|
||||||
|
XTSTATUS Status;
|
||||||
|
|
||||||
/* Check if display already initialized */
|
/* Check if display already initialized */
|
||||||
if(HlpFrameBufferData.Initialized)
|
if(HlpFrameBufferData.Initialized)
|
||||||
{
|
{
|
||||||
@ -108,19 +112,29 @@ HlInitializeFrameBuffer(VOID)
|
|||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if framebuffer initialized by bootloader */
|
/* Get FrameBuffer system resource */
|
||||||
if(!KeInitializationBlock->LoaderInformation.FrameBuffer.Initialized ||
|
Status = KeGetSystemResource(SystemResourceFrameBuffer, &SystemResource);
|
||||||
!KeInitializationBlock->LoaderInformation.FrameBuffer.Address)
|
if(Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Display not initialized */
|
/* Resource not found */
|
||||||
|
return STATUS_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cast system resource to FrameBuffer resource */
|
||||||
|
FrameBufferResource = (PSYSTEM_RESOURCE_FRAMEBUFFER)SystemResource;
|
||||||
|
|
||||||
|
/* Check if bootloader provided a framebuffer address */
|
||||||
|
if(!FrameBufferResource->Header.VirtualAddress)
|
||||||
|
{
|
||||||
|
/* Display probably not initialized */
|
||||||
return STATUS_DEVICE_NOT_READY;
|
return STATUS_DEVICE_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if custom font provided by bootloader */
|
/* Check if bootloader provided a custom font */
|
||||||
if(KeInitializationBlock->LoaderInformation.FrameBuffer.Font)
|
if(FrameBufferResource->Font)
|
||||||
{
|
{
|
||||||
/* Use custom font */
|
/* Use custom font */
|
||||||
HlpFrameBufferData.Font = KeInitializationBlock->LoaderInformation.FrameBuffer.Font;
|
HlpFrameBufferData.Font = FrameBufferResource->Font;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -129,20 +143,20 @@ HlInitializeFrameBuffer(VOID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Save framebuffer information and mark display as initialized */
|
/* Save framebuffer information and mark display as initialized */
|
||||||
HlpFrameBufferData.Address = KeInitializationBlock->LoaderInformation.FrameBuffer.Address;
|
HlpFrameBufferData.Address = FrameBufferResource->Header.VirtualAddress;
|
||||||
HlpFrameBufferData.Width = KeInitializationBlock->LoaderInformation.FrameBuffer.Width;
|
HlpFrameBufferData.Width = FrameBufferResource->Width;
|
||||||
HlpFrameBufferData.Height = KeInitializationBlock->LoaderInformation.FrameBuffer.Height;
|
HlpFrameBufferData.Height = FrameBufferResource->Height;
|
||||||
HlpFrameBufferData.BitsPerPixel = KeInitializationBlock->LoaderInformation.FrameBuffer.BitsPerPixel;
|
HlpFrameBufferData.BitsPerPixel = FrameBufferResource->BitsPerPixel;
|
||||||
HlpFrameBufferData.PixelsPerScanLine = KeInitializationBlock->LoaderInformation.FrameBuffer.PixelsPerScanLine;
|
HlpFrameBufferData.PixelsPerScanLine = FrameBufferResource->PixelsPerScanLine;
|
||||||
HlpFrameBufferData.Pitch = KeInitializationBlock->LoaderInformation.FrameBuffer.Pitch;
|
HlpFrameBufferData.Pitch = FrameBufferResource->Pitch;
|
||||||
HlpFrameBufferData.Pixels.BlueShift = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.BlueShift;
|
HlpFrameBufferData.Pixels.BlueShift = FrameBufferResource->Pixels.BlueShift;
|
||||||
HlpFrameBufferData.Pixels.BlueSize = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.BlueSize;
|
HlpFrameBufferData.Pixels.BlueSize = FrameBufferResource->Pixels.BlueSize;
|
||||||
HlpFrameBufferData.Pixels.GreenShift = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.GreenShift;
|
HlpFrameBufferData.Pixels.GreenShift = FrameBufferResource->Pixels.GreenShift;
|
||||||
HlpFrameBufferData.Pixels.GreenSize = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.GreenSize;
|
HlpFrameBufferData.Pixels.GreenSize = FrameBufferResource->Pixels.GreenSize;
|
||||||
HlpFrameBufferData.Pixels.RedShift = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.RedShift;
|
HlpFrameBufferData.Pixels.RedShift = FrameBufferResource->Pixels.RedShift;
|
||||||
HlpFrameBufferData.Pixels.RedSize = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.RedSize;
|
HlpFrameBufferData.Pixels.RedSize = FrameBufferResource->Pixels.RedSize;
|
||||||
HlpFrameBufferData.Pixels.ReservedShift = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.ReservedShift;
|
HlpFrameBufferData.Pixels.ReservedShift = FrameBufferResource->Pixels.ReservedShift;
|
||||||
HlpFrameBufferData.Pixels.ReservedSize = KeInitializationBlock->LoaderInformation.FrameBuffer.Pixels.ReservedSize;
|
HlpFrameBufferData.Pixels.ReservedSize = FrameBufferResource->Pixels.ReservedSize;
|
||||||
HlpFrameBufferData.Initialized = TRUE;
|
HlpFrameBufferData.Initialized = TRUE;
|
||||||
|
|
||||||
/* Clear screen */
|
/* Clear screen */
|
||||||
|
Loading…
Reference in New Issue
Block a user