58 #if ( defined ( CONSOLE_FRAMEBUFFER ) && ! defined ( CONSOLE_EFIFB ) ) 59 #define CONSOLE_EFIFB CONSOLE_FRAMEBUFFER 61 #if ! ( defined ( CONSOLE_EFIFB ) && CONSOLE_EXPLICIT ( CONSOLE_EFIFB ) ) 63 #define CONSOLE_EFIFB ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG ) 67 #define EFIFB_ASCII 128 70 #define EFIFB_DYNAMIC 32 114 unsigned int toggle ) {
135 DBGC ( &
efifb,
"EFIFB could not get glyph %#02x: %s\n",
142 if ( blt->
Width > 8 ) {
143 DBGC ( &
efifb,
"EFIFB glyph %#02x invalid width %d\n",
144 character, blt->
Width );
154 for (
x = 0 ;
x < blt->
Width ;
x++ ) {
155 bitmask = rol8 ( bitmask, 1 );
161 *(glyph++) = bitmask;
208 DBGC2 ( &
efifb,
"EFIFB dynamic %#02x is glyph %#02x\n",
253 unsigned int character;
267 for ( character = 0 ; character <
EFIFB_ASCII ; character++ ) {
285 DBGC ( &
efifb,
"EFIFB could not get font height\n" );
300 for ( character = 0 ; character <
EFIFB_ASCII ; character++ ) {
303 if ( !
isprint ( character ) ) {
309 height =
efifb_draw ( character, character, 0 );
342 *lsb = ( mask ? (
ffs ( mask ) - 1 ) : 0 );
343 *scale = ( mask ? ( 8 - (
fls ( mask ) - *lsb ) ) : 8 );
346 check = ( ( 0xff >> *scale ) << *lsb );
363 0x000000ffUL, 0x0000ff00UL, 0x00ff0000UL, 0xff000000UL
366 0x00ff0000UL, 0x0000ff00UL, 0x000000ffUL, 0xff000000UL
374 switch (
info->PixelFormat ) {
382 mask = &
info->PixelInformation;
385 DBGC ( &
efifb,
"EFIFB unrecognised pixel format %d\n",
392 &
map->red_lsb ) ) != 0 )
395 &
map->green_lsb ) ) != 0 )
398 &
map->blue_lsb ) ) != 0 )
401 &reserved_lsb ) ) != 0 )
405 return ( 32 - ( reserved_scale +
map->red_scale +
map->green_scale +
418 unsigned int min_bpp ) {
422 int best_mode_number = -
ENOENT;
423 unsigned int best_score =
INT_MAX;
438 DBGC ( &
efifb,
"EFIFB could not get mode %d " 447 DBGC ( &
efifb,
"EFIFB could not build colour map for " 453 if ( (
info->HorizontalResolution < min_width ) ||
454 (
info->VerticalResolution < min_height ) ||
455 ( ( (
unsigned int ) bpp ) < min_bpp ) ) {
456 goto err_requirements;
465 score = ( (
info->HorizontalResolution *
466 info->VerticalResolution ) - bpp );
467 if ( score < best_score ) {
468 best_mode_number =
mode;
479 if ( best_mode_number < 0 )
480 DBGC ( &
efifb,
"EFIFB found no suitable mode\n" );
481 return best_mode_number;
497 DBGC ( &
efifb,
"EFIFB could not restore mode %d: %s\n",
524 DBGC ( &
efifb,
"EFIFB could not locate graphics output " 534 DBGC ( &
efifb,
"EFIFB could not locate HII font protocol: %s\n",
536 goto err_locate_hiifont;
549 config->
depth ) ) < 0 ) {
551 goto err_select_mode;
557 DBGC ( &
efifb,
"EFIFB could not set mode %d: %s\n",
567 DBGC ( &
efifb,
"EFIFB could not build colour map for " 580 DBGC ( &
efifb,
"EFIFB using mode %d (%dx%d %dbpp at %#08lx)\n",
640 if ( ! efifb_console.disabled ) {
648 if ( ( config ==
NULL ) ||
649 ( config->
width == 0 ) || ( config->
height == 0 ) ) {
658 efifb_console.disabled = 0;
static __always_inline void ufree(void *ptr)
Free external memory.
unsigned int height
Character height (in pixels)
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
#define EINVAL
Invalid argument.
The Pixel definition of the physical frame buffer.
struct arbelprm_rc_send_wqe rc
EFI_GUID efi_hii_font_protocol_guid
HII font protocol GUID.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
unsigned int height
Height.
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE * Mode
Pointer to EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE data.
static int efifb_init(struct console_configuration *config)
Initialise EFI frame buffer.
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.
#define EFIFB_ASCII
Number of ASCII glyphs in cache.
EFI_LOCATE_PROTOCOL LocateProtocol
EFI_HII_GET_GLYPH GetGlyph
static int efifb_configure(struct console_configuration *config)
Configure console.
uint16_t mode
Acceleration mode.
EFI_GUID efi_graphics_output_protocol_guid
Graphics output protocol GUID.
struct fbcon fbcon
Frame buffer console.
unsigned int width
Width (number of entities per displayed row)
#define CONSOLE_DISABLED
Console is disabled for all uses.
uint16_t size
Buffer size.
static int efifb_glyphs(void)
Get character glyphs.
struct fbcon_geometry pixel
Pixel geometry.
static void efifb_fini(void)
Finalise EFI frame buffer.
#define ENOENT
No such file or directory.
void fbcon_putchar(struct fbcon *fbcon, int character)
Print a character to current cursor position.
static int efifb_select_mode(unsigned int min_width, unsigned int min_height, unsigned int min_bpp)
Select video mode.
static unsigned int efifb_dynamic(unsigned int character)
Get dynamic glyph index.
unsigned int depth
Colour depth.
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION * Info
Pointer to read-only EFI_GRAPHICS_OUTPUT_MODE_INFORMATION data.
A pixel is 32-bits and byte zero represents blue, byte one represents green, byte two represents red,...
int usage
Console usage bitmask.
#define ENOTSUP
Operation not supported.
static int isprint(int character)
Check if character is printable.
struct fbcon_colour_map map
Colour mapping.
EFI_GRAPHICS_OUTPUT_PROTOCOL * gop
EFI graphics output protocol.
EFI_GRAPHICS_OUTPUT_BLT_PIXEL * Bitmap
#define CONSOLE_DISABLED_OUTPUT
Console is disabled for output.
EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode
#define ENOMEM
Not enough space.
Provides a basic abstraction to set video modes and copy pixels to and from the graphics controller's...
size_t len
Length of a single entity.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct console_driver efifb_console __console_driver
EFI graphics output protocol console driver.
Access to external ("user") memory.
union _EFI_IMAGE_OUTPUT::@581 Image
unsigned int dynamic[EFIFB_DYNAMIC]
Dynamic characters in cache.
#define EFIFB_DYNAMIC
Number of dynamic non-ASCII glyphs in cache.
A frame buffer colour mapping.
A 16-bit general register.
static int efifb_draw(unsigned int character, unsigned int index, unsigned int toggle)
Draw character glyph.
struct fbcon_font font
Font definition.
struct console_driver efi_console
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode
void fbcon_fini(struct fbcon *fbcon)
Finalise frame buffer console.
static int efifb_draw_unknown(unsigned int index)
Draw "unknown character" glyph.
char * strerror(int errno)
Retrieve string representation of error number.
unsigned int next
Next dynamic character cache entry to evict.
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_colour_map(EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info, struct fbcon_colour_map *map)
Generate colour mapping.
UINT64 UINTN
Unsigned value of native width.
A pixel is 32-bits and byte zero represents red, byte one represents green, byte two represents blue,...
UINT32 MaxMode
The number of modes supported by QueryMode() and SetMode().
EFI_PHYSICAL_ADDRESS FrameBufferBase
Base address of graphics linear frame buffer.
void ansicol_set_magic_transparent(void)
Set magic colour to transparent.
#define ffs(x)
Find first (i.e.
static void efifb_putchar(int character)
Print a character to current cursor position.
UINT32 Mode
Current Mode of the graphics device.
Graphics Output Protocol from the UEFI 2.0 specification.
static const uint8_t * efifb_glyph(unsigned int character)
Get character glyph.
int disabled
Console disabled flags.
static __always_inline int struct dma_mapping * map
const uint8_t *(* glyph)(unsigned int character)
Get character glyph.
void ansicol_reset_magic(void)
Reset magic colour.
The protocol provides the service to retrieve the font informations.
unsigned int height
Height (number of entities per displayed column)
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
struct pixel_buffer * pixbuf
Background picture, if any.
static __always_inline void * umalloc(size_t size)
Allocate external memory.
static unsigned int unsigned int y
EFI_SYSTEM_TABLE * efi_systab
#define fls(x)
Find last (i.e.
UINT32 saved_mode
Saved mode.
The file provides services to retrieve font information.
uint8_t * glyphs
Character glyph cache.
#define NULL
NULL pointer (VOID *)
size_t stride
Stride (offset between vertically adjacent entities)
EFI_HII_FONT_PROTOCOL * hiifont
EFI HII font protocol.
Definition of EFI_IMAGE_OUTPUT.
static int efifb_restore(void)
Restore video mode.
void * memset(void *dest, int character, size_t len) __nonnull
physaddr_t start
Physical start address.