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

[Xen-devel] [PATCH] compliation fix caused by 17814:9af7a535225f



# HG changeset patch
# User Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
# Date 1213155635 -32400
# Node ID 6aed5cd65ae0efb5d4bc0478c97363a26fa3ff7a
# Parent  cc4e471bbc0881498886bc73d517e0e1cd36c82f
[IA64] compliation fix caused by 17814:9af7a535225f

ia64 compliation fix caused by 17814:9af7a535225f.
- generate_acpi_checksum() is replaced by acpi_tb_checksum()
- move dump_execution_state() definitions from asm-ia64/xenprocessor.h
  to asm-ia64/bug.h

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff --git a/tools/libxc/ia64/dom_fw_acpi.c b/tools/libxc/ia64/dom_fw_acpi.c
--- a/tools/libxc/ia64/dom_fw_acpi.c
+++ b/tools/libxc/ia64/dom_fw_acpi.c
@@ -1,14 +1,31 @@
 #include <inttypes.h>
 #include "xc_dom_ia64_util.h"
 #include <xen/acpi.h>
+#include <acpi/actables.h>
 
-uint8_t
-generate_acpi_checksum(void *tbl, unsigned long len)
+/* stolen from xen/drivers/acpi/tables/tbutils.c */
+
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_tb_checksum
+ *
+ * PARAMETERS:  Buffer          - Pointer to memory region to be checked
+ *              Length          - Length of this memory region
+ *
+ * RETURN:      Checksum (u8)
+ *
+ * DESCRIPTION: Calculates circular checksum of memory region.
+ *
+ 
******************************************************************************/
+
+u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length)
 {
-    uint8_t *ptr, sum = 0;
+       u8 sum = 0;
+       u8 *end = buffer + length;
 
-    for ( ptr = tbl; len > 0 ; len--, ptr++ )
-        sum += *ptr;
+       while (buffer < end) {
+               sum = (u8) (sum + *(buffer++));
+       }
 
-    return 0 - sum;
+       return sum;
 }
diff --git a/xen/arch/ia64/xen/dom_fw_common.c 
b/xen/arch/ia64/xen/dom_fw_common.c
--- a/xen/arch/ia64/xen/dom_fw_common.c
+++ b/xen/arch/ia64/xen/dom_fw_common.c
@@ -31,6 +31,7 @@
 #endif /* __XEN__ */
 
 #include <xen/acpi.h>
+#include <acpi/actables.h>
 #include <asm/dom_fw.h>
 #include <asm/dom_fw_domu.h>
 
@@ -258,8 +259,8 @@
        xsdt->table_offset_entry[0] = ACPI_TABLE_MPA(fadt);
        tables->madt_ptr = ACPI_TABLE_MPA(madt);
 
-       xsdt->header.checksum = generate_acpi_checksum(xsdt,
-                                                      xsdt->header.length);
+       xsdt->header.checksum = -acpi_tb_checksum((u8*)xsdt,
+                                                 xsdt->header.length);
 
        /* setup FADT */
        memcpy(fadt->header.signature, ACPI_SIG_FADT,
@@ -296,8 +297,8 @@
        fadt->xpm_timer_block.bit_width = 8;
        fadt->xpm_timer_block.address = ACPI_TABLE_MPA(pm_timer_block);
 
-       fadt->header.checksum = generate_acpi_checksum(fadt,
-                                                      fadt->header.length);
+       fadt->header.checksum = -acpi_tb_checksum((u8*)fadt,
+                                                 fadt->header.length);
 
        /* setup RSDP */
        memcpy(rsdp->signature, ACPI_SIG_RSDP, strlen(ACPI_SIG_RSDP));
@@ -306,9 +307,9 @@
        rsdp->length = sizeof(struct acpi_table_rsdp);
        rsdp->xsdt_physical_address = ACPI_TABLE_MPA(xsdt);
 
-       rsdp->checksum = generate_acpi_checksum(rsdp,
-                                               ACPI_RSDP_CHECKSUM_LENGTH);
-       rsdp->extended_checksum = generate_acpi_checksum(rsdp, rsdp->length);
+       rsdp->checksum = -acpi_tb_checksum((u8*)rsdp,
+                                          ACPI_RSDP_CHECKSUM_LENGTH);
+       rsdp->extended_checksum = -acpi_tb_checksum((u8*)rsdp, rsdp->length);
 
        /* setup DSDT with trivial namespace. */ 
        memcpy(dsdt->signature, ACPI_SIG_DSDT, strlen(ACPI_SIG_DSDT));
@@ -347,7 +348,7 @@
        tables->aml[1] = 0x40 + ((aml_len - 1) & 0x0f);
        tables->aml[2] = (aml_len - 1) >> 4;
        dsdt->length = sizeof(struct acpi_table_header) + aml_len;
-       dsdt->checksum = generate_acpi_checksum(dsdt, dsdt->length);
+       dsdt->checksum = -acpi_tb_checksum((u8*)dsdt, dsdt->length);
 
        /* setup MADT */
        memcpy(madt->header.signature, ACPI_SIG_MADT,
@@ -373,8 +374,8 @@
        }
        madt->header.length = sizeof(struct acpi_table_madt) +
                              nbr_cpus * sizeof(struct acpi_table_lsapic);
-       madt->header.checksum = generate_acpi_checksum(madt,
-                                                      madt->header.length);
+       madt->header.checksum = -acpi_tb_checksum((u8*)madt,
+                                                 madt->header.length);
        return;
 }
 
