Jan Beulich
2007-Jun-19 10:47 UTC
[Xen-devel] [PATCH] linux/x86: Obtain EDID info from Xen
Taken from our 2.6.22-rc4 tree and made apply - without further testing. The patch contains the necessary adjustment to the public headers - if that''s being pushed to the linux tree automatically, the respective hunk must be removed before applying. Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: head-2007-05-31/arch/i386/kernel/setup-xen.c ==================================================================--- head-2007-05-31.orig/arch/i386/kernel/setup-xen.c 2007-06-01 16:59:22.000000000 +0200 +++ head-2007-05-31/arch/i386/kernel/setup-xen.c 2007-06-01 16:59:27.000000000 +0200 @@ -132,6 +132,9 @@ struct sys_desc_table_struct { }; struct edid_info edid_info; EXPORT_SYMBOL_GPL(edid_info); +#ifndef CONFIG_XEN +#define copy_edid() (edid_info = EDID_INFO) +#endif struct ist_info ist_info; #if defined(CONFIG_X86_SPEEDSTEP_SMI) || \ defined(CONFIG_X86_SPEEDSTEP_SMI_MODULE) @@ -601,7 +604,7 @@ void __init setup_arch(char **cmdline_p) ROOT_DEV = MKDEV(UNNAMED_MAJOR,0); drive_info = DRIVE_INFO; screen_info = SCREEN_INFO; - edid_info = EDID_INFO; + copy_edid(); apm_info.bios = APM_BIOS_INFO; ist_info = IST_INFO; saved_videomode = VIDEO_MODE; Index: head-2007-05-31/arch/x86_64/kernel/setup-xen.c ==================================================================--- head-2007-05-31.orig/arch/x86_64/kernel/setup-xen.c 2007-06-01 16:59:22.000000000 +0200 +++ head-2007-05-31/arch/x86_64/kernel/setup-xen.c 2007-06-01 16:59:27.000000000 +0200 @@ -312,7 +312,7 @@ void __init setup_arch(char **cmdline_p) } else screen_info.orig_video_isVGA = 0; - edid_info = EDID_INFO; + copy_edid(); saved_video_mode = SAVED_VIDEO_MODE; bootloader_type = LOADER_TYPE; Index: head-2007-05-31/drivers/xen/core/firmware.c ==================================================================--- head-2007-05-31.orig/drivers/xen/core/firmware.c 2007-06-01 16:59:22.000000000 +0200 +++ head-2007-05-31/drivers/xen/core/firmware.c 2007-06-01 16:59:27.000000000 +0200 @@ -2,6 +2,7 @@ #include <linux/errno.h> #include <linux/init.h> #include <linux/edd.h> +#include <video/edid.h> #include <xen/interface/platform.h> #include <asm/hypervisor.h> @@ -59,3 +60,20 @@ void __init copy_edd(void) } } #endif + +void __init copy_edid(void) +{ +#if defined(CONFIG_FIRMWARE_EDID) && defined(CONFIG_X86) + xen_platform_op_t op; + + if (!is_initial_xendomain()) + return; + + op.cmd = XENPF_firmware_info; + op.u.firmware_info.index = 0; + op.u.firmware_info.type = XEN_FW_DDC_INFO; + set_xen_guest_handle(op.u.firmware_info.u.ddc_info.edid, edid_info.dummy); + if (HYPERVISOR_platform_op(&op) != 0) + memset(edid_info.dummy, 0x13, sizeof(edid_info.dummy)); +#endif +} Index: head-2007-05-31/include/xen/firmware.h ==================================================================--- head-2007-05-31.orig/include/xen/firmware.h 2007-06-01 16:59:22.000000000 +0200 +++ head-2007-05-31/include/xen/firmware.h 2007-06-01 16:59:27.000000000 +0200 @@ -2,5 +2,6 @@ #define __XEN_FIRMWARE_H__ void copy_edd(void); +void copy_edid(void); #endif /* __XEN_FIRMWARE_H__ */ Index: head-2007-05-31/include/xen/interface/platform.h ==================================================================--- head-2007-05-31.orig/include/xen/interface/platform.h 2007-06-01 16:59:22.000000000 +0200 +++ head-2007-05-31/include/xen/interface/platform.h 2007-06-01 16:59:27.000000000 +0200 @@ -119,6 +119,7 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_platform_q #define XEN_FW_EDD_INFO 2 /* from int 13 AH=41 */ #define XEN_FW_EDD_PARAMS 3 /* from int 13 AH=48 */ #define XEN_FW_MBR_SIGNATURE 4 +#define XEN_FW_DDC_INFO 5 /* from int 10 AX=4f15 */ struct xenpf_firmware_info { /* IN variables. */ uint32_t type; @@ -138,6 +139,12 @@ struct xenpf_firmware_info { /* first uint16_t of buffer must be set to buffer size */ XEN_GUEST_HANDLE(void) edd_params; uint32_t mbr_signature; + struct { + uint8_t capabilities; + uint8_t edid_transfer_time; + /* must refer to 128-byte buffer */ + XEN_GUEST_HANDLE(uint8_t) edid; + } ddc_info; } u; }; typedef struct xenpf_firmware_info xenpf_firmware_info_t; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel