aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/Kconfig16
-rw-r--r--arch/ia64/hp/common/sba_iommu.c13
-rw-r--r--arch/ia64/hp/sim/simeth.c5
-rw-r--r--arch/ia64/hp/sim/simscsi.c1
-rw-r--r--arch/ia64/ia32/binfmt_elf32.c31
-rw-r--r--arch/ia64/ia32/ia32_support.c5
-rw-r--r--arch/ia64/kernel/acpi.c26
-rw-r--r--arch/ia64/kernel/efi.c502
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/fsyscall_gtod_data.h4
-rw-r--r--arch/ia64/kernel/head.S1
-rw-r--r--arch/ia64/kernel/ia64_ksyms.c3
-rw-r--r--arch/ia64/kernel/irq_ia64.c4
-rw-r--r--arch/ia64/kernel/kprobes.c7
-rw-r--r--arch/ia64/kernel/mca.c99
-rw-r--r--arch/ia64/kernel/mca_asm.S46
-rw-r--r--arch/ia64/kernel/mca_drv.c2
-rw-r--r--arch/ia64/kernel/mca_drv.h2
-rw-r--r--arch/ia64/kernel/mca_drv_asm.S2
-rw-r--r--arch/ia64/kernel/module.c11
-rw-r--r--arch/ia64/kernel/perfmon.c10
-rw-r--r--arch/ia64/kernel/process.c7
-rw-r--r--arch/ia64/kernel/sal.c14
-rw-r--r--arch/ia64/kernel/setup.c6
-rw-r--r--arch/ia64/kernel/signal.c10
-rw-r--r--arch/ia64/kernel/smpboot.c14
-rw-r--r--arch/ia64/kernel/time.c27
-rw-r--r--arch/ia64/kernel/topology.c26
-rw-r--r--arch/ia64/kernel/traps.c35
-rw-r--r--arch/ia64/kernel/unaligned.c24
-rw-r--r--arch/ia64/kernel/uncached.c2
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S8
-rw-r--r--arch/ia64/mm/fault.c8
-rw-r--r--arch/ia64/mm/tlb.c18
-rw-r--r--arch/ia64/sn/kernel/bte.c4
-rw-r--r--arch/ia64/sn/kernel/bte_error.c8
-rw-r--r--arch/ia64/sn/kernel/setup.c11
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c2
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c11
-rw-r--r--arch/ia64/sn/kernel/xp_nofault.S10
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c6
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c2
42 files changed, 564 insertions, 481 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index bef47725d4ad..b0de1132dfc0 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -15,6 +15,8 @@ config IA64
15 select ACPI if (!IA64_HP_SIM) 15 select ACPI if (!IA64_HP_SIM)
16 select PM if (!IA64_HP_SIM) 16 select PM if (!IA64_HP_SIM)
17 select ARCH_SUPPORTS_MSI 17 select ARCH_SUPPORTS_MSI
18 select HAVE_OPROFILE
19 select HAVE_KPROBES
18 default y 20 default y
19 help 21 help
20 The Itanium Processor Family is Intel's 64-bit successor to 22 The Itanium Processor Family is Intel's 64-bit successor to
@@ -42,6 +44,11 @@ config MMU
42config SWIOTLB 44config SWIOTLB
43 bool 45 bool
44 46
47config GENERIC_LOCKBREAK
48 bool
49 default y
50 depends on SMP && PREEMPT
51
45config RWSEM_XCHGADD_ALGORITHM 52config RWSEM_XCHGADD_ALGORITHM
46 bool 53 bool
47 default y 54 default y
@@ -75,6 +82,9 @@ config GENERIC_TIME_VSYSCALL
75 bool 82 bool
76 default y 83 default y
77 84
85config HAVE_SETUP_PER_CPU_AREA
86 def_bool y
87
78config DMI 88config DMI
79 bool 89 bool
80 default y 90 default y
@@ -275,8 +285,8 @@ config SMP
275 single processor systems. On a single processor system, the kernel 285 single processor systems. On a single processor system, the kernel
276 will run faster if you say N here. 286 will run faster if you say N here.
277 287
278 See also the <file:Documentation/smp.txt> and the SMP-HOWTO 288 See also the SMP-HOWTO available at
279 available at <http://www.tldp.org/docs.html#howto>. 289 <http://www.tldp.org/docs.html#howto>.
280 290
281 If you don't know what to do here, say N. 291 If you don't know what to do here, say N.
282 292
@@ -592,8 +602,6 @@ config IRQ_PER_CPU
592 602
593source "arch/ia64/hp/sim/Kconfig" 603source "arch/ia64/hp/sim/Kconfig"
594 604
595source "kernel/Kconfig.instrumentation"
596
597source "arch/ia64/Kconfig.debug" 605source "arch/ia64/Kconfig.debug"
598 606
599source "security/Kconfig" 607source "security/Kconfig"
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index bc859a311eaf..a94445422cc6 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1265,7 +1265,7 @@ sba_fill_pdir(
1265 * the sglist do both. 1265 * the sglist do both.
1266 */ 1266 */
1267static SBA_INLINE int 1267static SBA_INLINE int
1268sba_coalesce_chunks( struct ioc *ioc, 1268sba_coalesce_chunks(struct ioc *ioc, struct device *dev,
1269 struct scatterlist *startsg, 1269 struct scatterlist *startsg,
1270 int nents) 1270 int nents)
1271{ 1271{
@@ -1275,6 +1275,7 @@ sba_coalesce_chunks( struct ioc *ioc,
1275 struct scatterlist *dma_sg; /* next DMA stream head */ 1275 struct scatterlist *dma_sg; /* next DMA stream head */
1276 unsigned long dma_offset, dma_len; /* start/len of DMA stream */ 1276 unsigned long dma_offset, dma_len; /* start/len of DMA stream */
1277 int n_mappings = 0; 1277 int n_mappings = 0;
1278 unsigned int max_seg_size = dma_get_max_seg_size(dev);
1278 1279
1279 while (nents > 0) { 1280 while (nents > 0) {
1280 unsigned long vaddr = (unsigned long) sba_sg_address(startsg); 1281 unsigned long vaddr = (unsigned long) sba_sg_address(startsg);
@@ -1314,6 +1315,9 @@ sba_coalesce_chunks( struct ioc *ioc,
1314 > DMA_CHUNK_SIZE) 1315 > DMA_CHUNK_SIZE)
1315 break; 1316 break;
1316 1317
1318 if (dma_len + startsg->length > max_seg_size)
1319 break;
1320
1317 /* 1321 /*
1318 ** Then look for virtually contiguous blocks. 1322 ** Then look for virtually contiguous blocks.
1319 ** 1323 **
@@ -1441,7 +1445,7 @@ int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, int di
1441 ** w/o this association, we wouldn't have coherent DMA! 1445 ** w/o this association, we wouldn't have coherent DMA!
1442 ** Access to the virtual address is what forces a two pass algorithm. 1446 ** Access to the virtual address is what forces a two pass algorithm.
1443 */ 1447 */
1444 coalesced = sba_coalesce_chunks(ioc, sglist, nents); 1448 coalesced = sba_coalesce_chunks(ioc, dev, sglist, nents);
1445 1449
1446 /* 1450 /*
1447 ** Program the I/O Pdir 1451 ** Program the I/O Pdir
@@ -1871,7 +1875,7 @@ ioc_show(struct seq_file *s, void *v)
1871 return 0; 1875 return 0;
1872} 1876}
1873 1877
1874static struct seq_operations ioc_seq_ops = { 1878static const struct seq_operations ioc_seq_ops = {
1875 .start = ioc_start, 1879 .start = ioc_start,
1876 .next = ioc_next, 1880 .next = ioc_next,
1877 .stop = ioc_stop, 1881 .stop = ioc_stop,
@@ -2034,7 +2038,8 @@ sba_init(void)
2034 if (!ia64_platform_is("hpzx1") && !ia64_platform_is("hpzx1_swiotlb")) 2038 if (!ia64_platform_is("hpzx1") && !ia64_platform_is("hpzx1_swiotlb"))
2035 return 0; 2039 return 0;
2036 2040
2037#if defined(CONFIG_IA64_GENERIC) && defined(CONFIG_CRASH_DUMP) 2041#if defined(CONFIG_IA64_GENERIC) && defined(CONFIG_CRASH_DUMP) && \
2042 defined(CONFIG_PROC_FS)
2038 /* If we are booting a kdump kernel, the sba_iommu will 2043 /* If we are booting a kdump kernel, the sba_iommu will
2039 * cause devices that were not shutdown properly to MCA 2044 * cause devices that were not shutdown properly to MCA
2040 * as soon as they are turned back on. Our only option for 2045 * as soon as they are turned back on. Our only option for
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
index 08b117e2c54b..9898febf609a 100644
--- a/arch/ia64/hp/sim/simeth.c
+++ b/arch/ia64/hp/sim/simeth.c
@@ -497,11 +497,6 @@ simeth_interrupt(int irq, void *dev_id)
497{ 497{
498 struct net_device *dev = dev_id; 498 struct net_device *dev = dev_id;
499 499
500 if ( dev == NULL ) {
501 printk(KERN_WARNING "simeth: irq %d for unknown device\n", irq);
502 return IRQ_NONE;
503 }
504
505 /* 500 /*
506 * very simple loop because we get interrupts only when receiving 501 * very simple loop because we get interrupts only when receiving
507 */ 502 */
diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index 6ef9b5219930..7661bb065fa5 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -360,7 +360,6 @@ static struct scsi_host_template driver_template = {
360 .max_sectors = 1024, 360 .max_sectors = 1024,
361 .cmd_per_lun = SIMSCSI_REQ_QUEUE_LEN, 361 .cmd_per_lun = SIMSCSI_REQ_QUEUE_LEN,
362 .use_clustering = DISABLE_CLUSTERING, 362 .use_clustering = DISABLE_CLUSTERING,
363 .use_sg_chaining = ENABLE_SG_CHAINING,
364}; 363};
365 364
366static int __init 365static int __init
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
index f6ae3ec93810..4f0c30c38e99 100644
--- a/arch/ia64/ia32/binfmt_elf32.c
+++ b/arch/ia64/ia32/binfmt_elf32.c
@@ -52,33 +52,29 @@ extern struct page *ia32_shared_page[];
52extern unsigned long *ia32_gdt; 52extern unsigned long *ia32_gdt;
53extern struct page *ia32_gate_page; 53extern struct page *ia32_gate_page;
54 54
55struct page * 55int
56ia32_install_shared_page (struct vm_area_struct *vma, unsigned long address, int *type) 56ia32_install_shared_page (struct vm_area_struct *vma, struct vm_fault *vmf)
57{ 57{
58 struct page *pg = ia32_shared_page[smp_processor_id()]; 58 vmf->page = ia32_shared_page[smp_processor_id()];
59 get_page(pg); 59 get_page(vmf->page);
60 if (type) 60 return 0;
61 *type = VM_FAULT_MINOR;
62 return pg;
63} 61}
64 62
65struct page * 63int
66ia32_install_gate_page (struct vm_area_struct *vma, unsigned long address, int *type) 64ia32_install_gate_page (struct vm_area_struct *vma, struct vm_fault *vmf)
67{ 65{
68 struct page *pg = ia32_gate_page; 66 vmf->page = ia32_gate_page;
69 get_page(pg); 67 get_page(vmf->page);
70 if (type) 68 return 0;
71 *type = VM_FAULT_MINOR;
72 return pg;
73} 69}
74 70
75 71
76static struct vm_operations_struct ia32_shared_page_vm_ops = { 72static struct vm_operations_struct ia32_shared_page_vm_ops = {
77 .nopage = ia32_install_shared_page 73 .fault = ia32_install_shared_page
78}; 74};
79 75
80static struct vm_operations_struct ia32_gate_page_vm_ops = { 76static struct vm_operations_struct ia32_gate_page_vm_ops = {
81 .nopage = ia32_install_gate_page 77 .fault = ia32_install_gate_page
82}; 78};
83 79
84void 80void
@@ -226,7 +222,8 @@ elf32_set_personality (void)
226} 222}
227 223
228static unsigned long 224static unsigned long
229elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type) 225elf32_map(struct file *filep, unsigned long addr, struct elf_phdr *eppnt,
226 int prot, int type, unsigned long unused)
230{ 227{
231 unsigned long pgoff = (eppnt->p_vaddr) & ~IA32_PAGE_MASK; 228 unsigned long pgoff = (eppnt->p_vaddr) & ~IA32_PAGE_MASK;
232 229
diff --git a/arch/ia64/ia32/ia32_support.c b/arch/ia64/ia32/ia32_support.c
index d1d50cd1c38a..896b1ebbfb26 100644
--- a/arch/ia64/ia32/ia32_support.c
+++ b/arch/ia64/ia32/ia32_support.c
@@ -27,7 +27,7 @@
27 27
28#include "ia32priv.h" 28#include "ia32priv.h"
29 29
30extern void die_if_kernel (char *str, struct pt_regs *regs, long err); 30extern int die_if_kernel (char *str, struct pt_regs *regs, long err);
31 31
32struct exec_domain ia32_exec_domain; 32struct exec_domain ia32_exec_domain;
33struct page *ia32_shared_page[NR_CPUS]; 33struct page *ia32_shared_page[NR_CPUS];
@@ -217,7 +217,8 @@ ia32_bad_interrupt (unsigned long int_num, struct pt_regs *regs)
217{ 217{
218 siginfo_t siginfo; 218 siginfo_t siginfo;
219 219
220 die_if_kernel("Bad IA-32 interrupt", regs, int_num); 220 if (die_if_kernel("Bad IA-32 interrupt", regs, int_num))
221 return;
221 222
222 siginfo.si_signo = SIGTRAP; 223 siginfo.si_signo = SIGTRAP;
223 siginfo.si_errno = int_num; /* XXX is it OK to abuse si_errno like this? */ 224 siginfo.si_errno = int_num; /* XXX is it OK to abuse si_errno like this? */
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index f932c486836a..90680255032e 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -69,6 +69,20 @@ unsigned int acpi_cpei_phys_cpuid;
69 69
70unsigned long acpi_wakeup_address = 0; 70unsigned long acpi_wakeup_address = 0;
71 71
72#ifdef CONFIG_IA64_GENERIC
73static unsigned long __init acpi_find_rsdp(void)
74{
75 unsigned long rsdp_phys = 0;
76
77 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
78 rsdp_phys = efi.acpi20;
79 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
80 printk(KERN_WARNING PREFIX
81 "v1.0/r0.71 tables no longer supported\n");
82 return rsdp_phys;
83}
84#endif
85
72const char __init * 86const char __init *
73acpi_get_sysname(void) 87acpi_get_sysname(void)
74{ 88{
@@ -631,18 +645,6 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
631 return 0; 645 return 0;
632} 646}
633 647
634unsigned long __init acpi_find_rsdp(void)
635{
636 unsigned long rsdp_phys = 0;
637
638 if (efi.acpi20 != EFI_INVALID_TABLE_ADDR)
639 rsdp_phys = efi.acpi20;
640 else if (efi.acpi != EFI_INVALID_TABLE_ADDR)
641 printk(KERN_WARNING PREFIX
642 "v1.0/r0.71 tables no longer supported\n");
643 return rsdp_phys;
644}
645
646int __init acpi_boot_init(void) 648int __init acpi_boot_init(void)
647{ 649{
648 650
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 242d79341120..919070a9aed7 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -1,7 +1,8 @@
1/* 1/*
2 * Extensible Firmware Interface 2 * Extensible Firmware Interface
3 * 3 *
4 * Based on Extensible Firmware Interface Specification version 0.9 April 30, 1999 4 * Based on Extensible Firmware Interface Specification version 0.9
5 * April 30, 1999
5 * 6 *
6 * Copyright (C) 1999 VA Linux Systems 7 * Copyright (C) 1999 VA Linux Systems
7 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> 8 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
@@ -48,145 +49,157 @@ static unsigned long mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;
48 49
49#define efi_call_virt(f, args...) (*(f))(args) 50#define efi_call_virt(f, args...) (*(f))(args)
50 51
51#define STUB_GET_TIME(prefix, adjust_arg) \ 52#define STUB_GET_TIME(prefix, adjust_arg) \
52static efi_status_t \ 53static efi_status_t \
53prefix##_get_time (efi_time_t *tm, efi_time_cap_t *tc) \ 54prefix##_get_time (efi_time_t *tm, efi_time_cap_t *tc) \
54{ \ 55{ \
55 struct ia64_fpreg fr[6]; \ 56 struct ia64_fpreg fr[6]; \
56 efi_time_cap_t *atc = NULL; \ 57 efi_time_cap_t *atc = NULL; \
57 efi_status_t ret; \ 58 efi_status_t ret; \
58 \ 59 \
59 if (tc) \ 60 if (tc) \
60 atc = adjust_arg(tc); \ 61 atc = adjust_arg(tc); \
61 ia64_save_scratch_fpregs(fr); \ 62 ia64_save_scratch_fpregs(fr); \
62 ret = efi_call_##prefix((efi_get_time_t *) __va(runtime->get_time), adjust_arg(tm), atc); \ 63 ret = efi_call_##prefix((efi_get_time_t *) __va(runtime->get_time), \
63 ia64_load_scratch_fpregs(fr); \ 64 adjust_arg(tm), atc); \
64 return ret; \ 65 ia64_load_scratch_fpregs(fr); \
66 return ret; \
65} 67}
66 68
67#define STUB_SET_TIME(prefix, adjust_arg) \ 69#define STUB_SET_TIME(prefix, adjust_arg) \
68static efi_status_t \ 70static efi_status_t \
69prefix##_set_time (efi_time_t *tm) \ 71prefix##_set_time (efi_time_t *tm) \
70{ \ 72{ \
71 struct ia64_fpreg fr[6]; \ 73 struct ia64_fpreg fr[6]; \
72 efi_status_t ret; \ 74 efi_status_t ret; \
73 \ 75 \
74 ia64_save_scratch_fpregs(fr); \ 76 ia64_save_scratch_fpregs(fr); \
75 ret = efi_call_##prefix((efi_set_time_t *) __va(runtime->set_time), adjust_arg(tm)); \ 77 ret = efi_call_##prefix((efi_set_time_t *) __va(runtime->set_time), \
76 ia64_load_scratch_fpregs(fr); \ 78 adjust_arg(tm)); \
77 return ret; \ 79 ia64_load_scratch_fpregs(fr); \
80 return ret; \
78} 81}
79 82
80#define STUB_GET_WAKEUP_TIME(prefix, adjust_arg) \ 83#define STUB_GET_WAKEUP_TIME(prefix, adjust_arg) \
81static efi_status_t \ 84static efi_status_t \
82prefix##_get_wakeup_time (efi_bool_t *enabled, efi_bool_t *pending, efi_time_t *tm) \ 85prefix##_get_wakeup_time (efi_bool_t *enabled, efi_bool_t *pending, \
83{ \ 86 efi_time_t *tm) \
84 struct ia64_fpreg fr[6]; \ 87{ \
85 efi_status_t ret; \ 88 struct ia64_fpreg fr[6]; \
86 \ 89 efi_status_t ret; \
87 ia64_save_scratch_fpregs(fr); \ 90 \
88 ret = efi_call_##prefix((efi_get_wakeup_time_t *) __va(runtime->get_wakeup_time), \ 91 ia64_save_scratch_fpregs(fr); \
89 adjust_arg(enabled), adjust_arg(pending), adjust_arg(tm)); \ 92 ret = efi_call_##prefix( \
90 ia64_load_scratch_fpregs(fr); \ 93 (efi_get_wakeup_time_t *) __va(runtime->get_wakeup_time), \
91 return ret; \ 94 adjust_arg(enabled), adjust_arg(pending), adjust_arg(tm)); \
95 ia64_load_scratch_fpregs(fr); \
96 return ret; \
92} 97}
93 98
94#define STUB_SET_WAKEUP_TIME(prefix, adjust_arg) \ 99#define STUB_SET_WAKEUP_TIME(prefix, adjust_arg) \
95static efi_status_t \ 100static efi_status_t \
96prefix##_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm) \ 101prefix##_set_wakeup_time (efi_bool_t enabled, efi_time_t *tm) \
97{ \ 102{ \
98 struct ia64_fpreg fr[6]; \ 103 struct ia64_fpreg fr[6]; \
99 efi_time_t *atm = NULL; \ 104 efi_time_t *atm = NULL; \
100 efi_status_t ret; \ 105 efi_status_t ret; \
101 \ 106 \
102 if (tm) \ 107 if (tm) \
103 atm = adjust_arg(tm); \ 108 atm = adjust_arg(tm); \
104 ia64_save_scratch_fpregs(fr); \ 109 ia64_save_scratch_fpregs(fr); \
105 ret = efi_call_##prefix((efi_set_wakeup_time_t *) __va(runtime->set_wakeup_time), \ 110 ret = efi_call_##prefix( \
106 enabled, atm); \ 111 (efi_set_wakeup_time_t *) __va(runtime->set_wakeup_time), \
107 ia64_load_scratch_fpregs(fr); \ 112 enabled, atm); \
108 return ret; \ 113 ia64_load_scratch_fpregs(fr); \
114 return ret; \
109} 115}
110 116
111#define STUB_GET_VARIABLE(prefix, adjust_arg) \ 117#define STUB_GET_VARIABLE(prefix, adjust_arg) \
112static efi_status_t \ 118static efi_status_t \
113prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, \ 119prefix##_get_variable (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, \
114 unsigned long *data_size, void *data) \ 120 unsigned long *data_size, void *data) \
115{ \ 121{ \
116 struct ia64_fpreg fr[6]; \ 122 struct ia64_fpreg fr[6]; \
117 u32 *aattr = NULL; \ 123 u32 *aattr = NULL; \
118 efi_status_t ret; \ 124 efi_status_t ret; \
119 \ 125 \
120 if (attr) \ 126 if (attr) \
121 aattr = adjust_arg(attr); \ 127 aattr = adjust_arg(attr); \
122 ia64_save_scratch_fpregs(fr); \ 128 ia64_save_scratch_fpregs(fr); \
123 ret = efi_call_##prefix((efi_get_variable_t *) __va(runtime->get_variable), \ 129 ret = efi_call_##prefix( \
124 adjust_arg(name), adjust_arg(vendor), aattr, \ 130 (efi_get_variable_t *) __va(runtime->get_variable), \
125 adjust_arg(data_size), adjust_arg(data)); \ 131 adjust_arg(name), adjust_arg(vendor), aattr, \
126 ia64_load_scratch_fpregs(fr); \ 132 adjust_arg(data_size), adjust_arg(data)); \
127 return ret; \ 133 ia64_load_scratch_fpregs(fr); \
134 return ret; \
128} 135}
129 136
130#define STUB_GET_NEXT_VARIABLE(prefix, adjust_arg) \ 137#define STUB_GET_NEXT_VARIABLE(prefix, adjust_arg) \
131static efi_status_t \ 138static efi_status_t \
132prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, efi_guid_t *vendor) \ 139prefix##_get_next_variable (unsigned long *name_size, efi_char16_t *name, \
133{ \ 140 efi_guid_t *vendor) \
134 struct ia64_fpreg fr[6]; \ 141{ \
135 efi_status_t ret; \ 142 struct ia64_fpreg fr[6]; \
136 \ 143 efi_status_t ret; \
137 ia64_save_scratch_fpregs(fr); \ 144 \
138 ret = efi_call_##prefix((efi_get_next_variable_t *) __va(runtime->get_next_variable), \ 145 ia64_save_scratch_fpregs(fr); \
139 adjust_arg(name_size), adjust_arg(name), adjust_arg(vendor)); \ 146 ret = efi_call_##prefix( \
140 ia64_load_scratch_fpregs(fr); \ 147 (efi_get_next_variable_t *) __va(runtime->get_next_variable), \
141 return ret; \ 148 adjust_arg(name_size), adjust_arg(name), adjust_arg(vendor)); \
149 ia64_load_scratch_fpregs(fr); \
150 return ret; \
142} 151}
143 152
144#define STUB_SET_VARIABLE(prefix, adjust_arg) \ 153#define STUB_SET_VARIABLE(prefix, adjust_arg) \
145static efi_status_t \ 154static efi_status_t \
146prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, unsigned long attr, \ 155prefix##_set_variable (efi_char16_t *name, efi_guid_t *vendor, \
147 unsigned long data_size, void *data) \ 156 unsigned long attr, unsigned long data_size, \
148{ \ 157 void *data) \
149 struct ia64_fpreg fr[6]; \ 158{ \
150 efi_status_t ret; \ 159 struct ia64_fpreg fr[6]; \
151 \ 160 efi_status_t ret; \
152 ia64_save_scratch_fpregs(fr); \ 161 \
153 ret = efi_call_##prefix((efi_set_variable_t *) __va(runtime->set_variable), \ 162 ia64_save_scratch_fpregs(fr); \
154 adjust_arg(name), adjust_arg(vendor), attr, data_size, \ 163 ret = efi_call_##prefix( \
155 adjust_arg(data)); \ 164 (efi_set_variable_t *) __va(runtime->set_variable), \
156 ia64_load_scratch_fpregs(fr); \ 165 adjust_arg(name), adjust_arg(vendor), attr, data_size, \
157 return ret; \ 166 adjust_arg(data)); \
167 ia64_load_scratch_fpregs(fr); \
168 return ret; \
158} 169}
159 170
160#define STUB_GET_NEXT_HIGH_MONO_COUNT(prefix, adjust_arg) \ 171#define STUB_GET_NEXT_HIGH_MONO_COUNT(prefix, adjust_arg) \
161static efi_status_t \ 172static efi_status_t \
162prefix##_get_next_high_mono_count (u32 *count) \ 173prefix##_get_next_high_mono_count (u32 *count) \
163{ \ 174{ \
164 struct ia64_fpreg fr[6]; \ 175 struct ia64_fpreg fr[6]; \
165 efi_status_t ret; \ 176 efi_status_t ret; \
166 \ 177 \
167 ia64_save_scratch_fpregs(fr); \ 178 ia64_save_scratch_fpregs(fr); \
168 ret = efi_call_##prefix((efi_get_next_high_mono_count_t *) \ 179 ret = efi_call_##prefix((efi_get_next_high_mono_count_t *) \
169 __va(runtime->get_next_high_mono_count), adjust_arg(count)); \ 180 __va(runtime->get_next_high_mono_count), \
170 ia64_load_scratch_fpregs(fr); \ 181 adjust_arg(count)); \
171 return ret; \ 182 ia64_load_scratch_fpregs(fr); \
183 return ret; \
172} 184}
173 185
174#define STUB_RESET_SYSTEM(prefix, adjust_arg) \ 186#define STUB_RESET_SYSTEM(prefix, adjust_arg) \
175static void \ 187static void \
176prefix##_reset_system (int reset_type, efi_status_t status, \ 188prefix##_reset_system (int reset_type, efi_status_t status, \
177 unsigned long data_size, efi_char16_t *data) \ 189 unsigned long data_size, efi_char16_t *data) \
178{ \ 190{ \
179 struct ia64_fpreg fr[6]; \ 191 struct ia64_fpreg fr[6]; \
180 efi_char16_t *adata = NULL; \ 192 efi_char16_t *adata = NULL; \
181 \ 193 \
182 if (data) \ 194 if (data) \
183 adata = adjust_arg(data); \ 195 adata = adjust_arg(data); \
184 \ 196 \
185 ia64_save_scratch_fpregs(fr); \ 197 ia64_save_scratch_fpregs(fr); \
186 efi_call_##prefix((efi_reset_system_t *) __va(runtime->reset_system), \ 198 efi_call_##prefix( \
187 reset_type, status, data_size, adata); \ 199 (efi_reset_system_t *) __va(runtime->reset_system), \
188 /* should not return, but just in case... */ \ 200 reset_type, status, data_size, adata); \
189 ia64_load_scratch_fpregs(fr); \ 201 /* should not return, but just in case... */ \
202 ia64_load_scratch_fpregs(fr); \
190} 203}
191 204
192#define phys_ptr(arg) ((__typeof__(arg)) ia64_tpa(arg)) 205#define phys_ptr(arg) ((__typeof__(arg)) ia64_tpa(arg))
@@ -223,7 +236,8 @@ efi_gettimeofday (struct timespec *ts)
223 return; 236 return;
224 } 237 }
225 238
226 ts->tv_sec = mktime(tm.year, tm.month, tm.day, tm.hour, tm.minute, tm.second); 239 ts->tv_sec = mktime(tm.year, tm.month, tm.day,
240 tm.hour, tm.minute, tm.second);
227 ts->tv_nsec = tm.nanosecond; 241 ts->tv_nsec = tm.nanosecond;
228} 242}
229 243
@@ -297,8 +311,8 @@ walk (efi_freemem_callback_t callback, void *arg, u64 attr)
297} 311}
298 312
299/* 313/*
300 * Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that 314 * Walk the EFI memory map and call CALLBACK once for each EFI memory
301 * has memory that is available for OS use. 315 * descriptor that has memory that is available for OS use.
302 */ 316 */
303void 317void
304efi_memmap_walk (efi_freemem_callback_t callback, void *arg) 318efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
@@ -307,8 +321,8 @@ efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
307} 321}
308 322
309/* 323/*
310 * Walks the EFI memory map and calls CALLBACK once for each EFI memory descriptor that 324 * Walk the EFI memory map and call CALLBACK once for each EFI memory
311 * has memory that is available for uncached allocator. 325 * descriptor that has memory that is available for uncached allocator.
312 */ 326 */
313void 327void
314efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg) 328efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg)
@@ -317,11 +331,10 @@ efi_memmap_walk_uc (efi_freemem_callback_t callback, void *arg)
317} 331}
318 332
319/* 333/*
320 * Look for the PAL_CODE region reported by EFI and maps it using an 334 * Look for the PAL_CODE region reported by EFI and map it using an
321 * ITR to enable safe PAL calls in virtual mode. See IA-64 Processor 335 * ITR to enable safe PAL calls in virtual mode. See IA-64 Processor
322 * Abstraction Layer chapter 11 in ADAG 336 * Abstraction Layer chapter 11 in ADAG
323 */ 337 */
324
325void * 338void *
326efi_get_pal_addr (void) 339efi_get_pal_addr (void)
327{ 340{
@@ -341,45 +354,47 @@ efi_get_pal_addr (void)
341 continue; 354 continue;
342 355
343 if (++pal_code_count > 1) { 356 if (++pal_code_count > 1) {
344 printk(KERN_ERR "Too many EFI Pal Code memory ranges, dropped @ %lx\n", 357 printk(KERN_ERR "Too many EFI Pal Code memory ranges, "
345 md->phys_addr); 358 "dropped @ %lx\n", md->phys_addr);
346 continue; 359 continue;
347 } 360 }
348 /* 361 /*
349 * The only ITLB entry in region 7 that is used is the one installed by 362 * The only ITLB entry in region 7 that is used is the one
350 * __start(). That entry covers a 64MB range. 363 * installed by __start(). That entry covers a 64MB range.
351 */ 364 */
352 mask = ~((1 << KERNEL_TR_PAGE_SHIFT) - 1); 365 mask = ~((1 << KERNEL_TR_PAGE_SHIFT) - 1);
353 vaddr = PAGE_OFFSET + md->phys_addr; 366 vaddr = PAGE_OFFSET + md->phys_addr;
354 367
355 /* 368 /*
356 * We must check that the PAL mapping won't overlap with the kernel 369 * We must check that the PAL mapping won't overlap with the
357 * mapping. 370 * kernel mapping.
358 * 371 *
359 * PAL code is guaranteed to be aligned on a power of 2 between 4k and 372 * PAL code is guaranteed to be aligned on a power of 2 between
360 * 256KB and that only one ITR is needed to map it. This implies that the 373 * 4k and 256KB and that only one ITR is needed to map it. This
361 * PAL code is always aligned on its size, i.e., the closest matching page 374 * implies that the PAL code is always aligned on its size,
362 * size supported by the TLB. Therefore PAL code is guaranteed never to 375 * i.e., the closest matching page size supported by the TLB.
363 * cross a 64MB unless it is bigger than 64MB (very unlikely!). So for 376 * Therefore PAL code is guaranteed never to cross a 64MB unless
364 * now the following test is enough to determine whether or not we need a 377 * it is bigger than 64MB (very unlikely!). So for now the
365 * dedicated ITR for the PAL code. 378 * following test is enough to determine whether or not we need
379 * a dedicated ITR for the PAL code.
366 */ 380 */
367 if ((vaddr & mask) == (KERNEL_START & mask)) { 381 if ((vaddr & mask) == (KERNEL_START & mask)) {
368 printk(KERN_INFO "%s: no need to install ITR for PAL code\n", 382 printk(KERN_INFO "%s: no need to install ITR for "
369 __FUNCTION__); 383 "PAL code\n", __FUNCTION__);
370 continue; 384 continue;
371 } 385 }
372 386
373 if (efi_md_size(md) > IA64_GRANULE_SIZE) 387 if (efi_md_size(md) > IA64_GRANULE_SIZE)
374 panic("Woah! PAL code size bigger than a granule!"); 388 panic("Whoa! PAL code size bigger than a granule!");
375 389
376#if EFI_DEBUG 390#if EFI_DEBUG
377 mask = ~((1 << IA64_GRANULE_SHIFT) - 1); 391 mask = ~((1 << IA64_GRANULE_SHIFT) - 1);
378 392
379 printk(KERN_INFO "CPU %d: mapping PAL code [0x%lx-0x%lx) into [0x%lx-0x%lx)\n", 393 printk(KERN_INFO "CPU %d: mapping PAL code "
380 smp_processor_id(), md->phys_addr, 394 "[0x%lx-0x%lx) into [0x%lx-0x%lx)\n",
381 md->phys_addr + efi_md_size(md), 395 smp_processor_id(), md->phys_addr,
382 vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE); 396 md->phys_addr + efi_md_size(md),
397 vaddr & mask, (vaddr & mask) + IA64_GRANULE_SIZE);
383#endif 398#endif
384 return __va(md->phys_addr); 399 return __va(md->phys_addr);
385 } 400 }
@@ -401,11 +416,11 @@ efi_map_pal_code (void)
401 * Cannot write to CRx with PSR.ic=1 416 * Cannot write to CRx with PSR.ic=1
402 */ 417 */
403 psr = ia64_clear_ic(); 418 psr = ia64_clear_ic();
404 ia64_itr(0x1, IA64_TR_PALCODE, GRANULEROUNDDOWN((unsigned long) pal_vaddr), 419 ia64_itr(0x1, IA64_TR_PALCODE,
420 GRANULEROUNDDOWN((unsigned long) pal_vaddr),
405 pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)), 421 pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)),
406 IA64_GRANULE_SHIFT); 422 IA64_GRANULE_SHIFT);
407 ia64_set_psr(psr); /* restore psr */ 423 ia64_set_psr(psr); /* restore psr */
408 ia64_srlz_i();
409} 424}
410 425
411void __init 426void __init
@@ -418,7 +433,10 @@ efi_init (void)
418 char *cp, vendor[100] = "unknown"; 433 char *cp, vendor[100] = "unknown";
419 int i; 434 int i;
420 435
421 /* it's too early to be able to use the standard kernel command line support... */ 436 /*
437 * It's too early to be able to use the standard kernel command line
438 * support...
439 */
422 for (cp = boot_command_line; *cp; ) { 440 for (cp = boot_command_line; *cp; ) {
423 if (memcmp(cp, "mem=", 4) == 0) { 441 if (memcmp(cp, "mem=", 4) == 0) {
424 mem_limit = memparse(cp + 4, &cp); 442 mem_limit = memparse(cp + 4, &cp);
@@ -434,9 +452,11 @@ efi_init (void)
434 } 452 }
435 } 453 }
436 if (min_addr != 0UL) 454 if (min_addr != 0UL)
437 printk(KERN_INFO "Ignoring memory below %luMB\n", min_addr >> 20); 455 printk(KERN_INFO "Ignoring memory below %luMB\n",
456 min_addr >> 20);
438 if (max_addr != ~0UL) 457 if (max_addr != ~0UL)
439 printk(KERN_INFO "Ignoring memory above %luMB\n", max_addr >> 20); 458 printk(KERN_INFO "Ignoring memory above %luMB\n",
459 max_addr >> 20);
440 460
441 efi.systab = __va(ia64_boot_param->efi_systab); 461 efi.systab = __va(ia64_boot_param->efi_systab);
442 462
@@ -444,9 +464,9 @@ efi_init (void)
444 * Verify the EFI Table 464 * Verify the EFI Table
445 */ 465 */
446 if (efi.systab == NULL) 466 if (efi.systab == NULL)
447 panic("Woah! Can't find EFI system table.\n"); 467 panic("Whoa! Can't find EFI system table.\n");
448 if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE) 468 if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
449 panic("Woah! EFI system table signature incorrect\n"); 469 panic("Whoa! EFI system table signature incorrect\n");
450 if ((efi.systab->hdr.revision >> 16) == 0) 470 if ((efi.systab->hdr.revision >> 16) == 0)
451 printk(KERN_WARNING "Warning: EFI system table version " 471 printk(KERN_WARNING "Warning: EFI system table version "
452 "%d.%02d, expected 1.00 or greater\n", 472 "%d.%02d, expected 1.00 or greater\n",
@@ -464,7 +484,8 @@ efi_init (void)
464 } 484 }
465 485
466 printk(KERN_INFO "EFI v%u.%.02u by %s:", 486 printk(KERN_INFO "EFI v%u.%.02u by %s:",
467 efi.systab->hdr.revision >> 16, efi.systab->hdr.revision & 0xffff, vendor); 487 efi.systab->hdr.revision >> 16,
488 efi.systab->hdr.revision & 0xffff, vendor);
468 489
469 efi.mps = EFI_INVALID_TABLE_ADDR; 490 efi.mps = EFI_INVALID_TABLE_ADDR;
470 efi.acpi = EFI_INVALID_TABLE_ADDR; 491 efi.acpi = EFI_INVALID_TABLE_ADDR;
@@ -519,9 +540,12 @@ efi_init (void)
519 efi_memory_desc_t *md; 540 efi_memory_desc_t *md;
520 void *p; 541 void *p;
521 542
522 for (i = 0, p = efi_map_start; p < efi_map_end; ++i, p += efi_desc_size) { 543 for (i = 0, p = efi_map_start; p < efi_map_end;
544 ++i, p += efi_desc_size)
545 {
523 md = p; 546 md = p;
524 printk("mem%02u: type=%u, attr=0x%lx, range=[0x%016lx-0x%016lx) (%luMB)\n", 547 printk("mem%02u: type=%u, attr=0x%lx, "
548 "range=[0x%016lx-0x%016lx) (%luMB)\n",
525 i, md->type, md->attribute, md->phys_addr, 549 i, md->type, md->attribute, md->phys_addr,
526 md->phys_addr + efi_md_size(md), 550 md->phys_addr + efi_md_size(md),
527 md->num_pages >> (20 - EFI_PAGE_SHIFT)); 551 md->num_pages >> (20 - EFI_PAGE_SHIFT));
@@ -549,8 +573,8 @@ efi_enter_virtual_mode (void)
549 md = p; 573 md = p;
550 if (md->attribute & EFI_MEMORY_RUNTIME) { 574 if (md->attribute & EFI_MEMORY_RUNTIME) {
551 /* 575 /*
552 * Some descriptors have multiple bits set, so the order of 576 * Some descriptors have multiple bits set, so the
553 * the tests is relevant. 577 * order of the tests is relevant.
554 */ 578 */
555 if (md->attribute & EFI_MEMORY_WB) { 579 if (md->attribute & EFI_MEMORY_WB) {
556 md->virt_addr = (u64) __va(md->phys_addr); 580 md->virt_addr = (u64) __va(md->phys_addr);
@@ -558,21 +582,26 @@ efi_enter_virtual_mode (void)
558 md->virt_addr = (u64) ioremap(md->phys_addr, 0); 582 md->virt_addr = (u64) ioremap(md->phys_addr, 0);
559 } else if (md->attribute & EFI_MEMORY_WC) { 583 } else if (md->attribute & EFI_MEMORY_WC) {
560#if 0 584#if 0
561 md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P 585 md->virt_addr = ia64_remap(md->phys_addr,
562 | _PAGE_D 586 (_PAGE_A |
563 | _PAGE_MA_WC 587 _PAGE_P |
564 | _PAGE_PL_0 588 _PAGE_D |
565 | _PAGE_AR_RW)); 589 _PAGE_MA_WC |
590 _PAGE_PL_0 |
591 _PAGE_AR_RW));
566#else 592#else
567 printk(KERN_INFO "EFI_MEMORY_WC mapping\n"); 593 printk(KERN_INFO "EFI_MEMORY_WC mapping\n");
568 md->virt_addr = (u64) ioremap(md->phys_addr, 0); 594 md->virt_addr = (u64) ioremap(md->phys_addr, 0);
569#endif 595#endif
570 } else if (md->attribute & EFI_MEMORY_WT) { 596 } else if (md->attribute & EFI_MEMORY_WT) {
571#if 0 597#if 0
572 md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P 598 md->virt_addr = ia64_remap(md->phys_addr,
573 | _PAGE_D | _PAGE_MA_WT 599 (_PAGE_A |
574 | _PAGE_PL_0 600 _PAGE_P |
575 | _PAGE_AR_RW)); 601 _PAGE_D |
602 _PAGE_MA_WT |
603 _PAGE_PL_0 |
604 _PAGE_AR_RW));
576#else 605#else
577 printk(KERN_INFO "EFI_MEMORY_WT mapping\n"); 606 printk(KERN_INFO "EFI_MEMORY_WT mapping\n");
578 md->virt_addr = (u64) ioremap(md->phys_addr, 0); 607 md->virt_addr = (u64) ioremap(md->phys_addr, 0);
@@ -583,16 +612,18 @@ efi_enter_virtual_mode (void)
583 612
584 status = efi_call_phys(__va(runtime->set_virtual_address_map), 613 status = efi_call_phys(__va(runtime->set_virtual_address_map),
585 ia64_boot_param->efi_memmap_size, 614 ia64_boot_param->efi_memmap_size,
586 efi_desc_size, ia64_boot_param->efi_memdesc_version, 615 efi_desc_size,
616 ia64_boot_param->efi_memdesc_version,
587 ia64_boot_param->efi_memmap); 617 ia64_boot_param->efi_memmap);
588 if (status != EFI_SUCCESS) { 618 if (status != EFI_SUCCESS) {
589 printk(KERN_WARNING "warning: unable to switch EFI into virtual mode " 619 printk(KERN_WARNING "warning: unable to switch EFI into "
590 "(status=%lu)\n", status); 620 "virtual mode (status=%lu)\n", status);
591 return; 621 return;
592 } 622 }
593 623
594 /* 624 /*
595 * Now that EFI is in virtual mode, we call the EFI functions more efficiently: 625 * Now that EFI is in virtual mode, we call the EFI functions more
626 * efficiently:
596 */ 627 */
597 efi.get_time = virt_get_time; 628 efi.get_time = virt_get_time;
598 efi.set_time = virt_set_time; 629 efi.set_time = virt_set_time;
@@ -606,8 +637,8 @@ efi_enter_virtual_mode (void)
606} 637}
607 638
608/* 639/*
609 * Walk the EFI memory map looking for the I/O port range. There can only be one entry of 640 * Walk the EFI memory map looking for the I/O port range. There can only be
610 * this type, other I/O port ranges should be described via ACPI. 641 * one entry of this type, other I/O port ranges should be described via ACPI.
611 */ 642 */
612u64 643u64
613efi_get_iobase (void) 644efi_get_iobase (void)
@@ -678,7 +709,6 @@ efi_memmap_intersects (unsigned long phys_addr, unsigned long size)
678 709
679 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { 710 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
680 md = p; 711 md = p;
681
682 if (md->phys_addr < end && efi_md_end(md) > phys_addr) 712 if (md->phys_addr < end && efi_md_end(md) > phys_addr)
683 return 1; 713 return 1;
684 } 714 }
@@ -731,7 +761,7 @@ efi_mem_attribute (unsigned long phys_addr, unsigned long size)
731 if (!md || (md->attribute & ~EFI_MEMORY_RUNTIME) != attr) 761 if (!md || (md->attribute & ~EFI_MEMORY_RUNTIME) != attr)
732 return 0; 762 return 0;
733 } while (md); 763 } while (md);
734 return 0; 764 return 0; /* never reached */
735} 765}
736 766
737u64 767u64
@@ -767,7 +797,7 @@ kern_mem_attribute (unsigned long phys_addr, unsigned long size)
767 if (!md || md->attribute != attr) 797 if (!md || md->attribute != attr)
768 return 0; 798 return 0;
769 } while (md); 799 } while (md);
770 return 0; 800 return 0; /* never reached */
771} 801}
772EXPORT_SYMBOL(kern_mem_attribute); 802EXPORT_SYMBOL(kern_mem_attribute);
773 803
@@ -883,7 +913,7 @@ efi_uart_console_only(void)
883 return 1; 913 return 1;
884 uart = 0; 914 uart = 0;
885 } 915 }
886 hdr = (struct efi_generic_dev_path *) ((u8 *) hdr + hdr->length); 916 hdr = (struct efi_generic_dev_path *)((u8 *) hdr + hdr->length);
887 } 917 }
888 printk(KERN_ERR "Malformed %s value\n", name); 918 printk(KERN_ERR "Malformed %s value\n", name);
889 return 0; 919 return 0;
@@ -921,10 +951,12 @@ find_memmap_space (void)
921 if (!efi_wb(md)) { 951 if (!efi_wb(md)) {
922 continue; 952 continue;
923 } 953 }
924 if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) { 954 if (pmd == NULL || !efi_wb(pmd) ||
955 efi_md_end(pmd) != md->phys_addr) {
925 contig_low = GRANULEROUNDUP(md->phys_addr); 956 contig_low = GRANULEROUNDUP(md->phys_addr);
926 contig_high = efi_md_end(md); 957 contig_high = efi_md_end(md);
927 for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) { 958 for (q = p + efi_desc_size; q < efi_map_end;
959 q += efi_desc_size) {
928 check_md = q; 960 check_md = q;
929 if (!efi_wb(check_md)) 961 if (!efi_wb(check_md))
930 break; 962 break;
@@ -988,8 +1020,9 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
988 for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) { 1020 for (p = efi_map_start; p < efi_map_end; pmd = md, p += efi_desc_size) {
989 md = p; 1021 md = p;
990 if (!efi_wb(md)) { 1022 if (!efi_wb(md)) {
991 if (efi_uc(md) && (md->type == EFI_CONVENTIONAL_MEMORY || 1023 if (efi_uc(md) &&
992 md->type == EFI_BOOT_SERVICES_DATA)) { 1024 (md->type == EFI_CONVENTIONAL_MEMORY ||
1025 md->type == EFI_BOOT_SERVICES_DATA)) {
993 k->attribute = EFI_MEMORY_UC; 1026 k->attribute = EFI_MEMORY_UC;
994 k->start = md->phys_addr; 1027 k->start = md->phys_addr;
995 k->num_pages = md->num_pages; 1028 k->num_pages = md->num_pages;
@@ -997,10 +1030,12 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
997 } 1030 }
998 continue; 1031 continue;
999 } 1032 }
1000 if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != md->phys_addr) { 1033 if (pmd == NULL || !efi_wb(pmd) ||
1034 efi_md_end(pmd) != md->phys_addr) {
1001 contig_low = GRANULEROUNDUP(md->phys_addr); 1035 contig_low = GRANULEROUNDUP(md->phys_addr);
1002 contig_high = efi_md_end(md); 1036 contig_high = efi_md_end(md);
1003 for (q = p + efi_desc_size; q < efi_map_end; q += efi_desc_size) { 1037 for (q = p + efi_desc_size; q < efi_map_end;
1038 q += efi_desc_size) {
1004 check_md = q; 1039 check_md = q;
1005 if (!efi_wb(check_md)) 1040 if (!efi_wb(check_md))
1006 break; 1041 break;
@@ -1025,13 +1060,17 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
1025 if (md->phys_addr < contig_low) { 1060 if (md->phys_addr < contig_low) {
1026 lim = min(efi_md_end(md), contig_low); 1061 lim = min(efi_md_end(md), contig_low);
1027 if (efi_uc(md)) { 1062 if (efi_uc(md)) {
1028 if (k > kern_memmap && (k-1)->attribute == EFI_MEMORY_UC && 1063 if (k > kern_memmap &&
1064 (k-1)->attribute == EFI_MEMORY_UC &&
1029 kmd_end(k-1) == md->phys_addr) { 1065 kmd_end(k-1) == md->phys_addr) {
1030 (k-1)->num_pages += (lim - md->phys_addr) >> EFI_PAGE_SHIFT; 1066 (k-1)->num_pages +=
1067 (lim - md->phys_addr)
1068 >> EFI_PAGE_SHIFT;
1031 } else { 1069 } else {
1032 k->attribute = EFI_MEMORY_UC; 1070 k->attribute = EFI_MEMORY_UC;
1033 k->start = md->phys_addr; 1071 k->start = md->phys_addr;
1034 k->num_pages = (lim - md->phys_addr) >> EFI_PAGE_SHIFT; 1072 k->num_pages = (lim - md->phys_addr)
1073 >> EFI_PAGE_SHIFT;
1035 k++; 1074 k++;
1036 } 1075 }
1037 } 1076 }
@@ -1049,7 +1088,8 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
1049 } else { 1088 } else {
1050 k->attribute = EFI_MEMORY_UC; 1089 k->attribute = EFI_MEMORY_UC;
1051 k->start = lim; 1090 k->start = lim;
1052 k->num_pages = (efi_md_end(md) - lim) >> EFI_PAGE_SHIFT; 1091 k->num_pages = (efi_md_end(md) - lim)
1092 >> EFI_PAGE_SHIFT;
1053 k++; 1093 k++;
1054 } 1094 }
1055 } 1095 }
@@ -1151,8 +1191,10 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1151 break; 1191 break;
1152 } 1192 }
1153 1193
1154 if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) { 1194 if ((res = kzalloc(sizeof(struct resource),
1155 printk(KERN_ERR "failed to alocate resource for iomem\n"); 1195 GFP_KERNEL)) == NULL) {
1196 printk(KERN_ERR
1197 "failed to allocate resource for iomem\n");
1156 return; 1198 return;
1157 } 1199 }
1158 1200
@@ -1187,44 +1229,44 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1187 rsvd_regions are sorted 1229 rsvd_regions are sorted
1188 */ 1230 */
1189unsigned long __init 1231unsigned long __init
1190kdump_find_rsvd_region (unsigned long size, 1232kdump_find_rsvd_region (unsigned long size, struct rsvd_region *r, int n)
1191 struct rsvd_region *r, int n)
1192{ 1233{
1193 int i; 1234 int i;
1194 u64 start, end; 1235 u64 start, end;
1195 u64 alignment = 1UL << _PAGE_SIZE_64M; 1236 u64 alignment = 1UL << _PAGE_SIZE_64M;
1196 void *efi_map_start, *efi_map_end, *p; 1237 void *efi_map_start, *efi_map_end, *p;
1197 efi_memory_desc_t *md; 1238 efi_memory_desc_t *md;
1198 u64 efi_desc_size; 1239 u64 efi_desc_size;
1199 1240
1200 efi_map_start = __va(ia64_boot_param->efi_memmap); 1241 efi_map_start = __va(ia64_boot_param->efi_memmap);
1201 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size; 1242 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
1202 efi_desc_size = ia64_boot_param->efi_memdesc_size; 1243 efi_desc_size = ia64_boot_param->efi_memdesc_size;
1203 1244
1204 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { 1245 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
1205 md = p; 1246 md = p;
1206 if (!efi_wb(md)) 1247 if (!efi_wb(md))
1207 continue; 1248 continue;
1208 start = ALIGN(md->phys_addr, alignment); 1249 start = ALIGN(md->phys_addr, alignment);
1209 end = efi_md_end(md); 1250 end = efi_md_end(md);
1210 for (i = 0; i < n; i++) { 1251 for (i = 0; i < n; i++) {
1211 if (__pa(r[i].start) >= start && __pa(r[i].end) < end) { 1252 if (__pa(r[i].start) >= start && __pa(r[i].end) < end) {
1212 if (__pa(r[i].start) > start + size) 1253 if (__pa(r[i].start) > start + size)
1213 return start; 1254 return start;
1214 start = ALIGN(__pa(r[i].end), alignment); 1255 start = ALIGN(__pa(r[i].end), alignment);
1215 if (i < n-1 && __pa(r[i+1].start) < start + size) 1256 if (i < n-1 &&
1216 continue; 1257 __pa(r[i+1].start) < start + size)
1217 else 1258 continue;
1218 break; 1259 else
1260 break;
1261 }
1219 } 1262 }
1220 } 1263 if (end > start + size)
1221 if (end > start + size) 1264 return start;
1222 return start; 1265 }
1223 } 1266
1224 1267 printk(KERN_WARNING
1225 printk(KERN_WARNING "Cannot reserve 0x%lx byte of memory for crashdump\n", 1268 "Cannot reserve 0x%lx byte of memory for crashdump\n", size);
1226 size); 1269 return ~0UL;
1227 return ~0UL;
1228} 1270}
1229#endif 1271#endif
1230 1272
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index c36f43c94600..f5d3efbfbeda 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1586,7 +1586,7 @@ sys_call_table:
1586 data8 sys_epoll_pwait // 1305 1586 data8 sys_epoll_pwait // 1305
1587 data8 sys_utimensat 1587 data8 sys_utimensat
1588 data8 sys_signalfd 1588 data8 sys_signalfd
1589 data8 sys_timerfd 1589 data8 sys_ni_syscall
1590 data8 sys_eventfd 1590 data8 sys_eventfd
1591 1591
1592 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1592 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/fsyscall_gtod_data.h b/arch/ia64/kernel/fsyscall_gtod_data.h
index 490dab55fba3..57d2ee6c83e1 100644
--- a/arch/ia64/kernel/fsyscall_gtod_data.h
+++ b/arch/ia64/kernel/fsyscall_gtod_data.h
@@ -14,10 +14,10 @@ struct fsyscall_gtod_data_t {
14 u32 clk_shift; 14 u32 clk_shift;
15 void *clk_fsys_mmio; 15 void *clk_fsys_mmio;
16 cycle_t clk_cycle_last; 16 cycle_t clk_cycle_last;
17} __attribute__ ((aligned (L1_CACHE_BYTES))); 17} ____cacheline_aligned;
18 18
19struct itc_jitter_data_t { 19struct itc_jitter_data_t {
20 int itc_jitter; 20 int itc_jitter;
21 cycle_t itc_lastcycle; 21 cycle_t itc_lastcycle;
22} __attribute__ ((aligned (L1_CACHE_BYTES))); 22} ____cacheline_aligned;
23 23
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 4e5e27540e27..d3a41d5f8d12 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1176,6 +1176,7 @@ tlb_purge_done:
1176 RESTORE_REG(cr.dcr, r25, r17);; 1176 RESTORE_REG(cr.dcr, r25, r17);;
1177 RESTORE_REG(cr.iva, r25, r17);; 1177 RESTORE_REG(cr.iva, r25, r17);;
1178 RESTORE_REG(cr.pta, r25, r17);; 1178 RESTORE_REG(cr.pta, r25, r17);;
1179 srlz.d;; // required not to violate RAW dependency
1179 RESTORE_REG(cr.itv, r25, r17);; 1180 RESTORE_REG(cr.itv, r25, r17);;
1180 RESTORE_REG(cr.pmv, r25, r17);; 1181 RESTORE_REG(cr.pmv, r25, r17);;
1181 RESTORE_REG(cr.cmcv, r25, r17);; 1182 RESTORE_REG(cr.cmcv, r25, r17);;
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
index c3b4412ccc67..8e7193d55528 100644
--- a/arch/ia64/kernel/ia64_ksyms.c
+++ b/arch/ia64/kernel/ia64_ksyms.c
@@ -12,6 +12,9 @@ EXPORT_SYMBOL(memset);
12EXPORT_SYMBOL(memcpy); 12EXPORT_SYMBOL(memcpy);
13EXPORT_SYMBOL(strlen); 13EXPORT_SYMBOL(strlen);
14 14
15#include<asm/pgtable.h>
16EXPORT_SYMBOL_GPL(empty_zero_page);
17
15#include <asm/checksum.h> 18#include <asm/checksum.h>
16EXPORT_SYMBOL(ip_fast_csum); /* hand-coded assembly */ 19EXPORT_SYMBOL(ip_fast_csum); /* hand-coded assembly */
17EXPORT_SYMBOL(csum_ipv6_magic); 20EXPORT_SYMBOL(csum_ipv6_magic);
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 00a4599e5f47..0b52f19ed046 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -200,7 +200,7 @@ assign_irq_vector (int irq)
200{ 200{
201 unsigned long flags; 201 unsigned long flags;
202 int vector, cpu; 202 int vector, cpu;
203 cpumask_t domain; 203 cpumask_t domain = CPU_MASK_NONE;
204 204
205 vector = -ENOSPC; 205 vector = -ENOSPC;
206 206
@@ -340,7 +340,7 @@ int create_irq(void)
340{ 340{
341 unsigned long flags; 341 unsigned long flags;
342 int irq, vector, cpu; 342 int irq, vector, cpu;
343 cpumask_t domain; 343 cpumask_t domain = CPU_MASK_NONE;
344 344
345 irq = vector = -ENOSPC; 345 irq = vector = -ENOSPC;
346 spin_lock_irqsave(&vector_lock, flags); 346 spin_lock_irqsave(&vector_lock, flags);
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index fc4d2676264f..b618487cdc85 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -381,9 +381,10 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
381static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb) 381static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
382{ 382{
383 unsigned int i; 383 unsigned int i;
384 i = atomic_sub_return(1, &kcb->prev_kprobe_index); 384 i = atomic_read(&kcb->prev_kprobe_index);
385 __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i].kp; 385 __get_cpu_var(current_kprobe) = kcb->prev_kprobe[i-1].kp;
386 kcb->kprobe_status = kcb->prev_kprobe[i].status; 386 kcb->kprobe_status = kcb->prev_kprobe[i-1].status;
387 atomic_sub(1, &kcb->prev_kprobe_index);
387} 388}
388 389
389static void __kprobes set_current_kprobe(struct kprobe *p, 390static void __kprobes set_current_kprobe(struct kprobe *p,
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 10b48cd15a87..846e7e036b13 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -2,61 +2,69 @@
2 * File: mca.c 2 * File: mca.c
3 * Purpose: Generic MCA handling layer 3 * Purpose: Generic MCA handling layer
4 * 4 *
5 * Updated for latest kernel
6 * Copyright (C) 2003 Hewlett-Packard Co 5 * Copyright (C) 2003 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * David Mosberger-Tang <davidm@hpl.hp.com>
8 * 7 *
9 * Copyright (C) 2002 Dell Inc. 8 * Copyright (C) 2002 Dell Inc.
10 * Copyright (C) Matt Domsch (Matt_Domsch@dell.com) 9 * Copyright (C) Matt Domsch <Matt_Domsch@dell.com>
11 * 10 *
12 * Copyright (C) 2002 Intel 11 * Copyright (C) 2002 Intel
13 * Copyright (C) Jenna Hall (jenna.s.hall@intel.com) 12 * Copyright (C) Jenna Hall <jenna.s.hall@intel.com>
14 * 13 *
15 * Copyright (C) 2001 Intel 14 * Copyright (C) 2001 Intel
16 * Copyright (C) Fred Lewis (frederick.v.lewis@intel.com) 15 * Copyright (C) Fred Lewis <frederick.v.lewis@intel.com>
17 * 16 *
18 * Copyright (C) 2000 Intel 17 * Copyright (C) 2000 Intel
19 * Copyright (C) Chuck Fleckenstein (cfleck@co.intel.com) 18 * Copyright (C) Chuck Fleckenstein <cfleck@co.intel.com>
20 * 19 *
21 * Copyright (C) 1999, 2004 Silicon Graphics, Inc. 20 * Copyright (C) 1999, 2004 Silicon Graphics, Inc.
22 * Copyright (C) Vijay Chander(vijay@engr.sgi.com) 21 * Copyright (C) Vijay Chander <vijay@engr.sgi.com>
23 * 22 *
24 * 03/04/15 D. Mosberger Added INIT backtrace support. 23 * Copyright (C) 2006 FUJITSU LIMITED
25 * 02/03/25 M. Domsch GUID cleanups 24 * Copyright (C) Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
26 * 25 *
27 * 02/01/04 J. Hall Aligned MCA stack to 16 bytes, added platform vs. CPU 26 * 2000-03-29 Chuck Fleckenstein <cfleck@co.intel.com>
28 * error flag, set SAL default return values, changed 27 * Fixed PAL/SAL update issues, began MCA bug fixes, logging issues,
29 * error record structure to linked list, added init call 28 * added min save state dump, added INIT handler.
30 * to sal_get_state_info_size().
31 * 29 *
32 * 01/01/03 F. Lewis Added setup of CMCI and CPEI IRQs, logging of corrected 30 * 2001-01-03 Fred Lewis <frederick.v.lewis@intel.com>
33 * platform errors, completed code for logging of 31 * Added setup of CMCI and CPEI IRQs, logging of corrected platform
34 * corrected & uncorrected machine check errors, and 32 * errors, completed code for logging of corrected & uncorrected
35 * updated for conformance with Nov. 2000 revision of the 33 * machine check errors, and updated for conformance with Nov. 2000
36 * SAL 3.0 spec. 34 * revision of the SAL 3.0 spec.
37 * 00/03/29 C. Fleckenstein Fixed PAL/SAL update issues, began MCA bug fixes, logging issues, 35 *
38 * added min save state dump, added INIT handler. 36 * 2002-01-04 Jenna Hall <jenna.s.hall@intel.com>
37 * Aligned MCA stack to 16 bytes, added platform vs. CPU error flag,
38 * set SAL default return values, changed error record structure to
39 * linked list, added init call to sal_get_state_info_size().
40 *
41 * 2002-03-25 Matt Domsch <Matt_Domsch@dell.com>
42 * GUID cleanups.
43 *
44 * 2003-04-15 David Mosberger-Tang <davidm@hpl.hp.com>
45 * Added INIT backtrace support.
39 * 46 *
40 * 2003-12-08 Keith Owens <kaos@sgi.com> 47 * 2003-12-08 Keith Owens <kaos@sgi.com>
41 * smp_call_function() must not be called from interrupt context (can 48 * smp_call_function() must not be called from interrupt context
42 * deadlock on tasklist_lock). Use keventd to call smp_call_function(). 49 * (can deadlock on tasklist_lock).
50 * Use keventd to call smp_call_function().
43 * 51 *
44 * 2004-02-01 Keith Owens <kaos@sgi.com> 52 * 2004-02-01 Keith Owens <kaos@sgi.com>
45 * Avoid deadlock when using printk() for MCA and INIT records. 53 * Avoid deadlock when using printk() for MCA and INIT records.
46 * Delete all record printing code, moved to salinfo_decode in user space. 54 * Delete all record printing code, moved to salinfo_decode in user
47 * Mark variables and functions static where possible. 55 * space. Mark variables and functions static where possible.
48 * Delete dead variables and functions. 56 * Delete dead variables and functions. Reorder to remove the need
49 * Reorder to remove the need for forward declarations and to consolidate 57 * for forward declarations and to consolidate related code.
50 * related code.
51 * 58 *
52 * 2005-08-12 Keith Owens <kaos@sgi.com> 59 * 2005-08-12 Keith Owens <kaos@sgi.com>
53 * Convert MCA/INIT handlers to use per event stacks and SAL/OS state. 60 * Convert MCA/INIT handlers to use per event stacks and SAL/OS
61 * state.
54 * 62 *
55 * 2005-10-07 Keith Owens <kaos@sgi.com> 63 * 2005-10-07 Keith Owens <kaos@sgi.com>
56 * Add notify_die() hooks. 64 * Add notify_die() hooks.
57 * 65 *
58 * 2006-09-15 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> 66 * 2006-09-15 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
59 * Add printing support for MCA/INIT. 67 * Add printing support for MCA/INIT.
60 * 68 *
61 * 2007-04-27 Russ Anderson <rja@sgi.com> 69 * 2007-04-27 Russ Anderson <rja@sgi.com>
62 * Support multiple cpus going through OS_MCA in the same event. 70 * Support multiple cpus going through OS_MCA in the same event.
@@ -75,6 +83,7 @@
75#include <linux/workqueue.h> 83#include <linux/workqueue.h>
76#include <linux/cpumask.h> 84#include <linux/cpumask.h>
77#include <linux/kdebug.h> 85#include <linux/kdebug.h>
86#include <linux/cpu.h>
78 87
79#include <asm/delay.h> 88#include <asm/delay.h>
80#include <asm/machvec.h> 89#include <asm/machvec.h>
@@ -1813,6 +1822,36 @@ ia64_mca_cpu_init(void *cpu_data)
1813 PAGE_KERNEL)); 1822 PAGE_KERNEL));
1814} 1823}
1815 1824
1825static void __cpuinit ia64_mca_cmc_vector_adjust(void *dummy)
1826{
1827 unsigned long flags;
1828
1829 local_irq_save(flags);
1830 if (!cmc_polling_enabled)
1831 ia64_mca_cmc_vector_enable(NULL);
1832 local_irq_restore(flags);
1833}
1834
1835static int __cpuinit mca_cpu_callback(struct notifier_block *nfb,
1836 unsigned long action,
1837 void *hcpu)
1838{
1839 int hotcpu = (unsigned long) hcpu;
1840
1841 switch (action) {
1842 case CPU_ONLINE:
1843 case CPU_ONLINE_FROZEN:
1844 smp_call_function_single(hotcpu, ia64_mca_cmc_vector_adjust,
1845 NULL, 1, 0);
1846 break;
1847 }
1848 return NOTIFY_OK;
1849}
1850
1851static struct notifier_block mca_cpu_notifier __cpuinitdata = {
1852 .notifier_call = mca_cpu_callback
1853};
1854
1816/* 1855/*
1817 * ia64_mca_init 1856 * ia64_mca_init
1818 * 1857 *
@@ -1996,6 +2035,8 @@ ia64_mca_late_init(void)
1996 if (!mca_init) 2035 if (!mca_init)
1997 return 0; 2036 return 0;
1998 2037
2038 register_hotcpu_notifier(&mca_cpu_notifier);
2039
1999 /* Setup the CMCI/P vector and handler */ 2040 /* Setup the CMCI/P vector and handler */
2000 init_timer(&cmc_poll_timer); 2041 init_timer(&cmc_poll_timer);
2001 cmc_poll_timer.function = ia64_mca_cmc_poll; 2042 cmc_poll_timer.function = ia64_mca_cmc_poll;
diff --git a/arch/ia64/kernel/mca_asm.S b/arch/ia64/kernel/mca_asm.S
index 0f5965fcdf85..8bc7d259e0c6 100644
--- a/arch/ia64/kernel/mca_asm.S
+++ b/arch/ia64/kernel/mca_asm.S
@@ -1,24 +1,28 @@
1// 1/*
2// assembly portion of the IA64 MCA handling 2 * File: mca_asm.S
3// 3 * Purpose: assembly portion of the IA64 MCA handling
4// Mods by cfleck to integrate into kernel build 4 *
5// 00/03/15 davidm Added various stop bits to get a clean compile 5 * Mods by cfleck to integrate into kernel build
6// 6 *
7// 00/03/29 cfleck Added code to save INIT handoff state in pt_regs format, switch to temp 7 * 2000-03-15 David Mosberger-Tang <davidm@hpl.hp.com>
8// kstack, switch modes, jump to C INIT handler 8 * Added various stop bits to get a clean compile
9// 9 *
10// 02/01/04 J.Hall <jenna.s.hall@intel.com> 10 * 2000-03-29 Chuck Fleckenstein <cfleck@co.intel.com>
11// Before entering virtual mode code: 11 * Added code to save INIT handoff state in pt_regs format,
12// 1. Check for TLB CPU error 12 * switch to temp kstack, switch modes, jump to C INIT handler
13// 2. Restore current thread pointer to kr6 13 *
14// 3. Move stack ptr 16 bytes to conform to C calling convention 14 * 2002-01-04 J.Hall <jenna.s.hall@intel.com>
15// 15 * Before entering virtual mode code:
16// 04/11/12 Russ Anderson <rja@sgi.com> 16 * 1. Check for TLB CPU error
17// Added per cpu MCA/INIT stack save areas. 17 * 2. Restore current thread pointer to kr6
18// 18 * 3. Move stack ptr 16 bytes to conform to C calling convention
19// 12/08/05 Keith Owens <kaos@sgi.com> 19 *
20// Use per cpu MCA/INIT stacks for all data. 20 * 2004-11-12 Russ Anderson <rja@sgi.com>
21// 21 * Added per cpu MCA/INIT stack save areas.
22 *
23 * 2005-12-08 Keith Owens <kaos@sgi.com>
24 * Use per cpu MCA/INIT stacks for all data.
25 */
22#include <linux/threads.h> 26#include <linux/threads.h>
23 27
24#include <asm/asmmacro.h> 28#include <asm/asmmacro.h>
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index aba813c2c150..fab1d21a4f2c 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -3,7 +3,7 @@
3 * Purpose: Generic MCA handling layer 3 * Purpose: Generic MCA handling layer
4 * 4 *
5 * Copyright (C) 2004 FUJITSU LIMITED 5 * Copyright (C) 2004 FUJITSU LIMITED
6 * Copyright (C) Hidetoshi Seto (seto.hidetoshi@jp.fujitsu.com) 6 * Copyright (C) 2004 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
7 * Copyright (C) 2005 Silicon Graphics, Inc 7 * Copyright (C) 2005 Silicon Graphics, Inc
8 * Copyright (C) 2005 Keith Owens <kaos@sgi.com> 8 * Copyright (C) 2005 Keith Owens <kaos@sgi.com>
9 * Copyright (C) 2006 Russ Anderson <rja@sgi.com> 9 * Copyright (C) 2006 Russ Anderson <rja@sgi.com>
diff --git a/arch/ia64/kernel/mca_drv.h b/arch/ia64/kernel/mca_drv.h
index 485e34d0b199..53b8ecb5b4b9 100644
--- a/arch/ia64/kernel/mca_drv.h
+++ b/arch/ia64/kernel/mca_drv.h
@@ -3,7 +3,7 @@
3 * Purpose: Define helpers for Generic MCA handling 3 * Purpose: Define helpers for Generic MCA handling
4 * 4 *
5 * Copyright (C) 2004 FUJITSU LIMITED 5 * Copyright (C) 2004 FUJITSU LIMITED
6 * Copyright (C) Hidetoshi Seto (seto.hidetoshi@jp.fujitsu.com) 6 * Copyright (C) 2004 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
7 */ 7 */
8/* 8/*
9 * Processor error section: 9 * Processor error section:
diff --git a/arch/ia64/kernel/mca_drv_asm.S b/arch/ia64/kernel/mca_drv_asm.S
index 3bccb06c8d21..767ac2c20d16 100644
--- a/arch/ia64/kernel/mca_drv_asm.S
+++ b/arch/ia64/kernel/mca_drv_asm.S
@@ -3,7 +3,7 @@
3 * Purpose: Assembly portion of Generic MCA handling 3 * Purpose: Assembly portion of Generic MCA handling
4 * 4 *
5 * Copyright (C) 2004 FUJITSU LIMITED 5 * Copyright (C) 2004 FUJITSU LIMITED
6 * Copyright (C) Hidetoshi Seto (seto.hidetoshi@jp.fujitsu.com) 6 * Copyright (C) 2004 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
7 */ 7 */
8#include <linux/threads.h> 8#include <linux/threads.h>
9 9
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 196287928bae..e58f4367cf11 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -940,14 +940,3 @@ module_arch_cleanup (struct module *mod)
940 if (mod->arch.core_unw_table) 940 if (mod->arch.core_unw_table)
941 unw_remove_unwind_table(mod->arch.core_unw_table); 941 unw_remove_unwind_table(mod->arch.core_unw_table);
942} 942}
943
944#ifdef CONFIG_SMP
945void
946percpu_modcopy (void *pcpudst, const void *src, unsigned long size)
947{
948 unsigned int i;
949 for_each_possible_cpu(i) {
950 memcpy(pcpudst + __per_cpu_offset[i], src, size);
951 }
952}
953#endif /* CONFIG_SMP */
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 73e7c2e40b54..78acd9fe97e9 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2631,7 +2631,7 @@ pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
2631 */ 2631 */
2632 if (task == current) return 0; 2632 if (task == current) return 0;
2633 2633
2634 if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) { 2634 if (!task_is_stopped_or_traced(task)) {
2635 DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task_pid_nr(task), task->state)); 2635 DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task_pid_nr(task), task->state));
2636 return -EBUSY; 2636 return -EBUSY;
2637 } 2637 }
@@ -2654,11 +2654,11 @@ pfm_get_task(pfm_context_t *ctx, pid_t pid, struct task_struct **task)
2654 /* XXX: need to add more checks here */ 2654 /* XXX: need to add more checks here */
2655 if (pid < 2) return -EPERM; 2655 if (pid < 2) return -EPERM;
2656 2656
2657 if (pid != current->pid) { 2657 if (pid != task_pid_vnr(current)) {
2658 2658
2659 read_lock(&tasklist_lock); 2659 read_lock(&tasklist_lock);
2660 2660
2661 p = find_task_by_pid(pid); 2661 p = find_task_by_vpid(pid);
2662 2662
2663 /* make sure task cannot go away while we operate on it */ 2663 /* make sure task cannot go away while we operate on it */
2664 if (p) get_task_struct(p); 2664 if (p) get_task_struct(p);
@@ -4792,7 +4792,7 @@ recheck:
4792 * the task must be stopped. 4792 * the task must be stopped.
4793 */ 4793 */
4794 if (PFM_CMD_STOPPED(cmd)) { 4794 if (PFM_CMD_STOPPED(cmd)) {
4795 if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) { 4795 if (!task_is_stopped_or_traced(task)) {
4796 DPRINT(("[%d] task not in stopped state\n", task_pid_nr(task))); 4796 DPRINT(("[%d] task not in stopped state\n", task_pid_nr(task)));
4797 return -EBUSY; 4797 return -EBUSY;
4798 } 4798 }
@@ -5795,7 +5795,7 @@ pfm_proc_show(struct seq_file *m, void *v)
5795 return 0; 5795 return 0;
5796} 5796}
5797 5797
5798struct seq_operations pfm_seq_ops = { 5798const struct seq_operations pfm_seq_ops = {
5799 .start = pfm_proc_start, 5799 .start = pfm_proc_start,
5800 .next = pfm_proc_next, 5800 .next = pfm_proc_next,
5801 .stop = pfm_proc_stop, 5801 .stop = pfm_proc_stop,
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 2418289ee5ca..7377d323131d 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -27,6 +27,7 @@
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/kdebug.h> 29#include <linux/kdebug.h>
30#include <linux/utsname.h>
30 31
31#include <asm/cpu.h> 32#include <asm/cpu.h>
32#include <asm/delay.h> 33#include <asm/delay.h>
@@ -107,8 +108,9 @@ show_regs (struct pt_regs *regs)
107 print_modules(); 108 print_modules();
108 printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current), 109 printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
109 smp_processor_id(), current->comm); 110 smp_processor_id(), current->comm);
110 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s\n", 111 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n",
111 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted()); 112 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
113 init_utsname()->release);
112 print_symbol("ip is at %s\n", ip); 114 print_symbol("ip is at %s\n", ip);
113 printk("unat: %016lx pfs : %016lx rsc : %016lx\n", 115 printk("unat: %016lx pfs : %016lx rsc : %016lx\n",
114 regs->ar_unat, regs->ar_pfs, regs->ar_rsc); 116 regs->ar_unat, regs->ar_pfs, regs->ar_rsc);
@@ -737,6 +739,7 @@ flush_thread (void)
737 ia32_drop_ia64_partial_page_list(current); 739 ia32_drop_ia64_partial_page_list(current);
738 current->thread.task_size = IA32_PAGE_OFFSET; 740 current->thread.task_size = IA32_PAGE_OFFSET;
739 set_fs(USER_DS); 741 set_fs(USER_DS);
742 memset(current->thread.tls_array, 0, sizeof(current->thread.tls_array));
740 } 743 }
741#endif 744#endif
742} 745}
diff --git a/arch/ia64/kernel/sal.c b/arch/ia64/kernel/sal.c
index 27c2ef445a56..f44fe8412162 100644
--- a/arch/ia64/kernel/sal.c
+++ b/arch/ia64/kernel/sal.c
@@ -284,6 +284,7 @@ ia64_sal_cache_flush (u64 cache_type)
284 SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0); 284 SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0);
285 return isrv.status; 285 return isrv.status;
286} 286}
287EXPORT_SYMBOL_GPL(ia64_sal_cache_flush);
287 288
288void __init 289void __init
289ia64_sal_init (struct ia64_sal_systab *systab) 290ia64_sal_init (struct ia64_sal_systab *systab)
@@ -372,3 +373,16 @@ ia64_sal_oemcall_reentrant(struct ia64_sal_retval *isrvp, u64 oemfunc,
372 return 0; 373 return 0;
373} 374}
374EXPORT_SYMBOL(ia64_sal_oemcall_reentrant); 375EXPORT_SYMBOL(ia64_sal_oemcall_reentrant);
376
377long
378ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second,
379 unsigned long *drift_info)
380{
381 struct ia64_sal_retval isrv;
382
383 SAL_CALL(isrv, SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
384 *ticks_per_second = isrv.v0;
385 *drift_info = isrv.v1;
386 return isrv.status;
387}
388EXPORT_SYMBOL_GPL(ia64_sal_freq_base);
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 4ac2b1f1bd3b..ebd1a09f3201 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -71,8 +71,6 @@ unsigned long __per_cpu_offset[NR_CPUS];
71EXPORT_SYMBOL(__per_cpu_offset); 71EXPORT_SYMBOL(__per_cpu_offset);
72#endif 72#endif
73 73
74extern void ia64_setup_printk_clock(void);
75
76DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info); 74DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info);
77DEFINE_PER_CPU(unsigned long, local_per_cpu_offset); 75DEFINE_PER_CPU(unsigned long, local_per_cpu_offset);
78unsigned long ia64_cycles_per_usec; 76unsigned long ia64_cycles_per_usec;
@@ -507,8 +505,6 @@ setup_arch (char **cmdline_p)
507 /* process SAL system table: */ 505 /* process SAL system table: */
508 ia64_sal_init(__va(efi.sal_systab)); 506 ia64_sal_init(__va(efi.sal_systab));
509 507
510 ia64_setup_printk_clock();
511
512#ifdef CONFIG_SMP 508#ifdef CONFIG_SMP
513 cpu_physical_id(0) = hard_smp_processor_id(); 509 cpu_physical_id(0) = hard_smp_processor_id();
514#endif 510#endif
@@ -658,7 +654,7 @@ c_stop (struct seq_file *m, void *v)
658{ 654{
659} 655}
660 656
661struct seq_operations cpuinfo_op = { 657const struct seq_operations cpuinfo_op = {
662 .start = c_start, 658 .start = c_start,
663 .next = c_next, 659 .next = c_next,
664 .stop = c_stop, 660 .stop = c_stop,
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 4c730099d58f..309da3567bc8 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -280,15 +280,7 @@ setup_sigcontext (struct sigcontext __user *sc, sigset_t *mask, struct sigscratc
280 err |= __copy_to_user(&sc->sc_gr[15], &scr->pt.r15, 8); /* r15 */ 280 err |= __copy_to_user(&sc->sc_gr[15], &scr->pt.r15, 8); /* r15 */
281 err |= __put_user(scr->pt.cr_iip + ia64_psr(&scr->pt)->ri, &sc->sc_ip); 281 err |= __put_user(scr->pt.cr_iip + ia64_psr(&scr->pt)->ri, &sc->sc_ip);
282 282
283 if (flags & IA64_SC_FLAG_IN_SYSCALL) { 283 if (!(flags & IA64_SC_FLAG_IN_SYSCALL)) {
284 /* Clear scratch registers if the signal interrupted a system call. */
285 err |= __put_user(0, &sc->sc_ar_ccv); /* ar.ccv */
286 err |= __put_user(0, &sc->sc_br[7]); /* b7 */
287 err |= __put_user(0, &sc->sc_gr[14]); /* r14 */
288 err |= __clear_user(&sc->sc_ar25, 2*8); /* ar.csd & ar.ssd */
289 err |= __clear_user(&sc->sc_gr[2], 2*8); /* r2-r3 */
290 err |= __clear_user(&sc->sc_gr[16], 16*8); /* r16-r31 */
291 } else {
292 /* Copy scratch regs to sigcontext if the signal didn't interrupt a syscall. */ 284 /* Copy scratch regs to sigcontext if the signal didn't interrupt a syscall. */
293 err |= __put_user(scr->pt.ar_ccv, &sc->sc_ar_ccv); /* ar.ccv */ 285 err |= __put_user(scr->pt.ar_ccv, &sc->sc_ar_ccv); /* ar.ccv */
294 err |= __put_user(scr->pt.b7, &sc->sc_br[7]); /* b7 */ 286 err |= __put_user(scr->pt.b7, &sc->sc_br[7]); /* b7 */
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index f0fc4d8465ad..32ee5979a042 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -120,7 +120,6 @@ static volatile unsigned long go[SLAVE + 1];
120 120
121#define DEBUG_ITC_SYNC 0 121#define DEBUG_ITC_SYNC 0
122 122
123extern void __devinit calibrate_delay (void);
124extern void start_ap (void); 123extern void start_ap (void);
125extern unsigned long ia64_iobase; 124extern unsigned long ia64_iobase;
126 125
@@ -477,7 +476,7 @@ start_secondary (void *unused)
477 return 0; 476 return 0;
478} 477}
479 478
480struct pt_regs * __devinit idle_regs(struct pt_regs *regs) 479struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
481{ 480{
482 return NULL; 481 return NULL;
483} 482}
@@ -767,17 +766,6 @@ void __cpu_die(unsigned int cpu)
767 } 766 }
768 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 767 printk(KERN_ERR "CPU %u didn't die...\n", cpu);
769} 768}
770#else /* !CONFIG_HOTPLUG_CPU */
771int __cpu_disable(void)
772{
773 return -ENOSYS;
774}
775
776void __cpu_die(unsigned int cpu)
777{
778 /* We said "no" in __cpu_disable */
779 BUG();
780}
781#endif /* CONFIG_HOTPLUG_CPU */ 769#endif /* CONFIG_HOTPLUG_CPU */
782 770
783void 771void
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 2bb84214e5f1..3ab042720970 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -344,33 +344,6 @@ udelay (unsigned long usecs)
344} 344}
345EXPORT_SYMBOL(udelay); 345EXPORT_SYMBOL(udelay);
346 346
347static unsigned long long ia64_itc_printk_clock(void)
348{
349 if (ia64_get_kr(IA64_KR_PER_CPU_DATA))
350 return sched_clock();
351 return 0;
352}
353
354static unsigned long long ia64_default_printk_clock(void)
355{
356 return (unsigned long long)(jiffies_64 - INITIAL_JIFFIES) *
357 (1000000000/HZ);
358}
359
360unsigned long long (*ia64_printk_clock)(void) = &ia64_default_printk_clock;
361
362unsigned long long printk_clock(void)
363{
364 return ia64_printk_clock();
365}
366
367void __init
368ia64_setup_printk_clock(void)
369{
370 if (!(sal_platform_features & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT))
371 ia64_printk_clock = ia64_itc_printk_clock;
372}
373
374/* IA64 doesn't cache the timezone */ 347/* IA64 doesn't cache the timezone */
375void update_vsyscall_tz(void) 348void update_vsyscall_tz(void)
376{ 349{
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index 14261fee5f4d..a2484fc1a06c 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -354,27 +354,27 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
354 if (unlikely(retval < 0)) 354 if (unlikely(retval < 0))
355 return retval; 355 return retval;
356 356
357 all_cpu_cache_info[cpu].kobj.parent = &sys_dev->kobj; 357 retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj,
358 kobject_set_name(&all_cpu_cache_info[cpu].kobj, "%s", "cache"); 358 &cache_ktype_percpu_entry, &sys_dev->kobj,
359 all_cpu_cache_info[cpu].kobj.ktype = &cache_ktype_percpu_entry; 359 "%s", "cache");
360 retval = kobject_register(&all_cpu_cache_info[cpu].kobj);
361 360
362 for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) { 361 for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) {
363 this_object = LEAF_KOBJECT_PTR(cpu,i); 362 this_object = LEAF_KOBJECT_PTR(cpu,i);
364 this_object->kobj.parent = &all_cpu_cache_info[cpu].kobj; 363 retval = kobject_init_and_add(&(this_object->kobj),
365 kobject_set_name(&(this_object->kobj), "index%1lu", i); 364 &cache_ktype,
366 this_object->kobj.ktype = &cache_ktype; 365 &all_cpu_cache_info[cpu].kobj,
367 retval = kobject_register(&(this_object->kobj)); 366 "index%1lu", i);
368 if (unlikely(retval)) { 367 if (unlikely(retval)) {
369 for (j = 0; j < i; j++) { 368 for (j = 0; j < i; j++) {
370 kobject_unregister( 369 kobject_put(&(LEAF_KOBJECT_PTR(cpu,j)->kobj));
371 &(LEAF_KOBJECT_PTR(cpu,j)->kobj));
372 } 370 }
373 kobject_unregister(&all_cpu_cache_info[cpu].kobj); 371 kobject_put(&all_cpu_cache_info[cpu].kobj);
374 cpu_cache_sysfs_exit(cpu); 372 cpu_cache_sysfs_exit(cpu);
375 break; 373 break;
376 } 374 }
375 kobject_uevent(&(this_object->kobj), KOBJ_ADD);
377 } 376 }
377 kobject_uevent(&all_cpu_cache_info[cpu].kobj, KOBJ_ADD);
378 return retval; 378 return retval;
379} 379}
380 380
@@ -385,10 +385,10 @@ static int __cpuinit cache_remove_dev(struct sys_device * sys_dev)
385 unsigned long i; 385 unsigned long i;
386 386
387 for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) 387 for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++)
388 kobject_unregister(&(LEAF_KOBJECT_PTR(cpu,i)->kobj)); 388 kobject_put(&(LEAF_KOBJECT_PTR(cpu,i)->kobj));
389 389
390 if (all_cpu_cache_info[cpu].kobj.parent) { 390 if (all_cpu_cache_info[cpu].kobj.parent) {
391 kobject_unregister(&all_cpu_cache_info[cpu].kobj); 391 kobject_put(&all_cpu_cache_info[cpu].kobj);
392 memset(&all_cpu_cache_info[cpu].kobj, 392 memset(&all_cpu_cache_info[cpu].kobj,
393 0, 393 0,
394 sizeof(struct kobject)); 394 sizeof(struct kobject));
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index 78d65cb947d2..f0cda765e681 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -35,7 +35,7 @@ trap_init (void)
35 fpswa_interface = __va(ia64_boot_param->fpswa); 35 fpswa_interface = __va(ia64_boot_param->fpswa);
36} 36}
37 37
38void 38int
39die (const char *str, struct pt_regs *regs, long err) 39die (const char *str, struct pt_regs *regs, long err)
40{ 40{
41 static struct { 41 static struct {
@@ -62,8 +62,11 @@ die (const char *str, struct pt_regs *regs, long err)
62 if (++die.lock_owner_depth < 3) { 62 if (++die.lock_owner_depth < 3) {
63 printk("%s[%d]: %s %ld [%d]\n", 63 printk("%s[%d]: %s %ld [%d]\n",
64 current->comm, task_pid_nr(current), str, err, ++die_counter); 64 current->comm, task_pid_nr(current), str, err, ++die_counter);
65 (void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 65 if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV)
66 show_regs(regs); 66 != NOTIFY_STOP)
67 show_regs(regs);
68 else
69 regs = NULL;
67 } else 70 } else
68 printk(KERN_ERR "Recursive die() failure, output suppressed\n"); 71 printk(KERN_ERR "Recursive die() failure, output suppressed\n");
69 72
@@ -72,17 +75,22 @@ die (const char *str, struct pt_regs *regs, long err)
72 add_taint(TAINT_DIE); 75 add_taint(TAINT_DIE);
73 spin_unlock_irq(&die.lock); 76 spin_unlock_irq(&die.lock);
74 77
78 if (!regs)
79 return 1;
80
75 if (panic_on_oops) 81 if (panic_on_oops)
76 panic("Fatal exception"); 82 panic("Fatal exception");
77 83
78 do_exit(SIGSEGV); 84 do_exit(SIGSEGV);
85 return 0;
79} 86}
80 87
81void 88int
82die_if_kernel (char *str, struct pt_regs *regs, long err) 89die_if_kernel (char *str, struct pt_regs *regs, long err)
83{ 90{
84 if (!user_mode(regs)) 91 if (!user_mode(regs))
85 die(str, regs, err); 92 return die(str, regs, err);
93 return 0;
86} 94}
87 95
88void 96void
@@ -102,7 +110,8 @@ __kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs)
102 if (notify_die(DIE_BREAK, "break 0", regs, break_num, TRAP_BRKPT, SIGTRAP) 110 if (notify_die(DIE_BREAK, "break 0", regs, break_num, TRAP_BRKPT, SIGTRAP)
103 == NOTIFY_STOP) 111 == NOTIFY_STOP)
104 return; 112 return;
105 die_if_kernel("bugcheck!", regs, break_num); 113 if (die_if_kernel("bugcheck!", regs, break_num))
114 return;
106 sig = SIGILL; code = ILL_ILLOPC; 115 sig = SIGILL; code = ILL_ILLOPC;
107 break; 116 break;
108 117
@@ -155,8 +164,9 @@ __kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs)
155 break; 164 break;
156 165
157 default: 166 default:
158 if (break_num < 0x40000 || break_num > 0x100000) 167 if ((break_num < 0x40000 || break_num > 0x100000)
159 die_if_kernel("Bad break", regs, break_num); 168 && die_if_kernel("Bad break", regs, break_num))
169 return;
160 170
161 if (break_num < 0x80000) { 171 if (break_num < 0x80000) {
162 sig = SIGILL; code = __ILL_BREAK; 172 sig = SIGILL; code = __ILL_BREAK;
@@ -402,14 +412,15 @@ ia64_illegal_op_fault (unsigned long ec, long arg1, long arg2, long arg3,
402#endif 412#endif
403 413
404 sprintf(buf, "IA-64 Illegal operation fault"); 414 sprintf(buf, "IA-64 Illegal operation fault");
405 die_if_kernel(buf, &regs, 0); 415 rv.fkt = 0;
416 if (die_if_kernel(buf, &regs, 0))
417 return rv;
406 418
407 memset(&si, 0, sizeof(si)); 419 memset(&si, 0, sizeof(si));
408 si.si_signo = SIGILL; 420 si.si_signo = SIGILL;
409 si.si_code = ILL_ILLOPC; 421 si.si_code = ILL_ILLOPC;
410 si.si_addr = (void __user *) (regs.cr_iip + ia64_psr(&regs)->ri); 422 si.si_addr = (void __user *) (regs.cr_iip + ia64_psr(&regs)->ri);
411 force_sig_info(SIGILL, &si, current); 423 force_sig_info(SIGILL, &si, current);
412 rv.fkt = 0;
413 return rv; 424 return rv;
414} 425}
415 426
@@ -644,6 +655,6 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
644 sprintf(buf, "Fault %lu", vector); 655 sprintf(buf, "Fault %lu", vector);
645 break; 656 break;
646 } 657 }
647 die_if_kernel(buf, &regs, error); 658 if (!die_if_kernel(buf, &regs, error))
648 force_sig(SIGILL, current); 659 force_sig(SIGILL, current);
649} 660}
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index 2173de9fe917..52f70bbc192a 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -23,7 +23,7 @@
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24#include <asm/unaligned.h> 24#include <asm/unaligned.h>
25 25
26extern void die_if_kernel(char *str, struct pt_regs *regs, long err); 26extern int die_if_kernel(char *str, struct pt_regs *regs, long err);
27 27
28#undef DEBUG_UNALIGNED_TRAP 28#undef DEBUG_UNALIGNED_TRAP
29 29
@@ -675,8 +675,9 @@ emulate_load_updates (update_t type, load_store_t ld, struct pt_regs *regs, unsi
675 */ 675 */
676 if (ld.x6_op == 1 || ld.x6_op == 3) { 676 if (ld.x6_op == 1 || ld.x6_op == 3) {
677 printk(KERN_ERR "%s: register update on speculative load, error\n", __FUNCTION__); 677 printk(KERN_ERR "%s: register update on speculative load, error\n", __FUNCTION__);
678 die_if_kernel("unaligned reference on speculative load with register update\n", 678 if (die_if_kernel("unaligned reference on speculative load with register update\n",
679 regs, 30); 679 regs, 30))
680 return;
680 } 681 }
681 682
682 683
@@ -1317,7 +1318,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1317 1318
1318 if (ia64_psr(regs)->be) { 1319 if (ia64_psr(regs)->be) {
1319 /* we don't support big-endian accesses */ 1320 /* we don't support big-endian accesses */
1320 die_if_kernel("big-endian unaligned accesses are not supported", regs, 0); 1321 if (die_if_kernel("big-endian unaligned accesses are not supported", regs, 0))
1322 return;
1321 goto force_sigbus; 1323 goto force_sigbus;
1322 } 1324 }
1323 1325
@@ -1488,16 +1490,19 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1488 case LDFA_OP: 1490 case LDFA_OP:
1489 case LDFCCLR_OP: 1491 case LDFCCLR_OP:
1490 case LDFCNC_OP: 1492 case LDFCNC_OP:
1491 case LDF_IMM_OP:
1492 case LDFA_IMM_OP:
1493 case LDFCCLR_IMM_OP:
1494 case LDFCNC_IMM_OP:
1495 if (u.insn.x) 1493 if (u.insn.x)
1496 ret = emulate_load_floatpair(ifa, u.insn, regs); 1494 ret = emulate_load_floatpair(ifa, u.insn, regs);
1497 else 1495 else
1498 ret = emulate_load_float(ifa, u.insn, regs); 1496 ret = emulate_load_float(ifa, u.insn, regs);
1499 break; 1497 break;
1500 1498
1499 case LDF_IMM_OP:
1500 case LDFA_IMM_OP:
1501 case LDFCCLR_IMM_OP:
1502 case LDFCNC_IMM_OP:
1503 ret = emulate_load_float(ifa, u.insn, regs);
1504 break;
1505
1501 case STF_OP: 1506 case STF_OP:
1502 case STF_IMM_OP: 1507 case STF_IMM_OP:
1503 ret = emulate_store_float(ifa, u.insn, regs); 1508 ret = emulate_store_float(ifa, u.insn, regs);
@@ -1531,7 +1536,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1531 ia64_handle_exception(regs, eh); 1536 ia64_handle_exception(regs, eh);
1532 goto done; 1537 goto done;
1533 } 1538 }
1534 die_if_kernel("error during unaligned kernel access\n", regs, ret); 1539 if (die_if_kernel("error during unaligned kernel access\n", regs, ret))
1540 return;
1535 /* NOT_REACHED */ 1541 /* NOT_REACHED */
1536 } 1542 }
1537 force_sigbus: 1543 force_sigbus:
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index a7be4f203420..2a90c32024f4 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -118,7 +118,7 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
118 for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++) 118 for (i = 0; i < (IA64_GRANULE_SIZE / PAGE_SIZE); i++)
119 SetPageUncached(&page[i]); 119 SetPageUncached(&page[i]);
120 120
121 flush_tlb_kernel_range(uc_addr, uc_adddr + IA64_GRANULE_SIZE); 121 flush_tlb_kernel_range(uc_addr, uc_addr + IA64_GRANULE_SIZE);
122 122
123 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); 123 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
124 if (status == PAL_VISIBILITY_OK_REMOTE_NEEDED) { 124 if (status == PAL_VISIBILITY_OK_REMOTE_NEEDED) {
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 757e419ebcf8..80622acc95de 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -27,8 +27,8 @@ SECTIONS
27{ 27{
28 /* Sections to be discarded */ 28 /* Sections to be discarded */
29 /DISCARD/ : { 29 /DISCARD/ : {
30 *(.exit.text) 30 EXIT_TEXT
31 *(.exit.data) 31 EXIT_DATA
32 *(.exitcall.exit) 32 *(.exitcall.exit)
33 *(.IA_64.unwind.exit.text) 33 *(.IA_64.unwind.exit.text)
34 *(.IA_64.unwind_info.exit.text) 34 *(.IA_64.unwind_info.exit.text)
@@ -119,12 +119,12 @@ SECTIONS
119 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) 119 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET)
120 { 120 {
121 _sinittext = .; 121 _sinittext = .;
122 *(.init.text) 122 INIT_TEXT
123 _einittext = .; 123 _einittext = .;
124 } 124 }
125 125
126 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) 126 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET)
127 { *(.init.data) } 127 { INIT_DATA }
128 128
129#ifdef CONFIG_BLK_DEV_INITRD 129#ifdef CONFIG_BLK_DEV_INITRD
130 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) 130 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET)
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 7571076a16a1..3e69881648a3 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -16,7 +16,7 @@
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18 18
19extern void die (char *, struct pt_regs *, long); 19extern int die(char *, struct pt_regs *, long);
20 20
21#ifdef CONFIG_KPROBES 21#ifdef CONFIG_KPROBES
22static inline int notify_page_fault(struct pt_regs *regs, int trap) 22static inline int notify_page_fault(struct pt_regs *regs, int trap)
@@ -267,9 +267,11 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
267 else 267 else
268 printk(KERN_ALERT "Unable to handle kernel paging request at " 268 printk(KERN_ALERT "Unable to handle kernel paging request at "
269 "virtual address %016lx\n", address); 269 "virtual address %016lx\n", address);
270 die("Oops", regs, isr); 270 if (die("Oops", regs, isr))
271 regs = NULL;
271 bust_spinlocks(0); 272 bust_spinlocks(0);
272 do_exit(SIGKILL); 273 if (regs)
274 do_exit(SIGKILL);
273 return; 275 return;
274 276
275 out_of_memory: 277 out_of_memory:
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index cef164729db7..655da240d13c 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -10,6 +10,7 @@
10 * IPI based ptc implementation and A-step IPI implementation. 10 * IPI based ptc implementation and A-step IPI implementation.
11 * Rohit Seth <rohit.seth@intel.com> 11 * Rohit Seth <rohit.seth@intel.com>
12 * Ken Chen <kenneth.w.chen@intel.com> 12 * Ken Chen <kenneth.w.chen@intel.com>
13 * Christophe de Dinechin <ddd@hp.com>: Avoid ptc.e on memory allocation
13 */ 14 */
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -89,9 +90,16 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
89{ 90{
90 static DEFINE_SPINLOCK(ptcg_lock); 91 static DEFINE_SPINLOCK(ptcg_lock);
91 92
92 if (mm != current->active_mm || !current->mm) { 93 struct mm_struct *active_mm = current->active_mm;
93 flush_tlb_all(); 94
94 return; 95 if (mm != active_mm) {
96 /* Restore region IDs for mm */
97 if (mm && active_mm) {
98 activate_context(mm);
99 } else {
100 flush_tlb_all();
101 return;
102 }
95 } 103 }
96 104
97 /* HW requires global serialization of ptc.ga. */ 105 /* HW requires global serialization of ptc.ga. */
@@ -107,6 +115,10 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
107 } while (start < end); 115 } while (start < end);
108 } 116 }
109 spin_unlock(&ptcg_lock); 117 spin_unlock(&ptcg_lock);
118
119 if (mm != active_mm) {
120 activate_context(active_mm);
121 }
110} 122}
111 123
112void 124void
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c
index b362d6d6a8c8..9456d4034024 100644
--- a/arch/ia64/sn/kernel/bte.c
+++ b/arch/ia64/sn/kernel/bte.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2000-2006 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9#include <linux/module.h> 9#include <linux/module.h>
@@ -227,7 +227,7 @@ retry_bteop:
227 BTE_LNSTAT_LOAD(bte), *bte->most_rcnt_na)); 227 BTE_LNSTAT_LOAD(bte), *bte->most_rcnt_na));
228 228
229 if (transfer_stat & IBLS_ERROR) { 229 if (transfer_stat & IBLS_ERROR) {
230 bte_status = transfer_stat & ~IBLS_ERROR; 230 bte_status = BTE_GET_ERROR_STATUS(transfer_stat);
231 } else { 231 } else {
232 bte_status = BTE_SUCCESS; 232 bte_status = BTE_SUCCESS;
233 } 233 }
diff --git a/arch/ia64/sn/kernel/bte_error.c b/arch/ia64/sn/kernel/bte_error.c
index 27c5936ccfe9..4cb09f3f1efc 100644
--- a/arch/ia64/sn/kernel/bte_error.c
+++ b/arch/ia64/sn/kernel/bte_error.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2000-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9#include <linux/types.h> 9#include <linux/types.h>
@@ -148,7 +148,11 @@ int shub2_bte_error_handler(unsigned long _nodepda)
148 for (i = 0; i < BTES_PER_NODE; i++) { 148 for (i = 0; i < BTES_PER_NODE; i++) {
149 bte = &err_nodepda->bte_if[i]; 149 bte = &err_nodepda->bte_if[i];
150 status = BTE_LNSTAT_LOAD(bte); 150 status = BTE_LNSTAT_LOAD(bte);
151 if ((status & IBLS_ERROR) || !(status & IBLS_BUSY)) 151 if (status & IBLS_ERROR) {
152 bte->bh_error = BTE_SHUB2_ERROR(status);
153 continue;
154 }
155 if (!(status & IBLS_BUSY))
152 continue; 156 continue;
153 mod_timer(recovery_timer, jiffies + (HZ * 5)); 157 mod_timer(recovery_timer, jiffies + (HZ * 5));
154 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda, 158 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 1f38a3a68390..bb1d24929640 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -64,7 +64,6 @@ extern void sn_timer_init(void);
64extern unsigned long last_time_offset; 64extern unsigned long last_time_offset;
65extern void (*ia64_mark_idle) (int); 65extern void (*ia64_mark_idle) (int);
66extern void snidle(int); 66extern void snidle(int);
67extern unsigned long long (*ia64_printk_clock)(void);
68 67
69unsigned long sn_rtc_cycles_per_second; 68unsigned long sn_rtc_cycles_per_second;
70EXPORT_SYMBOL(sn_rtc_cycles_per_second); 69EXPORT_SYMBOL(sn_rtc_cycles_per_second);
@@ -360,14 +359,6 @@ sn_scan_pcdp(void)
360 359
361static unsigned long sn2_rtc_initial; 360static unsigned long sn2_rtc_initial;
362 361
363static unsigned long long ia64_sn2_printk_clock(void)
364{
365 unsigned long rtc_now = rtc_time();
366
367 return (rtc_now - sn2_rtc_initial) *
368 (1000000000 / sn_rtc_cycles_per_second);
369}
370
371/** 362/**
372 * sn_setup - SN platform setup routine 363 * sn_setup - SN platform setup routine
373 * @cmdline_p: kernel command line 364 * @cmdline_p: kernel command line
@@ -468,8 +459,6 @@ void __init sn_setup(char **cmdline_p)
468 459
469 platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR; 460 platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR;
470 461
471 ia64_printk_clock = ia64_sn2_printk_clock;
472
473 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF); 462 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
474 463
475 /* 464 /*
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index f3c69329e145..dfc6bf1c7b41 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -523,7 +523,7 @@ static ssize_t sn2_ptc_proc_write(struct file *file, const char __user *user, si
523 return count; 523 return count;
524} 524}
525 525
526static struct seq_operations sn2_ptc_seq_ops = { 526static const struct seq_operations sn2_ptc_seq_ops = {
527 .start = sn2_ptc_seq_start, 527 .start = sn2_ptc_seq_start,
528 .next = sn2_ptc_seq_next, 528 .next = sn2_ptc_seq_next,
529 .stop = sn2_ptc_seq_stop, 529 .stop = sn2_ptc_seq_stop,
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index 1a8e49607f11..4b0d1538e7e5 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -33,6 +33,7 @@
33#include <linux/smp_lock.h> 33#include <linux/smp_lock.h>
34#include <linux/nodemask.h> 34#include <linux/nodemask.h>
35#include <linux/smp.h> 35#include <linux/smp.h>
36#include <linux/mutex.h>
36 37
37#include <asm/processor.h> 38#include <asm/processor.h>
38#include <asm/topology.h> 39#include <asm/topology.h>
@@ -50,7 +51,7 @@ static void *sn_hwperf_salheap = NULL;
50static int sn_hwperf_obj_cnt = 0; 51static int sn_hwperf_obj_cnt = 0;
51static nasid_t sn_hwperf_master_nasid = INVALID_NASID; 52static nasid_t sn_hwperf_master_nasid = INVALID_NASID;
52static int sn_hwperf_init(void); 53static int sn_hwperf_init(void);
53static DECLARE_MUTEX(sn_hwperf_init_mutex); 54static DEFINE_MUTEX(sn_hwperf_init_mutex);
54 55
55#define cnode_possible(n) ((n) < num_cnodes) 56#define cnode_possible(n) ((n) < num_cnodes)
56 57
@@ -577,7 +578,7 @@ static void sn_topology_stop(struct seq_file *m, void *v)
577/* 578/*
578 * /proc/sgi_sn/sn_topology, read-only using seq_file 579 * /proc/sgi_sn/sn_topology, read-only using seq_file
579 */ 580 */
580static struct seq_operations sn_topology_seq_ops = { 581static const struct seq_operations sn_topology_seq_ops = {
581 .start = sn_topology_start, 582 .start = sn_topology_start,
582 .next = sn_topology_next, 583 .next = sn_topology_next,
583 .stop = sn_topology_stop, 584 .stop = sn_topology_stop,
@@ -884,10 +885,10 @@ static int sn_hwperf_init(void)
884 int e = 0; 885 int e = 0;
885 886
886 /* single threaded, once-only initialization */ 887 /* single threaded, once-only initialization */
887 down(&sn_hwperf_init_mutex); 888 mutex_lock(&sn_hwperf_init_mutex);
888 889
889 if (sn_hwperf_salheap) { 890 if (sn_hwperf_salheap) {
890 up(&sn_hwperf_init_mutex); 891 mutex_unlock(&sn_hwperf_init_mutex);
891 return e; 892 return e;
892 } 893 }
893 894
@@ -936,7 +937,7 @@ out:
936 sn_hwperf_salheap = NULL; 937 sn_hwperf_salheap = NULL;
937 sn_hwperf_obj_cnt = 0; 938 sn_hwperf_obj_cnt = 0;
938 } 939 }
939 up(&sn_hwperf_init_mutex); 940 mutex_unlock(&sn_hwperf_init_mutex);
940 return e; 941 return e;
941} 942}
942 943
diff --git a/arch/ia64/sn/kernel/xp_nofault.S b/arch/ia64/sn/kernel/xp_nofault.S
index 54e8973b6e99..98e7c7dbfdd8 100644
--- a/arch/ia64/sn/kernel/xp_nofault.S
+++ b/arch/ia64/sn/kernel/xp_nofault.S
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2007 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -14,6 +14,11 @@
14 * PIO read fails, the MCA handler will force the error to look 14 * PIO read fails, the MCA handler will force the error to look
15 * corrected and vector to the xp_error_PIOR which will return an error. 15 * corrected and vector to the xp_error_PIOR which will return an error.
16 * 16 *
17 * The definition of "consumption" and the time it takes for an MCA
18 * to surface is processor implementation specific. This code
19 * is sufficient on Itanium through the Montvale processor family.
20 * It may need to be adjusted for future processor implementations.
21 *
17 * extern int xp_nofault_PIOR(void *remote_register); 22 * extern int xp_nofault_PIOR(void *remote_register);
18 */ 23 */
19 24
@@ -22,11 +27,10 @@ xp_nofault_PIOR:
22 mov r8=r0 // Stage a success return value 27 mov r8=r0 // Stage a success return value
23 ld8.acq r9=[r32];; // PIO Read the specified register 28 ld8.acq r9=[r32];; // PIO Read the specified register
24 adds r9=1,r9;; // Add to force consumption 29 adds r9=1,r9;; // Add to force consumption
25 or r9=r9,r9;; // Or to force consumption 30 srlz.i;; // Allow time for MCA to surface
26 br.ret.sptk.many b0;; // Return success 31 br.ret.sptk.many b0;; // Return success
27 32
28 .global xp_error_PIOR 33 .global xp_error_PIOR
29xp_error_PIOR: 34xp_error_PIOR:
30 mov r8=1 // Return value of 1 35 mov r8=1 // Return value of 1
31 br.ret.sptk.many b0;; // Return failure 36 br.ret.sptk.many b0;; // Return failure
32
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index ab3eaf85fe4d..2c676cc05418 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -100,11 +100,11 @@ u16 sn_ioboard_to_pci_bus(struct pci_bus *pci_bus)
100static irqreturn_t 100static irqreturn_t
101pcibr_error_intr_handler(int irq, void *arg) 101pcibr_error_intr_handler(int irq, void *arg)
102{ 102{
103 struct pcibus_info *soft = (struct pcibus_info *)arg; 103 struct pcibus_info *soft = arg;
104 104
105 if (sal_pcibr_error_interrupt(soft) < 0) { 105 if (sal_pcibr_error_interrupt(soft) < 0)
106 panic("pcibr_error_intr_handler(): Fatal Bridge Error"); 106 panic("pcibr_error_intr_handler(): Fatal Bridge Error");
107 } 107
108 return IRQ_HANDLED; 108 return IRQ_HANDLED;
109} 109}
110 110
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index cee9379d44e0..e1a3e19d3d9c 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -41,7 +41,7 @@
41 * } else 41 * } else
42 * do desired mmr access 42 * do desired mmr access
43 * 43 *
44 * According to hw, we can use reads instead of writes to the above addres 44 * According to hw, we can use reads instead of writes to the above address
45 * 45 *
46 * Note this WAR can only to be used for accessing internal MMR's in the 46 * Note this WAR can only to be used for accessing internal MMR's in the
47 * TIOCE Coretalk Address Range 0x0 - 0x07ff_ffff. This includes the 47 * TIOCE Coretalk Address Range 0x0 - 0x07ff_ffff. This includes the