59#if ( defined ( CONSOLE_FRAMEBUFFER ) && ! defined ( CONSOLE_EFIFB ) )
60#define CONSOLE_EFIFB CONSOLE_FRAMEBUFFER
62#if ! ( defined ( CONSOLE_EFIFB ) && CONSOLE_EXPLICIT ( CONSOLE_EFIFB ) )
64#define CONSOLE_EFIFB ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
68#define EFIFB_ASCII 128
71#define EFIFB_DYNAMIC 32
115 unsigned int toggle ) {
136 DBGC ( &
efifb,
"EFIFB could not get glyph %#02x: %s\n",
143 if ( blt->
Width > 8 ) {
144 DBGC ( &
efifb,
"EFIFB glyph %#02x invalid width %d\n",
145 character, blt->
Width );
155 for (
x = 0 ;
x < blt->
Width ;
x++ ) {
156 bitmask = rol8 ( bitmask, 1 );
162 *(glyph++) = bitmask;
209 DBGC2 ( &
efifb,
"EFIFB dynamic %#02x is glyph %#02x\n",
254 unsigned int character;
268 for ( character = 0 ; character <
EFIFB_ASCII ; character++ ) {
286 DBGC ( &
efifb,
"EFIFB could not get font height\n" );
301 for ( character = 0 ; character <
EFIFB_ASCII ; character++ ) {
304 if ( !
isprint ( character ) ) {
310 height =
efifb_draw ( character, character, 0 );
343 *lsb = ( mask ? (
ffs ( mask ) - 1 ) : 0 );
344 *scale = ( mask ? ( 8 - (
fls ( mask ) - *lsb ) ) : 8 );
347 check = ( ( 0xff >> *scale ) << *lsb );
364 0x000000ffUL, 0x0000ff00UL, 0x00ff0000UL, 0xff000000UL
367 0x00ff0000UL, 0x0000ff00UL, 0x000000ffUL, 0xff000000UL
375 switch (
info->PixelFormat ) {
383 mask = &
info->PixelInformation;
386 DBGC ( &
efifb,
"EFIFB unrecognised pixel format %d\n",
393 &
map->red_lsb ) ) != 0 )
396 &
map->green_lsb ) ) != 0 )
399 &
map->blue_lsb ) ) != 0 )
402 &reserved_lsb ) ) != 0 )
406 return ( 32 - ( reserved_scale +
map->red_scale +
map->green_scale +
419 unsigned int min_bpp ) {
423 int best_mode_number = -
ENOENT;
424 unsigned int best_score =
INT_MAX;
439 DBGC ( &
efifb,
"EFIFB could not get mode %d "
448 DBGC ( &
efifb,
"EFIFB could not build colour map for "
454 if ( (
info->HorizontalResolution < min_width ) ||
455 (
info->VerticalResolution < min_height ) ||
456 ( ( (
unsigned int ) bpp ) < min_bpp ) ) {
457 goto err_requirements;
466 score = ( (
info->HorizontalResolution *
467 info->VerticalResolution ) - bpp );
468 if ( score < best_score ) {
469 best_mode_number =
mode;
480 if ( best_mode_number < 0 )
481 DBGC ( &
efifb,
"EFIFB found no suitable mode\n" );
482 return best_mode_number;
498 DBGC ( &
efifb,
"EFIFB could not restore mode %d: %s\n",
525 DBGC ( &
efifb,
"EFIFB could not locate graphics output "
535 DBGC ( &
efifb,
"EFIFB could not locate HII font protocol: %s\n",
537 goto err_locate_hiifont;
550 config->
depth ) ) < 0 ) {
552 goto err_select_mode;
558 DBGC ( &
efifb,
"EFIFB could not set mode %d: %s\n",
568 DBGC ( &
efifb,
"EFIFB could not build colour map for "
581 DBGC ( &
efifb,
"EFIFB using mode %d (%dx%d %dbpp at %#08lx)\n",
641 if ( ! efifb_console.disabled ) {
649 if ( ( config ==
NULL ) ||
650 ( config->
width == 0 ) || ( config->
height == 0 ) ) {
659 efifb_console.disabled = 0;
UINT64 UINTN
Unsigned value of native width.
unsigned int UINT32
4-byte unsigned value.
#define NULL
NULL pointer (VOID *)
Graphics Output Protocol from the UEFI 2.0 specification.
@ PixelBitMask
The Pixel definition of the physical frame buffer.
@ PixelRedGreenBlueReserved8BitPerColor
A pixel is 32-bits and byte zero represents red, byte one represents green, byte two represents blue,...
@ PixelBlueGreenRedReserved8BitPerColor
A pixel is 32-bits and byte zero represents blue, byte one represents green, byte two represents red,...
struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL
The file provides services to retrieve font information.
struct _EFI_HII_FONT_PROTOCOL EFI_HII_FONT_PROTOCOL
struct _EFI_IMAGE_OUTPUT EFI_IMAGE_OUTPUT
Definition of EFI_IMAGE_OUTPUT.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
void ansicol_set_magic_transparent(void)
Set magic colour to transparent.
void ansicol_reset_magic(void)
Reset magic colour.
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
static int isprint(int character)
Check if character is printable.
static void efifb_fini(void)
Finalise EFI frame buffer.
#define EFIFB_DYNAMIC
Number of dynamic non-ASCII glyphs in cache.
static int efifb_glyphs(void)
Get character glyphs.
static int efifb_colour_map_mask(uint32_t mask, uint8_t *scale, uint8_t *lsb)
Generate colour mapping for a single colour component.
static int efifb_draw_unknown(unsigned int index)
Draw "unknown character" glyph.
static void efifb_putchar(int character)
Print a character to current cursor position.
#define EFIFB_ASCII
Number of ASCII glyphs in cache.
static int efifb_init(struct console_configuration *config)
Initialise EFI frame buffer.
static unsigned int efifb_dynamic(unsigned int character)
Get dynamic glyph index.
static int efifb_draw(unsigned int character, unsigned int index, unsigned int toggle)
Draw character glyph.
static const uint8_t * efifb_glyph(unsigned int character)
Get character glyph.
static int efifb_restore(void)
Restore video mode.
static int efifb_select_mode(unsigned int min_width, unsigned int min_height, unsigned int min_bpp)
Select video mode.
static int efifb_configure(struct console_configuration *config)
Configure console.
struct console_driver efi_console
static int efifb_colour_map(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info, struct fbcon_colour_map *map)
Generate colour mapping.
EFI_GUID efi_graphics_output_protocol_guid
Graphics output protocol GUID.
EFI_GUID efi_hii_font_protocol_guid
HII font protocol GUID.
uint16_t mode
Acceleration mode.
int fbcon_init(struct fbcon *fbcon, void *start, struct fbcon_geometry *pixel, struct fbcon_colour_map *map, struct fbcon_font *font, struct console_configuration *config)
Initialise frame buffer console.
void fbcon_fini(struct fbcon *fbcon)
Finalise frame buffer console.
void fbcon_putchar(struct fbcon *fbcon, int character)
Print a character to current cursor position.
uint16_t size
Buffer size.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ENOENT
No such file or directory.
#define EINVAL
Invalid argument.
#define ENOMEM
Not enough space.
#define ENOTSUP
Operation not supported.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define CONSOLE_DISABLED
Console is disabled for all uses.
#define CONSOLE_DISABLED_OUTPUT
Console is disabled for output.
#define __console_driver
Mark a struct console_driver as being part of the console drivers table.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
EFI_SYSTEM_TABLE * efi_systab
static __always_inline void * umalloc(size_t size)
Allocate external memory.
static __always_inline void ufree(void *ptr)
Free external memory.
void * memset(void *dest, int character, size_t len) __nonnull
#define fls(x)
Find last (i.e.
#define ffs(x)
Find first (i.e.
static __always_inline int struct dma_mapping * map
Access to external ("user") memory.
static unsigned int unsigned int y
char * strerror(int errno)
Retrieve string representation of error number.
EFI_LOCATE_PROTOCOL LocateProtocol
UINT32 Mode
Current Mode of the graphics device.
EFI_PHYSICAL_ADDRESS FrameBufferBase
Base address of graphics linear frame buffer.
UINT32 MaxMode
The number of modes supported by QueryMode() and SetMode().
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info
Pointer to read-only EFI_GRAPHICS_OUTPUT_MODE_INFORMATION data.
EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.
EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode
EFI_HII_GET_GLYPH GetGlyph
union _EFI_IMAGE_OUTPUT::@027206233250216234376274121372340236112234347110 Image
EFI_GRAPHICS_OUTPUT_BLT_PIXEL * Bitmap
struct pixel_buffer * pixbuf
Background picture, if any.
unsigned int height
Height.
unsigned int depth
Colour depth.
unsigned int dynamic[EFIFB_DYNAMIC]
Dynamic characters in cache.
uint8_t * glyphs
Character glyph cache.
EFI_GRAPHICS_OUTPUT_PROTOCOL * gop
EFI graphics output protocol.
UINT32 saved_mode
Saved mode.
unsigned int next
Next dynamic character cache entry to evict.
EFI_HII_FONT_PROTOCOL * hiifont
EFI HII font protocol.
struct fbcon_font font
Font definition.
struct fbcon_colour_map map
Colour mapping.
struct fbcon_geometry pixel
Pixel geometry.
struct fbcon fbcon
Frame buffer console.
physaddr_t start
Physical start address.
A frame buffer colour mapping.
unsigned int height
Character height (in pixels)
const uint8_t *(* glyph)(unsigned int character)
Get character glyph.
unsigned int height
Height (number of entities per displayed column)
size_t len
Length of a single entity.
unsigned int width
Width (number of entities per displayed row)
size_t stride
Stride (offset between vertically adjacent entities)