diff --git a/xen/arch/ia64/xen/dom_fw_dom0.c b/xen/arch/ia64/xen/dom_fw_dom0.c
--- a/xen/arch/ia64/xen/dom_fw_dom0.c
+++ b/xen/arch/ia64/xen/dom_fw_dom0.c
@@ -25,10 +25,11 @@
  */
 
 #include <xen/config.h>
-#include <xen/acpi.h>
 #include <xen/errno.h>
 #include <xen/sched.h>
 #include <xen/list.h>
+#include <xen/acpi.h>
+#include <acpi/actables.h>
 
 #include <asm/dom_fw.h>
 #include <asm/dom_fw_common.h>
@@ -102,7 +103,8 @@
 
        acpi_madt = (struct acpi_table_madt *)table;
        acpi_madt->header.checksum = 0;
-       acpi_madt->header.checksum = generate_acpi_checksum(acpi_madt, size);
+       acpi_madt->header.checksum = -acpi_tb_checksum((u8*)acpi_madt,
+                                                      table->length);
 
        return 0;
 }
@@ -154,7 +156,9 @@
        memcpy(header->oem_table_id, "Xen     ", 8);
        memcpy(header->signature, "OEMx", 4);
        header->checksum = 0;
-       header->checksum = generate_acpi_checksum(header, header->length);
+       header->checksum = -acpi_tb_checksum((u8*)header, header->length);
+
+       printk("Successfully Disabling %s\n", header->signature);
        return 0;
 }
 
@@ -166,7 +170,6 @@
 /* base is physical address of acpi table */
 static void __init touch_acpi_table(void)
 {
-       int result;
        lsapic_nbr = 0;
 
        /*
@@ -196,18 +199,8 @@
        acpi_table_parse(ACPI_SIG_SRAT, acpi_backup_table);
        acpi_table_parse(ACPI_SIG_SLIT, acpi_backup_table);
 
-       result = acpi_table_disable(ACPI_SIG_SRAT);
-       if ( result == 0 )
-               printk("Success Disabling SRAT\n");
-       else if ( result != -ENOENT )
-               printk("ERROR: Failed Disabling SRAT\n");
-
-       result = acpi_table_disable(ACPI_SIG_SLIT);
-       if ( result == 0 )
-               printk("Success Disabling SLIT\n");
-       else if ( result != -ENOENT )
-               printk("ERROR: Failed Disabling SLIT\n");
-
+       acpi_table_disable(ACPI_SIG_SRAT);
+       acpi_table_disable(ACPI_SIG_SLIT);
        return;
 }
 
diff --git a/xen/include/asm-ia64/bug.h b/xen/include/asm-ia64/bug.h
--- a/xen/include/asm-ia64/bug.h
+++ b/xen/include/asm-ia64/bug.h
@@ -4,4 +4,6 @@
 #define BUG() __bug(__FILE__, __LINE__)
 #define WARN() __warn(__FILE__, __LINE__)
 
+#define dump_execution_state() printk("FIXME: implement ia64 
dump_execution_state()\n");
+
 #endif /* __IA64_BUG_H__ */
diff --git a/xen/include/asm-ia64/xenprocessor.h 
b/xen/include/asm-ia64/xenprocessor.h
--- a/xen/include/asm-ia64/xenprocessor.h
+++ b/xen/include/asm-ia64/xenprocessor.h
@@ -250,6 +250,4 @@
        };
 } ia64_pkr_t;
 
-#define dump_execution_state() printk("FIXME: implement ia64 
dump_execution_state()\n");
-
 #endif // _ASM_IA64_XENPROCESSOR_H
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -295,7 +295,6 @@
 void acpi_table_print (struct acpi_table_header *header, unsigned long 
phys_addr);
 void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
 void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
-uint8_t generate_acpi_checksum(void *tbl, unsigned long len);
 
 /* the following four functions are architecture-dependent */
 void acpi_numa_slit_init (struct acpi_table_slit *slit);


-- 
yamahata

Attachment: 0-acpi-compilation-fix.patch
Description: Text Data

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

 


Rackspace

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