ia64/xen-unstable

changeset 11541:f07cf18343f1

[XEN] Upgrade some platform files to Linux 2.6.17.13.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Sep 19 16:33:01 2006 +0100 (2006-09-19)
parents 041be3f6b38e
children f90ac959db92
files xen/arch/x86/acpi/boot.c xen/arch/x86/apic.c xen/arch/x86/io_apic.c xen/arch/x86/mpparse.c xen/arch/x86/smpboot.c xen/drivers/acpi/tables.c xen/include/asm-x86/apicdef.h xen/include/asm-x86/io_apic.h
line diff
     1.1 --- a/xen/arch/x86/acpi/boot.c	Tue Sep 19 14:26:47 2006 +0100
     1.2 +++ b/xen/arch/x86/acpi/boot.c	Tue Sep 19 16:33:01 2006 +0100
     1.3 @@ -106,7 +106,7 @@ char *__acpi_map_table(unsigned long phy
     1.4  	unsigned long base, offset, mapped_size;
     1.5  	int idx;
     1.6  
     1.7 -	if (phys + size < 8 * 1024 * 1024) 
     1.8 +	if (phys + size < 8 * 1024 * 1024)
     1.9  		return __va(phys);
    1.10  
    1.11  	offset = phys & (PAGE_SIZE - 1);
    1.12 @@ -132,7 +132,7 @@ char *__acpi_map_table(unsigned long phy
    1.13  #ifdef CONFIG_X86_LOCAL_APIC
    1.14  static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
    1.15  {
    1.16 -	struct acpi_table_madt	*madt = NULL;
    1.17 +	struct acpi_table_madt *madt = NULL;
    1.18  
    1.19  	if (!phys_addr || !size)
    1.20  		return -EINVAL;
    1.21 @@ -147,18 +147,18 @@ static int __init acpi_parse_madt(unsign
    1.22  		acpi_lapic_addr = (u64) madt->lapic_address;
    1.23  
    1.24  		printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
    1.25 -			madt->lapic_address);
    1.26 +		       madt->lapic_address);
    1.27  	}
    1.28  
    1.29  	acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
    1.30 -	
    1.31 +
    1.32  	return 0;
    1.33  }
    1.34  
    1.35  static int __init
    1.36  acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
    1.37  {
    1.38 -	struct acpi_table_lapic	*processor = NULL;
    1.39 +	struct acpi_table_lapic *processor = NULL;
    1.40  
    1.41  	processor = (struct acpi_table_lapic *)header;
    1.42  
    1.43 @@ -167,10 +167,17 @@ acpi_parse_lapic(acpi_table_entry_header
    1.44  
    1.45  	acpi_table_print_madt_entry(header);
    1.46  
    1.47 -	/* Register even disabled CPUs for cpu hotplug */
    1.48 +	/* Record local apic id only when enabled */
    1.49 +	if (processor->flags.enabled)
    1.50 +		x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
    1.51  
    1.52 -	x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
    1.53 -
    1.54 +	/*
    1.55 +	 * We need to register disabled CPU as well to permit
    1.56 +	 * counting disabled CPUs. This allows us to size
    1.57 +	 * cpus_possible_map more accurately, to permit
    1.58 +	 * to not preallocating memory for all NR_CPUS
    1.59 +	 * when we use CPU hotplug.
    1.60 +	 */
    1.61  	mp_register_lapic(processor->id,	/* APIC ID */
    1.62  			  processor->flags.enabled);	/* Enabled? */
    1.63  
    1.64 @@ -224,7 +231,7 @@ acpi_parse_ioapic(acpi_table_entry_heade
    1.65  
    1.66  	if (BAD_MADT_ENTRY(ioapic, end))
    1.67  		return -EINVAL;
    1.68 - 
    1.69 +
    1.70  	acpi_table_print_madt_entry(header);
    1.71  
    1.72  	mp_register_ioapic(ioapic->id,
    1.73 @@ -281,8 +288,8 @@ acpi_parse_nmi_src(acpi_table_entry_head
    1.74  static unsigned long __init
    1.75  acpi_scan_rsdp(unsigned long start, unsigned long length)
    1.76  {
    1.77 -	unsigned long		offset = 0;
    1.78 -	unsigned long		sig_len = sizeof("RSD PTR ") - 1;
    1.79 +	unsigned long offset = 0;
    1.80 +	unsigned long sig_len = sizeof("RSD PTR ") - 1;
    1.81  
    1.82  	/*
    1.83  	 * Scan all 16-byte boundaries of the physical memory region for the
    1.84 @@ -302,7 +309,7 @@ static int __init acpi_parse_sbf(unsigne
    1.85  	struct acpi_table_sbf *sb;
    1.86  
    1.87  	if (!phys_addr || !size)
    1.88 -	return -EINVAL;
    1.89 +		return -EINVAL;
    1.90  
    1.91  	sb = (struct acpi_table_sbf *)__acpi_map_table(phys_addr, size);
    1.92  	if (!sb) {
    1.93 @@ -310,12 +317,11 @@ static int __init acpi_parse_sbf(unsigne
    1.94  		return -ENODEV;
    1.95  	}
    1.96  
    1.97 -	sbf_port = sb->sbf_cmos; /* Save CMOS port */
    1.98 +	sbf_port = sb->sbf_cmos;	/* Save CMOS port */
    1.99  
   1.100  	return 0;
   1.101  }
   1.102  
   1.103 -
   1.104  #ifdef CONFIG_HPET_TIMER
   1.105  
   1.106  static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
   1.107 @@ -349,7 +355,7 @@ static int __init acpi_parse_hpet(unsign
   1.108  
   1.109  		hpet_address = hpet_tbl->addr.addrl;
   1.110  		printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n",
   1.111 -			hpet_tbl->id, hpet_address);
   1.112 +		       hpet_tbl->id, hpet_address);
   1.113  	}
   1.114  #endif	/* X86 */
   1.115  
   1.116 @@ -410,17 +416,16 @@ static int __init acpi_parse_fadt(unsign
   1.117  	return 0;
   1.118  }
   1.119  
   1.120 -
   1.121  unsigned long __init acpi_find_rsdp(void)
   1.122  {
   1.123 -	unsigned long		rsdp_phys = 0;
   1.124 +	unsigned long rsdp_phys = 0;
   1.125  
   1.126  #if 0
   1.127  	if (efi_enabled) {
   1.128 -		if (efi.acpi20)
   1.129 -			return __pa(efi.acpi20);
   1.130 -		else if (efi.acpi)
   1.131 -			return __pa(efi.acpi);
   1.132 +		if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
   1.133 +			return efi.acpi20;
   1.134 +		else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
   1.135 +			return efi.acpi;
   1.136  	}
   1.137  #endif
   1.138  	/*
   1.139 @@ -443,6 +448,9 @@ static int __init acpi_parse_madt_lapic_
   1.140  {
   1.141  	int count;
   1.142  
   1.143 +	if (!cpu_has_apic)
   1.144 +		return -ENODEV;
   1.145 +
   1.146  	/* 
   1.147  	 * Note that the LAPIC address is obtained from the MADT (32-bit value)
   1.148  	 * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
   1.149 @@ -460,8 +468,8 @@ static int __init acpi_parse_madt_lapic_
   1.150  	mp_register_lapic_address(acpi_lapic_addr);
   1.151  
   1.152  	count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,
   1.153 -				       MAX_APICS);
   1.154 -	if (!count) { 
   1.155 +				      MAX_APICS);
   1.156 +	if (!count) {
   1.157  		printk(KERN_ERR PREFIX "No LAPIC entries present\n");
   1.158  		/* TBD: Cleanup to allow fallback to MPS */
   1.159  		return -ENODEV;
   1.160 @@ -499,14 +507,17 @@ static int __init acpi_parse_madt_ioapic
   1.161  	 */
   1.162  	if (acpi_disabled || acpi_noirq) {
   1.163  		return -ENODEV;
   1.164 -        }
   1.165 +	}
   1.166 +
   1.167 +	if (!cpu_has_apic)
   1.168 +		return -ENODEV;
   1.169  
   1.170  	/*
   1.171 - 	 * if "noapic" boot option, don't look for IO-APICs
   1.172 +	 * if "noapic" boot option, don't look for IO-APICs
   1.173  	 */
   1.174  	if (skip_ioapic_setup) {
   1.175  		printk(KERN_INFO PREFIX "Skipping IOAPIC probe "
   1.176 -			"due to 'noapic' option.\n");
   1.177 +		       "due to 'noapic' option.\n");
   1.178  		return -ENODEV;
   1.179  	}
   1.180  
   1.181 @@ -852,7 +863,7 @@ int __init acpi_boot_table_init(void)
   1.182  	 * One exception: acpi=ht continues far enough to enumerate LAPICs
   1.183  	 */
   1.184  	if (acpi_disabled && !acpi_ht)
   1.185 -		 return 1;
   1.186 +		return 1;
   1.187  
   1.188  	/* 
   1.189  	 * Initialize the ACPI boot-time table parser.
   1.190 @@ -884,7 +895,6 @@ int __init acpi_boot_table_init(void)
   1.191  	return 0;
   1.192  }
   1.193  
   1.194 -
   1.195  int __init acpi_boot_init(void)
   1.196  {
   1.197  	/*
   1.198 @@ -892,7 +902,7 @@ int __init acpi_boot_init(void)
   1.199  	 * One exception: acpi=ht continues far enough to enumerate LAPICs
   1.200  	 */
   1.201  	if (acpi_disabled && !acpi_ht)
   1.202 -		 return 1;
   1.203 +		return 1;
   1.204  
   1.205  	acpi_table_parse(ACPI_BOOT, acpi_parse_sbf);
   1.206  
   1.207 @@ -910,4 +920,3 @@ int __init acpi_boot_init(void)
   1.208  
   1.209  	return 0;
   1.210  }
   1.211 -
     2.1 --- a/xen/arch/x86/apic.c	Tue Sep 19 14:26:47 2006 +0100
     2.2 +++ b/xen/arch/x86/apic.c	Tue Sep 19 16:33:01 2006 +0100
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - *      based on linux-2.6.11/arch/i386/kernel/apic.c
     2.6 + *      based on linux-2.6.17.13/arch/i386/kernel/apic.c
     2.7   *
     2.8   *  Local APIC handling, local APIC timers
     2.9   *
    2.10 @@ -50,6 +50,18 @@ int apic_verbosity;
    2.11  
    2.12  static void apic_pm_activate(void);
    2.13  
    2.14 +int modern_apic(void)
    2.15 +{
    2.16 +    unsigned int lvr, version;
    2.17 +    /* AMD systems use old APIC versions, so check the CPU */
    2.18 +    if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
    2.19 +        boot_cpu_data.x86 >= 0xf)
    2.20 +        return 1;
    2.21 +    lvr = apic_read(APIC_LVR);
    2.22 +    version = GET_APIC_VERSION(lvr);
    2.23 +    return version >= 0x14;
    2.24 +}
    2.25 +
    2.26  /*
    2.27   * 'what should we do if we get a hw irq event on an illegal vector'.
    2.28   * each architecture has to answer this themselves.
    2.29 @@ -64,8 +76,10 @@ void ack_bad_irq(unsigned int irq)
    2.30       * holds up an irq slot - in excessive cases (when multiple
    2.31       * unexpected vectors occur) that might lock up the APIC
    2.32       * completely.
    2.33 +     * But only ack when the APIC is enabled -AK
    2.34       */
    2.35 -    ack_APIC_irq();
    2.36 +    if (cpu_has_apic)
    2.37 +        ack_APIC_irq();
    2.38  }
    2.39  
    2.40  void __init apic_intr_init(void)
    2.41 @@ -91,12 +105,21 @@ int using_apic_timer = 0;
    2.42  
    2.43  static int enabled_via_apicbase;
    2.44  
    2.45 +void enable_NMI_through_LVT0 (void * dummy)
    2.46 +{
    2.47 +    unsigned int v, ver;
    2.48 +
    2.49 +    ver = apic_read(APIC_LVR);
    2.50 +    ver = GET_APIC_VERSION(ver);
    2.51 +    v = APIC_DM_NMI;			/* unmask and set to NMI */
    2.52 +    if (!APIC_INTEGRATED(ver))		/* 82489DX */
    2.53 +        v |= APIC_LVT_LEVEL_TRIGGER;
    2.54 +    apic_write_around(APIC_LVT0, v);
    2.55 +}
    2.56 +
    2.57  int get_physical_broadcast(void)
    2.58  {
    2.59 -    unsigned int lvr, version;
    2.60 -    lvr = apic_read(APIC_LVR);
    2.61 -    version = GET_APIC_VERSION(lvr);
    2.62 -    if (!APIC_INTEGRATED(version) || version >= 0x14)
    2.63 +    if (modern_apic())
    2.64          return 0xff;
    2.65      else
    2.66          return 0xf;
    2.67 @@ -323,9 +346,9 @@ int __init verify_local_APIC(void)
    2.68  
    2.69  void __init sync_Arb_IDs(void)
    2.70  {
    2.71 -    /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 */
    2.72 -    unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
    2.73 -    if (ver >= 0x14)    /* P4 or higher */
    2.74 +    /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1
    2.75 +       And not needed on AMD */
    2.76 +    if (modern_apic())
    2.77          return;
    2.78      /*
    2.79       * Wait for idle.
    2.80 @@ -389,6 +412,7 @@ void __init init_bsp_APIC(void)
    2.81  void __devinit setup_local_APIC(void)
    2.82  {
    2.83      unsigned long oldvalue, value, ver, maxlvt;
    2.84 +    int i, j;
    2.85  
    2.86      /* Pound the ESR really hard over the head with a big hammer - mbligh */
    2.87      if (esr_disable) {
    2.88 @@ -426,6 +450,25 @@ void __devinit setup_local_APIC(void)
    2.89      apic_write_around(APIC_TASKPRI, value);
    2.90  
    2.91      /*
    2.92 +     * After a crash, we no longer service the interrupts and a pending
    2.93 +     * interrupt from previous kernel might still have ISR bit set.
    2.94 +     *
    2.95 +     * Most probably by now CPU has serviced that pending interrupt and
    2.96 +     * it might not have done the ack_APIC_irq() because it thought,
    2.97 +     * interrupt came from i8259 as ExtInt. LAPIC did not get EOI so it
    2.98 +     * does not clear the ISR bit and cpu thinks it has already serivced
    2.99 +     * the interrupt. Hence a vector might get locked. It was noticed
   2.100 +     * for timer irq (vector 0x31). Issue an extra EOI to clear ISR.
   2.101 +     */
   2.102 +    for (i = APIC_ISR_NR - 1; i >= 0; i--) {
   2.103 +        value = apic_read(APIC_ISR + i*0x10);
   2.104 +        for (j = 31; j >= 0; j--) {
   2.105 +            if (value & (1<<j))
   2.106 +                ack_APIC_irq();
   2.107 +        }
   2.108 +    }
   2.109 +
   2.110 +    /*
   2.111       * Now that we are all set up, enable the APIC
   2.112       */
   2.113      value = apic_read(APIC_SPIV);
   2.114 @@ -536,6 +579,29 @@ void __devinit setup_local_APIC(void)
   2.115      apic_pm_activate();
   2.116  }
   2.117  
   2.118 +/*
   2.119 + * If Linux enabled the LAPIC against the BIOS default
   2.120 + * disable it down before re-entering the BIOS on shutdown.
   2.121 + * Otherwise the BIOS may get confused and not power-off.
   2.122 + * Additionally clear all LVT entries before disable_local_APIC
   2.123 + * for the case where Linux didn't enable the LAPIC.
   2.124 + */
   2.125 +void lapic_shutdown(void)
   2.126 +{
   2.127 +    unsigned long flags;
   2.128 +
   2.129 +    if (!cpu_has_apic)
   2.130 +        return;
   2.131 +
   2.132 +    local_irq_save(flags);
   2.133 +    clear_local_APIC();
   2.134 +
   2.135 +    if (enabled_via_apicbase)
   2.136 +        disable_local_APIC();
   2.137 +
   2.138 +    local_irq_restore(flags);
   2.139 +}
   2.140 +
   2.141  static void apic_pm_activate(void) { }
   2.142  
   2.143  /*
   2.144 @@ -1086,6 +1152,7 @@ int __init APIC_init_uniprocessor (void)
   2.145      if (!cpu_has_apic && APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
   2.146          printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
   2.147                 boot_cpu_physical_apicid);
   2.148 +        clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
   2.149          return -1;
   2.150      }
   2.151  
   2.152 @@ -1093,6 +1160,14 @@ int __init APIC_init_uniprocessor (void)
   2.153  
   2.154      connect_bsp_APIC();
   2.155  
   2.156 +    /*
   2.157 +     * Hack: In case of kdump, after a crash, kernel might be booting
   2.158 +     * on a cpu with non-zero lapic id. But boot_cpu_physical_apicid
   2.159 +     * might be zero if read from MP tables. Get it from LAPIC.
   2.160 +     */
   2.161 +#ifdef CONFIG_CRASH_DUMP
   2.162 +    boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
   2.163 +#endif
   2.164      phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
   2.165  
   2.166      setup_local_APIC();
     3.1 --- a/xen/arch/x86/io_apic.c	Tue Sep 19 14:26:47 2006 +0100
     3.2 +++ b/xen/arch/x86/io_apic.c	Tue Sep 19 16:33:01 2006 +0100
     3.3 @@ -1143,7 +1143,8 @@ static void __init setup_ioapic_ids_from
     3.4       * Don't check I/O APIC IDs for xAPIC systems. They have
     3.5       * no meaning without the serial APIC bus.
     3.6       */
     3.7 -    if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && boot_cpu_data.x86 < 15))
     3.8 +    if (!(boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
     3.9 +        || APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
    3.10          return;
    3.11  
    3.12      /*
    3.13 @@ -1639,6 +1640,8 @@ static inline void unlock_ExtINT_logic(v
    3.14      spin_unlock_irqrestore(&ioapic_lock, flags);
    3.15  }
    3.16  
    3.17 +int timer_uses_ioapic_pin_0;
    3.18 +
    3.19  /*
    3.20   * This code may look a bit paranoid, but it's supposed to cooperate with
    3.21   * a wide range of boards and BIOS bugs.  Fortunately only the timer IRQ
    3.22 @@ -1678,6 +1681,9 @@ static inline void check_timer(void)
    3.23      pin2  = ioapic_i8259.pin;
    3.24      apic2 = ioapic_i8259.apic;
    3.25  
    3.26 +    if (pin1 == 0)
    3.27 +        timer_uses_ioapic_pin_0 = 1;
    3.28 +
    3.29      printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
    3.30             vector, apic1, pin1, apic2, pin2);
    3.31  
     4.1 --- a/xen/arch/x86/mpparse.c	Tue Sep 19 14:26:47 2006 +0100
     4.2 +++ b/xen/arch/x86/mpparse.c	Tue Sep 19 16:33:01 2006 +0100
     4.3 @@ -35,13 +35,7 @@
     4.4  
     4.5  /* Have we found an MP table */
     4.6  int smp_found_config;
     4.7 -unsigned int __devinitdata maxcpus = NR_CPUS;
     4.8 -
     4.9 -#ifdef CONFIG_HOTPLUG_CPU
    4.10 -#define CPU_HOTPLUG_ENABLED	(1)
    4.11 -#else
    4.12 -#define CPU_HOTPLUG_ENABLED	(0)
    4.13 -#endif
    4.14 +unsigned int __initdata maxcpus = NR_CPUS;
    4.15  
    4.16  /*
    4.17   * Various Linux-internal data structures created from the
    4.18 @@ -73,9 +67,8 @@ unsigned int def_to_bigsmp = 0;
    4.19  
    4.20  /* Processor that is doing the boot up */
    4.21  unsigned int boot_cpu_physical_apicid = -1U;
    4.22 -unsigned int boot_cpu_logical_apicid = -1U;
    4.23  /* Internal processor count */
    4.24 -static unsigned int __initdata num_processors;
    4.25 +static unsigned int __devinitdata num_processors;
    4.26  
    4.27  /* Bitmask of physically existing CPUs */
    4.28  physid_mask_t phys_cpu_present_map;
    4.29 @@ -107,24 +100,9 @@ static int __init mpf_checksum(unsigned 
    4.30   * doing this ....
    4.31   */
    4.32  
    4.33 -static int mpc_record;
    4.34 +static int mpc_record; 
    4.35  static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY] __initdata;
    4.36  
    4.37 -#ifdef CONFIG_X86_NUMAQ
    4.38 -static int MP_valid_apicid(int apicid, int version)
    4.39 -{
    4.40 -	return hweight_long(apicid & 0xf) == 1 && (apicid >> 4) != 0xf;
    4.41 -}
    4.42 -#else
    4.43 -static int MP_valid_apicid(int apicid, int version)
    4.44 -{
    4.45 -	if (version >= 0x14)
    4.46 -		return apicid < 0xff;
    4.47 -	else
    4.48 -		return apicid < 0xf;
    4.49 -}
    4.50 -#endif
    4.51 -
    4.52  static void __devinit MP_processor_info (struct mpc_config_processor *m)
    4.53  {
    4.54   	int ver, apicid;
    4.55 @@ -190,12 +168,6 @@ static void __devinit MP_processor_info 
    4.56  
    4.57  	ver = m->mpc_apicver;
    4.58  
    4.59 -	if (!MP_valid_apicid(apicid, ver)) {
    4.60 -		printk(KERN_WARNING "Processor #%d INVALID. (Max ID: %d).\n",
    4.61 -			m->mpc_apicid, MAX_APICS);
    4.62 -		return;
    4.63 -	}
    4.64 -
    4.65  	/*
    4.66  	 * Validate version
    4.67  	 */
    4.68 @@ -225,7 +197,7 @@ static void __devinit MP_processor_info 
    4.69  	cpu_set(num_processors, cpu_possible_map);
    4.70  	num_processors++;
    4.71  
    4.72 -	if (CPU_HOTPLUG_ENABLED || (num_processors > 8)) {
    4.73 +	if (num_processors > 8) {
    4.74  		/*
    4.75  		 * No need for processor or APIC checks: physical delivery
    4.76  		 * (bigsmp) mode should always work.
    4.77 @@ -244,6 +216,15 @@ static void __init MP_bus_info (struct m
    4.78  
    4.79  	mpc_oem_bus_info(m, str, translation_table[mpc_record]);
    4.80  
    4.81 +#if 0 /* size of mpc_busid (8 bits) makes this check unnecessary */
    4.82 +	if (m->mpc_busid >= MAX_MP_BUSSES) {
    4.83 +		printk(KERN_WARNING "MP table busid value (%d) for bustype %s "
    4.84 +			" is too large, max. supported is %d\n",
    4.85 +			m->mpc_busid, str, MAX_MP_BUSSES - 1);
    4.86 +		return;
    4.87 +	}
    4.88 +#endif
    4.89 +
    4.90  	if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) {
    4.91  		mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
    4.92  	} else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA)-1) == 0) {
    4.93 @@ -931,7 +912,8 @@ void __init mp_register_ioapic (
    4.94  	mp_ioapics[idx].mpc_apicaddr = address;
    4.95  
    4.96  	set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
    4.97 -	if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 < 15))
    4.98 +	if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
    4.99 +		&& !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
   4.100  		tmpid = io_apic_get_unique_id(idx, id);
   4.101  	else
   4.102  		tmpid = id;
   4.103 @@ -1007,7 +989,6 @@ void __init mp_override_legacy_irq (
   4.104  	return;
   4.105  }
   4.106  
   4.107 -
   4.108  void __init mp_config_acpi_legacy_irqs (void)
   4.109  {
   4.110  	struct mpc_config_intsrc intsrc;
   4.111 @@ -1139,7 +1120,17 @@ int mp_register_gsi (u32 gsi, int trigge
   4.112  		 */
   4.113  		int irq = gsi;
   4.114  		if (gsi < MAX_GSI_NUM) {
   4.115 -			if (gsi > 15)
   4.116 +			/*
   4.117 +			 * Retain the VIA chipset work-around (gsi > 15), but
   4.118 +			 * avoid a problem where the 8254 timer (IRQ0) is setup
   4.119 +			 * via an override (so it's not on pin 0 of the ioapic),
   4.120 +			 * and at the same time, the pin 0 interrupt is a PCI
   4.121 +			 * type.  The gsi > 15 test could cause these two pins
   4.122 +			 * to be shared as IRQ0, and they are not shareable.
   4.123 +			 * So test for this condition, and if necessary, avoid
   4.124 +			 * the pin collision.
   4.125 +			 */
   4.126 +			if (gsi > 15 || (gsi == 0 && !timer_uses_ioapic_pin_0))
   4.127  				gsi = pci_irq++;
   4.128  #ifdef CONFIG_ACPI_BUS
   4.129  			/*
     5.1 --- a/xen/arch/x86/smpboot.c	Tue Sep 19 14:26:47 2006 +0100
     5.2 +++ b/xen/arch/x86/smpboot.c	Tue Sep 19 16:33:01 2006 +0100
     5.3 @@ -982,7 +982,6 @@ static int __devinit do_boot_cpu(int api
     5.4   * Cycle through the processors sending APIC IPIs to boot each.
     5.5   */
     5.6  
     5.7 -static int boot_cpu_logical_apicid;
     5.8  /* Where the IO area was mapped on multiquad, always 0 otherwise */
     5.9  void *xquad_portio;
    5.10  #ifdef CONFIG_X86_NUMAQ
    5.11 @@ -1004,7 +1003,6 @@ static void __init smp_boot_cpus(unsigne
    5.12  	print_cpu_info(&cpu_data[0]);
    5.13  
    5.14  	boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
    5.15 -	boot_cpu_logical_apicid = logical_smp_processor_id();
    5.16  	x86_cpu_to_apicid[0] = boot_cpu_physical_apicid;
    5.17  
    5.18  	/*current_thread_info()->cpu = 0;*/
     6.1 --- a/xen/drivers/acpi/tables.c	Tue Sep 19 14:26:47 2006 +0100
     6.2 +++ b/xen/drivers/acpi/tables.c	Tue Sep 19 16:33:01 2006 +0100
     6.3 @@ -37,28 +37,28 @@
     6.4  
     6.5  #define PREFIX			"ACPI: "
     6.6  
     6.7 -#define ACPI_MAX_TABLES		256
     6.8 +#define ACPI_MAX_TABLES		128
     6.9  
    6.10  static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
    6.11 -	[ACPI_TABLE_UNKNOWN]	= "????",
    6.12 -	[ACPI_APIC]		= "APIC",
    6.13 -	[ACPI_BOOT]		= "BOOT",
    6.14 -	[ACPI_DBGP]		= "DBGP",
    6.15 -	[ACPI_DSDT]		= "DSDT",
    6.16 -	[ACPI_ECDT]		= "ECDT",
    6.17 -	[ACPI_ETDT]		= "ETDT",
    6.18 -	[ACPI_FADT]		= "FACP",
    6.19 -	[ACPI_FACS]		= "FACS",
    6.20 -	[ACPI_OEMX]		= "OEM",
    6.21 -	[ACPI_PSDT]		= "PSDT",
    6.22 -	[ACPI_SBST]		= "SBST",
    6.23 -	[ACPI_SLIT]		= "SLIT",
    6.24 -	[ACPI_SPCR]		= "SPCR",
    6.25 -	[ACPI_SRAT]		= "SRAT",
    6.26 -	[ACPI_SSDT]		= "SSDT",
    6.27 -	[ACPI_SPMI]		= "SPMI",
    6.28 -	[ACPI_HPET]		= "HPET",
    6.29 -	[ACPI_MCFG]		= "MCFG",
    6.30 +	[ACPI_TABLE_UNKNOWN] = "????",
    6.31 +	[ACPI_APIC] = "APIC",
    6.32 +	[ACPI_BOOT] = "BOOT",
    6.33 +	[ACPI_DBGP] = "DBGP",
    6.34 +	[ACPI_DSDT] = "DSDT",
    6.35 +	[ACPI_ECDT] = "ECDT",
    6.36 +	[ACPI_ETDT] = "ETDT",
    6.37 +	[ACPI_FADT] = "FACP",
    6.38 +	[ACPI_FACS] = "FACS",
    6.39 +	[ACPI_OEMX] = "OEM",
    6.40 +	[ACPI_PSDT] = "PSDT",
    6.41 +	[ACPI_SBST] = "SBST",
    6.42 +	[ACPI_SLIT] = "SLIT",
    6.43 +	[ACPI_SPCR] = "SPCR",
    6.44 +	[ACPI_SRAT] = "SRAT",
    6.45 +	[ACPI_SSDT] = "SSDT",
    6.46 +	[ACPI_SPMI] = "SPMI",
    6.47 +	[ACPI_HPET] = "HPET",
    6.48 +	[ACPI_MCFG] = "MCFG",
    6.49  };
    6.50  
    6.51  static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
    6.52 @@ -66,52 +66,44 @@ static char *mps_inti_flags_trigger[] = 
    6.53  
    6.54  /* System Description Table (RSDT/XSDT) */
    6.55  struct acpi_table_sdt {
    6.56 -	unsigned long		pa;
    6.57 -	enum acpi_table_id	id;
    6.58 -	unsigned long		size;
    6.59 +	unsigned long pa;
    6.60 +	enum acpi_table_id id;
    6.61 +	unsigned long size;
    6.62  } __attribute__ ((packed));
    6.63  
    6.64 -static unsigned long		sdt_pa;		/* Physical Address */
    6.65 -static unsigned long		sdt_count;	/* Table count */
    6.66 -
    6.67 -static struct acpi_table_sdt	sdt_entry[ACPI_MAX_TABLES];
    6.68 +static unsigned long sdt_pa;	/* Physical Address */
    6.69 +static unsigned long sdt_count;	/* Table count */
    6.70  
    6.71 -void
    6.72 -acpi_table_print (
    6.73 -	struct acpi_table_header *header,
    6.74 -	unsigned long		phys_addr)
    6.75 +static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES] __initdata;
    6.76 +
    6.77 +void acpi_table_print(struct acpi_table_header *header, unsigned long phys_addr)
    6.78  {
    6.79 -	char			*name = NULL;
    6.80 +	char *name = NULL;
    6.81  
    6.82  	if (!header)
    6.83  		return;
    6.84  
    6.85  	/* Some table signatures aren't good table names */
    6.86  
    6.87 -	if (!strncmp((char *) &header->signature,
    6.88 -		acpi_table_signatures[ACPI_APIC],
    6.89 -		sizeof(header->signature))) {
    6.90 +	if (!strncmp((char *)&header->signature,
    6.91 +		     acpi_table_signatures[ACPI_APIC],
    6.92 +		     sizeof(header->signature))) {
    6.93  		name = "MADT";
    6.94 -	}
    6.95 -	else if (!strncmp((char *) &header->signature,
    6.96 -		acpi_table_signatures[ACPI_FADT],
    6.97 -		sizeof(header->signature))) {
    6.98 +	} else if (!strncmp((char *)&header->signature,
    6.99 +			    acpi_table_signatures[ACPI_FADT],
   6.100 +			    sizeof(header->signature))) {
   6.101  		name = "FADT";
   6.102 -	}
   6.103 -	else
   6.104 +	} else
   6.105  		name = header->signature;
   6.106  
   6.107 -	printk(KERN_DEBUG PREFIX "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n",
   6.108 -		name, header->revision, header->oem_id,
   6.109 -		header->oem_table_id, header->oem_revision,
   6.110 -		header->asl_compiler_id, header->asl_compiler_revision,
   6.111 -		(void *) phys_addr);
   6.112 +	printk(KERN_DEBUG PREFIX
   6.113 +	       "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n", name,
   6.114 +	       header->revision, header->oem_id, header->oem_table_id,
   6.115 +	       header->oem_revision, header->asl_compiler_id,
   6.116 +	       header->asl_compiler_revision, (void *)phys_addr);
   6.117  }
   6.118  
   6.119 -
   6.120 -void
   6.121 -acpi_table_print_madt_entry (
   6.122 -	acpi_table_entry_header	*header)
   6.123 +void acpi_table_print_madt_entry(acpi_table_entry_header * header)
   6.124  {
   6.125  	if (!header)
   6.126  		return;
   6.127 @@ -119,113 +111,127 @@ acpi_table_print_madt_entry (
   6.128  	switch (header->type) {
   6.129  
   6.130  	case ACPI_MADT_LAPIC:
   6.131 -	{
   6.132 -		struct acpi_table_lapic *p =
   6.133 -			(struct acpi_table_lapic*) header;
   6.134 -		printk(KERN_INFO PREFIX "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
   6.135 -			p->acpi_id, p->id, p->flags.enabled?"enabled":"disabled");
   6.136 -	}
   6.137 +		{
   6.138 +			struct acpi_table_lapic *p =
   6.139 +			    (struct acpi_table_lapic *)header;
   6.140 +			printk(KERN_INFO PREFIX
   6.141 +			       "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
   6.142 +			       p->acpi_id, p->id,
   6.143 +			       p->flags.enabled ? "enabled" : "disabled");
   6.144 +		}
   6.145  		break;
   6.146  
   6.147  	case ACPI_MADT_IOAPIC:
   6.148 -	{
   6.149 -		struct acpi_table_ioapic *p =
   6.150 -			(struct acpi_table_ioapic*) header;
   6.151 -		printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
   6.152 -			p->id, p->address, p->global_irq_base);
   6.153 -	}
   6.154 +		{
   6.155 +			struct acpi_table_ioapic *p =
   6.156 +			    (struct acpi_table_ioapic *)header;
   6.157 +			printk(KERN_INFO PREFIX
   6.158 +			       "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
   6.159 +			       p->id, p->address, p->global_irq_base);
   6.160 +		}
   6.161  		break;
   6.162  
   6.163  	case ACPI_MADT_INT_SRC_OVR:
   6.164 -	{
   6.165 -		struct acpi_table_int_src_ovr *p =
   6.166 -			(struct acpi_table_int_src_ovr*) header;
   6.167 -		printk(KERN_INFO PREFIX "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
   6.168 -			p->bus, p->bus_irq, p->global_irq,
   6.169 -			mps_inti_flags_polarity[p->flags.polarity],
   6.170 -			mps_inti_flags_trigger[p->flags.trigger]);
   6.171 -		if(p->flags.reserved)
   6.172 -			printk(KERN_INFO PREFIX "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
   6.173 -				p->flags.reserved);
   6.174 +		{
   6.175 +			struct acpi_table_int_src_ovr *p =
   6.176 +			    (struct acpi_table_int_src_ovr *)header;
   6.177 +			printk(KERN_INFO PREFIX
   6.178 +			       "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
   6.179 +			       p->bus, p->bus_irq, p->global_irq,
   6.180 +			       mps_inti_flags_polarity[p->flags.polarity],
   6.181 +			       mps_inti_flags_trigger[p->flags.trigger]);
   6.182 +			if (p->flags.reserved)
   6.183 +				printk(KERN_INFO PREFIX
   6.184 +				       "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
   6.185 +				       p->flags.reserved);
   6.186  
   6.187 -	}
   6.188 +		}
   6.189  		break;
   6.190  
   6.191  	case ACPI_MADT_NMI_SRC:
   6.192 -	{
   6.193 -		struct acpi_table_nmi_src *p =
   6.194 -			(struct acpi_table_nmi_src*) header;
   6.195 -		printk(KERN_INFO PREFIX "NMI_SRC (%s %s global_irq %d)\n",
   6.196 -			mps_inti_flags_polarity[p->flags.polarity],
   6.197 -			mps_inti_flags_trigger[p->flags.trigger], p->global_irq);
   6.198 -	}
   6.199 +		{
   6.200 +			struct acpi_table_nmi_src *p =
   6.201 +			    (struct acpi_table_nmi_src *)header;
   6.202 +			printk(KERN_INFO PREFIX
   6.203 +			       "NMI_SRC (%s %s global_irq %d)\n",
   6.204 +			       mps_inti_flags_polarity[p->flags.polarity],
   6.205 +			       mps_inti_flags_trigger[p->flags.trigger],
   6.206 +			       p->global_irq);
   6.207 +		}
   6.208  		break;
   6.209  
   6.210  	case ACPI_MADT_LAPIC_NMI:
   6.211 -	{
   6.212 -		struct acpi_table_lapic_nmi *p =
   6.213 -			(struct acpi_table_lapic_nmi*) header;
   6.214 -		printk(KERN_INFO PREFIX "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
   6.215 -			p->acpi_id,
   6.216 -			mps_inti_flags_polarity[p->flags.polarity],
   6.217 -			mps_inti_flags_trigger[p->flags.trigger], p->lint);
   6.218 -	}
   6.219 +		{
   6.220 +			struct acpi_table_lapic_nmi *p =
   6.221 +			    (struct acpi_table_lapic_nmi *)header;
   6.222 +			printk(KERN_INFO PREFIX
   6.223 +			       "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
   6.224 +			       p->acpi_id,
   6.225 +			       mps_inti_flags_polarity[p->flags.polarity],
   6.226 +			       mps_inti_flags_trigger[p->flags.trigger],
   6.227 +			       p->lint);
   6.228 +		}
   6.229  		break;
   6.230  
   6.231  	case ACPI_MADT_LAPIC_ADDR_OVR:
   6.232 -	{
   6.233 -		struct acpi_table_lapic_addr_ovr *p =
   6.234 -			(struct acpi_table_lapic_addr_ovr*) header;
   6.235 -		printk(KERN_INFO PREFIX "LAPIC_ADDR_OVR (address[%p])\n",
   6.236 -			(void *) (unsigned long) p->address);
   6.237 -	}
   6.238 +		{
   6.239 +			struct acpi_table_lapic_addr_ovr *p =
   6.240 +			    (struct acpi_table_lapic_addr_ovr *)header;
   6.241 +			printk(KERN_INFO PREFIX
   6.242 +			       "LAPIC_ADDR_OVR (address[%p])\n",
   6.243 +			       (void *)(unsigned long)p->address);
   6.244 +		}
   6.245  		break;
   6.246  
   6.247  	case ACPI_MADT_IOSAPIC:
   6.248 -	{
   6.249 -		struct acpi_table_iosapic *p =
   6.250 -			(struct acpi_table_iosapic*) header;
   6.251 -		printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
   6.252 -			p->id, (void *) (unsigned long) p->address, p->global_irq_base);
   6.253 -	}
   6.254 +		{
   6.255 +			struct acpi_table_iosapic *p =
   6.256 +			    (struct acpi_table_iosapic *)header;
   6.257 +			printk(KERN_INFO PREFIX
   6.258 +			       "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
   6.259 +			       p->id, (void *)(unsigned long)p->address,
   6.260 +			       p->global_irq_base);
   6.261 +		}
   6.262  		break;
   6.263  
   6.264  	case ACPI_MADT_LSAPIC:
   6.265 -	{
   6.266 -		struct acpi_table_lsapic *p =
   6.267 -			(struct acpi_table_lsapic*) header;
   6.268 -		printk(KERN_INFO PREFIX "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
   6.269 -			p->acpi_id, p->id, p->eid, p->flags.enabled?"enabled":"disabled");
   6.270 -	}
   6.271 +		{
   6.272 +			struct acpi_table_lsapic *p =
   6.273 +			    (struct acpi_table_lsapic *)header;
   6.274 +			printk(KERN_INFO PREFIX
   6.275 +			       "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
   6.276 +			       p->acpi_id, p->id, p->eid,
   6.277 +			       p->flags.enabled ? "enabled" : "disabled");
   6.278 +		}
   6.279  		break;
   6.280  
   6.281  	case ACPI_MADT_PLAT_INT_SRC:
   6.282 -	{
   6.283 -		struct acpi_table_plat_int_src *p =
   6.284 -			(struct acpi_table_plat_int_src*) header;
   6.285 -		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",
   6.286 -			mps_inti_flags_polarity[p->flags.polarity],
   6.287 -			mps_inti_flags_trigger[p->flags.trigger],
   6.288 -			p->type, p->id, p->eid, p->iosapic_vector, p->global_irq);
   6.289 -	}
   6.290 +		{
   6.291 +			struct acpi_table_plat_int_src *p =
   6.292 +			    (struct acpi_table_plat_int_src *)header;
   6.293 +			printk(KERN_INFO PREFIX
   6.294 +			       "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
   6.295 +			       mps_inti_flags_polarity[p->flags.polarity],
   6.296 +			       mps_inti_flags_trigger[p->flags.trigger],
   6.297 +			       p->type, p->id, p->eid, p->iosapic_vector,
   6.298 +			       p->global_irq);
   6.299 +		}
   6.300  		break;
   6.301  
   6.302  	default:
   6.303 -		printk(KERN_WARNING PREFIX "Found unsupported MADT entry (type = 0x%x)\n",
   6.304 -			header->type);
   6.305 +		printk(KERN_WARNING PREFIX
   6.306 +		       "Found unsupported MADT entry (type = 0x%x)\n",
   6.307 +		       header->type);
   6.308  		break;
   6.309  	}
   6.310  }
   6.311  
   6.312 -
   6.313  static int
   6.314 -acpi_table_compute_checksum (
   6.315 -	void			*table_pointer,
   6.316 -	unsigned long		length)
   6.317 +acpi_table_compute_checksum(void *table_pointer, unsigned long length)
   6.318  {
   6.319 -	u8			*p = (u8 *) table_pointer;
   6.320 -	unsigned long		remains = length;
   6.321 -	unsigned long		sum = 0;
   6.322 +	u8 *p = (u8 *) table_pointer;
   6.323 +	unsigned long remains = length;
   6.324 +	unsigned long sum = 0;
   6.325  
   6.326  	if (!p || !length)
   6.327  		return -EINVAL;
   6.328 @@ -241,9 +247,8 @@ acpi_table_compute_checksum (
   6.329   * for acpi_blacklisted(), acpi_table_get_sdt()
   6.330   */
   6.331  int __init
   6.332 -acpi_get_table_header_early (
   6.333 -	enum acpi_table_id	id,
   6.334 -	struct acpi_table_header **header)
   6.335 +acpi_get_table_header_early(enum acpi_table_id id,
   6.336 +			    struct acpi_table_header **header)
   6.337  {
   6.338  	unsigned int i;
   6.339  	enum acpi_table_id temp_id;
   6.340 @@ -260,7 +265,7 @@ acpi_get_table_header_early (
   6.341  		if (sdt_entry[i].id != temp_id)
   6.342  			continue;
   6.343  		*header = (void *)
   6.344 -			__acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
   6.345 +		    __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
   6.346  		if (!*header) {
   6.347  			printk(KERN_WARNING PREFIX "Unable to map %s\n",
   6.348  			       acpi_table_signatures[temp_id]);
   6.349 @@ -277,14 +282,17 @@ acpi_get_table_header_early (
   6.350  
   6.351  	/* Map the DSDT header via the pointer in the FADT */
   6.352  	if (id == ACPI_DSDT) {
   6.353 -		struct fadt_descriptor_rev2 *fadt = (struct fadt_descriptor_rev2 *) *header;
   6.354 +		struct fadt_descriptor_rev2 *fadt =
   6.355 +		    (struct fadt_descriptor_rev2 *)*header;
   6.356  
   6.357  		if (fadt->revision == 3 && fadt->Xdsdt) {
   6.358 -			*header = (void *) __acpi_map_table(fadt->Xdsdt,
   6.359 -					sizeof(struct acpi_table_header));
   6.360 +			*header = (void *)__acpi_map_table(fadt->Xdsdt,
   6.361 +							   sizeof(struct
   6.362 +								  acpi_table_header));
   6.363  		} else if (fadt->V1_dsdt) {
   6.364 -			*header = (void *) __acpi_map_table(fadt->V1_dsdt,
   6.365 -					sizeof(struct acpi_table_header));
   6.366 +			*header = (void *)__acpi_map_table(fadt->V1_dsdt,
   6.367 +							   sizeof(struct
   6.368 +								  acpi_table_header));
   6.369  		} else
   6.370  			*header = NULL;
   6.371  
   6.372 @@ -296,21 +304,19 @@ acpi_get_table_header_early (
   6.373  
   6.374  	return 0;
   6.375  }
   6.376 -	 
   6.377  
   6.378  int __init
   6.379 -acpi_table_parse_madt_family (
   6.380 -	enum acpi_table_id	id,
   6.381 -	unsigned long		madt_size,
   6.382 -	int			entry_id,
   6.383 -	acpi_madt_entry_handler	handler,
   6.384 -	unsigned int		max_entries)
   6.385 +acpi_table_parse_madt_family(enum acpi_table_id id,
   6.386 +			     unsigned long madt_size,
   6.387 +			     int entry_id,
   6.388 +			     acpi_madt_entry_handler handler,
   6.389 +			     unsigned int max_entries)
   6.390  {
   6.391 -	void			*madt = NULL;
   6.392 -	acpi_table_entry_header	*entry;
   6.393 -	unsigned int		count = 0;
   6.394 -	unsigned long		madt_end;
   6.395 -	unsigned int		i;
   6.396 +	void *madt = NULL;
   6.397 +	acpi_table_entry_header *entry;
   6.398 +	unsigned int count = 0;
   6.399 +	unsigned long madt_end;
   6.400 +	unsigned int i;
   6.401  
   6.402  	if (!handler)
   6.403  		return -EINVAL;
   6.404 @@ -321,7 +327,7 @@ acpi_table_parse_madt_family (
   6.405  		if (sdt_entry[i].id != id)
   6.406  			continue;
   6.407  		madt = (void *)
   6.408 -			__acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
   6.409 +		    __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
   6.410  		if (!madt) {
   6.411  			printk(KERN_WARNING PREFIX "Unable to map %s\n",
   6.412  			       acpi_table_signatures[id]);
   6.413 @@ -336,21 +342,22 @@ acpi_table_parse_madt_family (
   6.414  		return -ENODEV;
   6.415  	}
   6.416  
   6.417 -	madt_end = (unsigned long) madt + sdt_entry[i].size;
   6.418 +	madt_end = (unsigned long)madt + sdt_entry[i].size;
   6.419  
   6.420  	/* Parse all entries looking for a match. */
   6.421  
   6.422  	entry = (acpi_table_entry_header *)
   6.423 -		((unsigned long) madt + madt_size);
   6.424 +	    ((unsigned long)madt + madt_size);
   6.425  
   6.426 -	while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < madt_end) {
   6.427 -		if (entry->type == entry_id &&
   6.428 -		    (!max_entries || count++ < max_entries))
   6.429 +	while (((unsigned long)entry) + sizeof(acpi_table_entry_header) <
   6.430 +	       madt_end) {
   6.431 +		if (entry->type == entry_id
   6.432 +		    && (!max_entries || count++ < max_entries))
   6.433  			if (handler(entry, madt_end))
   6.434  				return -EINVAL;
   6.435  
   6.436  		entry = (acpi_table_entry_header *)
   6.437 -			((unsigned long) entry + entry->length);
   6.438 +		    ((unsigned long)entry + entry->length);
   6.439  	}
   6.440  	if (max_entries && count > max_entries) {
   6.441  		printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of "
   6.442 @@ -361,25 +368,19 @@ acpi_table_parse_madt_family (
   6.443  	return count;
   6.444  }
   6.445  
   6.446 -
   6.447  int __init
   6.448 -acpi_table_parse_madt (
   6.449 -	enum acpi_madt_entry_id	id,
   6.450 -	acpi_madt_entry_handler	handler,
   6.451 -	unsigned int max_entries)
   6.452 +acpi_table_parse_madt(enum acpi_madt_entry_id id,
   6.453 +		      acpi_madt_entry_handler handler, unsigned int max_entries)
   6.454  {
   6.455 -	return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt),
   6.456 -					    id, handler, max_entries);
   6.457 +	return acpi_table_parse_madt_family(ACPI_APIC,
   6.458 +					    sizeof(struct acpi_table_madt), id,
   6.459 +					    handler, max_entries);
   6.460  }
   6.461  
   6.462 -
   6.463 -int __init
   6.464 -acpi_table_parse (
   6.465 -	enum acpi_table_id	id,
   6.466 -	acpi_table_handler	handler)
   6.467 +int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler)
   6.468  {
   6.469 -	int			count = 0;
   6.470 -	unsigned int		i = 0;
   6.471 +	int count = 0;
   6.472 +	unsigned int i = 0;
   6.473  
   6.474  	if (!handler)
   6.475  		return -EINVAL;
   6.476 @@ -392,20 +393,18 @@ acpi_table_parse (
   6.477  			handler(sdt_entry[i].pa, sdt_entry[i].size);
   6.478  
   6.479  		else
   6.480 -			printk(KERN_WARNING PREFIX "%d duplicate %s table ignored.\n",
   6.481 -				count, acpi_table_signatures[id]);
   6.482 +			printk(KERN_WARNING PREFIX
   6.483 +			       "%d duplicate %s table ignored.\n", count,
   6.484 +			       acpi_table_signatures[id]);
   6.485  	}
   6.486  
   6.487  	return count;
   6.488  }
   6.489  
   6.490 -
   6.491 -static int __init
   6.492 -acpi_table_get_sdt (
   6.493 -	struct acpi_table_rsdp	*rsdp)
   6.494 +static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)
   6.495  {
   6.496  	struct acpi_table_header *header = NULL;
   6.497 -	unsigned int		i, id = 0;
   6.498 +	unsigned int i, id = 0;
   6.499  
   6.500  	if (!rsdp)
   6.501  		return -EINVAL;
   6.502 @@ -413,24 +412,25 @@ acpi_table_get_sdt (
   6.503  	/* First check XSDT (but only on ACPI 2.0-compatible systems) */
   6.504  
   6.505  	if ((rsdp->revision >= 2) &&
   6.506 -		(((struct acpi20_table_rsdp*)rsdp)->xsdt_address)) {
   6.507 -			
   6.508 -		struct acpi_table_xsdt	*mapped_xsdt = NULL;
   6.509 +	    (((struct acpi20_table_rsdp *)rsdp)->xsdt_address)) {
   6.510  
   6.511 -		sdt_pa = ((struct acpi20_table_rsdp*)rsdp)->xsdt_address;
   6.512 +		struct acpi_table_xsdt *mapped_xsdt = NULL;
   6.513 +
   6.514 +		sdt_pa = ((struct acpi20_table_rsdp *)rsdp)->xsdt_address;
   6.515  
   6.516  		/* map in just the header */
   6.517  		header = (struct acpi_table_header *)
   6.518 -			__acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
   6.519 +		    __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
   6.520  
   6.521  		if (!header) {
   6.522 -			printk(KERN_WARNING PREFIX "Unable to map XSDT header\n");
   6.523 +			printk(KERN_WARNING PREFIX
   6.524 +			       "Unable to map XSDT header\n");
   6.525  			return -ENODEV;
   6.526  		}
   6.527  
   6.528  		/* remap in the entire table before processing */
   6.529  		mapped_xsdt = (struct acpi_table_xsdt *)
   6.530 -			__acpi_map_table(sdt_pa, header->length);
   6.531 +		    __acpi_map_table(sdt_pa, header->length);
   6.532  		if (!mapped_xsdt) {
   6.533  			printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
   6.534  			return -ENODEV;
   6.535 @@ -438,7 +438,8 @@ acpi_table_get_sdt (
   6.536  		header = &mapped_xsdt->header;
   6.537  
   6.538  		if (strncmp(header->signature, "XSDT", 4)) {
   6.539 -			printk(KERN_WARNING PREFIX "XSDT signature incorrect\n");
   6.540 +			printk(KERN_WARNING PREFIX
   6.541 +			       "XSDT signature incorrect\n");
   6.542  			return -ENODEV;
   6.543  		}
   6.544  
   6.545 @@ -447,36 +448,39 @@ acpi_table_get_sdt (
   6.546  			return -ENODEV;
   6.547  		}
   6.548  
   6.549 -		sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 3;
   6.550 +		sdt_count =
   6.551 +		    (header->length - sizeof(struct acpi_table_header)) >> 3;
   6.552  		if (sdt_count > ACPI_MAX_TABLES) {
   6.553 -			printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n",
   6.554 -				(sdt_count - ACPI_MAX_TABLES));
   6.555 +			printk(KERN_WARNING PREFIX
   6.556 +			       "Truncated %lu XSDT entries\n",
   6.557 +			       (sdt_count - ACPI_MAX_TABLES));
   6.558  			sdt_count = ACPI_MAX_TABLES;
   6.559  		}
   6.560  
   6.561  		for (i = 0; i < sdt_count; i++)
   6.562 -			sdt_entry[i].pa = (unsigned long) mapped_xsdt->entry[i];
   6.563 +			sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i];
   6.564  	}
   6.565  
   6.566  	/* Then check RSDT */
   6.567  
   6.568  	else if (rsdp->rsdt_address) {
   6.569  
   6.570 -		struct acpi_table_rsdt	*mapped_rsdt = NULL;
   6.571 +		struct acpi_table_rsdt *mapped_rsdt = NULL;
   6.572  
   6.573  		sdt_pa = rsdp->rsdt_address;
   6.574  
   6.575  		/* map in just the header */
   6.576  		header = (struct acpi_table_header *)
   6.577 -			__acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
   6.578 +		    __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
   6.579  		if (!header) {
   6.580 -			printk(KERN_WARNING PREFIX "Unable to map RSDT header\n");
   6.581 +			printk(KERN_WARNING PREFIX
   6.582 +			       "Unable to map RSDT header\n");
   6.583  			return -ENODEV;
   6.584  		}
   6.585  
   6.586  		/* remap in the entire table before processing */
   6.587  		mapped_rsdt = (struct acpi_table_rsdt *)
   6.588 -			__acpi_map_table(sdt_pa, header->length);
   6.589 +		    __acpi_map_table(sdt_pa, header->length);
   6.590  		if (!mapped_rsdt) {
   6.591  			printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
   6.592  			return -ENODEV;
   6.593 @@ -484,7 +488,8 @@ acpi_table_get_sdt (
   6.594  		header = &mapped_rsdt->header;
   6.595  
   6.596  		if (strncmp(header->signature, "RSDT", 4)) {
   6.597 -			printk(KERN_WARNING PREFIX "RSDT signature incorrect\n");
   6.598 +			printk(KERN_WARNING PREFIX
   6.599 +			       "RSDT signature incorrect\n");
   6.600  			return -ENODEV;
   6.601  		}
   6.602  
   6.603 @@ -493,19 +498,22 @@ acpi_table_get_sdt (
   6.604  			return -ENODEV;
   6.605  		}
   6.606  
   6.607 -		sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 2;
   6.608 +		sdt_count =
   6.609 +		    (header->length - sizeof(struct acpi_table_header)) >> 2;
   6.610  		if (sdt_count > ACPI_MAX_TABLES) {
   6.611 -			printk(KERN_WARNING PREFIX "Truncated %lu RSDT entries\n",
   6.612 -				(sdt_count - ACPI_MAX_TABLES));
   6.613 +			printk(KERN_WARNING PREFIX
   6.614 +			       "Truncated %lu RSDT entries\n",
   6.615 +			       (sdt_count - ACPI_MAX_TABLES));
   6.616  			sdt_count = ACPI_MAX_TABLES;
   6.617  		}
   6.618  
   6.619  		for (i = 0; i < sdt_count; i++)
   6.620 -			sdt_entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
   6.621 +			sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i];
   6.622  	}
   6.623  
   6.624  	else {
   6.625 -		printk(KERN_WARNING PREFIX "No System Description Table (RSDT/XSDT) specified in RSDP\n");
   6.626 +		printk(KERN_WARNING PREFIX
   6.627 +		       "No System Description Table (RSDT/XSDT) specified in RSDP\n");
   6.628  		return -ENODEV;
   6.629  	}
   6.630  
   6.631 @@ -515,18 +523,17 @@ acpi_table_get_sdt (
   6.632  
   6.633  		/* map in just the header */
   6.634  		header = (struct acpi_table_header *)
   6.635 -			__acpi_map_table(sdt_entry[i].pa,
   6.636 -				sizeof(struct acpi_table_header));
   6.637 +		    __acpi_map_table(sdt_entry[i].pa,
   6.638 +				     sizeof(struct acpi_table_header));
   6.639  		if (!header)
   6.640  			continue;
   6.641  
   6.642  		/* remap in the entire table before processing */
   6.643  		header = (struct acpi_table_header *)
   6.644 -			__acpi_map_table(sdt_entry[i].pa,
   6.645 -				header->length);
   6.646 +		    __acpi_map_table(sdt_entry[i].pa, header->length);
   6.647  		if (!header)
   6.648  			continue;
   6.649 -	               
   6.650 +
   6.651  		acpi_table_print(header, sdt_entry[i].pa);
   6.652  
   6.653  		if (acpi_table_compute_checksum(header, header->length)) {
   6.654 @@ -537,9 +544,9 @@ acpi_table_get_sdt (
   6.655  		sdt_entry[i].size = header->length;
   6.656  
   6.657  		for (id = 0; id < ACPI_TABLE_COUNT; id++) {
   6.658 -			if (!strncmp((char *) &header->signature,
   6.659 -				acpi_table_signatures[id],
   6.660 -				sizeof(header->signature))) {
   6.661 +			if (!strncmp((char *)&header->signature,
   6.662 +				     acpi_table_signatures[id],
   6.663 +				     sizeof(header->signature))) {
   6.664  				sdt_entry[i].id = id;
   6.665  			}
   6.666  		}
   6.667 @@ -551,7 +558,7 @@ acpi_table_get_sdt (
   6.668  	 * against. Unfortunately, we don't know the phys_addr, so just
   6.669  	 * print 0. Maybe no one will notice.
   6.670  	 */
   6.671 -	if(!acpi_get_table_header_early(ACPI_DSDT, &header))
   6.672 +	if (!acpi_get_table_header_early(ACPI_DSDT, &header))
   6.673  		acpi_table_print(header, 0);
   6.674  
   6.675  	return 0;
   6.676 @@ -566,12 +573,11 @@ acpi_table_get_sdt (
   6.677   * result: sdt_entry[] is initialized
   6.678   */
   6.679  
   6.680 -int __init
   6.681 -acpi_table_init (void)
   6.682 +int __init acpi_table_init(void)
   6.683  {
   6.684 -	struct acpi_table_rsdp	*rsdp = NULL;
   6.685 -	unsigned long		rsdp_phys = 0;
   6.686 -	int			result = 0;
   6.687 +	struct acpi_table_rsdp *rsdp = NULL;
   6.688 +	unsigned long rsdp_phys = 0;
   6.689 +	int result = 0;
   6.690  
   6.691  	/* Locate and map the Root System Description Table (RSDP) */
   6.692  
   6.693 @@ -581,19 +587,26 @@ acpi_table_init (void)
   6.694  		return -ENODEV;
   6.695  	}
   6.696  
   6.697 -	rsdp = (struct acpi_table_rsdp *) __va(rsdp_phys);
   6.698 +	rsdp = (struct acpi_table_rsdp *)__acpi_map_table(rsdp_phys,
   6.699 +		sizeof(struct acpi_table_rsdp));
   6.700  	if (!rsdp) {
   6.701  		printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
   6.702  		return -ENODEV;
   6.703  	}
   6.704  
   6.705 -	printk(KERN_DEBUG PREFIX "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
   6.706 -		rsdp->revision, rsdp->oem_id, (void *) rsdp_phys);
   6.707 +	printk(KERN_DEBUG PREFIX
   6.708 +	       "RSDP (v%3.3d %6.6s                                ) @ 0x%p\n",
   6.709 +	       rsdp->revision, rsdp->oem_id, (void *)rsdp_phys);
   6.710  
   6.711  	if (rsdp->revision < 2)
   6.712 -		result = acpi_table_compute_checksum(rsdp, sizeof(struct acpi_table_rsdp));
   6.713 +		result =
   6.714 +		    acpi_table_compute_checksum(rsdp,
   6.715 +						sizeof(struct acpi_table_rsdp));
   6.716  	else
   6.717 -		result = acpi_table_compute_checksum(rsdp, ((struct acpi20_table_rsdp *)rsdp)->length);
   6.718 +		result =
   6.719 +		    acpi_table_compute_checksum(rsdp,
   6.720 +						((struct acpi20_table_rsdp *)
   6.721 +						 rsdp)->length);
   6.722  
   6.723  	if (result) {
   6.724  		printk(KERN_WARNING "  >>> ERROR: Invalid checksum\n");
     7.1 --- a/xen/include/asm-x86/apicdef.h	Tue Sep 19 14:26:47 2006 +0100
     7.2 +++ b/xen/include/asm-x86/apicdef.h	Tue Sep 19 16:33:01 2006 +0100
     7.3 @@ -40,6 +40,7 @@
     7.4  #define			APIC_SPIV_FOCUS_DISABLED	(1<<9)
     7.5  #define			APIC_SPIV_APIC_ENABLED		(1<<8)
     7.6  #define		APIC_ISR	0x100
     7.7 +#define         APIC_ISR_NR     0x8     /* Number of 32 bit ISR registers. */
     7.8  #define		APIC_TMR	0x180
     7.9  #define 	APIC_IRR	0x200
    7.10  #define 	APIC_ESR	0x280
     8.1 --- a/xen/include/asm-x86/io_apic.h	Tue Sep 19 14:26:47 2006 +0100
     8.2 +++ b/xen/include/asm-x86/io_apic.h	Tue Sep 19 16:33:01 2006 +0100
     8.3 @@ -165,6 +165,7 @@ extern int io_apic_get_unique_id (int io
     8.4  extern int io_apic_get_version (int ioapic);
     8.5  extern int io_apic_get_redir_entries (int ioapic);
     8.6  extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low);
     8.7 +extern int timer_uses_ioapic_pin_0;
     8.8  #endif /*CONFIG_ACPI_BOOT*/
     8.9  
    8.10  extern int (*ioapic_renumber_irq)(int ioapic, int irq);