diff options
Diffstat (limited to 'src/device')
-rw-r--r-- | src/device/oprom/realmode/x86.c | 52 | ||||
-rw-r--r-- | src/device/oprom/yabel/vbe.c | 50 |
2 files changed, 38 insertions, 64 deletions
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c index d230d5cbea..6b80ac5f62 100644 --- a/src/device/oprom/realmode/x86.c +++ b/src/device/oprom/realmode/x86.c @@ -12,6 +12,7 @@ #include <pc80/i8254.h> #include <string.h> #include <vbe.h> +#include <framebuffer_info.h> /* we use x86emu's register file representation */ #include <x86emu/regs.h> @@ -208,11 +209,6 @@ static void setup_realmode_idt(void) static vbe_mode_info_t mode_info; static int mode_info_valid; -static int vbe_mode_info_valid(void) -{ - return mode_info_valid; -} - const vbe_mode_info_t *vbe_mode_info(void) { if (!mode_info_valid || !mode_info.vesa.phys_base_ptr) @@ -351,6 +347,24 @@ void vbe_set_graphics(void) } vbe_set_mode(&mode_info); + const struct lb_framebuffer fb = { + .physical_address = mode_info.vesa.phys_base_ptr, + .x_resolution = le16_to_cpu(mode_info.vesa.x_resolution), + .y_resolution = le16_to_cpu(mode_info.vesa.y_resolution), + .bytes_per_line = le16_to_cpu(mode_info.vesa.bytes_per_scanline), + .bits_per_pixel = mode_info.vesa.bits_per_pixel, + .red_mask_pos = mode_info.vesa.red_mask_pos, + .red_mask_size = mode_info.vesa.red_mask_size, + .green_mask_pos = mode_info.vesa.green_mask_pos, + .green_mask_size = mode_info.vesa.green_mask_size, + .blue_mask_pos = mode_info.vesa.blue_mask_pos, + .blue_mask_size = mode_info.vesa.blue_mask_size, + .reserved_mask_pos = mode_info.vesa.reserved_mask_pos, + .reserved_mask_size = mode_info.vesa.reserved_mask_size, + .orientation = LB_FB_ORIENTATION_NORMAL, + }; + + fb_add_framebuffer_info_ex(&fb); } void vbe_textmode_console(void) @@ -362,34 +376,6 @@ void vbe_textmode_console(void) die("\nError: In %s function\n", __func__); } -int fill_lb_framebuffer(struct lb_framebuffer *framebuffer) -{ - if (!vbe_mode_info_valid()) - return -1; - - framebuffer->physical_address = mode_info.vesa.phys_base_ptr; - - framebuffer->x_resolution = le16_to_cpu(mode_info.vesa.x_resolution); - framebuffer->y_resolution = le16_to_cpu(mode_info.vesa.y_resolution); - framebuffer->bytes_per_line = - le16_to_cpu(mode_info.vesa.bytes_per_scanline); - framebuffer->bits_per_pixel = mode_info.vesa.bits_per_pixel; - - framebuffer->red_mask_pos = mode_info.vesa.red_mask_pos; - framebuffer->red_mask_size = mode_info.vesa.red_mask_size; - - framebuffer->green_mask_pos = mode_info.vesa.green_mask_pos; - framebuffer->green_mask_size = mode_info.vesa.green_mask_size; - - framebuffer->blue_mask_pos = mode_info.vesa.blue_mask_pos; - framebuffer->blue_mask_size = mode_info.vesa.blue_mask_size; - - framebuffer->reserved_mask_pos = mode_info.vesa.reserved_mask_pos; - framebuffer->reserved_mask_size = mode_info.vesa.reserved_mask_size; - - return 0; -} - #endif void run_bios(struct device *dev, unsigned long addr) diff --git a/src/device/oprom/yabel/vbe.c b/src/device/oprom/yabel/vbe.c index a3d736fa93..5f03e19261 100644 --- a/src/device/oprom/yabel/vbe.c +++ b/src/device/oprom/yabel/vbe.c @@ -33,6 +33,7 @@ *****************************************************************************/ #include <boot/coreboot_tables.h> +#include <framebuffer_info.h> #include <string.h> #include <types.h> @@ -163,11 +164,6 @@ vbe_info(vbe_info_t * info) static int mode_info_valid; -static int vbe_mode_info_valid(void) -{ - return mode_info_valid; -} - // VBE Function 01h static u8 vbe_get_mode_info(vbe_mode_info_t * mode_info) @@ -747,33 +743,25 @@ void vbe_set_graphics(void) mode_info.video_mode = (1 << 14) | CONFIG_FRAMEBUFFER_VESA_MODE; vbe_get_mode_info(&mode_info); vbe_set_mode(&mode_info); -} - -int fill_lb_framebuffer(struct lb_framebuffer *framebuffer) -{ - if (!vbe_mode_info_valid()) - return -1; - framebuffer->physical_address = le32_to_cpu(mode_info.vesa.phys_base_ptr); - - framebuffer->x_resolution = le16_to_cpu(mode_info.vesa.x_resolution); - framebuffer->y_resolution = le16_to_cpu(mode_info.vesa.y_resolution); - framebuffer->bytes_per_line = le16_to_cpu(mode_info.vesa.bytes_per_scanline); - framebuffer->bits_per_pixel = mode_info.vesa.bits_per_pixel; - - framebuffer->red_mask_pos = mode_info.vesa.red_mask_pos; - framebuffer->red_mask_size = mode_info.vesa.red_mask_size; - - framebuffer->green_mask_pos = mode_info.vesa.green_mask_pos; - framebuffer->green_mask_size = mode_info.vesa.green_mask_size; - - framebuffer->blue_mask_pos = mode_info.vesa.blue_mask_pos; - framebuffer->blue_mask_size = mode_info.vesa.blue_mask_size; - - framebuffer->reserved_mask_pos = mode_info.vesa.reserved_mask_pos; - framebuffer->reserved_mask_size = mode_info.vesa.reserved_mask_size; - - return 0; + const struct lb_framebuffer fb = { + .physical_address = mode_info.vesa.phys_base_ptr, + .x_resolution = le16_to_cpu(mode_info.vesa.x_resolution), + .y_resolution = le16_to_cpu(mode_info.vesa.y_resolution), + .bytes_per_line = le16_to_cpu(mode_info.vesa.bytes_per_scanline), + .bits_per_pixel = mode_info.vesa.bits_per_pixel, + .red_mask_pos = mode_info.vesa.red_mask_pos, + .red_mask_size = mode_info.vesa.red_mask_size, + .green_mask_pos = mode_info.vesa.green_mask_pos, + .green_mask_size = mode_info.vesa.green_mask_size, + .blue_mask_pos = mode_info.vesa.blue_mask_pos, + .blue_mask_size = mode_info.vesa.blue_mask_size, + .reserved_mask_pos = mode_info.vesa.reserved_mask_pos, + .reserved_mask_size = mode_info.vesa.reserved_mask_size, + .orientation = LB_FB_ORIENTATION_NORMAL, + }; + + fb_add_framebuffer_info_ex(&fb); } void vbe_textmode_console(void) |