]> xenbits.xen.org Git - xenclient/linux-2.6.27-pq.git/commitdiff
Minor changes for wmi to work with 2.6.27 kernel.
authorKamala Narasimhan <kamala.narasimhan@citrix.com>
Thu, 14 May 2009 20:39:41 +0000 (16:39 -0400)
committerKamala Narasimhan <kamala.narasimhan@citrix.com>
Thu, 14 May 2009 20:39:41 +0000 (16:39 -0400)
master/xen-acpi-wmi

index 77d2a20564da5ac7c6027be8d61395123bf9ae09..7ad3ea5682c6b29f73e1a2cda4035d845c482726 100644 (file)
@@ -1,7 +1,8 @@
-diff -Nur linux-2.6-a/drivers/acpi/ec.c linux-2.6-b/drivers/acpi/ec.c
---- linux-2.6-a/drivers/acpi/ec.c      2009-04-07 16:52:00.000000000 -0400
-+++ linux-2.6-b/drivers/acpi/ec.c      2009-04-07 16:36:54.000000000 -0400
-@@ -123,6 +123,12 @@
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
+index 283f908..2359480 100644
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -123,6 +123,12 @@ static struct acpi_ec {
  
  int acpi_ec_intr = 1; /* Default is interrupt mode */
  
@@ -14,7 +15,7 @@ diff -Nur linux-2.6-a/drivers/acpi/ec.c linux-2.6-b/drivers/acpi/ec.c
  /* --------------------------------------------------------------------------
                               Transaction Management
     -------------------------------------------------------------------------- */
-@@ -377,6 +383,22 @@
+@@ -377,6 +383,22 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
  
        result = acpi_ec_transaction(ec, &t, 0);
        *data = d;
@@ -37,9 +38,10 @@ diff -Nur linux-2.6-a/drivers/acpi/ec.c linux-2.6-b/drivers/acpi/ec.c
        return result;
  }
  
-diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
---- linux-2.6-a/drivers/acpi/wmi.c     2009-04-07 15:31:56.000000000 -0400
-+++ linux-2.6-b/drivers/acpi/wmi.c     2009-04-07 17:29:43.000000000 -0400
+diff --git a/drivers/acpi/wmi.c b/drivers/acpi/wmi.c
+index cfe2c83..7765da4 100644
+--- a/drivers/acpi/wmi.c
++++ b/drivers/acpi/wmi.c
 @@ -1,13 +1,18 @@
  /*
   *  ACPI-WMI mapping driver
@@ -72,7 +74,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
  #include <acpi/acpi_bus.h>
  #include <acpi/acpi_drivers.h>
  
-@@ -45,8 +51,6 @@
+@@ -45,8 +51,6 @@ MODULE_LICENSE("GPL");
  #undef PREFIX
  #define PREFIX "ACPI: WMI: "
  
@@ -81,7 +83,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
  struct guid_block {
        char guid[16];
        union {
-@@ -64,11 +68,25 @@
+@@ -64,11 +68,25 @@ struct wmi_block {
        struct list_head list;
        struct guid_block gblock;
        acpi_handle handle;
@@ -109,25 +111,22 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
  
  /*
   * If the GUID data block is marked as expensive, we must enable and
-@@ -82,133 +100,27 @@
+@@ -81,11 +99,10 @@ static struct wmi_block wmi_blocks;
  static int acpi_wmi_remove(struct acpi_device *device, int type);
  static int acpi_wmi_add(struct acpi_device *device);
--static const struct acpi_device_id wmi_device_ids[] = {
+-
+ static const struct acpi_device_id wmi_device_ids[] = {
 -      {"PNP0C14", 0},
 -      {"pnp0c14", 0},
 -      {"", 0},
--};
--MODULE_DEVICE_TABLE(acpi, wmi_device_ids);
--
- static struct acpi_driver acpi_wmi_driver = {
-       .name = "wmi",
-       .class = ACPI_WMI_CLASS,
--      .ids = wmi_device_ids,
-+      .ids = "PNP0C14, pnp0c14",
-       .ops = {
-               .add = acpi_wmi_add,
-               .remove = acpi_wmi_remove,
++        {"PNP0C14", 0},
++        {"pnp0c14", 0},
++        {"", 0},
+ };
+ MODULE_DEVICE_TABLE(acpi, wmi_device_ids);
+@@ -99,116 +116,17 @@ static struct acpi_driver acpi_wmi_driver = {
                },
  };
  
@@ -245,7 +244,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
                        if (out)
                                *out = wblock;
                        return 1;
-@@ -217,12 +129,46 @@
+@@ -217,12 +135,46 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
        return 0;
  }
  
@@ -293,7 +292,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
   * @instance: Instance index
   * @method_id: Method ID to call
   * &in: Buffer containing input for the method call
-@@ -247,7 +193,7 @@
+@@ -247,7 +199,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
        block = &wblock->gblock;
        handle = wblock->handle;
  
@@ -302,7 +301,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
                return AE_BAD_DATA;
  
        if (block->instance_count < instance)
-@@ -282,7 +228,7 @@
+@@ -282,7 +234,7 @@ EXPORT_SYMBOL_GPL(wmi_evaluate_method);
  
  /**
   * wmi_query_block - Return contents of a WMI block
@@ -311,7 +310,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
   * @instance: Instance index
   * &out: Empty buffer to return the contents of the data block to
   *
-@@ -338,10 +284,10 @@
+@@ -338,10 +290,10 @@ struct acpi_buffer *out)
                 * expensive, but have no corresponding WCxx method. So we
                 * should not fail if this happens.
                 */
@@ -326,7 +325,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
        }
  
        strcpy(method, "WQ");
-@@ -365,7 +311,7 @@
+@@ -365,7 +317,7 @@ EXPORT_SYMBOL_GPL(wmi_query_block);
  
  /**
   * wmi_set_block - Write to a WMI block
@@ -335,7 +334,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
   * @instance: Instance index
   * &in: Buffer containing new values for the data block
   *
-@@ -417,61 +363,6 @@
+@@ -417,61 +369,6 @@ const struct acpi_buffer *in)
  EXPORT_SYMBOL_GPL(wmi_set_block);
  
  /**
@@ -397,7 +396,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
   * wmi_get_event_data - Get WMI data associated with an event
   *
   * @event - Event to find
-@@ -486,6 +377,8 @@
+@@ -486,6 +383,8 @@ acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
        struct guid_block *gblock;
        struct wmi_block *wblock;
        struct list_head *p;
@@ -406,7 +405,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
  
        input.count = 1;
        input.pointer = params;
-@@ -497,27 +390,31 @@
+@@ -497,27 +396,31 @@ acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
                gblock = &wblock->gblock;
  
                if ((gblock->flags & ACPI_WMI_EVENT) &&
@@ -452,7 +451,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
  /*
   * Parse the _WDG method for the GUID data blocks
   */
-@@ -621,12 +518,7 @@
+@@ -621,12 +524,7 @@ static void acpi_wmi_notify(acpi_handle handle, u32 event, void *data)
  
                if ((block->flags & ACPI_WMI_EVENT) &&
                        (block->notify_id == event)) {
@@ -466,7 +465,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
                        break;
                }
        }
-@@ -640,6 +532,7 @@
+@@ -640,6 +538,7 @@ static int acpi_wmi_remove(struct acpi_device *device, int type)
        acpi_remove_address_space_handler(device->handle,
                                ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler);
  
@@ -474,7 +473,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
        return 0;
  }
  
-@@ -659,26 +552,33 @@
+@@ -659,26 +558,33 @@ static int __init acpi_wmi_add(struct acpi_device *device)
                                                    ACPI_ADR_SPACE_EC,
                                                    &acpi_wmi_ec_space_handler,
                                                    NULL, NULL);
@@ -512,7 +511,7 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
  
        result = acpi_bus_register_driver(&acpi_wmi_driver);
  
-@@ -688,6 +588,13 @@
+@@ -688,6 +594,13 @@ static int __init acpi_wmi_init(void)
                printk(KERN_INFO PREFIX "Mapper loaded\n");
        }
  
@@ -526,372 +525,18 @@ diff -Nur linux-2.6-a/drivers/acpi/wmi.c linux-2.6-b/drivers/acpi/wmi.c
        return result;
  }
  
-diff -Nur linux-2.6-a/drivers/xen/acpi-wmi/acpi-wmi.c linux-2.6-b/drivers/xen/acpi-wmi/acpi-wmi.c
---- linux-2.6-a/drivers/xen/acpi-wmi/acpi-wmi.c        1969-12-31 19:00:00.000000000 -0500
-+++ linux-2.6-b/drivers/xen/acpi-wmi/acpi-wmi.c        2009-04-07 16:23:07.000000000 -0400
-@@ -0,0 +1,352 @@
-+/******************************************************************************
-+ * drivers/xen/acpi-wmi/acpi-wmi.c
-+ * 
-+ * Copyright (c) 2009 Kamala Narasimhan
-+ * Copyright (c) 2009 Citrix Systems, Inc.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License version 2
-+ * as published by the Free Software Foundation; or, when distributed
-+ * separately from the Linux kernel or incorporated into other
-+ * software packages, subject to the following license:
-+ *
-+ * Permission is hereby granted, free of charge, to any person obtaining a copy
-+ * of this source file (the "Software"), to deal in the Software without
-+ * restriction, including without limitation the rights to use, copy, modify,
-+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
-+ * and to permit persons to whom the Software is furnished to do so, subject to
-+ * the following conditions:
-+ *
-+ * The above copyright notice and this permission notice shall be included in
-+ * all copies or substantial portions of the Software.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-+ * IN THE SOFTWARE.
-+ */
-+
-+/* Xen acpi-wmi implementation provides the interface required for userspace 
-+ * module (qemu) to communicate with acpi wmi wrapper kernel driver.
-+ * Upon receiving request from qemu to call a WMI method or query or set WMI
-+ * data, it communicates the request to kernel acpi wmi layer which then 
-+ * interacts with the base firmware to get the necessary information/execute
-+ * relevant AML method etc.  The result returned by the base firmware is then
-+ * communicated back to the userspace module (qemu). 
-+ */
-+
-+#include <linux/module.h>
-+#include <linux/miscdevice.h>
-+#include <linux/acpi.h>
-+#include <asm/uaccess.h>
-+#include <xen/public/acpi-wmi.h>
-+
-+/* #define XEN_WMI_DEBUG */
-+
-+static bool xen_wmi_misc_dev_registered = false;
-+static int xen_wmi_ioctl(struct inode *inode, struct file *filp, 
-+                         unsigned int cmd, unsigned long arg);
-+
-+static struct file_operations xen_wmi_fops = {
-+    .owner = THIS_MODULE,
-+    .ioctl = xen_wmi_ioctl,
-+};
-+
-+static struct miscdevice xen_wmi_misc = {
-+        .minor    = MISC_DYNAMIC_MINOR,
-+        .name     = XEN_WMI_DEVICE_NAME,
-+        .fops     = &xen_wmi_fops,
-+};
-+
-+/*
-+ * xen_wmi_copy_input_buffer
-+ */
-+int xen_wmi_copy_input_buffer(xen_wmi_buffer_t *user_buf, struct acpi_buffer *acpi_buf)
-+{
-+    if ( user_buf->length <= 0 )
-+        return XEN_WMI_SUCCESS; 
-+
-+    acpi_buf->pointer = kmalloc(user_buf->length, GFP_KERNEL);
-+    if ( acpi_buf->pointer == NULL )
-+    {
-+        printk("XEN WMI: xen_wmi_copy_input_buffer - Buffer allocation failure\n");
-+        return XEN_WMI_NOT_ENOUGH_MEMORY; 
-+    }
-+
-+    if ( copy_from_user(acpi_buf->pointer,
-+                        (char __user *)user_buf->pointer,
-+                        user_buf->length) )
-+    {
-+        printk("XEN WMI: Unable to copy input buffer argument\n");
-+        kfree(acpi_buf->pointer);
-+        return XEN_WMI_EFAULT;
-+    }
-+
-+    acpi_buf->length = user_buf->length; 
-+    return XEN_WMI_SUCCESS; 
-+}
-+
-+/*
-+ * xen_wmi_copy_output_buffer
-+ */
-+int xen_wmi_copy_output_buffer(struct acpi_buffer *acpi_buf, xen_wmi_buffer_t *user_buf)
-+{
-+    /* IMPORTANT NOTE:  It is a little short sighted to assume that the return type
-+     * will not be anything other than buffer type.  A follow-up check-in will
-+     * cover more types. 
-+     */
-+
-+    union acpi_object *acpi_obj = acpi_buf->pointer;
-+
-+    if ( acpi_obj == NULL )
-+    {
-+        printk("XEN WMI: Invalid acpi buffer!\n");
-+        return XEN_WMI_EFAULT;
-+    }
-+
-+    if ( acpi_obj->type != ACPI_TYPE_BUFFER )
-+    {
-+        printk("XEN WMI: Unsupported acpi return object type - %d\n", acpi_obj->type);
-+        return XEN_WMI_UNSUPPORTED_TYPE;
-+    }
-+
-+    if ( copy_to_user((char __user *) user_buf->copied_length, &acpi_obj->buffer.length, sizeof(size_t)) )
-+    {
-+        printk("XEN WMI: Invalid copied length user buffer!\n");
-+        return XEN_WMI_INVALID_ARGUMENT;
-+    }
-+
-+    if ( user_buf->length < acpi_obj->buffer.length ) 
-+    {
-+        printk("XEN WMI: Required buffer length is - %d\n", acpi_obj->buffer.length);
-+        printk("XEN WMI: Passed in length is - %d\n", user_buf->length);
-+        return XEN_WMI_BUFFER_TOO_SMALL;
-+    }
-+
-+    if ( copy_to_user((char __user *) user_buf->pointer, acpi_obj->buffer.pointer, acpi_obj->buffer.length) )
-+    {
-+        printk("XEN WMI: Invalid user output buffer\n");
-+        return XEN_WMI_NOT_ENOUGH_MEMORY; 
-+    }
-+
-+    return XEN_WMI_SUCCESS; 
-+} 
-+
-+#ifdef XEN_WMI_DEBUG
-+
-+/*
-+ * xen_wmi_print_buffer
-+ */
-+void xen_wmi_print_buffer(struct acpi_buffer *acpi_buf)
-+{
-+    int count;
-+    union acpi_object *acpi_obj = acpi_buf->pointer;
-+
-+    if ( acpi_obj == NULL || acpi_obj->type != ACPI_TYPE_BUFFER )
-+    {
-+        printk("XEN WMI: Unsupported output buffer data!\n");
-+        return ;
-+    }
-+
-+    printk("XEN WMI: Output buffer length is - %d\n", acpi_obj->buffer.length);
-+    printk("XEN WMI:  Buffer:  ");
-+    for (count=0; count < acpi_obj->buffer.length; count++)
-+        printk("%d  ", ((byte *)(acpi_obj->buffer.pointer))[count]);
-+    printk("\n");
-+}
-+
-+#endif /* XEN_WMI_DEBUG */
-+
-+/*
-+ * xen_wmi_invoke_method 
-+ */
-+int xen_wmi_invoke_method(xen_wmi_obj_invocation_data_t *obj_inv_data)
-+{
-+    int result;
-+    struct acpi_buffer in_buf, *in_arg = NULL, out_buf = {ACPI_ALLOCATE_BUFFER, NULL};
-+
-+    result = xen_wmi_copy_input_buffer(&obj_inv_data->xen_wmi_arg.xen_wmi_method_arg.in_buf,
-+                                       &in_buf); 
-+    if ( result != XEN_WMI_SUCCESS )
-+        return result;
-+
-+    if ( in_buf.length > 0 ) 
-+        in_arg = &in_buf;
-+
-+    result = wmi_evaluate_method(obj_inv_data->guid, 
-+                 obj_inv_data->xen_wmi_arg.xen_wmi_method_arg.instance, 
-+                 obj_inv_data->xen_wmi_arg.xen_wmi_method_arg.method_id, 
-+                 in_arg, &out_buf);
-+
-+    if ( in_arg != NULL )
-+        kfree(in_buf.pointer);
-+
-+    if ( out_buf.length > 0  && result == XEN_WMI_SUCCESS )
-+    {
-+#ifdef XEN_WMI_DEBUG
-+        xen_wmi_print_buffer(&out_buf);
-+#endif
-+        result = xen_wmi_copy_output_buffer(&out_buf,
-+                                            &obj_inv_data->xen_wmi_arg.xen_wmi_method_arg.out_buf);
-+        kfree(out_buf.pointer); 
-+    }
-+    else if ( result != XEN_WMI_SUCCESS )
-+        printk("XEN WMI- Invoke WMI method failed with error - %d\n", result);
-+
-+    return result;
-+} 
-+
-+/*
-+ * xen_wmi_query_object
-+ */
-+int xen_wmi_query_object(xen_wmi_obj_invocation_data_t *obj_inv_data)
-+{
-+    int result; 
-+    struct acpi_buffer out_buf = {ACPI_ALLOCATE_BUFFER, NULL};
-+
-+    result = wmi_query_block(obj_inv_data->guid, 
-+                             obj_inv_data->xen_wmi_arg.xen_wmi_query_obj_arg.instance,
-+                             &out_buf);
-+
-+    if ( out_buf.length > 0 && result == XEN_WMI_SUCCESS )
-+    {
-+#ifdef XEN_WMI_DEBUG
-+        xen_wmi_print_buffer(&out_buf);
-+#endif
-+        result = xen_wmi_copy_output_buffer(&out_buf,
-+                                            &obj_inv_data->xen_wmi_arg.xen_wmi_query_obj_arg.out_buf);
-+        kfree(out_buf.pointer);
-+    }
-+    else
-+        printk("XEN WMI - Query WMI object failed with error - %d; output buffer length - %d\n",
-+               result, out_buf.length);
-+
-+    return result;
-+}
-+
-+/*
-+ * xen_wmi_set_object
-+ */
-+int xen_wmi_set_object(xen_wmi_obj_invocation_data_t *obj_inv_data) 
-+{
-+    int result;
-+    struct acpi_buffer in_buf;
-+
-+    if ( obj_inv_data->xen_wmi_arg.xen_wmi_set_obj_arg.in_buf.length <= 0 )
-+        return XEN_WMI_INVALID_ARGUMENT;
-+
-+    result = xen_wmi_copy_input_buffer(&obj_inv_data->xen_wmi_arg.xen_wmi_set_obj_arg.in_buf,
-+                                       &in_buf);
-+    if ( result != XEN_WMI_SUCCESS )
-+        return result;
-+
-+    result = wmi_set_block(obj_inv_data->guid, 
-+                           obj_inv_data->xen_wmi_arg.xen_wmi_set_obj_arg.instance,
-+                           &in_buf); 
-+    if ( result != XEN_WMI_SUCCESS )
-+        printk("XEN WMI: Set object failed with error - %d\n", result);
-+
-+    kfree(in_buf.pointer);
-+    return result;
-+}
-+
-+/*
-+ * xen_wmi_get_event_data 
-+ */
-+int xen_wmi_get_event_data(xen_wmi_obj_invocation_data_t *obj_inv_data) 
-+{
-+    int result;
-+    struct acpi_buffer out_buf = {ACPI_ALLOCATE_BUFFER, NULL};
-+
-+    result = wmi_get_event_data(obj_inv_data->xen_wmi_arg.xen_wmi_event_data_arg.event_id,
-+                       &out_buf);
-+
-+    if ( out_buf.length > 0 && result == XEN_WMI_SUCCESS )
-+    {
-+#ifdef XEN_WMI_DEBUG
-+        xen_wmi_print_buffer(&out_buf);
-+#endif
-+        result = xen_wmi_copy_output_buffer(&out_buf,
-+                                            &obj_inv_data->xen_wmi_arg.xen_wmi_event_data_arg.out_buf);
-+        kfree(out_buf.pointer);
-+    }
-+    else
-+        printk("XEN WMI: Get event data failed with error - %d\n", result);
-+
-+    return result;
-+}
-+
-+/*
-+ * xen_wmi_ioctl 
-+ */
-+static int xen_wmi_ioctl(struct inode *inode, struct file *filp,
-+                         unsigned int cmd, unsigned long arg)
-+{
-+    xen_wmi_obj_invocation_data_t obj_inv_data;
-+
-+#ifdef XEN_WMI_DEBUG
-+    printk("XEN WMI:  In xen_wmi_ioctl - %d\n", cmd);
-+#endif
-+
-+    memset(&obj_inv_data, 0, sizeof(obj_inv_data));
-+    if ( copy_from_user(&obj_inv_data, (char __user *)arg, sizeof(obj_inv_data)) )
-+    {
-+        printk("XEN WMI: Invalid object invocation parameter\n");
-+        return XEN_WMI_EFAULT;
-+    }
-+ 
-+    switch ( cmd ) 
-+    {
-+        case XEN_WMI_IOCTL_CALL_METHOD:
-+            return xen_wmi_invoke_method(&obj_inv_data);
-+        case XEN_WMI_IOCTL_QUERY_OBJECT:
-+            return xen_wmi_query_object(&obj_inv_data); 
-+        case XEN_WMI_IOCTL_SET_OBJECT:
-+            return xen_wmi_set_object(&obj_inv_data); 
-+        case XEN_WMI_IOCTL_GET_EVENT_DATA:
-+            return xen_wmi_get_event_data(&obj_inv_data); 
-+    }
-+
-+    return XEN_WMI_ENOIOCTLCMD;
-+}
-+
-+/*
-+ * xen_wmi_init 
-+ */
-+static int __init xen_wmi_init(void)
-+{
-+    int ret;
-+
-+    ret = misc_register(&xen_wmi_misc);
-+    if ( ret < 0 )
-+        printk("XEN WMI: misc_register failed with error - %d\n", ret);
-+    else
-+        xen_wmi_misc_dev_registered = true;
-+
-+#ifdef XEN_WMI_DEBUG
-+    printk("XEN WMI: xen-acpi-wmi misc_register succeeded!\n"); 
-+#endif
-+    return ret;
-+}
-+
-+/*
-+ * xen_wmi_exit 
-+ */
-+static void xen_wmi_exit(void)
-+{
-+    int ret;
-+
-+    if ( xen_wmi_misc_dev_registered == false )
-+        return;
-+
-+    if ( (ret = misc_deregister(&xen_wmi_misc)) < 0 )
-+        printk("XEN WMI: misc_deregister failed with error - %d\n", ret); 
-+}
-+
-+module_init(xen_wmi_init);
-+module_exit(xen_wmi_exit);
-+MODULE_LICENSE("Dual BSD/GPL");
-+
-diff -Nur linux-2.6-a/drivers/xen/acpi-wmi/Makefile linux-2.6-b/drivers/xen/acpi-wmi/Makefile
---- linux-2.6-a/drivers/xen/acpi-wmi/Makefile  1969-12-31 19:00:00.000000000 -0500
-+++ linux-2.6-b/drivers/xen/acpi-wmi/Makefile  2009-04-07 16:23:07.000000000 -0400
-@@ -0,0 +1,2 @@
-+
-+obj-y := acpi-wmi.o
-diff -Nur linux-2.6-a/drivers/xen/Kconfig linux-2.6-b/drivers/xen/Kconfig
---- linux-2.6-a/drivers/xen/Kconfig    2009-04-07 16:51:58.000000000 -0400
-+++ linux-2.6-b/drivers/xen/Kconfig    2009-04-07 16:25:37.000000000 -0400
-@@ -265,6 +265,13 @@
+@@ -708,5 +621,5 @@ static void __exit acpi_wmi_exit(void)
+       printk(KERN_INFO PREFIX "Mapper unloaded\n");
+ }
+-subsys_initcall(acpi_wmi_init);
++module_init(acpi_wmi_init);
+ module_exit(acpi_wmi_exit);
+diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
+index c672d05..a215f63 100644
+--- a/drivers/xen/Kconfig
++++ b/drivers/xen/Kconfig
+@@ -265,6 +265,13 @@ config XEN_NR_GUEST_DEVICES
          Specify the total number of virtual devices (i.e. both frontend
          and backend) that you want the kernel to be able to service.
  
