summaryrefslogtreecommitdiffstats
path: root/ddcprobe
diff options
context:
space:
mode:
authornalin <nalin>1999-07-18 09:33:22 +0000
committernalin <nalin>1999-07-18 09:33:22 +0000
commit1aaf90f2821e49c141078f804f5fd695cbb07b98 (patch)
tree4703ffcf9b6d6daebe847fb270d2dc41cc7c6eb3 /ddcprobe
parent94514a08d74dc0cf09ee92dec8ad937a18924fdf (diff)
downloadanaconda-1aaf90f2821e49c141078f804f5fd695cbb07b98.tar.gz
anaconda-1aaf90f2821e49c141078f804f5fd695cbb07b98.tar.xz
anaconda-1aaf90f2821e49c141078f804f5fd695cbb07b98.zip
move to using vbe functions
Diffstat (limited to 'ddcprobe')
-rw-r--r--ddcprobe/ddcprobe.c87
-rw-r--r--ddcprobe/svgamodes.c171
2 files changed, 76 insertions, 182 deletions
diff --git a/ddcprobe/ddcprobe.c b/ddcprobe/ddcprobe.c
index 8ac2a02c4..2389ddf5d 100644
--- a/ddcprobe/ddcprobe.c
+++ b/ddcprobe/ddcprobe.c
@@ -20,46 +20,15 @@
int main(int argc, char **argv)
{
- struct vm86_struct info;
struct vbe_info *vbe_info = NULL;
- struct edid_info *edid_info = NULL;
- unsigned char *memory = NULL;
+ struct vbe_edid_info *edid_info = NULL;
u_int16_t *mode_list = NULL;
char manufacturer[4];
int i;
- /* Get a copy of the low megabyte for use as an address space. */
- memory = vm86_ram_alloc();
- if(memory == MAP_FAILED) {
- printf("Couldn't allocate needed memory!\n");
- exit(0);
- }
-
- /* Set up registers for a real-mode interrupt call. */
- memset(&info, 0, sizeof(info));
- info.regs.eax = 0x4f00;
- info.regs.es = 0x4000;
- info.regs.edi = 0x0000;
- info.regs.ss = 0x9000;
- info.regs.esp = 0x0000;
- info.flags = 0;
-
- /* Call the BIOS. */
- memset(&memory[info.regs.es * 16 + info.regs.edi], 0, 1024);
- bioscall(0x10, &info.regs, memory);
-
- /* Interpret results. */
- vbe_info = (struct vbe_info*) &memory[info.regs.es*16 + info.regs.edi];
-
- if((info.regs.eax & 0xff) != 0x4f) {
+ vbe_info = vbe_get_vbe_info();
+ if(vbe_info == NULL) {
printf("VESA BIOS Extensions not detected.\n");
- vm86_ram_free(memory);
- exit(0);
- }
-
- if((info.regs.eax & 0xffff) != 0x004f) {
- printf("VESA Get SuperVGA Information request failed.\n");
- vm86_ram_free(memory);
exit(0);
}
@@ -70,16 +39,14 @@ int main(int argc, char **argv)
vbe_info->version[1], vbe_info->version[0]);
/* OEM */
- printf("OEM Name: %s\n", &memory[vbe_info->oem_name.addr.seg * 16 +
- vbe_info->oem_name.addr.ofs]);
+ printf("OEM Name: %s\n", vbe_info->oem_name.string);
/* Memory. */
printf("Memory installed = %d * 64k blocks = %dkb\n",
vbe_info->memory_size, vbe_info->memory_size * 64);
/* List supported standard modes. */
- mode_list = (u_int16_t*) &memory[vbe_info->mode_list.addr.seg * 16 +
- vbe_info->mode_list.addr.ofs];
+ mode_list = vbe_info->mode_list.list;
if(*mode_list != 0xffff) {
printf("Supported standard modes:\n");
}
@@ -92,46 +59,19 @@ int main(int argc, char **argv)
}
}
- /* Set up registers for reading the EDID from the BIOS. */
- memset(&info, 0, sizeof(info));
- info.regs.eax = 0x4f15;
- info.regs.ebx = 0x0001;
- info.regs.es = 0x4000;
- info.regs.edi = 0x0000;
- info.regs.ss = 0x9000;
- info.regs.esp = 0x0000;
- info.flags = 0;
-
- /* Call the BIOS again. */
- memset(&memory[info.regs.es * 16 + info.regs.edi], 0, 1024);
- bioscall(0x10, &info.regs, memory);
-
- /* Interpret results. */
- if((info.regs.eax & 0xff) != 0x4f) {
- printf("EDID read not supported by hardware.\n");
- vm86_ram_free(memory);
+ if(!vbe_get_edid_supported()) {
+ printf("EDID read not supported by video card.\n");
exit(0);
}
- if((info.regs.eax & 0xffff) == 0x014f) {
- printf("EDID read supported by hardware, but failed "
- "(monitor not DCC-capable?).\n");
-#if 1
- vm86_ram_free(memory);
- exit(0);
-#endif
- }
+ edid_info = vbe_get_edid_info();
- if((info.regs.eax & 0xffff) != 0x004f) {
- printf("Unknown failure reading EDID.\n");
- dump_regs(&info.regs);
- } else {
- printf("EDID read successfully.\n");
- dump_regs(&info.regs);
+ /* Interpret results. */
+ if(edid_info == NULL) {
+ printf("EDID failed. (No DDC-capable monitor attached?)\n");
+ exit(0);
}
- edid_info = (struct edid_info*) &memory[info.regs.es * 16 +
- info.regs.edi];
printf("EDID ver. %d rev. %d.\n",
edid_info->edid_version, edid_info->edid_revision);
@@ -153,7 +93,7 @@ int main(int argc, char **argv)
edid_info->serial -= 640000000;
}
}
- printf("Serial number: %d.\n", edid_info->serial);
+ printf("Serial number: %08x.\n", edid_info->serial);
printf("Manufactured in week %d of %d.\n",
edid_info->week, edid_info->year + 1990);
@@ -349,6 +289,5 @@ int main(int argc, char **argv)
printf("\n");
}
}
- vm86_ram_free(memory);
return 0;
}
diff --git a/ddcprobe/svgamodes.c b/ddcprobe/svgamodes.c
index 8ca345848..5902db60d 100644
--- a/ddcprobe/svgamodes.c
+++ b/ddcprobe/svgamodes.c
@@ -20,45 +20,16 @@
int main(int argc, char **argv)
{
- struct vm86_struct info;
struct vbe_info *vbe_info = NULL;
- struct mode_info *mode_info = NULL;
- unsigned char *memory = NULL;
+ struct vbe_mode_info *mode_info = NULL;
u_int16_t *mode_list = NULL;
float vesa_version;
- /* Get a copy of the low megabyte for use as an address space. */
- memory = vm86_ram_alloc();
- if(memory == MAP_FAILED) {
- printf("Couldn't allocate needed memory!\n");
- exit(0);
- }
-
- /* Set up registers for a real-mode interrupt call. */
- memset(&info, 0, sizeof(info));
- info.regs.eax = 0x4f00;
- info.regs.es = 0x4000;
- info.regs.edi = 0x0000;
- info.regs.ss = 0x9000;
- info.regs.esp = 0x0000;
- info.flags = 0;
-
- /* Call the BIOS. */
- memset(&memory[info.regs.es * 16 + info.regs.edi], 0, 1024);
- bioscall(0x10, &info.regs, memory);
-
/* Interpret results. */
- vbe_info = (struct vbe_info*) &memory[info.regs.es*16 + info.regs.edi];
+ vbe_info = vbe_get_vbe_info();
- if((info.regs.eax & 0xff) != 0x4f) {
+ if(vbe_info == NULL) {
printf("VESA BIOS Extensions not detected.\n");
- vm86_ram_free(memory);
- exit(0);
- }
-
- if((info.regs.eax & 0xffff) != 0x004f) {
- printf("VESA Get SuperVGA Information request failed.\n");
- vm86_ram_free(memory);
exit(0);
}
@@ -70,8 +41,7 @@ int main(int argc, char **argv)
vesa_version = (vbe_info->version[1]) + (vbe_info->version[0]) / 10.0;
/* List supported standard modes. */
- mode_list = (u_int16_t*) &memory[vbe_info->mode_list.addr.seg * 16 +
- vbe_info->mode_list.addr.ofs];
+ mode_list = vbe_info->mode_list.list;
if(*mode_list != 0xffff) {
printf("Supported standard modes:\n");
}
@@ -86,89 +56,74 @@ int main(int argc, char **argv)
known_vesa_modes[j].colors);
}}
printf("\n");
- memset(&info, 0, sizeof(info));
- info.regs.eax = 0x4f01;
- info.regs.ecx = *mode_list;
- info.regs.es = 0x5000;
- info.regs.edi = 0x0000;
- info.regs.ss = 0x9000;
- info.regs.esp = 0x0000;
- info.flags = 0;
- memset(&memory[info.regs.es * 16 + info.regs.edi], 0, 1024);
- bioscall(0x10, &info.regs, memory);
- mode_info = (struct mode_info*) &memory[info.regs.es * 16 +
- info.regs.edi];
- if((info.regs.eax & 0xff) != 0x4f) {
+ mode_info = vbe_get_mode_info(*mode_list);
+ if(mode_info == NULL) {
printf("Get mode information not supported.\n");
- vm86_ram_free(memory);
exit(0);
}
- if((info.regs.eax & 0xffff) == 0x004f) {
- if(mode_info->w && mode_info->h && mode_info->bpp) {
- printf("\tBIOS reports %dx%d, %d bpp",
- mode_info->w, mode_info->h,
- mode_info->bpp);
+ if(mode_info->w && mode_info->h && mode_info->bpp) {
+ printf("\tBIOS reports %dx%d, %d bpp",
+ mode_info->w, mode_info->h,
+ mode_info->bpp);
+ }
+ if(mode_info->bytes_per_scanline) {
+ printf(", %d bytes per scanline.",
+ mode_info->bytes_per_scanline);
+ }
+ printf("\n");
+ printf("\t%s, ", mode_info->mode_attributes & 0x01 ?
+ "Supported" : "Not supported");
+ printf("%s ", mode_info->mode_attributes & 0x08 ?
+ "Color" : "Monochrome");
+ printf("%s.\n", mode_info->mode_attributes & 0x10 ?
+ "Graphics" : "Text");
+ if(vesa_version >= 2.0) {
+ printf("\tLFB mode %s.\n",
+ mode_info->mode_attributes & 0x80 ?
+ "supported" : "not supported");
+ printf("\t%sVGA compatible.\n",
+ mode_info->mode_attributes & 0x20 ?
+ "" : "Not ");
+ }
+ printf("\tMemory model: ");
+ switch(mode_info->memory_model) {
+ case memory_model_text: {
+ printf("text.\n");
+ break;
+ }
+ case memory_model_cga: {
+ printf("CGA.\n");
+ break;
+ }
+ case memory_model_hgc: {
+ printf("Hercules.\n");
+ break;
}
- if(mode_info->bytes_per_scanline) {
- printf(", %d bytes per scanline.",
- mode_info->bytes_per_scanline);
+ case memory_model_ega16: {
+ printf("EGA.\n");
+ break;
}
- printf("\n");
- printf("\t%s, ", mode_info->mode_attributes & 0x01 ?
- "Supported" : "Not supported");
- printf("%s ", mode_info->mode_attributes & 0x08 ?
- "Color" : "Monochrome");
- printf("%s.\n", mode_info->mode_attributes & 0x10 ?
- "Graphics" : "Text");
- if(vesa_version >= 2.0) {
- printf("\tLFB mode %s.\n",
- mode_info->mode_attributes & 0x80 ?
- "supported" : "not supported");
- printf("\t%sVGA compatible.\n",
- mode_info->mode_attributes & 0x20 ?
- "" : "Not ");
+ case memory_model_packed_pixel: {
+ printf("packed-pixel.\n");
+ break;
}
- printf("\tMemory model: ");
- switch(mode_info->memory_model) {
- case memory_model_text: {
- printf("text.\n");
- break;
- }
- case memory_model_cga: {
- printf("CGA.\n");
- break;
- }
- case memory_model_hgc: {
- printf("Hercules.\n");
- break;
- }
- case memory_model_ega16: {
- printf("EGA.\n");
- break;
- }
- case memory_model_packed_pixel: {
- printf("packed-pixel.\n");
- break;
- }
- case memory_model_sequ256: {
- printf("sequential 256.\n");
- break;
- }
- case memory_model_direct_color: {
- printf("direct color (24-bit).\n");
- break;
- }
- case memory_model_yuv: {
- printf("YUV.\n");
- break;
- }
- default : {
- printf("unknown/OEM.\n");
- }
+ case memory_model_sequ256: {
+ printf("sequential 256.\n");
+ break;
+ }
+ case memory_model_direct_color: {
+ printf("direct color.\n");
+ break;
+ }
+ case memory_model_yuv: {
+ printf("YUV.\n");
+ break;
+ }
+ default : {
+ printf("unknown/OEM.\n");
}
}
}
-
return 0;
}