aboutsummaryrefslogtreecommitdiffstats
path: root/vbe.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi@mandriva.org>2010-01-02 01:31:47 +0000
committerAnssi Hannula <anssi@mandriva.org>2010-01-02 01:31:47 +0000
commit8ca7d57e16883816c4398b9111cb9797e21355d2 (patch)
tree29eb45c03aa1395723e9924d587290bd0e22d21d /vbe.c
parent404e0742af7250010c2e1eced4672ae271f67afa (diff)
downloadmonitor-edid-8ca7d57e16883816c4398b9111cb9797e21355d2.tar
monitor-edid-8ca7d57e16883816c4398b9111cb9797e21355d2.tar.gz
monitor-edid-8ca7d57e16883816c4398b9111cb9797e21355d2.tar.bz2
monitor-edid-8ca7d57e16883816c4398b9111cb9797e21355d2.tar.xz
monitor-edid-8ca7d57e16883816c4398b9111cb9797e21355d2.zip
monitor-get-edid-using-vbe:
o remove all x86emu and vga softbootloader code, and always use the LRMI interface which was previously the backup one on 32-bit x86; libx86 is now used instead of liblrmi, allowing the use of LRMI interface on non-x86 hosts as well (fixes Mandriva bug #53866, which was caused by a bug in the removed code)
Diffstat (limited to 'vbe.c')
-rw-r--r--vbe.c127
1 files changed, 11 insertions, 116 deletions
diff --git a/vbe.c b/vbe.c
index ff02e03..0aeadf9 100644
--- a/vbe.c
+++ b/vbe.c
@@ -6,26 +6,18 @@
#include <netinet/in.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <limits.h>
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
+#include <libx86.h>
#include "get-edid.h"
-#include "int10/vbios.h"
-
-#ifdef __i386__
-/* some regressions can occur. e.g. Shuttle S754 with built-in VIA VGA,
- in that case default to previous lrmi code */
-#define LRMI
-#endif
-
-#include <stdarg.h>
int box_is_xbox();
-/* also used by libint10 */
void log_err(char *format, ...)
{
if (verbose) {
@@ -112,29 +104,6 @@ static void parse_vbe_info(unsigned char *v)
log_err("Product revision: %s\n", get_str(tmp, sizeof tmp, v + 0x1e));
}
-static int vbe_check_vbe_info(hd_data_t *hd_data)
-{
- int i;
- unsigned char v[0x200];
- int ax, bx, cx;
-
- /* Setup registers for the interrupt call */
- ax = 0x4f00;
- bx = 0;
- cx = 0;
- memset(v, 0, sizeof(v));
- strcpy(v, "VBE2");
-
- /* Get VBE block */
- i = CallInt10(&ax, &bx, &cx, v, sizeof(v), hd_data->flags.cpuemu) & 0xffff;
- if (i != 0x4f) {
- log_err("VBE: Error (0x4f00): 0x%04x\n", i);
- return 0;
- }
- parse_vbe_info(v);
- return 1;
-}
-
static void parse_ddc_info(int port, int info)
{
log_err("Port %d:\n", port);
@@ -144,58 +113,7 @@ static void parse_ddc_info(int port, int info)
log_err(" Time to transfer one EDID block: %d sec (rounded up)\n", (info & 0xff00) >> 8);
}
-static int vbe_check_ddc_capabilities(hd_data_t *hd_data, int port)
-{
- int i;
- int ax, bx, cx;
-
- /* Setup registers for the interrupt call */
- ax = 0x4f15;
- bx = 0; /* Report DDC Capabilities */
- cx = port;
-
- /* Get capabilities */
- i = CallInt10(&ax, &bx, &cx, NULL, 0, hd_data->flags.cpuemu) & 0xffff;
- if (i != 0x4f) {
- log_err("DDC: Error (0x4f15:00): 0x%04x\n", i);
- return 0;
- }
-
- parse_ddc_info(port, bx);
-
- if (!(bx & 3)) {
- log_err("DDC (0x4f15:00): DDC not supported, not continuing\n", i);
- return 0;
- }
-
- return 1;
-}
-
-/* Get EDID info. */
-int vbe_get_edid_info(hd_data_t *hd_data, char *edid, int port)
-{
- int i;
- int ax, bx, cx;
-
- /* Setup registers for the interrupt call */
- ax = 0x4f15;
- bx = 1;
- cx = port;
-
- /* Get EDID block */
- i = CallInt10(&ax, &bx, &cx, edid, 256, hd_data->flags.cpuemu) & 0xffff;
- if (i != 0x4f) {
- log_err("EDID: Error (0x4f15:01): 0x%04x\n", i);
- return 0;
- }
-
- return 1;
-}
-
-#ifdef LRMI
-#include <lrmi.h>
-
-static int vbe_check_vbe_info__old(void)
+static int vbe_check_vbe_info(void)
{
int i;
unsigned char *mem;
@@ -247,14 +165,14 @@ static int vbe_check_vbe_info__old(void)
return 1;
}
-static int vbe_check_ddc_capabilities__old(int port)
+static int vbe_check_ddc_capabilities(int port)
{
int i;
struct LRMI_regs regs;
/* initialize LRMI */
if (LRMI_init() == 0) {
- log_err("EDID: could not initialize LRMI\n");
+ log_err("DDC: could not initialize LRMI\n");
return 0;
}
@@ -290,7 +208,7 @@ static int vbe_check_ddc_capabilities__old(int port)
return 1;
}
-static int vbe_get_edid_info__old(char *edid, int port)
+static int vbe_get_edid_info(char *edid, int port)
{
int i;
unsigned char *mem;
@@ -341,21 +259,7 @@ static int vbe_get_edid_info__old(char *edid, int port)
return 1;
}
-int get_edid__old(char *edid, int port)
-{
- int ok;
- /* try with older lrmi interface, we can assume a failure for
- one is also bogus for the other */
- log_err("Retrying with old LRMI interface\n");
- ok =
- (box_is_xbox() || (vbe_check_vbe_info__old() &&
- vbe_check_ddc_capabilities__old(port))) &&
- vbe_get_edid_info__old(edid, port);
- return ok;
-}
-#endif
-
-int get_edid(hd_data_t *hd_data, char *edid, int port)
+int get_edid(char *edid, int port)
{
int ok = 0;
@@ -364,19 +268,10 @@ int get_edid(hd_data_t *hd_data, char *edid, int port)
return 0;
}
- if (!box_is_xbox()) {
- if (InitInt10(hd_data) == 0) {
- ok = vbe_check_vbe_info(hd_data)
- && vbe_check_ddc_capabilities(hd_data, port)
- && vbe_get_edid_info(hd_data, edid, port);
- FreeInt10();
- }
- }
-
-#ifdef LRMI
- if (!ok)
- ok = get_edid__old(edid, port);
-#endif
+ ok =
+ (box_is_xbox() || (vbe_check_vbe_info() &&
+ vbe_check_ddc_capabilities(port))) &&
+ vbe_get_edid_info(edid, port);
return ok ? 128 : 0;
}