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 )
186 "movw %%es, %%cx\n\t" 187 "movw %%bp, %%dx\n\t" 193 DBGC ( &
vbe_buf,
"VESAFB has font %04x at %04x:%04x\n",
216 *mode_numbers =
NULL;
224 :
"memory",
"ebx",
"edx" );
226 DBGC ( &
vbe_buf,
"VESAFB could not get controller information: " 231 DBGC ( &
vbe_buf,
"VESAFB invalid controller signature " 232 "\"%c%c%c%c\"\n", (
controller->vbe_signature >> 0 ),
239 DBGC ( &
vbe_buf,
"VESAFB found VBE version %d.%d with mode list at " 251 sizeof ( mode_number ) );
252 len +=
sizeof ( mode_number );
257 if ( ! *mode_numbers )
283 DBGC ( &
vbe_buf,
"VESAFB could not get mode %04x information: " 287 DBGC ( &
vbe_buf,
"VESAFB mode %04x %dx%d %dbpp(%d:%d:%d:%d) model " 288 "%02x [x%d]%s%s%s%s%s\n", mode_number, mode->
x_resolution,
293 "" :
" [unsupported]" ),
299 "" :
" [nonlinear]" ),
327 DBGC ( &
vbe_buf,
"VESAFB mode %04x has frame buffer at %08x\n",
342 "b" ( mode_number ) );
344 DBGC ( &
vbe_buf,
"VESAFB could not set mode %04x: [%04x] %s\n",
362 unsigned int min_width,
unsigned int min_height,
363 unsigned int min_bpp ) {
365 int best_mode_number = -
ENOENT;
366 unsigned int best_score =
INT_MAX;
372 while ( ( mode_number = *(mode_numbers++) ) !=
VBE_MODE_END ) {
407 if ( score < best_score ) {
408 best_mode_number = mode_number;
413 if ( best_mode_number >= 0 ) {
417 DBGC ( &
vbe_buf,
"VESAFB found no suitable mode\n" );
420 return best_mode_number;
434 DBGC ( &
vbe_buf,
"VESAFB restored VGA mode %#02x\n",
463 config->
depth ) ) < 0 ) {
465 goto err_select_mode;
481 free ( mode_numbers );
489 free ( mode_numbers );
527 if ( ! vesafb_console.disabled ) {
535 if ( ( config ==
NULL ) ||
536 ( config->
width == 0 ) || ( config->
height == 0 ) ) {
545 vesafb_console.disabled = 0;
unsigned int height
Character height (in pixels)
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
uint8_t blue_field_position
Bit position of LSB of blue mask.
unsigned int height
Height.
static union vbe_buffer __bss16(vbe_buf)
Base memory buffer used for VBE calls.
uint8_t red_mask_size
Size of direct colour red mask in bits.
uint8_t bits_per_pixel
Bits per pixel.
uint8_t memory_model
Memory model type.
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.
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 __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
uint16_t y_resolution
Vertical resolution in pixels or characters.
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.
uint32_t phys_base_ptr
Physical address for flat memory frame buffer.
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.
userptr_t phys_to_user(unsigned long phys_addr)
Convert physical address to user pointer.
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.
void(* glyph)(unsigned int character, uint8_t *glyph)
Get character glyph.
unsigned int depth
Colour depth.
static unsigned int code
Response code.
int usage
Console usage bitmask.
#define ENOTSUP
Operation not supported.
#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.
Linear frame buffer mode is available.
uint32_t userptr_t
A pointer to a user buffer.
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
int fbcon_init(struct fbcon *fbcon, userptr_t start, struct fbcon_geometry *pixel, struct fbcon_colour_map *map, struct fbcon_font *font, struct console_configuration *config)
Initialise frame buffer console.
uint8_t number_of_image_pages
Number of images.
static void vesafb_glyph(unsigned int character, uint8_t *glyph)
Get character glyph.
uint8_t rsvd_mask_size
Size of direct colour reserved mask in bits.
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.
uint8_t green_mask_size
Size of direct colour green mask in bits.
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.
uint16_t mode_attributes
Mode attributes.
void * malloc(size_t size)
Allocate memory.
uint8_t blue_mask_size
Size of direct colour blue mask in bits.
uint8_t blue_scale
Blue scale (right shift amount from 24-bit RGB)
VESA frame buffer console.
struct segoff glyphs
Character glyphs.
#define VBE_CONTROLLER_INFO
INT 10,4f00: return controller information.
uint16_t bytes_per_scan_line
Bytes per scan line.
#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.
uint16_t x_resolution
Horizontal resolution in pixels or characters.
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 __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
static int vesafb_rc(unsigned int status)
Convert VBE status code to iPXE status code.
uint16_t offset
Offset to command line.
static void vesafb_fini(void)
Finalise VESA frame buffer.
struct fbcon_colour_map map
Colour mapping.
uint8_t red_field_position
Bit position of LSB of red mask.
#define REAL_CODE(asm_code_str)
#define NULL
NULL pointer (VOID *)
uint8_t green_field_position
Bit position of LSB of green mask.
size_t stride
Stride (offset between vertically adjacent entities)
static int vesafb_mode_list(uint16_t **mode_numbers)
Get VBE mode list.