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-changelog

[Xen-changelog] [xen-unstable] [XEN] Upgrade some platform files to Linu

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Upgrade some platform files to Linux 2.6.17.13.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 Sep 2006 11:50:12 +0000
Delivery-date: Wed, 20 Sep 2006 04:51:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID f07cf18343f1608e4c1f41b673f3b40e0525dc4d
# Parent  041be3f6b38e05f904d240630c18cadb1259317b
[XEN] Upgrade some platform files to Linux 2.6.17.13.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/acpi/boot.c      |   81 +++----
 xen/arch/x86/apic.c           |   95 +++++++-
 xen/arch/x86/io_apic.c        |    8 
 xen/arch/x86/mpparse.c        |   61 ++---
 xen/arch/x86/smpboot.c        |    2 
 xen/drivers/acpi/tables.c     |  473 +++++++++++++++++++++---------------------
 xen/include/asm-x86/apicdef.h |    1 
 xen/include/asm-x86/io_apic.h |    1 
 8 files changed, 408 insertions(+), 314 deletions(-)

diff -r 041be3f6b38e -r f07cf18343f1 xen/arch/x86/acpi/boot.c
--- a/xen/arch/x86/acpi/boot.c  Tue Sep 19 14:26:47 2006 +0100
+++ b/xen/arch/x86/acpi/boot.c  Tue Sep 19 16:33:01 2006 +0100
@@ -106,7 +106,7 @@ char *__acpi_map_table(unsigned long phy
        unsigned long base, offset, mapped_size;
        int idx;
 
-       if (phys + size < 8 * 1024 * 1024) 
+       if (phys + size < 8 * 1024 * 1024)
                return __va(phys);
 
        offset = phys & (PAGE_SIZE - 1);
@@ -132,7 +132,7 @@ char *__acpi_map_table(unsigned long phy
 #ifdef CONFIG_X86_LOCAL_APIC
 static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
 {
-       struct acpi_table_madt  *madt = NULL;
+       struct acpi_table_madt *madt = NULL;
 
        if (!phys_addr || !size)
                return -EINVAL;
@@ -147,18 +147,18 @@ static int __init acpi_parse_madt(unsign
                acpi_lapic_addr = (u64) madt->lapic_address;
 
                printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
-                       madt->lapic_address);
+                      madt->lapic_address);
        }
 
        acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
-       
+
        return 0;
 }
 
 static int __init
 acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
 {
-       struct acpi_table_lapic *processor = NULL;
+       struct acpi_table_lapic *processor = NULL;
 
        processor = (struct acpi_table_lapic *)header;
 
@@ -167,10 +167,17 @@ acpi_parse_lapic(acpi_table_entry_header
 
        acpi_table_print_madt_entry(header);
 
-       /* Register even disabled CPUs for cpu hotplug */
-
-       x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
-
+       /* Record local apic id only when enabled */
+       if (processor->flags.enabled)
+               x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
+
+       /*
+        * We need to register disabled CPU as well to permit
+        * counting disabled CPUs. This allows us to size
+        * cpus_possible_map more accurately, to permit
+        * to not preallocating memory for all NR_CPUS
+        * when we use CPU hotplug.
+        */
        mp_register_lapic(processor->id,        /* APIC ID */
                          processor->flags.enabled);    /* Enabled? */
 
@@ -224,7 +231,7 @@ acpi_parse_ioapic(acpi_table_entry_heade
 
        if (BAD_MADT_ENTRY(ioapic, end))
                return -EINVAL;
- 
+
        acpi_table_print_madt_entry(header);
 
        mp_register_ioapic(ioapic->id,
@@ -281,8 +288,8 @@ static unsigned long __init
 static unsigned long __init
 acpi_scan_rsdp(unsigned long start, unsigned long length)
 {
-       unsigned long           offset = 0;
-       unsigned long           sig_len = sizeof("RSD PTR ") - 1;
+       unsigned long offset = 0;
+       unsigned long sig_len = sizeof("RSD PTR ") - 1;
 
        /*
         * Scan all 16-byte boundaries of the physical memory region for the
@@ -302,7 +309,7 @@ static int __init acpi_parse_sbf(unsigne
        struct acpi_table_sbf *sb;
 
        if (!phys_addr || !size)
-       return -EINVAL;
+               return -EINVAL;
 
        sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
        if (!sb) {
@@ -310,11 +317,10 @@ static int __init acpi_parse_sbf(unsigne
                return -ENODEV;
        }
 
-       sbf_port = sb->sbf_cmos; /* Save CMOS port */
-
-       return 0;
-}
-
+       sbf_port = sb->sbf_cmos;        /* Save CMOS port */
+
+       return 0;
+}
 
 #ifdef CONFIG_HPET_TIMER
 
@@ -349,7 +355,7 @@ static int __init acpi_parse_hpet(unsign
 
                hpet_address = hpet_tbl->addr.addrl;
                printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
-                       hpet_tbl->id, hpet_address);
+                      hpet_tbl->id, hpet_address);
        }
 #endif /* X86 */
 
@@ -410,17 +416,16 @@ static int __init acpi_parse_fadt(unsign
        return 0;
 }
 
-
 unsigned long __init acpi_find_rsdp(void)
 {
-       unsigned long           rsdp_phys = 0;
+       unsigned long rsdp_phys = 0;
 
 #if 0
        if (efi_enabled) {
-               if (efi.acpi20)
-                       return __pa(efi.acpi20);
-               else if (efi.acpi)
-                       return __pa(efi.acpi);
+               if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
+                       return efi.acpi20;
+               else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
+                       return efi.acpi;
        }
 #endif
        /*
@@ -442,6 +447,9 @@ static int __init acpi_parse_madt_lapic_
 static int __init acpi_parse_madt_lapic_entries(void)
 {
        int count;
+
+       if (!cpu_has_apic)
+               return -ENODEV;
 
        /* 
         * Note that the LAPIC address is obtained from the MADT (32-bit value)
@@ -460,8 +468,8 @@ static int __init acpi_parse_madt_lapic_
        mp_register_lapic_address(acpi_lapic_addr);
 
        count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
-                                      MAX_APICS);
-       if (!count) { 
+                                     MAX_APICS);
+       if (!count) {
                printk(KERN_ERR PREFIX "No LAPIC entries present\n");
                /* TBD: Cleanup to allow fallback to MPS */
                return -ENODEV;
@@ -499,14 +507,17 @@ static int __init acpi_parse_madt_ioapic
         */
        if (acpi_disabled || acpi_noirq) {
                return -ENODEV;
-        }
-
-       /*
-        * if "noapic" boot option, don't look for IO-APICs
+       }
+
+       if (!cpu_has_apic)
+               return -ENODEV;
+
+       /*
+        * if "noapic" boot option, don't look for IO-APICs
         */
        if (skip_ioapic_setup) {
                printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
-                       "due to 'noapic' option.\n");
+                      "due to 'noapic' option.\n");
                return -ENODEV;
        }
 
