[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] linux/x86: Obtain EDD info from Xen



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1182362965 -3600
# Node ID 706976fe8333a88c4d3482253927faa3b4714b15
# Parent  496e3157a35c32d7a550223914cfb92389a80874
linux/x86: Obtain EDD info from Xen
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 arch/i386/kernel/setup-xen.c             |    3 +
 arch/x86_64/kernel/setup-xen.c           |    3 +
 buildconfigs/linux-defconfig_xen0_x86_32 |    2 +
 buildconfigs/linux-defconfig_xenU_x86_32 |    2 +
 buildconfigs/linux-defconfig_xen_x86_32  |    2 +
 drivers/firmware/Kconfig                 |    1 
 drivers/xen/core/Makefile                |    2 -
 drivers/xen/core/firmware.c              |   56 +++++++++++++++++++++++++++++++
 include/xen/firmware.h                   |    6 +++
 include/xen/interface/platform.h         |   32 +++++++++++++++++
 10 files changed, 107 insertions(+), 2 deletions(-)

diff -r 496e3157a35c -r 706976fe8333 arch/i386/kernel/setup-xen.c
--- a/arch/i386/kernel/setup-xen.c      Wed Jun 20 14:39:34 2007 +0100
+++ b/arch/i386/kernel/setup-xen.c      Wed Jun 20 19:09:25 2007 +0100
@@ -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)
 {
diff -r 496e3157a35c -r 706976fe8333 arch/x86_64/kernel/setup-xen.c
--- a/arch/x86_64/kernel/setup-xen.c    Wed Jun 20 14:39:34 2007 +0100
+++ b/arch/x86_64/kernel/setup-xen.c    Wed Jun 20 19:09:25 2007 +0100
@@ -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)
 {
diff -r 496e3157a35c -r 706976fe8333 buildconfigs/linux-defconfig_xen0_x86_32
--- a/buildconfigs/linux-defconfig_xen0_x86_32  Wed Jun 20 14:39:34 2007 +0100
+++ b/buildconfigs/linux-defconfig_xen0_x86_32  Wed Jun 20 19:09:25 2007 +0100
@@ -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
diff -r 496e3157a35c -r 706976fe8333 buildconfigs/linux-defconfig_xenU_x86_32
--- a/buildconfigs/linux-defconfig_xenU_x86_32  Wed Jun 20 14:39:34 2007 +0100
+++ b/buildconfigs/linux-defconfig_xenU_x86_32  Wed Jun 20 19:09:25 2007 +0100
@@ -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
diff -r 496e3157a35c -r 706976fe8333 buildconfigs/linux-defconfig_xen_x86_32
--- a/buildconfigs/linux-defconfig_xen_x86_32   Wed Jun 20 14:39:34 2007 +0100
+++ b/buildconfigs/linux-defconfig_xen_x86_32   Wed Jun 20 19:09:25 2007 +0100
@@ -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
diff -r 496e3157a35c -r 706976fe8333 drivers/firmware/Kconfig
--- a/drivers/firmware/Kconfig  Wed Jun 20 14:39:34 2007 +0100
+++ b/drivers/firmware/Kconfig  Wed Jun 20 19:09:25 2007 +0100
@@ -8,7 +8,6 @@ config EDD
 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
diff -r 496e3157a35c -r 706976fe8333 drivers/xen/core/Makefile
--- a/drivers/xen/core/Makefile Wed Jun 20 14:39:34 2007 +0100
+++ b/drivers/xen/core/Makefile Wed Jun 20 19:09:25 2007 +0100
@@ -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 -r 496e3157a35c -r 706976fe8333 drivers/xen/core/firmware.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/xen/core/firmware.c       Wed Jun 20 19:09:25 2007 +0100
@@ -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 -r 496e3157a35c -r 706976fe8333 include/xen/firmware.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/include/xen/firmware.h    Wed Jun 20 19:09:25 2007 +0100
@@ -0,0 +1,6 @@
+#ifndef __XEN_FIRMWARE_H__
+#define __XEN_FIRMWARE_H__
+
+void copy_edd(void);
+
+#endif /* __XEN_FIRMWARE_H__ */
diff -r 496e3157a35c -r 706976fe8333 include/xen/interface/platform.h
--- a/include/xen/interface/platform.h  Wed Jun 20 14:39:34 2007 +0100
+++ b/include/xen/interface/platform.h  Wed Jun 20 19:09:25 2007 +0100
@@ -114,6 +114,37 @@ typedef struct xenpf_platform_quirk xenp
 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
+#define XEN_FW_DISK_MBR_SIGNATURE 2
+struct xenpf_firmware_info {
+    /* IN variables. */
+    uint32_t type;
+    uint32_t index;
+    /* OUT variables. */
+    union {
+        struct {
+            /* Int13, Fn48: Check Extensions Present. */
+            uint8_t device;                   /* %dl: bios device number */
+            uint8_t version;                  /* %ah: major version      */
+            uint16_t interface_support;       /* %cx: support bitmap     */
+            /* Int13, Fn08: Legacy Get Device Parameters. */
+            uint16_t legacy_max_cylinder;     /* %cl[7:6]:%ch: max cyl # */
+            uint8_t legacy_max_head;          /* %dh: max head #         */
+            uint8_t legacy_sectors_per_track; /* %cl[5:0]: max sector #  */
+            /* Int13, Fn41: Get Device Parameters (as filled into %ds:%esi). */
+            /* NB. First uint16_t of buffer must be set to buffer size.      */
+            XEN_GUEST_HANDLE(void) edd_params;
+        } disk_info; /* XEN_FW_DISK_INFO */
+        struct {
+            uint8_t device;                   /* bios device number  */
+            uint32_t mbr_signature;           /* offset 0x1b8 in mbr */
+        } disk_mbr_signature; /* XEN_FW_DISK_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 +155,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;
 };

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.