WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] adjust ACPI PM1a/b event/control information retriev

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] adjust ACPI PM1a/b event/control information retrieval
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Fri, 04 Apr 2008 12:29:53 +0100
Delivery-date: Fri, 04 Apr 2008 04:29:49 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Restore the fallback to v1 fields which got removed as a side effect
of c/s 17249. Additionally, use the correct width from the tables
rather than hardcoded values. Also make the copying code more compact
by using a macro, and print the results earlier to have better
indication whether subsequent failures lead to the information
retrieved getting invalidated (which I actually think isn't correct,
as the PM1a/b stuff may also be needed to just power off the machine -
see a Linux side patch soon to be submitted).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2008-04-01/xen/arch/x86/acpi/boot.c
===================================================================
--- 2008-04-01.orig/xen/arch/x86/acpi/boot.c    2008-03-31 11:18:28.000000000 
+0200
+++ 2008-04-01/xen/arch/x86/acpi/boot.c 2008-04-02 11:28:40.000000000 +0200
@@ -374,6 +374,18 @@ extern u32 pmtmr_ioport;
 #endif
 
 #ifdef CONFIG_ACPI_SLEEP
+#define acpi_fadt_copy_address(dst, src, len) do {                     \
+       if (fadt->header.revision >= FADT2_REVISION_ID)                 \
+               acpi_sinfo.dst##_blk = fadt->x##src##_block;            \
+       if (!acpi_sinfo.dst##_blk.address) {                            \
+               acpi_sinfo.dst##_blk.address      = fadt->src##_block;  \
+               acpi_sinfo.dst##_blk.space_id     = ACPI_ADR_SPACE_SYSTEM_IO; \
+               acpi_sinfo.dst##_blk.bit_width    = fadt->len##_length << 3; \
+               acpi_sinfo.dst##_blk.bit_offset   = 0;                  \
+               acpi_sinfo.dst##_blk.access_width = 0;                  \
+       } \
+} while (0)
+
 /* Get pm1x_cnt and pm1x_evt information for ACPI sleep */
 static void __init
 acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
@@ -388,37 +400,18 @@ acpi_fadt_parse_sleep_info(struct acpi_t
                goto bad;
        rsdp = __va(rsdp_phys);
 
-       if (fadt->header.revision >= FADT2_REVISION_ID) {
-               memcpy(&acpi_sinfo.pm1a_cnt_blk, &fadt->xpm1a_control_block,
-                       sizeof(struct acpi_generic_address));
-               memcpy(&acpi_sinfo.pm1b_cnt_blk, &fadt->xpm1b_control_block,
-                       sizeof(struct acpi_generic_address));
-               memcpy(&acpi_sinfo.pm1a_evt_blk, &fadt->xpm1a_event_block,
-                       sizeof(struct acpi_generic_address));
-               memcpy(&acpi_sinfo.pm1b_evt_blk, &fadt->xpm1b_event_block,
-                       sizeof(struct acpi_generic_address));
-       } else {
-               acpi_sinfo.pm1a_cnt_blk.address = fadt->pm1a_control_block;
-               acpi_sinfo.pm1b_cnt_blk.address = fadt->pm1b_control_block;
-               acpi_sinfo.pm1a_evt_blk.address = fadt->pm1a_event_block;
-               acpi_sinfo.pm1b_evt_blk.address = fadt->pm1b_event_block;
-               acpi_sinfo.pm1a_cnt_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
-               acpi_sinfo.pm1b_cnt_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
-               acpi_sinfo.pm1a_evt_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
-               acpi_sinfo.pm1b_evt_blk.space_id = ACPI_ADR_SPACE_SYSTEM_IO;
-               acpi_sinfo.pm1a_cnt_blk.bit_width = 16;
-               acpi_sinfo.pm1b_cnt_blk.bit_width = 16;
-               acpi_sinfo.pm1a_evt_blk.bit_width = 16;
-               acpi_sinfo.pm1b_evt_blk.bit_width = 16;
-               acpi_sinfo.pm1a_cnt_blk.bit_offset = 0;
-               acpi_sinfo.pm1b_cnt_blk.bit_offset = 0;
-               acpi_sinfo.pm1a_evt_blk.bit_offset = 0;
-               acpi_sinfo.pm1b_evt_blk.bit_offset = 0;
-               acpi_sinfo.pm1a_cnt_blk.access_width = 0;
-               acpi_sinfo.pm1b_cnt_blk.access_width = 0;
-               acpi_sinfo.pm1a_evt_blk.access_width = 0;
-               acpi_sinfo.pm1b_evt_blk.access_width = 0;
-       }
+       acpi_fadt_copy_address(pm1a_cnt, pm1a_control, pm1_control);
+       acpi_fadt_copy_address(pm1b_cnt, pm1b_control, pm1_control);
+       acpi_fadt_copy_address(pm1a_evt, pm1a_event, pm1_event);
+       acpi_fadt_copy_address(pm1b_evt, pm1b_event, pm1_event);
+
+       printk(KERN_INFO PREFIX
+              "ACPI SLEEP INFO: pm1x_cnt[%"PRIx64",%"PRIx64"], "
+              "pm1x_evt[%"PRIx64",%"PRIx64"]\n",
+              acpi_sinfo.pm1a_cnt_blk.address,
+              acpi_sinfo.pm1b_cnt_blk.address,
+              acpi_sinfo.pm1a_evt_blk.address,
+              acpi_sinfo.pm1b_evt_blk.address);
 
        /* Now FACS... */
        if (fadt->header.revision >= FADT2_REVISION_ID)
@@ -461,13 +454,6 @@ acpi_fadt_parse_sleep_info(struct acpi_t
        }
 
        printk(KERN_INFO PREFIX
-              "ACPI SLEEP INFO: pm1x_cnt[%"PRIx64",%"PRIx64"], "
-              "pm1x_evt[%"PRIx64",%"PRIx64"]\n",
-              acpi_sinfo.pm1a_cnt_blk.address,
-              acpi_sinfo.pm1b_cnt_blk.address,
-              acpi_sinfo.pm1a_evt_blk.address,
-              acpi_sinfo.pm1b_evt_blk.address);
-       printk(KERN_INFO PREFIX
               "                 wakeup_vec[%"PRIx64"], vec_size[%x]\n",
               acpi_sinfo.wakeup_vector, acpi_sinfo.vector_width);
        return;



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] adjust ACPI PM1a/b event/control information retrieval, Jan Beulich <=