1c2419b4aSJeremy Fitzhardinge #include <linux/screen_info.h> 2c2419b4aSJeremy Fitzhardinge #include <linux/init.h> 3c2419b4aSJeremy Fitzhardinge 4c2419b4aSJeremy Fitzhardinge #include <asm/bootparam.h> 5c2419b4aSJeremy Fitzhardinge #include <asm/setup.h> 6c2419b4aSJeremy Fitzhardinge 7c2419b4aSJeremy Fitzhardinge #include <xen/interface/xen.h> 8c2419b4aSJeremy Fitzhardinge 9c2419b4aSJeremy Fitzhardinge #include "xen-ops.h" 10c2419b4aSJeremy Fitzhardinge 11c2419b4aSJeremy Fitzhardinge void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size) 12c2419b4aSJeremy Fitzhardinge { 13c2419b4aSJeremy Fitzhardinge struct screen_info *screen_info = &boot_params.screen_info; 14c2419b4aSJeremy Fitzhardinge 15c2419b4aSJeremy Fitzhardinge /* This is drawn from a dump from vgacon:startup in 16c2419b4aSJeremy Fitzhardinge * standard Linux. */ 17c2419b4aSJeremy Fitzhardinge screen_info->orig_video_mode = 3; 18c2419b4aSJeremy Fitzhardinge screen_info->orig_video_isVGA = 1; 19c2419b4aSJeremy Fitzhardinge screen_info->orig_video_lines = 25; 20c2419b4aSJeremy Fitzhardinge screen_info->orig_video_cols = 80; 21c2419b4aSJeremy Fitzhardinge screen_info->orig_video_ega_bx = 3; 22c2419b4aSJeremy Fitzhardinge screen_info->orig_video_points = 16; 23c2419b4aSJeremy Fitzhardinge screen_info->orig_y = screen_info->orig_video_lines - 1; 24c2419b4aSJeremy Fitzhardinge 25c2419b4aSJeremy Fitzhardinge switch (info->video_type) { 26c2419b4aSJeremy Fitzhardinge case XEN_VGATYPE_TEXT_MODE_3: 27c2419b4aSJeremy Fitzhardinge if (size < offsetof(struct dom0_vga_console_info, u.text_mode_3) 28c2419b4aSJeremy Fitzhardinge + sizeof(info->u.text_mode_3)) 29c2419b4aSJeremy Fitzhardinge break; 30c2419b4aSJeremy Fitzhardinge screen_info->orig_video_lines = info->u.text_mode_3.rows; 31c2419b4aSJeremy Fitzhardinge screen_info->orig_video_cols = info->u.text_mode_3.columns; 32c2419b4aSJeremy Fitzhardinge screen_info->orig_x = info->u.text_mode_3.cursor_x; 33c2419b4aSJeremy Fitzhardinge screen_info->orig_y = info->u.text_mode_3.cursor_y; 34c2419b4aSJeremy Fitzhardinge screen_info->orig_video_points = 35c2419b4aSJeremy Fitzhardinge info->u.text_mode_3.font_height; 36c2419b4aSJeremy Fitzhardinge break; 37c2419b4aSJeremy Fitzhardinge 38*aa387d63SJan Beulich case XEN_VGATYPE_EFI_LFB: 39c2419b4aSJeremy Fitzhardinge case XEN_VGATYPE_VESA_LFB: 40c2419b4aSJeremy Fitzhardinge if (size < offsetof(struct dom0_vga_console_info, 41c2419b4aSJeremy Fitzhardinge u.vesa_lfb.gbl_caps)) 42c2419b4aSJeremy Fitzhardinge break; 43c2419b4aSJeremy Fitzhardinge screen_info->orig_video_isVGA = VIDEO_TYPE_VLFB; 44c2419b4aSJeremy Fitzhardinge screen_info->lfb_width = info->u.vesa_lfb.width; 45c2419b4aSJeremy Fitzhardinge screen_info->lfb_height = info->u.vesa_lfb.height; 46c2419b4aSJeremy Fitzhardinge screen_info->lfb_depth = info->u.vesa_lfb.bits_per_pixel; 47c2419b4aSJeremy Fitzhardinge screen_info->lfb_base = info->u.vesa_lfb.lfb_base; 48c2419b4aSJeremy Fitzhardinge screen_info->lfb_size = info->u.vesa_lfb.lfb_size; 49c2419b4aSJeremy Fitzhardinge screen_info->lfb_linelength = info->u.vesa_lfb.bytes_per_line; 50c2419b4aSJeremy Fitzhardinge screen_info->red_size = info->u.vesa_lfb.red_size; 51c2419b4aSJeremy Fitzhardinge screen_info->red_pos = info->u.vesa_lfb.red_pos; 52c2419b4aSJeremy Fitzhardinge screen_info->green_size = info->u.vesa_lfb.green_size; 53c2419b4aSJeremy Fitzhardinge screen_info->green_pos = info->u.vesa_lfb.green_pos; 54c2419b4aSJeremy Fitzhardinge screen_info->blue_size = info->u.vesa_lfb.blue_size; 55c2419b4aSJeremy Fitzhardinge screen_info->blue_pos = info->u.vesa_lfb.blue_pos; 56c2419b4aSJeremy Fitzhardinge screen_info->rsvd_size = info->u.vesa_lfb.rsvd_size; 57c2419b4aSJeremy Fitzhardinge screen_info->rsvd_pos = info->u.vesa_lfb.rsvd_pos; 58*aa387d63SJan Beulich 59*aa387d63SJan Beulich if (info->video_type == XEN_VGATYPE_EFI_LFB) { 60*aa387d63SJan Beulich screen_info->orig_video_isVGA = VIDEO_TYPE_EFI; 61*aa387d63SJan Beulich break; 62*aa387d63SJan Beulich } 63*aa387d63SJan Beulich 64c2419b4aSJeremy Fitzhardinge if (size >= offsetof(struct dom0_vga_console_info, 65c2419b4aSJeremy Fitzhardinge u.vesa_lfb.gbl_caps) 66c2419b4aSJeremy Fitzhardinge + sizeof(info->u.vesa_lfb.gbl_caps)) 67c2419b4aSJeremy Fitzhardinge screen_info->capabilities = info->u.vesa_lfb.gbl_caps; 68c2419b4aSJeremy Fitzhardinge if (size >= offsetof(struct dom0_vga_console_info, 69c2419b4aSJeremy Fitzhardinge u.vesa_lfb.mode_attrs) 70c2419b4aSJeremy Fitzhardinge + sizeof(info->u.vesa_lfb.mode_attrs)) 71c2419b4aSJeremy Fitzhardinge screen_info->vesa_attributes = info->u.vesa_lfb.mode_attrs; 72c2419b4aSJeremy Fitzhardinge break; 73c2419b4aSJeremy Fitzhardinge } 74c2419b4aSJeremy Fitzhardinge } 75