0001
0002 #include <linux/screen_info.h>
0003 #include <linux/init.h>
0004
0005 #include <asm/bootparam.h>
0006 #include <asm/setup.h>
0007
0008 #include <xen/interface/xen.h>
0009
0010 #include "xen-ops.h"
0011
0012 void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size)
0013 {
0014 struct screen_info *screen_info = &boot_params.screen_info;
0015
0016
0017
0018 screen_info->orig_video_mode = 3;
0019 screen_info->orig_video_isVGA = 1;
0020 screen_info->orig_video_lines = 25;
0021 screen_info->orig_video_cols = 80;
0022 screen_info->orig_video_ega_bx = 3;
0023 screen_info->orig_video_points = 16;
0024 screen_info->orig_y = screen_info->orig_video_lines - 1;
0025
0026 switch (info->video_type) {
0027 case XEN_VGATYPE_TEXT_MODE_3:
0028 if (size < offsetof(struct dom0_vga_console_info, u.text_mode_3)
0029 + sizeof(info->u.text_mode_3))
0030 break;
0031 screen_info->orig_video_lines = info->u.text_mode_3.rows;
0032 screen_info->orig_video_cols = info->u.text_mode_3.columns;
0033 screen_info->orig_x = info->u.text_mode_3.cursor_x;
0034 screen_info->orig_y = info->u.text_mode_3.cursor_y;
0035 screen_info->orig_video_points =
0036 info->u.text_mode_3.font_height;
0037 break;
0038
0039 case XEN_VGATYPE_EFI_LFB:
0040 case XEN_VGATYPE_VESA_LFB:
0041 if (size < offsetof(struct dom0_vga_console_info,
0042 u.vesa_lfb.gbl_caps))
0043 break;
0044 screen_info->orig_video_isVGA = VIDEO_TYPE_VLFB;
0045 screen_info->lfb_width = info->u.vesa_lfb.width;
0046 screen_info->lfb_height = info->u.vesa_lfb.height;
0047 screen_info->lfb_depth = info->u.vesa_lfb.bits_per_pixel;
0048 screen_info->lfb_base = info->u.vesa_lfb.lfb_base;
0049 screen_info->lfb_size = info->u.vesa_lfb.lfb_size;
0050 screen_info->lfb_linelength = info->u.vesa_lfb.bytes_per_line;
0051 screen_info->red_size = info->u.vesa_lfb.red_size;
0052 screen_info->red_pos = info->u.vesa_lfb.red_pos;
0053 screen_info->green_size = info->u.vesa_lfb.green_size;
0054 screen_info->green_pos = info->u.vesa_lfb.green_pos;
0055 screen_info->blue_size = info->u.vesa_lfb.blue_size;
0056 screen_info->blue_pos = info->u.vesa_lfb.blue_pos;
0057 screen_info->rsvd_size = info->u.vesa_lfb.rsvd_size;
0058 screen_info->rsvd_pos = info->u.vesa_lfb.rsvd_pos;
0059
0060 if (size >= offsetof(struct dom0_vga_console_info,
0061 u.vesa_lfb.ext_lfb_base)
0062 + sizeof(info->u.vesa_lfb.ext_lfb_base)
0063 && info->u.vesa_lfb.ext_lfb_base) {
0064 screen_info->ext_lfb_base = info->u.vesa_lfb.ext_lfb_base;
0065 screen_info->capabilities |= VIDEO_CAPABILITY_64BIT_BASE;
0066 }
0067
0068 if (info->video_type == XEN_VGATYPE_EFI_LFB) {
0069 screen_info->orig_video_isVGA = VIDEO_TYPE_EFI;
0070 break;
0071 }
0072
0073 if (size >= offsetof(struct dom0_vga_console_info,
0074 u.vesa_lfb.mode_attrs)
0075 + sizeof(info->u.vesa_lfb.mode_attrs))
0076 screen_info->vesa_attributes = info->u.vesa_lfb.mode_attrs;
0077 break;
0078 }
0079 }