@@ -852,7 +863,7 @@ int __init acpi_boot_table_init(void)
         * One exception: acpi=ht continues far enough to enumerate LAPICs
         */
        if (acpi_disabled && !acpi_ht)
-                return 1;
+               return 1;
 
        /* 
         * Initialize the ACPI boot-time table parser.
@@ -884,7 +895,6 @@ int __init acpi_boot_table_init(void)
        return 0;
 }
 
-
 int __init acpi_boot_init(void)
 {
        /*
@@ -892,7 +902,7 @@ int __init acpi_boot_init(void)
         * One exception: acpi=ht continues far enough to enumerate LAPICs
         */
        if (acpi_disabled && !acpi_ht)
-                return 1;
+               return 1;
 
        acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
 
@@ -910,4 +920,3 @@ int __init acpi_boot_init(void)
 
        return 0;
 }
-
diff -r 041be3f6b38e -r f07cf18343f1 xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c       Tue Sep 19 14:26:47 2006 +0100
+++ b/xen/arch/x86/apic.c       Tue Sep 19 16:33:01 2006 +0100
@@ -1,5 +1,5 @@
 /*
- *      based on linux-2.6.11/arch/i386/kernel/apic.c
+ *      based on linux-2.6.17.13/arch/i386/kernel/apic.c
  *
  *  Local APIC handling, local APIC timers
  *
@@ -50,6 +50,18 @@ int apic_verbosity;
 
 static void apic_pm_activate(void);
 
+int modern_apic(void)
+{
+    unsigned int lvr, version;
+    /* AMD systems use old APIC versions, so check the CPU */
+    if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
+        boot_cpu_data.x86 >= 0xf)
+        return 1;
+    lvr = apic_read(APIC_LVR);
+    version = GET_APIC_VERSION(lvr);
+    return version >= 0x14;
+}
+
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
@@ -64,8 +76,10 @@ void ack_bad_irq(unsigned int irq)
      * holds up an irq slot - in excessive cases (when multiple
      * unexpected vectors occur) that might lock up the APIC
      * completely.
-     */
-    ack_APIC_irq();
+     * But only ack when the APIC is enabled -AK
+     */
+    if (cpu_has_apic)
+        ack_APIC_irq();
 }
 
 void __init apic_intr_init(void)
@@ -91,12 +105,21 @@ int using_apic_timer = 0;
 
 static int enabled_via_apicbase;
 
+void enable_NMI_through_LVT0 (void * dummy)
+{
+    unsigned int v, ver;
+
+    ver = apic_read(APIC_LVR);
+    ver = GET_APIC_VERSION(ver);
+    v = APIC_DM_NMI;                   /* unmask and set to NMI */
+    if (!APIC_INTEGRATED(ver))         /* 82489DX */
+        v |= APIC_LVT_LEVEL_TRIGGER;
+    apic_write_around(APIC_LVT0, v);
+}
+
 int get_physical_broadcast(void)
 {
-    unsigned int lvr, version;
-    lvr = apic_read(APIC_LVR);
-    version = GET_APIC_VERSION(lvr);
-    if (!APIC_INTEGRATED(version) || version >= 0x14)
+    if (modern_apic())
         return 0xff;
     else
         return 0xf;
@@ -323,9 +346,9 @@ int __init verify_local_APIC(void)
 
 void __init sync_Arb_IDs(void)
 {
-    /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 */
-    unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
-    if (ver >= 0x14)    /* P4 or higher */
+    /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1
+       And not needed on AMD */
+    if (modern_apic())
         return;
     /*
      * Wait for idle.
@@ -389,6 +412,7 @@ void __devinit setup_local_APIC(void)
 void __devinit setup_local_APIC(void)
 {
     unsigned long oldvalue, value, ver, maxlvt;
+    int i, j;
 
     /* Pound the ESR really hard over the head with a big hammer - mbligh */
     if (esr_disable) {
@@ -424,6 +448,25 @@ void __devinit setup_local_APIC(void)
     value = apic_read(APIC_TASKPRI);
     value &= ~APIC_TPRI_MASK;
     apic_write_around(APIC_TASKPRI, value);
+
+    /*
+     * After a crash, we no longer service the interrupts and a pending
+     * interrupt from previous kernel might still have ISR bit set.
+     *
+     * Most probably by now CPU has serviced that pending interrupt and
+     * it might not have done the ack_APIC_irq() because it thought,
+     * interrupt came from i8259 as ExtInt. LAPIC did not get EOI so it
+     * does not clear the ISR bit and cpu thinks it has already serivced
+     * the interrupt. Hence a vector might get locked. It was noticed
+     * for timer irq (vector 0x31). Issue an extra EOI to clear ISR.
+     */
+    for (i = APIC_ISR_NR - 1; i >= 0; i--) {
+        value = apic_read(APIC_ISR + i*0x10);
+        for (j = 31; j >= 0; j--) {
+            if (value & (1<<j))
+                ack_APIC_irq();
+        }
+    }
 
     /*
      * Now that we are all set up, enable the APIC
@@ -534,6 +577,29 @@ void __devinit setup_local_APIC(void)
     if (nmi_watchdog == NMI_LOCAL_APIC)
         setup_apic_nmi_watchdog();
     apic_pm_activate();
+}
+
+/*
+ * If Linux enabled the LAPIC against the BIOS default
+ * disable it down before re-entering the BIOS on shutdown.
+ * Otherwise the BIOS may get confused and not power-off.
+ * Additionally clear all LVT entries before disable_local_APIC
+ * for the case where Linux didn't enable the LAPIC.
+ */
+void lapic_shutdown(void)
+{
+    unsigned long flags;
+
+    if (!cpu_has_apic)
+        return;
+
+    local_irq_save(flags);
+    clear_local_APIC();
+
+    if (enabled_via_apicbase)
+        disable_local_APIC();
+
+    local_irq_restore(flags);
 }
 
 static void apic_pm_activate(void) { }
@@ -1086,6 +1152,7 @@ int __init APIC_init_uniprocessor (void)
     if (!cpu_has_apic && 
APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
         printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
                boot_cpu_physical_apicid);
+        clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
         return -1;
     }
 
@@ -1093,6 +1160,14 @@ int __init APIC_init_uniprocessor (void)
 
     connect_bsp_APIC();
 
+    /*
+     * Hack: In case of kdump, after a crash, kernel might be booting
+     * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid
+     * might be zero if read from MP tables. Get it from LAPIC.
+     */
+#ifdef CONFIG_CRASH_DUMP
+    boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
+#endif
     phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
 
     setup_local_APIC();
diff -r 041be3f6b38e -r f07cf18343f1 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c    Tue Sep 19 14:26:47 2006 +0100
+++ b/xen/arch/x86/io_apic.c    Tue Sep 19 16:33:01 2006 +0100
@@ -1143,7 +1143,8 @@ static void __init setup_ioapic_ids_from
      * Don't check I/O APIC IDs for xAPIC systems. They have
      * no meaning without the serial APIC bus.
      */
-    if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && boot_cpu_data.x86 < 
15))
+    if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+        || APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
         return;
 
     /*
@@ -1639,6 +1640,8 @@ static inline void unlock_ExtINT_logic(v
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
+int timer_uses_ioapic_pin_0;
+
 /*
  * This code may look a bit paranoid, but it's supposed to cooperate with
  * a wide range of boards and BIOS bugs.  Fortunately only the timer IRQ
@@ -1677,6 +1680,9 @@ static inline void check_timer(void)
     apic1 = find_isa_irq_apic(0, mp_INT);
     pin2  = ioapic_i8259.pin;
     apic2 = ioapic_i8259.apic;
+
+    if (pin1 == 0)
+        timer_uses_ioapic_pin_0 = 1;
 
     printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d 
pin2=%d\n",
            vector, apic1, pin1, apic2, pin2);
diff -r 041be3f6b38e -r f07cf18343f1 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c    Tue Sep 19 14:26:47 2006 +0100
+++ b/xen/arch/x86/mpparse.c    Tue Sep 19 16:33:01 2006 +0100
@@ -35,13 +35,7 @@
 
 /* Have we found an MP table */
 int smp_found_config;
