summaryrefslogtreecommitdiffstats
path: root/tools/ddcprobe/ddcxinfos.c
diff options
context:
space:
mode:
authorGwenolé Beauchesne <gbeauchesne@mandriva.org>2003-10-23 16:55:43 +0000
committerGwenolé Beauchesne <gbeauchesne@mandriva.org>2003-10-23 16:55:43 +0000
commitc5b81552b9abf8ef78056bd1db685aa7d9362620 (patch)
tree4f8391755177717abde3876e2c77c8f08e383032 /tools/ddcprobe/ddcxinfos.c
parenta8f5fcc9b9597beb0672f54301fcf59ee51c65c0 (diff)
downloaddrakx-backup-do-not-use-c5b81552b9abf8ef78056bd1db685aa7d9362620.tar
drakx-backup-do-not-use-c5b81552b9abf8ef78056bd1db685aa7d9362620.tar.gz
drakx-backup-do-not-use-c5b81552b9abf8ef78056bd1db685aa7d9362620.tar.bz2
drakx-backup-do-not-use-c5b81552b9abf8ef78056bd1db685aa7d9362620.tar.xz
drakx-backup-do-not-use-c5b81552b9abf8ef78056bd1db685aa7d9362620.zip
Remove unreachable code. Add support for AMD64 through parsing of
/proc/BOOT/{edid,vbe} blocks obtained early during the boot process. However, this is a -BOOT kernel specific since there is no way to dynamically fetch updated info at runtime. i.e. terrific HACKage!
Diffstat (limited to 'tools/ddcprobe/ddcxinfos.c')
-rw-r--r--tools/ddcprobe/ddcxinfos.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/tools/ddcprobe/ddcxinfos.c b/tools/ddcprobe/ddcxinfos.c
index 22ed653b8..4aec99d29 100644
--- a/tools/ddcprobe/ddcxinfos.c
+++ b/tools/ddcprobe/ddcxinfos.c
@@ -2,13 +2,17 @@
#include <stdlib.h>
#include <string.h>
#include <math.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
#include "vbe.h"
#include "vesamode.h"
#ident "$Id$"
#define SQR(x) ((x) * (x))
-int main(int argc, char **argv)
+int main(void)
{
int i, j;
u_int16_t *mode_list;
@@ -16,14 +20,34 @@ int main(int argc, char **argv)
struct vbe_info *vbe_info;
struct vbe_edid1_info *edid;
struct vbe_modeline *modelines;
-
+#if KERNEL_BOOT_INFO
+ int dev_mem_fd;
+ char *mem;
+#endif
if ((vbe_info = vbe_get_vbe_info()) == NULL) return 1;
-
printf("%dKB of video ram\n", vbe_info->memory_size * 64);
+#if KERNEL_BOOT_INFO
+ /* Open /dev/mem for extra information from VGA BIOS. */
+ if ((dev_mem_fd = open("/dev/mem", O_RDONLY)) < 0) {
+ perror("open /dev/mem");
+ return 1;
+ }
+ if ((mem = (char *)mmap(0, VGA_BIOS_SIZE, PROT_READ, MAP_PRIVATE, dev_mem_fd, VGA_BIOS_BASE)) == MAP_FAILED) {
+ perror("mmap /dev/mem at VGA_BIOS_BASE");
+ return 1;
+ }
+
+ if ((vbe_info->mode_list.base & ~0xffff) != VGA_BIOS_BASE) return 1;
+ mode_list = (u_int16_t *)(mem + vbe_info->mode_list.base - VGA_BIOS_BASE);
+#endif
+#if defined(__i386__)
+ mode_list = (u_int16_t *)vbe_info->mode_list.ptr;
+#endif
+
/* List supported standard modes. */
- for (mode_list = vbe_info->mode_list.list; *mode_list != 0xffff; mode_list++)
+ while (*mode_list != 0xffff) {
for (i = 0; known_vesa_modes[i].x; i++)
if (known_vesa_modes[i].number == *mode_list)
printf("%d %d %d\n",
@@ -31,8 +55,15 @@ int main(int argc, char **argv)
known_vesa_modes[i].x,
known_vesa_modes[i].y
);
+ mode_list++;
+ }
printf("\n");
+#if KERNEL_BOOT_INFO
+ munmap(mem, VGA_BIOS_SIZE);
+ close(dev_mem_fd);
+#endif
+
if ((edid = vbe_get_edid_info()) == NULL) return 0;
if (edid->version == 255 && edid->revision == 255) return 0;