/** @file
This module install ACPI Boot Graphics Resource Table (BGRT).
Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Uefi.h>
#include <IndustryStandard/Acpi50.h>
#include <IndustryStandard/Bmp.h>
#include <Protocol/AcpiTable.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/BootLogo.h>
#include <Guid/EventGroup.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>
//
// ACPI table information used to initialize tables.
//
//
// Module globals.
//
'B', // CharB
'M', // CharM
0, // Size will be updated at runtime
{0, 0}, // Reserved
sizeof (BMP_IMAGE_HEADER), // ImageOffset
0, // PixelWidth will be updated at runtime
0, // PixelHeight will be updated at runtime
1, // Planes
24, // BitPerPixel
0, // CompressionType
0, // ImageSize will be updated at runtime
0, // XPixelsPerMeter
0, // YPixelsPerMeter
0, // NumberOfColors
0 // ImportantColors
};
{
EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_REVISION, // Revision
0x00, // Checksum will be updated at runtime
//
// It is expected that these values will be updated at runtime.
//
EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field
EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long)
EFI_ACPI_OEM_REVISION, // OEM revision number
EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID
EFI_ACPI_CREATOR_REVISION, // ASL compiler revision number
},
EFI_ACPI_5_0_BGRT_VERSION, // Version
EFI_ACPI_5_0_BGRT_STATUS_VALID, // Status
EFI_ACPI_5_0_BGRT_IMAGE_TYPE_BMP, // Image Type
0, // Image Address
0, // Image Offset X
0 // Image Offset Y
};
/**
Update information of logo image drawn on screen.
@param This The pointer to the Boot Logo protocol instance.
@param BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer
is set to NULL, it indicates that logo image is no
longer on the screen.
@param DestinationX X coordinate of destination for the BltBuffer.
@param DestinationY Y coordinate of destination for the BltBuffer.
@param Width Width of rectangle in BltBuffer in pixels.
@param Height Hight of rectangle in BltBuffer in pixels.
@retval EFI_SUCCESS The boot logo information was updated.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
@retval EFI_OUT_OF_RESOURCES The logo information was not updated due to
insufficient memory resources.
**/
);
/**
Update information of logo image drawn on screen.
@param This The pointer to the Boot Logo protocol instance.
@param BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer
is set to NULL, it indicates that logo image is no
longer on the screen.
@param DestinationX X coordinate of destination for the BltBuffer.
@param DestinationY Y coordinate of destination for the BltBuffer.
@param Width Width of rectangle in BltBuffer in pixels.
@param Height Hight of rectangle in BltBuffer in pixels.
@retval EFI_SUCCESS The boot logo information was updated.
@retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
@retval EFI_OUT_OF_RESOURCES The logo information was not updated due to
insufficient memory resources.
**/
)
{
return EFI_SUCCESS;
}
return EFI_INVALID_PARAMETER;
}
if (mLogoBltBuffer != NULL) {
}
//
// Ensure the Height * Width doesn't overflow
//
return EFI_UNSUPPORTED;
}
//
// Ensure the BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow
//
return EFI_UNSUPPORTED;
}
);
if (mLogoBltBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
mLogoWidth = Width;
mIsLogoValid = TRUE;
return EFI_SUCCESS;
}
/**
This function calculates and updates an UINT8 checksum.
@param[in] Buffer Pointer to buffer to checksum.
@param[in] Size Number of bytes to checksum.
**/
)
{
//
// Set checksum to 0 first.
//
Buffer[ChecksumOffset] = 0;
//
// Update checksum value.
//
}
/**
Allocate EfiReservedMemoryType below 4G memory address.
This function allocates EfiReservedMemoryType below 4G memory address.
@param[in] Size Size of memory to allocate.
@return Allocated address for output.
**/
VOID *
)
{
Address = 0xffffffff;
);
return Buffer;
}
/**
Install Boot Graphics Resource Table to ACPI table.
@return Status code.
**/
)
{
//
// Get ACPI Table protocol.
//
return Status;
}
//
// Check whether Boot Graphics Resource Table is already installed.
//
if (mAcpiBgrtInstalled) {
if (!mAcpiBgrtStatusChanged && !mAcpiBgrtBufferChanged) {
//
// Nothing has changed
//
return EFI_SUCCESS;
} else {
//
// If BGRT data change happens. Uninstall Orignal AcpiTable first
//
);
return Status;
}
}
} else {
//
// Check whether Logo exist.
//
if ( mLogoBltBuffer == NULL) {
return EFI_NOT_FOUND;
}
}
if (mAcpiBgrtBufferChanged) {
//
// reserve original BGRT buffer size
//
//
// Free orignal BMP memory
//
}
//
// Allocate memory for BMP file.
//
//
// First check mLogoWidth * 3 + PaddingSize doesn't overflow
//
return EFI_UNSUPPORTED;
}
//
// Second check (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP_IMAGE_HEADER) doesn't overflow
//
return EFI_UNSUPPORTED;
}
if (ImageBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
//
// Convert BLT buffer to BMP file.
//
BltPixel++;
}
//
// Padding for 4 byte alignment.
//
Image += PaddingSize;
}
}
mBootGraphicsResourceTableTemplate.Status = (UINT8) (mIsLogoValid ? EFI_ACPI_5_0_BGRT_STATUS_VALID : EFI_ACPI_5_0_BGRT_STATUS_INVALID);
//
// Update Checksum.
//
BgrtAcpiTableChecksum ((UINT8 *) &mBootGraphicsResourceTableTemplate, sizeof (EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE));
//
// Publish Boot Graphics Resource Table.
//
);
return Status;
}
return Status;
}
/**
Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is used to
install the Boot Graphics Resource Table.
@param[in] Event The Event that is being processed.
@param[in] Context The Event Context.
**/
)
{
}
/**
The module Entry Point of the Boot Graphics Resource Table DXE driver.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval Other Some error occurs when executing this entry point.
**/
)
{
//
// Install Boot Logo protocol.
//
);
//
// Register notify function to install BGRT on ReadyToBoot Event.
//
NULL,
);
return Status;
}