@@ -905,109 +550,12 @@ diff -Nur linux-2.6-a/drivers/xen/Kconfig linux-2.6-b/drivers/xen/Kconfig
  choice
        prompt "Xen version compatibility"
        default XEN_COMPAT_030002_AND_LATER
-diff -Nur linux-2.6-a/drivers/xen/Makefile linux-2.6-b/drivers/xen/Makefile
---- linux-2.6-a/drivers/xen/Makefile   2009-04-07 16:52:14.000000000 -0400
-+++ linux-2.6-b/drivers/xen/Makefile   2009-04-07 16:26:11.000000000 -0400
-@@ -30,3 +30,4 @@
+diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
+index ab35228..873e5a3 100644
+--- a/drivers/xen/Makefile
++++ b/drivers/xen/Makefile
+@@ -30,3 +30,4 @@ obj-$(CONFIG_XEN_GRANT_DEV)  += gntdev/
  obj-$(CONFIG_XEN_NETDEV_ACCEL_SFC_UTIL)               += sfc_netutil/
  obj-$(CONFIG_XEN_NETDEV_ACCEL_SFC_FRONTEND)   += sfc_netfront/
  obj-$(CONFIG_XEN_NETDEV_ACCEL_SFC_BACKEND)    += sfc_netback/
 +obj-$(CONFIG_XEN_ACPI_WMI_WRAPPER)              += acpi-wmi/