-unsigned int __devinitdata maxcpus = NR_CPUS;
-
-#ifdef CONFIG_HOTPLUG_CPU
-#define CPU_HOTPLUG_ENABLED    (1)
-#else
-#define CPU_HOTPLUG_ENABLED    (0)
-#endif
+unsigned int __initdata maxcpus = NR_CPUS;
 
 /*
  * Various Linux-internal data structures created from the
@@ -73,9 +67,8 @@ unsigned int def_to_bigsmp = 0;
 
 /* Processor that is doing the boot up */
 unsigned int boot_cpu_physical_apicid = -1U;
-unsigned int boot_cpu_logical_apicid = -1U;
 /* Internal processor count */
-static unsigned int __initdata num_processors;
+static unsigned int __devinitdata num_processors;
 
 /* Bitmask of physically existing CPUs */
 physid_mask_t phys_cpu_present_map;
@@ -107,23 +100,8 @@ static int __init mpf_checksum(unsigned 
  * doing this ....
  */
 
-static int mpc_record;
+static int mpc_record; 
 static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] 
__initdata;
-
-#ifdef CONFIG_X86_NUMAQ
-static int MP_valid_apicid(int apicid, int version)
-{
-       return hweight_long(apicid & 0xf) == 1 && (apicid >> 4) != 0xf;
-}
-#else
-static int MP_valid_apicid(int apicid, int version)
-{
-       if (version >= 0x14)
-               return apicid < 0xff;
-       else
-               return apicid < 0xf;
-}
-#endif
 
 static void __devinit MP_processor_info (struct mpc_config_processor *m)
 {
@@ -190,12 +168,6 @@ static void __devinit MP_processor_info 
 
        ver = m->mpc_apicver;
 
-       if (!MP_valid_apicid(apicid, ver)) {
-               printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n",
-                       m->mpc_apicid, MAX_APICS);
-               return;
-       }
-
        /*
         * Validate version
         */
@@ -225,7 +197,7 @@ static void __devinit MP_processor_info 
        cpu_set(num_processors, cpu_possible_map);
        num_processors++;
 
