ia64/xen-unstable

changeset 15391:fb5077ecf9a4

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@novell.com>

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

Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Jun 19 18:07:53 2007 +0100 (2007-06-19)
parents eeeb77195ac2
children 739d698986e9
files xen/arch/x86/boot/video.S
line diff
     1.1 --- a/xen/arch/x86/boot/video.S	Tue Jun 19 16:32:28 2007 +0100
     1.2 +++ b/xen/arch/x86/boot/video.S	Tue Jun 19 18:07:53 2007 +0100
     1.3 @@ -15,7 +15,10 @@
     1.4  
     1.5  #include "video.h"
     1.6  
     1.7 -#define modelist (0x3000)
     1.8 +/* Scratch space layout. */
     1.9 +#define modelist       (0x3000)
    1.10 +#define vesa_glob_info (modelist + 1024)
    1.11 +#define vesa_mode_info (vesa_glob_info + 1024)
    1.12  
    1.13  /* Retrieve Extended Display Identification Data. */
    1.14  #define CONFIG_FIRMWARE_EDID
    1.15 @@ -109,7 +112,7 @@ mopar2: movb    %al, _param(PARAM_VIDEO_
    1.16  
    1.17  # Fetching of VESA frame buffer parameters
    1.18  mopar_gr:
    1.19 -        leaw    modelist+1024, %di
    1.20 +        leaw    vesa_mode_info, %di
    1.21          movb    $0x23, _param(PARAM_HAVE_VGA)
    1.22          movw    16(%di), %ax
    1.23          movw    %ax, _param(PARAM_LFB_LINELENGTH)
    1.24 @@ -128,9 +131,7 @@ mopar_gr:
    1.25          movl    %eax, _param(PARAM_LFB_COLORS+4)
    1.26  
    1.27  # get video mem size
    1.28 -        leaw    modelist+1024, %di
    1.29 -        movw    $0x4f00, %ax
    1.30 -        int     $0x10
    1.31 +        leaw    vesa_glob_info, %di
    1.32          xorl    %eax, %eax
    1.33          movw    18(%di), %ax
    1.34          movl    %eax, _param(PARAM_LFB_SIZE)
    1.35 @@ -183,7 +184,10 @@ dac_done:
    1.36  
    1.37          movw    %es, _param(PARAM_VESAPM_SEG)
    1.38          movw    %di, _param(PARAM_VESAPM_OFF)
    1.39 -no_pm:  ret
    1.40 +
    1.41 +no_pm:  pushw   %ds
    1.42 +        popw    %es
    1.43 +        ret
    1.44  
    1.45  # The video mode menu
    1.46  mode_menu:
    1.47 @@ -428,17 +432,13 @@ setmenu:
    1.48          jmp     mode_set
    1.49  
    1.50  check_vesa:
    1.51 -#ifdef CONFIG_FIRMWARE_EDID
    1.52 -        leaw    modelist+1024, %di
    1.53 +        leaw    vesa_glob_info, %di
    1.54          movw    $0x4f00, %ax
    1.55          int     $0x10
    1.56          cmpw    $0x004f, %ax
    1.57          jnz     setbad
    1.58  
    1.59 -        movw    4(%di), %ax
    1.60 -        movw    %ax, bootsym(vbe_version)
    1.61 -#endif
    1.62 -        leaw    modelist+1024, %di
    1.63 +        leaw    vesa_mode_info, %di
    1.64          subb    $VIDEO_FIRST_VESA>>8, %bh
    1.65          movw    %bx, %cx                # Get mode information structure
    1.66          movw    $0x4f01, %ax
    1.67 @@ -447,7 +447,7 @@ check_vesa:
    1.68          cmpw    $0x004f, %ax
    1.69          jnz     setbad
    1.70  
    1.71 -        movb    (%di), %al              # Check capabilities.
    1.72 +        movb    (%di), %al              # Check mode attributes.
    1.73          andb    $0x99, %al
    1.74          cmpb    $0x99, %al
    1.75          jnz     _setbad                 # Doh! No linear frame buffer.
    1.76 @@ -697,33 +697,34 @@ vga_modes_end:
    1.77  # Detect VESA modes.
    1.78  vesa_modes:
    1.79          movw    %di, %bp                # BP=original mode table end
    1.80 -        addw    $0x200, %di             # Buffer space
    1.81 +        leaw    vesa_glob_info, %di
    1.82          movw    $0x4f00, %ax            # VESA Get card info call
    1.83          int     $0x10
    1.84 +        movw    %di, %si
    1.85          movw    %bp, %di
    1.86          cmpw    $0x004f, %ax            # Successful?
    1.87          jnz     ret0
    1.88          
    1.89 -        cmpw    $0x4556, 0x200(%di)     # 'VE'
    1.90 +        cmpw    $0x4556, (%si)          # 'VE'
    1.91          jnz     ret0
    1.92          
    1.93 -        cmpw    $0x4153, 0x202(%di)     # 'SA'
    1.94 +        cmpw    $0x4153, 2(%si)         # 'SA'
    1.95          jnz     ret0
    1.96          
    1.97          movw    $bootsym(vesa_name), bootsym(card_name) # Set name to "VESA VGA"
    1.98          pushw   %gs
    1.99 -        lgsw    0x20e(%di), %si         # GS:SI=mode list
   1.100 +        lgsw    0xe(%si), %si           # GS:SI=mode list
   1.101          movw    $128, %cx               # Iteration limit
   1.102  vesa1:
   1.103          gs;     lodsw
   1.104 -        cmpw    $0xffff, %ax                        # End of the table?
   1.105 +        cmpw    $0xffff, %ax            # End of the table?
   1.106          jz      vesar
   1.107          
   1.108 -        cmpw    $0x0080, %ax                        # Check validity of mode ID
   1.109 +        cmpw    $0x0080, %ax            # Check validity of mode ID
   1.110          jc      vesa2
   1.111          
   1.112 -        orb     %ah, %ah        # Valid IDs: 0x0000-0x007f/0x0100-0x07ff
   1.113 -        jz      vesan                # Certain BIOSes report 0x80-0xff!
   1.114 +        orb     %ah, %ah                # Valid IDs 0x0000-0x007f/0x0100-0x07ff
   1.115 +        jz      vesan                   # Certain BIOSes report 0x80-0xff!
   1.116  
   1.117          cmpw    $0x0800, %ax
   1.118          jnc     vesae
   1.119 @@ -893,8 +894,13 @@ store_edid:
   1.120          cmpb    $1, bootsym(opt_edid)   # EDID disabled on cmdline (edid=no)?
   1.121          je      .Lno_edid
   1.122  
   1.123 -        cmpw    $0x0200, bootsym(vbe_version)  # only do EDID on >= VBE2.0
   1.124 -        jl      .Lno_edid
   1.125 +        leaw    vesa_glob_info, %di
   1.126 +        movw    $0x4f00, %ax
   1.127 +        int     $0x10
   1.128 +        cmpw    $0x004f, %ax
   1.129 +        jne     .Lno_edid
   1.130 +        cmpw    $0x0200, 4(%di)         # only do EDID on >= VBE2.0
   1.131 +        jb      .Lno_edid
   1.132  
   1.133          xorw    %di, %di                # Report Capability
   1.134          pushw   %di
   1.135 @@ -903,6 +909,8 @@ store_edid:
   1.136          xorw    %bx, %bx
   1.137          xorw    %cx, %cx
   1.138          int     $0x10
   1.139 +        pushw   %ds
   1.140 +        popw    %es
   1.141          cmpw    $0x004f, %ax            # Call failed?
   1.142          jne     .Lno_edid
   1.143  
   1.144 @@ -922,8 +930,6 @@ store_edid:
   1.145          movw    $0x01, %bx
   1.146          movw    $0x00, %cx
   1.147          movw    $0x00, %dx
   1.148 -        pushw   %ds
   1.149 -        popw    %es
   1.150          movw    $bootsym(boot_edid_info), %di
   1.151          int     $0x10
   1.152  
   1.153 @@ -942,7 +948,6 @@ edit_buf:       .space  6       # Line e
   1.154  card_name:      .word   0       # Pointer to adapter name
   1.155  graphic_mode:   .byte   0       # Graphic mode with a linear frame buffer
   1.156  dac_size:       .byte   6       # DAC bit depth
   1.157 -vbe_version:    .word   0       # VBE bios version
   1.158  
   1.159  # Status messages
   1.160  keymsg:         .ascii  "Press <RETURN> to see video modes available,"