]> xenbits.xensource.com Git - people/vhanquez/xen.git/commitdiff
linux/x86: Obtain EDD info from Xen
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 4 Feb 2008 13:48:19 +0000 (13:48 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 4 Feb 2008 13:48:19 +0000 (13:48 +0000)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6.18-xen changeset:   67:706976fe8333a88c4d3482253927faa3b4714b15
linux-2.6.18-xen date:        Wed Jun 20 19:09:25 2007 +0100

Fix build with CONFIG_EDD disabled.
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6.18-xen changeset:   76:6433fb4f88d6779073bb527e0ea13814206d3259
linux-2.6.18-xen date:        Thu Jun 21 22:37:49 2007 +0100

buildconfigs/linux-defconfig_xen0_x86_32
buildconfigs/linux-defconfig_xenU_x86_32
buildconfigs/linux-defconfig_xen_x86_32
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
linux-2.6-xen-sparse/drivers/firmware/Kconfig
linux-2.6-xen-sparse/drivers/xen/core/Makefile
linux-2.6-xen-sparse/drivers/xen/core/firmware.c [new file with mode: 0644]
linux-2.6-xen-sparse/include/xen/firmware.h [new file with mode: 0644]

index 0ade3530043148775347aaf7c4ae540ffad8b917..99379ce57791c770ab523513f7cd76a9144ae3c3 100644 (file)
@@ -155,12 +155,14 @@ CONFIG_VM86=y
 # CONFIG_I8K is not set
 # CONFIG_X86_REBOOTFIXUPS is not set
 CONFIG_MICROCODE=y
+CONFIG_X86_MSR=y
 CONFIG_X86_CPUID=y
 CONFIG_SWIOTLB=y
 
 #
 # Firmware Drivers
 #
+CONFIG_EDD=y
 # CONFIG_DELL_RBU is not set
 # CONFIG_DCDBAS is not set
 # CONFIG_NOHIGHMEM is not set
index f2bbb868efa24a1188f2c5fe9c0e4fd2dc26ccfc..18f20b9f3c75f0b12b9a3c2fce66eea2a350ed05 100644 (file)
@@ -152,12 +152,14 @@ CONFIG_VM86=y
 # CONFIG_TOSHIBA is not set
 # CONFIG_I8K is not set
 # CONFIG_X86_REBOOTFIXUPS is not set
+# CONFIG_X86_MSR is not set
 CONFIG_X86_CPUID=y
 CONFIG_SWIOTLB=y
 
 #
 # Firmware Drivers
 #
+# CONFIG_EDD is not set
 # CONFIG_DELL_RBU is not set
 # CONFIG_DCDBAS is not set
 # CONFIG_NOHIGHMEM is not set
index 1c949151ccf0763efcde962a4805b0f62fbe6df5..a5e8d95111867ecf858281102b57cfacdb445bc3 100644 (file)
@@ -160,12 +160,14 @@ CONFIG_VM86=y
 # CONFIG_I8K is not set
 # CONFIG_X86_REBOOTFIXUPS is not set
 CONFIG_MICROCODE=y
+CONFIG_X86_MSR=y
 CONFIG_X86_CPUID=m
 CONFIG_SWIOTLB=y
 
 #
 # Firmware Drivers
 #
+CONFIG_EDD=y
 CONFIG_DELL_RBU=m
 CONFIG_DCDBAS=m
 # CONFIG_NOHIGHMEM is not set
index f355f9a22924b91de87a662f2bbf5901e9d88cbd..6fc5f565bb2cf679f0678502f75ac924d1878af2 100644 (file)
@@ -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>
@@ -740,6 +741,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.
@@ -752,6 +754,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)
 {
index 74e8fd6363867063d1a5343ba02bff47cbae1733..ecb587648b2635e90322dcf4777f81923da515b1 100644 (file)
@@ -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)
@@ -534,6 +535,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.
@@ -546,6 +548,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)
 {
index a444f63d306403cffccb801bb054e7a27602f923..731c3d5da0dc7c6bc66a33a705f9b7a2fceab90a 100644 (file)
@@ -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
index d5435af71f6e19ed20fc7e14073eba2a33bc4c1a..12d2d69201e4c2904a582aa53ab93630b7b9f731 100644 (file)
@@ -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_SYS_HYPERVISOR)   += hypervisor_sysfs.o
diff --git a/linux-2.6-xen-sparse/drivers/xen/core/firmware.c b/linux-2.6-xen-sparse/drivers/xen/core/firmware.c
new file mode 100644 (file)
index 0000000..6ae3c56
--- /dev/null
@@ -0,0 +1,56 @@
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/edd.h>
+#include <xen/interface/platform.h>
+#include <asm/hypervisor.h>
+
+#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
+void __init copy_edd(void)
+{
+       int ret;
+       xen_platform_op_t op;
+
+       if (!is_initial_xendomain())
+               return;
+
+       op.cmd = XENPF_firmware_info;
+
+       for (op.u.firmware_info.index = 0, ret = 0;
+            ret != -ESRCH && ret != -ENOSYS && edd.edd_info_nr < EDDMAXNR;
+            ++op.u.firmware_info.index) {
+               struct edd_info *info = edd.edd_info + edd.edd_info_nr;
+
+               op.u.firmware_info.type = XEN_FW_DISK_INFO;
+               info->params.length = sizeof(info->params);
+               set_xen_guest_handle(op.u.firmware_info.u.disk_info.edd_params,
+                                    &info->params);
+               ret = HYPERVISOR_platform_op(&op);
+               if (ret)
+                       continue;
+
+#define C(x) info->x = op.u.firmware_info.u.disk_info.x
+               C(device);
+               C(version);
+               C(interface_support);
+               C(legacy_max_cylinder);
+               C(legacy_max_head);
+               C(legacy_sectors_per_track);
+#undef C
+
+               ++edd.edd_info_nr;
+       }
+
+       op.u.firmware_info.type = XEN_FW_DISK_MBR_SIGNATURE;
+       for (op.u.firmware_info.index = 0, ret = 0;
+            (ret != -ESRCH && ret != -ENOSYS &&
+             edd.mbr_signature_nr < EDD_MBR_SIG_MAX);
+            ++op.u.firmware_info.index) {
+               ret = HYPERVISOR_platform_op(&op);
+               if (ret)
+                       continue;
+               edd.mbr_signature[edd.mbr_signature_nr++] =
+                       op.u.firmware_info.u.disk_mbr_signature.mbr_signature;
+       }
+}
+#endif
diff --git a/linux-2.6-xen-sparse/include/xen/firmware.h b/linux-2.6-xen-sparse/include/xen/firmware.h
new file mode 100644 (file)
index 0000000..fe4bf10
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef __XEN_FIRMWARE_H__
+#define __XEN_FIRMWARE_H__
+
+#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
+void copy_edd(void);
+#endif
+
+#endif /* __XEN_FIRMWARE_H__ */