-       if (CPU_HOTPLUG_ENABLED || (num_processors > 8)) {
+       if (num_processors > 8) {
                /*
                 * No need for processor or APIC checks: physical delivery
                 * (bigsmp) mode should always work.
@@ -243,6 +215,15 @@ static void __init MP_bus_info (struct m
        str[6] = 0;
 
        mpc_oem_bus_info(m, str, translation_table[mpc_record]);
+
+#if 0 /* size of mpc_busid (8 bits) makes this check unnecessary */
+       if (m->mpc_busid >= MAX_MP_BUSSES) {
+               printk(KERN_WARNING "MP table busid value (%d) for bustype %s "
+                       " is too large, max. supported is %d\n",
+                       m->mpc_busid, str, MAX_MP_BUSSES - 1);
+               return;
+       }
+#endif
 
        if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) {
                mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
@@ -931,7 +912,8 @@ void __init mp_register_ioapic (
        mp_ioapics[idx].mpc_apicaddr = address;
 
        set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
-       if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && 
(boot_cpu_data.x86 < 15))
+       if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+               && !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
                tmpid = io_apic_get_unique_id(idx, id);
        else
                tmpid = id;
@@ -1007,7 +989,6 @@ void __init mp_override_legacy_irq (
        return;
 }
 
-
 void __init mp_config_acpi_legacy_irqs (void)
 {
        struct mpc_config_intsrc intsrc;
@@ -1139,7 +1120,17 @@ int mp_register_gsi (u32 gsi, int trigge
                 */
                int irq = gsi;
                if (gsi < MAX_GSI_NUM) {
-                       if (gsi > 15)
+                       /*
+                        * Retain the VIA chipset work-around (gsi > 15), but
+                        * avoid a problem where the 8254 timer (IRQ0) is setup
+                        * via an override (so it's not on pin 0 of the ioapic),
+                        * and at the same time, the pin 0 interrupt is a PCI
+                        * type.  The gsi > 15 test could cause these two pins
+                        * to be shared as IRQ0, and they are not shareable.
+                        * So test for this condition, and if necessary, avoid
+                        * the pin collision.
+                        */
+                       if (gsi > 15 || (gsi == 0 && !timer_uses_ioapic_pin_0))
                                gsi = pci_irq++;
 #ifdef CONFIG_ACPI_BUS
                        /*
diff -r 041be3f6b38e -r f07cf18343f1 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Tue Sep 19 14:26:47 2006 +0100
+++ b/xen/arch/x86/smpboot.c    Tue Sep 19 16:33:01 2006 +0100
@@ -982,7 +982,6 @@ static int __devinit do_boot_cpu(int api
  * Cycle through the processors sending APIC IPIs to boot each.
  */
 
-static int boot_cpu_logical_apicid;
 /* Where the IO area was mapped on multiquad, always 0 otherwise */
 void *xquad_portio;
 #ifdef CONFIG_X86_NUMAQ
@@ -1004,7 +1003,6 @@ static void __init smp_boot_cpus(unsigne
        print_cpu_info(&cpu_data[0]);
 
        boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
-       boot_cpu_logical_apicid = logical_smp_processor_id();
        x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
 
        /*current_thread_info()->cpu = 0;*/
diff -r 041be3f6b38e -r f07cf18343f1 xen/drivers/acpi/tables.c
--- a/xen/drivers/acpi/tables.c Tue Sep 19 14:26:47 2006 +0100
+++ b/xen/drivers/acpi/tables.c Tue Sep 19 16:33:01 2006 +0100
@@ -37,28 +37,28 @@
 
 #define PREFIX                 "ACPI: "
 
-#define ACPI_MAX_TABLES                256
+#define ACPI_MAX_TABLES                128
 
 static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
-       [ACPI_TABLE_UNKNOWN]    = "????",
-       [ACPI_APIC]             = "APIC",
-       [ACPI_BOOT]             = "BOOT",
-       [ACPI_DBGP]             = "DBGP",
-       [ACPI_DSDT]             = "DSDT",
-       [ACPI_ECDT]             = "ECDT",
-       [ACPI_ETDT]             = "ETDT",
-       [ACPI_FADT]             = "FACP",
-       [ACPI_FACS]             = "FACS",
-       [ACPI_OEMX]             = "OEM",
-       [ACPI_PSDT]             = "PSDT",
-       [ACPI_SBST]             = "SBST",
-       [ACPI_SLIT]             = "SLIT",
-       [ACPI_SPCR]             = "SPCR",
-       [ACPI_SRAT]             = "SRAT",
-       [ACPI_SSDT]             = "SSDT",
-       [ACPI_SPMI]             = "SPMI",
-       [ACPI_HPET]             = "HPET",
-       [ACPI_MCFG]             = "MCFG",
+       [ACPI_TABLE_UNKNOWN] = "????",
+       [ACPI_APIC] = "APIC",
+       [ACPI_BOOT] = "BOOT",
+       [ACPI_DBGP] = "DBGP",
+       [ACPI_DSDT] = "DSDT",
+       [ACPI_ECDT] = "ECDT",
+       [ACPI_ETDT] = "ETDT",
+       [ACPI_FADT] = "FACP",
+       [ACPI_FACS] = "FACS",
+       [ACPI_OEMX] = "OEM",
+       [ACPI_PSDT] = "PSDT",
+       [ACPI_SBST] = "SBST",
+       [ACPI_SLIT] = "SLIT",
+       [ACPI_SPCR] = "SPCR",
+       [ACPI_SRAT] = "SRAT",
+       [ACPI_SSDT] = "SSDT",
+       [ACPI_SPMI] = "SPMI",
+       [ACPI_HPET] = "HPET",
+       [ACPI_MCFG] = "MCFG",
 };
 
 static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
@@ -66,52 +66,44 @@ static char *mps_inti_flags_trigger[] = 
 
 /* System Description Table (RSDT/XSDT) */
 struct acpi_table_sdt {
-       unsigned long           pa;
-       enum acpi_table_id      id;
-       unsigned long           size;
+       unsigned long pa;
+       enum acpi_table_id id;
+       unsigned long size;
 } __attribute__ ((packed));
 
-static unsigned long           sdt_pa;         /* Physical Address */
-static unsigned long           sdt_count;      /* Table count */
-
-static struct acpi_table_sdt   sdt_entry[ACPI_MAX_TABLES];
-
-void
-acpi_table_print (
-       struct acpi_table_header *header,
-       unsigned long           phys_addr)
-{
-       char                    *name = NULL;
+static unsigned long sdt_pa;   /* Physical Address */
+static unsigned long sdt_count;        /* Table count */
+
+static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES] __initdata;
+
+void acpi_table_print(struct acpi_table_header *header, unsigned long 
phys_addr)
+{
+       char *name = NULL;
 
        if (!header)
                return;
 
        /* Some table signatures aren't good table names */
 
-       if (!strncmp((char *) &header->signature,
-               acpi_table_signatures[ACPI_APIC],
-               sizeof(header->signature))) {
+       if (!strncmp((char *)&header->signature,
+                    acpi_table_signatures[ACPI_APIC],
+                    sizeof(header->signature))) {
                name = "MADT";
-       }
-       else if (!strncmp((char *) &header->signature,
-               acpi_table_signatures[ACPI_FADT],
-               sizeof(header->signature))) {
+       } else if (!strncmp((char *)&header->signature,
+                           acpi_table_signatures[ACPI_FADT],
+                           sizeof(header->signature))) {
                name = "FADT";
-       }
-       else
+       } else
                name = header->signature;
 
-       printk(KERN_DEBUG PREFIX "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) 
@ 0x%p\n",
-               name, header->revision, header->oem_id,
-               header->oem_table_id, header->oem_revision,
-               header->asl_compiler_id, header->asl_compiler_revision,
-               (void *) phys_addr);
-}
-
-
-void
-acpi_table_print_madt_entry (
-       acpi_table_entry_header *header)
+       printk(KERN_DEBUG PREFIX
+              "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n", name,
+              header->revision, header->oem_id, header->oem_table_id,
+              header->oem_revision, header->asl_compiler_id,
+              header->asl_compiler_revision, (void *)phys_addr);
+}
+
+void acpi_table_print_madt_entry(acpi_table_entry_header * header)
 {
        if (!header)
                return;
@@ -119,113 +111,127 @@ acpi_table_print_madt_entry (
        switch (header->type) {
 
        case ACPI_MADT_LAPIC:
-       {
-               struct acpi_table_lapic *p =
-                       (struct acpi_table_lapic*) header;
-               printk(KERN_INFO PREFIX "LAPIC (acpi_id[0x%02x] 
lapic_id[0x%02x] %s)\n",
-                       p->acpi_id, p->id, 
p->flags.enabled?"enabled":"disabled");
-       }
+               {
+                       struct acpi_table_lapic *p =
+                           (struct acpi_table_lapic *)header;
+                       printk(KERN_INFO PREFIX
+                              "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
+                              p->acpi_id, p->id,
+                              p->flags.enabled ? "enabled" : "disabled");
+               }
                break;
 
        case ACPI_MADT_IOAPIC:
-       {
-               struct acpi_table_ioapic *p =
-                       (struct acpi_table_ioapic*) header;
-               printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] 
gsi_base[%d])\n",
-                       p->id, p->address, p->global_irq_base);
-       }
+               {
+                       struct acpi_table_ioapic *p =
+                           (struct acpi_table_ioapic *)header;
+                       printk(KERN_INFO PREFIX
+                              "IOAPIC (id[0x%02x] address[0x%08x] 
gsi_base[%d])\n",
+                              p->id, p->address, p->global_irq_base);
+               }
                break;
 
        case ACPI_MADT_INT_SRC_OVR:
-       {
-               struct acpi_table_int_src_ovr *p =
-                       (struct acpi_table_int_src_ovr*) header;
-               printk(KERN_INFO PREFIX "INT_SRC_OVR (bus %d bus_irq %d 
global_irq %d %s %s)\n",
-                       p->bus, p->bus_irq, p->global_irq,
-                       mps_inti_flags_polarity[p->flags.polarity],
-                       mps_inti_flags_trigger[p->flags.trigger]);
-               if(p->flags.reserved)
-                       printk(KERN_INFO PREFIX "INT_SRC_OVR unexpected 
reserved flags: 0x%x\n",
-                               p->flags.reserved);
-
-       }
+               {
+                       struct acpi_table_int_src_ovr *p =
+                           (struct acpi_table_int_src_ovr *)header;
+                       printk(KERN_INFO PREFIX
+                              "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s 
%s)\n",
+                              p->bus, p->bus_irq, p->global_irq,
+                              mps_inti_flags_polarity[p->flags.polarity],
+                              mps_inti_flags_trigger[p->flags.trigger]);
+                       if (p->flags.reserved)
+                               printk(KERN_INFO PREFIX
+                                      "INT_SRC_OVR unexpected reserved flags: 
0x%x\n",
+                                      p->flags.reserved);
+
+               }
                break;
 
        case ACPI_MADT_NMI_SRC:
