archrelease: copy trunk to extra-x86_64
[arch-packages.git] / kexec-tools / trunk / kexec-vesafb.diff
blobec164226d4c339570dcff0638207265bd755a9a1
1 Index: kexec-tools-1.101/kexec/arch/i386/x86-linux-setup.c
2 ===================================================================
3 --- kexec-tools-1.101.orig/kexec/arch/i386/x86-linux-setup.c 2006-03-03 10:51:31.000000000 +0100
4 +++ kexec-tools-1.101/kexec/arch/i386/x86-linux-setup.c 2006-03-10 14:02:20.000000000 +0100
5 @@ -24,6 +24,8 @@
6 #include <sys/stat.h>
7 #include <sys/mman.h>
8 #include <fcntl.h>
9 +#include <sys/ioctl.h>
10 +#include <linux/fb.h>
11 #include <unistd.h>
12 #include <x86/x86-linux.h>
13 #include "../../kexec.h"
14 @@ -94,6 +96,56 @@ void setup_linux_bootloader_parameters(
15 cmdline_ptr[cmdline_len - 1] = '\0';
18 +int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
20 + struct fb_fix_screeninfo fix;
21 + struct fb_var_screeninfo var;
22 + int fd;
24 + fd = open("/dev/fb0", O_RDONLY);
25 + if (-1 == fd)
26 + return -1;
28 + if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, &fix))
29 + goto out;
30 + if (-1 == ioctl(fd, FBIOGET_VSCREENINFO, &var))
31 + goto out;
32 + if (0 != strcmp(fix.id, "VESA VGA"))
33 + goto out;
34 + close(fd);
36 + real_mode->orig_video_isVGA = 0x23 /* VIDEO_TYPE_VLFB */;
37 + real_mode->lfb_width = var.xres;
38 + real_mode->lfb_height = var.yres;
39 + real_mode->lfb_depth = var.bits_per_pixel;
40 + real_mode->lfb_base = fix.smem_start;
41 + real_mode->lfb_linelength = fix.line_length;
42 + real_mode->vesapm_seg = 0;
44 + /* fixme: better get size from /proc/iomem */
45 + real_mode->lfb_size = (fix.smem_len + 65535) / 65536;
46 + real_mode->pages = (fix.smem_len + 4095) / 4096;
48 + if (var.bits_per_pixel > 8) {
49 + real_mode->red_pos = var.red.offset;
50 + real_mode->red_size = var.red.length;
51 + real_mode->green_pos = var.green.offset;
52 + real_mode->green_size = var.green.length;
53 + real_mode->blue_pos = var.blue.offset;
54 + real_mode->blue_size = var.blue.length;
55 + real_mode->rsvd_pos = var.transp.offset;
56 + real_mode->rsvd_size = var.transp.length;
57 + }
58 + fprintf(stderr, "%s: %dx%dx%d @ %lx +%lx\n", __FUNCTION__,
59 + var.xres, var.yres, var.bits_per_pixel,
60 + fix.smem_start, fix.smem_len);
61 + return 0;
63 + out:
64 + close(fd);
65 + return -1;
68 void setup_linux_system_parameters(struct x86_linux_param_header *real_mode)
70 /* Fill in information the BIOS would usually provide */
71 @@ -111,6 +163,7 @@ void setup_linux_system_parameters(struc
72 real_mode->orig_video_ega_bx = 0;
73 real_mode->orig_video_isVGA = 1;
74 real_mode->orig_video_points = 16;
75 + setup_linux_vesafb(real_mode);
77 /* Fill in the memsize later */
78 real_mode->ext_mem_k = 0;