[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: retrieve VBE EDID/DDC info independent of used video mode



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1182272873 -3600
# Node ID fb5077ecf9a440ab4fa128788172ce604c4b28f2
# Parent  eeeb77195ac20e8e08c57a7248913bedc0d999bf
x86: retrieve VBE EDID/DDC info independent of used video mode

The code to retrieve this information was protected by a check of a
variable (vbe_version) that would get initialized only when a VESA
mode was selected on the command line.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

At the same time I cleaned up use of 'scratch space' at address
modelist and beyond.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/boot/video.S |   57 +++++++++++++++++++++++++---------------------
 1 files changed, 31 insertions(+), 26 deletions(-)

diff -r eeeb77195ac2 -r fb5077ecf9a4 xen/arch/x86/boot/video.S
--- a/xen/arch/x86/boot/video.S Tue Jun 19 16:32:28 2007 +0100
+++ b/xen/arch/x86/boot/video.S Tue Jun 19 18:07:53 2007 +0100
@@ -15,7 +15,10 @@
 
 #include "video.h"
 
-#define modelist (0x3000)
+/* Scratch space layout. */
+#define modelist       (0x3000)
+#define vesa_glob_info (modelist + 1024)
+#define vesa_mode_info (vesa_glob_info + 1024)
 
 /* Retrieve Extended Display Identification Data. */
 #define CONFIG_FIRMWARE_EDID
@@ -109,7 +112,7 @@ mopar2: movb    %al, _param(PARAM_VIDEO_
 
 # Fetching of VESA frame buffer parameters
 mopar_gr:
-        leaw    modelist+1024, %di
+        leaw    vesa_mode_info, %di
         movb    $0x23, _param(PARAM_HAVE_VGA)
         movw    16(%di), %ax
         movw    %ax, _param(PARAM_LFB_LINELENGTH)
@@ -128,9 +131,7 @@ mopar_gr:
         movl    %eax, _param(PARAM_LFB_COLORS+4)
 
 # get video mem size
-        leaw    modelist+1024, %di
-        movw    $0x4f00, %ax
-        int     $0x10
+        leaw    vesa_glob_info, %di
         xorl    %eax, %eax
         movw    18(%di), %ax
         movl    %eax, _param(PARAM_LFB_SIZE)
@@ -183,7 +184,10 @@ dac_done:
 
         movw    %es, _param(PARAM_VESAPM_SEG)
         movw    %di, _param(PARAM_VESAPM_OFF)
-no_pm:  ret
+
+no_pm:  pushw   %ds
+        popw    %es
+        ret
 
 # The video mode menu
 mode_menu:
@@ -428,17 +432,13 @@ setmenu:
         jmp     mode_set
 
 check_vesa:
-#ifdef CONFIG_FIRMWARE_EDID
-        leaw    modelist+1024, %di
+        leaw    vesa_glob_info, %di
         movw    $0x4f00, %ax
         int     $0x10
         cmpw    $0x004f, %ax
         jnz     setbad
 
-        movw    4(%di), %ax
-        movw    %ax, bootsym(vbe_version)
-#endif
-        leaw    modelist+1024, %di
+        leaw    vesa_mode_info, %di
         subb    $VIDEO_FIRST_VESA>>8, %bh
         movw    %bx, %cx                # Get mode information structure
         movw    $0x4f01, %ax
@@ -447,7 +447,7 @@ check_vesa:
         cmpw    $0x004f, %ax
         jnz     setbad
 
-        movb    (%di), %al              # Check capabilities.
+        movb    (%di), %al              # Check mode attributes.
         andb    $0x99, %al
         cmpb    $0x99, %al
         jnz     _setbad                 # Doh! No linear frame buffer.
@@ -697,33 +697,34 @@ vga_modes_end:
 # Detect VESA modes.
 vesa_modes:
         movw    %di, %bp                # BP=original mode table end
-        addw    $0x200, %di             # Buffer space
+        leaw    vesa_glob_info, %di
         movw    $0x4f00, %ax            # VESA Get card info call
         int     $0x10
+        movw    %di, %si
         movw    %bp, %di
         cmpw    $0x004f, %ax            # Successful?
         jnz     ret0
         
-        cmpw    $0x4556, 0x200(%di)     # 'VE'
+        cmpw    $0x4556, (%si)          # 'VE'
         jnz     ret0
         
-        cmpw    $0x4153, 0x202(%di)     # 'SA'
+        cmpw    $0x4153, 2(%si)         # 'SA'
         jnz     ret0
         
         movw    $bootsym(vesa_name), bootsym(card_name) # Set name to "VESA 
VGA"
         pushw   %gs
-        lgsw    0x20e(%di), %si         # GS:SI=mode list
+        lgsw    0xe(%si), %si           # GS:SI=mode list
         movw    $128, %cx               # Iteration limit
 vesa1:
         gs;     lodsw
-        cmpw    $0xffff, %ax                        # End of the table?
+        cmpw    $0xffff, %ax            # End of the table?
         jz      vesar
         
-        cmpw    $0x0080, %ax                        # Check validity of mode ID
+        cmpw    $0x0080, %ax            # Check validity of mode ID
         jc      vesa2
         
-        orb     %ah, %ah        # Valid IDs: 0x0000-0x007f/0x0100-0x07ff
-        jz      vesan                # Certain BIOSes report 0x80-0xff!
+        orb     %ah, %ah                # Valid IDs 0x0000-0x007f/0x0100-0x07ff
+        jz      vesan                   # Certain BIOSes report 0x80-0xff!
 
         cmpw    $0x0800, %ax
         jnc     vesae
@@ -893,8 +894,13 @@ store_edid:
         cmpb    $1, bootsym(opt_edid)   # EDID disabled on cmdline (edid=no)?
         je      .Lno_edid
 
-        cmpw    $0x0200, bootsym(vbe_version)  # only do EDID on >= VBE2.0
-        jl      .Lno_edid
+        leaw    vesa_glob_info, %di
+        movw    $0x4f00, %ax
+        int     $0x10
+        cmpw    $0x004f, %ax
+        jne     .Lno_edid
+        cmpw    $0x0200, 4(%di)         # only do EDID on >= VBE2.0
+        jb      .Lno_edid
 
         xorw    %di, %di                # Report Capability
         pushw   %di
@@ -903,6 +909,8 @@ store_edid:
         xorw    %bx, %bx
         xorw    %cx, %cx
         int     $0x10
+        pushw   %ds
+        popw    %es
         cmpw    $0x004f, %ax            # Call failed?
         jne     .Lno_edid
 
@@ -922,8 +930,6 @@ store_edid:
         movw    $0x01, %bx
         movw    $0x00, %cx
         movw    $0x00, %dx
-        pushw   %ds
-        popw    %es
         movw    $bootsym(boot_edid_info), %di
         int     $0x10
 
@@ -942,7 +948,6 @@ card_name:      .word   0       # Pointe
 card_name:      .word   0       # Pointer to adapter name
 graphic_mode:   .byte   0       # Graphic mode with a linear frame buffer
 dac_size:       .byte   6       # DAC bit depth
-vbe_version:    .word   0       # VBE bios version
 
 # Status messages
 keymsg:         .ascii  "Press <RETURN> to see video modes available,"

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.