-       {
-               struct acpi_table_nmi_src *p =
-                       (struct acpi_table_nmi_src*) header;
-               printk(KERN_INFO PREFIX "NMI_SRC (%s %s global_irq %d)\n",
-                       mps_inti_flags_polarity[p->flags.polarity],
-                       mps_inti_flags_trigger[p->flags.trigger], 
p->global_irq);
-       }
+               {
+                       struct acpi_table_nmi_src *p =
+                           (struct acpi_table_nmi_src *)header;
+                       printk(KERN_INFO PREFIX
+                              "NMI_SRC (%s %s global_irq %d)\n",
+                              mps_inti_flags_polarity[p->flags.polarity],
+                              mps_inti_flags_trigger[p->flags.trigger],
+                              p->global_irq);
+               }
                break;
 
        case ACPI_MADT_LAPIC_NMI:
-       {
-               struct acpi_table_lapic_nmi *p =
-                       (struct acpi_table_lapic_nmi*) header;
-               printk(KERN_INFO PREFIX "LAPIC_NMI (acpi_id[0x%02x] %s %s 
lint[0x%x])\n",
-                       p->acpi_id,
-                       mps_inti_flags_polarity[p->flags.polarity],
-                       mps_inti_flags_trigger[p->flags.trigger], p->lint);
-       }
+               {
+                       struct acpi_table_lapic_nmi *p =
+                           (struct acpi_table_lapic_nmi *)header;
+                       printk(KERN_INFO PREFIX
+                              "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
+                              p->acpi_id,
+                              mps_inti_flags_polarity[p->flags.polarity],
+                              mps_inti_flags_trigger[p->flags.trigger],
+                              p->lint);
+               }
                break;
 
        case ACPI_MADT_LAPIC_ADDR_OVR:
-       {
-               struct acpi_table_lapic_addr_ovr *p =
-                       (struct acpi_table_lapic_addr_ovr*) header;
-               printk(KERN_INFO PREFIX "LAPIC_ADDR_OVR (address[%p])\n",
-                       (void *) (unsigned long) p->address);
-       }
+               {
+                       struct acpi_table_lapic_addr_ovr *p =
+                           (struct acpi_table_lapic_addr_ovr *)header;
+                       printk(KERN_INFO PREFIX
+                              "LAPIC_ADDR_OVR (address[%p])\n",
+                              (void *)(unsigned long)p->address);
+               }
                break;
 
        case ACPI_MADT_IOSAPIC:
-       {
-               struct acpi_table_iosapic *p =
-                       (struct acpi_table_iosapic*) header;
-               printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] address[%p] 
gsi_base[%d])\n",
-                       p->id, (void *) (unsigned long) p->address, 
p->global_irq_base);
-       }
+               {
+                       struct acpi_table_iosapic *p =
+                           (struct acpi_table_iosapic *)header;
+                       printk(KERN_INFO PREFIX
+                              "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
+                              p->id, (void *)(unsigned long)p->address,
+                              p->global_irq_base);
+               }
                break;
 
        case ACPI_MADT_LSAPIC:
