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;
unsigned int height
Character height (in pixels)
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
static const uint8_t * vesafb_glyph(unsigned int character)
Get character glyph.
unsigned int height
Height.
static union vbe_buffer __bss16(vbe_buf)
Base memory buffer used for VBE calls.
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.
VBE controller information.
uint8_t green_lsb
Green LSB.
static int vesafb_init(struct console_configuration *config)
Initialise VESA frame buffer.
#define VBE_MODE_INFO
INT 10,4f01: return VBE mode information.
uint16_t mode
Acceleration mode.
unsigned int width
Width (number of entities per displayed row)
#define CONSOLE_DISABLED
Console is disabled for all uses.
#define VESAFB_FONT
Font corresponding to selected character width and height.
static int vesafb_configure(struct console_configuration *config)
Configure console.
#define VBE_MODE_LINEAR
VBE linear frame buffer mode bit.
#define VESAFB_CHAR_HEIGHT
Character height.
#define ENOENT
No such file or directory.
struct segoff video_mode_ptr
Pointer to video mode list.
void fbcon_putchar(struct fbcon *fbcon, int character)
Print a character to current cursor position.
static void vesafb_putchar(int character)
Print a character to current cursor position.
struct fbcon fbcon
Frame buffer console.
#define VBE_SET_VGA_MODE
INT 10,00: set VGA mode.
unsigned int depth
Colour depth.
static unsigned int code
Response code.
int usage
Console usage bitmask.
#define ENOTSUP
Operation not supported.
static __always_inline void * real_to_virt(unsigned int segment, unsigned int offset)
Convert segment:offset address to virtual address.
#define VBE_MODE_END
VBE mode list end marker.
#define CONSOLE_DISABLED_OUTPUT
Console is disabled for output.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
Linear frame buffer mode is available.
uint8_t saved_mode
Saved VGA mode.
uint8_t red_scale
Red scale (right shift amount from 24-bit RGB)
size_t len
Length of a single entity.
#define VESAFB_UNKNOWN
Glyph to render for non-ASCII characters.
A frame buffer colour mapping.
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.
A 16-bit general register.
#define VBE_GET_VGA_MODE
INT 10,0f: get VGA mode.
struct console_driver vesafb_console __console_driver
VESA frame buffer console driver.
struct console_driver bios_console
static int vesafb_mode_info(unsigned int mode_number)
Get video mode information.
void fbcon_fini(struct fbcon *fbcon)
Finalise frame buffer console.
physaddr_t start
Physical start address.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
#define VBE_GET_FONT
INT 10,1130: get font information.
struct fbcon_font font
Font definition.
uint8_t green_scale
Green scale (right shift amount from 24-bit RGB)
__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))
TTY output functions supported by BIOS.
struct fbcon_geometry pixel
Pixel geometry.
static void vesafb_font(void)
Get font definition.
void ansicol_set_magic_transparent(void)
Set magic colour to transparent.
struct vbe_controller_info controller
VBE controller information block.
void * malloc(size_t size)
Allocate memory.
uint8_t blue_scale
Blue scale (right shift amount from 24-bit RGB)
VESA frame buffer console.
#define VBE_CONTROLLER_INFO
INT 10,4f00: return controller information.
#define VBE_CONTROLLER_SIGNATURE
VBE controller information signature.
__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")
uint8_t controller
CD-ROM controller number.
int disabled
Console disabled flags.
const uint8_t *(* glyph)(unsigned int character)
Get character glyph.
void ansicol_reset_magic(void)
Reset magic colour.
#define __from_data16(pointer)
Hardware triple buffering support.
static int vesafb_set_mode(unsigned int mode_number)
Set video mode.
unsigned int height
Height (number of entities per displayed column)
Mode supported in hardware.
struct pixel_buffer * pixbuf
Background picture, if any.
#define VESAFB_ASCII
Number of ASCII glyphs within the font.
static void vesafb_restore(void)
Restore video mode.
#define VBE_SET_MODE
INT 10,4f02: set VBE mode.
uint8_t blue_lsb
Blue LSB.
struct vbe_mode_info mode
VBE mode information block.
static int vesafb_rc(unsigned int status)
Convert VBE status code to iPXE status code.
static void vesafb_fini(void)
Finalise VESA frame buffer.
struct fbcon_colour_map map
Colour mapping.
const uint8_t * glyphs
Character glyphs.
#define REAL_CODE(asm_code_str)
#define NULL
NULL pointer (VOID *)
size_t stride
Stride (offset between vertically adjacent entities)
static int vesafb_mode_list(uint16_t **mode_numbers)
Get VBE mode list.