48#define EIO_FAILED __einfo_error ( EINFO_EIO_FAILED )
49#define EINFO_EIO_FAILED \
50 __einfo_uniqify ( EINFO_EIO, 0x01, \
51 "Function call failed" )
52#define EIO_HARDWARE __einfo_error ( EINFO_EIO_HARDWARE )
53#define EINFO_EIO_HARDWARE \
54 __einfo_uniqify ( EINFO_EIO, 0x02, \
55 "Not supported in current configuration" )
56#define EIO_MODE __einfo_error ( EINFO_EIO_MODE )
57#define EINFO_EIO_MODE \
58 __einfo_uniqify ( EINFO_EIO, 0x03, \
59 "Invalid in current video mode" )
60#define EIO_VBE( code ) \
61 EUNIQ ( EINFO_EIO, (code), EIO_FAILED, EIO_HARDWARE, EIO_MODE )
67#if ( defined ( CONSOLE_FRAMEBUFFER ) && ! defined ( CONSOLE_VESAFB ) )
68#define CONSOLE_VESAFB CONSOLE_FRAMEBUFFER
70#if ! ( defined ( CONSOLE_VESAFB ) && CONSOLE_EXPLICIT ( CONSOLE_VESAFB ) )
72#define CONSOLE_VESAFB ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
76#define VESAFB_CHAR_HEIGHT 16
79#define VESAFB_FONT VBE_FONT_8x16
82#define VESAFB_ASCII 128
88#define VESAFB_UNKNOWN 0xfe
122#define vbe_buf __use_data16 ( vbe_buf )
133 if ( (
status & 0xff ) != 0x4f )
184 "movw %%es, %%cx\n\t"
185 "movw %%bp, %%dx\n\t"
191 DBGC ( &
vbe_buf,
"VESAFB has font %04x at %04x:%04x\n",
215 *mode_numbers =
NULL;
223 :
"memory",
"ebx",
"edx" );
225 DBGC ( &
vbe_buf,
"VESAFB could not get controller information: "
230 DBGC ( &
vbe_buf,
"VESAFB invalid controller signature "
231 "\"%c%c%c%c\"\n", (
controller->vbe_signature >> 0 ),
238 DBGC ( &
vbe_buf,
"VESAFB found VBE version %d.%d with mode list at "
249 len = ( ( (
const void * ) mode_number ) -
254 if ( ! *mode_numbers )
280 DBGC ( &
vbe_buf,
"VESAFB could not get mode %04x information: "
284 DBGC ( &
vbe_buf,
"VESAFB mode %04x %dx%d %dbpp(%d:%d:%d:%d) model "
285 "%02x [x%d]%s%s%s%s%s\n", mode_number,
mode->x_resolution,
286 mode->y_resolution,
mode->bits_per_pixel,
mode->rsvd_mask_size,
287 mode->red_mask_size,
mode->green_mask_size,
mode->blue_mask_size,
288 mode->memory_model, (
mode->number_of_image_pages + 1 ),
290 "" :
" [unsupported]" ),
296 "" :
" [nonlinear]" ),
324 DBGC ( &
vbe_buf,
"VESAFB mode %04x has frame buffer at %08x\n",
325 mode_number,
mode->phys_base_ptr );
339 "b" ( mode_number ) );
341 DBGC ( &
vbe_buf,
"VESAFB could not set mode %04x: [%04x] %s\n",
359 unsigned int min_width,
unsigned int min_height,
360 unsigned int min_bpp ) {
362 int best_mode_number = -
ENOENT;
363 unsigned int best_score =
INT_MAX;
369 while ( ( mode_number = *(mode_numbers++) ) !=
VBE_MODE_END ) {
390 if ( (
mode->x_resolution < min_width ) ||
391 (
mode->y_resolution < min_height ) ||
392 (
mode->bits_per_pixel < min_bpp ) ) {
402 score = ( (
mode->x_resolution *
mode->y_resolution ) -
403 mode->bits_per_pixel );
404 if ( score < best_score ) {
405 best_mode_number = mode_number;
410 if ( best_mode_number >= 0 ) {
414 DBGC ( &
vbe_buf,
"VESAFB found no suitable mode\n" );
417 return best_mode_number;
431 DBGC ( &
vbe_buf,
"VESAFB restored VGA mode %#02x\n",
460 config->
depth ) ) < 0 ) {
462 goto err_select_mode;
478 free ( mode_numbers );
486 free ( mode_numbers );
524 if ( ! vesafb_console.disabled ) {
532 if ( ( config ==
NULL ) ||
533 ( config->
width == 0 ) || ( config->
height == 0 ) ) {
542 vesafb_console.disabled = 0;
#define NULL
NULL pointer (VOID *)
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
static unsigned int code
Response code.
__asm__ __volatile__("call *%9" :"=a"(result), "=c"(discard_ecx), "=d"(discard_edx) :"d"(0), "a"(code), "b"(0), "c"(in_phys), "D"(0), "S"(out_phys), "m"(hypercall))
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.
uint8_t controller
CD-ROM controller number.
#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 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.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define REAL_CODE(asm_code_str)
#define __bss16(variable)
#define __from_data16(pointer)
void * malloc(size_t size)
Allocate memory.
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
static __always_inline void * real_to_virt(unsigned int segment, unsigned int offset)
Convert segment:offset address to virtual address.
static void(* free)(struct refcnt *refcnt))
char * strerror(int errno)
Retrieve string representation of error number.
struct pixel_buffer * pixbuf
Background picture, if any.
unsigned int height
Height.
unsigned int depth
Colour depth.
A frame buffer colour mapping.
uint8_t blue_scale
Blue scale (right shift amount from 24-bit RGB)
uint8_t blue_lsb
Blue LSB.
uint8_t green_lsb
Green LSB.
uint8_t green_scale
Green scale (right shift amount from 24-bit RGB)
uint8_t red_scale
Red scale (right shift amount from 24-bit RGB)
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)
VBE controller information.
struct fbcon fbcon
Frame buffer console.
physaddr_t start
Physical start address.
struct fbcon_geometry pixel
Pixel geometry.
struct fbcon_colour_map map
Colour mapping.
const uint8_t * glyphs
Character glyphs.
uint8_t saved_mode
Saved VGA mode.
struct fbcon_font font
Font definition.
Base memory buffer used for VBE calls.
struct vbe_controller_info controller
VBE controller information block.
struct vbe_mode_info mode
VBE mode information block.
struct console_driver bios_console
#define VESAFB_FONT
Font corresponding to selected character width and height.
static int vesafb_init(struct console_configuration *config)
Initialise VESA frame buffer.
static int vesafb_set_mode(unsigned int mode_number)
Set video mode.
static int vesafb_select_mode(const uint16_t *mode_numbers, unsigned int min_width, unsigned int min_height, unsigned int min_bpp)
Select video mode.
static int vesafb_mode_list(uint16_t **mode_numbers)
Get VBE mode list.
#define VESAFB_UNKNOWN
Glyph to render for non-ASCII characters.
#define VESAFB_ASCII
Number of ASCII glyphs within the font.
static const uint8_t * vesafb_glyph(unsigned int character)
Get character glyph.
#define VESAFB_CHAR_HEIGHT
Character height.
static int vesafb_rc(unsigned int status)
Convert VBE status code to iPXE status code.
static void vesafb_fini(void)
Finalise VESA frame buffer.
static int vesafb_configure(struct console_configuration *config)
Configure console.
static void vesafb_font(void)
Get font definition.
static int vesafb_mode_info(unsigned int mode_number)
Get video mode information.
static void vesafb_putchar(int character)
Print a character to current cursor position.
static void vesafb_restore(void)
Restore video mode.
VESA frame buffer console.
#define VBE_SET_MODE
INT 10,4f02: set VBE mode.
#define VBE_MODE_LINEAR
VBE linear frame buffer mode bit.
#define VBE_MODE_INFO
INT 10,4f01: return VBE mode information.
#define VBE_GET_VGA_MODE
INT 10,0f: get VGA mode.
#define VBE_SET_VGA_MODE
INT 10,00: set VGA mode.
struct segoff video_mode_ptr
Pointer to video mode list.
#define VBE_CONTROLLER_INFO
INT 10,4f00: return controller information.
@ VBE_MODE_ATTR_TTY
TTY output functions supported by BIOS.
@ VBE_MODE_ATTR_GRAPHICS
Graphics mode.
@ VBE_MODE_ATTR_LINEAR
Linear frame buffer mode is available.
@ VBE_MODE_ATTR_TRIPLE_BUF
Hardware triple buffering support.
@ VBE_MODE_ATTR_SUPPORTED
Mode supported in hardware.
#define VBE_CONTROLLER_SIGNATURE
VBE controller information signature.
#define VBE_GET_FONT
INT 10,1130: get font information.
@ VBE_MODE_MODEL_DIRECT_COLOUR
Direct colour mode.
#define VBE_MODE_END
VBE mode list end marker.