-       {
-               struct acpi_table_lsapic *p =
-                       (struct acpi_table_lsapic*) header;
-               printk(KERN_INFO PREFIX "LSAPIC (acpi_id[0x%02x] 
lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
-                       p->acpi_id, p->id, p->eid, 
p->flags.enabled?"enabled":"disabled");
-       }
+               {
+                       struct acpi_table_lsapic *p =
+                           (struct acpi_table_lsapic *)header;
+                       printk(KERN_INFO PREFIX
+                              "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] 
lsapic_eid[0x%02x] %s)\n",
+                              p->acpi_id, p->id, p->eid,
+                              p->flags.enabled ? "enabled" : "disabled");
+               }
                break;
 
        case ACPI_MADT_PLAT_INT_SRC:
-       {
-               struct acpi_table_plat_int_src *p =
-                       (struct acpi_table_plat_int_src*) header;
-               printk(KERN_INFO PREFIX "PLAT_INT_SRC (%s %s type[0x%x] 
id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
-                       mps_inti_flags_polarity[p->flags.polarity],
-                       mps_inti_flags_trigger[p->flags.trigger],
-                       p->type, p->id, p->eid, p->iosapic_vector, 
p->global_irq);
-       }
+               {
+                       struct acpi_table_plat_int_src *p =
+                           (struct acpi_table_plat_int_src *)header;
+                       printk(KERN_INFO PREFIX
+                              "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] 
eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
+                              mps_inti_flags_polarity[p->flags.polarity],
+                              mps_inti_flags_trigger[p->flags.trigger],
+                              p->type, p->id, p->eid, p->iosapic_vector,
+                              p->global_irq);
+               }
                break;
 
        default:
-               printk(KERN_WARNING PREFIX "Found unsupported MADT entry (type 
= 0x%x)\n",
-                       header->type);
-               break;
-       }
-}
-
+               printk(KERN_WARNING PREFIX
+                      "Found unsupported MADT entry (type = 0x%x)\n",
+                      header->type);
+               break;
+       }
+}
 
 static int
