Getting the EDID block for x86

Getting the EDID block for x86

Post by Antonino Dapla » Thu, 03 Apr 2003 17:50:09

Hi Linus,

Attached is a diff against 2.5.66 which gets the EDID block via VBE/DDC
service.  This is done before switching to protected mode.

It's useful for video drivers to have some kind of information about the
primary display's operating limits and capability.  Please, kindly


diff -Naur linux-2.5.66-orig/arch/i386/boot/compressed/misc.c linux-2.5.66-edid/arch/i386/boot/compressed/misc.c
--- linux-2.5.66-orig/arch/i386/boot/compressed/misc.c  2003-02-16 00:47:53.000000000 +0000

 #include <linux/linkage.h>
 #include <linux/vmalloc.h>
 #include <linux/tty.h>
+#include <video/edid.h>
 #include <asm/io.h>

 #define ALT_MEM_K   (*(unsigned long *)(real_mode + 0x1e0))
 #define SCREEN_INFO (*(struct screen_info *)(real_mode+0))
+#define EDID_INFO   (*(struct edid_info *)(real_mode+0x440))

 extern char input_data[];
 extern int input_len;
diff -Naur linux-2.5.66-orig/arch/i386/boot/video.S linux-2.5.66-edid/arch/i386/boot/video.S
--- linux-2.5.66-orig/arch/i386/boot/video.S    2002-12-16 02:07:50.000000000 +0000

        call    mode_params                     # Store mode parameters
+       call    store_edid
        popw    %ds                             # Restore original DS

        popw    %ax

+       pushw   %es                             # just save all registers
+       pushw   %ax                            
+       pushw   %bx
+       pushw   %cx
+       pushw   %dx
+       pushw   %di
+       pushw   %fs                            
+       popw    %es
+       movl    $0x13131313, %eax               # memset block with 0x13
+       movw    $32, %cx
+       movw    $0x440, %di
+       cld
+       rep
+       stosl  
+       movw    $0x4f15, %ax                    # do VBE/DDC
+       movw    $0x01, %bx
+       movw    $0x00, %cx
+       movw    $0x01, %dx
+       movw    $0x440, %di
+       int     $0x10  
+       popw    %di                             # restore all registers        
+       popw    %dx
+       popw    %cx
+       popw    %bx
+       popw    %ax
+       popw    %es    
+       ret
 # VIDEO_SELECT-only variables
 mt_end:                .word   0       # End of video mode table if built
 edit_buf:      .space  6       # Line editor buffer
diff -Naur linux-2.5.66-orig/arch/i386/kernel/setup.c linux-2.5.66-edid/arch/i386/kernel/setup.c
--- linux-2.5.66-orig/arch/i386/kernel/setup.c  2003-03-29 12:36:36.000000000 +0000

 #include <linux/console.h>
 #include <linux/root_dev.h>
 #include <linux/highmem.h>
+#include <video/edid.h>
 #include <asm/e820.h>
 #include <asm/mpspec.h>

        unsigned short length;
        unsigned char table[0];
+struct edid_info edid_info;
 struct e820map e820;

        drive_info = DRIVE_INFO;
        screen_info = SCREEN_INFO;
+       edid_info = EDID_INFO;
        apm_info.bios = APM_BIOS_INFO;
        saved_videomode = VIDEO_MODE;
        printk("Video mode to be used for restore is %lx\n", saved_videomode);
diff -Naur linux-2.5.66-orig/include/asm-i386/setup.h linux-2.5.66-edid/include/asm-i386/setup.h
--- linux-2.5.66-orig/include/asm-i386/setup.h  2002-12-16 02:08:12.000000000 +0000

 #define KERNEL_START (*(unsigned long *) (PARAM+0x214))
 #define INITRD_START (*(unsigned long *) (PARAM+0x218))
 #define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
+#define EDID_INFO   (*(struct edid_info *) (PARAM+0x440))
 #define EDD_NR     (*(unsigned char *) (PARAM+EDDNR))
 #define EDD_BUF     ((struct edd_info *) (PARAM+EDDBUF))
 #define COMMAND_LINE ((char *) (PARAM+2048))
diff -Naur linux-2.5.66-orig/include/video/edid.h linux-2.5.66-edid/include/video/edid.h
--- linux-2.5.66-orig/include/video/edid.h      1970-01-01 00:00:00.000000000 +0000

+#ifndef __linux_video_edid_h__
+#define __linux_video_edid_h__
+#include <linux/config.h>
+#ifdef CONFIG_X86
+struct edid_info {
+       unsigned char dummy[128];
+extern struct edid_info edid_info;
+#endif /* CONFIG_X86 */
+#endif /* __linux_video_edid_h__ */

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at
Please read the FAQ at


1. Q: Memory upgrade issues (EDO vs non-EDO)


I'm about to upgrade my motherboard from a P75 to a PPro200,
and would like to upgrade the memory at the same time.

My P75 motherboard has 32Mb or memory: 2 x 16Mb 60ns non-EDO SIMMS.
I'd like my new system to have 64Mb in total.

My question is, should I:
   (a) buy 64Mb of EDO SIMMS for the PPro motherboard.
   (b) buy 32Mb of EDO SIMMS and also use the old SIMMS.

The only disadvantage I see to (a) is cost :-)
The main disadvantage to (b) is a (likely) performance hit.
Plus I paid an aweful lot of money for those 2x16Mb non-EDO SIMMS
in April 1995 :-) :-)

I suppose another concern is whether a PPro motherboard will
support a mix of EDO and non-EDO memory.  I've only looked into
the ASUS PPro boards so far, and their tech support claims that
they'll support 2x16Mb non-EDO and 2x16Mb EDO on the same board.

FWIW, I'm running Windows NTWS 4.0 and Linux 2.0.27

Any comments/suggestions/opinions are greatly appreciated!

Thanks in advance,
-- Sean.


3. Mixed EDO/non-EDO?

4. File recovery for linux

5. xmodem on 3b2 gets short blocks starting at block 16

6. reposting: mem allocations

7. What difference between EDO DRAM and EDO parity RAM?

8. Dual Monitors

9. Will EDO work with non-EDO ?

10. EDO and non-EDO mix - no X?

11. solaris x86 and EDO ram

12. Non blocking socket blocks; says 'read would block' ?

13. My bad blocks aren't getting marked bad ...