linux/x86: Obtain EDD info from Xen
PATCH 1/1 linux/x86: Obtain EDD info from Xen
Subject: Obtain EDD 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.
arch/i386/kernel/setup-xen.c +3 -0
@@ -66,6 +66,7 @@#include <xen/interface/physdev.h> #include <xen/interface/memory.h> #include <xen/features.h> +#include <xen/firmware.h> #include <xen/xencons.h> #include <setup_arch.h> #include <bios_ebda.h>
@@ -170,6 +171,7 @@ struct edd edd;#ifdef CONFIG_EDD_MODULE EXPORT_SYMBOL (edd);#endif +#ifndef CONFIG_XEN /** * copy_edd() - Copy the BIOS EDD information * from boot_params into a safe place.
@@ -182,6 +184,7 @@ static inline void copy_edd(void) edd.mbr_signature_nr =EDD_MBR_SIG_NR ; edd.edd_info_nr = EDD_NR; } +#endif #else static inline void copy_edd (void ) {
arch/x86_64/kernel/setup-xen.c +3 -0
@@ -71,6 +71,7 @@#include <asm/hypervisor.h> #include <xen/interface/nmi.h> #include <xen/features.h> +#include <xen/firmware.h> #include <xen/xencons.h> #define PFN_UP (x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)#define PFN_PHYS (x) ((x) << PAGE_SHIFT)
@@ -225,6 +226,7 @@ struct edd edd;#ifdef CONFIG_EDD_MODULE EXPORT_SYMBOL (edd);#endif +#ifndef CONFIG_XEN /** * copy_edd() - Copy the BIOS EDD information * from boot_params into a safe place.
@@ -237,6 +239,7 @@ static inline void copy_edd(void) edd.mbr_signature_nr =EDD_MBR_SIG_NR ; edd.edd_info_nr = EDD_NR; } +#endif #else static inline void copy_edd (void ) {
drivers/firmware/Kconfig +0 -1
@@ -8,7 +8,6 @@ menu "Firmware Drivers" config EDD tristate "BIOS Enhanced Disk Drive calls determine boot disk" depends on !IA64 - depends on !XEN help Say Y or M here if you want to enable BIOS Enhanced Disk Drive Services real mode BIOS calls to determine which disk
drivers/xen/core/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -obj-y := evtchn.o gnttab.o features.o reboot.o machine_reboot.o +obj-y := evtchn.o gnttab.o features.o reboot.o machine_reboot.o firmware.o obj-$(CONFIG_PROC_FS) += xen_proc.o obj-$(CONFIG_SYSFS) += hypervisor_sysfs.o
drivers/xen/core/firmware.c new file +61 -0
61 lines not on this page · raw message
include/xen/firmware.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __XEN_FIRMWARE_H__ +#define __XEN_FIRMWARE_H__ + +void copy_edd (void ); + +#endif /* __XEN_FIRMWARE_H__ */
include/xen/interface/platform.h +30 -0
@@ -114,6 +114,35 @@ struct xenpf_platform_quirk {typedef struct xenpf_platform_quirk xenpf_platform_quirk_t ;DEFINE_XEN_GUEST_HANDLE (xenpf_platform_quirk_t); +#define XENPF_firmware_info 50 +#define XEN_FW_DISK_INFO 1/* from int 13 AH=08 */ +#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 +struct xenpf_firmware_info { +/* IN variables. */ +uint32_t type; +uint32_t index; +/* OUT variables. */ +union { +struct { +uint16_t max_cylinder; +uint8_t max_head; +uint8_t sectors_per_track; + } disk_info; +struct { +uint8_t device; +uint8_t version; +uint16_t interface; + } edd_info; +/* first uint16_t of buffer must be set to buffer size */ +XEN_GUEST_HANDLE (void ) edd_params; +uint32_t mbr_signature; + } u; +}; +typedef struct xenpf_firmware_info xenpf_firmware_info_t ; +DEFINE_XEN_GUEST_HANDLE (xenpf_firmware_info_t); +struct xen_platform_op {uint32_t cmd;uint32_t interface_version;/* XENPF_INTERFACE_VERSION */
@@ -124,6 +153,7 @@ struct xen_platform_op {struct xenpf_read_memtype read_memtype;struct xenpf_microcode_update microcode;struct xenpf_platform_quirk platform_quirk; +struct xenpf_firmware_info firmware_info;uint8_t pad[128 ]; } u; };
Quoted 9 lines · Jan Beulich
#ifdef
CONFIG_EDD_MODULE
EXPORT_SYMBOL(edd);
#endifarch/i386/kernel/setup-xen.c +1
-0+#ifndef CONFIG_XEN /** * copy_edd() - Copy the BIOS EDD information * from boot_params into a safe place.
arch/i386/kernel/setup-xen.c static inline void copy_edd(void) · line 245
Quoted 7 lines
arch/i386/kernel/setup-xen.c +1
-0@@ -237,6 +239,7 @@ static inline void copy_edd(void) edd.mbr_signature_nr =EDD_MBR_SIG_NR ; edd.edd_info_nr = EDD_NR; } +#endif #else static inline void copy_edd (void ) {
This doesn't compile with CONFIG_EDD unset. The static inline copy_edd() conflicts with the xen/firmware.h declaration.
J
Quoted 3 lines
This doesn't compile with
CONFIG_EDDunset. The static inlinecopy_edd()conflicts with thexen/firmware.hdeclaration.
Now fixed, hopefully.
K.