-acpi_table_compute_checksum (
-       void                    *table_pointer,
-       unsigned long           length)
-{
-       u8                      *p = (u8 *) table_pointer;
-       unsigned long           remains = length;
-       unsigned long           sum = 0;
+acpi_table_compute_checksum(void *table_pointer, unsigned long length)
+{
+       u8 *p = (u8 *) table_pointer;
+       unsigned long remains = length;
+       unsigned long sum = 0;
 
        if (!p || !length)
                return -EINVAL;
@@ -241,9 +247,8 @@ acpi_table_compute_checksum (
  * for acpi_blacklisted(), acpi_table_get_sdt()
  */
 int __init
-acpi_get_table_header_early (
-       enum acpi_table_id      id,
-       struct acpi_table_header **header)
+acpi_get_table_header_early(enum acpi_table_id id,
+                           struct acpi_table_header **header)
 {
        unsigned int i;
        enum acpi_table_id temp_id;
@@ -260,7 +265,7 @@ acpi_get_table_header_early (
                if (sdt_entry[i].id != temp_id)
                        continue;
                *header = (void *)
-                       __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
+                   __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
                if (!*header) {
                        printk(KERN_WARNING PREFIX "Unable to map %s\n",
                               acpi_table_signatures[temp_id]);
@@ -277,14 +282,17 @@ acpi_get_table_header_early (
 
        /* Map the DSDT header via the pointer in the FADT */
        if (id == ACPI_DSDT) {
-               struct fadt_descriptor_rev2 *fadt = (struct 
fadt_descriptor_rev2 *) *header;
+               struct fadt_descriptor_rev2 *fadt =
+                   (struct fadt_descriptor_rev2 *)*header;
 
                if (fadt->revision == 3 && fadt->Xdsdt) {
-                       *header = (void *) __acpi_map_table(fadt->Xdsdt,
-                                       sizeof(struct acpi_table_header));
+                       *header = (void *)__acpi_map_table(fadt->Xdsdt,
+                                                          sizeof(struct
+                                                                 
acpi_table_header));
                } else if (fadt->V1_dsdt) {
-                       *header = (void *) __acpi_map_table(fadt->V1_dsdt,
-                                       sizeof(struct acpi_table_header));
+                       *header = (void *)__acpi_map_table(fadt->V1_dsdt,
+                                                          sizeof(struct
+                                                                 
acpi_table_header));
                } else
                        *header = NULL;
 
@@ -296,21 +304,19 @@ acpi_get_table_header_early (
 
        return 0;
 }
-        
 
 int __init
-acpi_table_parse_madt_family (
-       enum acpi_table_id      id,
-       unsigned long           madt_size,
-       int                     entry_id,
-       acpi_madt_entry_handler handler,
-       unsigned int            max_entries)
-{
-       void                    *madt = NULL;
-       acpi_table_entry_header *entry;
-       unsigned int            count = 0;
-       unsigned long           madt_end;
-       unsigned int            i;
+acpi_table_parse_madt_family(enum acpi_table_id id,
+                            unsigned long madt_size,
+                            int entry_id,
+                            acpi_madt_entry_handler handler,
+                            unsigned int max_entries)
+{
+       void *madt = NULL;
+       acpi_table_entry_header *entry;
+       unsigned int count = 0;
+       unsigned long madt_end;
+       unsigned int i;
 
        if (!handler)
                return -EINVAL;
@@ -321,7 +327,7 @@ acpi_table_parse_madt_family (
                if (sdt_entry[i].id != id)
                        continue;
                madt = (void *)
-                       __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
+                   __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
                if (!madt) {
                        printk(KERN_WARNING PREFIX "Unable to map %s\n",
                               acpi_table_signatures[id]);
@@ -336,21 +342,22 @@ acpi_table_parse_madt_family (
                return -ENODEV;
        }
 
-       madt_end = (unsigned long) madt + sdt_entry[i].size;
+       madt_end = (unsigned long)madt + sdt_entry[i].size;
 
        /* Parse all entries looking for a match. */
 
        entry = (acpi_table_entry_header *)
-               ((unsigned long) madt + madt_size);
-
-       while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < 
madt_end) {
-               if (entry->type == entry_id &&
-                   (!max_entries || count++ < max_entries))
+           ((unsigned long)madt + madt_size);
+
+       while (((unsigned long)entry) + sizeof(acpi_table_entry_header) <
+              madt_end) {
+               if (entry->type == entry_id
+                   && (!max_entries || count++ < max_entries))
                        if (handler(entry, madt_end))
                                return -EINVAL;
 
                entry = (acpi_table_entry_header *)
-                       ((unsigned long) entry + entry->length);
+                   ((unsigned long)entry + entry->length);
        }
        if (max_entries && count > max_entries) {
                printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of "
@@ -361,25 +368,19 @@ acpi_table_parse_madt_family (
        return count;
 }
 
-
 int __init
-acpi_table_parse_madt (
-       enum acpi_madt_entry_id id,
-       acpi_madt_entry_handler handler,
-       unsigned int max_entries)
-{
-       return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct 
acpi_table_madt),
-                                           id, handler, max_entries);
-}
-
-
-int __init
-acpi_table_parse (
-       enum acpi_table_id      id,
-       acpi_table_handler      handler)
-{
-       int                     count = 0;
-       unsigned int            i = 0;
+acpi_table_parse_madt(enum acpi_madt_entry_id id,
+                     acpi_madt_entry_handler handler, unsigned int max_entries)
+{
+       return acpi_table_parse_madt_family(ACPI_APIC,
+                                           sizeof(struct acpi_table_madt), id,
+                                           handler, max_entries);
+}
+
+int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler)
+{
+       int count = 0;
+       unsigned int i = 0;
 
        if (!handler)
                return -EINVAL;
@@ -392,20 +393,18 @@ acpi_table_parse (
                        handler(sdt_entry[i].pa, sdt_entry[i].size);
 
                else
-                       printk(KERN_WARNING PREFIX "%d duplicate %s table 
ignored.\n",
-                               count, acpi_table_signatures[id]);
+                       printk(KERN_WARNING PREFIX
+                              "%d duplicate %s table ignored.\n", count,
+                              acpi_table_signatures[id]);
        }
 
        return count;
 }
 
-
-static int __init
-acpi_table_get_sdt (
-       struct acpi_table_rsdp  *rsdp)
+static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)
 {
        struct acpi_table_header *header = NULL;
-       unsigned int            i, id = 0;
+       unsigned int i, id = 0;
 
        if (!rsdp)
                return -EINVAL;
@@ -413,24 +412,25 @@ acpi_table_get_sdt (
        /* First check XSDT (but only on ACPI 2.0-compatible systems) */
 
        if ((rsdp->revision >= 2) &&
-               (((struct acpi20_table_rsdp*)rsdp)->xsdt_address)) {
-                       
-               struct acpi_table_xsdt  *mapped_xsdt = NULL;
-
-               sdt_pa = ((struct acpi20_table_rsdp*)rsdp)->xsdt_address;
+           (((struct acpi20_table_rsdp *)rsdp)->xsdt_address)) {
+
+               struct acpi_table_xsdt *mapped_xsdt = NULL;
+
+               sdt_pa = ((struct acpi20_table_rsdp *)rsdp)->xsdt_address;
 
                /* map in just the header */
                header = (struct acpi_table_header *)
-                       __acpi_map_table(sdt_pa, sizeof(struct 
acpi_table_header));
+                   __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
 
                if (!header) {
-                       printk(KERN_WARNING PREFIX "Unable to map XSDT 
header\n");
+                       printk(KERN_WARNING PREFIX
+                              "Unable to map XSDT header\n");
                        return -ENODEV;
                }
 
                /* remap in the entire table before processing */
                mapped_xsdt = (struct acpi_table_xsdt *)
-                       __acpi_map_table(sdt_pa, header->length);
+                   __acpi_map_table(sdt_pa, header->length);
                if (!mapped_xsdt) {
                        printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
                        return -ENODEV;
@@ -438,7 +438,8 @@ acpi_table_get_sdt (
                header = &mapped_xsdt->header;
 
                if (strncmp(header->signature, "XSDT", 4)) {
-                       printk(KERN_WARNING PREFIX "XSDT signature 
incorrect\n");
+                       printk(KERN_WARNING PREFIX
+                              "XSDT signature incorrect\n");
                        return -ENODEV;
                }
 
@@ -447,36 +448,39 @@ acpi_table_get_sdt (
                        return -ENODEV;
                }
 
-               sdt_count = (header->length - sizeof(struct acpi_table_header)) 
>> 3;
+               sdt_count =
+                   (header->length - sizeof(struct acpi_table_header)) >> 3;
                if (sdt_count > ACPI_MAX_TABLES) {
-                       printk(KERN_WARNING PREFIX "Truncated %lu XSDT 
entries\n",
-                               (sdt_count - ACPI_MAX_TABLES));
+                       printk(KERN_WARNING PREFIX
+                              "Truncated %lu XSDT entries\n",
+                              (sdt_count - ACPI_MAX_TABLES));
                        sdt_count = ACPI_MAX_TABLES;
                }
 
                for (i = 0; i < sdt_count; i++)
-                       sdt_entry[i].pa = (unsigned long) mapped_xsdt->entry[i];
+                       sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i];
        }
 
        /* Then check RSDT */
 
        else if (rsdp->rsdt_address) {
 
-               struct acpi_table_rsdt  *mapped_rsdt = NULL;
+               struct acpi_table_rsdt *mapped_rsdt = NULL;
 
                sdt_pa = rsdp->rsdt_address;
 
                /* map in just the header */
                header = (struct acpi_table_header *)
-                       __acpi_map_table(sdt_pa, sizeof(struct 
acpi_table_header));
+                   __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
                if (!header) {
-                       printk(KERN_WARNING PREFIX "Unable to map RSDT 
header\n");
+                       printk(KERN_WARNING PREFIX
+                              "Unable to map RSDT header\n");
                        return -ENODEV;
                }
 
                /* remap in the entire table before processing */
                mapped_rsdt = (struct acpi_table_rsdt *)
-                       __acpi_map_table(sdt_pa, header->length);
+                   __acpi_map_table(sdt_pa, header->length);
                if (!mapped_rsdt) {
                        printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
                        return -ENODEV;
@@ -484,7 +488,8 @@ acpi_table_get_sdt (
                header = &mapped_rsdt->header;
 
                if (strncmp(header->signature, "RSDT", 4)) {
-                       printk(KERN_WARNING PREFIX "RSDT signature 
incorrect\n");
+                       printk(KERN_WARNING PREFIX
+                              "RSDT signature incorrect\n");
                        return -ENODEV;
                }
 
@@ -493,19 +498,22 @@ acpi_table_get_sdt (
                        return -ENODEV;
                }
 
-               sdt_count = (header->length - sizeof(struct acpi_table_header)) 
>> 2;
+               sdt_count =
+                   (header->length - sizeof(struct acpi_table_header)) >> 2;
                if (sdt_count > ACPI_MAX_TABLES) {
-                       printk(KERN_WARNING PREFIX "Truncated %lu RSDT 
entries\n",
-                               (sdt_count - ACPI_MAX_TABLES));
+                       printk(KERN_WARNING PREFIX
+                              "Truncated %lu RSDT entries\n",
+                              (sdt_count - ACPI_MAX_TABLES));
                        sdt_count = ACPI_MAX_TABLES;
                }
 
                for (i = 0; i < sdt_count; i++)
-                       sdt_entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
+                       sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i];
        }
 
        else {
-               printk(KERN_WARNING PREFIX "No System Description Table 
(RSDT/XSDT) specified in RSDP\n");
+               printk(KERN_WARNING PREFIX
+                      "No System Description Table (RSDT/XSDT) specified in 
RSDP\n");
                return -ENODEV;
        }
 
@@ -515,18 +523,17 @@ acpi_table_get_sdt (
 
                /* map in just the header */
                header = (struct acpi_table_header *)
-                       __acpi_map_table(sdt_entry[i].pa,
-                               sizeof(struct acpi_table_header));
+                   __acpi_map_table(sdt_entry[i].pa,
+                                    sizeof(struct acpi_table_header));
                if (!header)
                        continue;
 
                /* remap in the entire table before processing */
                header = (struct acpi_table_header *)
-                       __acpi_map_table(sdt_entry[i].pa,
-                               header->length);
+                   __acpi_map_table(sdt_entry[i].pa, header->length);
                if (!header)
                        continue;
-                      
+
                acpi_table_print(header, sdt_entry[i].pa);
 
                if (acpi_table_compute_checksum(header, header->length)) {
@@ -537,9 +544,9 @@ acpi_table_get_sdt (
                sdt_entry[i].size = header->length;
 
                for (id = 0; id < ACPI_TABLE_COUNT; id++) {
-                       if (!strncmp((char *) &header->signature,
-                               acpi_table_signatures[id],
-                               sizeof(header->signature))) {
+                       if (!strncmp((char *)&header->signature,
+                                    acpi_table_signatures[id],
+                                    sizeof(header->signature))) {
                                sdt_entry[i].id = id;
                        }
                }
@@ -551,7 +558,7 @@ acpi_table_get_sdt (
         * against. Unfortunately, we don't know the phys_addr, so just
         * print 0. Maybe no one will notice.
         */
-       if(!acpi_get_table_header_early(ACPI_DSDT, &header))
+       if (!acpi_get_table_header_early(ACPI_DSDT, &header))
                acpi_table_print(header, 0);
 
        return 0;
@@ -566,12 +573,11 @@ acpi_table_get_sdt (
  * result: sdt_entry[] is initialized
  */
 
-int __init
-acpi_table_init (void)
-{
-       struct acpi_table_rsdp  *rsdp = NULL;
-       unsigned long           rsdp_phys = 0;
-       int                     result = 0;
+int __init acpi_table_init(void)
+{
+       struct acpi_table_rsdp *rsdp = NULL;
+       unsigned long rsdp_phys = 0;
+       int result = 0;
 
        /* Locate and map the Root System Description Table (RSDP) */
 
@@ -581,19 +587,26 @@ acpi_table_init (void)
                return -ENODEV;
        }
 
-       rsdp = (struct acpi_table_rsdp *) __va(rsdp_phys);
+       rsdp = (struct acpi_table_rsdp *)__acpi_map_table(rsdp_phys,
+               sizeof(struct acpi_table_rsdp));
        if (!rsdp) {
                printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
                return -ENODEV;
        }
 
-       printk(KERN_DEBUG PREFIX "RSDP (v%3.3d %6.6s                            
    ) @ 0x%p\n",
-               rsdp->revision, rsdp->oem_id, (void *) rsdp_phys);
+       printk(KERN_DEBUG PREFIX
+              "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
+              rsdp->revision, rsdp->oem_id, (void *)rsdp_phys);
 
        if (rsdp->revision < 2)
-               result = acpi_table_compute_checksum(rsdp, sizeof(struct 
acpi_table_rsdp));
+               result =
+                   acpi_table_compute_checksum(rsdp,
+                                               sizeof(struct acpi_table_rsdp));
        else
-               result = acpi_table_compute_checksum(rsdp, ((struct 
acpi20_table_rsdp *)rsdp)->length);
+               result =
+                   acpi_table_compute_checksum(rsdp,
+                                               ((struct acpi20_table_rsdp *)
+                                                rsdp)->length);
 
        if (result) {
                printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
diff -r 041be3f6b38e -r f07cf18343f1 xen/include/asm-x86/apicdef.h
--- a/xen/include/asm-x86/apicdef.h     Tue Sep 19 14:26:47 2006 +0100
+++ b/xen/include/asm-x86/apicdef.h     Tue Sep 19 16:33:01 2006 +0100
@@ -40,6 +40,7 @@
 #define                        APIC_SPIV_FOCUS_DISABLED        (1<<9)
 #define                        APIC_SPIV_APIC_ENABLED          (1<<8)
 #define                APIC_ISR        0x100
+#define         APIC_ISR_NR     0x8     /* Number of 32 bit ISR registers. */
 #define                APIC_TMR        0x180
 #define        APIC_IRR        0x200
 #define        APIC_ESR        0x280
diff -r 041be3f6b38e -r f07cf18343f1 xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h     Tue Sep 19 14:26:47 2006 +0100
+++ b/xen/include/asm-x86/io_apic.h     Tue Sep 19 16:33:01 2006 +0100
@@ -165,6 +165,7 @@ extern int io_apic_get_version (int ioap
 extern int io_apic_get_version (int ioapic);
 extern int io_apic_get_redir_entries (int ioapic);
 extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int 
edge_level, int active_high_low);
+extern int timer_uses_ioapic_pin_0;
 #endif /*CONFIG_ACPI_BOOT*/
 
 extern int (*ioapic_renumber_irq)(int ioapic, int irq);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] Upgrade some platform files to Linux 2.6.17.13., Xen patchbot-unstable <=