-diff -Nur linux-2.6-a/include/xen/public/acpi-wmi.h linux-2.6-b/include/xen/public/acpi-wmi.h
---- linux-2.6-a/include/xen/public/acpi-wmi.h  1969-12-31 19:00:00.000000000 -0500
-+++ linux-2.6-b/include/xen/public/acpi-wmi.h  2009-04-07 16:44:29.000000000 -0400
-@@ -0,0 +1,94 @@
-+/******************************************************************************
-+ * acpi-wmi.h
-+ *
-+ * Interface to /proc/misc/xen-acpi-wmi
-+ *
-+ * Copyright (c) 2009 Kamala Narasimhan
-+ * Copyright (c) 2009 Citrix Systems, Inc.
-+ *
-+ * This program is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU General Public License version 2
-+ * as published by the Free Software Foundation; or, when distributed
-+ * separately from the Linux kernel or incorporated into other
-+ * software packages, subject to the following license:
-+ *
-+ * Permission is hereby granted, free of charge, to any person obtaining a copy
-+ * of this source file (the "Software"), to deal in the Software without
-+ * restriction, including without limitation the rights to use, copy, modify,
-+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
-+ * and to permit persons to whom the Software is furnished to do so, subject to
-+ * the following conditions:
-+ *
-+ * The above copyright notice and this permission notice shall be included in
-+ * all copies or substantial portions of the Software.
-+ *
-+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-+ * IN THE SOFTWARE.
-+ */
-+
-+
-+#ifndef _XEN_WMI_ACPI
-+#define _XEN_WMI_ACPI
-+
-+/*
-+ * Userspace Interface
-+ */
-+
-+#define XEN_WMI_DEVICE_NAME              "xen-acpi-wmi"
-+#define XEN_WMI_GUID_SIZE                16
-+
-+#define XEN_WMI_SUCCESS                  0
-+#define XEN_WMI_UNSUPPORTED_TYPE        -1
-+#define XEN_WMI_BUFFER_TOO_SMALL        -11
-+#define XEN_WMI_NOT_ENOUGH_MEMORY       -12
-+#define XEN_WMI_EFAULT                  -14
-+#define XEN_WMI_INVALID_ARGUMENT        -22
-+#define XEN_WMI_ENOIOCTLCMD             -515
-+ 
-+#define XEN_WMI_IOCTL_CALL_METHOD        100
-+#define XEN_WMI_IOCTL_QUERY_OBJECT       101
-+#define XEN_WMI_IOCTL_SET_OBJECT         102
-+#define XEN_WMI_IOCTL_GET_EVENT_DATA     103
-+
-+typedef unsigned char byte;
-+
-+typedef struct xen_wmi_buffer {
-+    size_t       length; 
-+    void        *pointer;
-+    size_t      *copied_length;
-+} xen_wmi_buffer_t;
-+
-+typedef struct xen_wmi_obj_invocation_data { 
-+    byte                       guid[XEN_WMI_GUID_SIZE];
-+    union {
-+        struct {
-+            ushort             instance;
-+            uint               method_id;
-+            xen_wmi_buffer_t   in_buf;
-+            xen_wmi_buffer_t   out_buf;
-+        } xen_wmi_method_arg;
-+
-+        struct {
-+            ushort             instance;
-+            xen_wmi_buffer_t   out_buf;
-+        } xen_wmi_query_obj_arg;
-+
-+        struct {
-+            ushort             instance;
-+            xen_wmi_buffer_t   in_buf;
-+        } xen_wmi_set_obj_arg;
-+
-+        struct {
-+            ushort             event_id;
-+            xen_wmi_buffer_t   out_buf;
-+        } xen_wmi_event_data_arg;
-+    } xen_wmi_arg;
-+} xen_wmi_obj_invocation_data_t;
-+
-+#endif /* _XEN_WMI_ACPI */
-+