summaryrefslogtreecommitdiff
path: root/vgasrc
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-03-19 11:09:33 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-05-15 10:11:48 +0200
commita307d0adc50f41787424a9453145293248a1908c (patch)
treeb7567be0fb586d231e39546b0c9a2bf56b5bf06c /vgasrc
parent55eca9a14abef410d45c2f10ecd3f11c946064fc (diff)
downloadqemu-seabios-a307d0adc50f41787424a9453145293248a1908c.tar.gz
vbe: add edid support.
VBE subfunction 0x15, read ddc data. Add VBE_edid where drivers can fill in a EDID data blob. If we find valid data there (checking the first two header bytes), then report the function as supported and hand out the data. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'vgasrc')
-rw-r--r--vgasrc/vbe.c30
-rw-r--r--vgasrc/vgautil.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/vgasrc/vbe.c b/vgasrc/vbe.c
index 724c1ba..66afb01 100644
--- a/vgasrc/vbe.c
+++ b/vgasrc/vbe.c
@@ -25,6 +25,7 @@ u32 VBE_total_memory VAR16 = 256 * 1024;
u32 VBE_capabilities VAR16;
u32 VBE_framebuffer VAR16;
u16 VBE_win_granularity VAR16;
+u8 VBE_edid[256] VAR16;
static void
vbe_104f00(struct bregs *regs)
@@ -401,6 +402,34 @@ vbe_104f10(struct bregs *regs)
}
static void
+vbe_104f15(struct bregs *regs)
+{
+ int offset;
+
+ switch (regs->bl) {
+ case 0x00:
+ if (GET_GLOBAL(VBE_edid[0]) != 0x00 ||
+ GET_GLOBAL(VBE_edid[1]) != 0xff)
+ goto err;
+ regs->bx = 0x0103;
+ break;
+ case 0x01:
+ offset = regs->dx * 128;
+ if (offset >= sizeof(VBE_edid))
+ goto err;
+ memcpy_far(regs->es, (void*)(regs->di+0),
+ get_global_seg(), VBE_edid + offset,
+ 128);
+ break;
+ err:
+ default:
+ regs->ax = 0x014f;
+ return;
+ }
+ regs->ax = 0x004f;
+}
+
+static void
vbe_104fXX(struct bregs *regs)
{
debug_stub(regs);
@@ -427,6 +456,7 @@ handle_104f(struct bregs *regs)
case 0x08: vbe_104f08(regs); break;
case 0x0a: vbe_104f0a(regs); break;
case 0x10: vbe_104f10(regs); break;
+ case 0x15: vbe_104f15(regs); break;
default: vbe_104fXX(regs); break;
}
}
diff --git a/vgasrc/vgautil.h b/vgasrc/vgautil.h
index a994040..dd1aa18 100644
--- a/vgasrc/vgautil.h
+++ b/vgasrc/vgautil.h
@@ -89,6 +89,7 @@ extern u32 VBE_total_memory;
extern u32 VBE_capabilities;
extern u32 VBE_framebuffer;
extern u16 VBE_win_granularity;
+extern u8 VBE_edid[256];
void handle_104f(struct bregs *regs);
// vgafonts.c