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