aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/ia64
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/Kconfig43
-rw-r--r--arch/ia64/configs/generic_defconfig2
-rw-r--r--arch/ia64/configs/gensparse_defconfig2
-rw-r--r--arch/ia64/configs/tiger_defconfig1
-rw-r--r--arch/ia64/configs/xen_domu_defconfig1
-rw-r--r--arch/ia64/configs/zx1_defconfig1
-rw-r--r--arch/ia64/dig/setup.c2
-rw-r--r--arch/ia64/hp/common/aml_nfw.c2
-rw-r--r--arch/ia64/hp/common/hwsw_iommu.c1
-rw-r--r--arch/ia64/hp/common/sba_iommu.c24
-rw-r--r--arch/ia64/hp/sim/boot/bootloader.c1
-rw-r--r--arch/ia64/hp/sim/boot/fw-emu.c18
-rw-r--r--arch/ia64/hp/sim/hpsim_irq.c36
-rw-r--r--arch/ia64/hp/sim/hpsim_setup.c6
-rw-r--r--arch/ia64/hp/sim/simeth.c32
-rw-r--r--arch/ia64/hp/sim/simserial.c709
-rw-r--r--arch/ia64/include/asm/Kbuild17
-rw-r--r--arch/ia64/include/asm/acpi.h3
-rw-r--r--arch/ia64/include/asm/atomic.h5
-rw-r--r--arch/ia64/include/asm/barrier.h68
-rw-r--r--arch/ia64/include/asm/cputime.h73
-rw-r--r--arch/ia64/include/asm/device.h3
-rw-r--r--arch/ia64/include/asm/dma-mapping.h19
-rw-r--r--arch/ia64/include/asm/futex.h10
-rw-r--r--arch/ia64/include/asm/gcc_intrin.h615
-rw-r--r--arch/ia64/include/asm/gpio.h59
-rw-r--r--arch/ia64/include/asm/hpsim.h2
-rw-r--r--arch/ia64/include/asm/hugetlb.h4
-rw-r--r--arch/ia64/include/asm/intrinsics.h243
-rw-r--r--arch/ia64/include/asm/io.h3
-rw-r--r--arch/ia64/include/asm/iommu.h2
-rw-r--r--arch/ia64/include/asm/iosapic.h11
-rw-r--r--arch/ia64/include/asm/irq_remapping.h4
-rw-r--r--arch/ia64/include/asm/irqflags.h2
-rw-r--r--arch/ia64/include/asm/kexec.h1
-rw-r--r--arch/ia64/include/asm/kvm_host.h6
-rw-r--r--arch/ia64/include/asm/machvec.h2
-rw-r--r--arch/ia64/include/asm/machvec_dig.h2
-rw-r--r--arch/ia64/include/asm/machvec_dig_vtd.h2
-rw-r--r--arch/ia64/include/asm/machvec_hpsim.h2
-rw-r--r--arch/ia64/include/asm/machvec_hpzx1.h2
-rw-r--r--arch/ia64/include/asm/machvec_hpzx1_swiotlb.h2
-rw-r--r--arch/ia64/include/asm/machvec_sn2.h2
-rw-r--r--arch/ia64/include/asm/machvec_uv.h2
-rw-r--r--arch/ia64/include/asm/machvec_xen.h2
-rw-r--r--arch/ia64/include/asm/mca_asm.h2
-rw-r--r--arch/ia64/include/asm/mman.h12
-rw-r--r--arch/ia64/include/asm/module.h6
-rw-r--r--arch/ia64/include/asm/numa.h2
-rw-r--r--arch/ia64/include/asm/page.h10
-rw-r--r--arch/ia64/include/asm/param.h22
-rw-r--r--arch/ia64/include/asm/paravirt.h6
-rw-r--r--arch/ia64/include/asm/parport.h5
-rw-r--r--arch/ia64/include/asm/pci.h20
-rw-r--r--arch/ia64/include/asm/perfmon.h171
-rw-r--r--arch/ia64/include/asm/pgtable.h1
-rw-r--r--arch/ia64/include/asm/processor.h32
-rw-r--r--arch/ia64/include/asm/ptrace.h254
-rw-r--r--arch/ia64/include/asm/sal.h1
-rw-r--r--arch/ia64/include/asm/siginfo.h118
-rw-r--r--arch/ia64/include/asm/signal.h124
-rw-r--r--arch/ia64/include/asm/smp.h2
-rw-r--r--arch/ia64/include/asm/sn/pda.h1
-rw-r--r--arch/ia64/include/asm/spinlock.h1
-rw-r--r--arch/ia64/include/asm/switch_to.h79
-rw-r--r--arch/ia64/include/asm/termios.h46
-rw-r--r--arch/ia64/include/asm/thread_info.h25
-rw-r--r--arch/ia64/include/asm/topology.h25
-rw-r--r--arch/ia64/include/asm/types.h21
-rw-r--r--arch/ia64/include/asm/unistd.h323
-rw-r--r--arch/ia64/include/asm/ustack.h11
-rw-r--r--arch/ia64/include/asm/uv/uv.h1
-rw-r--r--arch/ia64/include/asm/xen/interface.h12
-rw-r--r--arch/ia64/include/uapi/asm/Kbuild50
-rw-r--r--arch/ia64/include/uapi/asm/auxvec.h13
-rw-r--r--arch/ia64/include/uapi/asm/bitsperlong.h8
-rw-r--r--arch/ia64/include/uapi/asm/break.h32
-rw-r--r--arch/ia64/include/uapi/asm/byteorder.h6
-rw-r--r--arch/ia64/include/uapi/asm/cmpxchg.h147
-rw-r--r--arch/ia64/include/uapi/asm/errno.h1
-rw-r--r--arch/ia64/include/uapi/asm/fcntl.h13
-rw-r--r--arch/ia64/include/uapi/asm/fpu.h66
-rw-r--r--arch/ia64/include/uapi/asm/gcc_intrin.h618
-rw-r--r--arch/ia64/include/uapi/asm/ia64regs.h100
-rw-r--r--arch/ia64/include/uapi/asm/intel_intrin.h161
-rw-r--r--arch/ia64/include/uapi/asm/intrinsics.h124
-rw-r--r--arch/ia64/include/uapi/asm/ioctl.h1
-rw-r--r--arch/ia64/include/uapi/asm/ioctls.h6
-rw-r--r--arch/ia64/include/uapi/asm/ipcbuf.h1
-rw-r--r--arch/ia64/include/uapi/asm/kvm.h269
-rw-r--r--arch/ia64/include/uapi/asm/mman.h16
-rw-r--r--arch/ia64/include/uapi/asm/msgbuf.h27
-rw-r--r--arch/ia64/include/uapi/asm/param.h29
-rw-r--r--arch/ia64/include/uapi/asm/perfmon.h177
-rw-r--r--arch/ia64/include/uapi/asm/perfmon_default_smpl.h83
-rw-r--r--arch/ia64/include/uapi/asm/poll.h1
-rw-r--r--arch/ia64/include/uapi/asm/posix_types.h8
-rw-r--r--arch/ia64/include/uapi/asm/ptrace.h247
-rw-r--r--arch/ia64/include/uapi/asm/ptrace_offsets.h268
-rw-r--r--arch/ia64/include/uapi/asm/resource.h7
-rw-r--r--arch/ia64/include/uapi/asm/rse.h66
-rw-r--r--arch/ia64/include/uapi/asm/sembuf.h22
-rw-r--r--arch/ia64/include/uapi/asm/setup.h24
-rw-r--r--arch/ia64/include/uapi/asm/shmbuf.h38
-rw-r--r--arch/ia64/include/uapi/asm/sigcontext.h70
-rw-r--r--arch/ia64/include/uapi/asm/siginfo.h121
-rw-r--r--arch/ia64/include/uapi/asm/signal.h121
-rw-r--r--arch/ia64/include/uapi/asm/socket.h82
-rw-r--r--arch/ia64/include/uapi/asm/sockios.h20
-rw-r--r--arch/ia64/include/uapi/asm/stat.h51
-rw-r--r--arch/ia64/include/uapi/asm/statfs.h20
-rw-r--r--arch/ia64/include/uapi/asm/swab.h34
-rw-r--r--arch/ia64/include/uapi/asm/termbits.h208
-rw-r--r--arch/ia64/include/uapi/asm/termios.h50
-rw-r--r--arch/ia64/include/uapi/asm/types.h31
-rw-r--r--arch/ia64/include/uapi/asm/ucontext.h12
-rw-r--r--arch/ia64/include/uapi/asm/unistd.h329
-rw-r--r--arch/ia64/include/uapi/asm/ustack.h12
-rw-r--r--arch/ia64/kernel/acpi.c40
-rw-r--r--arch/ia64/kernel/asm-offsets.c4
-rw-r--r--arch/ia64/kernel/dma-mapping.c1
-rw-r--r--arch/ia64/kernel/efi.c3
-rw-r--r--arch/ia64/kernel/entry.S57
-rw-r--r--arch/ia64/kernel/err_inject.c52
-rw-r--r--arch/ia64/kernel/fsys.S194
-rw-r--r--arch/ia64/kernel/fsyscall_gtod_data.h2
-rw-r--r--arch/ia64/kernel/gate.S3
-rw-r--r--arch/ia64/kernel/gate.lds.S3
-rw-r--r--arch/ia64/kernel/head.S14
-rw-r--r--arch/ia64/kernel/ia64_ksyms.c2
-rw-r--r--arch/ia64/kernel/iosapic.c20
-rw-r--r--arch/ia64/kernel/irq_ia64.c10
-rw-r--r--arch/ia64/kernel/ivt.S1
-rw-r--r--arch/ia64/kernel/machine_kexec.c9
-rw-r--r--arch/ia64/kernel/machvec.c1
-rw-r--r--arch/ia64/kernel/mca.c9
-rw-r--r--arch/ia64/kernel/mca_drv.c4
-rw-r--r--arch/ia64/kernel/msi_ia64.c4
-rw-r--r--arch/ia64/kernel/paravirt.c4
-rw-r--r--arch/ia64/kernel/patch.c1
-rw-r--r--arch/ia64/kernel/pci-dma.c2
-rw-r--r--arch/ia64/kernel/pci-swiotlb.c14
-rw-r--r--arch/ia64/kernel/perfmon.c84
-rw-r--r--arch/ia64/kernel/process.c195
-rw-r--r--arch/ia64/kernel/ptrace.c19
-rw-r--r--arch/ia64/kernel/setup.c22
-rw-r--r--arch/ia64/kernel/signal.c59
-rw-r--r--arch/ia64/kernel/smp.c3
-rw-r--r--arch/ia64/kernel/smpboot.c101
-rw-r--r--arch/ia64/kernel/sys_ia64.c19
-rw-r--r--arch/ia64/kernel/time.c84
-rw-r--r--arch/ia64/kernel/topology.c18
-rw-r--r--arch/ia64/kernel/traps.c1
-rw-r--r--arch/ia64/kernel/uncached.c1
-rw-r--r--arch/ia64/kernel/unwind.c1
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S1
-rw-r--r--arch/ia64/kvm/Kconfig2
-rw-r--r--arch/ia64/kvm/kvm-ia64.c117
-rw-r--r--arch/ia64/kvm/vmm.c6
-rw-r--r--arch/ia64/mm/contig.c3
-rw-r--r--arch/ia64/mm/fault.c48
-rw-r--r--arch/ia64/mm/init.c13
-rw-r--r--arch/ia64/mm/tlb.c3
-rw-r--r--arch/ia64/oprofile/backtrace.c1
-rw-r--r--arch/ia64/pci/fixup.c6
-rw-r--r--arch/ia64/pci/pci.c147
-rw-r--r--arch/ia64/sn/kernel/huberror.c2
-rw-r--r--arch/ia64/sn/kernel/io_acpi_init.c1
-rw-r--r--arch/ia64/sn/kernel/io_common.c8
-rw-r--r--arch/ia64/sn/kernel/io_init.c17
-rw-r--r--arch/ia64/sn/kernel/irq.c7
-rw-r--r--arch/ia64/sn/kernel/setup.c2
-rw-r--r--arch/ia64/sn/kernel/sn2/prominfo_proc.c1
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c1
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_hwperf.c15
-rw-r--r--arch/ia64/sn/kernel/sn2/timer.c1
-rw-r--r--arch/ia64/sn/kernel/tiocx.c8
-rw-r--r--arch/ia64/sn/pci/pci_dma.c9
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c1
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c5
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c6
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c1
-rw-r--r--arch/ia64/xen/grant-table.c62
-rw-r--r--arch/ia64/xen/hypervisor.c1
-rw-r--r--arch/ia64/xen/irq_xen.c9
-rw-r--r--arch/ia64/xen/irq_xen.h2
-rw-r--r--arch/ia64/xen/xencomm.c3
-rw-r--r--arch/ia64/xen/xensetup.S1
188 files changed, 3816 insertions, 4927 deletions
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3279646120e..3ff7785b3be 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -23,25 +23,12 @@ config IA64
23 select HAVE_ARCH_TRACEHOOK 23 select HAVE_ARCH_TRACEHOOK
24 select HAVE_DMA_API_DEBUG 24 select HAVE_DMA_API_DEBUG
25 select HAVE_GENERIC_HARDIRQS 25 select HAVE_GENERIC_HARDIRQS
26 select HAVE_MEMBLOCK
27 select HAVE_MEMBLOCK_NODE_MAP
28 select HAVE_VIRT_CPU_ACCOUNTING
29 select ARCH_DISCARD_MEMBLOCK
30 select GENERIC_IRQ_PROBE 26 select GENERIC_IRQ_PROBE
31 select GENERIC_PENDING_IRQ if SMP 27 select GENERIC_PENDING_IRQ if SMP
32 select IRQ_PER_CPU 28 select IRQ_PER_CPU
33 select GENERIC_IRQ_SHOW 29 select GENERIC_IRQ_SHOW
34 select ARCH_WANT_OPTIONAL_GPIOLIB 30 select ARCH_WANT_OPTIONAL_GPIOLIB
35 select ARCH_HAVE_NMI_SAFE_CMPXCHG 31 select ARCH_HAVE_NMI_SAFE_CMPXCHG
36 select GENERIC_IOMAP
37 select GENERIC_SMP_IDLE_THREAD
38 select ARCH_INIT_TASK
39 select ARCH_TASK_STRUCT_ALLOCATOR
40 select ARCH_THREAD_INFO_ALLOCATOR
41 select ARCH_CLOCKSOURCE_DATA
42 select GENERIC_TIME_VSYSCALL_OLD
43 select HAVE_MOD_ARCH_SPECIFIC
44 select MODULES_USE_ELF_RELA
45 default y 32 default y
46 help 33 help
47 The Itanium Processor Family is Intel's 64-bit successor to 34 The Itanium Processor Family is Intel's 64-bit successor to
@@ -97,11 +84,15 @@ config GENERIC_CALIBRATE_DELAY
97 bool 84 bool
98 default y 85 default y
99 86
87config GENERIC_TIME_VSYSCALL
88 bool
89 default y
90
100config HAVE_SETUP_PER_CPU_AREA 91config HAVE_SETUP_PER_CPU_AREA
101 def_bool y 92 def_bool y
102 93
103config GENERIC_GPIO 94config GENERIC_GPIO
104 bool 95 def_bool y
105 96
106config DMI 97config DMI
107 bool 98 bool
@@ -111,6 +102,13 @@ config EFI
111 bool 102 bool
112 default y 103 default y
113 104
105config GENERIC_IOMAP
106 bool
107 default y
108
109config ARCH_CLOCKSOURCE_DATA
110 def_bool y
111
114config SCHED_OMIT_FRAME_POINTER 112config SCHED_OMIT_FRAME_POINTER
115 bool 113 bool
116 default y 114 default y
@@ -129,7 +127,6 @@ config AUDIT_ARCH
129 127
130menuconfig PARAVIRT_GUEST 128menuconfig PARAVIRT_GUEST
131 bool "Paravirtualized guest support" 129 bool "Paravirtualized guest support"
132 depends on BROKEN
133 help 130 help
134 Say Y here to get to see options related to running Linux under 131 Say Y here to get to see options related to running Linux under
135 various hypervisors. This option alone does not add any kernel code. 132 various hypervisors. This option alone does not add any kernel code.
@@ -142,6 +139,8 @@ config PARAVIRT
142 bool "Enable paravirtualization code" 139 bool "Enable paravirtualization code"
143 depends on PARAVIRT_GUEST 140 depends on PARAVIRT_GUEST
144 default y 141 default y
142 bool
143 default y
145 help 144 help
146 This changes the kernel so it can modify itself when it is run 145 This changes the kernel so it can modify itself when it is run
147 under a hypervisor, potentially improving performance significantly 146 under a hypervisor, potentially improving performance significantly
@@ -343,6 +342,17 @@ config FORCE_MAX_ZONEORDER
343 default "17" if HUGETLB_PAGE 342 default "17" if HUGETLB_PAGE
344 default "11" 343 default "11"
345 344
345config VIRT_CPU_ACCOUNTING
346 bool "Deterministic task and CPU time accounting"
347 default n
348 help
349 Select this option to enable more accurate task and CPU time
350 accounting. This is done by reading a CPU counter on each
351 kernel entry and exit and on transitions within the kernel
352 between system, softirq and hardirq state, so there is a
353 small performance impact.
354 If in doubt, say N here.
355
346config SMP 356config SMP
347 bool "Symmetric multi-processing support" 357 bool "Symmetric multi-processing support"
348 select USE_GENERIC_SMP_HELPERS 358 select USE_GENERIC_SMP_HELPERS
@@ -464,6 +474,9 @@ config NODES_SHIFT
464 MAX_NUMNODES will be 2^(This value). 474 MAX_NUMNODES will be 2^(This value).
465 If in doubt, use the default. 475 If in doubt, use the default.
466 476
477config ARCH_POPULATES_NODE_MAP
478 def_bool y
479
467# VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent. 480# VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent.
468# VIRTUAL_MEM_MAP has been retained for historical reasons. 481# VIRTUAL_MEM_MAP has been retained for historical reasons.
469config VIRTUAL_MEM_MAP 482config VIRTUAL_MEM_MAP
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 7913695b2fc..43ab1cd097a 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -87,7 +87,6 @@ CONFIG_NET_ETHERNET=y
87CONFIG_NET_TULIP=y 87CONFIG_NET_TULIP=y
88CONFIG_TULIP=m 88CONFIG_TULIP=m
89CONFIG_NET_PCI=y 89CONFIG_NET_PCI=y
90CONFIG_NET_VENDOR_INTEL=y
91CONFIG_E100=m 90CONFIG_E100=m
92CONFIG_E1000=y 91CONFIG_E1000=y
93CONFIG_IGB=y 92CONFIG_IGB=y
@@ -234,4 +233,5 @@ CONFIG_CRYPTO_PCBC=m
234CONFIG_CRYPTO_MD5=y 233CONFIG_CRYPTO_MD5=y
235# CONFIG_CRYPTO_ANSI_CPRNG is not set 234# CONFIG_CRYPTO_ANSI_CPRNG is not set
236CONFIG_CRC_T10DIF=y 235CONFIG_CRC_T10DIF=y
236CONFIG_MISC_DEVICES=y
237CONFIG_INTEL_IOMMU=y 237CONFIG_INTEL_IOMMU=y
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig
index f8e91336542..b11fa880e4b 100644
--- a/arch/ia64/configs/gensparse_defconfig
+++ b/arch/ia64/configs/gensparse_defconfig
@@ -75,7 +75,6 @@ CONFIG_NET_ETHERNET=y
75CONFIG_NET_TULIP=y 75CONFIG_NET_TULIP=y
76CONFIG_TULIP=m 76CONFIG_TULIP=m
77CONFIG_NET_PCI=y 77CONFIG_NET_PCI=y
78CONFIG_NET_VENDOR_INTEL=y
79CONFIG_E100=m 78CONFIG_E100=m
80CONFIG_E1000=y 79CONFIG_E1000=y
81CONFIG_TIGON3=y 80CONFIG_TIGON3=y
@@ -209,3 +208,4 @@ CONFIG_MAGIC_SYSRQ=y
209CONFIG_DEBUG_KERNEL=y 208CONFIG_DEBUG_KERNEL=y
210CONFIG_DEBUG_MUTEXES=y 209CONFIG_DEBUG_MUTEXES=y
211CONFIG_CRYPTO_MD5=y 210CONFIG_CRYPTO_MD5=y
211CONFIG_MISC_DEVICES=y
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index a5a9e02e60a..137a453dd50 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -77,7 +77,6 @@ CONFIG_NET_ETHERNET=y
77CONFIG_NET_TULIP=y 77CONFIG_NET_TULIP=y
78CONFIG_TULIP=m 78CONFIG_TULIP=m
79CONFIG_NET_PCI=y 79CONFIG_NET_PCI=y
80CONFIG_NET_VENDOR_INTEL=y
81CONFIG_E100=m 80CONFIG_E100=m
82CONFIG_E1000=y 81CONFIG_E1000=y
83CONFIG_TIGON3=y 82CONFIG_TIGON3=y
diff --git a/arch/ia64/configs/xen_domu_defconfig b/arch/ia64/configs/xen_domu_defconfig
index 37b9b422caa..2bf76e418bc 100644
--- a/arch/ia64/configs/xen_domu_defconfig
+++ b/arch/ia64/configs/xen_domu_defconfig
@@ -80,7 +80,6 @@ CONFIG_NET_ETHERNET=y
80CONFIG_NET_TULIP=y 80CONFIG_NET_TULIP=y
81CONFIG_TULIP=m 81CONFIG_TULIP=m
82CONFIG_NET_PCI=y 82CONFIG_NET_PCI=y
83CONFIG_NET_VENDOR_INTEL=y
84CONFIG_E100=m 83CONFIG_E100=m
85CONFIG_E1000=y 84CONFIG_E1000=y
86CONFIG_TIGON3=y 85CONFIG_TIGON3=y
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index fc7aba07c2b..1d42827f9fa 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -57,7 +57,6 @@ CONFIG_TULIP_MMIO=y
57CONFIG_TULIP_NAPI=y 57CONFIG_TULIP_NAPI=y
58CONFIG_TULIP_NAPI_HW_MITIGATION=y 58CONFIG_TULIP_NAPI_HW_MITIGATION=y
59CONFIG_NET_PCI=y 59CONFIG_NET_PCI=y
60CONFIG_NET_VENDOR_INTEL=y
61CONFIG_E100=y 60CONFIG_E100=y
62CONFIG_E1000=y 61CONFIG_E1000=y
63CONFIG_TIGON3=y 62CONFIG_TIGON3=y
diff --git a/arch/ia64/dig/setup.c b/arch/ia64/dig/setup.c
index 98131e1db7a..9196b330ff7 100644
--- a/arch/ia64/dig/setup.c
+++ b/arch/ia64/dig/setup.c
@@ -22,7 +22,7 @@
22 22
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/machvec.h> 24#include <asm/machvec.h>
25#include <asm/setup.h> 25#include <asm/system.h>
26 26
27void __init 27void __init
28dig_setup (char **cmdline_p) 28dig_setup (char **cmdline_p)
diff --git a/arch/ia64/hp/common/aml_nfw.c b/arch/ia64/hp/common/aml_nfw.c
index 6192f718865..22078486d35 100644
--- a/arch/ia64/hp/common/aml_nfw.c
+++ b/arch/ia64/hp/common/aml_nfw.c
@@ -31,7 +31,7 @@ MODULE_AUTHOR("Bjorn Helgaas <bjorn.helgaas@hp.com>");
31MODULE_LICENSE("GPL"); 31MODULE_LICENSE("GPL");
32MODULE_DESCRIPTION("ACPI opregion handler for native firmware calls"); 32MODULE_DESCRIPTION("ACPI opregion handler for native firmware calls");
33 33
34static bool force_register; 34static int force_register;
35module_param_named(force, force_register, bool, 0); 35module_param_named(force, force_register, bool, 0);
36MODULE_PARM_DESC(force, "Install opregion handler even without HPQ5001 device"); 36MODULE_PARM_DESC(force, "Install opregion handler even without HPQ5001 device");
37 37
diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c
index 1e4cae5ae05..e4a80d82e3d 100644
--- a/arch/ia64/hp/common/hwsw_iommu.c
+++ b/arch/ia64/hp/common/hwsw_iommu.c
@@ -15,7 +15,6 @@
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/swiotlb.h> 17#include <linux/swiotlb.h>
18#include <linux/export.h>
19#include <asm/machvec.h> 18#include <asm/machvec.h>
20 19
21extern struct dma_map_ops sba_dma_ops, swiotlb_dma_ops; 20extern struct dma_map_ops sba_dma_ops, swiotlb_dma_ops;
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index bcda5b2d121..80241fe03f5 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -43,6 +43,7 @@
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/page.h> /* PAGE_OFFSET */ 44#include <asm/page.h> /* PAGE_OFFSET */
45#include <asm/dma.h> 45#include <asm/dma.h>
46#include <asm/system.h> /* wmb() */
46 47
47#include <asm/acpi-ext.h> 48#include <asm/acpi-ext.h>
48 49
@@ -914,7 +915,7 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
914 * @dir: R/W or both. 915 * @dir: R/W or both.
915 * @attrs: optional dma attributes 916 * @attrs: optional dma attributes
916 * 917 *
917 * See Documentation/DMA-API-HOWTO.txt 918 * See Documentation/PCI/PCI-DMA-mapping.txt
918 */ 919 */
919static dma_addr_t sba_map_page(struct device *dev, struct page *page, 920static dma_addr_t sba_map_page(struct device *dev, struct page *page,
920 unsigned long poff, size_t size, 921 unsigned long poff, size_t size,
@@ -1043,7 +1044,7 @@ sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size)
1043 * @dir: R/W or both. 1044 * @dir: R/W or both.
1044 * @attrs: optional dma attributes 1045 * @attrs: optional dma attributes
1045 * 1046 *
1046 * See Documentation/DMA-API-HOWTO.txt 1047 * See Documentation/PCI/PCI-DMA-mapping.txt
1047 */ 1048 */
1048static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size, 1049static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size,
1049 enum dma_data_direction dir, struct dma_attrs *attrs) 1050 enum dma_data_direction dir, struct dma_attrs *attrs)
@@ -1126,11 +1127,10 @@ void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
1126 * @size: number of bytes mapped in driver buffer. 1127 * @size: number of bytes mapped in driver buffer.
1127 * @dma_handle: IOVA of new buffer. 1128 * @dma_handle: IOVA of new buffer.
1128 * 1129 *
1129 * See Documentation/DMA-API-HOWTO.txt 1130 * See Documentation/PCI/PCI-DMA-mapping.txt
1130 */ 1131 */
1131static void * 1132static void *
1132sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 1133sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags)
1133 gfp_t flags, struct dma_attrs *attrs)
1134{ 1134{
1135 struct ioc *ioc; 1135 struct ioc *ioc;
1136 void *addr; 1136 void *addr;
@@ -1190,10 +1190,10 @@ sba_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
1190 * @vaddr: virtual address IOVA of "consistent" buffer. 1190 * @vaddr: virtual address IOVA of "consistent" buffer.
1191 * @dma_handler: IO virtual address of "consistent" buffer. 1191 * @dma_handler: IO virtual address of "consistent" buffer.
1192 * 1192 *
1193 * See Documentation/DMA-API-HOWTO.txt 1193 * See Documentation/PCI/PCI-DMA-mapping.txt
1194 */ 1194 */
1195static void sba_free_coherent(struct device *dev, size_t size, void *vaddr, 1195static void sba_free_coherent (struct device *dev, size_t size, void *vaddr,
1196 dma_addr_t dma_handle, struct dma_attrs *attrs) 1196 dma_addr_t dma_handle)
1197{ 1197{
1198 sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL); 1198 sba_unmap_single_attrs(dev, dma_handle, size, 0, NULL);
1199 free_pages((unsigned long) vaddr, get_order(size)); 1199 free_pages((unsigned long) vaddr, get_order(size));
@@ -1453,7 +1453,7 @@ static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1453 * @dir: R/W or both. 1453 * @dir: R/W or both.
1454 * @attrs: optional dma attributes 1454 * @attrs: optional dma attributes
1455 * 1455 *
1456 * See Documentation/DMA-API-HOWTO.txt 1456 * See Documentation/PCI/PCI-DMA-mapping.txt
1457 */ 1457 */
1458static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, 1458static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
1459 int nents, enum dma_data_direction dir, 1459 int nents, enum dma_data_direction dir,
@@ -1549,7 +1549,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
1549 * @dir: R/W or both. 1549 * @dir: R/W or both.
1550 * @attrs: optional dma attributes 1550 * @attrs: optional dma attributes
1551 * 1551 *
1552 * See Documentation/DMA-API-HOWTO.txt 1552 * See Documentation/PCI/PCI-DMA-mapping.txt
1553 */ 1553 */
1554static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, 1554static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1555 int nents, enum dma_data_direction dir, 1555 int nents, enum dma_data_direction dir,
@@ -2213,8 +2213,8 @@ sba_page_override(char *str)
2213__setup("sbapagesize=",sba_page_override); 2213__setup("sbapagesize=",sba_page_override);
2214 2214
2215struct dma_map_ops sba_dma_ops = { 2215struct dma_map_ops sba_dma_ops = {
2216 .alloc = sba_alloc_coherent, 2216 .alloc_coherent = sba_alloc_coherent,
2217 .free = sba_free_coherent, 2217 .free_coherent = sba_free_coherent,
2218 .map_page = sba_map_page, 2218 .map_page = sba_map_page,
2219 .unmap_page = sba_unmap_page, 2219 .unmap_page = sba_unmap_page,
2220 .map_sg = sba_map_sg_attrs, 2220 .map_sg = sba_map_sg_attrs,
diff --git a/arch/ia64/hp/sim/boot/bootloader.c b/arch/ia64/hp/sim/boot/bootloader.c
index 28f4b230b8c..c5e9baafafe 100644
--- a/arch/ia64/hp/sim/boot/bootloader.c
+++ b/arch/ia64/hp/sim/boot/bootloader.c
@@ -20,6 +20,7 @@ struct task_struct; /* forward declaration for elf.h */
20#include <asm/pal.h> 20#include <asm/pal.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22#include <asm/sal.h> 22#include <asm/sal.h>
23#include <asm/system.h>
23 24
24#include "ssc.h" 25#include "ssc.h"
25 26
diff --git a/arch/ia64/hp/sim/boot/fw-emu.c b/arch/ia64/hp/sim/boot/fw-emu.c
index 271f412bda1..bf6d9d8c802 100644
--- a/arch/ia64/hp/sim/boot/fw-emu.c
+++ b/arch/ia64/hp/sim/boot/fw-emu.c
@@ -13,7 +13,6 @@
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/pal.h> 14#include <asm/pal.h>
15#include <asm/sal.h> 15#include <asm/sal.h>
16#include <asm/setup.h>
17 16
18#include "ssc.h" 17#include "ssc.h"
19 18
@@ -161,19 +160,28 @@ sal_emulator (long index, unsigned long in1, unsigned long in2,
161 */ 160 */
162 status = 0; 161 status = 0;
163 if (index == SAL_FREQ_BASE) { 162 if (index == SAL_FREQ_BASE) {
164 if (in1 == SAL_FREQ_BASE_PLATFORM) 163 switch (in1) {
164 case SAL_FREQ_BASE_PLATFORM:
165 r9 = 200000000; 165 r9 = 200000000;
166 else if (in1 == SAL_FREQ_BASE_INTERVAL_TIMER) { 166 break;
167
168 case SAL_FREQ_BASE_INTERVAL_TIMER:
167 /* 169 /*
168 * Is this supposed to be the cr.itc frequency 170 * Is this supposed to be the cr.itc frequency
169 * or something platform specific? The SAL 171 * or something platform specific? The SAL
170 * doc ain't exactly clear on this... 172 * doc ain't exactly clear on this...
171 */ 173 */
172 r9 = 700000000; 174 r9 = 700000000;
173 } else if (in1 == SAL_FREQ_BASE_REALTIME_CLOCK) 175 break;
176
177 case SAL_FREQ_BASE_REALTIME_CLOCK:
174 r9 = 1; 178 r9 = 1;
175 else 179 break;
180
181 default:
176 status = -1; 182 status = -1;
183 break;
184 }
177 } else if (index == SAL_SET_VECTORS) { 185 } else if (index == SAL_SET_VECTORS) {
178 ; 186 ;
179 } else if (index == SAL_GET_STATE_INFO) { 187 } else if (index == SAL_GET_STATE_INFO) {
diff --git a/arch/ia64/hp/sim/hpsim_irq.c b/arch/ia64/hp/sim/hpsim_irq.c
index 0aa70ebda49..4bd9a63260e 100644
--- a/arch/ia64/hp/sim/hpsim_irq.c
+++ b/arch/ia64/hp/sim/hpsim_irq.c
@@ -10,8 +10,6 @@
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/irq.h> 11#include <linux/irq.h>
12 12
13#include "hpsim_ssc.h"
14
15static unsigned int 13static unsigned int
16hpsim_irq_startup(struct irq_data *data) 14hpsim_irq_startup(struct irq_data *data)
17{ 15{
@@ -39,37 +37,15 @@ static struct irq_chip irq_type_hp_sim = {
39 .irq_set_affinity = hpsim_set_affinity_noop, 37 .irq_set_affinity = hpsim_set_affinity_noop,
40}; 38};
41 39
42static void hpsim_irq_set_chip(int irq)
43{
44 struct irq_chip *chip = irq_get_chip(irq);
45
46 if (chip == &no_irq_chip)
47 irq_set_chip(irq, &irq_type_hp_sim);
48}
49
50static void hpsim_connect_irq(int intr, int irq)
51{
52 ia64_ssc(intr, irq, 0, 0, SSC_CONNECT_INTERRUPT);
53}
54
55int hpsim_get_irq(int intr)
56{
57 int irq = assign_irq_vector(AUTO_ASSIGN);
58
59 if (irq >= 0) {
60 hpsim_irq_set_chip(irq);
61 irq_set_handler(irq, handle_simple_irq);
62 hpsim_connect_irq(intr, irq);
63 }
64
65 return irq;
66}
67
68void __init 40void __init
69hpsim_irq_init (void) 41hpsim_irq_init (void)
70{ 42{
71 int i; 43 int i;
72 44
73 for_each_active_irq(i) 45 for_each_active_irq(i) {
74 hpsim_irq_set_chip(i); 46 struct irq_chip *chip = irq_get_chip(i);
47
48 if (chip == &no_irq_chip)
49 irq_set_chip(i, &irq_type_hp_sim);
50 }
75} 51}
diff --git a/arch/ia64/hp/sim/hpsim_setup.c b/arch/ia64/hp/sim/hpsim_setup.c
index 664a5402a69..f629e903ebc 100644
--- a/arch/ia64/hp/sim/hpsim_setup.c
+++ b/arch/ia64/hp/sim/hpsim_setup.c
@@ -26,6 +26,12 @@
26#include "hpsim_ssc.h" 26#include "hpsim_ssc.h"
27 27
28void 28void
29ia64_ssc_connect_irq (long intr, long irq)
30{
31 ia64_ssc(intr, irq, 0, 0, SSC_CONNECT_INTERRUPT);
32}
33
34void
29ia64_ctl_trace (long on) 35ia64_ctl_trace (long on)
30{ 36{
31 ia64_ssc(on, 0, 0, 0, SSC_CTL_TRACE); 37 ia64_ssc(on, 0, 0, 0, SSC_CTL_TRACE);
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
index c13064e422d..7e81966ce48 100644
--- a/arch/ia64/hp/sim/simeth.c
+++ b/arch/ia64/hp/sim/simeth.c
@@ -20,6 +20,7 @@
20#include <linux/skbuff.h> 20#include <linux/skbuff.h>
21#include <linux/notifier.h> 21#include <linux/notifier.h>
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <asm/system.h>
23#include <asm/irq.h> 24#include <asm/irq.h>
24#include <asm/hpsim.h> 25#include <asm/hpsim.h>
25 26
@@ -128,6 +129,17 @@ netdev_probe(char *name, unsigned char *ether)
128 129
129 130
130static inline int 131static inline int
132netdev_connect(int irq)
133{
134 /* XXX Fix me
135 * this does not support multiple cards
136 * also no return value
137 */
138 ia64_ssc_connect_irq(NETWORK_INTR, irq);
139 return 0;
140}
141
142static inline int
131netdev_attach(int fd, int irq, unsigned int ipaddr) 143netdev_attach(int fd, int irq, unsigned int ipaddr)
132{ 144{
133 /* this puts the host interface in the right mode (start interrupting) */ 145 /* this puts the host interface in the right mode (start interrupting) */
@@ -160,7 +172,7 @@ static const struct net_device_ops simeth_netdev_ops = {
160 .ndo_stop = simeth_close, 172 .ndo_stop = simeth_close,
161 .ndo_start_xmit = simeth_tx, 173 .ndo_start_xmit = simeth_tx,
162 .ndo_get_stats = simeth_get_stats, 174 .ndo_get_stats = simeth_get_stats,
163 .ndo_set_rx_mode = set_multicast_list, /* not yet used */ 175 .ndo_set_multicast_list = set_multicast_list, /* not yet used */
164 176
165}; 177};
166 178
@@ -181,7 +193,7 @@ simeth_probe1(void)
181 unsigned char mac_addr[ETH_ALEN]; 193 unsigned char mac_addr[ETH_ALEN];
182 struct simeth_local *local; 194 struct simeth_local *local;
183 struct net_device *dev; 195 struct net_device *dev;
184 int fd, err, rc; 196 int fd, i, err, rc;
185 197
186 /* 198 /*
187 * XXX Fix me 199 * XXX Fix me
@@ -214,16 +226,22 @@ simeth_probe1(void)
214 return err; 226 return err;
215 } 227 }
216 228
229 if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0)
230 panic("%s: out of interrupt vectors!\n", __func__);
231 dev->irq = rc;
232
217 /* 233 /*
218 * attach the interrupt in the simulator, this does enable interrupts 234 * attach the interrupt in the simulator, this does enable interrupts
219 * until a netdev_attach() is called 235 * until a netdev_attach() is called
220 */ 236 */
221 if ((rc = hpsim_get_irq(NETWORK_INTR)) < 0) 237 netdev_connect(dev->irq);
222 panic("%s: out of interrupt vectors!\n", __func__);
223 dev->irq = rc;
224 238
225 printk(KERN_INFO "%s: hosteth=%s simfd=%d, HwAddr=%pm, IRQ %d\n", 239 printk(KERN_INFO "%s: hosteth=%s simfd=%d, HwAddr",
226 dev->name, simeth_device, local->simfd, dev->dev_addr, dev->irq); 240 dev->name, simeth_device, local->simfd);
241 for(i = 0; i < ETH_ALEN; i++) {
242 printk(" %2.2x", dev->dev_addr[i]);
243 }
244 printk(", IRQ %d\n", dev->irq);
227 245
228 return 0; 246 return 0;
229} 247}
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index fc3924d18c1..bff0824cf8a 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -4,11 +4,16 @@
4 * This driver is mostly used for bringup purposes and will go away. 4 * This driver is mostly used for bringup purposes and will go away.
5 * It has a strong dependency on the system console. All outputs 5 * It has a strong dependency on the system console. All outputs
6 * are rerouted to the same facility as the one used by printk which, in our 6 * are rerouted to the same facility as the one used by printk which, in our
7 * case means sys_sim.c console (goes via the simulator). 7 * case means sys_sim.c console (goes via the simulator). The code hereafter
8 * is completely leveraged from the serial.c driver.
8 * 9 *
9 * Copyright (C) 1999-2000, 2002-2003 Hewlett-Packard Co 10 * Copyright (C) 1999-2000, 2002-2003 Hewlett-Packard Co
10 * Stephane Eranian <eranian@hpl.hp.com> 11 * Stephane Eranian <eranian@hpl.hp.com>
11 * David Mosberger-Tang <davidm@hpl.hp.com> 12 * David Mosberger-Tang <davidm@hpl.hp.com>
13 *
14 * 02/04/00 D. Mosberger Merged in serial.c bug fixes in rs_close().
15 * 02/25/00 D. Mosberger Synced up with 2.3.99pre-5 version of serial.c.
16 * 07/30/02 D. Mosberger Replace sti()/cli() with explicit spinlocks & local irq masking
12 */ 17 */
13 18
14#include <linux/init.h> 19#include <linux/init.h>
@@ -22,17 +27,15 @@
22#include <linux/seq_file.h> 27#include <linux/seq_file.h>
23#include <linux/slab.h> 28#include <linux/slab.h>
24#include <linux/capability.h> 29#include <linux/capability.h>
25#include <linux/circ_buf.h>
26#include <linux/console.h> 30#include <linux/console.h>
27#include <linux/irq.h>
28#include <linux/module.h> 31#include <linux/module.h>
29#include <linux/serial.h> 32#include <linux/serial.h>
33#include <linux/serialP.h>
30#include <linux/sysrq.h> 34#include <linux/sysrq.h>
31#include <linux/uaccess.h>
32
33#include <asm/hpsim.h>
34 35
35#include "hpsim_ssc.h" 36#include <asm/irq.h>
37#include <asm/hw_irq.h>
38#include <asm/uaccess.h>
36 39
37#undef SIMSERIAL_DEBUG /* define this to get some debug information */ 40#undef SIMSERIAL_DEBUG /* define this to get some debug information */
38 41
@@ -40,44 +43,118 @@
40 43
41#define NR_PORTS 1 /* only one port for now */ 44#define NR_PORTS 1 /* only one port for now */
42 45
43struct serial_state { 46#define IRQ_T(info) ((info->flags & ASYNC_SHARE_IRQ) ? IRQF_SHARED : IRQF_DISABLED)
44 struct tty_port port; 47
45 struct circ_buf xmit; 48#define SSC_GETCHAR 21
46 int irq; 49
47 int x_char; 50extern long ia64_ssc (long, long, long, long, int);
51extern void ia64_ssc_connect_irq (long intr, long irq);
52
53static char *serial_name = "SimSerial driver";
54static char *serial_version = "0.6";
55
56/*
57 * This has been extracted from asm/serial.h. We need one eventually but
58 * I don't know exactly what we're going to put in it so just fake one
59 * for now.
60 */
61#define BASE_BAUD ( 1843200 / 16 )
62
63#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
64
65/*
66 * Most of the values here are meaningless to this particular driver.
67 * However some values must be preserved for the code (leveraged from serial.c
68 * to work correctly).
69 * port must not be 0
70 * type must not be UNKNOWN
71 * So I picked arbitrary (guess from where?) values instead
72 */
73static struct serial_state rs_table[NR_PORTS]={
74 /* UART CLK PORT IRQ FLAGS */
75 { 0, BASE_BAUD, 0x3F8, 0, STD_COM_FLAGS,0,PORT_16550 } /* ttyS0 */
48}; 76};
49 77
50static struct serial_state rs_table[NR_PORTS]; 78/*
79 * Just for the fun of it !
80 */
81static struct serial_uart_config uart_config[] = {
82 { "unknown", 1, 0 },
83 { "8250", 1, 0 },
84 { "16450", 1, 0 },
85 { "16550", 1, 0 },
86 { "16550A", 16, UART_CLEAR_FIFO | UART_USE_FIFO },
87 { "cirrus", 1, 0 },
88 { "ST16650", 1, UART_CLEAR_FIFO | UART_STARTECH },
89 { "ST16650V2", 32, UART_CLEAR_FIFO | UART_USE_FIFO |
90 UART_STARTECH },
91 { "TI16750", 64, UART_CLEAR_FIFO | UART_USE_FIFO},
92 { NULL, 0}
93};
51 94
52struct tty_driver *hp_simserial_driver; 95struct tty_driver *hp_simserial_driver;
53 96
97static struct async_struct *IRQ_ports[NR_IRQS];
98
54static struct console *console; 99static struct console *console;
55 100
56static void receive_chars(struct tty_struct *tty) 101static unsigned char *tmp_buf;
102
103extern struct console *console_drivers; /* from kernel/printk.c */
104
105/*
106 * ------------------------------------------------------------
107 * rs_stop() and rs_start()
108 *
109 * This routines are called before setting or resetting tty->stopped.
110 * They enable or disable transmitter interrupts, as necessary.
111 * ------------------------------------------------------------
112 */
113static void rs_stop(struct tty_struct *tty)
114{
115#ifdef SIMSERIAL_DEBUG
116 printk("rs_stop: tty->stopped=%d tty->hw_stopped=%d tty->flow_stopped=%d\n",
117 tty->stopped, tty->hw_stopped, tty->flow_stopped);
118#endif
119
120}
121
122static void rs_start(struct tty_struct *tty)
123{
124#ifdef SIMSERIAL_DEBUG
125 printk("rs_start: tty->stopped=%d tty->hw_stopped=%d tty->flow_stopped=%d\n",
126 tty->stopped, tty->hw_stopped, tty->flow_stopped);
127#endif
128}
129
130static void receive_chars(struct tty_struct *tty)
57{ 131{
58 unsigned char ch; 132 unsigned char ch;
59 static unsigned char seen_esc = 0; 133 static unsigned char seen_esc = 0;
60 134
61 while ( (ch = ia64_ssc(0, 0, 0, 0, SSC_GETCHAR)) ) { 135 while ( (ch = ia64_ssc(0, 0, 0, 0, SSC_GETCHAR)) ) {
62 if (ch == 27 && seen_esc == 0) { 136 if ( ch == 27 && seen_esc == 0 ) {
63 seen_esc = 1; 137 seen_esc = 1;
64 continue; 138 continue;
65 } else if (seen_esc == 1 && ch == 'O') { 139 } else {
66 seen_esc = 2; 140 if ( seen_esc==1 && ch == 'O' ) {
67 continue; 141 seen_esc = 2;
68 } else if (seen_esc == 2) { 142 continue;
69 if (ch == 'P') /* F1 */ 143 } else if ( seen_esc == 2 ) {
70 show_state(); 144 if ( ch == 'P' ) /* F1 */
145 show_state();
71#ifdef CONFIG_MAGIC_SYSRQ 146#ifdef CONFIG_MAGIC_SYSRQ
72 if (ch == 'S') { /* F4 */ 147 if ( ch == 'S' ) { /* F4 */
73 do { 148 do
74 ch = ia64_ssc(0, 0, 0, 0, SSC_GETCHAR); 149 ch = ia64_ssc(0, 0, 0, 0,
75 } while (!ch); 150 SSC_GETCHAR);
76 handle_sysrq(ch); 151 while (!ch);
77 } 152 handle_sysrq(ch);
153 }
78#endif 154#endif
79 seen_esc = 0; 155 seen_esc = 0;
80 continue; 156 continue;
157 }
81 } 158 }
82 seen_esc = 0; 159 seen_esc = 0;
83 160
@@ -92,19 +169,22 @@ static void receive_chars(struct tty_struct *tty)
92 */ 169 */
93static irqreturn_t rs_interrupt_single(int irq, void *dev_id) 170static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
94{ 171{
95 struct serial_state *info = dev_id; 172 struct async_struct * info;
96 struct tty_struct *tty = tty_port_tty_get(&info->port);
97 173
98 if (!tty) { 174 /*
99 printk(KERN_INFO "%s: tty=0 problem\n", __func__); 175 * I don't know exactly why they don't use the dev_id opaque data
176 * pointer instead of this extra lookup table
177 */
178 info = IRQ_ports[irq];
179 if (!info || !info->tty) {
180 printk(KERN_INFO "simrs_interrupt_single: info|tty=0 info=%p problem\n", info);
100 return IRQ_NONE; 181 return IRQ_NONE;
101 } 182 }
102 /* 183 /*
103 * pretty simple in our case, because we only get interrupts 184 * pretty simple in our case, because we only get interrupts
104 * on inbound traffic 185 * on inbound traffic
105 */ 186 */
106 receive_chars(tty); 187 receive_chars(info->tty);
107 tty_kref_put(tty);
108 return IRQ_HANDLED; 188 return IRQ_HANDLED;
109} 189}
110 190
@@ -114,12 +194,17 @@ static irqreturn_t rs_interrupt_single(int irq, void *dev_id)
114 * ------------------------------------------------------------------- 194 * -------------------------------------------------------------------
115 */ 195 */
116 196
197static void do_softint(struct work_struct *private_)
198{
199 printk(KERN_ERR "simserial: do_softint called\n");
200}
201
117static int rs_put_char(struct tty_struct *tty, unsigned char ch) 202static int rs_put_char(struct tty_struct *tty, unsigned char ch)
118{ 203{
119 struct serial_state *info = tty->driver_data; 204 struct async_struct *info = (struct async_struct *)tty->driver_data;
120 unsigned long flags; 205 unsigned long flags;
121 206
122 if (!info->xmit.buf) 207 if (!tty || !info->xmit.buf)
123 return 0; 208 return 0;
124 209
125 local_irq_save(flags); 210 local_irq_save(flags);
@@ -133,12 +218,12 @@ static int rs_put_char(struct tty_struct *tty, unsigned char ch)
133 return 1; 218 return 1;
134} 219}
135 220
136static void transmit_chars(struct tty_struct *tty, struct serial_state *info, 221static void transmit_chars(struct async_struct *info, int *intr_done)
137 int *intr_done)
138{ 222{
139 int count; 223 int count;
140 unsigned long flags; 224 unsigned long flags;
141 225
226
142 local_irq_save(flags); 227 local_irq_save(flags);
143 228
144 if (info->x_char) { 229 if (info->x_char) {
@@ -146,16 +231,16 @@ static void transmit_chars(struct tty_struct *tty, struct serial_state *info,
146 231
147 console->write(console, &c, 1); 232 console->write(console, &c, 1);
148 233
234 info->state->icount.tx++;
149 info->x_char = 0; 235 info->x_char = 0;
150 236
151 goto out; 237 goto out;
152 } 238 }
153 239
154 if (info->xmit.head == info->xmit.tail || tty->stopped || 240 if (info->xmit.head == info->xmit.tail || info->tty->stopped || info->tty->hw_stopped) {
155 tty->hw_stopped) {
156#ifdef SIMSERIAL_DEBUG 241#ifdef SIMSERIAL_DEBUG
157 printk("transmit_chars: head=%d, tail=%d, stopped=%d\n", 242 printk("transmit_chars: head=%d, tail=%d, stopped=%d\n",
158 info->xmit.head, info->xmit.tail, tty->stopped); 243 info->xmit.head, info->xmit.tail, info->tty->stopped);
159#endif 244#endif
160 goto out; 245 goto out;
161 } 246 }
@@ -187,24 +272,24 @@ out:
187 272
188static void rs_flush_chars(struct tty_struct *tty) 273static void rs_flush_chars(struct tty_struct *tty)
189{ 274{
190 struct serial_state *info = tty->driver_data; 275 struct async_struct *info = (struct async_struct *)tty->driver_data;
191 276
192 if (info->xmit.head == info->xmit.tail || tty->stopped || 277 if (info->xmit.head == info->xmit.tail || tty->stopped || tty->hw_stopped ||
193 tty->hw_stopped || !info->xmit.buf) 278 !info->xmit.buf)
194 return; 279 return;
195 280
196 transmit_chars(tty, info, NULL); 281 transmit_chars(info, NULL);
197} 282}
198 283
284
199static int rs_write(struct tty_struct * tty, 285static int rs_write(struct tty_struct * tty,
200 const unsigned char *buf, int count) 286 const unsigned char *buf, int count)
201{ 287{
202 struct serial_state *info = tty->driver_data;
203 int c, ret = 0; 288 int c, ret = 0;
289 struct async_struct *info = (struct async_struct *)tty->driver_data;
204 unsigned long flags; 290 unsigned long flags;
205 291
206 if (!info->xmit.buf) 292 if (!tty || !info->xmit.buf || !tmp_buf) return 0;
207 return 0;
208 293
209 local_irq_save(flags); 294 local_irq_save(flags);
210 while (1) { 295 while (1) {
@@ -225,30 +310,30 @@ static int rs_write(struct tty_struct * tty,
225 /* 310 /*
226 * Hey, we transmit directly from here in our case 311 * Hey, we transmit directly from here in our case
227 */ 312 */
228 if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE) && 313 if (CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE)
229 !tty->stopped && !tty->hw_stopped) 314 && !tty->stopped && !tty->hw_stopped) {
230 transmit_chars(tty, info, NULL); 315 transmit_chars(info, NULL);
231 316 }
232 return ret; 317 return ret;
233} 318}
234 319
235static int rs_write_room(struct tty_struct *tty) 320static int rs_write_room(struct tty_struct *tty)
236{ 321{
237 struct serial_state *info = tty->driver_data; 322 struct async_struct *info = (struct async_struct *)tty->driver_data;
238 323
239 return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); 324 return CIRC_SPACE(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
240} 325}
241 326
242static int rs_chars_in_buffer(struct tty_struct *tty) 327static int rs_chars_in_buffer(struct tty_struct *tty)
243{ 328{
244 struct serial_state *info = tty->driver_data; 329 struct async_struct *info = (struct async_struct *)tty->driver_data;
245 330
246 return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE); 331 return CIRC_CNT(info->xmit.head, info->xmit.tail, SERIAL_XMIT_SIZE);
247} 332}
248 333
249static void rs_flush_buffer(struct tty_struct *tty) 334static void rs_flush_buffer(struct tty_struct *tty)
250{ 335{
251 struct serial_state *info = tty->driver_data; 336 struct async_struct *info = (struct async_struct *)tty->driver_data;
252 unsigned long flags; 337 unsigned long flags;
253 338
254 local_irq_save(flags); 339 local_irq_save(flags);
@@ -264,7 +349,7 @@ static void rs_flush_buffer(struct tty_struct *tty)
264 */ 349 */
265static void rs_send_xchar(struct tty_struct *tty, char ch) 350static void rs_send_xchar(struct tty_struct *tty, char ch)
266{ 351{
267 struct serial_state *info = tty->driver_data; 352 struct async_struct *info = (struct async_struct *)tty->driver_data;
268 353
269 info->x_char = ch; 354 info->x_char = ch;
270 if (ch) { 355 if (ch) {
@@ -272,7 +357,7 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
272 * I guess we could call console->write() directly but 357 * I guess we could call console->write() directly but
273 * let's do that for now. 358 * let's do that for now.
274 */ 359 */
275 transmit_chars(tty, info, NULL); 360 transmit_chars(info, NULL);
276 } 361 }
277} 362}
278 363
@@ -286,15 +371,14 @@ static void rs_send_xchar(struct tty_struct *tty, char ch)
286 */ 371 */
287static void rs_throttle(struct tty_struct * tty) 372static void rs_throttle(struct tty_struct * tty)
288{ 373{
289 if (I_IXOFF(tty)) 374 if (I_IXOFF(tty)) rs_send_xchar(tty, STOP_CHAR(tty));
290 rs_send_xchar(tty, STOP_CHAR(tty));
291 375
292 printk(KERN_INFO "simrs_throttle called\n"); 376 printk(KERN_INFO "simrs_throttle called\n");
293} 377}
294 378
295static void rs_unthrottle(struct tty_struct * tty) 379static void rs_unthrottle(struct tty_struct * tty)
296{ 380{
297 struct serial_state *info = tty->driver_data; 381 struct async_struct *info = (struct async_struct *)tty->driver_data;
298 382
299 if (I_IXOFF(tty)) { 383 if (I_IXOFF(tty)) {
300 if (info->x_char) 384 if (info->x_char)
@@ -305,6 +389,7 @@ static void rs_unthrottle(struct tty_struct * tty)
305 printk(KERN_INFO "simrs_unthrottle called\n"); 389 printk(KERN_INFO "simrs_unthrottle called\n");
306} 390}
307 391
392
308static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) 393static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
309{ 394{
310 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && 395 if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
@@ -315,21 +400,48 @@ static int rs_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg)
315 } 400 }
316 401
317 switch (cmd) { 402 switch (cmd) {
318 case TIOCGSERIAL: 403 case TIOCGSERIAL:
319 case TIOCSSERIAL: 404 printk(KERN_INFO "simrs_ioctl TIOCGSERIAL called\n");
320 case TIOCSERGSTRUCT: 405 return 0;
321 case TIOCMIWAIT: 406 case TIOCSSERIAL:
322 return 0; 407 printk(KERN_INFO "simrs_ioctl TIOCSSERIAL called\n");
323 case TIOCSERCONFIG: 408 return 0;
324 case TIOCSERGETLSR: /* Get line status register */ 409 case TIOCSERCONFIG:
325 return -EINVAL; 410 printk(KERN_INFO "rs_ioctl: TIOCSERCONFIG called\n");
326 case TIOCSERGWILD: 411 return -EINVAL;
327 case TIOCSERSWILD: 412
328 /* "setserial -W" is called in Debian boot */ 413 case TIOCSERGETLSR: /* Get line status register */
329 printk (KERN_INFO "TIOCSER?WILD ioctl obsolete, ignored.\n"); 414 printk(KERN_INFO "rs_ioctl: TIOCSERGETLSR called\n");
330 return 0; 415 return -EINVAL;
331 } 416
332 return -ENOIOCTLCMD; 417 case TIOCSERGSTRUCT:
418 printk(KERN_INFO "rs_ioctl: TIOCSERGSTRUCT called\n");
419#if 0
420 if (copy_to_user((struct async_struct *) arg,
421 info, sizeof(struct async_struct)))
422 return -EFAULT;
423#endif
424 return 0;
425
426 /*
427 * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
428 * - mask passed in arg for lines of interest
429 * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking)
430 * Caller should use TIOCGICOUNT to see which one it was
431 */
432 case TIOCMIWAIT:
433 printk(KERN_INFO "rs_ioctl: TIOCMIWAIT: called\n");
434 return 0;
435 case TIOCSERGWILD:
436 case TIOCSERSWILD:
437 /* "setserial -W" is called in Debian boot */
438 printk (KERN_INFO "TIOCSER?WILD ioctl obsolete, ignored.\n");
439 return 0;
440
441 default:
442 return -ENOIOCTLCMD;
443 }
444 return 0;
333} 445}
334 446
335#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 447#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
@@ -338,52 +450,222 @@ static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
338{ 450{
339 /* Handle turning off CRTSCTS */ 451 /* Handle turning off CRTSCTS */
340 if ((old_termios->c_cflag & CRTSCTS) && 452 if ((old_termios->c_cflag & CRTSCTS) &&
341 !(tty->termios.c_cflag & CRTSCTS)) { 453 !(tty->termios->c_cflag & CRTSCTS)) {
342 tty->hw_stopped = 0; 454 tty->hw_stopped = 0;
455 rs_start(tty);
343 } 456 }
344} 457}
345/* 458/*
346 * This routine will shutdown a serial port; interrupts are disabled, and 459 * This routine will shutdown a serial port; interrupts are disabled, and
347 * DTR is dropped if the hangup on close termio flag is on. 460 * DTR is dropped if the hangup on close termio flag is on.
348 */ 461 */
349static void shutdown(struct tty_port *port) 462static void shutdown(struct async_struct * info)
350{ 463{
351 struct serial_state *info = container_of(port, struct serial_state, 464 unsigned long flags;
352 port); 465 struct serial_state *state;
353 unsigned long flags; 466 int retval;
467
468 if (!(info->flags & ASYNC_INITIALIZED)) return;
469
470 state = info->state;
471
472#ifdef SIMSERIAL_DEBUG
473 printk("Shutting down serial port %d (irq %d)....", info->line,
474 state->irq);
475#endif
354 476
355 local_irq_save(flags); 477 local_irq_save(flags);
356 if (info->irq) 478 {
357 free_irq(info->irq, info); 479 /*
480 * First unlink the serial port from the IRQ chain...
481 */
482 if (info->next_port)
483 info->next_port->prev_port = info->prev_port;
484 if (info->prev_port)
485 info->prev_port->next_port = info->next_port;
486 else
487 IRQ_ports[state->irq] = info->next_port;
488
489 /*
490 * Free the IRQ, if necessary
491 */
492 if (state->irq && (!IRQ_ports[state->irq] ||
493 !IRQ_ports[state->irq]->next_port)) {
494 if (IRQ_ports[state->irq]) {
495 free_irq(state->irq, NULL);
496 retval = request_irq(state->irq, rs_interrupt_single,
497 IRQ_T(info), "serial", NULL);
498
499 if (retval)
500 printk(KERN_ERR "serial shutdown: request_irq: error %d"
501 " Couldn't reacquire IRQ.\n", retval);
502 } else
503 free_irq(state->irq, NULL);
504 }
505
506 if (info->xmit.buf) {
507 free_page((unsigned long) info->xmit.buf);
508 info->xmit.buf = NULL;
509 }
510
511 if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags);
358 512
359 if (info->xmit.buf) { 513 info->flags &= ~ASYNC_INITIALIZED;
360 free_page((unsigned long) info->xmit.buf);
361 info->xmit.buf = NULL;
362 } 514 }
363 local_irq_restore(flags); 515 local_irq_restore(flags);
364} 516}
365 517
518/*
519 * ------------------------------------------------------------
520 * rs_close()
521 *
522 * This routine is called when the serial port gets closed. First, we
523 * wait for the last remaining data to be sent. Then, we unlink its
524 * async structure from the interrupt chain if necessary, and we free
525 * that IRQ if nothing is left in the chain.
526 * ------------------------------------------------------------
527 */
366static void rs_close(struct tty_struct *tty, struct file * filp) 528static void rs_close(struct tty_struct *tty, struct file * filp)
367{ 529{
368 struct serial_state *info = tty->driver_data; 530 struct async_struct * info = (struct async_struct *)tty->driver_data;
531 struct serial_state *state;
532 unsigned long flags;
533
534 if (!info ) return;
535
536 state = info->state;
537
538 local_irq_save(flags);
539 if (tty_hung_up_p(filp)) {
540#ifdef SIMSERIAL_DEBUG
541 printk("rs_close: hung_up\n");
542#endif
543 local_irq_restore(flags);
544 return;
545 }
546#ifdef SIMSERIAL_DEBUG
547 printk("rs_close ttys%d, count = %d\n", info->line, state->count);
548#endif
549 if ((tty->count == 1) && (state->count != 1)) {
550 /*
551 * Uh, oh. tty->count is 1, which means that the tty
552 * structure will be freed. state->count should always
553 * be one in these conditions. If it's greater than
554 * one, we've got real problems, since it means the
555 * serial port won't be shutdown.
556 */
557 printk(KERN_ERR "rs_close: bad serial port count; tty->count is 1, "
558 "state->count is %d\n", state->count);
559 state->count = 1;
560 }
561 if (--state->count < 0) {
562 printk(KERN_ERR "rs_close: bad serial port count for ttys%d: %d\n",
563 info->line, state->count);
564 state->count = 0;
565 }
566 if (state->count) {
567 local_irq_restore(flags);
568 return;
569 }
570 info->flags |= ASYNC_CLOSING;
571 local_irq_restore(flags);
369 572
370 tty_port_close(&info->port, tty, filp); 573 /*
574 * Now we wait for the transmit buffer to clear; and we notify
575 * the line discipline to only process XON/XOFF characters.
576 */
577 shutdown(info);
578 rs_flush_buffer(tty);
579 tty_ldisc_flush(tty);
580 info->event = 0;
581 info->tty = NULL;
582 if (info->blocked_open) {
583 if (info->close_delay)
584 schedule_timeout_interruptible(info->close_delay);
585 wake_up_interruptible(&info->open_wait);
586 }
587 info->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING);
588 wake_up_interruptible(&info->close_wait);
371} 589}
372 590
591/*
592 * rs_wait_until_sent() --- wait until the transmitter is empty
593 */
594static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
595{
596}
597
598
599/*
600 * rs_hangup() --- called by tty_hangup() when a hangup is signaled.
601 */
373static void rs_hangup(struct tty_struct *tty) 602static void rs_hangup(struct tty_struct *tty)
374{ 603{
375 struct serial_state *info = tty->driver_data; 604 struct async_struct * info = (struct async_struct *)tty->driver_data;
605 struct serial_state *state = info->state;
606
607#ifdef SIMSERIAL_DEBUG
608 printk("rs_hangup: called\n");
609#endif
610
611 state = info->state;
376 612
377 rs_flush_buffer(tty); 613 rs_flush_buffer(tty);
378 tty_port_hangup(&info->port); 614 if (info->flags & ASYNC_CLOSING)
615 return;
616 shutdown(info);
617
618 info->event = 0;
619 state->count = 0;
620 info->flags &= ~ASYNC_NORMAL_ACTIVE;
621 info->tty = NULL;
622 wake_up_interruptible(&info->open_wait);
379} 623}
380 624
381static int activate(struct tty_port *port, struct tty_struct *tty) 625
626static int get_async_struct(int line, struct async_struct **ret_info)
382{ 627{
383 struct serial_state *state = container_of(port, struct serial_state, 628 struct async_struct *info;
384 port); 629 struct serial_state *sstate;
385 unsigned long flags, page; 630
386 int retval = 0; 631 sstate = rs_table + line;
632 sstate->count++;
633 if (sstate->info) {
634 *ret_info = sstate->info;
635 return 0;
636 }
637 info = kzalloc(sizeof(struct async_struct), GFP_KERNEL);
638 if (!info) {
639 sstate->count--;
640 return -ENOMEM;
641 }
642 init_waitqueue_head(&info->open_wait);
643 init_waitqueue_head(&info->close_wait);
644 init_waitqueue_head(&info->delta_msr_wait);
645 info->magic = SERIAL_MAGIC;
646 info->port = sstate->port;
647 info->flags = sstate->flags;
648 info->xmit_fifo_size = sstate->xmit_fifo_size;
649 info->line = line;
650 INIT_WORK(&info->work, do_softint);
651 info->state = sstate;
652 if (sstate->info) {
653 kfree(info);
654 *ret_info = sstate->info;
655 return 0;
656 }
657 *ret_info = sstate->info = info;
658 return 0;
659}
660
661static int
662startup(struct async_struct *info)
663{
664 unsigned long flags;
665 int retval=0;
666 irq_handler_t handler;
667 struct serial_state *state= info->state;
668 unsigned long page;
387 669
388 page = get_zeroed_page(GFP_KERNEL); 670 page = get_zeroed_page(GFP_KERNEL);
389 if (!page) 671 if (!page)
@@ -391,31 +673,86 @@ static int activate(struct tty_port *port, struct tty_struct *tty)
391 673
392 local_irq_save(flags); 674 local_irq_save(flags);
393 675
394 if (state->xmit.buf) 676 if (info->flags & ASYNC_INITIALIZED) {
677 free_page(page);
678 goto errout;
679 }
680
681 if (!state->port || !state->type) {
682 if (info->tty) set_bit(TTY_IO_ERROR, &info->tty->flags);
683 free_page(page);
684 goto errout;
685 }
686 if (info->xmit.buf)
395 free_page(page); 687 free_page(page);
396 else 688 else
397 state->xmit.buf = (unsigned char *) page; 689 info->xmit.buf = (unsigned char *) page;
690
691#ifdef SIMSERIAL_DEBUG
692 printk("startup: ttys%d (irq %d)...", info->line, state->irq);
693#endif
398 694
399 if (state->irq) { 695 /*
400 retval = request_irq(state->irq, rs_interrupt_single, 0, 696 * Allocate the IRQ if necessary
401 "simserial", state); 697 */
402 if (retval) 698 if (state->irq && (!IRQ_ports[state->irq] ||
699 !IRQ_ports[state->irq]->next_port)) {
700 if (IRQ_ports[state->irq]) {
701 retval = -EBUSY;
702 goto errout;
703 } else
704 handler = rs_interrupt_single;
705
706 retval = request_irq(state->irq, handler, IRQ_T(info), "simserial", NULL);
707 if (retval) {
708 if (capable(CAP_SYS_ADMIN)) {
709 if (info->tty)
710 set_bit(TTY_IO_ERROR,
711 &info->tty->flags);
712 retval = 0;
713 }
403 goto errout; 714 goto errout;
715 }
404 } 716 }
405 717
406 state->xmit.head = state->xmit.tail = 0; 718 /*
719 * Insert serial port into IRQ chain.
720 */
721 info->prev_port = NULL;
722 info->next_port = IRQ_ports[state->irq];
723 if (info->next_port)
724 info->next_port->prev_port = info;
725 IRQ_ports[state->irq] = info;
726
727 if (info->tty) clear_bit(TTY_IO_ERROR, &info->tty->flags);
728
729 info->xmit.head = info->xmit.tail = 0;
730
731#if 0
732 /*
733 * Set up serial timers...
734 */
735 timer_table[RS_TIMER].expires = jiffies + 2*HZ/100;
736 timer_active |= 1 << RS_TIMER;
737#endif
407 738
408 /* 739 /*
409 * Set up the tty->alt_speed kludge 740 * Set up the tty->alt_speed kludge
410 */ 741 */
411 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) 742 if (info->tty) {
412 tty->alt_speed = 57600; 743 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
413 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) 744 info->tty->alt_speed = 57600;
414 tty->alt_speed = 115200; 745 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
415 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) 746 info->tty->alt_speed = 115200;
416 tty->alt_speed = 230400; 747 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)
417 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 748 info->tty->alt_speed = 230400;
418 tty->alt_speed = 460800; 749 if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
750 info->tty->alt_speed = 460800;
751 }
752
753 info->flags |= ASYNC_INITIALIZED;
754 local_irq_restore(flags);
755 return 0;
419 756
420errout: 757errout:
421 local_irq_restore(flags); 758 local_irq_restore(flags);
@@ -431,11 +768,56 @@ errout:
431 */ 768 */
432static int rs_open(struct tty_struct *tty, struct file * filp) 769static int rs_open(struct tty_struct *tty, struct file * filp)
433{ 770{
434 struct serial_state *info = rs_table + tty->index; 771 struct async_struct *info;
435 struct tty_port *port = &info->port; 772 int retval, line;
773 unsigned long page;
436 774
775 line = tty->index;
776 if ((line < 0) || (line >= NR_PORTS))
777 return -ENODEV;
778 retval = get_async_struct(line, &info);
779 if (retval)
780 return retval;
437 tty->driver_data = info; 781 tty->driver_data = info;
438 tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 782 info->tty = tty;
783
784#ifdef SIMSERIAL_DEBUG
785 printk("rs_open %s, count = %d\n", tty->name, info->state->count);
786#endif
787 info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
788
789 if (!tmp_buf) {
790 page = get_zeroed_page(GFP_KERNEL);
791 if (!page)
792 return -ENOMEM;
793 if (tmp_buf)
794 free_page(page);
795 else
796 tmp_buf = (unsigned char *) page;
797 }
798
799 /*
800 * If the port is the middle of closing, bail out now
801 */
802 if (tty_hung_up_p(filp) ||
803 (info->flags & ASYNC_CLOSING)) {
804 if (info->flags & ASYNC_CLOSING)
805 interruptible_sleep_on(&info->close_wait);
806#ifdef SERIAL_DO_RESTART
807 return ((info->flags & ASYNC_HUP_NOTIFY) ?
808 -EAGAIN : -ERESTARTSYS);
809#else
810 return -EAGAIN;
811#endif
812 }
813
814 /*
815 * Start up serial port
816 */
817 retval = startup(info);
818 if (retval) {
819 return retval;
820 }
439 821
440 /* 822 /*
441 * figure out which console to use (should be one already) 823 * figure out which console to use (should be one already)
@@ -446,21 +828,30 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
446 console = console->next; 828 console = console->next;
447 } 829 }
448 830
449 return tty_port_open(port, tty, filp); 831#ifdef SIMSERIAL_DEBUG
832 printk("rs_open ttys%d successful\n", info->line);
833#endif
834 return 0;
450} 835}
451 836
452/* 837/*
453 * /proc fs routines.... 838 * /proc fs routines....
454 */ 839 */
455 840
841static inline void line_info(struct seq_file *m, struct serial_state *state)
842{
843 seq_printf(m, "%d: uart:%s port:%lX irq:%d\n",
844 state->line, uart_config[state->type].name,
845 state->port, state->irq);
846}
847
456static int rs_proc_show(struct seq_file *m, void *v) 848static int rs_proc_show(struct seq_file *m, void *v)
457{ 849{
458 int i; 850 int i;
459 851
460 seq_printf(m, "simserinfo:1.0\n"); 852 seq_printf(m, "simserinfo:1.0 driver:%s\n", serial_version);
461 for (i = 0; i < NR_PORTS; i++) 853 for (i = 0; i < NR_PORTS; i++)
462 seq_printf(m, "%d: uart:16550 port:3F8 irq:%d\n", 854 line_info(m, &rs_table[i]);
463 i, rs_table[i].irq);
464 return 0; 855 return 0;
465} 856}
466 857
@@ -477,6 +868,25 @@ static const struct file_operations rs_proc_fops = {
477 .release = single_release, 868 .release = single_release,
478}; 869};
479 870
871/*
872 * ---------------------------------------------------------------------
873 * rs_init() and friends
874 *
875 * rs_init() is called at boot-time to initialize the serial driver.
876 * ---------------------------------------------------------------------
877 */
878
879/*
880 * This routine prints out the appropriate serial driver version
881 * number, and identifies which options were configured into this
882 * driver.
883 */
884static inline void show_serial_version(void)
885{
886 printk(KERN_INFO "%s version %s with", serial_name, serial_version);
887 printk(KERN_INFO " no serial options enabled\n");
888}
889
480static const struct tty_operations hp_ops = { 890static const struct tty_operations hp_ops = {
481 .open = rs_open, 891 .open = rs_open,
482 .close = rs_close, 892 .close = rs_close,
@@ -491,31 +901,34 @@ static const struct tty_operations hp_ops = {
491 .unthrottle = rs_unthrottle, 901 .unthrottle = rs_unthrottle,
492 .send_xchar = rs_send_xchar, 902 .send_xchar = rs_send_xchar,
493 .set_termios = rs_set_termios, 903 .set_termios = rs_set_termios,
904 .stop = rs_stop,
905 .start = rs_start,
494 .hangup = rs_hangup, 906 .hangup = rs_hangup,
907 .wait_until_sent = rs_wait_until_sent,
495 .proc_fops = &rs_proc_fops, 908 .proc_fops = &rs_proc_fops,
496}; 909};
497 910
498static const struct tty_port_operations hp_port_ops = { 911/*
499 .activate = activate, 912 * The serial driver boot-time initialization code!
500 .shutdown = shutdown, 913 */
501}; 914static int __init
502 915simrs_init (void)
503static int __init simrs_init(void)
504{ 916{
505 struct serial_state *state; 917 int i, rc;
506 int retval; 918 struct serial_state *state;
507 919
508 if (!ia64_platform_is("hpsim")) 920 if (!ia64_platform_is("hpsim"))
509 return -ENODEV; 921 return -ENODEV;
510 922
511 hp_simserial_driver = alloc_tty_driver(NR_PORTS); 923 hp_simserial_driver = alloc_tty_driver(1);
512 if (!hp_simserial_driver) 924 if (!hp_simserial_driver)
513 return -ENOMEM; 925 return -ENOMEM;
514 926
515 printk(KERN_INFO "SimSerial driver with no serial options enabled\n"); 927 show_serial_version();
516 928
517 /* Initialize the tty_driver structure */ 929 /* Initialize the tty_driver structure */
518 930
931 hp_simserial_driver->owner = THIS_MODULE;
519 hp_simserial_driver->driver_name = "simserial"; 932 hp_simserial_driver->driver_name = "simserial";
520 hp_simserial_driver->name = "ttyS"; 933 hp_simserial_driver->name = "ttyS";
521 hp_simserial_driver->major = TTY_MAJOR; 934 hp_simserial_driver->major = TTY_MAJOR;
@@ -528,35 +941,31 @@ static int __init simrs_init(void)
528 hp_simserial_driver->flags = TTY_DRIVER_REAL_RAW; 941 hp_simserial_driver->flags = TTY_DRIVER_REAL_RAW;
529 tty_set_operations(hp_simserial_driver, &hp_ops); 942 tty_set_operations(hp_simserial_driver, &hp_ops);
530 943
531 state = rs_table; 944 /*
532 tty_port_init(&state->port); 945 * Let's have a little bit of fun !
533 state->port.ops = &hp_port_ops; 946 */
534 state->port.close_delay = 0; /* XXX really 0? */ 947 for (i = 0, state = rs_table; i < NR_PORTS; i++,state++) {
535
536 retval = hpsim_get_irq(KEYBOARD_INTR);
537 if (retval < 0) {
538 printk(KERN_ERR "%s: out of interrupt vectors!\n",
539 __func__);
540 goto err_free_tty;
541 }
542 948
543 state->irq = retval; 949 if (state->type == PORT_UNKNOWN) continue;
544 950
545 /* the port is imaginary */ 951 if (!state->irq) {
546 printk(KERN_INFO "ttyS0 at 0x03f8 (irq = %d) is a 16550\n", state->irq); 952 if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0)
953 panic("%s: out of interrupt vectors!\n",
954 __func__);
955 state->irq = rc;
956 ia64_ssc_connect_irq(KEYBOARD_INTR, state->irq);
957 }
547 958
548 tty_port_link_device(&state->port, hp_simserial_driver, 0); 959 printk(KERN_INFO "ttyS%d at 0x%04lx (irq = %d) is a %s\n",
549 retval = tty_register_driver(hp_simserial_driver); 960 state->line,
550 if (retval) { 961 state->port, state->irq,
551 printk(KERN_ERR "Couldn't register simserial driver\n"); 962 uart_config[state->type].name);
552 goto err_free_tty;
553 } 963 }
554 964
965 if (tty_register_driver(hp_simserial_driver))
966 panic("Couldn't register simserial driver\n");
967
555 return 0; 968 return 0;
556err_free_tty:
557 put_tty_driver(hp_simserial_driver);
558 tty_port_destroy(&state->port);
559 return retval;
560} 969}
561 970
562#ifndef MODULE 971#ifndef MODULE
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 05b03ecd793..241d1c53ba6 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -1,5 +1,14 @@
1include include/asm-generic/Kbuild.asm
1 2
2generic-y += clkdev.h 3header-y += break.h
3generic-y += exec.h 4header-y += fpu.h
4generic-y += kvm_para.h 5header-y += gcc_intrin.h
5generic-y += trace_clock.h 6header-y += ia64regs.h
7header-y += intel_intrin.h
8header-y += intrinsics.h
9header-y += perfmon.h
10header-y += perfmon_default_smpl.h
11header-y += ptrace_offsets.h
12header-y += rse.h
13header-y += ucontext.h
14header-y += ustack.h
diff --git a/arch/ia64/include/asm/acpi.h b/arch/ia64/include/asm/acpi.h
index 359e68a03ca..a06dfb13d51 100644
--- a/arch/ia64/include/asm/acpi.h
+++ b/arch/ia64/include/asm/acpi.h
@@ -32,6 +32,7 @@
32 32
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/numa.h> 34#include <linux/numa.h>
35#include <asm/system.h>
35#include <asm/numa.h> 36#include <asm/numa.h>
36 37
37#define COMPILER_DEPENDENT_INT64 long 38#define COMPILER_DEPENDENT_INT64 long
@@ -153,7 +154,7 @@ extern int additional_cpus;
153#else 154#else
154#define MAX_PXM_DOMAINS (256) 155#define MAX_PXM_DOMAINS (256)
155#endif 156#endif
156extern int pxm_to_nid_map[MAX_PXM_DOMAINS]; 157extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
157extern int __initdata nid_to_pxm_map[MAX_NUMNODES]; 158extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
158#endif 159#endif
159 160
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h
index 6e6fe1839f5..3fad89ee01c 100644
--- a/arch/ia64/include/asm/atomic.h
+++ b/arch/ia64/include/asm/atomic.h
@@ -15,10 +15,11 @@
15#include <linux/types.h> 15#include <linux/types.h>
16 16
17#include <asm/intrinsics.h> 17#include <asm/intrinsics.h>
18#include <asm/system.h>
18 19
19 20
20#define ATOMIC_INIT(i) { (i) } 21#define ATOMIC_INIT(i) ((atomic_t) { (i) })
21#define ATOMIC64_INIT(i) { (i) } 22#define ATOMIC64_INIT(i) ((atomic64_t) { (i) })
22 23
23#define atomic_read(v) (*(volatile int *)&(v)->counter) 24#define atomic_read(v) (*(volatile int *)&(v)->counter)
24#define atomic64_read(v) (*(volatile long *)&(v)->counter) 25#define atomic64_read(v) (*(volatile long *)&(v)->counter)
diff --git a/arch/ia64/include/asm/barrier.h b/arch/ia64/include/asm/barrier.h
deleted file mode 100644
index 60576e06b6f..00000000000
--- a/arch/ia64/include/asm/barrier.h
+++ /dev/null
@@ -1,68 +0,0 @@
1/*
2 * Memory barrier definitions. This is based on information published
3 * in the Processor Abstraction Layer and the System Abstraction Layer
4 * manual.
5 *
6 * Copyright (C) 1998-2003 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
9 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
10 */
11#ifndef _ASM_IA64_BARRIER_H
12#define _ASM_IA64_BARRIER_H
13
14#include <linux/compiler.h>
15
16/*
17 * Macros to force memory ordering. In these descriptions, "previous"
18 * and "subsequent" refer to program order; "visible" means that all
19 * architecturally visible effects of a memory access have occurred
20 * (at a minimum, this means the memory has been read or written).
21 *
22 * wmb(): Guarantees that all preceding stores to memory-
23 * like regions are visible before any subsequent
24 * stores and that all following stores will be
25 * visible only after all previous stores.
26 * rmb(): Like wmb(), but for reads.
27 * mb(): wmb()/rmb() combo, i.e., all previous memory
28 * accesses are visible before all subsequent
29 * accesses and vice versa. This is also known as
30 * a "fence."
31 *
32 * Note: "mb()" and its variants cannot be used as a fence to order
33 * accesses to memory mapped I/O registers. For that, mf.a needs to
34 * be used. However, we don't want to always use mf.a because (a)
35 * it's (presumably) much slower than mf and (b) mf.a is supported for
36 * sequential memory pages only.
37 */
38#define mb() ia64_mf()
39#define rmb() mb()
40#define wmb() mb()
41#define read_barrier_depends() do { } while(0)
42
43#ifdef CONFIG_SMP
44# define smp_mb() mb()
45# define smp_rmb() rmb()
46# define smp_wmb() wmb()
47# define smp_read_barrier_depends() read_barrier_depends()
48#else
49# define smp_mb() barrier()
50# define smp_rmb() barrier()
51# define smp_wmb() barrier()
52# define smp_read_barrier_depends() do { } while(0)
53#endif
54
55/*
56 * XXX check on this ---I suspect what Linus really wants here is
57 * acquire vs release semantics but we can't discuss this stuff with
58 * Linus just yet. Grrr...
59 */
60#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
61
62/*
63 * The group barrier in front of the rsm & ssm are necessary to ensure
64 * that none of the previous instructions in the same group are
65 * affected by the rsm/ssm.
66 */
67
68#endif /* _ASM_IA64_BARRIER_H */
diff --git a/arch/ia64/include/asm/cputime.h b/arch/ia64/include/asm/cputime.h
index 7fcf7f08ab0..6073b187528 100644
--- a/arch/ia64/include/asm/cputime.h
+++ b/arch/ia64/include/asm/cputime.h
@@ -26,53 +26,59 @@
26#include <linux/jiffies.h> 26#include <linux/jiffies.h>
27#include <asm/processor.h> 27#include <asm/processor.h>
28 28
29typedef u64 __nocast cputime_t; 29typedef u64 cputime_t;
30typedef u64 __nocast cputime64_t; 30typedef u64 cputime64_t;
31 31
32#define cputime_zero ((cputime_t)0)
32#define cputime_one_jiffy jiffies_to_cputime(1) 33#define cputime_one_jiffy jiffies_to_cputime(1)
34#define cputime_max ((~((cputime_t)0) >> 1) - 1)
35#define cputime_add(__a, __b) ((__a) + (__b))
36#define cputime_sub(__a, __b) ((__a) - (__b))
37#define cputime_div(__a, __n) ((__a) / (__n))
38#define cputime_halve(__a) ((__a) >> 1)
39#define cputime_eq(__a, __b) ((__a) == (__b))
40#define cputime_gt(__a, __b) ((__a) > (__b))
41#define cputime_ge(__a, __b) ((__a) >= (__b))
42#define cputime_lt(__a, __b) ((__a) < (__b))
43#define cputime_le(__a, __b) ((__a) <= (__b))
44
45#define cputime64_zero ((cputime64_t)0)
46#define cputime64_add(__a, __b) ((__a) + (__b))
47#define cputime64_sub(__a, __b) ((__a) - (__b))
48#define cputime_to_cputime64(__ct) (__ct)
33 49
34/* 50/*
35 * Convert cputime <-> jiffies (HZ) 51 * Convert cputime <-> jiffies (HZ)
36 */ 52 */
37#define cputime_to_jiffies(__ct) \ 53#define cputime_to_jiffies(__ct) ((__ct) / (NSEC_PER_SEC / HZ))
38 ((__force u64)(__ct) / (NSEC_PER_SEC / HZ)) 54#define jiffies_to_cputime(__jif) ((__jif) * (NSEC_PER_SEC / HZ))
39#define jiffies_to_cputime(__jif) \ 55#define cputime64_to_jiffies64(__ct) ((__ct) / (NSEC_PER_SEC / HZ))
40 (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ)) 56#define jiffies64_to_cputime64(__jif) ((__jif) * (NSEC_PER_SEC / HZ))
41#define cputime64_to_jiffies64(__ct) \
42 ((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
43#define jiffies64_to_cputime64(__jif) \
44 (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ))
45 57
46/* 58/*
47 * Convert cputime <-> microseconds 59 * Convert cputime <-> microseconds
48 */ 60 */
49#define cputime_to_usecs(__ct) \ 61#define cputime_to_usecs(__ct) ((__ct) / NSEC_PER_USEC)
50 ((__force u64)(__ct) / NSEC_PER_USEC) 62#define usecs_to_cputime(__usecs) ((__usecs) * NSEC_PER_USEC)
51#define usecs_to_cputime(__usecs) \
52 (__force cputime_t)((__usecs) * NSEC_PER_USEC)
53#define usecs_to_cputime64(__usecs) \
54 (__force cputime64_t)((__usecs) * NSEC_PER_USEC)
55 63
56/* 64/*
57 * Convert cputime <-> seconds 65 * Convert cputime <-> seconds
58 */ 66 */
59#define cputime_to_secs(__ct) \ 67#define cputime_to_secs(__ct) ((__ct) / NSEC_PER_SEC)
60 ((__force u64)(__ct) / NSEC_PER_SEC) 68#define secs_to_cputime(__secs) ((__secs) * NSEC_PER_SEC)
61#define secs_to_cputime(__secs) \
62 (__force cputime_t)((__secs) * NSEC_PER_SEC)
63 69
64/* 70/*
65 * Convert cputime <-> timespec (nsec) 71 * Convert cputime <-> timespec (nsec)
66 */ 72 */
67static inline cputime_t timespec_to_cputime(const struct timespec *val) 73static inline cputime_t timespec_to_cputime(const struct timespec *val)
68{ 74{
69 u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec; 75 cputime_t ret = val->tv_sec * NSEC_PER_SEC;
70 return (__force cputime_t) ret; 76 return (ret + val->tv_nsec);
71} 77}
72static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val) 78static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
73{ 79{
74 val->tv_sec = (__force u64) ct / NSEC_PER_SEC; 80 val->tv_sec = ct / NSEC_PER_SEC;
75 val->tv_nsec = (__force u64) ct % NSEC_PER_SEC; 81 val->tv_nsec = ct % NSEC_PER_SEC;
76} 82}
77 83
78/* 84/*
@@ -80,30 +86,25 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
80 */ 86 */
81static inline cputime_t timeval_to_cputime(struct timeval *val) 87static inline cputime_t timeval_to_cputime(struct timeval *val)
82{ 88{
83 u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC; 89 cputime_t ret = val->tv_sec * NSEC_PER_SEC;
84 return (__force cputime_t) ret; 90 return (ret + val->tv_usec * NSEC_PER_USEC);
85} 91}
86static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val) 92static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
87{ 93{
88 val->tv_sec = (__force u64) ct / NSEC_PER_SEC; 94 val->tv_sec = ct / NSEC_PER_SEC;
89 val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC; 95 val->tv_usec = (ct % NSEC_PER_SEC) / NSEC_PER_USEC;
90} 96}
91 97
92/* 98/*
93 * Convert cputime <-> clock (USER_HZ) 99 * Convert cputime <-> clock (USER_HZ)
94 */ 100 */
95#define cputime_to_clock_t(__ct) \ 101#define cputime_to_clock_t(__ct) ((__ct) / (NSEC_PER_SEC / USER_HZ))
96 ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ)) 102#define clock_t_to_cputime(__x) ((__x) * (NSEC_PER_SEC / USER_HZ))
97#define clock_t_to_cputime(__x) \
98 (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ))
99 103
100/* 104/*
101 * Convert cputime64 to clock. 105 * Convert cputime64 to clock.
102 */ 106 */
103#define cputime64_to_clock_t(__ct) \ 107#define cputime64_to_clock_t(__ct) cputime_to_clock_t((cputime_t)__ct)
104 cputime_to_clock_t((__force cputime_t)__ct)
105
106extern void arch_vtime_task_switch(struct task_struct *tsk);
107 108
108#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ 109#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
109#endif /* __IA64_CPUTIME_H */ 110#endif /* __IA64_CPUTIME_H */
diff --git a/arch/ia64/include/asm/device.h b/arch/ia64/include/asm/device.h
index f69c32ffbe6..d05e78f6db9 100644
--- a/arch/ia64/include/asm/device.h
+++ b/arch/ia64/include/asm/device.h
@@ -7,6 +7,9 @@
7#define _ASM_IA64_DEVICE_H 7#define _ASM_IA64_DEVICE_H
8 8
9struct dev_archdata { 9struct dev_archdata {
10#ifdef CONFIG_ACPI
11 void *acpi_handle;
12#endif
10#ifdef CONFIG_INTEL_IOMMU 13#ifdef CONFIG_INTEL_IOMMU
11 void *iommu; /* hook for IOMMU specific extension */ 14 void *iommu; /* hook for IOMMU specific extension */
12#endif 15#endif
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index cf3ab7e784b..4336d080b24 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -23,29 +23,23 @@ extern void machvec_dma_sync_single(struct device *, dma_addr_t, size_t,
23extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int, 23extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int,
24 enum dma_data_direction); 24 enum dma_data_direction);
25 25
26#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL) 26static inline void *dma_alloc_coherent(struct device *dev, size_t size,
27 27 dma_addr_t *daddr, gfp_t gfp)
28static inline void *dma_alloc_attrs(struct device *dev, size_t size,
29 dma_addr_t *daddr, gfp_t gfp,
30 struct dma_attrs *attrs)
31{ 28{
32 struct dma_map_ops *ops = platform_dma_get_ops(dev); 29 struct dma_map_ops *ops = platform_dma_get_ops(dev);
33 void *caddr; 30 void *caddr;
34 31
35 caddr = ops->alloc(dev, size, daddr, gfp, attrs); 32 caddr = ops->alloc_coherent(dev, size, daddr, gfp);
36 debug_dma_alloc_coherent(dev, size, *daddr, caddr); 33 debug_dma_alloc_coherent(dev, size, *daddr, caddr);
37 return caddr; 34 return caddr;
38} 35}
39 36
40#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL) 37static inline void dma_free_coherent(struct device *dev, size_t size,
41 38 void *caddr, dma_addr_t daddr)
42static inline void dma_free_attrs(struct device *dev, size_t size,
43 void *caddr, dma_addr_t daddr,
44 struct dma_attrs *attrs)
45{ 39{
46 struct dma_map_ops *ops = platform_dma_get_ops(dev); 40 struct dma_map_ops *ops = platform_dma_get_ops(dev);
47 debug_dma_free_coherent(dev, size, caddr, daddr); 41 debug_dma_free_coherent(dev, size, caddr, daddr);
48 ops->free(dev, size, caddr, daddr, attrs); 42 ops->free_coherent(dev, size, caddr, daddr);
49} 43}
50 44
51#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 45#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
@@ -58,7 +52,6 @@ static inline void dma_free_attrs(struct device *dev, size_t size,
58static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr) 52static inline int dma_mapping_error(struct device *dev, dma_addr_t daddr)
59{ 53{
60 struct dma_map_ops *ops = platform_dma_get_ops(dev); 54 struct dma_map_ops *ops = platform_dma_get_ops(dev);
61 debug_dma_mapping_error(dev, daddr);
62 return ops->mapping_error(dev, daddr); 55 return ops->mapping_error(dev, daddr);
63} 56}
64 57
diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h
index d2bf1fd5e44..8428525ddb2 100644
--- a/arch/ia64/include/asm/futex.h
+++ b/arch/ia64/include/asm/futex.h
@@ -4,6 +4,7 @@
4#include <linux/futex.h> 4#include <linux/futex.h>
5#include <linux/uaccess.h> 5#include <linux/uaccess.h>
6#include <asm/errno.h> 6#include <asm/errno.h>
7#include <asm/system.h>
7 8
8#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \ 9#define __futex_atomic_op1(insn, ret, oldval, uaddr, oparg) \
9do { \ 10do { \
@@ -106,16 +107,15 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
106 return -EFAULT; 107 return -EFAULT;
107 108
108 { 109 {
109 register unsigned long r8 __asm ("r8"); 110 register unsigned long r8 __asm ("r8") = 0;
110 unsigned long prev; 111 unsigned long prev;
111 __asm__ __volatile__( 112 __asm__ __volatile__(
112 " mf;; \n" 113 " mf;; \n"
113 " mov %0=r0 \n" 114 " mov ar.ccv=%3;; \n"
114 " mov ar.ccv=%4;; \n" 115 "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n"
115 "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n"
116 " .xdata4 \"__ex_table\", 1b-., 2f-. \n" 116 " .xdata4 \"__ex_table\", 1b-., 2f-. \n"
117 "[2:]" 117 "[2:]"
118 : "=r" (r8), "=r" (prev) 118 : "=r" (prev)
119 : "r" (uaddr), "r" (newval), 119 : "r" (uaddr), "r" (newval),
120 "rO" ((long) (unsigned) oldval) 120 "rO" ((long) (unsigned) oldval)
121 : "memory"); 121 : "memory");
diff --git a/arch/ia64/include/asm/gcc_intrin.h b/arch/ia64/include/asm/gcc_intrin.h
index f9495b1757a..21ddee54ada 100644
--- a/arch/ia64/include/asm/gcc_intrin.h
+++ b/arch/ia64/include/asm/gcc_intrin.h
@@ -1,12 +1,621 @@
1#ifndef _ASM_IA64_GCC_INTRIN_H
2#define _ASM_IA64_GCC_INTRIN_H
1/* 3/*
2 * 4 *
3 * Copyright (C) 2002,2003 Jun Nakajima <jun.nakajima@intel.com> 5 * Copyright (C) 2002,2003 Jun Nakajima <jun.nakajima@intel.com>
4 * Copyright (C) 2002,2003 Suresh Siddha <suresh.b.siddha@intel.com> 6 * Copyright (C) 2002,2003 Suresh Siddha <suresh.b.siddha@intel.com>
5 */ 7 */
6#ifndef _ASM_IA64_GCC_INTRIN_H
7#define _ASM_IA64_GCC_INTRIN_H
8 8
9#include <uapi/asm/gcc_intrin.h> 9#include <linux/types.h>
10#include <linux/compiler.h>
11
12/* define this macro to get some asm stmts included in 'c' files */
13#define ASM_SUPPORTED
14
15/* Optimization barrier */
16/* The "volatile" is due to gcc bugs */
17#define ia64_barrier() asm volatile ("":::"memory")
18
19#define ia64_stop() asm volatile (";;"::)
20
21#define ia64_invala_gr(regnum) asm volatile ("invala.e r%0" :: "i"(regnum))
22
23#define ia64_invala_fr(regnum) asm volatile ("invala.e f%0" :: "i"(regnum))
24
25#define ia64_flushrs() asm volatile ("flushrs;;":::"memory")
26
27#define ia64_loadrs() asm volatile ("loadrs;;":::"memory")
28
29extern void ia64_bad_param_for_setreg (void);
30extern void ia64_bad_param_for_getreg (void);
10 31
32#ifdef __KERNEL__
11register unsigned long ia64_r13 asm ("r13") __used; 33register unsigned long ia64_r13 asm ("r13") __used;
34#endif
35
36#define ia64_native_setreg(regnum, val) \
37({ \
38 switch (regnum) { \
39 case _IA64_REG_PSR_L: \
40 asm volatile ("mov psr.l=%0" :: "r"(val) : "memory"); \
41 break; \
42 case _IA64_REG_AR_KR0 ... _IA64_REG_AR_EC: \
43 asm volatile ("mov ar%0=%1" :: \
44 "i" (regnum - _IA64_REG_AR_KR0), \
45 "r"(val): "memory"); \
46 break; \
47 case _IA64_REG_CR_DCR ... _IA64_REG_CR_LRR1: \
48 asm volatile ("mov cr%0=%1" :: \
49 "i" (regnum - _IA64_REG_CR_DCR), \
50 "r"(val): "memory" ); \
51 break; \
52 case _IA64_REG_SP: \
53 asm volatile ("mov r12=%0" :: \
54 "r"(val): "memory"); \
55 break; \
56 case _IA64_REG_GP: \
57 asm volatile ("mov gp=%0" :: "r"(val) : "memory"); \
58 break; \
59 default: \
60 ia64_bad_param_for_setreg(); \
61 break; \
62 } \
63})
64
65#define ia64_native_getreg(regnum) \
66({ \
67 __u64 ia64_intri_res; \
68 \
69 switch (regnum) { \
70 case _IA64_REG_GP: \
71 asm volatile ("mov %0=gp" : "=r"(ia64_intri_res)); \
72 break; \
73 case _IA64_REG_IP: \
74 asm volatile ("mov %0=ip" : "=r"(ia64_intri_res)); \
75 break; \
76 case _IA64_REG_PSR: \
77 asm volatile ("mov %0=psr" : "=r"(ia64_intri_res)); \
78 break; \
79 case _IA64_REG_TP: /* for current() */ \
80 ia64_intri_res = ia64_r13; \
81 break; \
82 case _IA64_REG_AR_KR0 ... _IA64_REG_AR_EC: \
83 asm volatile ("mov %0=ar%1" : "=r" (ia64_intri_res) \
84 : "i"(regnum - _IA64_REG_AR_KR0)); \
85 break; \
86 case _IA64_REG_CR_DCR ... _IA64_REG_CR_LRR1: \
87 asm volatile ("mov %0=cr%1" : "=r" (ia64_intri_res) \
88 : "i" (regnum - _IA64_REG_CR_DCR)); \
89 break; \
90 case _IA64_REG_SP: \
91 asm volatile ("mov %0=sp" : "=r" (ia64_intri_res)); \
92 break; \
93 default: \
94 ia64_bad_param_for_getreg(); \
95 break; \
96 } \
97 ia64_intri_res; \
98})
99
100#define ia64_hint_pause 0
101
102#define ia64_hint(mode) \
103({ \
104 switch (mode) { \
105 case ia64_hint_pause: \
106 asm volatile ("hint @pause" ::: "memory"); \
107 break; \
108 } \
109})
110
111
112/* Integer values for mux1 instruction */
113#define ia64_mux1_brcst 0
114#define ia64_mux1_mix 8
115#define ia64_mux1_shuf 9
116#define ia64_mux1_alt 10
117#define ia64_mux1_rev 11
118
119#define ia64_mux1(x, mode) \
120({ \
121 __u64 ia64_intri_res; \
122 \
123 switch (mode) { \
124 case ia64_mux1_brcst: \
125 asm ("mux1 %0=%1,@brcst" : "=r" (ia64_intri_res) : "r" (x)); \
126 break; \
127 case ia64_mux1_mix: \
128 asm ("mux1 %0=%1,@mix" : "=r" (ia64_intri_res) : "r" (x)); \
129 break; \
130 case ia64_mux1_shuf: \
131 asm ("mux1 %0=%1,@shuf" : "=r" (ia64_intri_res) : "r" (x)); \
132 break; \
133 case ia64_mux1_alt: \
134 asm ("mux1 %0=%1,@alt" : "=r" (ia64_intri_res) : "r" (x)); \
135 break; \
136 case ia64_mux1_rev: \
137 asm ("mux1 %0=%1,@rev" : "=r" (ia64_intri_res) : "r" (x)); \
138 break; \
139 } \
140 ia64_intri_res; \
141})
142
143#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
144# define ia64_popcnt(x) __builtin_popcountl(x)
145#else
146# define ia64_popcnt(x) \
147 ({ \
148 __u64 ia64_intri_res; \
149 asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \
150 \
151 ia64_intri_res; \
152 })
153#endif
154
155#define ia64_getf_exp(x) \
156({ \
157 long ia64_intri_res; \
158 \
159 asm ("getf.exp %0=%1" : "=r"(ia64_intri_res) : "f"(x)); \
160 \
161 ia64_intri_res; \
162})
163
164#define ia64_shrp(a, b, count) \
165({ \
166 __u64 ia64_intri_res; \
167 asm ("shrp %0=%1,%2,%3" : "=r"(ia64_intri_res) : "r"(a), "r"(b), "i"(count)); \
168 ia64_intri_res; \
169})
170
171#define ia64_ldfs(regnum, x) \
172({ \
173 register double __f__ asm ("f"#regnum); \
174 asm volatile ("ldfs %0=[%1]" :"=f"(__f__): "r"(x)); \
175})
176
177#define ia64_ldfd(regnum, x) \
178({ \
179 register double __f__ asm ("f"#regnum); \
180 asm volatile ("ldfd %0=[%1]" :"=f"(__f__): "r"(x)); \
181})
182
183#define ia64_ldfe(regnum, x) \
184({ \
185 register double __f__ asm ("f"#regnum); \
186 asm volatile ("ldfe %0=[%1]" :"=f"(__f__): "r"(x)); \
187})
188
189#define ia64_ldf8(regnum, x) \
190({ \
191 register double __f__ asm ("f"#regnum); \
192 asm volatile ("ldf8 %0=[%1]" :"=f"(__f__): "r"(x)); \
193})
194
195#define ia64_ldf_fill(regnum, x) \
196({ \
197 register double __f__ asm ("f"#regnum); \
198 asm volatile ("ldf.fill %0=[%1]" :"=f"(__f__): "r"(x)); \
199})
200
201#define ia64_st4_rel_nta(m, val) \
202({ \
203 asm volatile ("st4.rel.nta [%0] = %1\n\t" :: "r"(m), "r"(val)); \
204})
205
206#define ia64_stfs(x, regnum) \
207({ \
208 register double __f__ asm ("f"#regnum); \
209 asm volatile ("stfs [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
210})
211
212#define ia64_stfd(x, regnum) \
213({ \
214 register double __f__ asm ("f"#regnum); \
215 asm volatile ("stfd [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
216})
217
218#define ia64_stfe(x, regnum) \
219({ \
220 register double __f__ asm ("f"#regnum); \
221 asm volatile ("stfe [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
222})
223
224#define ia64_stf8(x, regnum) \
225({ \
226 register double __f__ asm ("f"#regnum); \
227 asm volatile ("stf8 [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
228})
229
230#define ia64_stf_spill(x, regnum) \
231({ \
232 register double __f__ asm ("f"#regnum); \
233 asm volatile ("stf.spill [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
234})
235
236#define ia64_fetchadd4_acq(p, inc) \
237({ \
238 \
239 __u64 ia64_intri_res; \
240 asm volatile ("fetchadd4.acq %0=[%1],%2" \
241 : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \
242 : "memory"); \
243 \
244 ia64_intri_res; \
245})
246
247#define ia64_fetchadd4_rel(p, inc) \
248({ \
249 __u64 ia64_intri_res; \
250 asm volatile ("fetchadd4.rel %0=[%1],%2" \
251 : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \
252 : "memory"); \
253 \
254 ia64_intri_res; \
255})
256
257#define ia64_fetchadd8_acq(p, inc) \
258({ \
259 \
260 __u64 ia64_intri_res; \
261 asm volatile ("fetchadd8.acq %0=[%1],%2" \
262 : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \
263 : "memory"); \
264 \
265 ia64_intri_res; \
266})
267
268#define ia64_fetchadd8_rel(p, inc) \
269({ \
270 __u64 ia64_intri_res; \
271 asm volatile ("fetchadd8.rel %0=[%1],%2" \
272 : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \
273 : "memory"); \
274 \
275 ia64_intri_res; \
276})
277
278#define ia64_xchg1(ptr,x) \
279({ \
280 __u64 ia64_intri_res; \
281 asm volatile ("xchg1 %0=[%1],%2" \
282 : "=r" (ia64_intri_res) : "r" (ptr), "r" (x) : "memory"); \
283 ia64_intri_res; \
284})
285
286#define ia64_xchg2(ptr,x) \
287({ \
288 __u64 ia64_intri_res; \
289 asm volatile ("xchg2 %0=[%1],%2" : "=r" (ia64_intri_res) \
290 : "r" (ptr), "r" (x) : "memory"); \
291 ia64_intri_res; \
292})
293
294#define ia64_xchg4(ptr,x) \
295({ \
296 __u64 ia64_intri_res; \
297 asm volatile ("xchg4 %0=[%1],%2" : "=r" (ia64_intri_res) \
298 : "r" (ptr), "r" (x) : "memory"); \
299 ia64_intri_res; \
300})
301
302#define ia64_xchg8(ptr,x) \
303({ \
304 __u64 ia64_intri_res; \
305 asm volatile ("xchg8 %0=[%1],%2" : "=r" (ia64_intri_res) \
306 : "r" (ptr), "r" (x) : "memory"); \
307 ia64_intri_res; \
308})
309
310#define ia64_cmpxchg1_acq(ptr, new, old) \
311({ \
312 __u64 ia64_intri_res; \
313 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
314 asm volatile ("cmpxchg1.acq %0=[%1],%2,ar.ccv": \
315 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
316 ia64_intri_res; \
317})
318
319#define ia64_cmpxchg1_rel(ptr, new, old) \
320({ \
321 __u64 ia64_intri_res; \
322 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
323 asm volatile ("cmpxchg1.rel %0=[%1],%2,ar.ccv": \
324 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
325 ia64_intri_res; \
326})
327
328#define ia64_cmpxchg2_acq(ptr, new, old) \
329({ \
330 __u64 ia64_intri_res; \
331 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
332 asm volatile ("cmpxchg2.acq %0=[%1],%2,ar.ccv": \
333 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
334 ia64_intri_res; \
335})
336
337#define ia64_cmpxchg2_rel(ptr, new, old) \
338({ \
339 __u64 ia64_intri_res; \
340 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
341 \
342 asm volatile ("cmpxchg2.rel %0=[%1],%2,ar.ccv": \
343 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
344 ia64_intri_res; \
345})
346
347#define ia64_cmpxchg4_acq(ptr, new, old) \
348({ \
349 __u64 ia64_intri_res; \
350 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
351 asm volatile ("cmpxchg4.acq %0=[%1],%2,ar.ccv": \
352 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
353 ia64_intri_res; \
354})
355
356#define ia64_cmpxchg4_rel(ptr, new, old) \
357({ \
358 __u64 ia64_intri_res; \
359 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
360 asm volatile ("cmpxchg4.rel %0=[%1],%2,ar.ccv": \
361 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
362 ia64_intri_res; \
363})
364
365#define ia64_cmpxchg8_acq(ptr, new, old) \
366({ \
367 __u64 ia64_intri_res; \
368 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
369 asm volatile ("cmpxchg8.acq %0=[%1],%2,ar.ccv": \
370 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
371 ia64_intri_res; \
372})
373
374#define ia64_cmpxchg8_rel(ptr, new, old) \
375({ \
376 __u64 ia64_intri_res; \
377 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
378 \
379 asm volatile ("cmpxchg8.rel %0=[%1],%2,ar.ccv": \
380 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
381 ia64_intri_res; \
382})
383
384#define ia64_mf() asm volatile ("mf" ::: "memory")
385#define ia64_mfa() asm volatile ("mf.a" ::: "memory")
386
387#define ia64_invala() asm volatile ("invala" ::: "memory")
388
389#define ia64_native_thash(addr) \
390({ \
391 unsigned long ia64_intri_res; \
392 asm volatile ("thash %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \
393 ia64_intri_res; \
394})
395
396#define ia64_srlz_i() asm volatile (";; srlz.i ;;" ::: "memory")
397#define ia64_srlz_d() asm volatile (";; srlz.d" ::: "memory");
398
399#ifdef HAVE_SERIALIZE_DIRECTIVE
400# define ia64_dv_serialize_data() asm volatile (".serialize.data");
401# define ia64_dv_serialize_instruction() asm volatile (".serialize.instruction");
402#else
403# define ia64_dv_serialize_data()
404# define ia64_dv_serialize_instruction()
405#endif
406
407#define ia64_nop(x) asm volatile ("nop %0"::"i"(x));
408
409#define ia64_itci(addr) asm volatile ("itc.i %0;;" :: "r"(addr) : "memory")
410
411#define ia64_itcd(addr) asm volatile ("itc.d %0;;" :: "r"(addr) : "memory")
412
413
414#define ia64_itri(trnum, addr) asm volatile ("itr.i itr[%0]=%1" \
415 :: "r"(trnum), "r"(addr) : "memory")
416
417#define ia64_itrd(trnum, addr) asm volatile ("itr.d dtr[%0]=%1" \
418 :: "r"(trnum), "r"(addr) : "memory")
419
420#define ia64_tpa(addr) \
421({ \
422 unsigned long ia64_pa; \
423 asm volatile ("tpa %0 = %1" : "=r"(ia64_pa) : "r"(addr) : "memory"); \
424 ia64_pa; \
425})
426
427#define __ia64_set_dbr(index, val) \
428 asm volatile ("mov dbr[%0]=%1" :: "r"(index), "r"(val) : "memory")
429
430#define ia64_set_ibr(index, val) \
431 asm volatile ("mov ibr[%0]=%1" :: "r"(index), "r"(val) : "memory")
432
433#define ia64_set_pkr(index, val) \
434 asm volatile ("mov pkr[%0]=%1" :: "r"(index), "r"(val) : "memory")
435
436#define ia64_set_pmc(index, val) \
437 asm volatile ("mov pmc[%0]=%1" :: "r"(index), "r"(val) : "memory")
438
439#define ia64_set_pmd(index, val) \
440 asm volatile ("mov pmd[%0]=%1" :: "r"(index), "r"(val) : "memory")
441
442#define ia64_native_set_rr(index, val) \
443 asm volatile ("mov rr[%0]=%1" :: "r"(index), "r"(val) : "memory");
444
445#define ia64_native_get_cpuid(index) \
446({ \
447 unsigned long ia64_intri_res; \
448 asm volatile ("mov %0=cpuid[%r1]" : "=r"(ia64_intri_res) : "rO"(index)); \
449 ia64_intri_res; \
450})
451
452#define __ia64_get_dbr(index) \
453({ \
454 unsigned long ia64_intri_res; \
455 asm volatile ("mov %0=dbr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
456 ia64_intri_res; \
457})
458
459#define ia64_get_ibr(index) \
460({ \
461 unsigned long ia64_intri_res; \
462 asm volatile ("mov %0=ibr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
463 ia64_intri_res; \
464})
465
466#define ia64_get_pkr(index) \
467({ \
468 unsigned long ia64_intri_res; \
469 asm volatile ("mov %0=pkr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
470 ia64_intri_res; \
471})
472
473#define ia64_get_pmc(index) \
474({ \
475 unsigned long ia64_intri_res; \
476 asm volatile ("mov %0=pmc[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
477 ia64_intri_res; \
478})
479
480
481#define ia64_native_get_pmd(index) \
482({ \
483 unsigned long ia64_intri_res; \
484 asm volatile ("mov %0=pmd[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
485 ia64_intri_res; \
486})
487
488#define ia64_native_get_rr(index) \
489({ \
490 unsigned long ia64_intri_res; \
491 asm volatile ("mov %0=rr[%1]" : "=r"(ia64_intri_res) : "r" (index)); \
492 ia64_intri_res; \
493})
494
495#define ia64_native_fc(addr) asm volatile ("fc %0" :: "r"(addr) : "memory")
496
497
498#define ia64_sync_i() asm volatile (";; sync.i" ::: "memory")
499
500#define ia64_native_ssm(mask) asm volatile ("ssm %0":: "i"((mask)) : "memory")
501#define ia64_native_rsm(mask) asm volatile ("rsm %0":: "i"((mask)) : "memory")
502#define ia64_sum(mask) asm volatile ("sum %0":: "i"((mask)) : "memory")
503#define ia64_rum(mask) asm volatile ("rum %0":: "i"((mask)) : "memory")
504
505#define ia64_ptce(addr) asm volatile ("ptc.e %0" :: "r"(addr))
506
507#define ia64_native_ptcga(addr, size) \
508do { \
509 asm volatile ("ptc.ga %0,%1" :: "r"(addr), "r"(size) : "memory"); \
510 ia64_dv_serialize_data(); \
511} while (0)
512
513#define ia64_ptcl(addr, size) \
514do { \
515 asm volatile ("ptc.l %0,%1" :: "r"(addr), "r"(size) : "memory"); \
516 ia64_dv_serialize_data(); \
517} while (0)
518
519#define ia64_ptri(addr, size) \
520 asm volatile ("ptr.i %0,%1" :: "r"(addr), "r"(size) : "memory")
521
522#define ia64_ptrd(addr, size) \
523 asm volatile ("ptr.d %0,%1" :: "r"(addr), "r"(size) : "memory")
524
525#define ia64_ttag(addr) \
526({ \
527 __u64 ia64_intri_res; \
528 asm volatile ("ttag %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \
529 ia64_intri_res; \
530})
531
532
533/* Values for lfhint in ia64_lfetch and ia64_lfetch_fault */
534
535#define ia64_lfhint_none 0
536#define ia64_lfhint_nt1 1
537#define ia64_lfhint_nt2 2
538#define ia64_lfhint_nta 3
539
540#define ia64_lfetch(lfhint, y) \
541({ \
542 switch (lfhint) { \
543 case ia64_lfhint_none: \
544 asm volatile ("lfetch [%0]" : : "r"(y)); \
545 break; \
546 case ia64_lfhint_nt1: \
547 asm volatile ("lfetch.nt1 [%0]" : : "r"(y)); \
548 break; \
549 case ia64_lfhint_nt2: \
550 asm volatile ("lfetch.nt2 [%0]" : : "r"(y)); \
551 break; \
552 case ia64_lfhint_nta: \
553 asm volatile ("lfetch.nta [%0]" : : "r"(y)); \
554 break; \
555 } \
556})
557
558#define ia64_lfetch_excl(lfhint, y) \
559({ \
560 switch (lfhint) { \
561 case ia64_lfhint_none: \
562 asm volatile ("lfetch.excl [%0]" :: "r"(y)); \
563 break; \
564 case ia64_lfhint_nt1: \
565 asm volatile ("lfetch.excl.nt1 [%0]" :: "r"(y)); \
566 break; \
567 case ia64_lfhint_nt2: \
568 asm volatile ("lfetch.excl.nt2 [%0]" :: "r"(y)); \
569 break; \
570 case ia64_lfhint_nta: \
571 asm volatile ("lfetch.excl.nta [%0]" :: "r"(y)); \
572 break; \
573 } \
574})
575
576#define ia64_lfetch_fault(lfhint, y) \
577({ \
578 switch (lfhint) { \
579 case ia64_lfhint_none: \
580 asm volatile ("lfetch.fault [%0]" : : "r"(y)); \
581 break; \
582 case ia64_lfhint_nt1: \
583 asm volatile ("lfetch.fault.nt1 [%0]" : : "r"(y)); \
584 break; \
585 case ia64_lfhint_nt2: \
586 asm volatile ("lfetch.fault.nt2 [%0]" : : "r"(y)); \
587 break; \
588 case ia64_lfhint_nta: \
589 asm volatile ("lfetch.fault.nta [%0]" : : "r"(y)); \
590 break; \
591 } \
592})
593
594#define ia64_lfetch_fault_excl(lfhint, y) \
595({ \
596 switch (lfhint) { \
597 case ia64_lfhint_none: \
598 asm volatile ("lfetch.fault.excl [%0]" :: "r"(y)); \
599 break; \
600 case ia64_lfhint_nt1: \
601 asm volatile ("lfetch.fault.excl.nt1 [%0]" :: "r"(y)); \
602 break; \
603 case ia64_lfhint_nt2: \
604 asm volatile ("lfetch.fault.excl.nt2 [%0]" :: "r"(y)); \
605 break; \
606 case ia64_lfhint_nta: \
607 asm volatile ("lfetch.fault.excl.nta [%0]" :: "r"(y)); \
608 break; \
609 } \
610})
611
612#define ia64_native_intrin_local_irq_restore(x) \
613do { \
614 asm volatile (";; cmp.ne p6,p7=%0,r0;;" \
615 "(p6) ssm psr.i;" \
616 "(p7) rsm psr.i;;" \
617 "(p6) srlz.d" \
618 :: "r"((x)) : "p6", "p7", "memory"); \
619} while (0)
620
12#endif /* _ASM_IA64_GCC_INTRIN_H */ 621#endif /* _ASM_IA64_GCC_INTRIN_H */
diff --git a/arch/ia64/include/asm/gpio.h b/arch/ia64/include/asm/gpio.h
index b3799d88ffc..590a20debc4 100644
--- a/arch/ia64/include/asm/gpio.h
+++ b/arch/ia64/include/asm/gpio.h
@@ -1,4 +1,55 @@
1#ifndef __LINUX_GPIO_H 1/*
2#warning Include linux/gpio.h instead of asm/gpio.h 2 * Generic GPIO API implementation for IA-64.
3#include <linux/gpio.h> 3 *
4#endif 4 * A stright copy of that for PowerPC which was:
5 *
6 * Copyright (c) 2007-2008 MontaVista Software, Inc.
7 *
8 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef _ASM_IA64_GPIO_H
17#define _ASM_IA64_GPIO_H
18
19#include <linux/errno.h>
20#include <asm-generic/gpio.h>
21
22#ifdef CONFIG_GPIOLIB
23
24/*
25 * We don't (yet) implement inlined/rapid versions for on-chip gpios.
26 * Just call gpiolib.
27 */
28static inline int gpio_get_value(unsigned int gpio)
29{
30 return __gpio_get_value(gpio);
31}
32
33static inline void gpio_set_value(unsigned int gpio, int value)
34{
35 __gpio_set_value(gpio, value);
36}
37
38static inline int gpio_cansleep(unsigned int gpio)
39{
40 return __gpio_cansleep(gpio);
41}
42
43static inline int gpio_to_irq(unsigned int gpio)
44{
45 return __gpio_to_irq(gpio);
46}
47
48static inline int irq_to_gpio(unsigned int irq)
49{
50 return -EINVAL;
51}
52
53#endif /* CONFIG_GPIOLIB */
54
55#endif /* _ASM_IA64_GPIO_H */
diff --git a/arch/ia64/include/asm/hpsim.h b/arch/ia64/include/asm/hpsim.h
index 0fe50225daa..892ab198a9d 100644
--- a/arch/ia64/include/asm/hpsim.h
+++ b/arch/ia64/include/asm/hpsim.h
@@ -10,7 +10,7 @@ int simcons_register(void);
10struct tty_driver; 10struct tty_driver;
11extern struct tty_driver *hp_simserial_driver; 11extern struct tty_driver *hp_simserial_driver;
12 12
13extern int hpsim_get_irq(int intr); 13void ia64_ssc_connect_irq(long intr, long irq);
14void ia64_ctl_trace(long on); 14void ia64_ctl_trace(long on);
15 15
16#endif 16#endif
diff --git a/arch/ia64/include/asm/hugetlb.h b/arch/ia64/include/asm/hugetlb.h
index 94eaa5bd5d0..da55c63728e 100644
--- a/arch/ia64/include/asm/hugetlb.h
+++ b/arch/ia64/include/asm/hugetlb.h
@@ -77,8 +77,4 @@ static inline void arch_release_hugepage(struct page *page)
77{ 77{
78} 78}
79 79
80static inline void arch_clear_hugepage_flags(struct page *page)
81{
82}
83
84#endif /* _ASM_IA64_HUGETLB_H */ 80#endif /* _ASM_IA64_HUGETLB_H */
diff --git a/arch/ia64/include/asm/intrinsics.h b/arch/ia64/include/asm/intrinsics.h
index 20477ea111b..111ed522289 100644
--- a/arch/ia64/include/asm/intrinsics.h
+++ b/arch/ia64/include/asm/intrinsics.h
@@ -1,25 +1,246 @@
1#ifndef _ASM_IA64_INTRINSICS_H
2#define _ASM_IA64_INTRINSICS_H
3
1/* 4/*
2 * Compiler-dependent intrinsics. 5 * Compiler-dependent intrinsics.
3 * 6 *
4 * Copyright (C) 2002-2003 Hewlett-Packard Co 7 * Copyright (C) 2002-2003 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com> 8 * David Mosberger-Tang <davidm@hpl.hp.com>
6 */ 9 */
7#ifndef _ASM_IA64_INTRINSICS_H
8#define _ASM_IA64_INTRINSICS_H
9 10
11#ifndef __ASSEMBLY__
12
13#include <linux/types.h>
14/* include compiler specific intrinsics */
15#include <asm/ia64regs.h>
16#ifdef __INTEL_COMPILER
17# include <asm/intel_intrin.h>
18#else
19# include <asm/gcc_intrin.h>
20#endif
21
22#define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I)
23
24#define ia64_native_set_rr0_to_rr4(val0, val1, val2, val3, val4) \
25do { \
26 ia64_native_set_rr(0x0000000000000000UL, (val0)); \
27 ia64_native_set_rr(0x2000000000000000UL, (val1)); \
28 ia64_native_set_rr(0x4000000000000000UL, (val2)); \
29 ia64_native_set_rr(0x6000000000000000UL, (val3)); \
30 ia64_native_set_rr(0x8000000000000000UL, (val4)); \
31} while (0)
32
33/*
34 * Force an unresolved reference if someone tries to use
35 * ia64_fetch_and_add() with a bad value.
36 */
37extern unsigned long __bad_size_for_ia64_fetch_and_add (void);
38extern unsigned long __bad_increment_for_ia64_fetch_and_add (void);
39
40#define IA64_FETCHADD(tmp,v,n,sz,sem) \
41({ \
42 switch (sz) { \
43 case 4: \
44 tmp = ia64_fetchadd4_##sem((unsigned int *) v, n); \
45 break; \
46 \
47 case 8: \
48 tmp = ia64_fetchadd8_##sem((unsigned long *) v, n); \
49 break; \
50 \
51 default: \
52 __bad_size_for_ia64_fetch_and_add(); \
53 } \
54})
55
56#define ia64_fetchadd(i,v,sem) \
57({ \
58 __u64 _tmp; \
59 volatile __typeof__(*(v)) *_v = (v); \
60 /* Can't use a switch () here: gcc isn't always smart enough for that... */ \
61 if ((i) == -16) \
62 IA64_FETCHADD(_tmp, _v, -16, sizeof(*(v)), sem); \
63 else if ((i) == -8) \
64 IA64_FETCHADD(_tmp, _v, -8, sizeof(*(v)), sem); \
65 else if ((i) == -4) \
66 IA64_FETCHADD(_tmp, _v, -4, sizeof(*(v)), sem); \
67 else if ((i) == -1) \
68 IA64_FETCHADD(_tmp, _v, -1, sizeof(*(v)), sem); \
69 else if ((i) == 1) \
70 IA64_FETCHADD(_tmp, _v, 1, sizeof(*(v)), sem); \
71 else if ((i) == 4) \
72 IA64_FETCHADD(_tmp, _v, 4, sizeof(*(v)), sem); \
73 else if ((i) == 8) \
74 IA64_FETCHADD(_tmp, _v, 8, sizeof(*(v)), sem); \
75 else if ((i) == 16) \
76 IA64_FETCHADD(_tmp, _v, 16, sizeof(*(v)), sem); \
77 else \
78 _tmp = __bad_increment_for_ia64_fetch_and_add(); \
79 (__typeof__(*(v))) (_tmp); /* return old value */ \
80})
81
82#define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */
83
84/*
85 * This function doesn't exist, so you'll get a linker error if
86 * something tries to do an invalid xchg().
87 */
88extern void ia64_xchg_called_with_bad_pointer (void);
89
90#define __xchg(x,ptr,size) \
91({ \
92 unsigned long __xchg_result; \
93 \
94 switch (size) { \
95 case 1: \
96 __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
97 break; \
98 \
99 case 2: \
100 __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
101 break; \
102 \
103 case 4: \
104 __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
105 break; \
106 \
107 case 8: \
108 __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
109 break; \
110 default: \
111 ia64_xchg_called_with_bad_pointer(); \
112 } \
113 __xchg_result; \
114})
115
116#define xchg(ptr,x) \
117 ((__typeof__(*(ptr))) __xchg ((unsigned long) (x), (ptr), sizeof(*(ptr))))
118
119/*
120 * Atomic compare and exchange. Compare OLD with MEM, if identical,
121 * store NEW in MEM. Return the initial value in MEM. Success is
122 * indicated by comparing RETURN with OLD.
123 */
124
125#define __HAVE_ARCH_CMPXCHG 1
126
127/*
128 * This function doesn't exist, so you'll get a linker error
129 * if something tries to do an invalid cmpxchg().
130 */
131extern long ia64_cmpxchg_called_with_bad_pointer (void);
132
133#define ia64_cmpxchg(sem,ptr,old,new,size) \
134({ \
135 __u64 _o_, _r_; \
136 \
137 switch (size) { \
138 case 1: _o_ = (__u8 ) (long) (old); break; \
139 case 2: _o_ = (__u16) (long) (old); break; \
140 case 4: _o_ = (__u32) (long) (old); break; \
141 case 8: _o_ = (__u64) (long) (old); break; \
142 default: break; \
143 } \
144 switch (size) { \
145 case 1: \
146 _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
147 break; \
148 \
149 case 2: \
150 _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
151 break; \
152 \
153 case 4: \
154 _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
155 break; \
156 \
157 case 8: \
158 _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
159 break; \
160 \
161 default: \
162 _r_ = ia64_cmpxchg_called_with_bad_pointer(); \
163 break; \
164 } \
165 (__typeof__(old)) _r_; \
166})
167
168#define cmpxchg_acq(ptr, o, n) \
169 ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr)))
170#define cmpxchg_rel(ptr, o, n) \
171 ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr)))
172
173/* for compatibility with other platforms: */
174#define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
175#define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
176
177#define cmpxchg_local cmpxchg
178#define cmpxchg64_local cmpxchg64
179
180#ifdef CONFIG_IA64_DEBUG_CMPXCHG
181# define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128;
182# define CMPXCHG_BUGCHECK(v) \
183 do { \
184 if (_cmpxchg_bugcheck_count-- <= 0) { \
185 void *ip; \
186 extern int printk(const char *fmt, ...); \
187 ip = (void *) ia64_getreg(_IA64_REG_IP); \
188 printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v)); \
189 break; \
190 } \
191 } while (0)
192#else /* !CONFIG_IA64_DEBUG_CMPXCHG */
193# define CMPXCHG_BUGCHECK_DECL
194# define CMPXCHG_BUGCHECK(v)
195#endif /* !CONFIG_IA64_DEBUG_CMPXCHG */
196
197#endif
198
199#ifdef __KERNEL__
10#include <asm/paravirt_privop.h> 200#include <asm/paravirt_privop.h>
11#include <uapi/asm/intrinsics.h> 201#endif
12 202
13#ifndef __ASSEMBLY__ 203#ifndef __ASSEMBLY__
14#if defined(CONFIG_PARAVIRT) 204#if defined(CONFIG_PARAVIRT) && defined(__KERNEL__)
15# undef IA64_INTRINSIC_API 205#ifdef ASM_SUPPORTED
16# undef IA64_INTRINSIC_MACRO 206# define IA64_INTRINSIC_API(name) paravirt_ ## name
17# ifdef ASM_SUPPORTED 207#else
18# define IA64_INTRINSIC_API(name) paravirt_ ## name 208# define IA64_INTRINSIC_API(name) pv_cpu_ops.name
19# else 209#endif
20# define IA64_INTRINSIC_API(name) pv_cpu_ops.name
21# endif
22#define IA64_INTRINSIC_MACRO(name) paravirt_ ## name 210#define IA64_INTRINSIC_MACRO(name) paravirt_ ## name
211#else
212#define IA64_INTRINSIC_API(name) ia64_native_ ## name
213#define IA64_INTRINSIC_MACRO(name) ia64_native_ ## name
23#endif 214#endif
215
216/************************************************/
217/* Instructions paravirtualized for correctness */
218/************************************************/
219/* fc, thash, get_cpuid, get_pmd, get_eflags, set_eflags */
220/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag"
221 * is not currently used (though it may be in a long-format VHPT system!)
222 */
223#define ia64_fc IA64_INTRINSIC_API(fc)
224#define ia64_thash IA64_INTRINSIC_API(thash)
225#define ia64_get_cpuid IA64_INTRINSIC_API(get_cpuid)
226#define ia64_get_pmd IA64_INTRINSIC_API(get_pmd)
227
228
229/************************************************/
230/* Instructions paravirtualized for performance */
231/************************************************/
232#define ia64_ssm IA64_INTRINSIC_MACRO(ssm)
233#define ia64_rsm IA64_INTRINSIC_MACRO(rsm)
234#define ia64_getreg IA64_INTRINSIC_MACRO(getreg)
235#define ia64_setreg IA64_INTRINSIC_API(setreg)
236#define ia64_set_rr IA64_INTRINSIC_API(set_rr)
237#define ia64_get_rr IA64_INTRINSIC_API(get_rr)
238#define ia64_ptcga IA64_INTRINSIC_API(ptcga)
239#define ia64_get_psr_i IA64_INTRINSIC_API(get_psr_i)
240#define ia64_intrin_local_irq_restore \
241 IA64_INTRINSIC_API(intrin_local_irq_restore)
242#define ia64_set_rr0_to_rr4 IA64_INTRINSIC_API(set_rr0_to_rr4)
243
24#endif /* !__ASSEMBLY__ */ 244#endif /* !__ASSEMBLY__ */
245
25#endif /* _ASM_IA64_INTRINSICS_H */ 246#endif /* _ASM_IA64_INTRINSICS_H */
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 74a7cc3293b..e5a6c3530c6 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -71,6 +71,7 @@ extern unsigned int num_io_spaces;
71#include <asm/intrinsics.h> 71#include <asm/intrinsics.h>
72#include <asm/machvec.h> 72#include <asm/machvec.h>
73#include <asm/page.h> 73#include <asm/page.h>
74#include <asm/system.h>
74#include <asm-generic/iomap.h> 75#include <asm-generic/iomap.h>
75 76
76/* 77/*
@@ -90,7 +91,7 @@ phys_to_virt (unsigned long address)
90 91
91#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 92#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
92extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size); 93extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
93extern int valid_phys_addr_range (phys_addr_t addr, size_t count); /* efi.c */ 94extern int valid_phys_addr_range (unsigned long addr, size_t count); /* efi.c */
94extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count); 95extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count);
95 96
96/* 97/*
diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h
index 105c93b00b1..b6a809fa299 100644
--- a/arch/ia64/include/asm/iommu.h
+++ b/arch/ia64/include/asm/iommu.h
@@ -11,10 +11,12 @@ extern void no_iommu_init(void);
11extern int force_iommu, no_iommu; 11extern int force_iommu, no_iommu;
12extern int iommu_pass_through; 12extern int iommu_pass_through;
13extern int iommu_detected; 13extern int iommu_detected;
14extern int iommu_group_mf;
14#else 15#else
15#define iommu_pass_through (0) 16#define iommu_pass_through (0)
16#define no_iommu (1) 17#define no_iommu (1)
17#define iommu_detected (0) 18#define iommu_detected (0)
19#define iommu_group_mf (0)
18#endif 20#endif
19extern void iommu_dma_init(void); 21extern void iommu_dma_init(void);
20extern void machvec_init(const char *name); 22extern void machvec_init(const char *name);
diff --git a/arch/ia64/include/asm/iosapic.h b/arch/ia64/include/asm/iosapic.h
index 94c89a2d97f..b9c102e15f2 100644
--- a/arch/ia64/include/asm/iosapic.h
+++ b/arch/ia64/include/asm/iosapic.h
@@ -87,13 +87,18 @@ static inline void iosapic_eoi(char __iomem *iosapic, u32 vector)
87} 87}
88 88
89extern void __init iosapic_system_init (int pcat_compat); 89extern void __init iosapic_system_init (int pcat_compat);
90extern int iosapic_init (unsigned long address, unsigned int gsi_base); 90extern int __devinit iosapic_init (unsigned long address,
91 unsigned int gsi_base);
92#ifdef CONFIG_HOTPLUG
91extern int iosapic_remove (unsigned int gsi_base); 93extern int iosapic_remove (unsigned int gsi_base);
94#else
95#define iosapic_remove(gsi_base) (-EINVAL)
96#endif /* CONFIG_HOTPLUG */
92extern int gsi_to_irq (unsigned int gsi); 97extern int gsi_to_irq (unsigned int gsi);
93extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity, 98extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity,
94 unsigned long trigger); 99 unsigned long trigger);
95extern void iosapic_unregister_intr (unsigned int irq); 100extern void iosapic_unregister_intr (unsigned int irq);
96extern void iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi, 101extern void __devinit iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
97 unsigned long polarity, 102 unsigned long polarity,
98 unsigned long trigger); 103 unsigned long trigger);
99extern int __init iosapic_register_platform_intr (u32 int_type, 104extern int __init iosapic_register_platform_intr (u32 int_type,
@@ -104,7 +109,7 @@ extern int __init iosapic_register_platform_intr (u32 int_type,
104 unsigned long trigger); 109 unsigned long trigger);
105 110
106#ifdef CONFIG_NUMA 111#ifdef CONFIG_NUMA
107extern void map_iosapic_to_node (unsigned int, int); 112extern void __devinit map_iosapic_to_node (unsigned int, int);
108#endif 113#endif
109#else 114#else
110#define iosapic_system_init(pcat_compat) do { } while (0) 115#define iosapic_system_init(pcat_compat) do { } while (0)
diff --git a/arch/ia64/include/asm/irq_remapping.h b/arch/ia64/include/asm/irq_remapping.h
deleted file mode 100644
index a8687b1d890..00000000000
--- a/arch/ia64/include/asm/irq_remapping.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __IA64_INTR_REMAPPING_H
2#define __IA64_INTR_REMAPPING_H
3#define irq_remapping_enabled 0
4#endif
diff --git a/arch/ia64/include/asm/irqflags.h b/arch/ia64/include/asm/irqflags.h
index 2b68d856dc7..f82d6be2ecd 100644
--- a/arch/ia64/include/asm/irqflags.h
+++ b/arch/ia64/include/asm/irqflags.h
@@ -10,8 +10,6 @@
10#ifndef _ASM_IA64_IRQFLAGS_H 10#ifndef _ASM_IA64_IRQFLAGS_H
11#define _ASM_IA64_IRQFLAGS_H 11#define _ASM_IA64_IRQFLAGS_H
12 12
13#include <asm/pal.h>
14
15#ifdef CONFIG_IA64_DEBUG_IRQ 13#ifdef CONFIG_IA64_DEBUG_IRQ
16extern unsigned long last_cli_ip; 14extern unsigned long last_cli_ip;
17static inline void arch_maybe_save_ip(unsigned long flags) 15static inline void arch_maybe_save_ip(unsigned long flags)
diff --git a/arch/ia64/include/asm/kexec.h b/arch/ia64/include/asm/kexec.h
index aea2b81b03a..e1d58f819d7 100644
--- a/arch/ia64/include/asm/kexec.h
+++ b/arch/ia64/include/asm/kexec.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_IA64_KEXEC_H 1#ifndef _ASM_IA64_KEXEC_H
2#define _ASM_IA64_KEXEC_H 2#define _ASM_IA64_KEXEC_H
3 3
4#include <asm/setup.h>
5 4
6/* Maximum physical address we can use pages from */ 5/* Maximum physical address we can use pages from */
7#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) 6#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 6d6a5ac48d8..2689ee54a1c 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -365,7 +365,6 @@ struct thash_cb {
365}; 365};
366 366
367struct kvm_vcpu_stat { 367struct kvm_vcpu_stat {
368 u32 halt_wakeup;
369}; 368};
370 369
371struct kvm_vcpu_arch { 370struct kvm_vcpu_arch {
@@ -449,8 +448,6 @@ struct kvm_vcpu_arch {
449 char log_buf[VMM_LOG_LEN]; 448 char log_buf[VMM_LOG_LEN];
450 union context host; 449 union context host;
451 union context guest; 450 union context guest;
452
453 char mmio_data[8];
454}; 451};
455 452
456struct kvm_vm_stat { 453struct kvm_vm_stat {
@@ -462,9 +459,6 @@ struct kvm_sal_data {
462 unsigned long boot_gp; 459 unsigned long boot_gp;
463}; 460};
464 461
465struct kvm_arch_memory_slot {
466};
467
468struct kvm_arch { 462struct kvm_arch {
469 spinlock_t dirty_log_lock; 463 spinlock_t dirty_log_lock;
470 464
diff --git a/arch/ia64/include/asm/machvec.h b/arch/ia64/include/asm/machvec.h
index 2d1ad4b11a8..367d299d993 100644
--- a/arch/ia64/include/asm/machvec.h
+++ b/arch/ia64/include/asm/machvec.h
@@ -120,7 +120,7 @@ extern void machvec_tlb_migrate_finish (struct mm_struct *);
120# ifdef MACHVEC_PLATFORM_HEADER 120# ifdef MACHVEC_PLATFORM_HEADER
121# include MACHVEC_PLATFORM_HEADER 121# include MACHVEC_PLATFORM_HEADER
122# else 122# else
123# define ia64_platform_name ia64_mv.name 123# define platform_name ia64_mv.name
124# define platform_setup ia64_mv.setup 124# define platform_setup ia64_mv.setup
125# define platform_cpu_init ia64_mv.cpu_init 125# define platform_cpu_init ia64_mv.cpu_init
126# define platform_irq_init ia64_mv.irq_init 126# define platform_irq_init ia64_mv.irq_init
diff --git a/arch/ia64/include/asm/machvec_dig.h b/arch/ia64/include/asm/machvec_dig.h
index 1f7403a2fbe..8a0752f4098 100644
--- a/arch/ia64/include/asm/machvec_dig.h
+++ b/arch/ia64/include/asm/machvec_dig.h
@@ -10,7 +10,7 @@ extern ia64_mv_setup_t dig_setup;
10 * platform's machvec structure. When compiling a non-generic kernel, 10 * platform's machvec structure. When compiling a non-generic kernel,
11 * the macros are used directly. 11 * the macros are used directly.
12 */ 12 */
13#define ia64_platform_name "dig" 13#define platform_name "dig"
14#define platform_setup dig_setup 14#define platform_setup dig_setup
15 15
16#endif /* _ASM_IA64_MACHVEC_DIG_h */ 16#endif /* _ASM_IA64_MACHVEC_DIG_h */
diff --git a/arch/ia64/include/asm/machvec_dig_vtd.h b/arch/ia64/include/asm/machvec_dig_vtd.h
index 44308b4c3f6..6ab1de5c45e 100644
--- a/arch/ia64/include/asm/machvec_dig_vtd.h
+++ b/arch/ia64/include/asm/machvec_dig_vtd.h
@@ -11,7 +11,7 @@ extern ia64_mv_dma_init pci_iommu_alloc;
11 * platform's machvec structure. When compiling a non-generic kernel, 11 * platform's machvec structure. When compiling a non-generic kernel,
12 * the macros are used directly. 12 * the macros are used directly.
13 */ 13 */
14#define ia64_platform_name "dig_vtd" 14#define platform_name "dig_vtd"
15#define platform_setup dig_setup 15#define platform_setup dig_setup
16#define platform_dma_init pci_iommu_alloc 16#define platform_dma_init pci_iommu_alloc
17 17
diff --git a/arch/ia64/include/asm/machvec_hpsim.h b/arch/ia64/include/asm/machvec_hpsim.h
index e7571127936..cf72fc87fdf 100644
--- a/arch/ia64/include/asm/machvec_hpsim.h
+++ b/arch/ia64/include/asm/machvec_hpsim.h
@@ -11,7 +11,7 @@ extern ia64_mv_irq_init_t hpsim_irq_init;
11 * platform's machvec structure. When compiling a non-generic kernel, 11 * platform's machvec structure. When compiling a non-generic kernel,
12 * the macros are used directly. 12 * the macros are used directly.
13 */ 13 */
14#define ia64_platform_name "hpsim" 14#define platform_name "hpsim"
15#define platform_setup hpsim_setup 15#define platform_setup hpsim_setup
16#define platform_irq_init hpsim_irq_init 16#define platform_irq_init hpsim_irq_init
17 17
diff --git a/arch/ia64/include/asm/machvec_hpzx1.h b/arch/ia64/include/asm/machvec_hpzx1.h
index c74d3159e9e..3bd83d78a41 100644
--- a/arch/ia64/include/asm/machvec_hpzx1.h
+++ b/arch/ia64/include/asm/machvec_hpzx1.h
@@ -11,7 +11,7 @@ extern ia64_mv_dma_init sba_dma_init;
11 * platform's machvec structure. When compiling a non-generic kernel, 11 * platform's machvec structure. When compiling a non-generic kernel,
12 * the macros are used directly. 12 * the macros are used directly.
13 */ 13 */
14#define ia64_platform_name "hpzx1" 14#define platform_name "hpzx1"
15#define platform_setup dig_setup 15#define platform_setup dig_setup
16#define platform_dma_init sba_dma_init 16#define platform_dma_init sba_dma_init
17 17
diff --git a/arch/ia64/include/asm/machvec_hpzx1_swiotlb.h b/arch/ia64/include/asm/machvec_hpzx1_swiotlb.h
index 906ef621077..1091ac39740 100644
--- a/arch/ia64/include/asm/machvec_hpzx1_swiotlb.h
+++ b/arch/ia64/include/asm/machvec_hpzx1_swiotlb.h
@@ -11,7 +11,7 @@ extern ia64_mv_dma_get_ops hwsw_dma_get_ops;
11 * platform's machvec structure. When compiling a non-generic kernel, 11 * platform's machvec structure. When compiling a non-generic kernel,
12 * the macros are used directly. 12 * the macros are used directly.
13 */ 13 */
14#define ia64_platform_name "hpzx1_swiotlb" 14#define platform_name "hpzx1_swiotlb"
15#define platform_setup dig_setup 15#define platform_setup dig_setup
16#define platform_dma_init machvec_noop 16#define platform_dma_init machvec_noop
17#define platform_dma_get_ops hwsw_dma_get_ops 17#define platform_dma_get_ops hwsw_dma_get_ops
diff --git a/arch/ia64/include/asm/machvec_sn2.h b/arch/ia64/include/asm/machvec_sn2.h
index ece9fa85be8..f061a30aac4 100644
--- a/arch/ia64/include/asm/machvec_sn2.h
+++ b/arch/ia64/include/asm/machvec_sn2.h
@@ -71,7 +71,7 @@ extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;
71 * platform's machvec structure. When compiling a non-generic kernel, 71 * platform's machvec structure. When compiling a non-generic kernel,
72 * the macros are used directly. 72 * the macros are used directly.
73 */ 73 */
74#define ia64_platform_name "sn2" 74#define platform_name "sn2"
75#define platform_setup sn_setup 75#define platform_setup sn_setup
76#define platform_cpu_init sn_cpu_init 76#define platform_cpu_init sn_cpu_init
77#define platform_irq_init sn_irq_init 77#define platform_irq_init sn_irq_init
diff --git a/arch/ia64/include/asm/machvec_uv.h b/arch/ia64/include/asm/machvec_uv.h
index 2c50853f35a..2931447f381 100644
--- a/arch/ia64/include/asm/machvec_uv.h
+++ b/arch/ia64/include/asm/machvec_uv.h
@@ -20,7 +20,7 @@ extern ia64_mv_setup_t uv_setup;
20 * platform's machvec structure. When compiling a non-generic kernel, 20 * platform's machvec structure. When compiling a non-generic kernel,
21 * the macros are used directly. 21 * the macros are used directly.
22 */ 22 */
23#define ia64_platform_name "uv" 23#define platform_name "uv"
24#define platform_setup uv_setup 24#define platform_setup uv_setup
25 25
26#endif /* _ASM_IA64_MACHVEC_UV_H */ 26#endif /* _ASM_IA64_MACHVEC_UV_H */
diff --git a/arch/ia64/include/asm/machvec_xen.h b/arch/ia64/include/asm/machvec_xen.h
index 8b8bd0eb392..55f9228056c 100644
--- a/arch/ia64/include/asm/machvec_xen.h
+++ b/arch/ia64/include/asm/machvec_xen.h
@@ -13,7 +13,7 @@ extern ia64_mv_send_ipi_t xen_platform_send_ipi;
13 * platform's machvec structure. When compiling a non-generic kernel, 13 * platform's machvec structure. When compiling a non-generic kernel,
14 * the macros are used directly. 14 * the macros are used directly.
15 */ 15 */
16#define ia64_platform_name "xen" 16#define platform_name "xen"
17#define platform_setup dig_setup 17#define platform_setup dig_setup
18#define platform_cpu_init xen_cpu_init 18#define platform_cpu_init xen_cpu_init
19#define platform_irq_init xen_irq_init 19#define platform_irq_init xen_irq_init
diff --git a/arch/ia64/include/asm/mca_asm.h b/arch/ia64/include/asm/mca_asm.h
index 13c1d4994d4..dd2a5b13439 100644
--- a/arch/ia64/include/asm/mca_asm.h
+++ b/arch/ia64/include/asm/mca_asm.h
@@ -15,8 +15,6 @@
15#ifndef _ASM_IA64_MCA_ASM_H 15#ifndef _ASM_IA64_MCA_ASM_H
16#define _ASM_IA64_MCA_ASM_H 16#define _ASM_IA64_MCA_ASM_H
17 17
18#include <asm/percpu.h>
19
20#define PSR_IC 13 18#define PSR_IC 13
21#define PSR_I 14 19#define PSR_I 14
22#define PSR_DT 17 20#define PSR_DT 17
diff --git a/arch/ia64/include/asm/mman.h b/arch/ia64/include/asm/mman.h
index fdd5f5229f7..4459028e5aa 100644
--- a/arch/ia64/include/asm/mman.h
+++ b/arch/ia64/include/asm/mman.h
@@ -1,17 +1,23 @@
1#ifndef _ASM_IA64_MMAN_H
2#define _ASM_IA64_MMAN_H
3
1/* 4/*
2 * Based on <asm-i386/mman.h>. 5 * Based on <asm-i386/mman.h>.
3 * 6 *
4 * Modified 1998-2000, 2002 7 * Modified 1998-2000, 2002
5 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
6 */ 9 */
7#ifndef _ASM_IA64_MMAN_H
8#define _ASM_IA64_MMAN_H
9 10
10#include <uapi/asm/mman.h> 11#include <asm-generic/mman.h>
12
13#define MAP_GROWSUP 0x0200 /* register stack-like segment */
11 14
15#ifdef __KERNEL__
12#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
13#define arch_mmap_check ia64_mmap_check 17#define arch_mmap_check ia64_mmap_check
14int ia64_mmap_check(unsigned long addr, unsigned long len, 18int ia64_mmap_check(unsigned long addr, unsigned long len,
15 unsigned long flags); 19 unsigned long flags);
16#endif 20#endif
21#endif
22
17#endif /* _ASM_IA64_MMAN_H */ 23#endif /* _ASM_IA64_MMAN_H */
diff --git a/arch/ia64/include/asm/module.h b/arch/ia64/include/asm/module.h
index dfba22a872c..908eaef42a0 100644
--- a/arch/ia64/include/asm/module.h
+++ b/arch/ia64/include/asm/module.h
@@ -1,8 +1,6 @@
1#ifndef _ASM_IA64_MODULE_H 1#ifndef _ASM_IA64_MODULE_H
2#define _ASM_IA64_MODULE_H 2#define _ASM_IA64_MODULE_H
3 3
4#include <asm-generic/module.h>
5
6/* 4/*
7 * IA-64-specific support for kernel module loader. 5 * IA-64-specific support for kernel module loader.
8 * 6 *
@@ -31,6 +29,10 @@ struct mod_arch_specific {
31 unsigned int next_got_entry; /* index of next available got entry */ 29 unsigned int next_got_entry; /* index of next available got entry */
32}; 30};
33 31
32#define Elf_Shdr Elf64_Shdr
33#define Elf_Sym Elf64_Sym
34#define Elf_Ehdr Elf64_Ehdr
35
34#define MODULE_PROC_FAMILY "ia64" 36#define MODULE_PROC_FAMILY "ia64"
35#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY \ 37#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY \
36 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__) 38 "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__)
diff --git a/arch/ia64/include/asm/numa.h b/arch/ia64/include/asm/numa.h
index 2e27ef17565..6a8a27cfae3 100644
--- a/arch/ia64/include/asm/numa.h
+++ b/arch/ia64/include/asm/numa.h
@@ -59,7 +59,7 @@ extern struct node_cpuid_s node_cpuid[NR_CPUS];
59 */ 59 */
60 60
61extern u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES]; 61extern u8 numa_slit[MAX_NUMNODES * MAX_NUMNODES];
62#define node_distance(from,to) (numa_slit[(from) * MAX_NUMNODES + (to)]) 62#define node_distance(from,to) (numa_slit[(from) * num_online_nodes() + (to)])
63 63
64extern int paddr_to_nid(unsigned long paddr); 64extern int paddr_to_nid(unsigned long paddr);
65 65
diff --git a/arch/ia64/include/asm/page.h b/arch/ia64/include/asm/page.h
index f1e1b2e3cdb..961a16f43e6 100644
--- a/arch/ia64/include/asm/page.h
+++ b/arch/ia64/include/asm/page.h
@@ -221,14 +221,4 @@ get_order (unsigned long size)
221 (((current->personality & READ_IMPLIES_EXEC) != 0) \ 221 (((current->personality & READ_IMPLIES_EXEC) != 0) \
222 ? VM_EXEC : 0)) 222 ? VM_EXEC : 0))
223 223
224#define GATE_ADDR RGN_BASE(RGN_GATE)
225
226/*
227 * 0xa000000000000000+2*PERCPU_PAGE_SIZE
228 * - 0xa000000000000000+3*PERCPU_PAGE_SIZE remain unmapped (guard page)
229 */
230#define KERNEL_START (GATE_ADDR+__IA64_UL_CONST(0x100000000))
231#define PERCPU_ADDR (-PERCPU_PAGE_SIZE)
232#define LOAD_OFFSET (KERNEL_START - KERNEL_TR_PAGE_SIZE)
233
234#endif /* _ASM_IA64_PAGE_H */ 224#endif /* _ASM_IA64_PAGE_H */
diff --git a/arch/ia64/include/asm/param.h b/arch/ia64/include/asm/param.h
index 1295913d6a8..0964c32c135 100644
--- a/arch/ia64/include/asm/param.h
+++ b/arch/ia64/include/asm/param.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_IA64_PARAM_H
2#define _ASM_IA64_PARAM_H
3
1/* 4/*
2 * Fundamental kernel parameters. 5 * Fundamental kernel parameters.
3 * 6 *
@@ -6,12 +9,25 @@
6 * Modified 1998, 1999, 2002-2003 9 * Modified 1998, 1999, 2002-2003
7 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 10 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
8 */ 11 */
9#ifndef _ASM_IA64_PARAM_H
10#define _ASM_IA64_PARAM_H
11 12
12#include <uapi/asm/param.h> 13#define EXEC_PAGESIZE 65536
14
15#ifndef NOGROUP
16# define NOGROUP (-1)
17#endif
13 18
19#define MAXHOSTNAMELEN 64 /* max length of hostname */
20
21#ifdef __KERNEL__
14# define HZ CONFIG_HZ 22# define HZ CONFIG_HZ
15# define USER_HZ HZ 23# define USER_HZ HZ
16# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */ 24# define CLOCKS_PER_SEC HZ /* frequency at which times() counts */
25#else
26 /*
27 * Technically, this is wrong, but some old apps still refer to it. The proper way to
28 * get the HZ value is via sysconf(_SC_CLK_TCK).
29 */
30# define HZ 1024
31#endif
32
17#endif /* _ASM_IA64_PARAM_H */ 33#endif /* _ASM_IA64_PARAM_H */
diff --git a/arch/ia64/include/asm/paravirt.h b/arch/ia64/include/asm/paravirt.h
index b149b88ea79..32551d304cd 100644
--- a/arch/ia64/include/asm/paravirt.h
+++ b/arch/ia64/include/asm/paravirt.h
@@ -281,9 +281,9 @@ paravirt_init_missing_ticks_accounting(int cpu)
281 pv_time_ops.init_missing_ticks_accounting(cpu); 281 pv_time_ops.init_missing_ticks_accounting(cpu);
282} 282}
283 283
284struct static_key; 284struct jump_label_key;
285extern struct static_key paravirt_steal_enabled; 285extern struct jump_label_key paravirt_steal_enabled;
286extern struct static_key paravirt_steal_rq_enabled; 286extern struct jump_label_key paravirt_steal_rq_enabled;
287 287
288static inline int 288static inline int
289paravirt_do_steal_accounting(unsigned long *new_itm) 289paravirt_do_steal_accounting(unsigned long *new_itm)
diff --git a/arch/ia64/include/asm/parport.h b/arch/ia64/include/asm/parport.h
index 638b4d271b9..67e16adfcd2 100644
--- a/arch/ia64/include/asm/parport.h
+++ b/arch/ia64/include/asm/parport.h
@@ -9,9 +9,10 @@
9#ifndef _ASM_IA64_PARPORT_H 9#ifndef _ASM_IA64_PARPORT_H
10#define _ASM_IA64_PARPORT_H 1 10#define _ASM_IA64_PARPORT_H 1
11 11
12static int parport_pc_find_isa_ports(int autoirq, int autodma); 12static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
13 13
14static int parport_pc_find_nonpci_ports(int autoirq, int autodma) 14static int __devinit
15parport_pc_find_nonpci_ports (int autoirq, int autodma)
15{ 16{
16 return parport_pc_find_isa_ports(autoirq, autodma); 17 return parport_pc_find_isa_ports(autoirq, autodma);
17} 18}
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 5e04b591e42..127dd7be346 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -11,14 +11,6 @@
11#include <asm/scatterlist.h> 11#include <asm/scatterlist.h>
12#include <asm/hw_irq.h> 12#include <asm/hw_irq.h>
13 13
14struct pci_vector_struct {
15 __u16 segment; /* PCI Segment number */
16 __u16 bus; /* PCI Bus number */
17 __u32 pci_id; /* ACPI split 16 bits device, 16 bits function (see section 6.1.1) */
18 __u8 pin; /* PCI PIN (0 = A, 1 = B, 2 = C, 3 = D) */
19 __u32 irq; /* IRQ assigned */
20};
21
22/* 14/*
23 * Can be used to override the logic in pci_scan_bus for skipping already-configured bus 15 * Can be used to override the logic in pci_scan_bus for skipping already-configured bus
24 * numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the 16 * numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the
@@ -51,6 +43,12 @@ extern unsigned long ia64_max_iommu_merge_mask;
51#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL) 43#define PCI_DMA_BUS_IS_PHYS (ia64_max_iommu_merge_mask == ~0UL)
52 44
53static inline void 45static inline void
46pcibios_set_master (struct pci_dev *dev)
47{
48 /* No special bus mastering setup handling */
49}
50
51static inline void
54pcibios_penalize_isa_irq (int irq, int active) 52pcibios_penalize_isa_irq (int irq, int active)
55{ 53{
56 /* We don't do dynamic PCI IRQ allocation */ 54 /* We don't do dynamic PCI IRQ allocation */
@@ -116,6 +114,12 @@ static inline int pci_proc_domain(struct pci_bus *bus)
116 return (pci_domain_nr(bus) != 0); 114 return (pci_domain_nr(bus) != 0);
117} 115}
118 116
117extern void pcibios_resource_to_bus(struct pci_dev *dev,
118 struct pci_bus_region *region, struct resource *res);
119
120extern void pcibios_bus_to_resource(struct pci_dev *dev,
121 struct resource *res, struct pci_bus_region *region);
122
119static inline struct resource * 123static inline struct resource *
120pcibios_select_root(struct pci_dev *pdev, struct resource *res) 124pcibios_select_root(struct pci_dev *pdev, struct resource *res)
121{ 125{
diff --git a/arch/ia64/include/asm/perfmon.h b/arch/ia64/include/asm/perfmon.h
index 15476dd3a8b..d551183fee9 100644
--- a/arch/ia64/include/asm/perfmon.h
+++ b/arch/ia64/include/asm/perfmon.h
@@ -2,12 +2,179 @@
2 * Copyright (C) 2001-2003 Hewlett-Packard Co 2 * Copyright (C) 2001-2003 Hewlett-Packard Co
3 * Stephane Eranian <eranian@hpl.hp.com> 3 * Stephane Eranian <eranian@hpl.hp.com>
4 */ 4 */
5
5#ifndef _ASM_IA64_PERFMON_H 6#ifndef _ASM_IA64_PERFMON_H
6#define _ASM_IA64_PERFMON_H 7#define _ASM_IA64_PERFMON_H
7 8
8#include <uapi/asm/perfmon.h> 9/*
10 * perfmon commands supported on all CPU models
11 */
12#define PFM_WRITE_PMCS 0x01
13#define PFM_WRITE_PMDS 0x02
14#define PFM_READ_PMDS 0x03
15#define PFM_STOP 0x04
16#define PFM_START 0x05
17#define PFM_ENABLE 0x06 /* obsolete */
18#define PFM_DISABLE 0x07 /* obsolete */
19#define PFM_CREATE_CONTEXT 0x08
20#define PFM_DESTROY_CONTEXT 0x09 /* obsolete use close() */
21#define PFM_RESTART 0x0a
22#define PFM_PROTECT_CONTEXT 0x0b /* obsolete */
23#define PFM_GET_FEATURES 0x0c
24#define PFM_DEBUG 0x0d
25#define PFM_UNPROTECT_CONTEXT 0x0e /* obsolete */
26#define PFM_GET_PMC_RESET_VAL 0x0f
27#define PFM_LOAD_CONTEXT 0x10
28#define PFM_UNLOAD_CONTEXT 0x11
29
30/*
31 * PMU model specific commands (may not be supported on all PMU models)
32 */
33#define PFM_WRITE_IBRS 0x20
34#define PFM_WRITE_DBRS 0x21
35
36/*
37 * context flags
38 */
39#define PFM_FL_NOTIFY_BLOCK 0x01 /* block task on user level notifications */
40#define PFM_FL_SYSTEM_WIDE 0x02 /* create a system wide context */
41#define PFM_FL_OVFL_NO_MSG 0x80 /* do not post overflow/end messages for notification */
42
43/*
44 * event set flags
45 */
46#define PFM_SETFL_EXCL_IDLE 0x01 /* exclude idle task (syswide only) XXX: DO NOT USE YET */
47
48/*
49 * PMC flags
50 */
51#define PFM_REGFL_OVFL_NOTIFY 0x1 /* send notification on overflow */
52#define PFM_REGFL_RANDOM 0x2 /* randomize sampling interval */
53
54/*
55 * PMD/PMC/IBR/DBR return flags (ignored on input)
56 *
57 * Those flags are used on output and must be checked in case EAGAIN is returned
58 * by any of the calls using a pfarg_reg_t or pfarg_dbreg_t structure.
59 */
60#define PFM_REG_RETFL_NOTAVAIL (1UL<<31) /* set if register is implemented but not available */
61#define PFM_REG_RETFL_EINVAL (1UL<<30) /* set if register entry is invalid */
62#define PFM_REG_RETFL_MASK (PFM_REG_RETFL_NOTAVAIL|PFM_REG_RETFL_EINVAL)
63
64#define PFM_REG_HAS_ERROR(flag) (((flag) & PFM_REG_RETFL_MASK) != 0)
65
66typedef unsigned char pfm_uuid_t[16]; /* custom sampling buffer identifier type */
67
68/*
69 * Request structure used to define a context
70 */
71typedef struct {
72 pfm_uuid_t ctx_smpl_buf_id; /* which buffer format to use (if needed) */
73 unsigned long ctx_flags; /* noblock/block */
74 unsigned short ctx_nextra_sets; /* number of extra event sets (you always get 1) */
75 unsigned short ctx_reserved1; /* for future use */
76 int ctx_fd; /* return arg: unique identification for context */
77 void *ctx_smpl_vaddr; /* return arg: virtual address of sampling buffer, is used */
78 unsigned long ctx_reserved2[11];/* for future use */
79} pfarg_context_t;
80
81/*
82 * Request structure used to write/read a PMC or PMD
83 */
84typedef struct {
85 unsigned int reg_num; /* which register */
86 unsigned short reg_set; /* event set for this register */
87 unsigned short reg_reserved1; /* for future use */
88
89 unsigned long reg_value; /* initial pmc/pmd value */
90 unsigned long reg_flags; /* input: pmc/pmd flags, return: reg error */
91
92 unsigned long reg_long_reset; /* reset after buffer overflow notification */
93 unsigned long reg_short_reset; /* reset after counter overflow */
94
95 unsigned long reg_reset_pmds[4]; /* which other counters to reset on overflow */
96 unsigned long reg_random_seed; /* seed value when randomization is used */
97 unsigned long reg_random_mask; /* bitmask used to limit random value */
98 unsigned long reg_last_reset_val;/* return: PMD last reset value */
99
100 unsigned long reg_smpl_pmds[4]; /* which pmds are accessed when PMC overflows */
101 unsigned long reg_smpl_eventid; /* opaque sampling event identifier */
102
103 unsigned long reg_reserved2[3]; /* for future use */
104} pfarg_reg_t;
105
106typedef struct {
107 unsigned int dbreg_num; /* which debug register */
108 unsigned short dbreg_set; /* event set for this register */
109 unsigned short dbreg_reserved1; /* for future use */
110 unsigned long dbreg_value; /* value for debug register */
111 unsigned long dbreg_flags; /* return: dbreg error */
112 unsigned long dbreg_reserved2[1]; /* for future use */
113} pfarg_dbreg_t;
114
115typedef struct {
116 unsigned int ft_version; /* perfmon: major [16-31], minor [0-15] */
117 unsigned int ft_reserved; /* reserved for future use */
118 unsigned long reserved[4]; /* for future use */
119} pfarg_features_t;
120
121typedef struct {
122 pid_t load_pid; /* process to load the context into */
123 unsigned short load_set; /* first event set to load */
124 unsigned short load_reserved1; /* for future use */
125 unsigned long load_reserved2[3]; /* for future use */
126} pfarg_load_t;
127
128typedef struct {
129 int msg_type; /* generic message header */
130 int msg_ctx_fd; /* generic message header */
131 unsigned long msg_ovfl_pmds[4]; /* which PMDs overflowed */
132 unsigned short msg_active_set; /* active set at the time of overflow */
133 unsigned short msg_reserved1; /* for future use */
134 unsigned int msg_reserved2; /* for future use */
135 unsigned long msg_tstamp; /* for perf tuning/debug */
136} pfm_ovfl_msg_t;
137
138typedef struct {
139 int msg_type; /* generic message header */
140 int msg_ctx_fd; /* generic message header */
141 unsigned long msg_tstamp; /* for perf tuning */
142} pfm_end_msg_t;
143
144typedef struct {
145 int msg_type; /* type of the message */
146 int msg_ctx_fd; /* unique identifier for the context */
147 unsigned long msg_tstamp; /* for perf tuning */
148} pfm_gen_msg_t;
149
150#define PFM_MSG_OVFL 1 /* an overflow happened */
151#define PFM_MSG_END 2 /* task to which context was attached ended */
152
153typedef union {
154 pfm_ovfl_msg_t pfm_ovfl_msg;
155 pfm_end_msg_t pfm_end_msg;
156 pfm_gen_msg_t pfm_gen_msg;
157} pfm_msg_t;
158
159/*
160 * Define the version numbers for both perfmon as a whole and the sampling buffer format.
161 */
162#define PFM_VERSION_MAJ 2U
163#define PFM_VERSION_MIN 0U
164#define PFM_VERSION (((PFM_VERSION_MAJ&0xffff)<<16)|(PFM_VERSION_MIN & 0xffff))
165#define PFM_VERSION_MAJOR(x) (((x)>>16) & 0xffff)
166#define PFM_VERSION_MINOR(x) ((x) & 0xffff)
9 167
10 168
169/*
170 * miscellaneous architected definitions
171 */
172#define PMU_FIRST_COUNTER 4 /* first counting monitor (PMC/PMD) */
173#define PMU_MAX_PMCS 256 /* maximum architected number of PMC registers */
174#define PMU_MAX_PMDS 256 /* maximum architected number of PMD registers */
175
176#ifdef __KERNEL__
177
11extern long perfmonctl(int fd, int cmd, void *arg, int narg); 178extern long perfmonctl(int fd, int cmd, void *arg, int narg);
12 179
13typedef struct { 180typedef struct {
@@ -107,4 +274,6 @@ typedef struct {
107extern pfm_sysctl_t pfm_sysctl; 274extern pfm_sysctl_t pfm_sysctl;
108 275
109 276
277#endif /* __KERNEL__ */
278
110#endif /* _ASM_IA64_PERFMON_H */ 279#endif /* _ASM_IA64_PERFMON_H */
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h
index 815810cbbed..1a97af31ef1 100644
--- a/arch/ia64/include/asm/pgtable.h
+++ b/arch/ia64/include/asm/pgtable.h
@@ -16,6 +16,7 @@
16#include <asm/mman.h> 16#include <asm/mman.h>
17#include <asm/page.h> 17#include <asm/page.h>
18#include <asm/processor.h> 18#include <asm/processor.h>
19#include <asm/system.h>
19#include <asm/types.h> 20#include <asm/types.h>
20 21
21#define IA64_MAX_PHYS_BITS 50 /* max. number of physical address bits (architected) */ 22#define IA64_MAX_PHYS_BITS 50 /* max. number of physical address bits (architected) */
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index e0a899a1a8a..d9f397fae03 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -19,9 +19,6 @@
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/ustack.h> 20#include <asm/ustack.h>
21 21
22#define __ARCH_WANT_UNLOCKED_CTXSW
23#define ARCH_HAS_PREFETCH_SWITCH_STACK
24
25#define IA64_NUM_PHYS_STACK_REG 96 22#define IA64_NUM_PHYS_STACK_REG 96
26#define IA64_NUM_DBG_REGS 8 23#define IA64_NUM_DBG_REGS 8
27 24
@@ -34,7 +31,8 @@
34 * each (assuming 8KB page size), for a total of 8TB of user virtual 31 * each (assuming 8KB page size), for a total of 8TB of user virtual
35 * address space. 32 * address space.
36 */ 33 */
37#define TASK_SIZE DEFAULT_TASK_SIZE 34#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
35#define TASK_SIZE TASK_SIZE_OF(current)
38 36
39/* 37/*
40 * This decides where the kernel will search for a free chunk of vm 38 * This decides where the kernel will search for a free chunk of vm
@@ -279,6 +277,7 @@ struct thread_struct {
279 __u8 pad[3]; 277 __u8 pad[3];
280 __u64 ksp; /* kernel stack pointer */ 278 __u64 ksp; /* kernel stack pointer */
281 __u64 map_base; /* base address for get_unmapped_area() */ 279 __u64 map_base; /* base address for get_unmapped_area() */
280 __u64 task_size; /* limit for task size */
282 __u64 rbs_bot; /* the base address for the RBS */ 281 __u64 rbs_bot; /* the base address for the RBS */
283 int last_fph_cpu; /* CPU that may hold the contents of f32-f127 */ 282 int last_fph_cpu; /* CPU that may hold the contents of f32-f127 */
284 283
@@ -301,6 +300,7 @@ struct thread_struct {
301 .ksp = 0, \ 300 .ksp = 0, \
302 .map_base = DEFAULT_MAP_BASE, \ 301 .map_base = DEFAULT_MAP_BASE, \
303 .rbs_bot = STACK_TOP - DEFAULT_USER_STACK_SIZE, \ 302 .rbs_bot = STACK_TOP - DEFAULT_USER_STACK_SIZE, \
303 .task_size = DEFAULT_TASK_SIZE, \
304 .last_fph_cpu = -1, \ 304 .last_fph_cpu = -1, \
305 INIT_THREAD_PM \ 305 INIT_THREAD_PM \
306 .dbr = {0, }, \ 306 .dbr = {0, }, \
@@ -309,6 +309,7 @@ struct thread_struct {
309} 309}
310 310
311#define start_thread(regs,new_ip,new_sp) do { \ 311#define start_thread(regs,new_ip,new_sp) do { \
312 set_fs(USER_DS); \
312 regs->cr_ipsr = ((regs->cr_ipsr | (IA64_PSR_BITS_TO_SET | IA64_PSR_CPL)) \ 313 regs->cr_ipsr = ((regs->cr_ipsr | (IA64_PSR_BITS_TO_SET | IA64_PSR_CPL)) \
313 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_RI | IA64_PSR_IS)); \ 314 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_RI | IA64_PSR_IS)); \
314 regs->cr_iip = new_ip; \ 315 regs->cr_iip = new_ip; \
@@ -340,6 +341,25 @@ struct task_struct;
340 */ 341 */
341#define release_thread(dead_task) 342#define release_thread(dead_task)
342 343
344/* Prepare to copy thread state - unlazy all lazy status */
345#define prepare_to_copy(tsk) do { } while (0)
346
347/*
348 * This is the mechanism for creating a new kernel thread.
349 *
350 * NOTE 1: Only a kernel-only process (ie the swapper or direct
351 * descendants who haven't done an "execve()") should use this: it
352 * will work within a system call from a "real" process, but the
353 * process memory space will not be free'd until both the parent and
354 * the child have exited.
355 *
356 * NOTE 2: This MUST NOT be an inlined function. Otherwise, we get
357 * into trouble in init/main.c when the child thread returns to
358 * do_basic_setup() and the timing is such that free_initmem() has
359 * been called already.
360 */
361extern pid_t kernel_thread (int (*fn)(void *), void *arg, unsigned long flags);
362
343/* Get wait channel for task P. */ 363/* Get wait channel for task P. */
344extern unsigned long get_wchan (struct task_struct *p); 364extern unsigned long get_wchan (struct task_struct *p);
345 365
@@ -701,10 +721,6 @@ extern unsigned long boot_option_idle_override;
701enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT, 721enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT,
702 IDLE_NOMWAIT, IDLE_POLL}; 722 IDLE_NOMWAIT, IDLE_POLL};
703 723
704void default_idle(void);
705
706#define ia64_platform_is(x) (strcmp(x, ia64_platform_name) == 0)
707
708#endif /* !__ASSEMBLY__ */ 724#endif /* !__ASSEMBLY__ */
709 725
710#endif /* _ASM_IA64_PROCESSOR_H */ 726#endif /* _ASM_IA64_PROCESSOR_H */
diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h
index 845143990a1..f5cb27614e3 100644
--- a/arch/ia64/include/asm/ptrace.h
+++ b/arch/ia64/include/asm/ptrace.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_IA64_PTRACE_H
2#define _ASM_IA64_PTRACE_H
3
1/* 4/*
2 * Copyright (C) 1998-2004 Hewlett-Packard Co 5 * Copyright (C) 1998-2004 Hewlett-Packard Co
3 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * David Mosberger-Tang <davidm@hpl.hp.com>
@@ -12,13 +15,52 @@
12 * 6/17/99 D. Mosberger added second unat member to "struct switch_stack" 15 * 6/17/99 D. Mosberger added second unat member to "struct switch_stack"
13 * 16 *
14 */ 17 */
15#ifndef _ASM_IA64_PTRACE_H 18/*
16#define _ASM_IA64_PTRACE_H 19 * When a user process is blocked, its state looks as follows:
20 *
21 * +----------------------+ ------- IA64_STK_OFFSET
22 * | | ^
23 * | struct pt_regs | |
24 * | | |
25 * +----------------------+ |
26 * | | |
27 * | memory stack | |
28 * | (growing downwards) | |
29 * //.....................// |
30 * |
31 * //.....................// |
32 * | | |
33 * +----------------------+ |
34 * | struct switch_stack | |
35 * | | |
36 * +----------------------+ |
37 * | | |
38 * //.....................// |
39 * |
40 * //.....................// |
41 * | | |
42 * | register stack | |
43 * | (growing upwards) | |
44 * | | |
45 * +----------------------+ | --- IA64_RBS_OFFSET
46 * | struct thread_info | | ^
47 * +----------------------+ | |
48 * | | | |
49 * | struct task_struct | | |
50 * current -> | | | |
51 * +----------------------+ -------
52 *
53 * Note that ar.ec is not saved explicitly in pt_reg or switch_stack.
54 * This is because ar.ec is saved as part of ar.pfs.
55 */
56
57
58#include <asm/fpu.h>
17 59
60#ifdef __KERNEL__
18#ifndef ASM_OFFSETS_C 61#ifndef ASM_OFFSETS_C
19#include <asm/asm-offsets.h> 62#include <asm/asm-offsets.h>
20#endif 63#endif
21#include <uapi/asm/ptrace.h>
22 64
23/* 65/*
24 * Base-2 logarithm of number of pages to allocate per task structure 66 * Base-2 logarithm of number of pages to allocate per task structure
@@ -39,8 +81,155 @@
39 81
40#define KERNEL_STACK_SIZE IA64_STK_OFFSET 82#define KERNEL_STACK_SIZE IA64_STK_OFFSET
41 83
84#endif /* __KERNEL__ */
85
42#ifndef __ASSEMBLY__ 86#ifndef __ASSEMBLY__
43 87
88/*
89 * This struct defines the way the registers are saved on system
90 * calls.
91 *
92 * We don't save all floating point register because the kernel
93 * is compiled to use only a very small subset, so the other are
94 * untouched.
95 *
96 * THIS STRUCTURE MUST BE A MULTIPLE 16-BYTE IN SIZE
97 * (because the memory stack pointer MUST ALWAYS be aligned this way)
98 *
99 */
100struct pt_regs {
101 /* The following registers are saved by SAVE_MIN: */
102 unsigned long b6; /* scratch */
103 unsigned long b7; /* scratch */
104
105 unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */
106 unsigned long ar_ssd; /* reserved for future use (scratch) */
107
108 unsigned long r8; /* scratch (return value register 0) */
109 unsigned long r9; /* scratch (return value register 1) */
110 unsigned long r10; /* scratch (return value register 2) */
111 unsigned long r11; /* scratch (return value register 3) */
112
113 unsigned long cr_ipsr; /* interrupted task's psr */
114 unsigned long cr_iip; /* interrupted task's instruction pointer */
115 /*
116 * interrupted task's function state; if bit 63 is cleared, it
117 * contains syscall's ar.pfs.pfm:
118 */
119 unsigned long cr_ifs;
120
121 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
122 unsigned long ar_pfs; /* prev function state */
123 unsigned long ar_rsc; /* RSE configuration */
124 /* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */
125 unsigned long ar_rnat; /* RSE NaT */
126 unsigned long ar_bspstore; /* RSE bspstore */
127
128 unsigned long pr; /* 64 predicate registers (1 bit each) */
129 unsigned long b0; /* return pointer (bp) */
130 unsigned long loadrs; /* size of dirty partition << 16 */
131
132 unsigned long r1; /* the gp pointer */
133 unsigned long r12; /* interrupted task's memory stack pointer */
134 unsigned long r13; /* thread pointer */
135
136 unsigned long ar_fpsr; /* floating point status (preserved) */
137 unsigned long r15; /* scratch */
138
139 /* The remaining registers are NOT saved for system calls. */
140
141 unsigned long r14; /* scratch */
142 unsigned long r2; /* scratch */
143 unsigned long r3; /* scratch */
144
145 /* The following registers are saved by SAVE_REST: */
146 unsigned long r16; /* scratch */
147 unsigned long r17; /* scratch */
148 unsigned long r18; /* scratch */
149 unsigned long r19; /* scratch */
150 unsigned long r20; /* scratch */
151 unsigned long r21; /* scratch */
152 unsigned long r22; /* scratch */
153 unsigned long r23; /* scratch */
154 unsigned long r24; /* scratch */
155 unsigned long r25; /* scratch */
156 unsigned long r26; /* scratch */
157 unsigned long r27; /* scratch */
158 unsigned long r28; /* scratch */
159 unsigned long r29; /* scratch */
160 unsigned long r30; /* scratch */
161 unsigned long r31; /* scratch */
162
163 unsigned long ar_ccv; /* compare/exchange value (scratch) */
164
165 /*
166 * Floating point registers that the kernel considers scratch:
167 */
168 struct ia64_fpreg f6; /* scratch */
169 struct ia64_fpreg f7; /* scratch */
170 struct ia64_fpreg f8; /* scratch */
171 struct ia64_fpreg f9; /* scratch */
172 struct ia64_fpreg f10; /* scratch */
173 struct ia64_fpreg f11; /* scratch */
174};
175
176/*
177 * This structure contains the addition registers that need to
178 * preserved across a context switch. This generally consists of
179 * "preserved" registers.
180 */
181struct switch_stack {
182 unsigned long caller_unat; /* user NaT collection register (preserved) */
183 unsigned long ar_fpsr; /* floating-point status register */
184
185 struct ia64_fpreg f2; /* preserved */
186 struct ia64_fpreg f3; /* preserved */
187 struct ia64_fpreg f4; /* preserved */
188 struct ia64_fpreg f5; /* preserved */
189
190 struct ia64_fpreg f12; /* scratch, but untouched by kernel */
191 struct ia64_fpreg f13; /* scratch, but untouched by kernel */
192 struct ia64_fpreg f14; /* scratch, but untouched by kernel */
193 struct ia64_fpreg f15; /* scratch, but untouched by kernel */
194 struct ia64_fpreg f16; /* preserved */
195 struct ia64_fpreg f17; /* preserved */
196 struct ia64_fpreg f18; /* preserved */
197 struct ia64_fpreg f19; /* preserved */
198 struct ia64_fpreg f20; /* preserved */
199 struct ia64_fpreg f21; /* preserved */
200 struct ia64_fpreg f22; /* preserved */
201 struct ia64_fpreg f23; /* preserved */
202 struct ia64_fpreg f24; /* preserved */
203 struct ia64_fpreg f25; /* preserved */
204 struct ia64_fpreg f26; /* preserved */
205 struct ia64_fpreg f27; /* preserved */
206 struct ia64_fpreg f28; /* preserved */
207 struct ia64_fpreg f29; /* preserved */
208 struct ia64_fpreg f30; /* preserved */
209 struct ia64_fpreg f31; /* preserved */
210
211 unsigned long r4; /* preserved */
212 unsigned long r5; /* preserved */
213 unsigned long r6; /* preserved */
214 unsigned long r7; /* preserved */
215
216 unsigned long b0; /* so we can force a direct return in copy_thread */
217 unsigned long b1;
218 unsigned long b2;
219 unsigned long b3;
220 unsigned long b4;
221 unsigned long b5;
222
223 unsigned long ar_pfs; /* previous function state */
224 unsigned long ar_lc; /* loop counter (preserved) */
225 unsigned long ar_unat; /* NaT bits for r4-r7 */
226 unsigned long ar_rnat; /* RSE NaT collection register */
227 unsigned long ar_bspstore; /* RSE dirty base (preserved) */
228 unsigned long pr; /* 64 predicate registers (1 bit each) */
229};
230
231#ifdef __KERNEL__
232
44#include <asm/current.h> 233#include <asm/current.h>
45#include <asm/page.h> 234#include <asm/page.h>
46 235
@@ -57,18 +246,7 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
57 return regs->ar_bspstore; 246 return regs->ar_bspstore;
58} 247}
59 248
60static inline int is_syscall_success(struct pt_regs *regs) 249#define regs_return_value(regs) ((regs)->r8)
61{
62 return regs->r10 != -1;
63}
64
65static inline long regs_return_value(struct pt_regs *regs)
66{
67 if (is_syscall_success(regs))
68 return regs->r8;
69 else
70 return -regs->r8;
71}
72 250
73/* Conserve space in histogram by encoding slot bits in address 251/* Conserve space in histogram by encoding slot bits in address
74 * bits 2 and 3 rather than bits 0 and 1. 252 * bits 2 and 3 rather than bits 0 and 1.
@@ -78,11 +256,6 @@ static inline long regs_return_value(struct pt_regs *regs)
78 unsigned long __ip = instruction_pointer(regs); \ 256 unsigned long __ip = instruction_pointer(regs); \
79 (__ip & ~3UL) + ((__ip & 3UL) << 2); \ 257 (__ip & ~3UL) + ((__ip & 3UL) << 2); \
80}) 258})
81/*
82 * Why not default? Because user_stack_pointer() on ia64 gives register
83 * stack backing store instead...
84 */
85#define current_user_stack_pointer() (current_pt_regs()->r12)
86 259
87 /* given a pointer to a task_struct, return the user's pt_regs */ 260 /* given a pointer to a task_struct, return the user's pt_regs */
88# define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) 261# define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)
@@ -147,5 +320,46 @@ static inline long regs_return_value(struct pt_regs *regs)
147 #define arch_has_single_step() (1) 320 #define arch_has_single_step() (1)
148 #define arch_has_block_step() (1) 321 #define arch_has_block_step() (1)
149 322
323#endif /* !__KERNEL__ */
324
325/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */
326struct pt_all_user_regs {
327 unsigned long nat;
328 unsigned long cr_iip;
329 unsigned long cfm;
330 unsigned long cr_ipsr;
331 unsigned long pr;
332
333 unsigned long gr[32];
334 unsigned long br[8];
335 unsigned long ar[128];
336 struct ia64_fpreg fr[128];
337};
338
150#endif /* !__ASSEMBLY__ */ 339#endif /* !__ASSEMBLY__ */
340
341/* indices to application-registers array in pt_all_user_regs */
342#define PT_AUR_RSC 16
343#define PT_AUR_BSP 17
344#define PT_AUR_BSPSTORE 18
345#define PT_AUR_RNAT 19
346#define PT_AUR_CCV 32
347#define PT_AUR_UNAT 36
348#define PT_AUR_FPSR 40
349#define PT_AUR_PFS 64
350#define PT_AUR_LC 65
351#define PT_AUR_EC 66
352
353/*
354 * The numbers chosen here are somewhat arbitrary but absolutely MUST
355 * not overlap with any of the number assigned in <linux/ptrace.h>.
356 */
357#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
358#define PTRACE_OLD_GETSIGINFO 13 /* (replaced by PTRACE_GETSIGINFO in <linux/ptrace.h>) */
359#define PTRACE_OLD_SETSIGINFO 14 /* (replaced by PTRACE_SETSIGINFO in <linux/ptrace.h>) */
360#define PTRACE_GETREGS 18 /* get all registers (pt_all_user_regs) in one shot */
361#define PTRACE_SETREGS 19 /* set all registers (pt_all_user_regs) in one shot */
362
363#define PTRACE_OLDSETOPTIONS 21
364
151#endif /* _ASM_IA64_PTRACE_H */ 365#endif /* _ASM_IA64_PTRACE_H */
diff --git a/arch/ia64/include/asm/sal.h b/arch/ia64/include/asm/sal.h
index e504f382115..d19ddba4e32 100644
--- a/arch/ia64/include/asm/sal.h
+++ b/arch/ia64/include/asm/sal.h
@@ -40,6 +40,7 @@
40#include <linux/efi.h> 40#include <linux/efi.h>
41 41
42#include <asm/pal.h> 42#include <asm/pal.h>
43#include <asm/system.h>
43#include <asm/fpu.h> 44#include <asm/fpu.h>
44 45
45extern spinlock_t sal_lock; 46extern spinlock_t sal_lock;
diff --git a/arch/ia64/include/asm/siginfo.h b/arch/ia64/include/asm/siginfo.h
index 6f2e2dd0f28..c8fcaa2ac48 100644
--- a/arch/ia64/include/asm/siginfo.h
+++ b/arch/ia64/include/asm/siginfo.h
@@ -1,14 +1,124 @@
1#ifndef _ASM_IA64_SIGINFO_H
2#define _ASM_IA64_SIGINFO_H
3
1/* 4/*
2 * Based on <asm-i386/siginfo.h>. 5 * Based on <asm-i386/siginfo.h>.
3 * 6 *
4 * Modified 1998-2002 7 * Modified 1998-2002
5 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
6 */ 9 */
7#ifndef _ASM_IA64_SIGINFO_H
8#define _ASM_IA64_SIGINFO_H
9 10
11#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
12
13#define HAVE_ARCH_SIGINFO_T
14#define HAVE_ARCH_COPY_SIGINFO
15#define HAVE_ARCH_COPY_SIGINFO_TO_USER
16
17#include <asm-generic/siginfo.h>
18
19typedef struct siginfo {
20 int si_signo;
21 int si_errno;
22 int si_code;
23 int __pad0;
24
25 union {
26 int _pad[SI_PAD_SIZE];
27
28 /* kill() */
29 struct {
30 pid_t _pid; /* sender's pid */
31 uid_t _uid; /* sender's uid */
32 } _kill;
33
34 /* POSIX.1b timers */
35 struct {
36 timer_t _tid; /* timer id */
37 int _overrun; /* overrun count */
38 char _pad[sizeof(__ARCH_SI_UID_T) - sizeof(int)];
39 sigval_t _sigval; /* must overlay ._rt._sigval! */
40 int _sys_private; /* not to be passed to user */
41 } _timer;
42
43 /* POSIX.1b signals */
44 struct {
45 pid_t _pid; /* sender's pid */
46 uid_t _uid; /* sender's uid */
47 sigval_t _sigval;
48 } _rt;
49
50 /* SIGCHLD */
51 struct {
52 pid_t _pid; /* which child */
53 uid_t _uid; /* sender's uid */
54 int _status; /* exit code */
55 clock_t _utime;
56 clock_t _stime;
57 } _sigchld;
58
59 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
60 struct {
61 void __user *_addr; /* faulting insn/memory ref. */
62 int _imm; /* immediate value for "break" */
63 unsigned int _flags; /* see below */
64 unsigned long _isr; /* isr */
65 short _addr_lsb; /* lsb of faulting address */
66 } _sigfault;
67
68 /* SIGPOLL */
69 struct {
70 long _band; /* POLL_IN, POLL_OUT, POLL_MSG (XPG requires a "long") */
71 int _fd;
72 } _sigpoll;
73 } _sifields;
74} siginfo_t;
75
76#define si_imm _sifields._sigfault._imm /* as per UNIX SysV ABI spec */
77#define si_flags _sifields._sigfault._flags
78/*
79 * si_isr is valid for SIGILL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP provided that
80 * si_code is non-zero and __ISR_VALID is set in si_flags.
81 */
82#define si_isr _sifields._sigfault._isr
83
84/*
85 * Flag values for si_flags:
86 */
87#define __ISR_VALID_BIT 0
88#define __ISR_VALID (1 << __ISR_VALID_BIT)
89
90/*
91 * SIGILL si_codes
92 */
93#define ILL_BADIADDR (__SI_FAULT|9) /* unimplemented instruction address */
94#define __ILL_BREAK (__SI_FAULT|10) /* illegal break */
95#define __ILL_BNDMOD (__SI_FAULT|11) /* bundle-update (modification) in progress */
96#undef NSIGILL
97#define NSIGILL 11
98
99/*
100 * SIGFPE si_codes
101 */
102#define __FPE_DECOVF (__SI_FAULT|9) /* decimal overflow */
103#define __FPE_DECDIV (__SI_FAULT|10) /* decimal division by zero */
104#define __FPE_DECERR (__SI_FAULT|11) /* packed decimal error */
105#define __FPE_INVASC (__SI_FAULT|12) /* invalid ASCII digit */
106#define __FPE_INVDEC (__SI_FAULT|13) /* invalid decimal digit */
107#undef NSIGFPE
108#define NSIGFPE 13
109
110/*
111 * SIGSEGV si_codes
112 */
113#define __SEGV_PSTKOVF (__SI_FAULT|3) /* paragraph stack overflow */
114#undef NSIGSEGV
115#define NSIGSEGV 3
116
117#undef NSIGTRAP
118#define NSIGTRAP 4
119
120#ifdef __KERNEL__
10#include <linux/string.h> 121#include <linux/string.h>
11#include <uapi/asm/siginfo.h>
12 122
13static inline void 123static inline void
14copy_siginfo (siginfo_t *to, siginfo_t *from) 124copy_siginfo (siginfo_t *to, siginfo_t *from)
@@ -20,4 +130,6 @@ copy_siginfo (siginfo_t *to, siginfo_t *from)
20 memcpy(to, from, 4*sizeof(int) + sizeof(from->_sifields._sigchld)); 130 memcpy(to, from, 4*sizeof(int) + sizeof(from->_sifields._sigchld));
21} 131}
22 132
133#endif /* __KERNEL__ */
134
23#endif /* _ASM_IA64_SIGINFO_H */ 135#endif /* _ASM_IA64_SIGINFO_H */
diff --git a/arch/ia64/include/asm/signal.h b/arch/ia64/include/asm/signal.h
index 3a1b20e74c5..b166248d49a 100644
--- a/arch/ia64/include/asm/signal.h
+++ b/arch/ia64/include/asm/signal.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_IA64_SIGNAL_H
2#define _ASM_IA64_SIGNAL_H
3
1/* 4/*
2 * Modified 1998-2001, 2003 5 * Modified 1998-2001, 2003
3 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
@@ -5,18 +8,129 @@
5 * Unfortunately, this file is being included by bits/signal.h in 8 * Unfortunately, this file is being included by bits/signal.h in
6 * glibc-2.x. Hence the #ifdef __KERNEL__ ugliness. 9 * glibc-2.x. Hence the #ifdef __KERNEL__ ugliness.
7 */ 10 */
8#ifndef _ASM_IA64_SIGNAL_H
9#define _ASM_IA64_SIGNAL_H
10 11
11#include <uapi/asm/signal.h> 12#define SIGHUP 1
13#define SIGINT 2
14#define SIGQUIT 3
15#define SIGILL 4
16#define SIGTRAP 5
17#define SIGABRT 6
18#define SIGIOT 6
19#define SIGBUS 7
20#define SIGFPE 8
21#define SIGKILL 9
22#define SIGUSR1 10
23#define SIGSEGV 11
24#define SIGUSR2 12
25#define SIGPIPE 13
26#define SIGALRM 14
27#define SIGTERM 15
28#define SIGSTKFLT 16
29#define SIGCHLD 17
30#define SIGCONT 18
31#define SIGSTOP 19
32#define SIGTSTP 20
33#define SIGTTIN 21
34#define SIGTTOU 22
35#define SIGURG 23
36#define SIGXCPU 24
37#define SIGXFSZ 25
38#define SIGVTALRM 26
39#define SIGPROF 27
40#define SIGWINCH 28
41#define SIGIO 29
42#define SIGPOLL SIGIO
43/*
44#define SIGLOST 29
45*/
46#define SIGPWR 30
47#define SIGSYS 31
48/* signal 31 is no longer "unused", but the SIGUNUSED macro remains for backwards compatibility */
49#define SIGUNUSED 31
50
51/* These should not be considered constants from userland. */
52#define SIGRTMIN 32
53#define SIGRTMAX _NSIG
54
55/*
56 * SA_FLAGS values:
57 *
58 * SA_ONSTACK indicates that a registered stack_t will be used.
59 * SA_RESTART flag to get restarting signals (which were the default long ago)
60 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
61 * SA_RESETHAND clears the handler when the signal is delivered.
62 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
63 * SA_NODEFER prevents the current signal from being masked in the handler.
64 *
65 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
66 * Unix names RESETHAND and NODEFER respectively.
67 */
68#define SA_NOCLDSTOP 0x00000001
69#define SA_NOCLDWAIT 0x00000002
70#define SA_SIGINFO 0x00000004
71#define SA_ONSTACK 0x08000000
72#define SA_RESTART 0x10000000
73#define SA_NODEFER 0x40000000
74#define SA_RESETHAND 0x80000000
75
76#define SA_NOMASK SA_NODEFER
77#define SA_ONESHOT SA_RESETHAND
78
79#define SA_RESTORER 0x04000000
12 80
81/*
82 * sigaltstack controls
83 */
84#define SS_ONSTACK 1
85#define SS_DISABLE 2
86
87/*
88 * The minimum stack size needs to be fairly large because we want to
89 * be sure that an app compiled for today's CPUs will continue to run
90 * on all future CPU models. The CPU model matters because the signal
91 * frame needs to have space for the complete machine state, including
92 * all physical stacked registers. The number of physical stacked
93 * registers is CPU model dependent, but given that the width of
94 * ar.rsc.loadrs is 14 bits, we can assume that they'll never take up
95 * more than 16KB of space.
96 */
97#if 1
98 /*
99 * This is a stupid typo: the value was _meant_ to be 131072 (0x20000), but I typed it
100 * in wrong. ;-( To preserve backwards compatibility, we leave the kernel at the
101 * incorrect value and fix libc only.
102 */
103# define MINSIGSTKSZ 131027 /* min. stack size for sigaltstack() */
104#else
105# define MINSIGSTKSZ 131072 /* min. stack size for sigaltstack() */
106#endif
107#define SIGSTKSZ 262144 /* default stack size for sigaltstack() */
108
109#ifdef __KERNEL__
13 110
14#define _NSIG 64 111#define _NSIG 64
15#define _NSIG_BPW 64 112#define _NSIG_BPW 64
16#define _NSIG_WORDS (_NSIG / _NSIG_BPW) 113#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
17 114
115#endif /* __KERNEL__ */
116
117#include <asm-generic/signal-defs.h>
118
18# ifndef __ASSEMBLY__ 119# ifndef __ASSEMBLY__
19 120
121# include <linux/types.h>
122
123/* Avoid too many header ordering problems. */
124struct siginfo;
125
126typedef struct sigaltstack {
127 void __user *ss_sp;
128 int ss_flags;
129 size_t ss_size;
130} stack_t;
131
132#ifdef __KERNEL__
133
20/* Most things should be clean enough to redefine this at will, if care 134/* Most things should be clean enough to redefine this at will, if care
21 is taken to make libc match. */ 135 is taken to make libc match. */
22 136
@@ -38,5 +152,9 @@ struct k_sigaction {
38 152
39# include <asm/sigcontext.h> 153# include <asm/sigcontext.h>
40 154
155#define ptrace_signal_deliver(regs, cookie) do { } while (0)
156
157#endif /* __KERNEL__ */
158
41# endif /* !__ASSEMBLY__ */ 159# endif /* !__ASSEMBLY__ */
42#endif /* _ASM_IA64_SIGNAL_H */ 160#endif /* _ASM_IA64_SIGNAL_H */
diff --git a/arch/ia64/include/asm/smp.h b/arch/ia64/include/asm/smp.h
index fea21e98602..0b3b3997dec 100644
--- a/arch/ia64/include/asm/smp.h
+++ b/arch/ia64/include/asm/smp.h
@@ -55,7 +55,7 @@ extern struct smp_boot_data {
55 int cpu_phys_id[NR_CPUS]; 55 int cpu_phys_id[NR_CPUS];
56} smp_boot_data __initdata; 56} smp_boot_data __initdata;
57 57
58extern char no_int_routing; 58extern char no_int_routing __devinitdata;
59 59
60extern cpumask_t cpu_core_map[NR_CPUS]; 60extern cpumask_t cpu_core_map[NR_CPUS];
61DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map); 61DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
diff --git a/arch/ia64/include/asm/sn/pda.h b/arch/ia64/include/asm/sn/pda.h
index 22ae358c8d1..1c5108d44d8 100644
--- a/arch/ia64/include/asm/sn/pda.h
+++ b/arch/ia64/include/asm/sn/pda.h
@@ -10,6 +10,7 @@
10 10
11#include <linux/cache.h> 11#include <linux/cache.h>
12#include <asm/percpu.h> 12#include <asm/percpu.h>
13#include <asm/system.h>
13 14
14 15
15/* 16/*
diff --git a/arch/ia64/include/asm/spinlock.h b/arch/ia64/include/asm/spinlock.h
index 54ff557d474..b77768d35f9 100644
--- a/arch/ia64/include/asm/spinlock.h
+++ b/arch/ia64/include/asm/spinlock.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/atomic.h> 16#include <linux/atomic.h>
17#include <asm/intrinsics.h> 17#include <asm/intrinsics.h>
18#include <asm/system.h>
18 19
19#define arch_spin_lock_init(x) ((x)->lock = 0) 20#define arch_spin_lock_init(x) ((x)->lock = 0)
20 21
diff --git a/arch/ia64/include/asm/switch_to.h b/arch/ia64/include/asm/switch_to.h
deleted file mode 100644
index d38c7ea5eea..00000000000
--- a/arch/ia64/include/asm/switch_to.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Low-level task switching. This is based on information published in
3 * the Processor Abstraction Layer and the System Abstraction Layer
4 * manual.
5 *
6 * Copyright (C) 1998-2003 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
9 * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
10 */
11#ifndef _ASM_IA64_SWITCH_TO_H
12#define _ASM_IA64_SWITCH_TO_H
13
14#include <linux/percpu.h>
15
16struct task_struct;
17
18/*
19 * Context switch from one thread to another. If the two threads have
20 * different address spaces, schedule() has already taken care of
21 * switching to the new address space by calling switch_mm().
22 *
23 * Disabling access to the fph partition and the debug-register
24 * context switch MUST be done before calling ia64_switch_to() since a
25 * newly created thread returns directly to
26 * ia64_ret_from_syscall_clear_r8.
27 */
28extern struct task_struct *ia64_switch_to (void *next_task);
29
30extern void ia64_save_extra (struct task_struct *task);
31extern void ia64_load_extra (struct task_struct *task);
32
33#ifdef CONFIG_PERFMON
34 DECLARE_PER_CPU(unsigned long, pfm_syst_info);
35# define PERFMON_IS_SYSWIDE() (__get_cpu_var(pfm_syst_info) & 0x1)
36#else
37# define PERFMON_IS_SYSWIDE() (0)
38#endif
39
40#define IA64_HAS_EXTRA_STATE(t) \
41 ((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID) \
42 || PERFMON_IS_SYSWIDE())
43
44#define __switch_to(prev,next,last) do { \
45 if (IA64_HAS_EXTRA_STATE(prev)) \
46 ia64_save_extra(prev); \
47 if (IA64_HAS_EXTRA_STATE(next)) \
48 ia64_load_extra(next); \
49 ia64_psr(task_pt_regs(next))->dfh = !ia64_is_local_fpu_owner(next); \
50 (last) = ia64_switch_to((next)); \
51} while (0)
52
53#ifdef CONFIG_SMP
54/*
55 * In the SMP case, we save the fph state when context-switching away from a thread that
56 * modified fph. This way, when the thread gets scheduled on another CPU, the CPU can
57 * pick up the state from task->thread.fph, avoiding the complication of having to fetch
58 * the latest fph state from another CPU. In other words: eager save, lazy restore.
59 */
60# define switch_to(prev,next,last) do { \
61 if (ia64_psr(task_pt_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) { \
62 ia64_psr(task_pt_regs(prev))->mfh = 0; \
63 (prev)->thread.flags |= IA64_THREAD_FPH_VALID; \
64 __ia64_save_fpu((prev)->thread.fph); \
65 } \
66 __switch_to(prev, next, last); \
67 /* "next" in old context is "current" in new context */ \
68 if (unlikely((current->thread.flags & IA64_THREAD_MIGRATION) && \
69 (task_cpu(current) != \
70 task_thread_info(current)->last_cpu))) { \
71 platform_migrate(current); \
72 task_thread_info(current)->last_cpu = task_cpu(current); \
73 } \
74} while (0)
75#else
76# define switch_to(prev,next,last) __switch_to(prev, next, last)
77#endif
78
79#endif /* _ASM_IA64_SWITCH_TO_H */
diff --git a/arch/ia64/include/asm/termios.h b/arch/ia64/include/asm/termios.h
index a42f870ca4f..689d218c0c2 100644
--- a/arch/ia64/include/asm/termios.h
+++ b/arch/ia64/include/asm/termios.h
@@ -1,14 +1,52 @@
1#ifndef _ASM_IA64_TERMIOS_H
2#define _ASM_IA64_TERMIOS_H
3
1/* 4/*
2 * Modified 1999 5 * Modified 1999
3 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
4 * 7 *
5 * 99/01/28 Added N_IRDA and N_SMSBLOCK 8 * 99/01/28 Added N_IRDA and N_SMSBLOCK
6 */ 9 */
7#ifndef _ASM_IA64_TERMIOS_H
8#define _ASM_IA64_TERMIOS_H
9 10
10#include <uapi/asm/termios.h> 11#include <asm/termbits.h>
12#include <asm/ioctls.h>
11 13
14struct winsize {
15 unsigned short ws_row;
16 unsigned short ws_col;
17 unsigned short ws_xpixel;
18 unsigned short ws_ypixel;
19};
20
21#define NCC 8
22struct termio {
23 unsigned short c_iflag; /* input mode flags */
24 unsigned short c_oflag; /* output mode flags */
25 unsigned short c_cflag; /* control mode flags */
26 unsigned short c_lflag; /* local mode flags */
27 unsigned char c_line; /* line discipline */
28 unsigned char c_cc[NCC]; /* control characters */
29};
30
31/* modem lines */
32#define TIOCM_LE 0x001
33#define TIOCM_DTR 0x002
34#define TIOCM_RTS 0x004
35#define TIOCM_ST 0x008
36#define TIOCM_SR 0x010
37#define TIOCM_CTS 0x020
38#define TIOCM_CAR 0x040
39#define TIOCM_RNG 0x080
40#define TIOCM_DSR 0x100
41#define TIOCM_CD TIOCM_CAR
42#define TIOCM_RI TIOCM_RNG
43#define TIOCM_OUT1 0x2000
44#define TIOCM_OUT2 0x4000
45#define TIOCM_LOOP 0x8000
46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48
49# ifdef __KERNEL__
12 50
13/* intr=^C quit=^\ erase=del kill=^U 51/* intr=^C quit=^\ erase=del kill=^U
14 eof=^D vtime=\0 vmin=\1 sxtc=\0 52 eof=^D vtime=\0 vmin=\1 sxtc=\0
@@ -54,4 +92,6 @@
54#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) 92#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
55#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) 93#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
56 94
95# endif /* __KERNEL__ */
96
57#endif /* _ASM_IA64_TERMIOS_H */ 97#endif /* _ASM_IA64_TERMIOS_H */
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h
index ff2ae413658..ff0cc84e7bc 100644
--- a/arch/ia64/include/asm/thread_info.h
+++ b/arch/ia64/include/asm/thread_info.h
@@ -54,6 +54,8 @@ struct thread_info {
54 }, \ 54 }, \
55} 55}
56 56
57#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
58
57#ifndef ASM_OFFSETS_C 59#ifndef ASM_OFFSETS_C
58/* how to get the thread information struct from C */ 60/* how to get the thread information struct from C */
59#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE)) 61#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
@@ -82,6 +84,7 @@ struct thread_info {
82#endif 84#endif
83#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET) 85#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
84 86
87#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
85#define alloc_task_struct_node(node) \ 88#define alloc_task_struct_node(node) \
86({ \ 89({ \
87 struct page *page = alloc_pages_node(node, GFP_KERNEL | __GFP_COMP, \ 90 struct page *page = alloc_pages_node(node, GFP_KERNEL | __GFP_COMP, \
@@ -106,9 +109,11 @@ struct thread_info {
106#define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */ 109#define TIF_SYSCALL_AUDIT 3 /* syscall auditing active */
107#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ 110#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
108#define TIF_NOTIFY_RESUME 6 /* resumption notification requested */ 111#define TIF_NOTIFY_RESUME 6 /* resumption notification requested */
112#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
109#define TIF_MEMDIE 17 /* is terminating due to OOM killer */ 113#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
110#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */ 114#define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */
111#define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ 115#define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */
116#define TIF_FREEZE 20 /* is freezing for suspend */
112#define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */ 117#define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */
113 118
114#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 119#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
@@ -118,8 +123,10 @@ struct thread_info {
118#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 123#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
119#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 124#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
120#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 125#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
126#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
121#define _TIF_MCA_INIT (1 << TIF_MCA_INIT) 127#define _TIF_MCA_INIT (1 << TIF_MCA_INIT)
122#define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED) 128#define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED)
129#define _TIF_FREEZE (1 << TIF_FREEZE)
123#define _TIF_RESTORE_RSE (1 << TIF_RESTORE_RSE) 130#define _TIF_RESTORE_RSE (1 << TIF_RESTORE_RSE)
124 131
125/* "work to do on user-return" bits */ 132/* "work to do on user-return" bits */
@@ -139,23 +146,7 @@ static inline void set_restore_sigmask(void)
139{ 146{
140 struct thread_info *ti = current_thread_info(); 147 struct thread_info *ti = current_thread_info();
141 ti->status |= TS_RESTORE_SIGMASK; 148 ti->status |= TS_RESTORE_SIGMASK;
142 WARN_ON(!test_bit(TIF_SIGPENDING, &ti->flags)); 149 set_bit(TIF_SIGPENDING, &ti->flags);
143}
144static inline void clear_restore_sigmask(void)
145{
146 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
147}
148static inline bool test_restore_sigmask(void)
149{
150 return current_thread_info()->status & TS_RESTORE_SIGMASK;
151}
152static inline bool test_and_clear_restore_sigmask(void)
153{
154 struct thread_info *ti = current_thread_info();
155 if (!(ti->status & TS_RESTORE_SIGMASK))
156 return false;
157 ti->status &= ~TS_RESTORE_SIGMASK;
158 return true;
159} 150}
160#endif /* !__ASSEMBLY__ */ 151#endif /* !__ASSEMBLY__ */
161 152
diff --git a/arch/ia64/include/asm/topology.h b/arch/ia64/include/asm/topology.h
index a2496e449b7..09f646753d1 100644
--- a/arch/ia64/include/asm/topology.h
+++ b/arch/ia64/include/asm/topology.h
@@ -70,6 +70,31 @@ void build_cpu_to_node_map(void);
70 .nr_balance_failed = 0, \ 70 .nr_balance_failed = 0, \
71} 71}
72 72
73/* sched_domains SD_NODE_INIT for IA64 NUMA machines */
74#define SD_NODE_INIT (struct sched_domain) { \
75 .parent = NULL, \
76 .child = NULL, \
77 .groups = NULL, \
78 .min_interval = 8, \
79 .max_interval = 8*(min(num_online_cpus(), 32U)), \
80 .busy_factor = 64, \
81 .imbalance_pct = 125, \
82 .cache_nice_tries = 2, \
83 .busy_idx = 3, \
84 .idle_idx = 2, \
85 .newidle_idx = 0, \
86 .wake_idx = 0, \
87 .forkexec_idx = 0, \
88 .flags = SD_LOAD_BALANCE \
89 | SD_BALANCE_NEWIDLE \
90 | SD_BALANCE_EXEC \
91 | SD_BALANCE_FORK \
92 | SD_SERIALIZE, \
93 .last_balance = jiffies, \
94 .balance_interval = 64, \
95 .nr_balance_failed = 0, \
96}
97
73#endif /* CONFIG_NUMA */ 98#endif /* CONFIG_NUMA */
74 99
75#ifdef CONFIG_SMP 100#ifdef CONFIG_SMP
diff --git a/arch/ia64/include/asm/types.h b/arch/ia64/include/asm/types.h
index 4c351b169da..82b3939d271 100644
--- a/arch/ia64/include/asm/types.h
+++ b/arch/ia64/include/asm/types.h
@@ -1,3 +1,6 @@
1#ifndef _ASM_IA64_TYPES_H
2#define _ASM_IA64_TYPES_H
3
1/* 4/*
2 * This file is never included by application software unless explicitly 5 * This file is never included by application software unless explicitly
3 * requested (e.g., via linux/types.h) in which case the application is 6 * requested (e.g., via linux/types.h) in which case the application is
@@ -10,22 +13,34 @@
10 * Modified 1998-2000, 2002 13 * Modified 1998-2000, 2002
11 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co 14 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
12 */ 15 */
13#ifndef _ASM_IA64_TYPES_H
14#define _ASM_IA64_TYPES_H
15 16
17#ifdef __KERNEL__
16#include <asm-generic/int-ll64.h> 18#include <asm-generic/int-ll64.h>
17#include <uapi/asm/types.h> 19#else
20#include <asm-generic/int-l64.h>
21#endif
18 22
19#ifdef __ASSEMBLY__ 23#ifdef __ASSEMBLY__
24# define __IA64_UL(x) (x)
25# define __IA64_UL_CONST(x) x
26
20#else 27#else
28# define __IA64_UL(x) ((unsigned long)(x))
29# define __IA64_UL_CONST(x) x##UL
30
31typedef unsigned int umode_t;
32
21/* 33/*
22 * These aren't exported outside the kernel to avoid name space clashes 34 * These aren't exported outside the kernel to avoid name space clashes
23 */ 35 */
36# ifdef __KERNEL__
24 37
25struct fnptr { 38struct fnptr {
26 unsigned long ip; 39 unsigned long ip;
27 unsigned long gp; 40 unsigned long gp;
28}; 41};
29 42
43# endif /* __KERNEL__ */
30#endif /* !__ASSEMBLY__ */ 44#endif /* !__ASSEMBLY__ */
45
31#endif /* _ASM_IA64_TYPES_H */ 46#endif /* _ASM_IA64_TYPES_H */
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index c3cc42a15af..7c928da35b1 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -1,17 +1,331 @@
1#ifndef _ASM_IA64_UNISTD_H
2#define _ASM_IA64_UNISTD_H
3
1/* 4/*
2 * IA-64 Linux syscall numbers and inline-functions. 5 * IA-64 Linux syscall numbers and inline-functions.
3 * 6 *
4 * Copyright (C) 1998-2005 Hewlett-Packard Co 7 * Copyright (C) 1998-2005 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com> 8 * David Mosberger-Tang <davidm@hpl.hp.com>
6 */ 9 */
7#ifndef _ASM_IA64_UNISTD_H
8#define _ASM_IA64_UNISTD_H
9 10
10#include <uapi/asm/unistd.h> 11#include <asm/break.h>
12
13#define __BREAK_SYSCALL __IA64_BREAK_SYSCALL
14
15#define __NR_ni_syscall 1024
16#define __NR_exit 1025
17#define __NR_read 1026
18#define __NR_write 1027
19#define __NR_open 1028
20#define __NR_close 1029
21#define __NR_creat 1030
22#define __NR_link 1031
23#define __NR_unlink 1032
24#define __NR_execve 1033
25#define __NR_chdir 1034
26#define __NR_fchdir 1035
27#define __NR_utimes 1036
28#define __NR_mknod 1037
29#define __NR_chmod 1038
30#define __NR_chown 1039
31#define __NR_lseek 1040
32#define __NR_getpid 1041
33#define __NR_getppid 1042
34#define __NR_mount 1043
35#define __NR_umount 1044
36#define __NR_setuid 1045
37#define __NR_getuid 1046
38#define __NR_geteuid 1047
39#define __NR_ptrace 1048
40#define __NR_access 1049
41#define __NR_sync 1050
42#define __NR_fsync 1051
43#define __NR_fdatasync 1052
44#define __NR_kill 1053
45#define __NR_rename 1054
46#define __NR_mkdir 1055
47#define __NR_rmdir 1056
48#define __NR_dup 1057
49#define __NR_pipe 1058
50#define __NR_times 1059
51#define __NR_brk 1060
52#define __NR_setgid 1061
53#define __NR_getgid 1062
54#define __NR_getegid 1063
55#define __NR_acct 1064
56#define __NR_ioctl 1065
57#define __NR_fcntl 1066
58#define __NR_umask 1067
59#define __NR_chroot 1068
60#define __NR_ustat 1069
61#define __NR_dup2 1070
62#define __NR_setreuid 1071
63#define __NR_setregid 1072
64#define __NR_getresuid 1073
65#define __NR_setresuid 1074
66#define __NR_getresgid 1075
67#define __NR_setresgid 1076
68#define __NR_getgroups 1077
69#define __NR_setgroups 1078
70#define __NR_getpgid 1079
71#define __NR_setpgid 1080
72#define __NR_setsid 1081
73#define __NR_getsid 1082
74#define __NR_sethostname 1083
75#define __NR_setrlimit 1084
76#define __NR_getrlimit 1085
77#define __NR_getrusage 1086
78#define __NR_gettimeofday 1087
79#define __NR_settimeofday 1088
80#define __NR_select 1089
81#define __NR_poll 1090
82#define __NR_symlink 1091
83#define __NR_readlink 1092
84#define __NR_uselib 1093
85#define __NR_swapon 1094
86#define __NR_swapoff 1095
87#define __NR_reboot 1096
88#define __NR_truncate 1097
89#define __NR_ftruncate 1098
90#define __NR_fchmod 1099
91#define __NR_fchown 1100
92#define __NR_getpriority 1101
93#define __NR_setpriority 1102
94#define __NR_statfs 1103
95#define __NR_fstatfs 1104
96#define __NR_gettid 1105
97#define __NR_semget 1106
98#define __NR_semop 1107
99#define __NR_semctl 1108
100#define __NR_msgget 1109
101#define __NR_msgsnd 1110
102#define __NR_msgrcv 1111
103#define __NR_msgctl 1112
104#define __NR_shmget 1113
105#define __NR_shmat 1114
106#define __NR_shmdt 1115
107#define __NR_shmctl 1116
108/* also known as klogctl() in GNU libc: */
109#define __NR_syslog 1117
110#define __NR_setitimer 1118
111#define __NR_getitimer 1119
112/* 1120 was __NR_old_stat */
113/* 1121 was __NR_old_lstat */
114/* 1122 was __NR_old_fstat */
115#define __NR_vhangup 1123
116#define __NR_lchown 1124
117#define __NR_remap_file_pages 1125
118#define __NR_wait4 1126
119#define __NR_sysinfo 1127
120#define __NR_clone 1128
121#define __NR_setdomainname 1129
122#define __NR_uname 1130
123#define __NR_adjtimex 1131
124/* 1132 was __NR_create_module */
125#define __NR_init_module 1133
126#define __NR_delete_module 1134
127/* 1135 was __NR_get_kernel_syms */
128/* 1136 was __NR_query_module */
129#define __NR_quotactl 1137
130#define __NR_bdflush 1138
131#define __NR_sysfs 1139
132#define __NR_personality 1140
133#define __NR_afs_syscall 1141
134#define __NR_setfsuid 1142
135#define __NR_setfsgid 1143
136#define __NR_getdents 1144
137#define __NR_flock 1145
138#define __NR_readv 1146
139#define __NR_writev 1147
140#define __NR_pread64 1148
141#define __NR_pwrite64 1149
142#define __NR__sysctl 1150
143#define __NR_mmap 1151
144#define __NR_munmap 1152
145#define __NR_mlock 1153
146#define __NR_mlockall 1154
147#define __NR_mprotect 1155
148#define __NR_mremap 1156
149#define __NR_msync 1157
150#define __NR_munlock 1158
151#define __NR_munlockall 1159
152#define __NR_sched_getparam 1160
153#define __NR_sched_setparam 1161
154#define __NR_sched_getscheduler 1162
155#define __NR_sched_setscheduler 1163
156#define __NR_sched_yield 1164
157#define __NR_sched_get_priority_max 1165
158#define __NR_sched_get_priority_min 1166
159#define __NR_sched_rr_get_interval 1167
160#define __NR_nanosleep 1168
161#define __NR_nfsservctl 1169
162#define __NR_prctl 1170
163/* 1171 is reserved for backwards compatibility with old __NR_getpagesize */
164#define __NR_mmap2 1172
165#define __NR_pciconfig_read 1173
166#define __NR_pciconfig_write 1174
167#define __NR_perfmonctl 1175
168#define __NR_sigaltstack 1176
169#define __NR_rt_sigaction 1177
170#define __NR_rt_sigpending 1178
171#define __NR_rt_sigprocmask 1179
172#define __NR_rt_sigqueueinfo 1180
173#define __NR_rt_sigreturn 1181
174#define __NR_rt_sigsuspend 1182
175#define __NR_rt_sigtimedwait 1183
176#define __NR_getcwd 1184
177#define __NR_capget 1185
178#define __NR_capset 1186
179#define __NR_sendfile 1187
180#define __NR_getpmsg 1188
181#define __NR_putpmsg 1189
182#define __NR_socket 1190
183#define __NR_bind 1191
184#define __NR_connect 1192
185#define __NR_listen 1193
186#define __NR_accept 1194
187#define __NR_getsockname 1195
188#define __NR_getpeername 1196
189#define __NR_socketpair 1197
190#define __NR_send 1198
191#define __NR_sendto 1199
192#define __NR_recv 1200
193#define __NR_recvfrom 1201
194#define __NR_shutdown 1202
195#define __NR_setsockopt 1203
196#define __NR_getsockopt 1204
197#define __NR_sendmsg 1205
198#define __NR_recvmsg 1206
199#define __NR_pivot_root 1207
200#define __NR_mincore 1208
201#define __NR_madvise 1209
202#define __NR_stat 1210
203#define __NR_lstat 1211
204#define __NR_fstat 1212
205#define __NR_clone2 1213
206#define __NR_getdents64 1214
207#define __NR_getunwind 1215
208#define __NR_readahead 1216
209#define __NR_setxattr 1217
210#define __NR_lsetxattr 1218
211#define __NR_fsetxattr 1219
212#define __NR_getxattr 1220
213#define __NR_lgetxattr 1221
214#define __NR_fgetxattr 1222
215#define __NR_listxattr 1223
216#define __NR_llistxattr 1224
217#define __NR_flistxattr 1225
218#define __NR_removexattr 1226
219#define __NR_lremovexattr 1227
220#define __NR_fremovexattr 1228
221#define __NR_tkill 1229
222#define __NR_futex 1230
223#define __NR_sched_setaffinity 1231
224#define __NR_sched_getaffinity 1232
225#define __NR_set_tid_address 1233
226#define __NR_fadvise64 1234
227#define __NR_tgkill 1235
228#define __NR_exit_group 1236
229#define __NR_lookup_dcookie 1237
230#define __NR_io_setup 1238
231#define __NR_io_destroy 1239
232#define __NR_io_getevents 1240
233#define __NR_io_submit 1241
234#define __NR_io_cancel 1242
235#define __NR_epoll_create 1243
236#define __NR_epoll_ctl 1244
237#define __NR_epoll_wait 1245
238#define __NR_restart_syscall 1246
239#define __NR_semtimedop 1247
240#define __NR_timer_create 1248
241#define __NR_timer_settime 1249
242#define __NR_timer_gettime 1250
243#define __NR_timer_getoverrun 1251
244#define __NR_timer_delete 1252
245#define __NR_clock_settime 1253
246#define __NR_clock_gettime 1254
247#define __NR_clock_getres 1255
248#define __NR_clock_nanosleep 1256
249#define __NR_fstatfs64 1257
250#define __NR_statfs64 1258
251#define __NR_mbind 1259
252#define __NR_get_mempolicy 1260
253#define __NR_set_mempolicy 1261
254#define __NR_mq_open 1262
255#define __NR_mq_unlink 1263
256#define __NR_mq_timedsend 1264
257#define __NR_mq_timedreceive 1265
258#define __NR_mq_notify 1266
259#define __NR_mq_getsetattr 1267
260#define __NR_kexec_load 1268
261#define __NR_vserver 1269
262#define __NR_waitid 1270
263#define __NR_add_key 1271
264#define __NR_request_key 1272
265#define __NR_keyctl 1273
266#define __NR_ioprio_set 1274
267#define __NR_ioprio_get 1275
268#define __NR_move_pages 1276
269#define __NR_inotify_init 1277
270#define __NR_inotify_add_watch 1278
271#define __NR_inotify_rm_watch 1279
272#define __NR_migrate_pages 1280
273#define __NR_openat 1281
274#define __NR_mkdirat 1282
275#define __NR_mknodat 1283
276#define __NR_fchownat 1284
277#define __NR_futimesat 1285
278#define __NR_newfstatat 1286
279#define __NR_unlinkat 1287
280#define __NR_renameat 1288
281#define __NR_linkat 1289
282#define __NR_symlinkat 1290
283#define __NR_readlinkat 1291
284#define __NR_fchmodat 1292
285#define __NR_faccessat 1293
286#define __NR_pselect6 1294
287#define __NR_ppoll 1295
288#define __NR_unshare 1296
289#define __NR_splice 1297
290#define __NR_set_robust_list 1298
291#define __NR_get_robust_list 1299
292#define __NR_sync_file_range 1300
293#define __NR_tee 1301
294#define __NR_vmsplice 1302
295#define __NR_fallocate 1303
296#define __NR_getcpu 1304
297#define __NR_epoll_pwait 1305
298#define __NR_utimensat 1306
299#define __NR_signalfd 1307
300#define __NR_timerfd 1308
301#define __NR_eventfd 1309
302#define __NR_timerfd_create 1310
303#define __NR_timerfd_settime 1311
304#define __NR_timerfd_gettime 1312
305#define __NR_signalfd4 1313
306#define __NR_eventfd2 1314
307#define __NR_epoll_create1 1315
308#define __NR_dup3 1316
309#define __NR_pipe2 1317
310#define __NR_inotify_init1 1318
311#define __NR_preadv 1319
312#define __NR_pwritev 1320
313#define __NR_rt_tgsigqueueinfo 1321
314#define __NR_recvmmsg 1322
315#define __NR_fanotify_init 1323
316#define __NR_fanotify_mark 1324
317#define __NR_prlimit64 1325
318#define __NR_name_to_handle_at 1326
319#define __NR_open_by_handle_at 1327
320#define __NR_clock_adjtime 1328
321#define __NR_syncfs 1329
322#define __NR_setns 1330
323#define __NR_sendmmsg 1331
11 324
325#ifdef __KERNEL__
12 326
13 327
14#define NR_syscalls 312 /* length of syscall table */ 328#define NR_syscalls 308 /* length of syscall table */
15 329
16/* 330/*
17 * The following defines stop scripts/checksyscalls.sh from complaining about 331 * The following defines stop scripts/checksyscalls.sh from complaining about
@@ -65,4 +379,5 @@ asmlinkage long sys_rt_sigaction(int sig,
65#define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall"))) 379#define cond_syscall(x) asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
66 380
67#endif /* !__ASSEMBLY__ */ 381#endif /* !__ASSEMBLY__ */
382#endif /* __KERNEL__ */
68#endif /* _ASM_IA64_UNISTD_H */ 383#endif /* _ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/include/asm/ustack.h b/arch/ia64/include/asm/ustack.h
index b275401b96d..504167c35b8 100644
--- a/arch/ia64/include/asm/ustack.h
+++ b/arch/ia64/include/asm/ustack.h
@@ -1,11 +1,20 @@
1#ifndef _ASM_IA64_USTACK_H 1#ifndef _ASM_IA64_USTACK_H
2#define _ASM_IA64_USTACK_H 2#define _ASM_IA64_USTACK_H
3 3
4/*
5 * Constants for the user stack size
6 */
7
8#ifdef __KERNEL__
4#include <asm/page.h> 9#include <asm/page.h>
5#include <uapi/asm/ustack.h>
6 10
7/* The absolute hard limit for stack size is 1/2 of the mappable space in the region */ 11/* The absolute hard limit for stack size is 1/2 of the mappable space in the region */
8#define MAX_USER_STACK_SIZE (RGN_MAP_LIMIT/2) 12#define MAX_USER_STACK_SIZE (RGN_MAP_LIMIT/2)
9#define STACK_TOP (0x6000000000000000UL + RGN_MAP_LIMIT) 13#define STACK_TOP (0x6000000000000000UL + RGN_MAP_LIMIT)
10#define STACK_TOP_MAX STACK_TOP 14#define STACK_TOP_MAX STACK_TOP
15#endif
16
17/* Make a default stack size of 2GiB */
18#define DEFAULT_USER_STACK_SIZE (1UL << 31)
19
11#endif /* _ASM_IA64_USTACK_H */ 20#endif /* _ASM_IA64_USTACK_H */
diff --git a/arch/ia64/include/asm/uv/uv.h b/arch/ia64/include/asm/uv/uv.h
index 8f6cbaa742e..61b5bdfd980 100644
--- a/arch/ia64/include/asm/uv/uv.h
+++ b/arch/ia64/include/asm/uv/uv.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_IA64_UV_UV_H 1#ifndef _ASM_IA64_UV_UV_H
2#define _ASM_IA64_UV_UV_H 2#define _ASM_IA64_UV_UV_H
3 3
4#include <asm/system.h>
4#include <asm/sn/simulator.h> 5#include <asm/sn/simulator.h>
5 6
6static inline int is_uv_system(void) 7static inline int is_uv_system(void)
diff --git a/arch/ia64/include/asm/xen/interface.h b/arch/ia64/include/asm/xen/interface.h
index e88c5de2741..e951e740bdf 100644
--- a/arch/ia64/include/asm/xen/interface.h
+++ b/arch/ia64/include/asm/xen/interface.h
@@ -67,23 +67,17 @@
67#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0) 67#define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0)
68 68
69#ifndef __ASSEMBLY__ 69#ifndef __ASSEMBLY__
70/* Explicitly size integers that represent pfns in the public interface
71 * with Xen so that we could have one ABI that works for 32 and 64 bit
72 * guests. */
73typedef unsigned long xen_pfn_t;
74typedef unsigned long xen_ulong_t;
75/* Guest handles for primitive C types. */ 70/* Guest handles for primitive C types. */
76__DEFINE_GUEST_HANDLE(uchar, unsigned char); 71__DEFINE_GUEST_HANDLE(uchar, unsigned char);
77__DEFINE_GUEST_HANDLE(uint, unsigned int); 72__DEFINE_GUEST_HANDLE(uint, unsigned int);
78__DEFINE_GUEST_HANDLE(ulong, unsigned long); 73__DEFINE_GUEST_HANDLE(ulong, unsigned long);
79 74__DEFINE_GUEST_HANDLE(u64, unsigned long);
80DEFINE_GUEST_HANDLE(char); 75DEFINE_GUEST_HANDLE(char);
81DEFINE_GUEST_HANDLE(int); 76DEFINE_GUEST_HANDLE(int);
82DEFINE_GUEST_HANDLE(long); 77DEFINE_GUEST_HANDLE(long);
83DEFINE_GUEST_HANDLE(void); 78DEFINE_GUEST_HANDLE(void);
84DEFINE_GUEST_HANDLE(uint64_t);
85DEFINE_GUEST_HANDLE(uint32_t);
86 79
80typedef unsigned long xen_pfn_t;
87DEFINE_GUEST_HANDLE(xen_pfn_t); 81DEFINE_GUEST_HANDLE(xen_pfn_t);
88#define PRI_xen_pfn "lx" 82#define PRI_xen_pfn "lx"
89#endif 83#endif
@@ -269,8 +263,6 @@ typedef struct xen_callback xen_callback_t;
269 263
270#endif /* !__ASSEMBLY__ */ 264#endif /* !__ASSEMBLY__ */
271 265
272#include <asm/pvclock-abi.h>
273
274/* Size of the shared_info area (this is not related to page size). */ 266/* Size of the shared_info area (this is not related to page size). */
275#define XSI_SHIFT 14 267#define XSI_SHIFT 14
276#define XSI_SIZE (1 << XSI_SHIFT) 268#define XSI_SIZE (1 << XSI_SHIFT)
diff --git a/arch/ia64/include/uapi/asm/Kbuild b/arch/ia64/include/uapi/asm/Kbuild
deleted file mode 100644
index 1b3f5eb5fcd..00000000000
--- a/arch/ia64/include/uapi/asm/Kbuild
+++ /dev/null
@@ -1,50 +0,0 @@
1# UAPI Header export list
2include include/uapi/asm-generic/Kbuild.asm
3
4generic-y += kvm_para.h
5
6header-y += auxvec.h
7header-y += bitsperlong.h
8header-y += break.h
9header-y += byteorder.h
10header-y += cmpxchg.h
11header-y += errno.h
12header-y += fcntl.h
13header-y += fpu.h
14header-y += gcc_intrin.h
15header-y += ia64regs.h
16header-y += intel_intrin.h
17header-y += intrinsics.h
18header-y += ioctl.h
19header-y += ioctls.h
20header-y += ipcbuf.h
21header-y += kvm.h
22header-y += kvm_para.h
23header-y += mman.h
24header-y += msgbuf.h
25header-y += param.h
26header-y += perfmon.h
27header-y += perfmon_default_smpl.h
28header-y += poll.h
29header-y += posix_types.h
30header-y += ptrace.h
31header-y += ptrace_offsets.h
32header-y += resource.h
33header-y += rse.h
34header-y += sembuf.h
35header-y += setup.h
36header-y += shmbuf.h
37header-y += sigcontext.h
38header-y += siginfo.h
39header-y += signal.h
40header-y += socket.h
41header-y += sockios.h
42header-y += stat.h
43header-y += statfs.h
44header-y += swab.h
45header-y += termbits.h
46header-y += termios.h
47header-y += types.h
48header-y += ucontext.h
49header-y += unistd.h
50header-y += ustack.h
diff --git a/arch/ia64/include/uapi/asm/auxvec.h b/arch/ia64/include/uapi/asm/auxvec.h
deleted file mode 100644
index 58277fc650e..00000000000
--- a/arch/ia64/include/uapi/asm/auxvec.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_IA64_AUXVEC_H
2#define _ASM_IA64_AUXVEC_H
3
4/*
5 * Architecture-neutral AT_ values are in the range 0-17. Leave some room for more of
6 * them, start the architecture-specific ones at 32.
7 */
8#define AT_SYSINFO 32
9#define AT_SYSINFO_EHDR 33
10
11#define AT_VECTOR_SIZE_ARCH 2 /* entries in ARCH_DLINFO */
12
13#endif /* _ASM_IA64_AUXVEC_H */
diff --git a/arch/ia64/include/uapi/asm/bitsperlong.h b/arch/ia64/include/uapi/asm/bitsperlong.h
deleted file mode 100644
index ec4db3c970b..00000000000
--- a/arch/ia64/include/uapi/asm/bitsperlong.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef __ASM_IA64_BITSPERLONG_H
2#define __ASM_IA64_BITSPERLONG_H
3
4#define __BITS_PER_LONG 64
5
6#include <asm-generic/bitsperlong.h>
7
8#endif /* __ASM_IA64_BITSPERLONG_H */
diff --git a/arch/ia64/include/uapi/asm/break.h b/arch/ia64/include/uapi/asm/break.h
deleted file mode 100644
index e90c40ec9ed..00000000000
--- a/arch/ia64/include/uapi/asm/break.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _ASM_IA64_BREAK_H
2#define _ASM_IA64_BREAK_H
3
4/*
5 * IA-64 Linux break numbers.
6 *
7 * Copyright (C) 1999 Hewlett-Packard Co
8 * Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com>
9 */
10
11/*
12 * OS-specific debug break numbers:
13 */
14#define __IA64_BREAK_KDB 0x80100
15#define __IA64_BREAK_KPROBE 0x81000 /* .. 0x81fff */
16#define __IA64_BREAK_JPROBE 0x82000
17
18/*
19 * OS-specific break numbers:
20 */
21#define __IA64_BREAK_SYSCALL 0x100000
22
23/*
24 * Xen specific break numbers:
25 */
26#define __IA64_XEN_HYPERCALL 0x1000
27/* [__IA64_XEN_HYPERPRIVOP_START, __IA64_XEN_HYPERPRIVOP_MAX] is used
28 for xen hyperprivops */
29#define __IA64_XEN_HYPERPRIVOP_START 0x1
30#define __IA64_XEN_HYPERPRIVOP_MAX 0x1a
31
32#endif /* _ASM_IA64_BREAK_H */
diff --git a/arch/ia64/include/uapi/asm/byteorder.h b/arch/ia64/include/uapi/asm/byteorder.h
deleted file mode 100644
index a8dd7355815..00000000000
--- a/arch/ia64/include/uapi/asm/byteorder.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_IA64_BYTEORDER_H
2#define _ASM_IA64_BYTEORDER_H
3
4#include <linux/byteorder/little_endian.h>
5
6#endif /* _ASM_IA64_BYTEORDER_H */
diff --git a/arch/ia64/include/uapi/asm/cmpxchg.h b/arch/ia64/include/uapi/asm/cmpxchg.h
deleted file mode 100644
index 4f37dbbb864..00000000000
--- a/arch/ia64/include/uapi/asm/cmpxchg.h
+++ /dev/null
@@ -1,147 +0,0 @@
1#ifndef _ASM_IA64_CMPXCHG_H
2#define _ASM_IA64_CMPXCHG_H
3
4/*
5 * Compare/Exchange, forked from asm/intrinsics.h
6 * which was:
7 *
8 * Copyright (C) 2002-2003 Hewlett-Packard Co
9 * David Mosberger-Tang <davidm@hpl.hp.com>
10 */
11
12#ifndef __ASSEMBLY__
13
14#include <linux/types.h>
15/* include compiler specific intrinsics */
16#include <asm/ia64regs.h>
17#ifdef __INTEL_COMPILER
18# include <asm/intel_intrin.h>
19#else
20# include <asm/gcc_intrin.h>
21#endif
22
23/*
24 * This function doesn't exist, so you'll get a linker error if
25 * something tries to do an invalid xchg().
26 */
27extern void ia64_xchg_called_with_bad_pointer(void);
28
29#define __xchg(x, ptr, size) \
30({ \
31 unsigned long __xchg_result; \
32 \
33 switch (size) { \
34 case 1: \
35 __xchg_result = ia64_xchg1((__u8 *)ptr, x); \
36 break; \
37 \
38 case 2: \
39 __xchg_result = ia64_xchg2((__u16 *)ptr, x); \
40 break; \
41 \
42 case 4: \
43 __xchg_result = ia64_xchg4((__u32 *)ptr, x); \
44 break; \
45 \
46 case 8: \
47 __xchg_result = ia64_xchg8((__u64 *)ptr, x); \
48 break; \
49 default: \
50 ia64_xchg_called_with_bad_pointer(); \
51 } \
52 __xchg_result; \
53})
54
55#define xchg(ptr, x) \
56((__typeof__(*(ptr))) __xchg((unsigned long) (x), (ptr), sizeof(*(ptr))))
57
58/*
59 * Atomic compare and exchange. Compare OLD with MEM, if identical,
60 * store NEW in MEM. Return the initial value in MEM. Success is
61 * indicated by comparing RETURN with OLD.
62 */
63
64#define __HAVE_ARCH_CMPXCHG 1
65
66/*
67 * This function doesn't exist, so you'll get a linker error
68 * if something tries to do an invalid cmpxchg().
69 */
70extern long ia64_cmpxchg_called_with_bad_pointer(void);
71
72#define ia64_cmpxchg(sem, ptr, old, new, size) \
73({ \
74 __u64 _o_, _r_; \
75 \
76 switch (size) { \
77 case 1: \
78 _o_ = (__u8) (long) (old); \
79 break; \
80 case 2: \
81 _o_ = (__u16) (long) (old); \
82 break; \
83 case 4: \
84 _o_ = (__u32) (long) (old); \
85 break; \
86 case 8: \
87 _o_ = (__u64) (long) (old); \
88 break; \
89 default: \
90 break; \
91 } \
92 switch (size) { \
93 case 1: \
94 _r_ = ia64_cmpxchg1_##sem((__u8 *) ptr, new, _o_); \
95 break; \
96 \
97 case 2: \
98 _r_ = ia64_cmpxchg2_##sem((__u16 *) ptr, new, _o_); \
99 break; \
100 \
101 case 4: \
102 _r_ = ia64_cmpxchg4_##sem((__u32 *) ptr, new, _o_); \
103 break; \
104 \
105 case 8: \
106 _r_ = ia64_cmpxchg8_##sem((__u64 *) ptr, new, _o_); \
107 break; \
108 \
109 default: \
110 _r_ = ia64_cmpxchg_called_with_bad_pointer(); \
111 break; \
112 } \
113 (__typeof__(old)) _r_; \
114})
115
116#define cmpxchg_acq(ptr, o, n) \
117 ia64_cmpxchg(acq, (ptr), (o), (n), sizeof(*(ptr)))
118#define cmpxchg_rel(ptr, o, n) \
119 ia64_cmpxchg(rel, (ptr), (o), (n), sizeof(*(ptr)))
120
121/* for compatibility with other platforms: */
122#define cmpxchg(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
123#define cmpxchg64(ptr, o, n) cmpxchg_acq((ptr), (o), (n))
124
125#define cmpxchg_local cmpxchg
126#define cmpxchg64_local cmpxchg64
127
128#ifdef CONFIG_IA64_DEBUG_CMPXCHG
129# define CMPXCHG_BUGCHECK_DECL int _cmpxchg_bugcheck_count = 128;
130# define CMPXCHG_BUGCHECK(v) \
131do { \
132 if (_cmpxchg_bugcheck_count-- <= 0) { \
133 void *ip; \
134 extern int printk(const char *fmt, ...); \
135 ip = (void *) ia64_getreg(_IA64_REG_IP); \
136 printk("CMPXCHG_BUGCHECK: stuck at %p on word %p\n", ip, (v));\
137 break; \
138 } \
139} while (0)
140#else /* !CONFIG_IA64_DEBUG_CMPXCHG */
141# define CMPXCHG_BUGCHECK_DECL
142# define CMPXCHG_BUGCHECK(v)
143#endif /* !CONFIG_IA64_DEBUG_CMPXCHG */
144
145#endif /* !__ASSEMBLY__ */
146
147#endif /* _ASM_IA64_CMPXCHG_H */
diff --git a/arch/ia64/include/uapi/asm/errno.h b/arch/ia64/include/uapi/asm/errno.h
deleted file mode 100644
index 4c82b503d92..00000000000
--- a/arch/ia64/include/uapi/asm/errno.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/errno.h>
diff --git a/arch/ia64/include/uapi/asm/fcntl.h b/arch/ia64/include/uapi/asm/fcntl.h
deleted file mode 100644
index 1dd275dc8f6..00000000000
--- a/arch/ia64/include/uapi/asm/fcntl.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _ASM_IA64_FCNTL_H
2#define _ASM_IA64_FCNTL_H
3/*
4 * Modified 1998-2000
5 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co.
6 */
7
8#define force_o_largefile() \
9 (personality(current->personality) != PER_LINUX32)
10
11#include <asm-generic/fcntl.h>
12
13#endif /* _ASM_IA64_FCNTL_H */
diff --git a/arch/ia64/include/uapi/asm/fpu.h b/arch/ia64/include/uapi/asm/fpu.h
deleted file mode 100644
index b6395ad1500..00000000000
--- a/arch/ia64/include/uapi/asm/fpu.h
+++ /dev/null
@@ -1,66 +0,0 @@
1#ifndef _ASM_IA64_FPU_H
2#define _ASM_IA64_FPU_H
3
4/*
5 * Copyright (C) 1998, 1999, 2002, 2003 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */
8
9#include <linux/types.h>
10
11/* floating point status register: */
12#define FPSR_TRAP_VD (1 << 0) /* invalid op trap disabled */
13#define FPSR_TRAP_DD (1 << 1) /* denormal trap disabled */
14#define FPSR_TRAP_ZD (1 << 2) /* zero-divide trap disabled */
15#define FPSR_TRAP_OD (1 << 3) /* overflow trap disabled */
16#define FPSR_TRAP_UD (1 << 4) /* underflow trap disabled */
17#define FPSR_TRAP_ID (1 << 5) /* inexact trap disabled */
18#define FPSR_S0(x) ((x) << 6)
19#define FPSR_S1(x) ((x) << 19)
20#define FPSR_S2(x) (__IA64_UL(x) << 32)
21#define FPSR_S3(x) (__IA64_UL(x) << 45)
22
23/* floating-point status field controls: */
24#define FPSF_FTZ (1 << 0) /* flush-to-zero */
25#define FPSF_WRE (1 << 1) /* widest-range exponent */
26#define FPSF_PC(x) (((x) & 0x3) << 2) /* precision control */
27#define FPSF_RC(x) (((x) & 0x3) << 4) /* rounding control */
28#define FPSF_TD (1 << 6) /* trap disabled */
29
30/* floating-point status field flags: */
31#define FPSF_V (1 << 7) /* invalid operation flag */
32#define FPSF_D (1 << 8) /* denormal/unnormal operand flag */
33#define FPSF_Z (1 << 9) /* zero divide (IEEE) flag */
34#define FPSF_O (1 << 10) /* overflow (IEEE) flag */
35#define FPSF_U (1 << 11) /* underflow (IEEE) flag */
36#define FPSF_I (1 << 12) /* inexact (IEEE) flag) */
37
38/* floating-point rounding control: */
39#define FPRC_NEAREST 0x0
40#define FPRC_NEGINF 0x1
41#define FPRC_POSINF 0x2
42#define FPRC_TRUNC 0x3
43
44#define FPSF_DEFAULT (FPSF_PC (0x3) | FPSF_RC (FPRC_NEAREST))
45
46/* This default value is the same as HP-UX uses. Don't change it
47 without a very good reason. */
48#define FPSR_DEFAULT (FPSR_TRAP_VD | FPSR_TRAP_DD | FPSR_TRAP_ZD \
49 | FPSR_TRAP_OD | FPSR_TRAP_UD | FPSR_TRAP_ID \
50 | FPSR_S0 (FPSF_DEFAULT) \
51 | FPSR_S1 (FPSF_DEFAULT | FPSF_TD | FPSF_WRE) \
52 | FPSR_S2 (FPSF_DEFAULT | FPSF_TD) \
53 | FPSR_S3 (FPSF_DEFAULT | FPSF_TD))
54
55# ifndef __ASSEMBLY__
56
57struct ia64_fpreg {
58 union {
59 unsigned long bits[2];
60 long double __dummy; /* force 16-byte alignment */
61 } u;
62};
63
64# endif /* __ASSEMBLY__ */
65
66#endif /* _ASM_IA64_FPU_H */
diff --git a/arch/ia64/include/uapi/asm/gcc_intrin.h b/arch/ia64/include/uapi/asm/gcc_intrin.h
deleted file mode 100644
index 61d0d011197..00000000000
--- a/arch/ia64/include/uapi/asm/gcc_intrin.h
+++ /dev/null
@@ -1,618 +0,0 @@
1/*
2 *
3 * Copyright (C) 2002,2003 Jun Nakajima <jun.nakajima@intel.com>
4 * Copyright (C) 2002,2003 Suresh Siddha <suresh.b.siddha@intel.com>
5 */
6#ifndef _UAPI_ASM_IA64_GCC_INTRIN_H
7#define _UAPI_ASM_IA64_GCC_INTRIN_H
8
9#include <linux/types.h>
10#include <linux/compiler.h>
11
12/* define this macro to get some asm stmts included in 'c' files */
13#define ASM_SUPPORTED
14
15/* Optimization barrier */
16/* The "volatile" is due to gcc bugs */
17#define ia64_barrier() asm volatile ("":::"memory")
18
19#define ia64_stop() asm volatile (";;"::)
20
21#define ia64_invala_gr(regnum) asm volatile ("invala.e r%0" :: "i"(regnum))
22
23#define ia64_invala_fr(regnum) asm volatile ("invala.e f%0" :: "i"(regnum))
24
25#define ia64_flushrs() asm volatile ("flushrs;;":::"memory")
26
27#define ia64_loadrs() asm volatile ("loadrs;;":::"memory")
28
29extern void ia64_bad_param_for_setreg (void);
30extern void ia64_bad_param_for_getreg (void);
31
32
33#define ia64_native_setreg(regnum, val) \
34({ \
35 switch (regnum) { \
36 case _IA64_REG_PSR_L: \
37 asm volatile ("mov psr.l=%0" :: "r"(val) : "memory"); \
38 break; \
39 case _IA64_REG_AR_KR0 ... _IA64_REG_AR_EC: \
40 asm volatile ("mov ar%0=%1" :: \
41 "i" (regnum - _IA64_REG_AR_KR0), \
42 "r"(val): "memory"); \
43 break; \
44 case _IA64_REG_CR_DCR ... _IA64_REG_CR_LRR1: \
45 asm volatile ("mov cr%0=%1" :: \
46 "i" (regnum - _IA64_REG_CR_DCR), \
47 "r"(val): "memory" ); \
48 break; \
49 case _IA64_REG_SP: \
50 asm volatile ("mov r12=%0" :: \
51 "r"(val): "memory"); \
52 break; \
53 case _IA64_REG_GP: \
54 asm volatile ("mov gp=%0" :: "r"(val) : "memory"); \
55 break; \
56 default: \
57 ia64_bad_param_for_setreg(); \
58 break; \
59 } \
60})
61
62#define ia64_native_getreg(regnum) \
63({ \
64 __u64 ia64_intri_res; \
65 \
66 switch (regnum) { \
67 case _IA64_REG_GP: \
68 asm volatile ("mov %0=gp" : "=r"(ia64_intri_res)); \
69 break; \
70 case _IA64_REG_IP: \
71 asm volatile ("mov %0=ip" : "=r"(ia64_intri_res)); \
72 break; \
73 case _IA64_REG_PSR: \
74 asm volatile ("mov %0=psr" : "=r"(ia64_intri_res)); \
75 break; \
76 case _IA64_REG_TP: /* for current() */ \
77 ia64_intri_res = ia64_r13; \
78 break; \
79 case _IA64_REG_AR_KR0 ... _IA64_REG_AR_EC: \
80 asm volatile ("mov %0=ar%1" : "=r" (ia64_intri_res) \
81 : "i"(regnum - _IA64_REG_AR_KR0)); \
82 break; \
83 case _IA64_REG_CR_DCR ... _IA64_REG_CR_LRR1: \
84 asm volatile ("mov %0=cr%1" : "=r" (ia64_intri_res) \
85 : "i" (regnum - _IA64_REG_CR_DCR)); \
86 break; \
87 case _IA64_REG_SP: \
88 asm volatile ("mov %0=sp" : "=r" (ia64_intri_res)); \
89 break; \
90 default: \
91 ia64_bad_param_for_getreg(); \
92 break; \
93 } \
94 ia64_intri_res; \
95})
96
97#define ia64_hint_pause 0
98
99#define ia64_hint(mode) \
100({ \
101 switch (mode) { \
102 case ia64_hint_pause: \
103 asm volatile ("hint @pause" ::: "memory"); \
104 break; \
105 } \
106})
107
108
109/* Integer values for mux1 instruction */
110#define ia64_mux1_brcst 0
111#define ia64_mux1_mix 8
112#define ia64_mux1_shuf 9
113#define ia64_mux1_alt 10
114#define ia64_mux1_rev 11
115
116#define ia64_mux1(x, mode) \
117({ \
118 __u64 ia64_intri_res; \
119 \
120 switch (mode) { \
121 case ia64_mux1_brcst: \
122 asm ("mux1 %0=%1,@brcst" : "=r" (ia64_intri_res) : "r" (x)); \
123 break; \
124 case ia64_mux1_mix: \
125 asm ("mux1 %0=%1,@mix" : "=r" (ia64_intri_res) : "r" (x)); \
126 break; \
127 case ia64_mux1_shuf: \
128 asm ("mux1 %0=%1,@shuf" : "=r" (ia64_intri_res) : "r" (x)); \
129 break; \
130 case ia64_mux1_alt: \
131 asm ("mux1 %0=%1,@alt" : "=r" (ia64_intri_res) : "r" (x)); \
132 break; \
133 case ia64_mux1_rev: \
134 asm ("mux1 %0=%1,@rev" : "=r" (ia64_intri_res) : "r" (x)); \
135 break; \
136 } \
137 ia64_intri_res; \
138})
139
140#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
141# define ia64_popcnt(x) __builtin_popcountl(x)
142#else
143# define ia64_popcnt(x) \
144 ({ \
145 __u64 ia64_intri_res; \
146 asm ("popcnt %0=%1" : "=r" (ia64_intri_res) : "r" (x)); \
147 \
148 ia64_intri_res; \
149 })
150#endif
151
152#define ia64_getf_exp(x) \
153({ \
154 long ia64_intri_res; \
155 \
156 asm ("getf.exp %0=%1" : "=r"(ia64_intri_res) : "f"(x)); \
157 \
158 ia64_intri_res; \
159})
160
161#define ia64_shrp(a, b, count) \
162({ \
163 __u64 ia64_intri_res; \
164 asm ("shrp %0=%1,%2,%3" : "=r"(ia64_intri_res) : "r"(a), "r"(b), "i"(count)); \
165 ia64_intri_res; \
166})
167
168#define ia64_ldfs(regnum, x) \
169({ \
170 register double __f__ asm ("f"#regnum); \
171 asm volatile ("ldfs %0=[%1]" :"=f"(__f__): "r"(x)); \
172})
173
174#define ia64_ldfd(regnum, x) \
175({ \
176 register double __f__ asm ("f"#regnum); \
177 asm volatile ("ldfd %0=[%1]" :"=f"(__f__): "r"(x)); \
178})
179
180#define ia64_ldfe(regnum, x) \
181({ \
182 register double __f__ asm ("f"#regnum); \
183 asm volatile ("ldfe %0=[%1]" :"=f"(__f__): "r"(x)); \
184})
185
186#define ia64_ldf8(regnum, x) \
187({ \
188 register double __f__ asm ("f"#regnum); \
189 asm volatile ("ldf8 %0=[%1]" :"=f"(__f__): "r"(x)); \
190})
191
192#define ia64_ldf_fill(regnum, x) \
193({ \
194 register double __f__ asm ("f"#regnum); \
195 asm volatile ("ldf.fill %0=[%1]" :"=f"(__f__): "r"(x)); \
196})
197
198#define ia64_st4_rel_nta(m, val) \
199({ \
200 asm volatile ("st4.rel.nta [%0] = %1\n\t" :: "r"(m), "r"(val)); \
201})
202
203#define ia64_stfs(x, regnum) \
204({ \
205 register double __f__ asm ("f"#regnum); \
206 asm volatile ("stfs [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
207})
208
209#define ia64_stfd(x, regnum) \
210({ \
211 register double __f__ asm ("f"#regnum); \
212 asm volatile ("stfd [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
213})
214
215#define ia64_stfe(x, regnum) \
216({ \
217 register double __f__ asm ("f"#regnum); \
218 asm volatile ("stfe [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
219})
220
221#define ia64_stf8(x, regnum) \
222({ \
223 register double __f__ asm ("f"#regnum); \
224 asm volatile ("stf8 [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
225})
226
227#define ia64_stf_spill(x, regnum) \
228({ \
229 register double __f__ asm ("f"#regnum); \
230 asm volatile ("stf.spill [%0]=%1" :: "r"(x), "f"(__f__) : "memory"); \
231})
232
233#define ia64_fetchadd4_acq(p, inc) \
234({ \
235 \
236 __u64 ia64_intri_res; \
237 asm volatile ("fetchadd4.acq %0=[%1],%2" \
238 : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \
239 : "memory"); \
240 \
241 ia64_intri_res; \
242})
243
244#define ia64_fetchadd4_rel(p, inc) \
245({ \
246 __u64 ia64_intri_res; \
247 asm volatile ("fetchadd4.rel %0=[%1],%2" \
248 : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \
249 : "memory"); \
250 \
251 ia64_intri_res; \
252})
253
254#define ia64_fetchadd8_acq(p, inc) \
255({ \
256 \
257 __u64 ia64_intri_res; \
258 asm volatile ("fetchadd8.acq %0=[%1],%2" \
259 : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \
260 : "memory"); \
261 \
262 ia64_intri_res; \
263})
264
265#define ia64_fetchadd8_rel(p, inc) \
266({ \
267 __u64 ia64_intri_res; \
268 asm volatile ("fetchadd8.rel %0=[%1],%2" \
269 : "=r"(ia64_intri_res) : "r"(p), "i" (inc) \
270 : "memory"); \
271 \
272 ia64_intri_res; \
273})
274
275#define ia64_xchg1(ptr,x) \
276({ \
277 __u64 ia64_intri_res; \
278 asm volatile ("xchg1 %0=[%1],%2" \
279 : "=r" (ia64_intri_res) : "r" (ptr), "r" (x) : "memory"); \
280 ia64_intri_res; \
281})
282
283#define ia64_xchg2(ptr,x) \
284({ \
285 __u64 ia64_intri_res; \
286 asm volatile ("xchg2 %0=[%1],%2" : "=r" (ia64_intri_res) \
287 : "r" (ptr), "r" (x) : "memory"); \
288 ia64_intri_res; \
289})
290
291#define ia64_xchg4(ptr,x) \
292({ \
293 __u64 ia64_intri_res; \
294 asm volatile ("xchg4 %0=[%1],%2" : "=r" (ia64_intri_res) \
295 : "r" (ptr), "r" (x) : "memory"); \
296 ia64_intri_res; \
297})
298
299#define ia64_xchg8(ptr,x) \
300({ \
301 __u64 ia64_intri_res; \
302 asm volatile ("xchg8 %0=[%1],%2" : "=r" (ia64_intri_res) \
303 : "r" (ptr), "r" (x) : "memory"); \
304 ia64_intri_res; \
305})
306
307#define ia64_cmpxchg1_acq(ptr, new, old) \
308({ \
309 __u64 ia64_intri_res; \
310 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
311 asm volatile ("cmpxchg1.acq %0=[%1],%2,ar.ccv": \
312 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
313 ia64_intri_res; \
314})
315
316#define ia64_cmpxchg1_rel(ptr, new, old) \
317({ \
318 __u64 ia64_intri_res; \
319 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
320 asm volatile ("cmpxchg1.rel %0=[%1],%2,ar.ccv": \
321 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
322 ia64_intri_res; \
323})
324
325#define ia64_cmpxchg2_acq(ptr, new, old) \
326({ \
327 __u64 ia64_intri_res; \
328 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
329 asm volatile ("cmpxchg2.acq %0=[%1],%2,ar.ccv": \
330 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
331 ia64_intri_res; \
332})
333
334#define ia64_cmpxchg2_rel(ptr, new, old) \
335({ \
336 __u64 ia64_intri_res; \
337 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
338 \
339 asm volatile ("cmpxchg2.rel %0=[%1],%2,ar.ccv": \
340 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
341 ia64_intri_res; \
342})
343
344#define ia64_cmpxchg4_acq(ptr, new, old) \
345({ \
346 __u64 ia64_intri_res; \
347 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
348 asm volatile ("cmpxchg4.acq %0=[%1],%2,ar.ccv": \
349 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
350 ia64_intri_res; \
351})
352
353#define ia64_cmpxchg4_rel(ptr, new, old) \
354({ \
355 __u64 ia64_intri_res; \
356 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
357 asm volatile ("cmpxchg4.rel %0=[%1],%2,ar.ccv": \
358 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
359 ia64_intri_res; \
360})
361
362#define ia64_cmpxchg8_acq(ptr, new, old) \
363({ \
364 __u64 ia64_intri_res; \
365 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
366 asm volatile ("cmpxchg8.acq %0=[%1],%2,ar.ccv": \
367 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
368 ia64_intri_res; \
369})
370
371#define ia64_cmpxchg8_rel(ptr, new, old) \
372({ \
373 __u64 ia64_intri_res; \
374 asm volatile ("mov ar.ccv=%0;;" :: "rO"(old)); \
375 \
376 asm volatile ("cmpxchg8.rel %0=[%1],%2,ar.ccv": \
377 "=r"(ia64_intri_res) : "r"(ptr), "r"(new) : "memory"); \
378 ia64_intri_res; \
379})
380
381#define ia64_mf() asm volatile ("mf" ::: "memory")
382#define ia64_mfa() asm volatile ("mf.a" ::: "memory")
383
384#define ia64_invala() asm volatile ("invala" ::: "memory")
385
386#define ia64_native_thash(addr) \
387({ \
388 unsigned long ia64_intri_res; \
389 asm volatile ("thash %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \
390 ia64_intri_res; \
391})
392
393#define ia64_srlz_i() asm volatile (";; srlz.i ;;" ::: "memory")
394#define ia64_srlz_d() asm volatile (";; srlz.d" ::: "memory");
395
396#ifdef HAVE_SERIALIZE_DIRECTIVE
397# define ia64_dv_serialize_data() asm volatile (".serialize.data");
398# define ia64_dv_serialize_instruction() asm volatile (".serialize.instruction");
399#else
400# define ia64_dv_serialize_data()
401# define ia64_dv_serialize_instruction()
402#endif
403
404#define ia64_nop(x) asm volatile ("nop %0"::"i"(x));
405
406#define ia64_itci(addr) asm volatile ("itc.i %0;;" :: "r"(addr) : "memory")
407
408#define ia64_itcd(addr) asm volatile ("itc.d %0;;" :: "r"(addr) : "memory")
409
410
411#define ia64_itri(trnum, addr) asm volatile ("itr.i itr[%0]=%1" \
412 :: "r"(trnum), "r"(addr) : "memory")
413
414#define ia64_itrd(trnum, addr) asm volatile ("itr.d dtr[%0]=%1" \
415 :: "r"(trnum), "r"(addr) : "memory")
416
417#define ia64_tpa(addr) \
418({ \
419 unsigned long ia64_pa; \
420 asm volatile ("tpa %0 = %1" : "=r"(ia64_pa) : "r"(addr) : "memory"); \
421 ia64_pa; \
422})
423
424#define __ia64_set_dbr(index, val) \
425 asm volatile ("mov dbr[%0]=%1" :: "r"(index), "r"(val) : "memory")
426
427#define ia64_set_ibr(index, val) \
428 asm volatile ("mov ibr[%0]=%1" :: "r"(index), "r"(val) : "memory")
429
430#define ia64_set_pkr(index, val) \
431 asm volatile ("mov pkr[%0]=%1" :: "r"(index), "r"(val) : "memory")
432
433#define ia64_set_pmc(index, val) \
434 asm volatile ("mov pmc[%0]=%1" :: "r"(index), "r"(val) : "memory")
435
436#define ia64_set_pmd(index, val) \
437 asm volatile ("mov pmd[%0]=%1" :: "r"(index), "r"(val) : "memory")
438
439#define ia64_native_set_rr(index, val) \
440 asm volatile ("mov rr[%0]=%1" :: "r"(index), "r"(val) : "memory");
441
442#define ia64_native_get_cpuid(index) \
443({ \
444 unsigned long ia64_intri_res; \
445 asm volatile ("mov %0=cpuid[%r1]" : "=r"(ia64_intri_res) : "rO"(index)); \
446 ia64_intri_res; \
447})
448
449#define __ia64_get_dbr(index) \
450({ \
451 unsigned long ia64_intri_res; \
452 asm volatile ("mov %0=dbr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
453 ia64_intri_res; \
454})
455
456#define ia64_get_ibr(index) \
457({ \
458 unsigned long ia64_intri_res; \
459 asm volatile ("mov %0=ibr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
460 ia64_intri_res; \
461})
462
463#define ia64_get_pkr(index) \
464({ \
465 unsigned long ia64_intri_res; \
466 asm volatile ("mov %0=pkr[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
467 ia64_intri_res; \
468})
469
470#define ia64_get_pmc(index) \
471({ \
472 unsigned long ia64_intri_res; \
473 asm volatile ("mov %0=pmc[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
474 ia64_intri_res; \
475})
476
477
478#define ia64_native_get_pmd(index) \
479({ \
480 unsigned long ia64_intri_res; \
481 asm volatile ("mov %0=pmd[%1]" : "=r"(ia64_intri_res) : "r"(index)); \
482 ia64_intri_res; \
483})
484
485#define ia64_native_get_rr(index) \
486({ \
487 unsigned long ia64_intri_res; \
488 asm volatile ("mov %0=rr[%1]" : "=r"(ia64_intri_res) : "r" (index)); \
489 ia64_intri_res; \
490})
491
492#define ia64_native_fc(addr) asm volatile ("fc %0" :: "r"(addr) : "memory")
493
494
495#define ia64_sync_i() asm volatile (";; sync.i" ::: "memory")
496
497#define ia64_native_ssm(mask) asm volatile ("ssm %0":: "i"((mask)) : "memory")
498#define ia64_native_rsm(mask) asm volatile ("rsm %0":: "i"((mask)) : "memory")
499#define ia64_sum(mask) asm volatile ("sum %0":: "i"((mask)) : "memory")
500#define ia64_rum(mask) asm volatile ("rum %0":: "i"((mask)) : "memory")
501
502#define ia64_ptce(addr) asm volatile ("ptc.e %0" :: "r"(addr))
503
504#define ia64_native_ptcga(addr, size) \
505do { \
506 asm volatile ("ptc.ga %0,%1" :: "r"(addr), "r"(size) : "memory"); \
507 ia64_dv_serialize_data(); \
508} while (0)
509
510#define ia64_ptcl(addr, size) \
511do { \
512 asm volatile ("ptc.l %0,%1" :: "r"(addr), "r"(size) : "memory"); \
513 ia64_dv_serialize_data(); \
514} while (0)
515
516#define ia64_ptri(addr, size) \
517 asm volatile ("ptr.i %0,%1" :: "r"(addr), "r"(size) : "memory")
518
519#define ia64_ptrd(addr, size) \
520 asm volatile ("ptr.d %0,%1" :: "r"(addr), "r"(size) : "memory")
521
522#define ia64_ttag(addr) \
523({ \
524 __u64 ia64_intri_res; \
525 asm volatile ("ttag %0=%1" : "=r"(ia64_intri_res) : "r" (addr)); \
526 ia64_intri_res; \
527})
528
529
530/* Values for lfhint in ia64_lfetch and ia64_lfetch_fault */
531
532#define ia64_lfhint_none 0
533#define ia64_lfhint_nt1 1
534#define ia64_lfhint_nt2 2
535#define ia64_lfhint_nta 3
536
537#define ia64_lfetch(lfhint, y) \
538({ \
539 switch (lfhint) { \
540 case ia64_lfhint_none: \
541 asm volatile ("lfetch [%0]" : : "r"(y)); \
542 break; \
543 case ia64_lfhint_nt1: \
544 asm volatile ("lfetch.nt1 [%0]" : : "r"(y)); \
545 break; \
546 case ia64_lfhint_nt2: \
547 asm volatile ("lfetch.nt2 [%0]" : : "r"(y)); \
548 break; \
549 case ia64_lfhint_nta: \
550 asm volatile ("lfetch.nta [%0]" : : "r"(y)); \
551 break; \
552 } \
553})
554
555#define ia64_lfetch_excl(lfhint, y) \
556({ \
557 switch (lfhint) { \
558 case ia64_lfhint_none: \
559 asm volatile ("lfetch.excl [%0]" :: "r"(y)); \
560 break; \
561 case ia64_lfhint_nt1: \
562 asm volatile ("lfetch.excl.nt1 [%0]" :: "r"(y)); \
563 break; \
564 case ia64_lfhint_nt2: \
565 asm volatile ("lfetch.excl.nt2 [%0]" :: "r"(y)); \
566 break; \
567 case ia64_lfhint_nta: \
568 asm volatile ("lfetch.excl.nta [%0]" :: "r"(y)); \
569 break; \
570 } \
571})
572
573#define ia64_lfetch_fault(lfhint, y) \
574({ \
575 switch (lfhint) { \
576 case ia64_lfhint_none: \
577 asm volatile ("lfetch.fault [%0]" : : "r"(y)); \
578 break; \
579 case ia64_lfhint_nt1: \
580 asm volatile ("lfetch.fault.nt1 [%0]" : : "r"(y)); \
581 break; \
582 case ia64_lfhint_nt2: \
583 asm volatile ("lfetch.fault.nt2 [%0]" : : "r"(y)); \
584 break; \
585 case ia64_lfhint_nta: \
586 asm volatile ("lfetch.fault.nta [%0]" : : "r"(y)); \
587 break; \
588 } \
589})
590
591#define ia64_lfetch_fault_excl(lfhint, y) \
592({ \
593 switch (lfhint) { \
594 case ia64_lfhint_none: \
595 asm volatile ("lfetch.fault.excl [%0]" :: "r"(y)); \
596 break; \
597 case ia64_lfhint_nt1: \
598 asm volatile ("lfetch.fault.excl.nt1 [%0]" :: "r"(y)); \
599 break; \
600 case ia64_lfhint_nt2: \
601 asm volatile ("lfetch.fault.excl.nt2 [%0]" :: "r"(y)); \
602 break; \
603 case ia64_lfhint_nta: \
604 asm volatile ("lfetch.fault.excl.nta [%0]" :: "r"(y)); \
605 break; \
606 } \
607})
608
609#define ia64_native_intrin_local_irq_restore(x) \
610do { \
611 asm volatile (";; cmp.ne p6,p7=%0,r0;;" \
612 "(p6) ssm psr.i;" \
613 "(p7) rsm psr.i;;" \
614 "(p6) srlz.d" \
615 :: "r"((x)) : "p6", "p7", "memory"); \
616} while (0)
617
618#endif /* _UAPI_ASM_IA64_GCC_INTRIN_H */
diff --git a/arch/ia64/include/uapi/asm/ia64regs.h b/arch/ia64/include/uapi/asm/ia64regs.h
deleted file mode 100644
index 1757f1c11ad..00000000000
--- a/arch/ia64/include/uapi/asm/ia64regs.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * Copyright (C) 2002,2003 Intel Corp.
3 * Jun Nakajima <jun.nakajima@intel.com>
4 * Suresh Siddha <suresh.b.siddha@intel.com>
5 */
6
7#ifndef _ASM_IA64_IA64REGS_H
8#define _ASM_IA64_IA64REGS_H
9
10/*
11 * Register Names for getreg() and setreg().
12 *
13 * The "magic" numbers happen to match the values used by the Intel compiler's
14 * getreg()/setreg() intrinsics.
15 */
16
17/* Special Registers */
18
19#define _IA64_REG_IP 1016 /* getreg only */
20#define _IA64_REG_PSR 1019
21#define _IA64_REG_PSR_L 1019
22
23/* General Integer Registers */
24
25#define _IA64_REG_GP 1025 /* R1 */
26#define _IA64_REG_R8 1032 /* R8 */
27#define _IA64_REG_R9 1033 /* R9 */
28#define _IA64_REG_SP 1036 /* R12 */
29#define _IA64_REG_TP 1037 /* R13 */
30
31/* Application Registers */
32
33#define _IA64_REG_AR_KR0 3072
34#define _IA64_REG_AR_KR1 3073
35#define _IA64_REG_AR_KR2 3074
36#define _IA64_REG_AR_KR3 3075
37#define _IA64_REG_AR_KR4 3076
38#define _IA64_REG_AR_KR5 3077
39#define _IA64_REG_AR_KR6 3078
40#define _IA64_REG_AR_KR7 3079
41#define _IA64_REG_AR_RSC 3088
42#define _IA64_REG_AR_BSP 3089
43#define _IA64_REG_AR_BSPSTORE 3090
44#define _IA64_REG_AR_RNAT 3091
45#define _IA64_REG_AR_FCR 3093
46#define _IA64_REG_AR_EFLAG 3096
47#define _IA64_REG_AR_CSD 3097
48#define _IA64_REG_AR_SSD 3098
49#define _IA64_REG_AR_CFLAG 3099
50#define _IA64_REG_AR_FSR 3100
51#define _IA64_REG_AR_FIR 3101
52#define _IA64_REG_AR_FDR 3102
53#define _IA64_REG_AR_CCV 3104
54#define _IA64_REG_AR_UNAT 3108
55#define _IA64_REG_AR_FPSR 3112
56#define _IA64_REG_AR_ITC 3116
57#define _IA64_REG_AR_PFS 3136
58#define _IA64_REG_AR_LC 3137
59#define _IA64_REG_AR_EC 3138
60
61/* Control Registers */
62
63#define _IA64_REG_CR_DCR 4096
64#define _IA64_REG_CR_ITM 4097
65#define _IA64_REG_CR_IVA 4098
66#define _IA64_REG_CR_PTA 4104
67#define _IA64_REG_CR_IPSR 4112
68#define _IA64_REG_CR_ISR 4113
69#define _IA64_REG_CR_IIP 4115
70#define _IA64_REG_CR_IFA 4116
71#define _IA64_REG_CR_ITIR 4117
72#define _IA64_REG_CR_IIPA 4118
73#define _IA64_REG_CR_IFS 4119
74#define _IA64_REG_CR_IIM 4120
75#define _IA64_REG_CR_IHA 4121
76#define _IA64_REG_CR_LID 4160
77#define _IA64_REG_CR_IVR 4161 /* getreg only */
78#define _IA64_REG_CR_TPR 4162
79#define _IA64_REG_CR_EOI 4163
80#define _IA64_REG_CR_IRR0 4164 /* getreg only */
81#define _IA64_REG_CR_IRR1 4165 /* getreg only */
82#define _IA64_REG_CR_IRR2 4166 /* getreg only */
83#define _IA64_REG_CR_IRR3 4167 /* getreg only */
84#define _IA64_REG_CR_ITV 4168
85#define _IA64_REG_CR_PMV 4169
86#define _IA64_REG_CR_CMCV 4170
87#define _IA64_REG_CR_LRR0 4176
88#define _IA64_REG_CR_LRR1 4177
89
90/* Indirect Registers for getindreg() and setindreg() */
91
92#define _IA64_REG_INDR_CPUID 9000 /* getindreg only */
93#define _IA64_REG_INDR_DBR 9001
94#define _IA64_REG_INDR_IBR 9002
95#define _IA64_REG_INDR_PKR 9003
96#define _IA64_REG_INDR_PMC 9004
97#define _IA64_REG_INDR_PMD 9005
98#define _IA64_REG_INDR_RR 9006
99
100#endif /* _ASM_IA64_IA64REGS_H */
diff --git a/arch/ia64/include/uapi/asm/intel_intrin.h b/arch/ia64/include/uapi/asm/intel_intrin.h
deleted file mode 100644
index 53cec577558..00000000000
--- a/arch/ia64/include/uapi/asm/intel_intrin.h
+++ /dev/null
@@ -1,161 +0,0 @@
1#ifndef _ASM_IA64_INTEL_INTRIN_H
2#define _ASM_IA64_INTEL_INTRIN_H
3/*
4 * Intel Compiler Intrinsics
5 *
6 * Copyright (C) 2002,2003 Jun Nakajima <jun.nakajima@intel.com>
7 * Copyright (C) 2002,2003 Suresh Siddha <suresh.b.siddha@intel.com>
8 * Copyright (C) 2005,2006 Hongjiu Lu <hongjiu.lu@intel.com>
9 *
10 */
11#include <ia64intrin.h>
12
13#define ia64_barrier() __memory_barrier()
14
15#define ia64_stop() /* Nothing: As of now stop bit is generated for each
16 * intrinsic
17 */
18
19#define ia64_native_getreg __getReg
20#define ia64_native_setreg __setReg
21
22#define ia64_hint __hint
23#define ia64_hint_pause __hint_pause
24
25#define ia64_mux1_brcst _m64_mux1_brcst
26#define ia64_mux1_mix _m64_mux1_mix
27#define ia64_mux1_shuf _m64_mux1_shuf
28#define ia64_mux1_alt _m64_mux1_alt
29#define ia64_mux1_rev _m64_mux1_rev
30
31#define ia64_mux1(x,v) _m_to_int64(_m64_mux1(_m_from_int64(x), (v)))
32#define ia64_popcnt _m64_popcnt
33#define ia64_getf_exp __getf_exp
34#define ia64_shrp _m64_shrp
35
36#define ia64_tpa __tpa
37#define ia64_invala __invala
38#define ia64_invala_gr __invala_gr
39#define ia64_invala_fr __invala_fr
40#define ia64_nop __nop
41#define ia64_sum __sum
42#define ia64_native_ssm __ssm
43#define ia64_rum __rum
44#define ia64_native_rsm __rsm
45#define ia64_native_fc __fc
46
47#define ia64_ldfs __ldfs
48#define ia64_ldfd __ldfd
49#define ia64_ldfe __ldfe
50#define ia64_ldf8 __ldf8
51#define ia64_ldf_fill __ldf_fill
52
53#define ia64_stfs __stfs
54#define ia64_stfd __stfd
55#define ia64_stfe __stfe
56#define ia64_stf8 __stf8
57#define ia64_stf_spill __stf_spill
58
59#define ia64_mf __mf
60#define ia64_mfa __mfa
61
62#define ia64_fetchadd4_acq __fetchadd4_acq
63#define ia64_fetchadd4_rel __fetchadd4_rel
64#define ia64_fetchadd8_acq __fetchadd8_acq
65#define ia64_fetchadd8_rel __fetchadd8_rel
66
67#define ia64_xchg1 _InterlockedExchange8
68#define ia64_xchg2 _InterlockedExchange16
69#define ia64_xchg4 _InterlockedExchange
70#define ia64_xchg8 _InterlockedExchange64
71
72#define ia64_cmpxchg1_rel _InterlockedCompareExchange8_rel
73#define ia64_cmpxchg1_acq _InterlockedCompareExchange8_acq
74#define ia64_cmpxchg2_rel _InterlockedCompareExchange16_rel
75#define ia64_cmpxchg2_acq _InterlockedCompareExchange16_acq
76#define ia64_cmpxchg4_rel _InterlockedCompareExchange_rel
77#define ia64_cmpxchg4_acq _InterlockedCompareExchange_acq
78#define ia64_cmpxchg8_rel _InterlockedCompareExchange64_rel
79#define ia64_cmpxchg8_acq _InterlockedCompareExchange64_acq
80
81#define __ia64_set_dbr(index, val) \
82 __setIndReg(_IA64_REG_INDR_DBR, index, val)
83#define ia64_set_ibr(index, val) \
84 __setIndReg(_IA64_REG_INDR_IBR, index, val)
85#define ia64_set_pkr(index, val) \
86 __setIndReg(_IA64_REG_INDR_PKR, index, val)
87#define ia64_set_pmc(index, val) \
88 __setIndReg(_IA64_REG_INDR_PMC, index, val)
89#define ia64_set_pmd(index, val) \
90 __setIndReg(_IA64_REG_INDR_PMD, index, val)
91#define ia64_native_set_rr(index, val) \
92 __setIndReg(_IA64_REG_INDR_RR, index, val)
93
94#define ia64_native_get_cpuid(index) \
95 __getIndReg(_IA64_REG_INDR_CPUID, index)
96#define __ia64_get_dbr(index) __getIndReg(_IA64_REG_INDR_DBR, index)
97#define ia64_get_ibr(index) __getIndReg(_IA64_REG_INDR_IBR, index)
98#define ia64_get_pkr(index) __getIndReg(_IA64_REG_INDR_PKR, index)
99#define ia64_get_pmc(index) __getIndReg(_IA64_REG_INDR_PMC, index)
100#define ia64_native_get_pmd(index) __getIndReg(_IA64_REG_INDR_PMD, index)
101#define ia64_native_get_rr(index) __getIndReg(_IA64_REG_INDR_RR, index)
102
103#define ia64_srlz_d __dsrlz
104#define ia64_srlz_i __isrlz
105
106#define ia64_dv_serialize_data()
107#define ia64_dv_serialize_instruction()
108
109#define ia64_st1_rel __st1_rel
110#define ia64_st2_rel __st2_rel
111#define ia64_st4_rel __st4_rel
112#define ia64_st8_rel __st8_rel
113
114/* FIXME: need st4.rel.nta intrinsic */
115#define ia64_st4_rel_nta __st4_rel
116
117#define ia64_ld1_acq __ld1_acq
118#define ia64_ld2_acq __ld2_acq
119#define ia64_ld4_acq __ld4_acq
120#define ia64_ld8_acq __ld8_acq
121
122#define ia64_sync_i __synci
123#define ia64_native_thash __thash
124#define ia64_native_ttag __ttag
125#define ia64_itcd __itcd
126#define ia64_itci __itci
127#define ia64_itrd __itrd
128#define ia64_itri __itri
129#define ia64_ptce __ptce
130#define ia64_ptcl __ptcl
131#define ia64_native_ptcg __ptcg
132#define ia64_native_ptcga __ptcga
133#define ia64_ptri __ptri
134#define ia64_ptrd __ptrd
135#define ia64_dep_mi _m64_dep_mi
136
137/* Values for lfhint in __lfetch and __lfetch_fault */
138
139#define ia64_lfhint_none __lfhint_none
140#define ia64_lfhint_nt1 __lfhint_nt1
141#define ia64_lfhint_nt2 __lfhint_nt2
142#define ia64_lfhint_nta __lfhint_nta
143
144#define ia64_lfetch __lfetch
145#define ia64_lfetch_excl __lfetch_excl
146#define ia64_lfetch_fault __lfetch_fault
147#define ia64_lfetch_fault_excl __lfetch_fault_excl
148
149#define ia64_native_intrin_local_irq_restore(x) \
150do { \
151 if ((x) != 0) { \
152 ia64_native_ssm(IA64_PSR_I); \
153 ia64_srlz_d(); \
154 } else { \
155 ia64_native_rsm(IA64_PSR_I); \
156 } \
157} while (0)
158
159#define __builtin_trap() __break(0);
160
161#endif /* _ASM_IA64_INTEL_INTRIN_H */
diff --git a/arch/ia64/include/uapi/asm/intrinsics.h b/arch/ia64/include/uapi/asm/intrinsics.h
deleted file mode 100644
index 5829978ff46..00000000000
--- a/arch/ia64/include/uapi/asm/intrinsics.h
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * Compiler-dependent intrinsics.
3 *
4 * Copyright (C) 2002-2003 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com>
6 */
7#ifndef _UAPI_ASM_IA64_INTRINSICS_H
8#define _UAPI_ASM_IA64_INTRINSICS_H
9
10
11#ifndef __ASSEMBLY__
12
13#include <linux/types.h>
14/* include compiler specific intrinsics */
15#include <asm/ia64regs.h>
16#ifdef __INTEL_COMPILER
17# include <asm/intel_intrin.h>
18#else
19# include <asm/gcc_intrin.h>
20#endif
21#include <asm/cmpxchg.h>
22
23#define ia64_native_get_psr_i() (ia64_native_getreg(_IA64_REG_PSR) & IA64_PSR_I)
24
25#define ia64_native_set_rr0_to_rr4(val0, val1, val2, val3, val4) \
26do { \
27 ia64_native_set_rr(0x0000000000000000UL, (val0)); \
28 ia64_native_set_rr(0x2000000000000000UL, (val1)); \
29 ia64_native_set_rr(0x4000000000000000UL, (val2)); \
30 ia64_native_set_rr(0x6000000000000000UL, (val3)); \
31 ia64_native_set_rr(0x8000000000000000UL, (val4)); \
32} while (0)
33
34/*
35 * Force an unresolved reference if someone tries to use
36 * ia64_fetch_and_add() with a bad value.
37 */
38extern unsigned long __bad_size_for_ia64_fetch_and_add (void);
39extern unsigned long __bad_increment_for_ia64_fetch_and_add (void);
40
41#define IA64_FETCHADD(tmp,v,n,sz,sem) \
42({ \
43 switch (sz) { \
44 case 4: \
45 tmp = ia64_fetchadd4_##sem((unsigned int *) v, n); \
46 break; \
47 \
48 case 8: \
49 tmp = ia64_fetchadd8_##sem((unsigned long *) v, n); \
50 break; \
51 \
52 default: \
53 __bad_size_for_ia64_fetch_and_add(); \
54 } \
55})
56
57#define ia64_fetchadd(i,v,sem) \
58({ \
59 __u64 _tmp; \
60 volatile __typeof__(*(v)) *_v = (v); \
61 /* Can't use a switch () here: gcc isn't always smart enough for that... */ \
62 if ((i) == -16) \
63 IA64_FETCHADD(_tmp, _v, -16, sizeof(*(v)), sem); \
64 else if ((i) == -8) \
65 IA64_FETCHADD(_tmp, _v, -8, sizeof(*(v)), sem); \
66 else if ((i) == -4) \
67 IA64_FETCHADD(_tmp, _v, -4, sizeof(*(v)), sem); \
68 else if ((i) == -1) \
69 IA64_FETCHADD(_tmp, _v, -1, sizeof(*(v)), sem); \
70 else if ((i) == 1) \
71 IA64_FETCHADD(_tmp, _v, 1, sizeof(*(v)), sem); \
72 else if ((i) == 4) \
73 IA64_FETCHADD(_tmp, _v, 4, sizeof(*(v)), sem); \
74 else if ((i) == 8) \
75 IA64_FETCHADD(_tmp, _v, 8, sizeof(*(v)), sem); \
76 else if ((i) == 16) \
77 IA64_FETCHADD(_tmp, _v, 16, sizeof(*(v)), sem); \
78 else \
79 _tmp = __bad_increment_for_ia64_fetch_and_add(); \
80 (__typeof__(*(v))) (_tmp); /* return old value */ \
81})
82
83#define ia64_fetch_and_add(i,v) (ia64_fetchadd(i, v, rel) + (i)) /* return new value */
84
85#endif
86
87
88#ifndef __ASSEMBLY__
89
90#define IA64_INTRINSIC_API(name) ia64_native_ ## name
91#define IA64_INTRINSIC_MACRO(name) ia64_native_ ## name
92
93
94/************************************************/
95/* Instructions paravirtualized for correctness */
96/************************************************/
97/* fc, thash, get_cpuid, get_pmd, get_eflags, set_eflags */
98/* Note that "ttag" and "cover" are also privilege-sensitive; "ttag"
99 * is not currently used (though it may be in a long-format VHPT system!)
100 */
101#define ia64_fc IA64_INTRINSIC_API(fc)
102#define ia64_thash IA64_INTRINSIC_API(thash)
103#define ia64_get_cpuid IA64_INTRINSIC_API(get_cpuid)
104#define ia64_get_pmd IA64_INTRINSIC_API(get_pmd)
105
106
107/************************************************/
108/* Instructions paravirtualized for performance */
109/************************************************/
110#define ia64_ssm IA64_INTRINSIC_MACRO(ssm)
111#define ia64_rsm IA64_INTRINSIC_MACRO(rsm)
112#define ia64_getreg IA64_INTRINSIC_MACRO(getreg)
113#define ia64_setreg IA64_INTRINSIC_API(setreg)
114#define ia64_set_rr IA64_INTRINSIC_API(set_rr)
115#define ia64_get_rr IA64_INTRINSIC_API(get_rr)
116#define ia64_ptcga IA64_INTRINSIC_API(ptcga)
117#define ia64_get_psr_i IA64_INTRINSIC_API(get_psr_i)
118#define ia64_intrin_local_irq_restore \
119 IA64_INTRINSIC_API(intrin_local_irq_restore)
120#define ia64_set_rr0_to_rr4 IA64_INTRINSIC_API(set_rr0_to_rr4)
121
122#endif /* !__ASSEMBLY__ */
123
124#endif /* _UAPI_ASM_IA64_INTRINSICS_H */
diff --git a/arch/ia64/include/uapi/asm/ioctl.h b/arch/ia64/include/uapi/asm/ioctl.h
deleted file mode 100644
index b279fe06dfe..00000000000
--- a/arch/ia64/include/uapi/asm/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/arch/ia64/include/uapi/asm/ioctls.h b/arch/ia64/include/uapi/asm/ioctls.h
deleted file mode 100644
index f3aab5512e9..00000000000
--- a/arch/ia64/include/uapi/asm/ioctls.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_IA64_IOCTLS_H
2#define _ASM_IA64_IOCTLS_H
3
4#include <asm-generic/ioctls.h>
5
6#endif /* _ASM_IA64_IOCTLS_H */
diff --git a/arch/ia64/include/uapi/asm/ipcbuf.h b/arch/ia64/include/uapi/asm/ipcbuf.h
deleted file mode 100644
index 84c7e51cb6d..00000000000
--- a/arch/ia64/include/uapi/asm/ipcbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipcbuf.h>
diff --git a/arch/ia64/include/uapi/asm/kvm.h b/arch/ia64/include/uapi/asm/kvm.h
deleted file mode 100644
index ec6c6b30123..00000000000
--- a/arch/ia64/include/uapi/asm/kvm.h
+++ /dev/null
@@ -1,269 +0,0 @@
1#ifndef __ASM_IA64_KVM_H
2#define __ASM_IA64_KVM_H
3
4/*
5 * kvm structure definitions for ia64
6 *
7 * Copyright (C) 2007 Xiantao Zhang <xiantao.zhang@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms and conditions of the GNU General Public License,
11 * version 2, as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20 * Place - Suite 330, Boston, MA 02111-1307 USA.
21 *
22 */
23
24#include <linux/types.h>
25#include <linux/ioctl.h>
26
27/* Select x86 specific features in <linux/kvm.h> */
28#define __KVM_HAVE_IOAPIC
29#define __KVM_HAVE_IRQ_LINE
30#define __KVM_HAVE_DEVICE_ASSIGNMENT
31
32/* Architectural interrupt line count. */
33#define KVM_NR_INTERRUPTS 256
34
35#define KVM_IOAPIC_NUM_PINS 48
36
37struct kvm_ioapic_state {
38 __u64 base_address;
39 __u32 ioregsel;
40 __u32 id;
41 __u32 irr;
42 __u32 pad;
43 union {
44 __u64 bits;
45 struct {
46 __u8 vector;
47 __u8 delivery_mode:3;
48 __u8 dest_mode:1;
49 __u8 delivery_status:1;
50 __u8 polarity:1;
51 __u8 remote_irr:1;
52 __u8 trig_mode:1;
53 __u8 mask:1;
54 __u8 reserve:7;
55 __u8 reserved[4];
56 __u8 dest_id;
57 } fields;
58 } redirtbl[KVM_IOAPIC_NUM_PINS];
59};
60
61#define KVM_IRQCHIP_PIC_MASTER 0
62#define KVM_IRQCHIP_PIC_SLAVE 1
63#define KVM_IRQCHIP_IOAPIC 2
64#define KVM_NR_IRQCHIPS 3
65
66#define KVM_CONTEXT_SIZE 8*1024
67
68struct kvm_fpreg {
69 union {
70 unsigned long bits[2];
71 long double __dummy; /* force 16-byte alignment */
72 } u;
73};
74
75union context {
76 /* 8K size */
77 char dummy[KVM_CONTEXT_SIZE];
78 struct {
79 unsigned long psr;
80 unsigned long pr;
81 unsigned long caller_unat;
82 unsigned long pad;
83 unsigned long gr[32];
84 unsigned long ar[128];
85 unsigned long br[8];
86 unsigned long cr[128];
87 unsigned long rr[8];
88 unsigned long ibr[8];
89 unsigned long dbr[8];
90 unsigned long pkr[8];
91 struct kvm_fpreg fr[128];
92 };
93};
94
95struct thash_data {
96 union {
97 struct {
98 unsigned long p : 1; /* 0 */
99 unsigned long rv1 : 1; /* 1 */
100 unsigned long ma : 3; /* 2-4 */
101 unsigned long a : 1; /* 5 */
102 unsigned long d : 1; /* 6 */
103 unsigned long pl : 2; /* 7-8 */
104 unsigned long ar : 3; /* 9-11 */
105 unsigned long ppn : 38; /* 12-49 */
106 unsigned long rv2 : 2; /* 50-51 */
107 unsigned long ed : 1; /* 52 */
108 unsigned long ig1 : 11; /* 53-63 */
109 };
110 struct {
111 unsigned long __rv1 : 53; /* 0-52 */
112 unsigned long contiguous : 1; /*53 */
113 unsigned long tc : 1; /* 54 TR or TC */
114 unsigned long cl : 1;
115 /* 55 I side or D side cache line */
116 unsigned long len : 4; /* 56-59 */
117 unsigned long io : 1; /* 60 entry is for io or not */
118 unsigned long nomap : 1;
119 /* 61 entry cann't be inserted into machine TLB.*/
120 unsigned long checked : 1;
121 /* 62 for VTLB/VHPT sanity check */
122 unsigned long invalid : 1;
123 /* 63 invalid entry */
124 };
125 unsigned long page_flags;
126 }; /* same for VHPT and TLB */
127
128 union {
129 struct {
130 unsigned long rv3 : 2;
131 unsigned long ps : 6;
132 unsigned long key : 24;
133 unsigned long rv4 : 32;
134 };
135 unsigned long itir;
136 };
137 union {
138 struct {
139 unsigned long ig2 : 12;
140 unsigned long vpn : 49;
141 unsigned long vrn : 3;
142 };
143 unsigned long ifa;
144 unsigned long vadr;
145 struct {
146 unsigned long tag : 63;
147 unsigned long ti : 1;
148 };
149 unsigned long etag;
150 };
151 union {
152 struct thash_data *next;
153 unsigned long rid;
154 unsigned long gpaddr;
155 };
156};
157
158#define NITRS 8
159#define NDTRS 8
160
161struct saved_vpd {
162 unsigned long vhpi;
163 unsigned long vgr[16];
164 unsigned long vbgr[16];
165 unsigned long vnat;
166 unsigned long vbnat;
167 unsigned long vcpuid[5];
168 unsigned long vpsr;
169 unsigned long vpr;
170 union {
171 unsigned long vcr[128];
172 struct {
173 unsigned long dcr;
174 unsigned long itm;
175 unsigned long iva;
176 unsigned long rsv1[5];
177 unsigned long pta;
178 unsigned long rsv2[7];
179 unsigned long ipsr;
180 unsigned long isr;
181 unsigned long rsv3;
182 unsigned long iip;
183 unsigned long ifa;
184 unsigned long itir;
185 unsigned long iipa;
186 unsigned long ifs;
187 unsigned long iim;
188 unsigned long iha;
189 unsigned long rsv4[38];
190 unsigned long lid;
191 unsigned long ivr;
192 unsigned long tpr;
193 unsigned long eoi;
194 unsigned long irr[4];
195 unsigned long itv;
196 unsigned long pmv;
197 unsigned long cmcv;
198 unsigned long rsv5[5];
199 unsigned long lrr0;
200 unsigned long lrr1;
201 unsigned long rsv6[46];
202 };
203 };
204};
205
206struct kvm_regs {
207 struct saved_vpd vpd;
208 /*Arch-regs*/
209 int mp_state;
210 unsigned long vmm_rr;
211 /* TR and TC. */
212 struct thash_data itrs[NITRS];
213 struct thash_data dtrs[NDTRS];
214 /* Bit is set if there is a tr/tc for the region. */
215 unsigned char itr_regions;
216 unsigned char dtr_regions;
217 unsigned char tc_regions;
218
219 char irq_check;
220 unsigned long saved_itc;
221 unsigned long itc_check;
222 unsigned long timer_check;
223 unsigned long timer_pending;
224 unsigned long last_itc;
225
226 unsigned long vrr[8];
227 unsigned long ibr[8];
228 unsigned long dbr[8];
229 unsigned long insvc[4]; /* Interrupt in service. */
230 unsigned long xtp;
231
232 unsigned long metaphysical_rr0; /* from kvm_arch (so is pinned) */
233 unsigned long metaphysical_rr4; /* from kvm_arch (so is pinned) */
234 unsigned long metaphysical_saved_rr0; /* from kvm_arch */
235 unsigned long metaphysical_saved_rr4; /* from kvm_arch */
236 unsigned long fp_psr; /*used for lazy float register */
237 unsigned long saved_gp;
238 /*for phycial emulation */
239
240 union context saved_guest;
241
242 unsigned long reserved[64]; /* for future use */
243};
244
245struct kvm_sregs {
246};
247
248struct kvm_fpu {
249};
250
251#define KVM_IA64_VCPU_STACK_SHIFT 16
252#define KVM_IA64_VCPU_STACK_SIZE (1UL << KVM_IA64_VCPU_STACK_SHIFT)
253
254struct kvm_ia64_vcpu_stack {
255 unsigned char stack[KVM_IA64_VCPU_STACK_SIZE];
256};
257
258struct kvm_debug_exit_arch {
259};
260
261/* for KVM_SET_GUEST_DEBUG */
262struct kvm_guest_debug_arch {
263};
264
265/* definition of registers in kvm_run */
266struct kvm_sync_regs {
267};
268
269#endif
diff --git a/arch/ia64/include/uapi/asm/mman.h b/arch/ia64/include/uapi/asm/mman.h
deleted file mode 100644
index 8740819adc5..00000000000
--- a/arch/ia64/include/uapi/asm/mman.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * Based on <asm-i386/mman.h>.
3 *
4 * Modified 1998-2000, 2002
5 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
6 */
7#ifndef _UAPI_ASM_IA64_MMAN_H
8#define _UAPI_ASM_IA64_MMAN_H
9
10
11#include <asm-generic/mman.h>
12
13#define MAP_GROWSUP 0x0200 /* register stack-like segment */
14
15
16#endif /* _UAPI_ASM_IA64_MMAN_H */
diff --git a/arch/ia64/include/uapi/asm/msgbuf.h b/arch/ia64/include/uapi/asm/msgbuf.h
deleted file mode 100644
index 6c64c0d2aae..00000000000
--- a/arch/ia64/include/uapi/asm/msgbuf.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _ASM_IA64_MSGBUF_H
2#define _ASM_IA64_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for IA-64 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 64-bit values
11 */
12
13struct msqid64_ds {
14 struct ipc64_perm msg_perm;
15 __kernel_time_t msg_stime; /* last msgsnd time */
16 __kernel_time_t msg_rtime; /* last msgrcv time */
17 __kernel_time_t msg_ctime; /* last change time */
18 unsigned long msg_cbytes; /* current number of bytes on queue */
19 unsigned long msg_qnum; /* number of messages in queue */
20 unsigned long msg_qbytes; /* max number of bytes on queue */
21 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
22 __kernel_pid_t msg_lrpid; /* last receive pid */
23 unsigned long __unused1;
24 unsigned long __unused2;
25};
26
27#endif /* _ASM_IA64_MSGBUF_H */
diff --git a/arch/ia64/include/uapi/asm/param.h b/arch/ia64/include/uapi/asm/param.h
deleted file mode 100644
index d7da41d9497..00000000000
--- a/arch/ia64/include/uapi/asm/param.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Fundamental kernel parameters.
3 *
4 * Based on <asm-i386/param.h>.
5 *
6 * Modified 1998, 1999, 2002-2003
7 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
8 */
9#ifndef _UAPI_ASM_IA64_PARAM_H
10#define _UAPI_ASM_IA64_PARAM_H
11
12
13#define EXEC_PAGESIZE 65536
14
15#ifndef NOGROUP
16# define NOGROUP (-1)
17#endif
18
19#define MAXHOSTNAMELEN 64 /* max length of hostname */
20
21#ifndef __KERNEL__
22 /*
23 * Technically, this is wrong, but some old apps still refer to it. The proper way to
24 * get the HZ value is via sysconf(_SC_CLK_TCK).
25 */
26# define HZ 1024
27#endif
28
29#endif /* _UAPI_ASM_IA64_PARAM_H */
diff --git a/arch/ia64/include/uapi/asm/perfmon.h b/arch/ia64/include/uapi/asm/perfmon.h
deleted file mode 100644
index 1a10a2dd58a..00000000000
--- a/arch/ia64/include/uapi/asm/perfmon.h
+++ /dev/null
@@ -1,177 +0,0 @@
1/*
2 * Copyright (C) 2001-2003 Hewlett-Packard Co
3 * Stephane Eranian <eranian@hpl.hp.com>
4 */
5
6#ifndef _UAPI_ASM_IA64_PERFMON_H
7#define _UAPI_ASM_IA64_PERFMON_H
8
9/*
10 * perfmon commands supported on all CPU models
11 */
12#define PFM_WRITE_PMCS 0x01
13#define PFM_WRITE_PMDS 0x02
14#define PFM_READ_PMDS 0x03
15#define PFM_STOP 0x04
16#define PFM_START 0x05
17#define PFM_ENABLE 0x06 /* obsolete */
18#define PFM_DISABLE 0x07 /* obsolete */
19#define PFM_CREATE_CONTEXT 0x08
20#define PFM_DESTROY_CONTEXT 0x09 /* obsolete use close() */
21#define PFM_RESTART 0x0a
22#define PFM_PROTECT_CONTEXT 0x0b /* obsolete */
23#define PFM_GET_FEATURES 0x0c
24#define PFM_DEBUG 0x0d
25#define PFM_UNPROTECT_CONTEXT 0x0e /* obsolete */
26#define PFM_GET_PMC_RESET_VAL 0x0f
27#define PFM_LOAD_CONTEXT 0x10
28#define PFM_UNLOAD_CONTEXT 0x11
29
30/*
31 * PMU model specific commands (may not be supported on all PMU models)
32 */
33#define PFM_WRITE_IBRS 0x20
34#define PFM_WRITE_DBRS 0x21
35
36/*
37 * context flags
38 */
39#define PFM_FL_NOTIFY_BLOCK 0x01 /* block task on user level notifications */
40#define PFM_FL_SYSTEM_WIDE 0x02 /* create a system wide context */
41#define PFM_FL_OVFL_NO_MSG 0x80 /* do not post overflow/end messages for notification */
42
43/*
44 * event set flags
45 */
46#define PFM_SETFL_EXCL_IDLE 0x01 /* exclude idle task (syswide only) XXX: DO NOT USE YET */
47
48/*
49 * PMC flags
50 */
51#define PFM_REGFL_OVFL_NOTIFY 0x1 /* send notification on overflow */
52#define PFM_REGFL_RANDOM 0x2 /* randomize sampling interval */
53
54/*
55 * PMD/PMC/IBR/DBR return flags (ignored on input)
56 *
57 * Those flags are used on output and must be checked in case EAGAIN is returned
58 * by any of the calls using a pfarg_reg_t or pfarg_dbreg_t structure.
59 */
60#define PFM_REG_RETFL_NOTAVAIL (1UL<<31) /* set if register is implemented but not available */
61#define PFM_REG_RETFL_EINVAL (1UL<<30) /* set if register entry is invalid */
62#define PFM_REG_RETFL_MASK (PFM_REG_RETFL_NOTAVAIL|PFM_REG_RETFL_EINVAL)
63
64#define PFM_REG_HAS_ERROR(flag) (((flag) & PFM_REG_RETFL_MASK) != 0)
65
66typedef unsigned char pfm_uuid_t[16]; /* custom sampling buffer identifier type */
67
68/*
69 * Request structure used to define a context
70 */
71typedef struct {
72 pfm_uuid_t ctx_smpl_buf_id; /* which buffer format to use (if needed) */
73 unsigned long ctx_flags; /* noblock/block */
74 unsigned short ctx_nextra_sets; /* number of extra event sets (you always get 1) */
75 unsigned short ctx_reserved1; /* for future use */
76 int ctx_fd; /* return arg: unique identification for context */
77 void *ctx_smpl_vaddr; /* return arg: virtual address of sampling buffer, is used */
78 unsigned long ctx_reserved2[11];/* for future use */
79} pfarg_context_t;
80
81/*
82 * Request structure used to write/read a PMC or PMD
83 */
84typedef struct {
85 unsigned int reg_num; /* which register */
86 unsigned short reg_set; /* event set for this register */
87 unsigned short reg_reserved1; /* for future use */
88
89 unsigned long reg_value; /* initial pmc/pmd value */
90 unsigned long reg_flags; /* input: pmc/pmd flags, return: reg error */
91
92 unsigned long reg_long_reset; /* reset after buffer overflow notification */
93 unsigned long reg_short_reset; /* reset after counter overflow */
94
95 unsigned long reg_reset_pmds[4]; /* which other counters to reset on overflow */
96 unsigned long reg_random_seed; /* seed value when randomization is used */
97 unsigned long reg_random_mask; /* bitmask used to limit random value */
98 unsigned long reg_last_reset_val;/* return: PMD last reset value */
99
100 unsigned long reg_smpl_pmds[4]; /* which pmds are accessed when PMC overflows */
101 unsigned long reg_smpl_eventid; /* opaque sampling event identifier */
102
103 unsigned long reg_reserved2[3]; /* for future use */
104} pfarg_reg_t;
105
106typedef struct {
107 unsigned int dbreg_num; /* which debug register */
108 unsigned short dbreg_set; /* event set for this register */
109 unsigned short dbreg_reserved1; /* for future use */
110 unsigned long dbreg_value; /* value for debug register */
111 unsigned long dbreg_flags; /* return: dbreg error */
112 unsigned long dbreg_reserved2[1]; /* for future use */
113} pfarg_dbreg_t;
114
115typedef struct {
116 unsigned int ft_version; /* perfmon: major [16-31], minor [0-15] */
117 unsigned int ft_reserved; /* reserved for future use */
118 unsigned long reserved[4]; /* for future use */
119} pfarg_features_t;
120
121typedef struct {
122 pid_t load_pid; /* process to load the context into */
123 unsigned short load_set; /* first event set to load */
124 unsigned short load_reserved1; /* for future use */
125 unsigned long load_reserved2[3]; /* for future use */
126} pfarg_load_t;
127
128typedef struct {
129 int msg_type; /* generic message header */
130 int msg_ctx_fd; /* generic message header */
131 unsigned long msg_ovfl_pmds[4]; /* which PMDs overflowed */
132 unsigned short msg_active_set; /* active set at the time of overflow */
133 unsigned short msg_reserved1; /* for future use */
134 unsigned int msg_reserved2; /* for future use */
135 unsigned long msg_tstamp; /* for perf tuning/debug */
136} pfm_ovfl_msg_t;
137
138typedef struct {
139 int msg_type; /* generic message header */
140 int msg_ctx_fd; /* generic message header */
141 unsigned long msg_tstamp; /* for perf tuning */
142} pfm_end_msg_t;
143
144typedef struct {
145 int msg_type; /* type of the message */
146 int msg_ctx_fd; /* unique identifier for the context */
147 unsigned long msg_tstamp; /* for perf tuning */
148} pfm_gen_msg_t;
149
150#define PFM_MSG_OVFL 1 /* an overflow happened */
151#define PFM_MSG_END 2 /* task to which context was attached ended */
152
153typedef union {
154 pfm_ovfl_msg_t pfm_ovfl_msg;
155 pfm_end_msg_t pfm_end_msg;
156 pfm_gen_msg_t pfm_gen_msg;
157} pfm_msg_t;
158
159/*
160 * Define the version numbers for both perfmon as a whole and the sampling buffer format.
161 */
162#define PFM_VERSION_MAJ 2U
163#define PFM_VERSION_MIN 0U
164#define PFM_VERSION (((PFM_VERSION_MAJ&0xffff)<<16)|(PFM_VERSION_MIN & 0xffff))
165#define PFM_VERSION_MAJOR(x) (((x)>>16) & 0xffff)
166#define PFM_VERSION_MINOR(x) ((x) & 0xffff)
167
168
169/*
170 * miscellaneous architected definitions
171 */
172#define PMU_FIRST_COUNTER 4 /* first counting monitor (PMC/PMD) */
173#define PMU_MAX_PMCS 256 /* maximum architected number of PMC registers */
174#define PMU_MAX_PMDS 256 /* maximum architected number of PMD registers */
175
176
177#endif /* _UAPI_ASM_IA64_PERFMON_H */
diff --git a/arch/ia64/include/uapi/asm/perfmon_default_smpl.h b/arch/ia64/include/uapi/asm/perfmon_default_smpl.h
deleted file mode 100644
index a2d560c6723..00000000000
--- a/arch/ia64/include/uapi/asm/perfmon_default_smpl.h
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * Copyright (C) 2002-2003 Hewlett-Packard Co
3 * Stephane Eranian <eranian@hpl.hp.com>
4 *
5 * This file implements the default sampling buffer format
6 * for Linux/ia64 perfmon subsystem.
7 */
8#ifndef __PERFMON_DEFAULT_SMPL_H__
9#define __PERFMON_DEFAULT_SMPL_H__ 1
10
11#define PFM_DEFAULT_SMPL_UUID { \
12 0x4d, 0x72, 0xbe, 0xc0, 0x06, 0x64, 0x41, 0x43, 0x82, 0xb4, 0xd3, 0xfd, 0x27, 0x24, 0x3c, 0x97}
13
14/*
15 * format specific parameters (passed at context creation)
16 */
17typedef struct {
18 unsigned long buf_size; /* size of the buffer in bytes */
19 unsigned int flags; /* buffer specific flags */
20 unsigned int res1; /* for future use */
21 unsigned long reserved[2]; /* for future use */
22} pfm_default_smpl_arg_t;
23
24/*
25 * combined context+format specific structure. Can be passed
26 * to PFM_CONTEXT_CREATE
27 */
28typedef struct {
29 pfarg_context_t ctx_arg;
30 pfm_default_smpl_arg_t buf_arg;
31} pfm_default_smpl_ctx_arg_t;
32
33/*
34 * This header is at the beginning of the sampling buffer returned to the user.
35 * It is directly followed by the first record.
36 */
37typedef struct {
38 unsigned long hdr_count; /* how many valid entries */
39 unsigned long hdr_cur_offs; /* current offset from top of buffer */
40 unsigned long hdr_reserved2; /* reserved for future use */
41
42 unsigned long hdr_overflows; /* how many times the buffer overflowed */
43 unsigned long hdr_buf_size; /* how many bytes in the buffer */
44
45 unsigned int hdr_version; /* contains perfmon version (smpl format diffs) */
46 unsigned int hdr_reserved1; /* for future use */
47 unsigned long hdr_reserved[10]; /* for future use */
48} pfm_default_smpl_hdr_t;
49
50/*
51 * Entry header in the sampling buffer. The header is directly followed
52 * with the values of the PMD registers of interest saved in increasing
53 * index order: PMD4, PMD5, and so on. How many PMDs are present depends
54 * on how the session was programmed.
55 *
56 * In the case where multiple counters overflow at the same time, multiple
57 * entries are written consecutively.
58 *
59 * last_reset_value member indicates the initial value of the overflowed PMD.
60 */
61typedef struct {
62 int pid; /* thread id (for NPTL, this is gettid()) */
63 unsigned char reserved1[3]; /* reserved for future use */
64 unsigned char ovfl_pmd; /* index of overflowed PMD */
65
66 unsigned long last_reset_val; /* initial value of overflowed PMD */
67 unsigned long ip; /* where did the overflow interrupt happened */
68 unsigned long tstamp; /* ar.itc when entering perfmon intr. handler */
69
70 unsigned short cpu; /* cpu on which the overflow occurred */
71 unsigned short set; /* event set active when overflow occurred */
72 int tgid; /* thread group id (for NPTL, this is getpid()) */
73} pfm_default_smpl_entry_t;
74
75#define PFM_DEFAULT_MAX_PMDS 64 /* how many pmds supported by data structures (sizeof(unsigned long) */
76#define PFM_DEFAULT_MAX_ENTRY_SIZE (sizeof(pfm_default_smpl_entry_t)+(sizeof(unsigned long)*PFM_DEFAULT_MAX_PMDS))
77#define PFM_DEFAULT_SMPL_MIN_BUF_SIZE (sizeof(pfm_default_smpl_hdr_t)+PFM_DEFAULT_MAX_ENTRY_SIZE)
78
79#define PFM_DEFAULT_SMPL_VERSION_MAJ 2U
80#define PFM_DEFAULT_SMPL_VERSION_MIN 0U
81#define PFM_DEFAULT_SMPL_VERSION (((PFM_DEFAULT_SMPL_VERSION_MAJ&0xffff)<<16)|(PFM_DEFAULT_SMPL_VERSION_MIN & 0xffff))
82
83#endif /* __PERFMON_DEFAULT_SMPL_H__ */
diff --git a/arch/ia64/include/uapi/asm/poll.h b/arch/ia64/include/uapi/asm/poll.h
deleted file mode 100644
index c98509d3149..00000000000
--- a/arch/ia64/include/uapi/asm/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/arch/ia64/include/uapi/asm/posix_types.h b/arch/ia64/include/uapi/asm/posix_types.h
deleted file mode 100644
index 99ee1d6510c..00000000000
--- a/arch/ia64/include/uapi/asm/posix_types.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef _ASM_IA64_POSIX_TYPES_H
2#define _ASM_IA64_POSIX_TYPES_H
3
4typedef unsigned long __kernel_sigset_t; /* at least 32 bits */
5
6#include <asm-generic/posix_types.h>
7
8#endif /* _ASM_IA64_POSIX_TYPES_H */
diff --git a/arch/ia64/include/uapi/asm/ptrace.h b/arch/ia64/include/uapi/asm/ptrace.h
deleted file mode 100644
index 0a02f634e12..00000000000
--- a/arch/ia64/include/uapi/asm/ptrace.h
+++ /dev/null
@@ -1,247 +0,0 @@
1/*
2 * Copyright (C) 1998-2004 Hewlett-Packard Co
3 * David Mosberger-Tang <davidm@hpl.hp.com>
4 * Stephane Eranian <eranian@hpl.hp.com>
5 * Copyright (C) 2003 Intel Co
6 * Suresh Siddha <suresh.b.siddha@intel.com>
7 * Fenghua Yu <fenghua.yu@intel.com>
8 * Arun Sharma <arun.sharma@intel.com>
9 *
10 * 12/07/98 S. Eranian added pt_regs & switch_stack
11 * 12/21/98 D. Mosberger updated to match latest code
12 * 6/17/99 D. Mosberger added second unat member to "struct switch_stack"
13 *
14 */
15#ifndef _UAPI_ASM_IA64_PTRACE_H
16#define _UAPI_ASM_IA64_PTRACE_H
17
18/*
19 * When a user process is blocked, its state looks as follows:
20 *
21 * +----------------------+ ------- IA64_STK_OFFSET
22 * | | ^
23 * | struct pt_regs | |
24 * | | |
25 * +----------------------+ |
26 * | | |
27 * | memory stack | |
28 * | (growing downwards) | |
29 * //.....................// |
30 * |
31 * //.....................// |
32 * | | |
33 * +----------------------+ |
34 * | struct switch_stack | |
35 * | | |
36 * +----------------------+ |
37 * | | |
38 * //.....................// |
39 * |
40 * //.....................// |
41 * | | |
42 * | register stack | |
43 * | (growing upwards) | |
44 * | | |
45 * +----------------------+ | --- IA64_RBS_OFFSET
46 * | struct thread_info | | ^
47 * +----------------------+ | |
48 * | | | |
49 * | struct task_struct | | |
50 * current -> | | | |
51 * +----------------------+ -------
52 *
53 * Note that ar.ec is not saved explicitly in pt_reg or switch_stack.
54 * This is because ar.ec is saved as part of ar.pfs.
55 */
56
57
58#include <asm/fpu.h>
59
60
61#ifndef __ASSEMBLY__
62
63/*
64 * This struct defines the way the registers are saved on system
65 * calls.
66 *
67 * We don't save all floating point register because the kernel
68 * is compiled to use only a very small subset, so the other are
69 * untouched.
70 *
71 * THIS STRUCTURE MUST BE A MULTIPLE 16-BYTE IN SIZE
72 * (because the memory stack pointer MUST ALWAYS be aligned this way)
73 *
74 */
75struct pt_regs {
76 /* The following registers are saved by SAVE_MIN: */
77 unsigned long b6; /* scratch */
78 unsigned long b7; /* scratch */
79
80 unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */
81 unsigned long ar_ssd; /* reserved for future use (scratch) */
82
83 unsigned long r8; /* scratch (return value register 0) */
84 unsigned long r9; /* scratch (return value register 1) */
85 unsigned long r10; /* scratch (return value register 2) */
86 unsigned long r11; /* scratch (return value register 3) */
87
88 unsigned long cr_ipsr; /* interrupted task's psr */
89 unsigned long cr_iip; /* interrupted task's instruction pointer */
90 /*
91 * interrupted task's function state; if bit 63 is cleared, it
92 * contains syscall's ar.pfs.pfm:
93 */
94 unsigned long cr_ifs;
95
96 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
97 unsigned long ar_pfs; /* prev function state */
98 unsigned long ar_rsc; /* RSE configuration */
99 /* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */
100 unsigned long ar_rnat; /* RSE NaT */
101 unsigned long ar_bspstore; /* RSE bspstore */
102
103 unsigned long pr; /* 64 predicate registers (1 bit each) */
104 unsigned long b0; /* return pointer (bp) */
105 unsigned long loadrs; /* size of dirty partition << 16 */
106
107 unsigned long r1; /* the gp pointer */
108 unsigned long r12; /* interrupted task's memory stack pointer */
109 unsigned long r13; /* thread pointer */
110
111 unsigned long ar_fpsr; /* floating point status (preserved) */
112 unsigned long r15; /* scratch */
113
114 /* The remaining registers are NOT saved for system calls. */
115
116 unsigned long r14; /* scratch */
117 unsigned long r2; /* scratch */
118 unsigned long r3; /* scratch */
119
120 /* The following registers are saved by SAVE_REST: */
121 unsigned long r16; /* scratch */
122 unsigned long r17; /* scratch */
123 unsigned long r18; /* scratch */
124 unsigned long r19; /* scratch */
125 unsigned long r20; /* scratch */
126 unsigned long r21; /* scratch */
127 unsigned long r22; /* scratch */
128 unsigned long r23; /* scratch */
129 unsigned long r24; /* scratch */
130 unsigned long r25; /* scratch */
131 unsigned long r26; /* scratch */
132 unsigned long r27; /* scratch */
133 unsigned long r28; /* scratch */
134 unsigned long r29; /* scratch */
135 unsigned long r30; /* scratch */
136 unsigned long r31; /* scratch */
137
138 unsigned long ar_ccv; /* compare/exchange value (scratch) */
139
140 /*
141 * Floating point registers that the kernel considers scratch:
142 */
143 struct ia64_fpreg f6; /* scratch */
144 struct ia64_fpreg f7; /* scratch */
145 struct ia64_fpreg f8; /* scratch */
146 struct ia64_fpreg f9; /* scratch */
147 struct ia64_fpreg f10; /* scratch */
148 struct ia64_fpreg f11; /* scratch */
149};
150
151/*
152 * This structure contains the addition registers that need to
153 * preserved across a context switch. This generally consists of
154 * "preserved" registers.
155 */
156struct switch_stack {
157 unsigned long caller_unat; /* user NaT collection register (preserved) */
158 unsigned long ar_fpsr; /* floating-point status register */
159
160 struct ia64_fpreg f2; /* preserved */
161 struct ia64_fpreg f3; /* preserved */
162 struct ia64_fpreg f4; /* preserved */
163 struct ia64_fpreg f5; /* preserved */
164
165 struct ia64_fpreg f12; /* scratch, but untouched by kernel */
166 struct ia64_fpreg f13; /* scratch, but untouched by kernel */
167 struct ia64_fpreg f14; /* scratch, but untouched by kernel */
168 struct ia64_fpreg f15; /* scratch, but untouched by kernel */
169 struct ia64_fpreg f16; /* preserved */
170 struct ia64_fpreg f17; /* preserved */
171 struct ia64_fpreg f18; /* preserved */
172 struct ia64_fpreg f19; /* preserved */
173 struct ia64_fpreg f20; /* preserved */
174 struct ia64_fpreg f21; /* preserved */
175 struct ia64_fpreg f22; /* preserved */
176 struct ia64_fpreg f23; /* preserved */
177 struct ia64_fpreg f24; /* preserved */
178 struct ia64_fpreg f25; /* preserved */
179 struct ia64_fpreg f26; /* preserved */
180 struct ia64_fpreg f27; /* preserved */
181 struct ia64_fpreg f28; /* preserved */
182 struct ia64_fpreg f29; /* preserved */
183 struct ia64_fpreg f30; /* preserved */
184 struct ia64_fpreg f31; /* preserved */
185
186 unsigned long r4; /* preserved */
187 unsigned long r5; /* preserved */
188 unsigned long r6; /* preserved */
189 unsigned long r7; /* preserved */
190
191 unsigned long b0; /* so we can force a direct return in copy_thread */
192 unsigned long b1;
193 unsigned long b2;
194 unsigned long b3;
195 unsigned long b4;
196 unsigned long b5;
197
198 unsigned long ar_pfs; /* previous function state */
199 unsigned long ar_lc; /* loop counter (preserved) */
200 unsigned long ar_unat; /* NaT bits for r4-r7 */
201 unsigned long ar_rnat; /* RSE NaT collection register */
202 unsigned long ar_bspstore; /* RSE dirty base (preserved) */
203 unsigned long pr; /* 64 predicate registers (1 bit each) */
204};
205
206
207/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */
208struct pt_all_user_regs {
209 unsigned long nat;
210 unsigned long cr_iip;
211 unsigned long cfm;
212 unsigned long cr_ipsr;
213 unsigned long pr;
214
215 unsigned long gr[32];
216 unsigned long br[8];
217 unsigned long ar[128];
218 struct ia64_fpreg fr[128];
219};
220
221#endif /* !__ASSEMBLY__ */
222
223/* indices to application-registers array in pt_all_user_regs */
224#define PT_AUR_RSC 16
225#define PT_AUR_BSP 17
226#define PT_AUR_BSPSTORE 18
227#define PT_AUR_RNAT 19
228#define PT_AUR_CCV 32
229#define PT_AUR_UNAT 36
230#define PT_AUR_FPSR 40
231#define PT_AUR_PFS 64
232#define PT_AUR_LC 65
233#define PT_AUR_EC 66
234
235/*
236 * The numbers chosen here are somewhat arbitrary but absolutely MUST
237 * not overlap with any of the number assigned in <linux/ptrace.h>.
238 */
239#define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */
240#define PTRACE_OLD_GETSIGINFO 13 /* (replaced by PTRACE_GETSIGINFO in <linux/ptrace.h>) */
241#define PTRACE_OLD_SETSIGINFO 14 /* (replaced by PTRACE_SETSIGINFO in <linux/ptrace.h>) */
242#define PTRACE_GETREGS 18 /* get all registers (pt_all_user_regs) in one shot */
243#define PTRACE_SETREGS 19 /* set all registers (pt_all_user_regs) in one shot */
244
245#define PTRACE_OLDSETOPTIONS 21
246
247#endif /* _UAPI_ASM_IA64_PTRACE_H */
diff --git a/arch/ia64/include/uapi/asm/ptrace_offsets.h b/arch/ia64/include/uapi/asm/ptrace_offsets.h
deleted file mode 100644
index b712773c759..00000000000
--- a/arch/ia64/include/uapi/asm/ptrace_offsets.h
+++ /dev/null
@@ -1,268 +0,0 @@
1#ifndef _ASM_IA64_PTRACE_OFFSETS_H
2#define _ASM_IA64_PTRACE_OFFSETS_H
3
4/*
5 * Copyright (C) 1999, 2003 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */
8/*
9 * The "uarea" that can be accessed via PEEKUSER and POKEUSER is a
10 * virtual structure that would have the following definition:
11 *
12 * struct uarea {
13 * struct ia64_fpreg fph[96]; // f32-f127
14 * unsigned long nat_bits;
15 * unsigned long empty1;
16 * struct ia64_fpreg f2; // f2-f5
17 * :
18 * struct ia64_fpreg f5;
19 * struct ia64_fpreg f10; // f10-f31
20 * :
21 * struct ia64_fpreg f31;
22 * unsigned long r4; // r4-r7
23 * :
24 * unsigned long r7;
25 * unsigned long b1; // b1-b5
26 * :
27 * unsigned long b5;
28 * unsigned long ar_ec;
29 * unsigned long ar_lc;
30 * unsigned long empty2[5];
31 * unsigned long cr_ipsr;
32 * unsigned long cr_iip;
33 * unsigned long cfm;
34 * unsigned long ar_unat;
35 * unsigned long ar_pfs;
36 * unsigned long ar_rsc;
37 * unsigned long ar_rnat;
38 * unsigned long ar_bspstore;
39 * unsigned long pr;
40 * unsigned long b6;
41 * unsigned long ar_bsp;
42 * unsigned long r1;
43 * unsigned long r2;
44 * unsigned long r3;
45 * unsigned long r12;
46 * unsigned long r13;
47 * unsigned long r14;
48 * unsigned long r15;
49 * unsigned long r8;
50 * unsigned long r9;
51 * unsigned long r10;
52 * unsigned long r11;
53 * unsigned long r16;
54 * :
55 * unsigned long r31;
56 * unsigned long ar_ccv;
57 * unsigned long ar_fpsr;
58 * unsigned long b0;
59 * unsigned long b7;
60 * unsigned long f6;
61 * unsigned long f7;
62 * unsigned long f8;
63 * unsigned long f9;
64 * unsigned long ar_csd;
65 * unsigned long ar_ssd;
66 * unsigned long rsvd1[710];
67 * unsigned long dbr[8];
68 * unsigned long rsvd2[504];
69 * unsigned long ibr[8];
70 * unsigned long rsvd3[504];
71 * unsigned long pmd[4];
72 * }
73 */
74
75/* fph: */
76#define PT_F32 0x0000
77#define PT_F33 0x0010
78#define PT_F34 0x0020
79#define PT_F35 0x0030
80#define PT_F36 0x0040
81#define PT_F37 0x0050
82#define PT_F38 0x0060
83#define PT_F39 0x0070
84#define PT_F40 0x0080
85#define PT_F41 0x0090
86#define PT_F42 0x00a0
87#define PT_F43 0x00b0
88#define PT_F44 0x00c0
89#define PT_F45 0x00d0
90#define PT_F46 0x00e0
91#define PT_F47 0x00f0
92#define PT_F48 0x0100
93#define PT_F49 0x0110
94#define PT_F50 0x0120
95#define PT_F51 0x0130
96#define PT_F52 0x0140
97#define PT_F53 0x0150
98#define PT_F54 0x0160
99#define PT_F55 0x0170
100#define PT_F56 0x0180
101#define PT_F57 0x0190
102#define PT_F58 0x01a0
103#define PT_F59 0x01b0
104#define PT_F60 0x01c0
105#define PT_F61 0x01d0
106#define PT_F62 0x01e0
107#define PT_F63 0x01f0
108#define PT_F64 0x0200
109#define PT_F65 0x0210
110#define PT_F66 0x0220
111#define PT_F67 0x0230
112#define PT_F68 0x0240
113#define PT_F69 0x0250
114#define PT_F70 0x0260
115#define PT_F71 0x0270
116#define PT_F72 0x0280
117#define PT_F73 0x0290
118#define PT_F74 0x02a0
119#define PT_F75 0x02b0
120#define PT_F76 0x02c0
121#define PT_F77 0x02d0
122#define PT_F78 0x02e0
123#define PT_F79 0x02f0
124#define PT_F80 0x0300
125#define PT_F81 0x0310
126#define PT_F82 0x0320
127#define PT_F83 0x0330
128#define PT_F84 0x0340
129#define PT_F85 0x0350
130#define PT_F86 0x0360
131#define PT_F87 0x0370
132#define PT_F88 0x0380
133#define PT_F89 0x0390
134#define PT_F90 0x03a0
135#define PT_F91 0x03b0
136#define PT_F92 0x03c0
137#define PT_F93 0x03d0
138#define PT_F94 0x03e0
139#define PT_F95 0x03f0
140#define PT_F96 0x0400
141#define PT_F97 0x0410
142#define PT_F98 0x0420
143#define PT_F99 0x0430
144#define PT_F100 0x0440
145#define PT_F101 0x0450
146#define PT_F102 0x0460
147#define PT_F103 0x0470
148#define PT_F104 0x0480
149#define PT_F105 0x0490
150#define PT_F106 0x04a0
151#define PT_F107 0x04b0
152#define PT_F108 0x04c0
153#define PT_F109 0x04d0
154#define PT_F110 0x04e0
155#define PT_F111 0x04f0
156#define PT_F112 0x0500
157#define PT_F113 0x0510
158#define PT_F114 0x0520
159#define PT_F115 0x0530
160#define PT_F116 0x0540
161#define PT_F117 0x0550
162#define PT_F118 0x0560
163#define PT_F119 0x0570
164#define PT_F120 0x0580
165#define PT_F121 0x0590
166#define PT_F122 0x05a0
167#define PT_F123 0x05b0
168#define PT_F124 0x05c0
169#define PT_F125 0x05d0
170#define PT_F126 0x05e0
171#define PT_F127 0x05f0
172
173#define PT_NAT_BITS 0x0600
174
175#define PT_F2 0x0610
176#define PT_F3 0x0620
177#define PT_F4 0x0630
178#define PT_F5 0x0640
179#define PT_F10 0x0650
180#define PT_F11 0x0660
181#define PT_F12 0x0670
182#define PT_F13 0x0680
183#define PT_F14 0x0690
184#define PT_F15 0x06a0
185#define PT_F16 0x06b0
186#define PT_F17 0x06c0
187#define PT_F18 0x06d0
188#define PT_F19 0x06e0
189#define PT_F20 0x06f0
190#define PT_F21 0x0700
191#define PT_F22 0x0710
192#define PT_F23 0x0720
193#define PT_F24 0x0730
194#define PT_F25 0x0740
195#define PT_F26 0x0750
196#define PT_F27 0x0760
197#define PT_F28 0x0770
198#define PT_F29 0x0780
199#define PT_F30 0x0790
200#define PT_F31 0x07a0
201#define PT_R4 0x07b0
202#define PT_R5 0x07b8
203#define PT_R6 0x07c0
204#define PT_R7 0x07c8
205
206#define PT_B1 0x07d8
207#define PT_B2 0x07e0
208#define PT_B3 0x07e8
209#define PT_B4 0x07f0
210#define PT_B5 0x07f8
211
212#define PT_AR_EC 0x0800
213#define PT_AR_LC 0x0808
214
215#define PT_CR_IPSR 0x0830
216#define PT_CR_IIP 0x0838
217#define PT_CFM 0x0840
218#define PT_AR_UNAT 0x0848
219#define PT_AR_PFS 0x0850
220#define PT_AR_RSC 0x0858
221#define PT_AR_RNAT 0x0860
222#define PT_AR_BSPSTORE 0x0868
223#define PT_PR 0x0870
224#define PT_B6 0x0878
225#define PT_AR_BSP 0x0880 /* note: this points to the *end* of the backing store! */
226#define PT_R1 0x0888
227#define PT_R2 0x0890
228#define PT_R3 0x0898
229#define PT_R12 0x08a0
230#define PT_R13 0x08a8
231#define PT_R14 0x08b0
232#define PT_R15 0x08b8
233#define PT_R8 0x08c0
234#define PT_R9 0x08c8
235#define PT_R10 0x08d0
236#define PT_R11 0x08d8
237#define PT_R16 0x08e0
238#define PT_R17 0x08e8
239#define PT_R18 0x08f0
240#define PT_R19 0x08f8
241#define PT_R20 0x0900
242#define PT_R21 0x0908
243#define PT_R22 0x0910
244#define PT_R23 0x0918
245#define PT_R24 0x0920
246#define PT_R25 0x0928
247#define PT_R26 0x0930
248#define PT_R27 0x0938
249#define PT_R28 0x0940
250#define PT_R29 0x0948
251#define PT_R30 0x0950
252#define PT_R31 0x0958
253#define PT_AR_CCV 0x0960
254#define PT_AR_FPSR 0x0968
255#define PT_B0 0x0970
256#define PT_B7 0x0978
257#define PT_F6 0x0980
258#define PT_F7 0x0990
259#define PT_F8 0x09a0
260#define PT_F9 0x09b0
261#define PT_AR_CSD 0x09c0
262#define PT_AR_SSD 0x09c8
263
264#define PT_DBR 0x2000 /* data breakpoint registers */
265#define PT_IBR 0x3000 /* instruction breakpoint registers */
266#define PT_PMD 0x4000 /* performance monitoring counters */
267
268#endif /* _ASM_IA64_PTRACE_OFFSETS_H */
diff --git a/arch/ia64/include/uapi/asm/resource.h b/arch/ia64/include/uapi/asm/resource.h
deleted file mode 100644
index ba2272a87fc..00000000000
--- a/arch/ia64/include/uapi/asm/resource.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_IA64_RESOURCE_H
2#define _ASM_IA64_RESOURCE_H
3
4#include <asm/ustack.h>
5#include <asm-generic/resource.h>
6
7#endif /* _ASM_IA64_RESOURCE_H */
diff --git a/arch/ia64/include/uapi/asm/rse.h b/arch/ia64/include/uapi/asm/rse.h
deleted file mode 100644
index 02830a3b019..00000000000
--- a/arch/ia64/include/uapi/asm/rse.h
+++ /dev/null
@@ -1,66 +0,0 @@
1#ifndef _ASM_IA64_RSE_H
2#define _ASM_IA64_RSE_H
3
4/*
5 * Copyright (C) 1998, 1999 Hewlett-Packard Co
6 * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com>
7 *
8 * Register stack engine related helper functions. This file may be
9 * used in applications, so be careful about the name-space and give
10 * some consideration to non-GNU C compilers (though __inline__ is
11 * fine).
12 */
13
14static __inline__ unsigned long
15ia64_rse_slot_num (unsigned long *addr)
16{
17 return (((unsigned long) addr) >> 3) & 0x3f;
18}
19
20/*
21 * Return TRUE if ADDR is the address of an RNAT slot.
22 */
23static __inline__ unsigned long
24ia64_rse_is_rnat_slot (unsigned long *addr)
25{
26 return ia64_rse_slot_num(addr) == 0x3f;
27}
28
29/*
30 * Returns the address of the RNAT slot that covers the slot at
31 * address SLOT_ADDR.
32 */
33static __inline__ unsigned long *
34ia64_rse_rnat_addr (unsigned long *slot_addr)
35{
36 return (unsigned long *) ((unsigned long) slot_addr | (0x3f << 3));
37}
38
39/*
40 * Calculate the number of registers in the dirty partition starting at BSPSTORE and
41 * ending at BSP. This isn't simply (BSP-BSPSTORE)/8 because every 64th slot stores
42 * ar.rnat.
43 */
44static __inline__ unsigned long
45ia64_rse_num_regs (unsigned long *bspstore, unsigned long *bsp)
46{
47 unsigned long slots = (bsp - bspstore);
48
49 return slots - (ia64_rse_slot_num(bspstore) + slots)/0x40;
50}
51
52/*
53 * The inverse of the above: given bspstore and the number of
54 * registers, calculate ar.bsp.
55 */
56static __inline__ unsigned long *
57ia64_rse_skip_regs (unsigned long *addr, long num_regs)
58{
59 long delta = ia64_rse_slot_num(addr) + num_regs;
60
61 if (num_regs < 0)
62 delta -= 0x3e;
63 return addr + num_regs + delta/0x3f;
64}
65
66#endif /* _ASM_IA64_RSE_H */
diff --git a/arch/ia64/include/uapi/asm/sembuf.h b/arch/ia64/include/uapi/asm/sembuf.h
deleted file mode 100644
index 1340fbc04d3..00000000000
--- a/arch/ia64/include/uapi/asm/sembuf.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _ASM_IA64_SEMBUF_H
2#define _ASM_IA64_SEMBUF_H
3
4/*
5 * The semid64_ds structure for IA-64 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 64-bit values
11 */
12
13struct semid64_ds {
14 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
15 __kernel_time_t sem_otime; /* last semop time */
16 __kernel_time_t sem_ctime; /* last change time */
17 unsigned long sem_nsems; /* no. of semaphores in array */
18 unsigned long __unused1;
19 unsigned long __unused2;
20};
21
22#endif /* _ASM_IA64_SEMBUF_H */
diff --git a/arch/ia64/include/uapi/asm/setup.h b/arch/ia64/include/uapi/asm/setup.h
deleted file mode 100644
index 8d56458310b..00000000000
--- a/arch/ia64/include/uapi/asm/setup.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef __IA64_SETUP_H
2#define __IA64_SETUP_H
3
4#define COMMAND_LINE_SIZE 2048
5
6extern struct ia64_boot_param {
7 __u64 command_line; /* physical address of command line arguments */
8 __u64 efi_systab; /* physical address of EFI system table */
9 __u64 efi_memmap; /* physical address of EFI memory map */
10 __u64 efi_memmap_size; /* size of EFI memory map */
11 __u64 efi_memdesc_size; /* size of an EFI memory map descriptor */
12 __u32 efi_memdesc_version; /* memory descriptor version */
13 struct {
14 __u16 num_cols; /* number of columns on console output device */
15 __u16 num_rows; /* number of rows on console output device */
16 __u16 orig_x; /* cursor's x position */
17 __u16 orig_y; /* cursor's y position */
18 } console_info;
19 __u64 fpswa; /* physical address of the fpswa interface */
20 __u64 initrd_start;
21 __u64 initrd_size;
22} *ia64_boot_param;
23
24#endif
diff --git a/arch/ia64/include/uapi/asm/shmbuf.h b/arch/ia64/include/uapi/asm/shmbuf.h
deleted file mode 100644
index 585002a77ac..00000000000
--- a/arch/ia64/include/uapi/asm/shmbuf.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _ASM_IA64_SHMBUF_H
2#define _ASM_IA64_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for IA-64 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 2 miscellaneous 64-bit values
11 */
12
13struct shmid64_ds {
14 struct ipc64_perm shm_perm; /* operation perms */
15 size_t shm_segsz; /* size of segment (bytes) */
16 __kernel_time_t shm_atime; /* last attach time */
17 __kernel_time_t shm_dtime; /* last detach time */
18 __kernel_time_t shm_ctime; /* last change time */
19 __kernel_pid_t shm_cpid; /* pid of creator */
20 __kernel_pid_t shm_lpid; /* pid of last operator */
21 unsigned long shm_nattch; /* no. of current attaches */
22 unsigned long __unused1;
23 unsigned long __unused2;
24};
25
26struct shminfo64 {
27 unsigned long shmmax;
28 unsigned long shmmin;
29 unsigned long shmmni;
30 unsigned long shmseg;
31 unsigned long shmall;
32 unsigned long __unused1;
33 unsigned long __unused2;
34 unsigned long __unused3;
35 unsigned long __unused4;
36};
37
38#endif /* _ASM_IA64_SHMBUF_H */
diff --git a/arch/ia64/include/uapi/asm/sigcontext.h b/arch/ia64/include/uapi/asm/sigcontext.h
deleted file mode 100644
index 57ff777bcc4..00000000000
--- a/arch/ia64/include/uapi/asm/sigcontext.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef _ASM_IA64_SIGCONTEXT_H
2#define _ASM_IA64_SIGCONTEXT_H
3
4/*
5 * Copyright (C) 1998, 1999, 2001 Hewlett-Packard Co
6 * Copyright (C) 1998, 1999, 2001 David Mosberger-Tang <davidm@hpl.hp.com>
7 */
8
9#include <asm/fpu.h>
10
11#define IA64_SC_FLAG_ONSTACK_BIT 0 /* is handler running on signal stack? */
12#define IA64_SC_FLAG_IN_SYSCALL_BIT 1 /* did signal interrupt a syscall? */
13#define IA64_SC_FLAG_FPH_VALID_BIT 2 /* is state in f[32]-f[127] valid? */
14
15#define IA64_SC_FLAG_ONSTACK (1 << IA64_SC_FLAG_ONSTACK_BIT)
16#define IA64_SC_FLAG_IN_SYSCALL (1 << IA64_SC_FLAG_IN_SYSCALL_BIT)
17#define IA64_SC_FLAG_FPH_VALID (1 << IA64_SC_FLAG_FPH_VALID_BIT)
18
19# ifndef __ASSEMBLY__
20
21/*
22 * Note on handling of register backing store: sc_ar_bsp contains the address that would
23 * be found in ar.bsp after executing a "cover" instruction the context in which the
24 * signal was raised. If signal delivery required switching to an alternate signal stack
25 * (sc_rbs_base is not NULL), the "dirty" partition (as it would exist after executing the
26 * imaginary "cover" instruction) is backed by the *alternate* signal stack, not the
27 * original one. In this case, sc_rbs_base contains the base address of the new register
28 * backing store. The number of registers in the dirty partition can be calculated as:
29 *
30 * ndirty = ia64_rse_num_regs(sc_rbs_base, sc_rbs_base + (sc_loadrs >> 16))
31 *
32 */
33
34struct sigcontext {
35 unsigned long sc_flags; /* see manifest constants above */
36 unsigned long sc_nat; /* bit i == 1 iff scratch reg gr[i] is a NaT */
37 stack_t sc_stack; /* previously active stack */
38
39 unsigned long sc_ip; /* instruction pointer */
40 unsigned long sc_cfm; /* current frame marker */
41 unsigned long sc_um; /* user mask bits */
42 unsigned long sc_ar_rsc; /* register stack configuration register */
43 unsigned long sc_ar_bsp; /* backing store pointer */
44 unsigned long sc_ar_rnat; /* RSE NaT collection register */
45 unsigned long sc_ar_ccv; /* compare and exchange compare value register */
46 unsigned long sc_ar_unat; /* ar.unat of interrupted context */
47 unsigned long sc_ar_fpsr; /* floating-point status register */
48 unsigned long sc_ar_pfs; /* previous function state */
49 unsigned long sc_ar_lc; /* loop count register */
50 unsigned long sc_pr; /* predicate registers */
51 unsigned long sc_br[8]; /* branch registers */
52 /* Note: sc_gr[0] is used as the "uc_link" member of ucontext_t */
53 unsigned long sc_gr[32]; /* general registers (static partition) */
54 struct ia64_fpreg sc_fr[128]; /* floating-point registers */
55
56 unsigned long sc_rbs_base; /* NULL or new base of sighandler's rbs */
57 unsigned long sc_loadrs; /* see description above */
58
59 unsigned long sc_ar25; /* cmp8xchg16 uses this */
60 unsigned long sc_ar26; /* rsvd for scratch use */
61 unsigned long sc_rsvd[12]; /* reserved for future use */
62 /*
63 * The mask must come last so we can increase _NSIG_WORDS
64 * without breaking binary compatibility.
65 */
66 sigset_t sc_mask; /* signal mask to restore after handler returns */
67};
68
69# endif /* __ASSEMBLY__ */
70#endif /* _ASM_IA64_SIGCONTEXT_H */
diff --git a/arch/ia64/include/uapi/asm/siginfo.h b/arch/ia64/include/uapi/asm/siginfo.h
deleted file mode 100644
index 4ea6225196b..00000000000
--- a/arch/ia64/include/uapi/asm/siginfo.h
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Based on <asm-i386/siginfo.h>.
3 *
4 * Modified 1998-2002
5 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
6 */
7#ifndef _UAPI_ASM_IA64_SIGINFO_H
8#define _UAPI_ASM_IA64_SIGINFO_H
9
10
11#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
12
13#define HAVE_ARCH_SIGINFO_T
14#define HAVE_ARCH_COPY_SIGINFO
15#define HAVE_ARCH_COPY_SIGINFO_TO_USER
16
17#include <asm-generic/siginfo.h>
18
19typedef struct siginfo {
20 int si_signo;
21 int si_errno;
22 int si_code;
23 int __pad0;
24
25 union {
26 int _pad[SI_PAD_SIZE];
27
28 /* kill() */
29 struct {
30 pid_t _pid; /* sender's pid */
31 uid_t _uid; /* sender's uid */
32 } _kill;
33
34 /* POSIX.1b timers */
35 struct {
36 timer_t _tid; /* timer id */
37 int _overrun; /* overrun count */
38 char _pad[sizeof(__ARCH_SI_UID_T) - sizeof(int)];
39 sigval_t _sigval; /* must overlay ._rt._sigval! */
40 int _sys_private; /* not to be passed to user */
41 } _timer;
42
43 /* POSIX.1b signals */
44 struct {
45 pid_t _pid; /* sender's pid */
46 uid_t _uid; /* sender's uid */
47 sigval_t _sigval;
48 } _rt;
49
50 /* SIGCHLD */
51 struct {
52 pid_t _pid; /* which child */
53 uid_t _uid; /* sender's uid */
54 int _status; /* exit code */
55 clock_t _utime;
56 clock_t _stime;
57 } _sigchld;
58
59 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
60 struct {
61 void __user *_addr; /* faulting insn/memory ref. */
62 int _imm; /* immediate value for "break" */
63 unsigned int _flags; /* see below */
64 unsigned long _isr; /* isr */
65 short _addr_lsb; /* lsb of faulting address */
66 } _sigfault;
67
68 /* SIGPOLL */
69 struct {
70 long _band; /* POLL_IN, POLL_OUT, POLL_MSG (XPG requires a "long") */
71 int _fd;
72 } _sigpoll;
73 } _sifields;
74} siginfo_t;
75
76#define si_imm _sifields._sigfault._imm /* as per UNIX SysV ABI spec */
77#define si_flags _sifields._sigfault._flags
78/*
79 * si_isr is valid for SIGILL, SIGFPE, SIGSEGV, SIGBUS, and SIGTRAP provided that
80 * si_code is non-zero and __ISR_VALID is set in si_flags.
81 */
82#define si_isr _sifields._sigfault._isr
83
84/*
85 * Flag values for si_flags:
86 */
87#define __ISR_VALID_BIT 0
88#define __ISR_VALID (1 << __ISR_VALID_BIT)
89
90/*
91 * SIGILL si_codes
92 */
93#define ILL_BADIADDR (__SI_FAULT|9) /* unimplemented instruction address */
94#define __ILL_BREAK (__SI_FAULT|10) /* illegal break */
95#define __ILL_BNDMOD (__SI_FAULT|11) /* bundle-update (modification) in progress */
96#undef NSIGILL
97#define NSIGILL 11
98
99/*
100 * SIGFPE si_codes
101 */
102#define __FPE_DECOVF (__SI_FAULT|9) /* decimal overflow */
103#define __FPE_DECDIV (__SI_FAULT|10) /* decimal division by zero */
104#define __FPE_DECERR (__SI_FAULT|11) /* packed decimal error */
105#define __FPE_INVASC (__SI_FAULT|12) /* invalid ASCII digit */
106#define __FPE_INVDEC (__SI_FAULT|13) /* invalid decimal digit */
107#undef NSIGFPE
108#define NSIGFPE 13
109
110/*
111 * SIGSEGV si_codes
112 */
113#define __SEGV_PSTKOVF (__SI_FAULT|3) /* paragraph stack overflow */
114#undef NSIGSEGV
115#define NSIGSEGV 3
116
117#undef NSIGTRAP
118#define NSIGTRAP 4
119
120
121#endif /* _UAPI_ASM_IA64_SIGINFO_H */
diff --git a/arch/ia64/include/uapi/asm/signal.h b/arch/ia64/include/uapi/asm/signal.h
deleted file mode 100644
index c0ea2855e96..00000000000
--- a/arch/ia64/include/uapi/asm/signal.h
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Modified 1998-2001, 2003
3 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
4 *
5 * Unfortunately, this file is being included by bits/signal.h in
6 * glibc-2.x. Hence the #ifdef __KERNEL__ ugliness.
7 */
8#ifndef _UAPI_ASM_IA64_SIGNAL_H
9#define _UAPI_ASM_IA64_SIGNAL_H
10
11
12#define SIGHUP 1
13#define SIGINT 2
14#define SIGQUIT 3
15#define SIGILL 4
16#define SIGTRAP 5
17#define SIGABRT 6
18#define SIGIOT 6
19#define SIGBUS 7
20#define SIGFPE 8
21#define SIGKILL 9
22#define SIGUSR1 10
23#define SIGSEGV 11
24#define SIGUSR2 12
25#define SIGPIPE 13
26#define SIGALRM 14
27#define SIGTERM 15
28#define SIGSTKFLT 16
29#define SIGCHLD 17
30#define SIGCONT 18
31#define SIGSTOP 19
32#define SIGTSTP 20
33#define SIGTTIN 21
34#define SIGTTOU 22
35#define SIGURG 23
36#define SIGXCPU 24
37#define SIGXFSZ 25
38#define SIGVTALRM 26
39#define SIGPROF 27
40#define SIGWINCH 28
41#define SIGIO 29
42#define SIGPOLL SIGIO
43/*
44#define SIGLOST 29
45*/
46#define SIGPWR 30
47#define SIGSYS 31
48/* signal 31 is no longer "unused", but the SIGUNUSED macro remains for backwards compatibility */
49#define SIGUNUSED 31
50
51/* These should not be considered constants from userland. */
52#define SIGRTMIN 32
53#define SIGRTMAX _NSIG
54
55/*
56 * SA_FLAGS values:
57 *
58 * SA_ONSTACK indicates that a registered stack_t will be used.
59 * SA_RESTART flag to get restarting signals (which were the default long ago)
60 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
61 * SA_RESETHAND clears the handler when the signal is delivered.
62 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
63 * SA_NODEFER prevents the current signal from being masked in the handler.
64 *
65 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
66 * Unix names RESETHAND and NODEFER respectively.
67 */
68#define SA_NOCLDSTOP 0x00000001
69#define SA_NOCLDWAIT 0x00000002
70#define SA_SIGINFO 0x00000004
71#define SA_ONSTACK 0x08000000
72#define SA_RESTART 0x10000000
73#define SA_NODEFER 0x40000000
74#define SA_RESETHAND 0x80000000
75
76#define SA_NOMASK SA_NODEFER
77#define SA_ONESHOT SA_RESETHAND
78
79#define SA_RESTORER 0x04000000
80
81/*
82 * The minimum stack size needs to be fairly large because we want to
83 * be sure that an app compiled for today's CPUs will continue to run
84 * on all future CPU models. The CPU model matters because the signal
85 * frame needs to have space for the complete machine state, including
86 * all physical stacked registers. The number of physical stacked
87 * registers is CPU model dependent, but given that the width of
88 * ar.rsc.loadrs is 14 bits, we can assume that they'll never take up
89 * more than 16KB of space.
90 */
91#if 1
92 /*
93 * This is a stupid typo: the value was _meant_ to be 131072 (0x20000), but I typed it
94 * in wrong. ;-( To preserve backwards compatibility, we leave the kernel at the
95 * incorrect value and fix libc only.
96 */
97# define MINSIGSTKSZ 131027 /* min. stack size for sigaltstack() */
98#else
99# define MINSIGSTKSZ 131072 /* min. stack size for sigaltstack() */
100#endif
101#define SIGSTKSZ 262144 /* default stack size for sigaltstack() */
102
103
104#include <asm-generic/signal-defs.h>
105
106# ifndef __ASSEMBLY__
107
108# include <linux/types.h>
109
110/* Avoid too many header ordering problems. */
111struct siginfo;
112
113typedef struct sigaltstack {
114 void __user *ss_sp;
115 int ss_flags;
116 size_t ss_size;
117} stack_t;
118
119
120# endif /* !__ASSEMBLY__ */
121#endif /* _UAPI_ASM_IA64_SIGNAL_H */
diff --git a/arch/ia64/include/uapi/asm/socket.h b/arch/ia64/include/uapi/asm/socket.h
deleted file mode 100644
index 23d6759bb57..00000000000
--- a/arch/ia64/include/uapi/asm/socket.h
+++ /dev/null
@@ -1,82 +0,0 @@
1#ifndef _ASM_IA64_SOCKET_H
2#define _ASM_IA64_SOCKET_H
3
4/*
5 * Socket related defines.
6 *
7 * Based on <asm-i386/socket.h>.
8 *
9 * Modified 1998-2000
10 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
11 */
12
13#include <asm/sockios.h>
14
15/* For setsockopt(2) */
16#define SOL_SOCKET 1
17
18#define SO_DEBUG 1
19#define SO_REUSEADDR 2
20#define SO_TYPE 3
21#define SO_ERROR 4
22#define SO_DONTROUTE 5
23#define SO_BROADCAST 6
24#define SO_SNDBUF 7
25#define SO_RCVBUF 8
26#define SO_SNDBUFFORCE 32
27#define SO_RCVBUFFORCE 33
28#define SO_KEEPALIVE 9
29#define SO_OOBINLINE 10
30#define SO_NO_CHECK 11
31#define SO_PRIORITY 12
32#define SO_LINGER 13
33#define SO_BSDCOMPAT 14
34/* To add :#define SO_REUSEPORT 15 */
35#define SO_PASSCRED 16
36#define SO_PEERCRED 17
37#define SO_RCVLOWAT 18
38#define SO_SNDLOWAT 19
39#define SO_RCVTIMEO 20
40#define SO_SNDTIMEO 21
41
42/* Security levels - as per NRL IPv6 - don't actually do anything */
43#define SO_SECURITY_AUTHENTICATION 22
44#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
45#define SO_SECURITY_ENCRYPTION_NETWORK 24
46
47#define SO_BINDTODEVICE 25
48
49/* Socket filtering */
50#define SO_ATTACH_FILTER 26
51#define SO_DETACH_FILTER 27
52#define SO_GET_FILTER SO_ATTACH_FILTER
53
54#define SO_PEERNAME 28
55#define SO_TIMESTAMP 29
56#define SCM_TIMESTAMP SO_TIMESTAMP
57
58#define SO_ACCEPTCONN 30
59
60#define SO_PEERSEC 31
61#define SO_PASSSEC 34
62#define SO_TIMESTAMPNS 35
63#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
64
65#define SO_MARK 36
66
67#define SO_TIMESTAMPING 37
68#define SCM_TIMESTAMPING SO_TIMESTAMPING
69
70#define SO_PROTOCOL 38
71#define SO_DOMAIN 39
72
73#define SO_RXQ_OVFL 40
74
75#define SO_WIFI_STATUS 41
76#define SCM_WIFI_STATUS SO_WIFI_STATUS
77#define SO_PEEK_OFF 42
78
79/* Instruct lower device to use last 4-bytes of skb data as FCS */
80#define SO_NOFCS 43
81
82#endif /* _ASM_IA64_SOCKET_H */
diff --git a/arch/ia64/include/uapi/asm/sockios.h b/arch/ia64/include/uapi/asm/sockios.h
deleted file mode 100644
index 15c92468ad3..00000000000
--- a/arch/ia64/include/uapi/asm/sockios.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_IA64_SOCKIOS_H
2#define _ASM_IA64_SOCKIOS_H
3
4/*
5 * Socket-level I/O control calls.
6 *
7 * Based on <asm-i386/sockios.h>.
8 *
9 * Modified 1998, 1999
10 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
11 */
12#define FIOSETOWN 0x8901
13#define SIOCSPGRP 0x8902
14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
18#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
19
20#endif /* _ASM_IA64_SOCKIOS_H */
diff --git a/arch/ia64/include/uapi/asm/stat.h b/arch/ia64/include/uapi/asm/stat.h
deleted file mode 100644
index 367bb90cdff..00000000000
--- a/arch/ia64/include/uapi/asm/stat.h
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifndef _ASM_IA64_STAT_H
2#define _ASM_IA64_STAT_H
3
4/*
5 * Modified 1998, 1999
6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
7 */
8
9struct stat {
10 unsigned long st_dev;
11 unsigned long st_ino;
12 unsigned long st_nlink;
13 unsigned int st_mode;
14 unsigned int st_uid;
15 unsigned int st_gid;
16 unsigned int __pad0;
17 unsigned long st_rdev;
18 unsigned long st_size;
19 unsigned long st_atime;
20 unsigned long st_atime_nsec;
21 unsigned long st_mtime;
22 unsigned long st_mtime_nsec;
23 unsigned long st_ctime;
24 unsigned long st_ctime_nsec;
25 unsigned long st_blksize;
26 long st_blocks;
27 unsigned long __unused[3];
28};
29
30#define STAT_HAVE_NSEC 1
31
32struct ia64_oldstat {
33 unsigned int st_dev;
34 unsigned int st_ino;
35 unsigned int st_mode;
36 unsigned int st_nlink;
37 unsigned int st_uid;
38 unsigned int st_gid;
39 unsigned int st_rdev;
40 unsigned int __pad1;
41 unsigned long st_size;
42 unsigned long st_atime;
43 unsigned long st_mtime;
44 unsigned long st_ctime;
45 unsigned int st_blksize;
46 int st_blocks;
47 unsigned int __unused1;
48 unsigned int __unused2;
49};
50
51#endif /* _ASM_IA64_STAT_H */
diff --git a/arch/ia64/include/uapi/asm/statfs.h b/arch/ia64/include/uapi/asm/statfs.h
deleted file mode 100644
index 1e589669de5..00000000000
--- a/arch/ia64/include/uapi/asm/statfs.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef _ASM_IA64_STATFS_H
2#define _ASM_IA64_STATFS_H
3
4/*
5 * Based on <asm-i386/statfs.h>.
6 *
7 * Modified 1998, 1999, 2003
8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
9 */
10
11/*
12 * We need compat_statfs64 to be packed, because the i386 ABI won't
13 * add padding at the end to bring it to a multiple of 8 bytes, but
14 * the IA64 ABI will.
15 */
16#define ARCH_PACK_COMPAT_STATFS64 __attribute__((packed,aligned(4)))
17
18#include <asm-generic/statfs.h>
19
20#endif /* _ASM_IA64_STATFS_H */
diff --git a/arch/ia64/include/uapi/asm/swab.h b/arch/ia64/include/uapi/asm/swab.h
deleted file mode 100644
index c89a8cb5d8a..00000000000
--- a/arch/ia64/include/uapi/asm/swab.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef _ASM_IA64_SWAB_H
2#define _ASM_IA64_SWAB_H
3
4/*
5 * Modified 1998, 1999
6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co.
7 */
8
9#include <linux/types.h>
10#include <asm/intrinsics.h>
11#include <linux/compiler.h>
12
13static __inline__ __attribute_const__ __u64 __arch_swab64(__u64 x)
14{
15 __u64 result;
16
17 result = ia64_mux1(x, ia64_mux1_rev);
18 return result;
19}
20#define __arch_swab64 __arch_swab64
21
22static __inline__ __attribute_const__ __u32 __arch_swab32(__u32 x)
23{
24 return __arch_swab64(x) >> 32;
25}
26#define __arch_swab32 __arch_swab32
27
28static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 x)
29{
30 return __arch_swab64(x) >> 48;
31}
32#define __arch_swab16 __arch_swab16
33
34#endif /* _ASM_IA64_SWAB_H */
diff --git a/arch/ia64/include/uapi/asm/termbits.h b/arch/ia64/include/uapi/asm/termbits.h
deleted file mode 100644
index c009b94e58d..00000000000
--- a/arch/ia64/include/uapi/asm/termbits.h
+++ /dev/null
@@ -1,208 +0,0 @@
1#ifndef _ASM_IA64_TERMBITS_H
2#define _ASM_IA64_TERMBITS_H
3
4/*
5 * Based on <asm-i386/termbits.h>.
6 *
7 * Modified 1999
8 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
9 *
10 * 99/01/28 Added new baudrates
11 */
12
13#include <linux/posix_types.h>
14
15typedef unsigned char cc_t;
16typedef unsigned int speed_t;
17typedef unsigned int tcflag_t;
18
19#define NCCS 19
20struct termios {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27};
28
29struct termios2 {
30 tcflag_t c_iflag; /* input mode flags */
31 tcflag_t c_oflag; /* output mode flags */
32 tcflag_t c_cflag; /* control mode flags */
33 tcflag_t c_lflag; /* local mode flags */
34 cc_t c_line; /* line discipline */
35 cc_t c_cc[NCCS]; /* control characters */
36 speed_t c_ispeed; /* input speed */
37 speed_t c_ospeed; /* output speed */
38};
39
40struct ktermios {
41 tcflag_t c_iflag; /* input mode flags */
42 tcflag_t c_oflag; /* output mode flags */
43 tcflag_t c_cflag; /* control mode flags */
44 tcflag_t c_lflag; /* local mode flags */
45 cc_t c_line; /* line discipline */
46 cc_t c_cc[NCCS]; /* control characters */
47 speed_t c_ispeed; /* input speed */
48 speed_t c_ospeed; /* output speed */
49};
50
51/* c_cc characters */
52#define VINTR 0
53#define VQUIT 1
54#define VERASE 2
55#define VKILL 3
56#define VEOF 4
57#define VTIME 5
58#define VMIN 6
59#define VSWTC 7
60#define VSTART 8
61#define VSTOP 9
62#define VSUSP 10
63#define VEOL 11
64#define VREPRINT 12
65#define VDISCARD 13
66#define VWERASE 14
67#define VLNEXT 15
68#define VEOL2 16
69
70/* c_iflag bits */
71#define IGNBRK 0000001
72#define BRKINT 0000002
73#define IGNPAR 0000004
74#define PARMRK 0000010
75#define INPCK 0000020
76#define ISTRIP 0000040
77#define INLCR 0000100
78#define IGNCR 0000200
79#define ICRNL 0000400
80#define IUCLC 0001000
81#define IXON 0002000
82#define IXANY 0004000
83#define IXOFF 0010000
84#define IMAXBEL 0020000
85#define IUTF8 0040000
86
87/* c_oflag bits */
88#define OPOST 0000001
89#define OLCUC 0000002
90#define ONLCR 0000004
91#define OCRNL 0000010
92#define ONOCR 0000020
93#define ONLRET 0000040
94#define OFILL 0000100
95#define OFDEL 0000200
96#define NLDLY 0000400
97#define NL0 0000000
98#define NL1 0000400
99#define CRDLY 0003000
100#define CR0 0000000
101#define CR1 0001000
102#define CR2 0002000
103#define CR3 0003000
104#define TABDLY 0014000
105#define TAB0 0000000
106#define TAB1 0004000
107#define TAB2 0010000
108#define TAB3 0014000
109#define XTABS 0014000
110#define BSDLY 0020000
111#define BS0 0000000
112#define BS1 0020000
113#define VTDLY 0040000
114#define VT0 0000000
115#define VT1 0040000
116#define FFDLY 0100000
117#define FF0 0000000
118#define FF1 0100000
119
120/* c_cflag bit meaning */
121#define CBAUD 0010017
122#define B0 0000000 /* hang up */
123#define B50 0000001
124#define B75 0000002
125#define B110 0000003
126#define B134 0000004
127#define B150 0000005
128#define B200 0000006
129#define B300 0000007
130#define B600 0000010
131#define B1200 0000011
132#define B1800 0000012
133#define B2400 0000013
134#define B4800 0000014
135#define B9600 0000015
136#define B19200 0000016
137#define B38400 0000017
138#define EXTA B19200
139#define EXTB B38400
140#define CSIZE 0000060
141#define CS5 0000000
142#define CS6 0000020
143#define CS7 0000040
144#define CS8 0000060
145#define CSTOPB 0000100
146#define CREAD 0000200
147#define PARENB 0000400
148#define PARODD 0001000
149#define HUPCL 0002000
150#define CLOCAL 0004000
151#define CBAUDEX 0010000
152#define BOTHER 0010000
153#define B57600 0010001
154#define B115200 0010002
155#define B230400 0010003
156#define B460800 0010004
157#define B500000 0010005
158#define B576000 0010006
159#define B921600 0010007
160#define B1000000 0010010
161#define B1152000 0010011
162#define B1500000 0010012
163#define B2000000 0010013
164#define B2500000 0010014
165#define B3000000 0010015
166#define B3500000 0010016
167#define B4000000 0010017
168#define CIBAUD 002003600000 /* input baud rate */
169#define CMSPAR 010000000000 /* mark or space (stick) parity */
170#define CRTSCTS 020000000000 /* flow control */
171
172#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
173
174/* c_lflag bits */
175#define ISIG 0000001
176#define ICANON 0000002
177#define XCASE 0000004
178#define ECHO 0000010
179#define ECHOE 0000020
180#define ECHOK 0000040
181#define ECHONL 0000100
182#define NOFLSH 0000200
183#define TOSTOP 0000400
184#define ECHOCTL 0001000
185#define ECHOPRT 0002000
186#define ECHOKE 0004000
187#define FLUSHO 0010000
188#define PENDIN 0040000
189#define IEXTEN 0100000
190#define EXTPROC 0200000
191
192/* tcflow() and TCXONC use these */
193#define TCOOFF 0
194#define TCOON 1
195#define TCIOFF 2
196#define TCION 3
197
198/* tcflush() and TCFLSH use these */
199#define TCIFLUSH 0
200#define TCOFLUSH 1
201#define TCIOFLUSH 2
202
203/* tcsetattr uses these */
204#define TCSANOW 0
205#define TCSADRAIN 1
206#define TCSAFLUSH 2
207
208#endif /* _ASM_IA64_TERMBITS_H */
diff --git a/arch/ia64/include/uapi/asm/termios.h b/arch/ia64/include/uapi/asm/termios.h
deleted file mode 100644
index d59b48c307f..00000000000
--- a/arch/ia64/include/uapi/asm/termios.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Modified 1999
3 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
4 *
5 * 99/01/28 Added N_IRDA and N_SMSBLOCK
6 */
7#ifndef _UAPI_ASM_IA64_TERMIOS_H
8#define _UAPI_ASM_IA64_TERMIOS_H
9
10
11#include <asm/termbits.h>
12#include <asm/ioctls.h>
13
14struct winsize {
15 unsigned short ws_row;
16 unsigned short ws_col;
17 unsigned short ws_xpixel;
18 unsigned short ws_ypixel;
19};
20
21#define NCC 8
22struct termio {
23 unsigned short c_iflag; /* input mode flags */
24 unsigned short c_oflag; /* output mode flags */
25 unsigned short c_cflag; /* control mode flags */
26 unsigned short c_lflag; /* local mode flags */
27 unsigned char c_line; /* line discipline */
28 unsigned char c_cc[NCC]; /* control characters */
29};
30
31/* modem lines */
32#define TIOCM_LE 0x001
33#define TIOCM_DTR 0x002
34#define TIOCM_RTS 0x004
35#define TIOCM_ST 0x008
36#define TIOCM_SR 0x010
37#define TIOCM_CTS 0x020
38#define TIOCM_CAR 0x040
39#define TIOCM_RNG 0x080
40#define TIOCM_DSR 0x100
41#define TIOCM_CD TIOCM_CAR
42#define TIOCM_RI TIOCM_RNG
43#define TIOCM_OUT1 0x2000
44#define TIOCM_OUT2 0x4000
45#define TIOCM_LOOP 0x8000
46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48
49
50#endif /* _UAPI_ASM_IA64_TERMIOS_H */
diff --git a/arch/ia64/include/uapi/asm/types.h b/arch/ia64/include/uapi/asm/types.h
deleted file mode 100644
index 321193b05ee..00000000000
--- a/arch/ia64/include/uapi/asm/types.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * This file is never included by application software unless explicitly
3 * requested (e.g., via linux/types.h) in which case the application is
4 * Linux specific so (user-) name space pollution is not a major issue.
5 * However, for interoperability, libraries still need to be careful to
6 * avoid naming clashes.
7 *
8 * Based on <asm-alpha/types.h>.
9 *
10 * Modified 1998-2000, 2002
11 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
12 */
13#ifndef _UAPI_ASM_IA64_TYPES_H
14#define _UAPI_ASM_IA64_TYPES_H
15
16
17#ifndef __KERNEL__
18#include <asm-generic/int-l64.h>
19#endif
20
21#ifdef __ASSEMBLY__
22# define __IA64_UL(x) (x)
23# define __IA64_UL_CONST(x) x
24
25#else
26# define __IA64_UL(x) ((unsigned long)(x))
27# define __IA64_UL_CONST(x) x##UL
28
29#endif /* !__ASSEMBLY__ */
30
31#endif /* _UAPI_ASM_IA64_TYPES_H */
diff --git a/arch/ia64/include/uapi/asm/ucontext.h b/arch/ia64/include/uapi/asm/ucontext.h
deleted file mode 100644
index bf573dc8ca6..00000000000
--- a/arch/ia64/include/uapi/asm/ucontext.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _ASM_IA64_UCONTEXT_H
2#define _ASM_IA64_UCONTEXT_H
3
4struct ucontext {
5 struct sigcontext uc_mcontext;
6};
7
8#define uc_link uc_mcontext.sc_gr[0] /* wrong type; nobody cares */
9#define uc_sigmask uc_mcontext.sc_sigmask
10#define uc_stack uc_mcontext.sc_stack
11
12#endif /* _ASM_IA64_UCONTEXT_H */
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
deleted file mode 100644
index 34fd6fe46da..00000000000
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ /dev/null
@@ -1,329 +0,0 @@
1/*
2 * IA-64 Linux syscall numbers and inline-functions.
3 *
4 * Copyright (C) 1998-2005 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com>
6 */
7#ifndef _UAPI_ASM_IA64_UNISTD_H
8#define _UAPI_ASM_IA64_UNISTD_H
9
10
11#include <asm/break.h>
12
13#define __BREAK_SYSCALL __IA64_BREAK_SYSCALL
14
15#define __NR_ni_syscall 1024
16#define __NR_exit 1025
17#define __NR_read 1026
18#define __NR_write 1027
19#define __NR_open 1028
20#define __NR_close 1029
21#define __NR_creat 1030
22#define __NR_link 1031
23#define __NR_unlink 1032
24#define __NR_execve 1033
25#define __NR_chdir 1034
26#define __NR_fchdir 1035
27#define __NR_utimes 1036
28#define __NR_mknod 1037
29#define __NR_chmod 1038
30#define __NR_chown 1039
31#define __NR_lseek 1040
32#define __NR_getpid 1041
33#define __NR_getppid 1042
34#define __NR_mount 1043
35#define __NR_umount 1044
36#define __NR_setuid 1045
37#define __NR_getuid 1046
38#define __NR_geteuid 1047
39#define __NR_ptrace 1048
40#define __NR_access 1049
41#define __NR_sync 1050
42#define __NR_fsync 1051
43#define __NR_fdatasync 1052
44#define __NR_kill 1053
45#define __NR_rename 1054
46#define __NR_mkdir 1055
47#define __NR_rmdir 1056
48#define __NR_dup 1057
49#define __NR_pipe 1058
50#define __NR_times 1059
51#define __NR_brk 1060
52#define __NR_setgid 1061
53#define __NR_getgid 1062
54#define __NR_getegid 1063
55#define __NR_acct 1064
56#define __NR_ioctl 1065
57#define __NR_fcntl 1066
58#define __NR_umask 1067
59#define __NR_chroot 1068
60#define __NR_ustat 1069
61#define __NR_dup2 1070
62#define __NR_setreuid 1071
63#define __NR_setregid 1072
64#define __NR_getresuid 1073
65#define __NR_setresuid 1074
66#define __NR_getresgid 1075
67#define __NR_setresgid 1076
68#define __NR_getgroups 1077
69#define __NR_setgroups 1078
70#define __NR_getpgid 1079
71#define __NR_setpgid 1080
72#define __NR_setsid 1081
73#define __NR_getsid 1082
74#define __NR_sethostname 1083
75#define __NR_setrlimit 1084
76#define __NR_getrlimit 1085
77#define __NR_getrusage 1086
78#define __NR_gettimeofday 1087
79#define __NR_settimeofday 1088
80#define __NR_select 1089
81#define __NR_poll 1090
82#define __NR_symlink 1091
83#define __NR_readlink 1092
84#define __NR_uselib 1093
85#define __NR_swapon 1094
86#define __NR_swapoff 1095
87#define __NR_reboot 1096
88#define __NR_truncate 1097
89#define __NR_ftruncate 1098
90#define __NR_fchmod 1099
91#define __NR_fchown 1100
92#define __NR_getpriority 1101
93#define __NR_setpriority 1102
94#define __NR_statfs 1103
95#define __NR_fstatfs 1104
96#define __NR_gettid 1105
97#define __NR_semget 1106
98#define __NR_semop 1107
99#define __NR_semctl 1108
100#define __NR_msgget 1109
101#define __NR_msgsnd 1110
102#define __NR_msgrcv 1111
103#define __NR_msgctl 1112
104#define __NR_shmget 1113
105#define __NR_shmat 1114
106#define __NR_shmdt 1115
107#define __NR_shmctl 1116
108/* also known as klogctl() in GNU libc: */
109#define __NR_syslog 1117
110#define __NR_setitimer 1118
111#define __NR_getitimer 1119
112/* 1120 was __NR_old_stat */
113/* 1121 was __NR_old_lstat */
114/* 1122 was __NR_old_fstat */
115#define __NR_vhangup 1123
116#define __NR_lchown 1124
117#define __NR_remap_file_pages 1125
118#define __NR_wait4 1126
119#define __NR_sysinfo 1127
120#define __NR_clone 1128
121#define __NR_setdomainname 1129
122#define __NR_uname 1130
123#define __NR_adjtimex 1131
124/* 1132 was __NR_create_module */
125#define __NR_init_module 1133
126#define __NR_delete_module 1134
127/* 1135 was __NR_get_kernel_syms */
128/* 1136 was __NR_query_module */
129#define __NR_quotactl 1137
130#define __NR_bdflush 1138
131#define __NR_sysfs 1139
132#define __NR_personality 1140
133#define __NR_afs_syscall 1141
134#define __NR_setfsuid 1142
135#define __NR_setfsgid 1143
136#define __NR_getdents 1144
137#define __NR_flock 1145
138#define __NR_readv 1146
139#define __NR_writev 1147
140#define __NR_pread64 1148
141#define __NR_pwrite64 1149
142#define __NR__sysctl 1150
143#define __NR_mmap 1151
144#define __NR_munmap 1152
145#define __NR_mlock 1153
146#define __NR_mlockall 1154
147#define __NR_mprotect 1155
148#define __NR_mremap 1156
149#define __NR_msync 1157
150#define __NR_munlock 1158
151#define __NR_munlockall 1159
152#define __NR_sched_getparam 1160
153#define __NR_sched_setparam 1161
154#define __NR_sched_getscheduler 1162
155#define __NR_sched_setscheduler 1163
156#define __NR_sched_yield 1164
157#define __NR_sched_get_priority_max 1165
158#define __NR_sched_get_priority_min 1166
159#define __NR_sched_rr_get_interval 1167
160#define __NR_nanosleep 1168
161#define __NR_nfsservctl 1169
162#define __NR_prctl 1170
163/* 1171 is reserved for backwards compatibility with old __NR_getpagesize */
164#define __NR_mmap2 1172
165#define __NR_pciconfig_read 1173
166#define __NR_pciconfig_write 1174
167#define __NR_perfmonctl 1175
168#define __NR_sigaltstack 1176
169#define __NR_rt_sigaction 1177
170#define __NR_rt_sigpending 1178
171#define __NR_rt_sigprocmask 1179
172#define __NR_rt_sigqueueinfo 1180
173#define __NR_rt_sigreturn 1181
174#define __NR_rt_sigsuspend 1182
175#define __NR_rt_sigtimedwait 1183
176#define __NR_getcwd 1184
177#define __NR_capget 1185
178#define __NR_capset 1186
179#define __NR_sendfile 1187
180#define __NR_getpmsg 1188
181#define __NR_putpmsg 1189
182#define __NR_socket 1190
183#define __NR_bind 1191
184#define __NR_connect 1192
185#define __NR_listen 1193
186#define __NR_accept 1194
187#define __NR_getsockname 1195
188#define __NR_getpeername 1196
189#define __NR_socketpair 1197
190#define __NR_send 1198
191#define __NR_sendto 1199
192#define __NR_recv 1200
193#define __NR_recvfrom 1201
194#define __NR_shutdown 1202
195#define __NR_setsockopt 1203
196#define __NR_getsockopt 1204
197#define __NR_sendmsg 1205
198#define __NR_recvmsg 1206
199#define __NR_pivot_root 1207
200#define __NR_mincore 1208
201#define __NR_madvise 1209
202#define __NR_stat 1210
203#define __NR_lstat 1211
204#define __NR_fstat 1212
205#define __NR_clone2 1213
206#define __NR_getdents64 1214
207#define __NR_getunwind 1215
208#define __NR_readahead 1216
209#define __NR_setxattr 1217
210#define __NR_lsetxattr 1218
211#define __NR_fsetxattr 1219
212#define __NR_getxattr 1220
213#define __NR_lgetxattr 1221
214#define __NR_fgetxattr 1222
215#define __NR_listxattr 1223
216#define __NR_llistxattr 1224
217#define __NR_flistxattr 1225
218#define __NR_removexattr 1226
219#define __NR_lremovexattr 1227
220#define __NR_fremovexattr 1228
221#define __NR_tkill 1229
222#define __NR_futex 1230
223#define __NR_sched_setaffinity 1231
224#define __NR_sched_getaffinity 1232
225#define __NR_set_tid_address 1233
226#define __NR_fadvise64 1234
227#define __NR_tgkill 1235
228#define __NR_exit_group 1236
229#define __NR_lookup_dcookie 1237
230#define __NR_io_setup 1238
231#define __NR_io_destroy 1239
232#define __NR_io_getevents 1240
233#define __NR_io_submit 1241
234#define __NR_io_cancel 1242
235#define __NR_epoll_create 1243
236#define __NR_epoll_ctl 1244
237#define __NR_epoll_wait 1245
238#define __NR_restart_syscall 1246
239#define __NR_semtimedop 1247
240#define __NR_timer_create 1248
241#define __NR_timer_settime 1249
242#define __NR_timer_gettime 1250
243#define __NR_timer_getoverrun 1251
244#define __NR_timer_delete 1252
245#define __NR_clock_settime 1253
246#define __NR_clock_gettime 1254
247#define __NR_clock_getres 1255
248#define __NR_clock_nanosleep 1256
249#define __NR_fstatfs64 1257
250#define __NR_statfs64 1258
251#define __NR_mbind 1259
252#define __NR_get_mempolicy 1260
253#define __NR_set_mempolicy 1261
254#define __NR_mq_open 1262
255#define __NR_mq_unlink 1263
256#define __NR_mq_timedsend 1264
257#define __NR_mq_timedreceive 1265
258#define __NR_mq_notify 1266
259#define __NR_mq_getsetattr 1267
260#define __NR_kexec_load 1268
261#define __NR_vserver 1269
262#define __NR_waitid 1270
263#define __NR_add_key 1271
264#define __NR_request_key 1272
265#define __NR_keyctl 1273
266#define __NR_ioprio_set 1274
267#define __NR_ioprio_get 1275
268#define __NR_move_pages 1276
269#define __NR_inotify_init 1277
270#define __NR_inotify_add_watch 1278
271#define __NR_inotify_rm_watch 1279
272#define __NR_migrate_pages 1280
273#define __NR_openat 1281
274#define __NR_mkdirat 1282
275#define __NR_mknodat 1283
276#define __NR_fchownat 1284
277#define __NR_futimesat 1285
278#define __NR_newfstatat 1286
279#define __NR_unlinkat 1287
280#define __NR_renameat 1288
281#define __NR_linkat 1289
282#define __NR_symlinkat 1290
283#define __NR_readlinkat 1291
284#define __NR_fchmodat 1292
285#define __NR_faccessat 1293
286#define __NR_pselect6 1294
287#define __NR_ppoll 1295
288#define __NR_unshare 1296
289#define __NR_splice 1297
290#define __NR_set_robust_list 1298
291#define __NR_get_robust_list 1299
292#define __NR_sync_file_range 1300
293#define __NR_tee 1301
294#define __NR_vmsplice 1302
295#define __NR_fallocate 1303
296#define __NR_getcpu 1304
297#define __NR_epoll_pwait 1305
298#define __NR_utimensat 1306
299#define __NR_signalfd 1307
300#define __NR_timerfd 1308
301#define __NR_eventfd 1309
302#define __NR_timerfd_create 1310
303#define __NR_timerfd_settime 1311
304#define __NR_timerfd_gettime 1312
305#define __NR_signalfd4 1313
306#define __NR_eventfd2 1314
307#define __NR_epoll_create1 1315
308#define __NR_dup3 1316
309#define __NR_pipe2 1317
310#define __NR_inotify_init1 1318
311#define __NR_preadv 1319
312#define __NR_pwritev 1320
313#define __NR_rt_tgsigqueueinfo 1321
314#define __NR_recvmmsg 1322
315#define __NR_fanotify_init 1323
316#define __NR_fanotify_mark 1324
317#define __NR_prlimit64 1325
318#define __NR_name_to_handle_at 1326
319#define __NR_open_by_handle_at 1327
320#define __NR_clock_adjtime 1328
321#define __NR_syncfs 1329
322#define __NR_setns 1330
323#define __NR_sendmmsg 1331
324#define __NR_process_vm_readv 1332
325#define __NR_process_vm_writev 1333
326#define __NR_accept4 1334
327#define __NR_finit_module 1335
328
329#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/include/uapi/asm/ustack.h b/arch/ia64/include/uapi/asm/ustack.h
deleted file mode 100644
index 1dfebc62269..00000000000
--- a/arch/ia64/include/uapi/asm/ustack.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _UAPI_ASM_IA64_USTACK_H
2#define _UAPI_ASM_IA64_USTACK_H
3
4/*
5 * Constants for the user stack size
6 */
7
8
9/* Make a default stack size of 2GiB */
10#define DEFAULT_USER_STACK_SIZE (1UL << 31)
11
12#endif /* _UAPI_ASM_IA64_USTACK_H */
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 335eb07480f..bfb4d01e0e5 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -50,6 +50,7 @@
50#include <asm/iosapic.h> 50#include <asm/iosapic.h>
51#include <asm/machvec.h> 51#include <asm/machvec.h>
52#include <asm/page.h> 52#include <asm/page.h>
53#include <asm/system.h>
53#include <asm/numa.h> 54#include <asm/numa.h>
54#include <asm/sal.h> 55#include <asm/sal.h>
55#include <asm/cyclone.h> 56#include <asm/cyclone.h>
@@ -348,11 +349,11 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
348 349
349 iosapic_override_isa_irq(p->source_irq, p->global_irq, 350 iosapic_override_isa_irq(p->source_irq, p->global_irq,
350 ((p->inti_flags & ACPI_MADT_POLARITY_MASK) == 351 ((p->inti_flags & ACPI_MADT_POLARITY_MASK) ==
351 ACPI_MADT_POLARITY_ACTIVE_LOW) ? 352 ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
352 IOSAPIC_POL_LOW : IOSAPIC_POL_HIGH, 353 IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
353 ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) == 354 ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
354 ACPI_MADT_TRIGGER_LEVEL) ? 355 ACPI_MADT_TRIGGER_EDGE) ?
355 IOSAPIC_LEVEL : IOSAPIC_EDGE); 356 IOSAPIC_EDGE : IOSAPIC_LEVEL);
356 return 0; 357 return 0;
357} 358}
358 359
@@ -422,30 +423,28 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
422#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32) 423#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
423 424
424static int __initdata srat_num_cpus; /* number of cpus */ 425static int __initdata srat_num_cpus; /* number of cpus */
425static u32 pxm_flag[PXM_FLAG_LEN]; 426static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
426#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag)) 427#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
427#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) 428#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
428static struct acpi_table_slit __initdata *slit_table; 429static struct acpi_table_slit __initdata *slit_table;
429cpumask_t early_cpu_possible_map = CPU_MASK_NONE; 430cpumask_t early_cpu_possible_map = CPU_MASK_NONE;
430 431
431static int __init 432static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
432get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
433{ 433{
434 int pxm; 434 int pxm;
435 435
436 pxm = pa->proximity_domain_lo; 436 pxm = pa->proximity_domain_lo;
437 if (ia64_platform_is("sn2") || acpi_srat_revision >= 2) 437 if (ia64_platform_is("sn2"))
438 pxm += pa->proximity_domain_hi[0] << 8; 438 pxm += pa->proximity_domain_hi[0] << 8;
439 return pxm; 439 return pxm;
440} 440}
441 441
442static int __init 442static int get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
443get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
444{ 443{
445 int pxm; 444 int pxm;
446 445
447 pxm = ma->proximity_domain; 446 pxm = ma->proximity_domain;
448 if (!ia64_platform_is("sn2") && acpi_srat_revision <= 1) 447 if (!ia64_platform_is("sn2"))
449 pxm &= 0xff; 448 pxm &= 0xff;
450 449
451 return pxm; 450 return pxm;
@@ -497,7 +496,7 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
497 srat_num_cpus++; 496 srat_num_cpus++;
498} 497}
499 498
500int __init 499void __init
501acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) 500acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
502{ 501{
503 unsigned long paddr, size; 502 unsigned long paddr, size;
@@ -512,7 +511,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
512 511
513 /* Ignore disabled entries */ 512 /* Ignore disabled entries */
514 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) 513 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
515 return -1; 514 return;
516 515
517 /* record this node in proximity bitmap */ 516 /* record this node in proximity bitmap */
518 pxm_bit_set(pxm); 517 pxm_bit_set(pxm);
@@ -531,7 +530,6 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
531 p->size = size; 530 p->size = size;
532 p->nid = pxm; 531 p->nid = pxm;
533 num_node_memblks++; 532 num_node_memblks++;
534 return 0;
535} 533}
536 534
537void __init acpi_numa_arch_fixup(void) 535void __init acpi_numa_arch_fixup(void)
@@ -633,7 +631,6 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int triggering, int polarity)
633 ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : 631 ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
634 IOSAPIC_LEVEL); 632 IOSAPIC_LEVEL);
635} 633}
636EXPORT_SYMBOL_GPL(acpi_register_gsi);
637 634
638void acpi_unregister_gsi(u32 gsi) 635void acpi_unregister_gsi(u32 gsi)
639{ 636{
@@ -645,7 +642,6 @@ void acpi_unregister_gsi(u32 gsi)
645 642
646 iosapic_unregister_intr(gsi); 643 iosapic_unregister_intr(gsi);
647} 644}
648EXPORT_SYMBOL_GPL(acpi_unregister_gsi);
649 645
650static int __init acpi_parse_fadt(struct acpi_table_header *table) 646static int __init acpi_parse_fadt(struct acpi_table_header *table)
651{ 647{
@@ -842,11 +838,11 @@ static __init int setup_additional_cpus(char *s)
842early_param("additional_cpus", setup_additional_cpus); 838early_param("additional_cpus", setup_additional_cpus);
843 839
844/* 840/*
845 * cpu_possible_mask should be static, it cannot change as CPUs 841 * cpu_possible_map should be static, it cannot change as CPUs
846 * are onlined, or offlined. The reason is per-cpu data-structures 842 * are onlined, or offlined. The reason is per-cpu data-structures
847 * are allocated by some modules at init time, and dont expect to 843 * are allocated by some modules at init time, and dont expect to
848 * do this dynamically on cpu arrival/departure. 844 * do this dynamically on cpu arrival/departure.
849 * cpu_present_mask on the other hand can change dynamically. 845 * cpu_present_map on the other hand can change dynamically.
850 * In case when cpu_hotplug is not compiled, then we resort to current 846 * In case when cpu_hotplug is not compiled, then we resort to current
851 * behaviour, which is cpu_possible == cpu_present. 847 * behaviour, which is cpu_possible == cpu_present.
852 * - Ashok Raj 848 * - Ashok Raj
@@ -924,7 +920,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
924 920
925 acpi_map_cpu2node(handle, cpu, physid); 921 acpi_map_cpu2node(handle, cpu, physid);
926 922
927 set_cpu_present(cpu, true); 923 cpu_set(cpu, cpu_present_map);
928 ia64_cpu_to_sapicid[cpu] = physid; 924 ia64_cpu_to_sapicid[cpu] = physid;
929 925
930 acpi_processor_set_pdc(handle); 926 acpi_processor_set_pdc(handle);
@@ -943,7 +939,7 @@ EXPORT_SYMBOL(acpi_map_lsapic);
943int acpi_unmap_lsapic(int cpu) 939int acpi_unmap_lsapic(int cpu)
944{ 940{
945 ia64_cpu_to_sapicid[cpu] = -1; 941 ia64_cpu_to_sapicid[cpu] = -1;
946 set_cpu_present(cpu, false); 942 cpu_clear(cpu, cpu_present_map);
947 943
948#ifdef CONFIG_ACPI_NUMA 944#ifdef CONFIG_ACPI_NUMA
949 /* NUMA specific cleanup's */ 945 /* NUMA specific cleanup's */
@@ -956,8 +952,8 @@ EXPORT_SYMBOL(acpi_unmap_lsapic);
956#endif /* CONFIG_ACPI_HOTPLUG_CPU */ 952#endif /* CONFIG_ACPI_HOTPLUG_CPU */
957 953
958#ifdef CONFIG_ACPI_NUMA 954#ifdef CONFIG_ACPI_NUMA
959static acpi_status acpi_map_iosapic(acpi_handle handle, u32 depth, 955static acpi_status __devinit
960 void *context, void **ret) 956acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
961{ 957{
962 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 958 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
963 union acpi_object *obj; 959 union acpi_object *obj;
diff --git a/arch/ia64/kernel/asm-offsets.c b/arch/ia64/kernel/asm-offsets.c
index a48bd9a9927..af565016904 100644
--- a/arch/ia64/kernel/asm-offsets.c
+++ b/arch/ia64/kernel/asm-offsets.c
@@ -269,8 +269,8 @@ void foo(void)
269 BLANK(); 269 BLANK();
270 270
271 /* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */ 271 /* used by fsys_gettimeofday in arch/ia64/kernel/fsys.S */
272 DEFINE(IA64_GTOD_SEQ_OFFSET, 272 DEFINE(IA64_GTOD_LOCK_OFFSET,
273 offsetof (struct fsyscall_gtod_data_t, seq)); 273 offsetof (struct fsyscall_gtod_data_t, lock));
274 DEFINE(IA64_GTOD_WALL_TIME_OFFSET, 274 DEFINE(IA64_GTOD_WALL_TIME_OFFSET,
275 offsetof (struct fsyscall_gtod_data_t, wall_time)); 275 offsetof (struct fsyscall_gtod_data_t, wall_time));
276 DEFINE(IA64_GTOD_MONO_TIME_OFFSET, 276 DEFINE(IA64_GTOD_MONO_TIME_OFFSET,
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index 7f791623820..f2c1600da09 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -1,5 +1,4 @@
1#include <linux/dma-mapping.h> 1#include <linux/dma-mapping.h>
2#include <linux/export.h>
3 2
4/* Set this to 1 if there is a HW IOMMU in the system */ 3/* Set this to 1 if there is a HW IOMMU in the system */
5int iommu_detected __read_mostly; 4int iommu_detected __read_mostly;
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index f034563aeae..c38d22e5e90 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -39,7 +39,6 @@
39#include <asm/pgtable.h> 39#include <asm/pgtable.h>
40#include <asm/processor.h> 40#include <asm/processor.h>
41#include <asm/mca.h> 41#include <asm/mca.h>
42#include <asm/setup.h>
43#include <asm/tlbflush.h> 42#include <asm/tlbflush.h>
44 43
45#define EFI_DEBUG 0 44#define EFI_DEBUG 0
@@ -870,7 +869,7 @@ kern_mem_attribute (unsigned long phys_addr, unsigned long size)
870EXPORT_SYMBOL(kern_mem_attribute); 869EXPORT_SYMBOL(kern_mem_attribute);
871 870
872int 871int
873valid_phys_addr_range (phys_addr_t phys_addr, unsigned long size) 872valid_phys_addr_range (unsigned long phys_addr, unsigned long size)
874{ 873{
875 u64 attr; 874 u64 attr;
876 875
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 6bfd8429ee0..198c753d100 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -61,13 +61,14 @@ ENTRY(ia64_execve)
61 * Allocate 8 input registers since ptrace() may clobber them 61 * Allocate 8 input registers since ptrace() may clobber them
62 */ 62 */
63 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8) 63 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
64 alloc loc1=ar.pfs,8,2,3,0 64 alloc loc1=ar.pfs,8,2,4,0
65 mov loc0=rp 65 mov loc0=rp
66 .body 66 .body
67 mov out0=in0 // filename 67 mov out0=in0 // filename
68 ;; // stop bit between alloc and call 68 ;; // stop bit between alloc and call
69 mov out1=in1 // argv 69 mov out1=in1 // argv
70 mov out2=in2 // envp 70 mov out2=in2 // envp
71 add out3=16,sp // regs
71 br.call.sptk.many rp=sys_execve 72 br.call.sptk.many rp=sys_execve
72.ret0: 73.ret0:
73 cmp4.ge p6,p7=r8,r0 74 cmp4.ge p6,p7=r8,r0
@@ -75,6 +76,7 @@ ENTRY(ia64_execve)
75 sxt4 r8=r8 // return 64-bit result 76 sxt4 r8=r8 // return 64-bit result
76 ;; 77 ;;
77 stf.spill [sp]=f0 78 stf.spill [sp]=f0
79(p6) cmp.ne pKStk,pUStk=r0,r0 // a successful execve() lands us in user-mode...
78 mov rp=loc0 80 mov rp=loc0
79(p6) mov ar.pfs=r0 // clear ar.pfs on success 81(p6) mov ar.pfs=r0 // clear ar.pfs on success
80(p7) br.ret.sptk.many rp 82(p7) br.ret.sptk.many rp
@@ -116,12 +118,13 @@ GLOBAL_ENTRY(sys_clone2)
116 mov loc1=r16 // save ar.pfs across do_fork 118 mov loc1=r16 // save ar.pfs across do_fork
117 .body 119 .body
118 mov out1=in1 120 mov out1=in1
119 mov out2=in2 121 mov out3=in2
120 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT 122 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
121 mov out3=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID 123 mov out4=in3 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
122 ;; 124 ;;
123(p6) st8 [r2]=in5 // store TLS in r16 for copy_thread() 125(p6) st8 [r2]=in5 // store TLS in r16 for copy_thread()
124 mov out4=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID 126 mov out5=in4 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
127 adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = &regs
125 mov out0=in0 // out0 = clone_flags 128 mov out0=in0 // out0 = clone_flags
126 br.call.sptk.many rp=do_fork 129 br.call.sptk.many rp=do_fork
127.ret1: .restore sp 130.ret1: .restore sp
@@ -147,12 +150,13 @@ GLOBAL_ENTRY(sys_clone)
147 mov loc1=r16 // save ar.pfs across do_fork 150 mov loc1=r16 // save ar.pfs across do_fork
148 .body 151 .body
149 mov out1=in1 152 mov out1=in1
150 mov out2=16 // stacksize (compensates for 16-byte scratch area) 153 mov out3=16 // stacksize (compensates for 16-byte scratch area)
151 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT 154 tbit.nz p6,p0=in0,CLONE_SETTLS_BIT
152 mov out3=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID 155 mov out4=in2 // parent_tidptr: valid only w/CLONE_PARENT_SETTID
153 ;; 156 ;;
154(p6) st8 [r2]=in4 // store TLS in r13 (tp) 157(p6) st8 [r2]=in4 // store TLS in r13 (tp)
155 mov out4=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID 158 mov out5=in3 // child_tidptr: valid only w/CLONE_CHILD_SETTID or CLONE_CHILD_CLEARTID
159 adds out2=IA64_SWITCH_STACK_SIZE+16,sp // out2 = &regs
156 mov out0=in0 // out0 = clone_flags 160 mov out0=in0 // out0 = clone_flags
157 br.call.sptk.many rp=do_fork 161 br.call.sptk.many rp=do_fork
158.ret2: .restore sp 162.ret2: .restore sp
@@ -480,6 +484,19 @@ GLOBAL_ENTRY(prefetch_stack)
480 br.ret.sptk.many rp 484 br.ret.sptk.many rp
481END(prefetch_stack) 485END(prefetch_stack)
482 486
487GLOBAL_ENTRY(kernel_execve)
488 rum psr.ac
489 mov r15=__NR_execve // put syscall number in place
490 break __BREAK_SYSCALL
491 br.ret.sptk.many rp
492END(kernel_execve)
493
494GLOBAL_ENTRY(clone)
495 mov r15=__NR_clone // put syscall number in place
496 break __BREAK_SYSCALL
497 br.ret.sptk.many rp
498END(clone)
499
483 /* 500 /*
484 * Invoke a system call, but do some tracing before and after the call. 501 * Invoke a system call, but do some tracing before and after the call.
485 * We MUST preserve the current register frame throughout this routine 502 * We MUST preserve the current register frame throughout this routine
@@ -583,27 +600,6 @@ GLOBAL_ENTRY(ia64_strace_leave_kernel)
583.ret4: br.cond.sptk ia64_leave_kernel 600.ret4: br.cond.sptk ia64_leave_kernel
584END(ia64_strace_leave_kernel) 601END(ia64_strace_leave_kernel)
585 602
586ENTRY(call_payload)
587 .prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(0)
588 /* call the kernel_thread payload; fn is in r4, arg - in r5 */
589 alloc loc1=ar.pfs,0,3,1,0
590 mov loc0=rp
591 mov loc2=gp
592 mov out0=r5 // arg
593 ld8 r14 = [r4], 8 // fn.address
594 ;;
595 mov b6 = r14
596 ld8 gp = [r4] // fn.gp
597 ;;
598 br.call.sptk.many rp=b6 // fn(arg)
599.ret12: mov gp=loc2
600 mov rp=loc0
601 mov ar.pfs=loc1
602 /* ... and if it has returned, we are going to userland */
603 cmp.ne pKStk,pUStk=r0,r0
604 br.ret.sptk.many rp
605END(call_payload)
606
607GLOBAL_ENTRY(ia64_ret_from_clone) 603GLOBAL_ENTRY(ia64_ret_from_clone)
608 PT_REGS_UNWIND_INFO(0) 604 PT_REGS_UNWIND_INFO(0)
609{ /* 605{ /*
@@ -620,7 +616,6 @@ GLOBAL_ENTRY(ia64_ret_from_clone)
620 br.call.sptk.many rp=ia64_invoke_schedule_tail 616 br.call.sptk.many rp=ia64_invoke_schedule_tail
621} 617}
622.ret8: 618.ret8:
623(pKStk) br.call.sptk.many rp=call_payload
624 adds r2=TI_FLAGS+IA64_TASK_SIZE,r13 619 adds r2=TI_FLAGS+IA64_TASK_SIZE,r13
625 ;; 620 ;;
626 ld4 r2=[r2] 621 ld4 r2=[r2]
@@ -1782,10 +1777,6 @@ sys_call_table:
1782 data8 sys_syncfs 1777 data8 sys_syncfs
1783 data8 sys_setns // 1330 1778 data8 sys_setns // 1330
1784 data8 sys_sendmmsg 1779 data8 sys_sendmmsg
1785 data8 sys_process_vm_readv
1786 data8 sys_process_vm_writev
1787 data8 sys_accept4
1788 data8 sys_finit_module // 1335
1789 1780
1790 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1781 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
1791#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ 1782#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
index 2d67317a1ec..c539c689493 100644
--- a/arch/ia64/kernel/err_inject.c
+++ b/arch/ia64/kernel/err_inject.c
@@ -24,7 +24,7 @@
24 * Copyright (C) 2006, Intel Corp. All rights reserved. 24 * Copyright (C) 2006, Intel Corp. All rights reserved.
25 * 25 *
26 */ 26 */
27#include <linux/device.h> 27#include <linux/sysdev.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/cpu.h> 30#include <linux/cpu.h>
@@ -35,10 +35,10 @@
35#define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte; 35#define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte;
36 36
37#define define_one_ro(name) \ 37#define define_one_ro(name) \
38static DEVICE_ATTR(name, 0444, show_##name, NULL) 38static SYSDEV_ATTR(name, 0444, show_##name, NULL)
39 39
40#define define_one_rw(name) \ 40#define define_one_rw(name) \
41static DEVICE_ATTR(name, 0644, show_##name, store_##name) 41static SYSDEV_ATTR(name, 0644, show_##name, store_##name)
42 42
43static u64 call_start[NR_CPUS]; 43static u64 call_start[NR_CPUS];
44static u64 phys_addr[NR_CPUS]; 44static u64 phys_addr[NR_CPUS];
@@ -55,7 +55,7 @@ static u64 resources[NR_CPUS];
55 55
56#define show(name) \ 56#define show(name) \
57static ssize_t \ 57static ssize_t \
58show_##name(struct device *dev, struct device_attribute *attr, \ 58show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \
59 char *buf) \ 59 char *buf) \
60{ \ 60{ \
61 u32 cpu=dev->id; \ 61 u32 cpu=dev->id; \
@@ -64,7 +64,7 @@ show_##name(struct device *dev, struct device_attribute *attr, \
64 64
65#define store(name) \ 65#define store(name) \
66static ssize_t \ 66static ssize_t \
67store_##name(struct device *dev, struct device_attribute *attr, \ 67store_##name(struct sys_device *dev, struct sysdev_attribute *attr, \
68 const char *buf, size_t size) \ 68 const char *buf, size_t size) \
69{ \ 69{ \
70 unsigned int cpu=dev->id; \ 70 unsigned int cpu=dev->id; \
@@ -78,7 +78,7 @@ show(call_start)
78 * processor. The cpu number in driver is only used for storing data. 78 * processor. The cpu number in driver is only used for storing data.
79 */ 79 */
80static ssize_t 80static ssize_t
81store_call_start(struct device *dev, struct device_attribute *attr, 81store_call_start(struct sys_device *dev, struct sysdev_attribute *attr,
82 const char *buf, size_t size) 82 const char *buf, size_t size)
83{ 83{
84 unsigned int cpu=dev->id; 84 unsigned int cpu=dev->id;
@@ -127,7 +127,7 @@ show(err_type_info)
127store(err_type_info) 127store(err_type_info)
128 128
129static ssize_t 129static ssize_t
130show_virtual_to_phys(struct device *dev, struct device_attribute *attr, 130show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr,
131 char *buf) 131 char *buf)
132{ 132{
133 unsigned int cpu=dev->id; 133 unsigned int cpu=dev->id;
@@ -135,7 +135,7 @@ show_virtual_to_phys(struct device *dev, struct device_attribute *attr,
135} 135}
136 136
137static ssize_t 137static ssize_t
138store_virtual_to_phys(struct device *dev, struct device_attribute *attr, 138store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr,
139 const char *buf, size_t size) 139 const char *buf, size_t size)
140{ 140{
141 unsigned int cpu=dev->id; 141 unsigned int cpu=dev->id;
@@ -159,8 +159,8 @@ show(err_struct_info)
159store(err_struct_info) 159store(err_struct_info)
160 160
161static ssize_t 161static ssize_t
162show_err_data_buffer(struct device *dev, 162show_err_data_buffer(struct sys_device *dev,
163 struct device_attribute *attr, char *buf) 163 struct sysdev_attribute *attr, char *buf)
164{ 164{
165 unsigned int cpu=dev->id; 165 unsigned int cpu=dev->id;
166 166
@@ -171,8 +171,8 @@ show_err_data_buffer(struct device *dev,
171} 171}
172 172
173static ssize_t 173static ssize_t
174store_err_data_buffer(struct device *dev, 174store_err_data_buffer(struct sys_device *dev,
175 struct device_attribute *attr, 175 struct sysdev_attribute *attr,
176 const char *buf, size_t size) 176 const char *buf, size_t size)
177{ 177{
178 unsigned int cpu=dev->id; 178 unsigned int cpu=dev->id;
@@ -209,14 +209,14 @@ define_one_ro(capabilities);
209define_one_ro(resources); 209define_one_ro(resources);
210 210
211static struct attribute *default_attrs[] = { 211static struct attribute *default_attrs[] = {
212 &dev_attr_call_start.attr, 212 &attr_call_start.attr,
213 &dev_attr_virtual_to_phys.attr, 213 &attr_virtual_to_phys.attr,
214 &dev_attr_err_type_info.attr, 214 &attr_err_type_info.attr,
215 &dev_attr_err_struct_info.attr, 215 &attr_err_struct_info.attr,
216 &dev_attr_err_data_buffer.attr, 216 &attr_err_data_buffer.attr,
217 &dev_attr_status.attr, 217 &attr_status.attr,
218 &dev_attr_capabilities.attr, 218 &attr_capabilities.attr,
219 &dev_attr_resources.attr, 219 &attr_resources.attr,
220 NULL 220 NULL
221}; 221};
222 222
@@ -225,12 +225,12 @@ static struct attribute_group err_inject_attr_group = {
225 .name = "err_inject" 225 .name = "err_inject"
226}; 226};
227/* Add/Remove err_inject interface for CPU device */ 227/* Add/Remove err_inject interface for CPU device */
228static int __cpuinit err_inject_add_dev(struct device * sys_dev) 228static int __cpuinit err_inject_add_dev(struct sys_device * sys_dev)
229{ 229{
230 return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group); 230 return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group);
231} 231}
232 232
233static int __cpuinit err_inject_remove_dev(struct device * sys_dev) 233static int __cpuinit err_inject_remove_dev(struct sys_device * sys_dev)
234{ 234{
235 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); 235 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
236 return 0; 236 return 0;
@@ -239,9 +239,9 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb,
239 unsigned long action, void *hcpu) 239 unsigned long action, void *hcpu)
240{ 240{
241 unsigned int cpu = (unsigned long)hcpu; 241 unsigned int cpu = (unsigned long)hcpu;
242 struct device *sys_dev; 242 struct sys_device *sys_dev;
243 243
244 sys_dev = get_cpu_device(cpu); 244 sys_dev = get_cpu_sysdev(cpu);
245 switch (action) { 245 switch (action) {
246 case CPU_ONLINE: 246 case CPU_ONLINE:
247 case CPU_ONLINE_FROZEN: 247 case CPU_ONLINE_FROZEN:
@@ -283,13 +283,13 @@ static void __exit
283err_inject_exit(void) 283err_inject_exit(void)
284{ 284{
285 int i; 285 int i;
286 struct device *sys_dev; 286 struct sys_device *sys_dev;
287 287
288#ifdef ERR_INJ_DEBUG 288#ifdef ERR_INJ_DEBUG
289 printk(KERN_INFO "Exit error injection driver.\n"); 289 printk(KERN_INFO "Exit error injection driver.\n");
290#endif 290#endif
291 for_each_online_cpu(i) { 291 for_each_online_cpu(i) {
292 sys_dev = get_cpu_device(i); 292 sys_dev = get_cpu_sysdev(i);
293 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); 293 sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
294 } 294 }
295 unregister_hotcpu_notifier(&err_inject_cpu_notifier); 295 unregister_hotcpu_notifier(&err_inject_cpu_notifier);
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index e662f178b99..331d42bda77 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -21,6 +21,7 @@
21#include <asm/thread_info.h> 21#include <asm/thread_info.h>
22#include <asm/sal.h> 22#include <asm/sal.h>
23#include <asm/signal.h> 23#include <asm/signal.h>
24#include <asm/system.h>
24#include <asm/unistd.h> 25#include <asm/unistd.h>
25 26
26#include "entry.h" 27#include "entry.h"
@@ -173,7 +174,7 @@ ENTRY(fsys_set_tid_address)
173 FSYS_RETURN 174 FSYS_RETURN
174END(fsys_set_tid_address) 175END(fsys_set_tid_address)
175 176
176#if IA64_GTOD_SEQ_OFFSET !=0 177#if IA64_GTOD_LOCK_OFFSET !=0
177#error fsys_gettimeofday incompatible with changes to struct fsyscall_gtod_data_t 178#error fsys_gettimeofday incompatible with changes to struct fsyscall_gtod_data_t
178#endif 179#endif
179#if IA64_ITC_JITTER_OFFSET !=0 180#if IA64_ITC_JITTER_OFFSET !=0
@@ -372,6 +373,175 @@ ENTRY(fsys_clock_gettime)
372END(fsys_clock_gettime) 373END(fsys_clock_gettime)
373 374
374/* 375/*
376 * long fsys_rt_sigprocmask (int how, sigset_t *set, sigset_t *oset, size_t sigsetsize).
377 */
378#if _NSIG_WORDS != 1
379# error Sorry, fsys_rt_sigprocmask() needs to be updated for _NSIG_WORDS != 1.
380#endif
381ENTRY(fsys_rt_sigprocmask)
382 .prologue
383 .altrp b6
384 .body
385
386 add r2=IA64_TASK_BLOCKED_OFFSET,r16
387 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
388 cmp4.ltu p6,p0=SIG_SETMASK,r32
389
390 cmp.ne p15,p0=r0,r34 // oset != NULL?
391 tnat.nz p8,p0=r34
392 add r31=IA64_TASK_SIGHAND_OFFSET,r16
393 ;;
394 ld8 r3=[r2] // read/prefetch current->blocked
395 ld4 r9=[r9]
396 tnat.nz.or p6,p0=r35
397
398 cmp.ne.or p6,p0=_NSIG_WORDS*8,r35
399 tnat.nz.or p6,p0=r32
400(p6) br.spnt.few .fail_einval // fail with EINVAL
401 ;;
402#ifdef CONFIG_SMP
403 ld8 r31=[r31] // r31 <- current->sighand
404#endif
405 and r9=TIF_ALLWORK_MASK,r9
406 tnat.nz.or p8,p0=r33
407 ;;
408 cmp.ne p7,p0=0,r9
409 cmp.eq p6,p0=r0,r33 // set == NULL?
410 add r31=IA64_SIGHAND_SIGLOCK_OFFSET,r31 // r31 <- current->sighand->siglock
411(p8) br.spnt.few .fail_efault // fail with EFAULT
412(p7) br.spnt.many fsys_fallback_syscall // got pending kernel work...
413(p6) br.dpnt.many .store_mask // -> short-circuit to just reading the signal mask
414
415 /* Argh, we actually have to do some work and _update_ the signal mask: */
416
417EX(.fail_efault, probe.r.fault r33, 3) // verify user has read-access to *set
418EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set
419 mov r17=(1 << (SIGKILL - 1)) | (1 << (SIGSTOP - 1))
420 ;;
421
422 RSM_PSR_I(p0, r18, r19) // mask interrupt delivery
423 andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP
424 mov r8=EINVAL // default to EINVAL
425
426#ifdef CONFIG_SMP
427 // __ticket_spin_trylock(r31)
428 ld4 r17=[r31]
429 ;;
430 mov.m ar.ccv=r17
431 extr.u r9=r17,17,15
432 adds r19=1,r17
433 extr.u r18=r17,0,15
434 ;;
435 cmp.eq p6,p7=r9,r18
436 ;;
437(p6) cmpxchg4.acq r9=[r31],r19,ar.ccv
438(p6) dep.z r20=r19,1,15 // next serving ticket for unlock
439(p7) br.cond.spnt.many .lock_contention
440 ;;
441 cmp4.eq p0,p7=r9,r17
442 adds r31=2,r31
443(p7) br.cond.spnt.many .lock_contention
444 ld8 r3=[r2] // re-read current->blocked now that we hold the lock
445 ;;
446#else
447 ld8 r3=[r2] // re-read current->blocked now that we hold the lock
448#endif
449 add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16
450 add r19=IA64_TASK_SIGNAL_OFFSET,r16
451 cmp4.eq p6,p0=SIG_BLOCK,r32
452 ;;
453 ld8 r19=[r19] // r19 <- current->signal
454 cmp4.eq p7,p0=SIG_UNBLOCK,r32
455 cmp4.eq p8,p0=SIG_SETMASK,r32
456 ;;
457 ld8 r18=[r18] // r18 <- current->pending.signal
458 .pred.rel.mutex p6,p7,p8
459(p6) or r14=r3,r14 // SIG_BLOCK
460(p7) andcm r14=r3,r14 // SIG_UNBLOCK
461
462(p8) mov r14=r14 // SIG_SETMASK
463(p6) mov r8=0 // clear error code
464 // recalc_sigpending()
465 add r17=IA64_SIGNAL_GROUP_STOP_COUNT_OFFSET,r19
466
467 add r19=IA64_SIGNAL_SHARED_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r19
468 ;;
469 ld4 r17=[r17] // r17 <- current->signal->group_stop_count
470(p7) mov r8=0 // clear error code
471
472 ld8 r19=[r19] // r19 <- current->signal->shared_pending
473 ;;
474 cmp4.gt p6,p7=r17,r0 // p6/p7 <- (current->signal->group_stop_count > 0)?
475(p8) mov r8=0 // clear error code
476
477 or r18=r18,r19 // r18 <- current->pending | current->signal->shared_pending
478 ;;
479 // r18 <- (current->pending | current->signal->shared_pending) & ~current->blocked:
480 andcm r18=r18,r14
481 add r9=TI_FLAGS+IA64_TASK_SIZE,r16
482 ;;
483
484(p7) cmp.ne.or.andcm p6,p7=r18,r0 // p6/p7 <- signal pending
485 mov r19=0 // i must not leak kernel bits...
486(p6) br.cond.dpnt.many .sig_pending
487 ;;
488
4891: ld4 r17=[r9] // r17 <- current->thread_info->flags
490 ;;
491 mov ar.ccv=r17
492 and r18=~_TIF_SIGPENDING,r17 // r18 <- r17 & ~(1 << TIF_SIGPENDING)
493 ;;
494
495 st8 [r2]=r14 // update current->blocked with new mask
496 cmpxchg4.acq r8=[r9],r18,ar.ccv // current->thread_info->flags <- r18
497 ;;
498 cmp.ne p6,p0=r17,r8 // update failed?
499(p6) br.cond.spnt.few 1b // yes -> retry
500
501#ifdef CONFIG_SMP
502 // __ticket_spin_unlock(r31)
503 st2.rel [r31]=r20
504 mov r20=0 // i must not leak kernel bits...
505#endif
506 SSM_PSR_I(p0, p9, r31)
507 ;;
508
509 srlz.d // ensure psr.i is set again
510 mov r18=0 // i must not leak kernel bits...
511
512.store_mask:
513EX(.fail_efault, (p15) probe.w.fault r34, 3) // verify user has write-access to *oset
514EX(.fail_efault, (p15) st8 [r34]=r3)
515 mov r2=0 // i must not leak kernel bits...
516 mov r3=0 // i must not leak kernel bits...
517 mov r8=0 // return 0
518 mov r9=0 // i must not leak kernel bits...
519 mov r14=0 // i must not leak kernel bits...
520 mov r17=0 // i must not leak kernel bits...
521 mov r31=0 // i must not leak kernel bits...
522 FSYS_RETURN
523
524.sig_pending:
525#ifdef CONFIG_SMP
526 // __ticket_spin_unlock(r31)
527 st2.rel [r31]=r20 // release the lock
528#endif
529 SSM_PSR_I(p0, p9, r17)
530 ;;
531 srlz.d
532 br.sptk.many fsys_fallback_syscall // with signal pending, do the heavy-weight syscall
533
534#ifdef CONFIG_SMP
535.lock_contention:
536 /* Rather than spinning here, fall back on doing a heavy-weight syscall. */
537 SSM_PSR_I(p0, p9, r17)
538 ;;
539 srlz.d
540 br.sptk.many fsys_fallback_syscall
541#endif
542END(fsys_rt_sigprocmask)
543
544/*
375 * fsys_getcpu doesn't use the third parameter in this implementation. It reads 545 * fsys_getcpu doesn't use the third parameter in this implementation. It reads
376 * current_thread_info()->cpu and corresponding node in cpu_to_node_map. 546 * current_thread_info()->cpu and corresponding node in cpu_to_node_map.
377 */ 547 */
@@ -390,15 +560,11 @@ ENTRY(fsys_getcpu)
390 ;; 560 ;;
391 tnat.nz p7,p0 = r33 // I guard against NaT argument 561 tnat.nz p7,p0 = r33 // I guard against NaT argument
392(p7) br.cond.spnt.few .fail_einval // B 562(p7) br.cond.spnt.few .fail_einval // B
393 ;;
394 cmp.ne p6,p0=r32,r0
395 cmp.ne p7,p0=r33,r0
396 ;;
397#ifdef CONFIG_NUMA 563#ifdef CONFIG_NUMA
398 movl r17=cpu_to_node_map 564 movl r17=cpu_to_node_map
399 ;; 565 ;;
400EX(.fail_efault, (p6) probe.w.fault r32, 3) // M This takes 5 cycles 566EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles
401EX(.fail_efault, (p7) probe.w.fault r33, 3) // M This takes 5 cycles 567EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles
402 shladd r18=r3,1,r17 568 shladd r18=r3,1,r17
403 ;; 569 ;;
404 ld2 r20=[r18] // r20 = cpu_to_node_map[cpu] 570 ld2 r20=[r18] // r20 = cpu_to_node_map[cpu]
@@ -408,20 +574,20 @@ EX(.fail_efault, (p7) probe.w.fault r33, 3) // M This takes 5 cycles
408(p8) br.spnt.many fsys_fallback_syscall 574(p8) br.spnt.many fsys_fallback_syscall
409 ;; 575 ;;
410 ;; 576 ;;
411EX(.fail_efault, (p6) st4 [r32] = r3) 577EX(.fail_efault, st4 [r32] = r3)
412EX(.fail_efault, (p7) st2 [r33] = r20) 578EX(.fail_efault, st2 [r33] = r20)
413 mov r8=0 579 mov r8=0
414 ;; 580 ;;
415#else 581#else
416EX(.fail_efault, (p6) probe.w.fault r32, 3) // M This takes 5 cycles 582EX(.fail_efault, probe.w.fault r32, 3) // M This takes 5 cycles
417EX(.fail_efault, (p7) probe.w.fault r33, 3) // M This takes 5 cycles 583EX(.fail_efault, probe.w.fault r33, 3) // M This takes 5 cycles
418 and r2 = TIF_ALLWORK_MASK,r2 584 and r2 = TIF_ALLWORK_MASK,r2
419 ;; 585 ;;
420 cmp.ne p8,p0=0,r2 586 cmp.ne p8,p0=0,r2
421(p8) br.spnt.many fsys_fallback_syscall 587(p8) br.spnt.many fsys_fallback_syscall
422 ;; 588 ;;
423EX(.fail_efault, (p6) st4 [r32] = r3) 589EX(.fail_efault, st4 [r32] = r3)
424EX(.fail_efault, (p7) st2 [r33] = r0) 590EX(.fail_efault, st2 [r33] = r0)
425 mov r8=0 591 mov r8=0
426 ;; 592 ;;
427#endif 593#endif
@@ -751,7 +917,7 @@ paravirt_fsyscall_table:
751 data8 0 // sigaltstack 917 data8 0 // sigaltstack
752 data8 0 // rt_sigaction 918 data8 0 // rt_sigaction
753 data8 0 // rt_sigpending 919 data8 0 // rt_sigpending
754 data8 0 // rt_sigprocmask 920 data8 fsys_rt_sigprocmask // rt_sigprocmask
755 data8 0 // rt_sigqueueinfo // 1180 921 data8 0 // rt_sigqueueinfo // 1180
756 data8 0 // rt_sigreturn 922 data8 0 // rt_sigreturn
757 data8 0 // rt_sigsuspend 923 data8 0 // rt_sigsuspend
diff --git a/arch/ia64/kernel/fsyscall_gtod_data.h b/arch/ia64/kernel/fsyscall_gtod_data.h
index 146b15b5fec..57d2ee6c83e 100644
--- a/arch/ia64/kernel/fsyscall_gtod_data.h
+++ b/arch/ia64/kernel/fsyscall_gtod_data.h
@@ -6,7 +6,7 @@
6 */ 6 */
7 7
8struct fsyscall_gtod_data_t { 8struct fsyscall_gtod_data_t {
9 seqcount_t seq; 9 seqlock_t lock;
10 struct timespec wall_time; 10 struct timespec wall_time;
11 struct timespec monotonic_time; 11 struct timespec monotonic_time;
12 cycle_t clk_mask; 12 cycle_t clk_mask;
diff --git a/arch/ia64/kernel/gate.S b/arch/ia64/kernel/gate.S
index b5f8bdd8618..245d3e1ec7e 100644
--- a/arch/ia64/kernel/gate.S
+++ b/arch/ia64/kernel/gate.S
@@ -11,9 +11,8 @@
11#include <asm/errno.h> 11#include <asm/errno.h>
12#include <asm/asm-offsets.h> 12#include <asm/asm-offsets.h>
13#include <asm/sigcontext.h> 13#include <asm/sigcontext.h>
14#include <asm/system.h>
14#include <asm/unistd.h> 15#include <asm/unistd.h>
15#include <asm/kregs.h>
16#include <asm/page.h>
17#include "paravirt_inst.h" 16#include "paravirt_inst.h"
18 17
19/* 18/*
diff --git a/arch/ia64/kernel/gate.lds.S b/arch/ia64/kernel/gate.lds.S
index e518f7902af..d32b0855110 100644
--- a/arch/ia64/kernel/gate.lds.S
+++ b/arch/ia64/kernel/gate.lds.S
@@ -5,7 +5,8 @@
5 * its layout. 5 * its layout.
6 */ 6 */
7 7
8#include <asm/page.h> 8
9#include <asm/system.h>
9#include "paravirt_patchlist.h" 10#include "paravirt_patchlist.h"
10 11
11SECTIONS 12SECTIONS
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 4738ff7bd66..17a9fba3893 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -30,6 +30,7 @@
30#include <asm/pgtable.h> 30#include <asm/pgtable.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
32#include <asm/ptrace.h> 32#include <asm/ptrace.h>
33#include <asm/system.h>
33#include <asm/mca_asm.h> 34#include <asm/mca_asm.h>
34#include <linux/init.h> 35#include <linux/init.h>
35#include <linux/linkage.h> 36#include <linux/linkage.h>
@@ -1093,6 +1094,19 @@ GLOBAL_ENTRY(cycle_to_cputime)
1093END(cycle_to_cputime) 1094END(cycle_to_cputime)
1094#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ 1095#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
1095 1096
1097GLOBAL_ENTRY(start_kernel_thread)
1098 .prologue
1099 .save rp, r0 // this is the end of the call-chain
1100 .body
1101 alloc r2 = ar.pfs, 0, 0, 2, 0
1102 mov out0 = r9
1103 mov out1 = r11;;
1104 br.call.sptk.many rp = kernel_thread_helper;;
1105 mov out0 = r8
1106 br.call.sptk.many rp = sys_exit;;
11071: br.sptk.few 1b // not reached
1108END(start_kernel_thread)
1109
1096#ifdef CONFIG_IA64_BRL_EMU 1110#ifdef CONFIG_IA64_BRL_EMU
1097 1111
1098/* 1112/*
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
index 5b7791dd396..7f4a0ed2415 100644
--- a/arch/ia64/kernel/ia64_ksyms.c
+++ b/arch/ia64/kernel/ia64_ksyms.c
@@ -12,7 +12,7 @@ EXPORT_SYMBOL(memset);
12EXPORT_SYMBOL(memcpy); 12EXPORT_SYMBOL(memcpy);
13EXPORT_SYMBOL(strlen); 13EXPORT_SYMBOL(strlen);
14 14
15#include <asm/pgtable.h> 15#include<asm/pgtable.h>
16EXPORT_SYMBOL_GPL(empty_zero_page); 16EXPORT_SYMBOL_GPL(empty_zero_page);
17 17
18#include <asm/checksum.h> 18#include <asm/checksum.h>
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index ee33c3aaa2f..b0f9afebb14 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -98,6 +98,7 @@
98#include <asm/machvec.h> 98#include <asm/machvec.h>
99#include <asm/processor.h> 99#include <asm/processor.h>
100#include <asm/ptrace.h> 100#include <asm/ptrace.h>
101#include <asm/system.h>
101 102
102#undef DEBUG_INTERRUPT_ROUTING 103#undef DEBUG_INTERRUPT_ROUTING
103 104
@@ -147,7 +148,7 @@ static struct iosapic_intr_info {
147 unsigned char trigger : 1; /* trigger mode (see iosapic.h) */ 148 unsigned char trigger : 1; /* trigger mode (see iosapic.h) */
148} iosapic_intr_info[NR_IRQS]; 149} iosapic_intr_info[NR_IRQS];
149 150
150static unsigned char pcat_compat; /* 8259 compatibility flag */ 151static unsigned char pcat_compat __devinitdata; /* 8259 compatibility flag */
151 152
152static inline void 153static inline void
153iosapic_write(struct iosapic *iosapic, unsigned int reg, u32 val) 154iosapic_write(struct iosapic *iosapic, unsigned int reg, u32 val)
@@ -914,8 +915,10 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi,
914/* 915/*
915 * ACPI calls this when it finds an entry for a legacy ISA IRQ override. 916 * ACPI calls this when it finds an entry for a legacy ISA IRQ override.
916 */ 917 */
917void iosapic_override_isa_irq(unsigned int isa_irq, unsigned int gsi, 918void __devinit
918 unsigned long polarity, unsigned long trigger) 919iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
920 unsigned long polarity,
921 unsigned long trigger)
919{ 922{
920 int vector, irq; 923 int vector, irq;
921 unsigned int dest = cpu_physical_id(smp_processor_id()); 924 unsigned int dest = cpu_physical_id(smp_processor_id());
@@ -1010,7 +1013,8 @@ iosapic_check_gsi_range (unsigned int gsi_base, unsigned int ver)
1010 return 0; 1013 return 0;
1011} 1014}
1012 1015
1013int iosapic_init(unsigned long phys_addr, unsigned int gsi_base) 1016int __devinit
1017iosapic_init (unsigned long phys_addr, unsigned int gsi_base)
1014{ 1018{
1015 int num_rte, err, index; 1019 int num_rte, err, index;
1016 unsigned int isa_irq, ver; 1020 unsigned int isa_irq, ver;
@@ -1067,7 +1071,9 @@ int iosapic_init(unsigned long phys_addr, unsigned int gsi_base)
1067 return 0; 1071 return 0;
1068} 1072}
1069 1073
1070int iosapic_remove(unsigned int gsi_base) 1074#ifdef CONFIG_HOTPLUG
1075int
1076iosapic_remove (unsigned int gsi_base)
1071{ 1077{
1072 int index, err = 0; 1078 int index, err = 0;
1073 unsigned long flags; 1079 unsigned long flags;
@@ -1093,9 +1099,11 @@ int iosapic_remove(unsigned int gsi_base)
1093 spin_unlock_irqrestore(&iosapic_lock, flags); 1099 spin_unlock_irqrestore(&iosapic_lock, flags);
1094 return err; 1100 return err;
1095} 1101}
1102#endif /* CONFIG_HOTPLUG */
1096 1103
1097#ifdef CONFIG_NUMA 1104#ifdef CONFIG_NUMA
1098void map_iosapic_to_node(unsigned int gsi_base, int node) 1105void __devinit
1106map_iosapic_to_node(unsigned int gsi_base, int node)
1099{ 1107{
1100 int index; 1108 int index;
1101 1109
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 1034884b77d..782c3a357f2 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -23,6 +23,7 @@
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/kernel_stat.h> 24#include <linux/kernel_stat.h>
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/random.h> /* for rand_initialize_irq() */
26#include <linux/signal.h> 27#include <linux/signal.h>
27#include <linux/smp.h> 28#include <linux/smp.h>
28#include <linux/threads.h> 29#include <linux/threads.h>
@@ -38,6 +39,7 @@
38#include <asm/hw_irq.h> 39#include <asm/hw_irq.h>
39#include <asm/machvec.h> 40#include <asm/machvec.h>
40#include <asm/pgtable.h> 41#include <asm/pgtable.h>
42#include <asm/system.h>
41#include <asm/tlbflush.h> 43#include <asm/tlbflush.h>
42 44
43#ifdef CONFIG_PERFMON 45#ifdef CONFIG_PERFMON
@@ -116,7 +118,7 @@ static inline int find_unassigned_vector(cpumask_t domain)
116 cpumask_t mask; 118 cpumask_t mask;
117 int pos, vector; 119 int pos, vector;
118 120
119 cpumask_and(&mask, &domain, cpu_online_mask); 121 cpus_and(mask, domain, cpu_online_map);
120 if (cpus_empty(mask)) 122 if (cpus_empty(mask))
121 return -EINVAL; 123 return -EINVAL;
122 124
@@ -139,7 +141,7 @@ static int __bind_irq_vector(int irq, int vector, cpumask_t domain)
139 BUG_ON((unsigned)irq >= NR_IRQS); 141 BUG_ON((unsigned)irq >= NR_IRQS);
140 BUG_ON((unsigned)vector >= IA64_NUM_VECTORS); 142 BUG_ON((unsigned)vector >= IA64_NUM_VECTORS);
141 143
142 cpumask_and(&mask, &domain, cpu_online_mask); 144 cpus_and(mask, domain, cpu_online_map);
143 if (cpus_empty(mask)) 145 if (cpus_empty(mask))
144 return -EINVAL; 146 return -EINVAL;
145 if ((cfg->vector == vector) && cpus_equal(cfg->domain, domain)) 147 if ((cfg->vector == vector) && cpus_equal(cfg->domain, domain))
@@ -177,7 +179,7 @@ static void __clear_irq_vector(int irq)
177 BUG_ON(cfg->vector == IRQ_VECTOR_UNASSIGNED); 179 BUG_ON(cfg->vector == IRQ_VECTOR_UNASSIGNED);
178 vector = cfg->vector; 180 vector = cfg->vector;
179 domain = cfg->domain; 181 domain = cfg->domain;
180 cpumask_and(&mask, &cfg->domain, cpu_online_mask); 182 cpus_and(mask, cfg->domain, cpu_online_map);
181 for_each_cpu_mask(cpu, mask) 183 for_each_cpu_mask(cpu, mask)
182 per_cpu(vector_irq, cpu)[vector] = -1; 184 per_cpu(vector_irq, cpu)[vector] = -1;
183 cfg->vector = IRQ_VECTOR_UNASSIGNED; 185 cfg->vector = IRQ_VECTOR_UNASSIGNED;
@@ -320,7 +322,7 @@ void irq_complete_move(unsigned irq)
320 if (unlikely(cpu_isset(smp_processor_id(), cfg->old_domain))) 322 if (unlikely(cpu_isset(smp_processor_id(), cfg->old_domain)))
321 return; 323 return;
322 324
323 cpumask_and(&cleanup_mask, &cfg->old_domain, cpu_online_mask); 325 cpus_and(cleanup_mask, cfg->old_domain, cpu_online_map);
324 cfg->move_cleanup_count = cpus_weight(cleanup_mask); 326 cfg->move_cleanup_count = cpus_weight(cleanup_mask);
325 for_each_cpu_mask(i, cleanup_mask) 327 for_each_cpu_mask(i, cleanup_mask)
326 platform_send_ipi(i, IA64_IRQ_MOVE_VECTOR, IA64_IPI_DM_INT, 0); 328 platform_send_ipi(i, IA64_IRQ_MOVE_VECTOR, IA64_IPI_DM_INT, 0);
diff --git a/arch/ia64/kernel/ivt.S b/arch/ia64/kernel/ivt.S
index fa25689fc45..d93e396bf59 100644
--- a/arch/ia64/kernel/ivt.S
+++ b/arch/ia64/kernel/ivt.S
@@ -54,6 +54,7 @@
54#include <asm/pgtable.h> 54#include <asm/pgtable.h>
55#include <asm/processor.h> 55#include <asm/processor.h>
56#include <asm/ptrace.h> 56#include <asm/ptrace.h>
57#include <asm/system.h>
57#include <asm/thread_info.h> 58#include <asm/thread_info.h>
58#include <asm/unistd.h> 59#include <asm/unistd.h>
59#include <asm/errno.h> 60#include <asm/errno.h>
diff --git a/arch/ia64/kernel/machine_kexec.c b/arch/ia64/kernel/machine_kexec.c
index 5151a649c96..3d3aeef4694 100644
--- a/arch/ia64/kernel/machine_kexec.c
+++ b/arch/ia64/kernel/machine_kexec.c
@@ -27,11 +27,11 @@
27#include <asm/sal.h> 27#include <asm/sal.h>
28#include <asm/mca.h> 28#include <asm/mca.h>
29 29
30typedef void (*relocate_new_kernel_t)( 30typedef NORET_TYPE void (*relocate_new_kernel_t)(
31 unsigned long indirection_page, 31 unsigned long indirection_page,
32 unsigned long start_address, 32 unsigned long start_address,
33 struct ia64_boot_param *boot_param, 33 struct ia64_boot_param *boot_param,
34 unsigned long pal_addr) __noreturn; 34 unsigned long pal_addr) ATTRIB_NORET;
35 35
36struct kimage *ia64_kimage; 36struct kimage *ia64_kimage;
37 37
@@ -85,13 +85,12 @@ static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)
85 struct kimage *image = arg; 85 struct kimage *image = arg;
86 relocate_new_kernel_t rnk; 86 relocate_new_kernel_t rnk;
87 void *pal_addr = efi_get_pal_addr(); 87 void *pal_addr = efi_get_pal_addr();
88 unsigned long code_addr; 88 unsigned long code_addr = (unsigned long)page_address(image->control_code_page);
89 int ii; 89 int ii;
90 u64 fp, gp; 90 u64 fp, gp;
91 ia64_fptr_t *init_handler = (ia64_fptr_t *)ia64_os_init_on_kdump; 91 ia64_fptr_t *init_handler = (ia64_fptr_t *)ia64_os_init_on_kdump;
92 92
93 BUG_ON(!image); 93 BUG_ON(!image);
94 code_addr = (unsigned long)page_address(image->control_code_page);
95 if (image->type == KEXEC_TYPE_CRASH) { 94 if (image->type == KEXEC_TYPE_CRASH) {
96 crash_save_this_cpu(); 95 crash_save_this_cpu();
97 current->thread.ksp = (__u64)info->sw - 16; 96 current->thread.ksp = (__u64)info->sw - 16;
@@ -158,7 +157,7 @@ void arch_crash_save_vmcoreinfo(void)
158#endif 157#endif
159#ifdef CONFIG_PGTABLE_3 158#ifdef CONFIG_PGTABLE_3
160 VMCOREINFO_CONFIG(PGTABLE_3); 159 VMCOREINFO_CONFIG(PGTABLE_3);
161#elif defined(CONFIG_PGTABLE_4) 160#elif CONFIG_PGTABLE_4
162 VMCOREINFO_CONFIG(PGTABLE_4); 161 VMCOREINFO_CONFIG(PGTABLE_4);
163#endif 162#endif
164} 163}
diff --git a/arch/ia64/kernel/machvec.c b/arch/ia64/kernel/machvec.c
index f5a1e5246b3..d41a40ef80c 100644
--- a/arch/ia64/kernel/machvec.c
+++ b/arch/ia64/kernel/machvec.c
@@ -1,6 +1,7 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/dma-mapping.h> 2#include <linux/dma-mapping.h>
3#include <asm/machvec.h> 3#include <asm/machvec.h>
4#include <asm/system.h>
4 5
5#ifdef CONFIG_IA64_GENERIC 6#ifdef CONFIG_IA64_GENERIC
6 7
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 65bf9cd3904..84fb405eee8 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -92,6 +92,7 @@
92#include <asm/meminit.h> 92#include <asm/meminit.h>
93#include <asm/page.h> 93#include <asm/page.h>
94#include <asm/ptrace.h> 94#include <asm/ptrace.h>
95#include <asm/system.h>
95#include <asm/sal.h> 96#include <asm/sal.h>
96#include <asm/mca.h> 97#include <asm/mca.h>
97#include <asm/kexec.h> 98#include <asm/kexec.h>
@@ -1446,8 +1447,6 @@ out:
1446 /* Get the CMC error record and log it */ 1447 /* Get the CMC error record and log it */
1447 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC); 1448 ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CMC);
1448 1449
1449 local_irq_disable();
1450
1451 return IRQ_HANDLED; 1450 return IRQ_HANDLED;
1452} 1451}
1453 1452
@@ -1514,8 +1513,7 @@ static void
1514ia64_mca_cmc_poll (unsigned long dummy) 1513ia64_mca_cmc_poll (unsigned long dummy)
1515{ 1514{
1516 /* Trigger a CMC interrupt cascade */ 1515 /* Trigger a CMC interrupt cascade */
1517 platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CMCP_VECTOR, 1516 platform_send_ipi(first_cpu(cpu_online_map), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
1518 IA64_IPI_DM_INT, 0);
1519} 1517}
1520 1518
1521/* 1519/*
@@ -1591,8 +1589,7 @@ static void
1591ia64_mca_cpe_poll (unsigned long dummy) 1589ia64_mca_cpe_poll (unsigned long dummy)
1592{ 1590{
1593 /* Trigger a CPE interrupt cascade */ 1591 /* Trigger a CPE interrupt cascade */
1594 platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CPEP_VECTOR, 1592 platform_send_ipi(first_cpu(cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
1595 IA64_IPI_DM_INT, 0);
1596} 1593}
1597 1594
1598#endif /* CONFIG_ACPI */ 1595#endif /* CONFIG_ACPI */
diff --git a/arch/ia64/kernel/mca_drv.c b/arch/ia64/kernel/mca_drv.c
index 9392e021c93..09b4d6828c4 100644
--- a/arch/ia64/kernel/mca_drv.c
+++ b/arch/ia64/kernel/mca_drv.c
@@ -28,6 +28,7 @@
28#include <asm/machvec.h> 28#include <asm/machvec.h>
29#include <asm/page.h> 29#include <asm/page.h>
30#include <asm/ptrace.h> 30#include <asm/ptrace.h>
31#include <asm/system.h>
31#include <asm/sal.h> 32#include <asm/sal.h>
32#include <asm/mca.h> 33#include <asm/mca.h>
33 34
@@ -158,8 +159,7 @@ mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)
158 ia64_mlogbuf_dump(); 159 ia64_mlogbuf_dump();
159 printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " 160 printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, "
160 "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", 161 "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n",
161 raw_smp_processor_id(), current->pid, 162 raw_smp_processor_id(), current->pid, current_uid(),
162 from_kuid(&init_user_ns, current_uid()),
163 iip, ipsr, paddr, current->comm); 163 iip, ipsr, paddr, current->comm);
164 164
165 spin_lock(&mca_bh_lock); 165 spin_lock(&mca_bh_lock);
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index fb2f1e62287..94e0db72d4a 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -57,7 +57,7 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
57 return irq; 57 return irq;
58 58
59 irq_set_msi_desc(irq, desc); 59 irq_set_msi_desc(irq, desc);
60 cpumask_and(&mask, &(irq_to_domain(irq)), cpu_online_mask); 60 cpus_and(mask, irq_to_domain(irq), cpu_online_map);
61 dest_phys_id = cpu_physical_id(first_cpu(mask)); 61 dest_phys_id = cpu_physical_id(first_cpu(mask));
62 vector = irq_to_vector(irq); 62 vector = irq_to_vector(irq);
63 63
@@ -179,7 +179,7 @@ msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
179 unsigned dest; 179 unsigned dest;
180 cpumask_t mask; 180 cpumask_t mask;
181 181
182 cpumask_and(&mask, &(irq_to_domain(irq)), cpu_online_mask); 182 cpus_and(mask, irq_to_domain(irq), cpu_online_map);
183 dest = cpu_physical_id(first_cpu(mask)); 183 dest = cpu_physical_id(first_cpu(mask));
184 184
185 msg->address_hi = 0; 185 msg->address_hi = 0;
diff --git a/arch/ia64/kernel/paravirt.c b/arch/ia64/kernel/paravirt.c
index 1b22f6de293..100868216c5 100644
--- a/arch/ia64/kernel/paravirt.c
+++ b/arch/ia64/kernel/paravirt.c
@@ -634,8 +634,8 @@ struct pv_irq_ops pv_irq_ops = {
634 * pv_time_ops 634 * pv_time_ops
635 * time operations 635 * time operations
636 */ 636 */
637struct static_key paravirt_steal_enabled; 637struct jump_label_key paravirt_steal_enabled;
638struct static_key paravirt_steal_rq_enabled; 638struct jump_label_key paravirt_steal_rq_enabled;
639 639
640static int 640static int
641ia64_native_do_steal_accounting(unsigned long *new_itm) 641ia64_native_do_steal_accounting(unsigned long *new_itm)
diff --git a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
index 1cf09179371..68a1311db80 100644
--- a/arch/ia64/kernel/patch.c
+++ b/arch/ia64/kernel/patch.c
@@ -11,6 +11,7 @@
11#include <asm/patch.h> 11#include <asm/patch.h>
12#include <asm/processor.h> 12#include <asm/processor.h>
13#include <asm/sections.h> 13#include <asm/sections.h>
14#include <asm/system.h>
14#include <asm/unistd.h> 15#include <asm/unistd.h>
15 16
16/* 17/*
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index 1ddcfe5ef35..eb117572005 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -12,6 +12,7 @@
12#include <asm/machvec.h> 12#include <asm/machvec.h>
13#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
14 14
15#include <asm/system.h>
15 16
16#ifdef CONFIG_INTEL_IOMMU 17#ifdef CONFIG_INTEL_IOMMU
17 18
@@ -32,6 +33,7 @@ int force_iommu __read_mostly;
32#endif 33#endif
33 34
34int iommu_pass_through; 35int iommu_pass_through;
36int iommu_group_mf;
35 37
36/* Dummy device used for NULL arguments (normally ISA). Better would 38/* Dummy device used for NULL arguments (normally ISA). Better would
37 be probably a smaller DMA mask, but this is bug-to-bug compatible 39 be probably a smaller DMA mask, but this is bug-to-bug compatible
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c
index 939260aeac9..d9485d952ed 100644
--- a/arch/ia64/kernel/pci-swiotlb.c
+++ b/arch/ia64/kernel/pci-swiotlb.c
@@ -15,24 +15,16 @@ int swiotlb __read_mostly;
15EXPORT_SYMBOL(swiotlb); 15EXPORT_SYMBOL(swiotlb);
16 16
17static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, 17static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size,
18 dma_addr_t *dma_handle, gfp_t gfp, 18 dma_addr_t *dma_handle, gfp_t gfp)
19 struct dma_attrs *attrs)
20{ 19{
21 if (dev->coherent_dma_mask != DMA_BIT_MASK(64)) 20 if (dev->coherent_dma_mask != DMA_BIT_MASK(64))
22 gfp |= GFP_DMA; 21 gfp |= GFP_DMA;
23 return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); 22 return swiotlb_alloc_coherent(dev, size, dma_handle, gfp);
24} 23}
25 24
26static void ia64_swiotlb_free_coherent(struct device *dev, size_t size,
27 void *vaddr, dma_addr_t dma_addr,
28 struct dma_attrs *attrs)
29{
30 swiotlb_free_coherent(dev, size, vaddr, dma_addr);
31}
32
33struct dma_map_ops swiotlb_dma_ops = { 25struct dma_map_ops swiotlb_dma_ops = {
34 .alloc = ia64_swiotlb_alloc_coherent, 26 .alloc_coherent = ia64_swiotlb_alloc_coherent,
35 .free = ia64_swiotlb_free_coherent, 27 .free_coherent = swiotlb_free_coherent,
36 .map_page = swiotlb_map_page, 28 .map_page = swiotlb_map_page,
37 .unmap_page = swiotlb_unmap_page, 29 .unmap_page = swiotlb_unmap_page,
38 .map_sg = swiotlb_map_sg_attrs, 30 .map_sg = swiotlb_map_sg_attrs,
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index ea39eba61ef..89accc626b8 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -49,6 +49,7 @@
49#include <asm/perfmon.h> 49#include <asm/perfmon.h>
50#include <asm/processor.h> 50#include <asm/processor.h>
51#include <asm/signal.h> 51#include <asm/signal.h>
52#include <asm/system.h>
52#include <asm/uaccess.h> 53#include <asm/uaccess.h>
53#include <asm/delay.h> 54#include <asm/delay.h>
54 55
@@ -604,6 +605,18 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)
604 spin_unlock(&(x)->ctx_lock); 605 spin_unlock(&(x)->ctx_lock);
605} 606}
606 607
608static inline unsigned int
609pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct)
610{
611 return do_munmap(mm, addr, len);
612}
613
614static inline unsigned long
615pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec)
616{
617 return get_unmapped_area(file, addr, len, pgoff, flags);
618}
619
607/* forward declaration */ 620/* forward declaration */
608static const struct dentry_operations pfmfs_dentry_operations; 621static const struct dentry_operations pfmfs_dentry_operations;
609 622
@@ -1446,9 +1459,8 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
1446 * a PROTECT_CTX() section. 1459 * a PROTECT_CTX() section.
1447 */ 1460 */
1448static int 1461static int
1449pfm_remove_smpl_mapping(void *vaddr, unsigned long size) 1462pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size)
1450{ 1463{
1451 struct task_struct *task = current;
1452 int r; 1464 int r;
1453 1465
1454 /* sanity checks */ 1466 /* sanity checks */
@@ -1462,8 +1474,13 @@ pfm_remove_smpl_mapping(void *vaddr, unsigned long size)
1462 /* 1474 /*
1463 * does the actual unmapping 1475 * does the actual unmapping
1464 */ 1476 */
1465 r = vm_munmap((unsigned long)vaddr, size); 1477 down_write(&task->mm->mmap_sem);
1478
1479 DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size));
1480
1481 r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0);
1466 1482
1483 up_write(&task->mm->mmap_sem);
1467 if (r !=0) { 1484 if (r !=0) {
1468 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); 1485 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size);
1469 } 1486 }
@@ -1929,7 +1946,7 @@ pfm_flush(struct file *filp, fl_owner_t id)
1929 * because some VM function reenables interrupts. 1946 * because some VM function reenables interrupts.
1930 * 1947 *
1931 */ 1948 */
1932 if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size); 1949 if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size);
1933 1950
1934 return 0; 1951 return 0;
1935} 1952}
@@ -2211,7 +2228,7 @@ pfm_alloc_file(pfm_context_t *ctx)
2211 /* 2228 /*
2212 * allocate a new dcache entry 2229 * allocate a new dcache entry
2213 */ 2230 */
2214 path.dentry = d_alloc(pfmfs_mnt->mnt_root, &this); 2231 path.dentry = d_alloc(pfmfs_mnt->mnt_sb->s_root, &this);
2215 if (!path.dentry) { 2232 if (!path.dentry) {
2216 iput(inode); 2233 iput(inode);
2217 return ERR_PTR(-ENOMEM); 2234 return ERR_PTR(-ENOMEM);
@@ -2306,8 +2323,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
2306 * partially initialize the vma for the sampling buffer 2323 * partially initialize the vma for the sampling buffer
2307 */ 2324 */
2308 vma->vm_mm = mm; 2325 vma->vm_mm = mm;
2309 vma->vm_file = get_file(filp); 2326 vma->vm_file = filp;
2310 vma->vm_flags = VM_READ|VM_MAYREAD|VM_DONTEXPAND|VM_DONTDUMP; 2327 vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED;
2311 vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ 2328 vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */
2312 2329
2313 /* 2330 /*
@@ -2327,8 +2344,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
2327 down_write(&task->mm->mmap_sem); 2344 down_write(&task->mm->mmap_sem);
2328 2345
2329 /* find some free area in address space, must have mmap sem held */ 2346 /* find some free area in address space, must have mmap sem held */
2330 vma->vm_start = get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS); 2347 vma->vm_start = pfm_get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS, 0);
2331 if (IS_ERR_VALUE(vma->vm_start)) { 2348 if (vma->vm_start == 0UL) {
2332 DPRINT(("Cannot find unmapped area for size %ld\n", size)); 2349 DPRINT(("Cannot find unmapped area for size %ld\n", size));
2333 up_write(&task->mm->mmap_sem); 2350 up_write(&task->mm->mmap_sem);
2334 goto error; 2351 goto error;
@@ -2345,12 +2362,15 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t
2345 goto error; 2362 goto error;
2346 } 2363 }
2347 2364
2365 get_file(filp);
2366
2348 /* 2367 /*
2349 * now insert the vma in the vm list for the process, must be 2368 * now insert the vma in the vm list for the process, must be
2350 * done with mmap lock held 2369 * done with mmap lock held
2351 */ 2370 */
2352 insert_vm_struct(mm, vma); 2371 insert_vm_struct(mm, vma);
2353 2372
2373 mm->total_vm += size >> PAGE_SHIFT;
2354 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, 2374 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
2355 vma_pages(vma)); 2375 vma_pages(vma));
2356 up_write(&task->mm->mmap_sem); 2376 up_write(&task->mm->mmap_sem);
@@ -2378,8 +2398,8 @@ static int
2378pfm_bad_permissions(struct task_struct *task) 2398pfm_bad_permissions(struct task_struct *task)
2379{ 2399{
2380 const struct cred *tcred; 2400 const struct cred *tcred;
2381 kuid_t uid = current_uid(); 2401 uid_t uid = current_uid();
2382 kgid_t gid = current_gid(); 2402 gid_t gid = current_gid();
2383 int ret; 2403 int ret;
2384 2404
2385 rcu_read_lock(); 2405 rcu_read_lock();
@@ -2387,20 +2407,20 @@ pfm_bad_permissions(struct task_struct *task)
2387 2407
2388 /* inspired by ptrace_attach() */ 2408 /* inspired by ptrace_attach() */
2389 DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n", 2409 DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
2390 from_kuid(&init_user_ns, uid), 2410 uid,
2391 from_kgid(&init_user_ns, gid), 2411 gid,
2392 from_kuid(&init_user_ns, tcred->euid), 2412 tcred->euid,
2393 from_kuid(&init_user_ns, tcred->suid), 2413 tcred->suid,
2394 from_kuid(&init_user_ns, tcred->uid), 2414 tcred->uid,
2395 from_kgid(&init_user_ns, tcred->egid), 2415 tcred->egid,
2396 from_kgid(&init_user_ns, tcred->sgid))); 2416 tcred->sgid));
2397 2417
2398 ret = ((!uid_eq(uid, tcred->euid)) 2418 ret = ((uid != tcred->euid)
2399 || (!uid_eq(uid, tcred->suid)) 2419 || (uid != tcred->suid)
2400 || (!uid_eq(uid, tcred->uid)) 2420 || (uid != tcred->uid)
2401 || (!gid_eq(gid, tcred->egid)) 2421 || (gid != tcred->egid)
2402 || (!gid_eq(gid, tcred->sgid)) 2422 || (gid != tcred->sgid)
2403 || (!gid_eq(gid, tcred->gid))) && !capable(CAP_SYS_PTRACE); 2423 || (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE);
2404 2424
2405 rcu_read_unlock(); 2425 rcu_read_unlock();
2406 return ret; 2426 return ret;
@@ -4780,7 +4800,7 @@ recheck:
4780asmlinkage long 4800asmlinkage long
4781sys_perfmonctl (int fd, int cmd, void __user *arg, int count) 4801sys_perfmonctl (int fd, int cmd, void __user *arg, int count)
4782{ 4802{
4783 struct fd f = {NULL, 0}; 4803 struct file *file = NULL;
4784 pfm_context_t *ctx = NULL; 4804 pfm_context_t *ctx = NULL;
4785 unsigned long flags = 0UL; 4805 unsigned long flags = 0UL;
4786 void *args_k = NULL; 4806 void *args_k = NULL;
@@ -4877,17 +4897,17 @@ restart_args:
4877 4897
4878 ret = -EBADF; 4898 ret = -EBADF;
4879 4899
4880 f = fdget(fd); 4900 file = fget(fd);
4881 if (unlikely(f.file == NULL)) { 4901 if (unlikely(file == NULL)) {
4882 DPRINT(("invalid fd %d\n", fd)); 4902 DPRINT(("invalid fd %d\n", fd));
4883 goto error_args; 4903 goto error_args;
4884 } 4904 }
4885 if (unlikely(PFM_IS_FILE(f.file) == 0)) { 4905 if (unlikely(PFM_IS_FILE(file) == 0)) {
4886 DPRINT(("fd %d not related to perfmon\n", fd)); 4906 DPRINT(("fd %d not related to perfmon\n", fd));
4887 goto error_args; 4907 goto error_args;
4888 } 4908 }
4889 4909
4890 ctx = f.file->private_data; 4910 ctx = file->private_data;
4891 if (unlikely(ctx == NULL)) { 4911 if (unlikely(ctx == NULL)) {
4892 DPRINT(("no context for fd %d\n", fd)); 4912 DPRINT(("no context for fd %d\n", fd));
4893 goto error_args; 4913 goto error_args;
@@ -4917,8 +4937,8 @@ abort_locked:
4917 if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT; 4937 if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT;
4918 4938
4919error_args: 4939error_args:
4920 if (f.file) 4940 if (file)
4921 fdput(f); 4941 fput(file);
4922 4942
4923 kfree(args_k); 4943 kfree(args_k);
4924 4944
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 31360cbbd5f..6d33c5cc94f 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -29,7 +29,6 @@
29#include <linux/kdebug.h> 29#include <linux/kdebug.h>
30#include <linux/utsname.h> 30#include <linux/utsname.h>
31#include <linux/tracehook.h> 31#include <linux/tracehook.h>
32#include <linux/rcupdate.h>
33 32
34#include <asm/cpu.h> 33#include <asm/cpu.h>
35#include <asm/delay.h> 34#include <asm/delay.h>
@@ -39,7 +38,6 @@
39#include <asm/pgalloc.h> 38#include <asm/pgalloc.h>
40#include <asm/processor.h> 39#include <asm/processor.h>
41#include <asm/sal.h> 40#include <asm/sal.h>
42#include <asm/switch_to.h>
43#include <asm/tlbflush.h> 41#include <asm/tlbflush.h>
44#include <asm/uaccess.h> 42#include <asm/uaccess.h>
45#include <asm/unwind.h> 43#include <asm/unwind.h>
@@ -197,9 +195,11 @@ do_notify_resume_user(sigset_t *unused, struct sigscratch *scr, long in_syscall)
197 ia64_do_signal(scr, in_syscall); 195 ia64_do_signal(scr, in_syscall);
198 } 196 }
199 197
200 if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME)) { 198 if (test_thread_flag(TIF_NOTIFY_RESUME)) {
201 local_irq_enable(); /* force interrupt enable */ 199 clear_thread_flag(TIF_NOTIFY_RESUME);
202 tracehook_notify_resume(&scr->pt); 200 tracehook_notify_resume(&scr->pt);
201 if (current->replacement_session_keyring)
202 key_replace_session_keyring();
203 } 203 }
204 204
205 /* copy user rbs to kernel rbs */ 205 /* copy user rbs to kernel rbs */
@@ -272,6 +272,26 @@ static inline void play_dead(void)
272} 272}
273#endif /* CONFIG_HOTPLUG_CPU */ 273#endif /* CONFIG_HOTPLUG_CPU */
274 274
275static void do_nothing(void *unused)
276{
277}
278
279/*
280 * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
281 * pm_idle and update to new pm_idle value. Required while changing pm_idle
282 * handler on SMP systems.
283 *
284 * Caller must have changed pm_idle to the new value before the call. Old
285 * pm_idle value will not be used by any CPU after the return of this function.
286 */
287void cpu_idle_wait(void)
288{
289 smp_mb();
290 /* kick all the CPUs so that they exit out of pm_idle */
291 smp_call_function(do_nothing, NULL, 1);
292}
293EXPORT_SYMBOL_GPL(cpu_idle_wait);
294
275void __attribute__((noreturn)) 295void __attribute__((noreturn))
276cpu_idle (void) 296cpu_idle (void)
277{ 297{
@@ -280,7 +300,6 @@ cpu_idle (void)
280 300
281 /* endless idle loop with no priority at all */ 301 /* endless idle loop with no priority at all */
282 while (1) { 302 while (1) {
283 rcu_idle_enter();
284 if (can_do_pal_halt) { 303 if (can_do_pal_halt) {
285 current_thread_info()->status &= ~TS_POLLING; 304 current_thread_info()->status &= ~TS_POLLING;
286 /* 305 /*
@@ -311,8 +330,9 @@ cpu_idle (void)
311 normal_xtp(); 330 normal_xtp();
312#endif 331#endif
313 } 332 }
314 rcu_idle_exit(); 333 preempt_enable_no_resched();
315 schedule_preempt_disabled(); 334 schedule();
335 preempt_disable();
316 check_pgt_cache(); 336 check_pgt_cache();
317 if (cpu_is_offline(cpu)) 337 if (cpu_is_offline(cpu))
318 play_dead(); 338 play_dead();
@@ -393,24 +413,72 @@ ia64_load_extra (struct task_struct *task)
393int 413int
394copy_thread(unsigned long clone_flags, 414copy_thread(unsigned long clone_flags,
395 unsigned long user_stack_base, unsigned long user_stack_size, 415 unsigned long user_stack_base, unsigned long user_stack_size,
396 struct task_struct *p) 416 struct task_struct *p, struct pt_regs *regs)
397{ 417{
398 extern char ia64_ret_from_clone; 418 extern char ia64_ret_from_clone;
399 struct switch_stack *child_stack, *stack; 419 struct switch_stack *child_stack, *stack;
400 unsigned long rbs, child_rbs, rbs_size; 420 unsigned long rbs, child_rbs, rbs_size;
401 struct pt_regs *child_ptregs; 421 struct pt_regs *child_ptregs;
402 struct pt_regs *regs = current_pt_regs();
403 int retval = 0; 422 int retval = 0;
404 423
424#ifdef CONFIG_SMP
425 /*
426 * For SMP idle threads, fork_by_hand() calls do_fork with
427 * NULL regs.
428 */
429 if (!regs)
430 return 0;
431#endif
432
433 stack = ((struct switch_stack *) regs) - 1;
434
405 child_ptregs = (struct pt_regs *) ((unsigned long) p + IA64_STK_OFFSET) - 1; 435 child_ptregs = (struct pt_regs *) ((unsigned long) p + IA64_STK_OFFSET) - 1;
406 child_stack = (struct switch_stack *) child_ptregs - 1; 436 child_stack = (struct switch_stack *) child_ptregs - 1;
407 437
438 /* copy parent's switch_stack & pt_regs to child: */
439 memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack));
440
408 rbs = (unsigned long) current + IA64_RBS_OFFSET; 441 rbs = (unsigned long) current + IA64_RBS_OFFSET;
409 child_rbs = (unsigned long) p + IA64_RBS_OFFSET; 442 child_rbs = (unsigned long) p + IA64_RBS_OFFSET;
443 rbs_size = stack->ar_bspstore - rbs;
444
445 /* copy the parent's register backing store to the child: */
446 memcpy((void *) child_rbs, (void *) rbs, rbs_size);
447
448 if (likely(user_mode(child_ptregs))) {
449 if (clone_flags & CLONE_SETTLS)
450 child_ptregs->r13 = regs->r16; /* see sys_clone2() in entry.S */
451 if (user_stack_base) {
452 child_ptregs->r12 = user_stack_base + user_stack_size - 16;
453 child_ptregs->ar_bspstore = user_stack_base;
454 child_ptregs->ar_rnat = 0;
455 child_ptregs->loadrs = 0;
456 }
457 } else {
458 /*
459 * Note: we simply preserve the relative position of
460 * the stack pointer here. There is no need to
461 * allocate a scratch area here, since that will have
462 * been taken care of by the caller of sys_clone()
463 * already.
464 */
465 child_ptregs->r12 = (unsigned long) child_ptregs - 16; /* kernel sp */
466 child_ptregs->r13 = (unsigned long) p; /* set `current' pointer */
467 }
468 child_stack->ar_bspstore = child_rbs + rbs_size;
469 child_stack->b0 = (unsigned long) &ia64_ret_from_clone;
410 470
411 /* copy parts of thread_struct: */ 471 /* copy parts of thread_struct: */
412 p->thread.ksp = (unsigned long) child_stack - 16; 472 p->thread.ksp = (unsigned long) child_stack - 16;
413 473
474 /* stop some PSR bits from being inherited.
475 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve()
476 * therefore we must specify them explicitly here and not include them in
477 * IA64_PSR_BITS_TO_CLEAR.
478 */
479 child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET)
480 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP));
481
414 /* 482 /*
415 * NOTE: The calling convention considers all floating point 483 * NOTE: The calling convention considers all floating point
416 * registers in the high partition (fph) to be scratch. Since 484 * registers in the high partition (fph) to be scratch. Since
@@ -432,66 +500,8 @@ copy_thread(unsigned long clone_flags,
432# define THREAD_FLAGS_TO_SET 0 500# define THREAD_FLAGS_TO_SET 0
433 p->thread.flags = ((current->thread.flags & ~THREAD_FLAGS_TO_CLEAR) 501 p->thread.flags = ((current->thread.flags & ~THREAD_FLAGS_TO_CLEAR)
434 | THREAD_FLAGS_TO_SET); 502 | THREAD_FLAGS_TO_SET);
435
436 ia64_drop_fpu(p); /* don't pick up stale state from a CPU's fph */ 503 ia64_drop_fpu(p); /* don't pick up stale state from a CPU's fph */
437 504
438 if (unlikely(p->flags & PF_KTHREAD)) {
439 if (unlikely(!user_stack_base)) {
440 /* fork_idle() called us */
441 return 0;
442 }
443 memset(child_stack, 0, sizeof(*child_ptregs) + sizeof(*child_stack));
444 child_stack->r4 = user_stack_base; /* payload */
445 child_stack->r5 = user_stack_size; /* argument */
446 /*
447 * Preserve PSR bits, except for bits 32-34 and 37-45,
448 * which we can't read.
449 */
450 child_ptregs->cr_ipsr = ia64_getreg(_IA64_REG_PSR) | IA64_PSR_BN;
451 /* mark as valid, empty frame */
452 child_ptregs->cr_ifs = 1UL << 63;
453 child_stack->ar_fpsr = child_ptregs->ar_fpsr
454 = ia64_getreg(_IA64_REG_AR_FPSR);
455 child_stack->pr = (1 << PRED_KERNEL_STACK);
456 child_stack->ar_bspstore = child_rbs;
457 child_stack->b0 = (unsigned long) &ia64_ret_from_clone;
458
459 /* stop some PSR bits from being inherited.
460 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve()
461 * therefore we must specify them explicitly here and not include them in
462 * IA64_PSR_BITS_TO_CLEAR.
463 */
464 child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET)
465 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP));
466
467 return 0;
468 }
469 stack = ((struct switch_stack *) regs) - 1;
470 /* copy parent's switch_stack & pt_regs to child: */
471 memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack));
472
473 /* copy the parent's register backing store to the child: */
474 rbs_size = stack->ar_bspstore - rbs;
475 memcpy((void *) child_rbs, (void *) rbs, rbs_size);
476 if (clone_flags & CLONE_SETTLS)
477 child_ptregs->r13 = regs->r16; /* see sys_clone2() in entry.S */
478 if (user_stack_base) {
479 child_ptregs->r12 = user_stack_base + user_stack_size - 16;
480 child_ptregs->ar_bspstore = user_stack_base;
481 child_ptregs->ar_rnat = 0;
482 child_ptregs->loadrs = 0;
483 }
484 child_stack->ar_bspstore = child_rbs + rbs_size;
485 child_stack->b0 = (unsigned long) &ia64_ret_from_clone;
486
487 /* stop some PSR bits from being inherited.
488 * the psr.up/psr.pp bits must be cleared on fork but inherited on execve()
489 * therefore we must specify them explicitly here and not include them in
490 * IA64_PSR_BITS_TO_CLEAR.
491 */
492 child_ptregs->cr_ipsr = ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET)
493 & ~(IA64_PSR_BITS_TO_CLEAR | IA64_PSR_PP | IA64_PSR_UP));
494
495#ifdef CONFIG_PERFMON 505#ifdef CONFIG_PERFMON
496 if (current->thread.pfm_context) 506 if (current->thread.pfm_context)
497 pfm_inherit(p, child_ptregs); 507 pfm_inherit(p, child_ptregs);
@@ -618,6 +628,57 @@ dump_fpu (struct pt_regs *pt, elf_fpregset_t dst)
618 return 1; /* f0-f31 are always valid so we always return 1 */ 628 return 1; /* f0-f31 are always valid so we always return 1 */
619} 629}
620 630
631long
632sys_execve (const char __user *filename,
633 const char __user *const __user *argv,
634 const char __user *const __user *envp,
635 struct pt_regs *regs)
636{
637 char *fname;
638 int error;
639
640 fname = getname(filename);
641 error = PTR_ERR(fname);
642 if (IS_ERR(fname))
643 goto out;
644 error = do_execve(fname, argv, envp, regs);
645 putname(fname);
646out:
647 return error;
648}
649
650pid_t
651kernel_thread (int (*fn)(void *), void *arg, unsigned long flags)
652{
653 extern void start_kernel_thread (void);
654 unsigned long *helper_fptr = (unsigned long *) &start_kernel_thread;
655 struct {
656 struct switch_stack sw;
657 struct pt_regs pt;
658 } regs;
659
660 memset(&regs, 0, sizeof(regs));
661 regs.pt.cr_iip = helper_fptr[0]; /* set entry point (IP) */
662 regs.pt.r1 = helper_fptr[1]; /* set GP */
663 regs.pt.r9 = (unsigned long) fn; /* 1st argument */
664 regs.pt.r11 = (unsigned long) arg; /* 2nd argument */
665 /* Preserve PSR bits, except for bits 32-34 and 37-45, which we can't read. */
666 regs.pt.cr_ipsr = ia64_getreg(_IA64_REG_PSR) | IA64_PSR_BN;
667 regs.pt.cr_ifs = 1UL << 63; /* mark as valid, empty frame */
668 regs.sw.ar_fpsr = regs.pt.ar_fpsr = ia64_getreg(_IA64_REG_AR_FPSR);
669 regs.sw.ar_bspstore = (unsigned long) current + IA64_RBS_OFFSET;
670 regs.sw.pr = (1 << PRED_KERNEL_STACK);
671 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs.pt, 0, NULL, NULL);
672}
673EXPORT_SYMBOL(kernel_thread);
674
675/* This gets called from kernel_thread() via ia64_invoke_thread_helper(). */
676int
677kernel_thread_helper (int (*fn)(void *), void *arg)
678{
679 return (*fn)(arg);
680}
681
621/* 682/*
622 * Flush thread state. This is called when a thread does an execve(). 683 * Flush thread state. This is called when a thread does an execve().
623 */ 684 */
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 4265ff64219..8848f43d819 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -26,6 +26,7 @@
26#include <asm/processor.h> 26#include <asm/processor.h>
27#include <asm/ptrace_offsets.h> 27#include <asm/ptrace_offsets.h>
28#include <asm/rse.h> 28#include <asm/rse.h>
29#include <asm/system.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/unwind.h> 31#include <asm/unwind.h>
31#ifdef CONFIG_PERFMON 32#ifdef CONFIG_PERFMON
@@ -1245,8 +1246,15 @@ syscall_trace_enter (long arg0, long arg1, long arg2, long arg3,
1245 if (test_thread_flag(TIF_RESTORE_RSE)) 1246 if (test_thread_flag(TIF_RESTORE_RSE))
1246 ia64_sync_krbs(); 1247 ia64_sync_krbs();
1247 1248
1249 if (unlikely(current->audit_context)) {
1250 long syscall;
1251 int arch;
1248 1252
1249 audit_syscall_entry(AUDIT_ARCH_IA64, regs.r15, arg0, arg1, arg2, arg3); 1253 syscall = regs.r15;
1254 arch = AUDIT_ARCH_IA64;
1255
1256 audit_syscall_entry(arch, syscall, arg0, arg1, arg2, arg3);
1257 }
1250 1258
1251 return 0; 1259 return 0;
1252} 1260}
@@ -1260,7 +1268,14 @@ syscall_trace_leave (long arg0, long arg1, long arg2, long arg3,
1260{ 1268{
1261 int step; 1269 int step;
1262 1270
1263 audit_syscall_exit(&regs); 1271 if (unlikely(current->audit_context)) {
1272 int success = AUDITSC_RESULT(regs.r10);
1273 long result = regs.r8;
1274
1275 if (success != AUDITSC_SUCCESS)
1276 result = -result;
1277 audit_syscall_exit(success, result);
1278 }
1264 1279
1265 step = test_thread_flag(TIF_SINGLESTEP); 1280 step = test_thread_flag(TIF_SINGLESTEP);
1266 if (step || test_thread_flag(TIF_SYSCALL_TRACE)) 1281 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index aaefd9b94f2..5e2c72498c5 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -59,6 +59,7 @@
59#include <asm/sections.h> 59#include <asm/sections.h>
60#include <asm/setup.h> 60#include <asm/setup.h>
61#include <asm/smp.h> 61#include <asm/smp.h>
62#include <asm/system.h>
62#include <asm/tlbflush.h> 63#include <asm/tlbflush.h>
63#include <asm/unistd.h> 64#include <asm/unistd.h>
64#include <asm/hpsim.h> 65#include <asm/hpsim.h>
@@ -219,23 +220,6 @@ sort_regions (struct rsvd_region *rsvd_region, int max)
219 } 220 }
220} 221}
221 222
222/* merge overlaps */
223static int __init
224merge_regions (struct rsvd_region *rsvd_region, int max)
225{
226 int i;
227 for (i = 1; i < max; ++i) {
228 if (rsvd_region[i].start >= rsvd_region[i-1].end)
229 continue;
230 if (rsvd_region[i].end > rsvd_region[i-1].end)
231 rsvd_region[i-1].end = rsvd_region[i].end;
232 --max;
233 memmove(&rsvd_region[i], &rsvd_region[i+1],
234 (max - i) * sizeof(struct rsvd_region));
235 }
236 return max;
237}
238
239/* 223/*
240 * Request address space for all standard resources 224 * Request address space for all standard resources
241 */ 225 */
@@ -286,7 +270,6 @@ static void __init setup_crashkernel(unsigned long total, int *n)
286 if (ret == 0 && size > 0) { 270 if (ret == 0 && size > 0) {
287 if (!base) { 271 if (!base) {
288 sort_regions(rsvd_region, *n); 272 sort_regions(rsvd_region, *n);
289 *n = merge_regions(rsvd_region, *n);
290 base = kdump_find_rsvd_region(size, 273 base = kdump_find_rsvd_region(size,
291 rsvd_region, *n); 274 rsvd_region, *n);
292 } 275 }
@@ -390,7 +373,6 @@ reserve_memory (void)
390 BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n); 373 BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n);
391 374
392 sort_regions(rsvd_region, num_rsvd_regions); 375 sort_regions(rsvd_region, num_rsvd_regions);
393 num_rsvd_regions = merge_regions(rsvd_region, num_rsvd_regions);
394} 376}
395 377
396 378
@@ -485,7 +467,7 @@ mark_bsp_online (void)
485{ 467{
486#ifdef CONFIG_SMP 468#ifdef CONFIG_SMP
487 /* If we register an early console, allow CPU 0 to printk */ 469 /* If we register an early console, allow CPU 0 to printk */
488 set_cpu_online(smp_processor_id(), true); 470 cpu_set(smp_processor_id(), cpu_online_map);
489#endif 471#endif
490} 472}
491 473
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 680b73786be..7bdafc8788b 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -30,6 +30,7 @@
30 30
31#define DEBUG_SIG 0 31#define DEBUG_SIG 0
32#define STACK_ALIGN 16 /* minimal alignment for stack pointer */ 32#define STACK_ALIGN 16 /* minimal alignment for stack pointer */
33#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
33 34
34#if _NSIG_WORDS > 1 35#if _NSIG_WORDS > 1
35# define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t)) 36# define PUT_SIGSET(k,u) __copy_to_user((u)->sig, (k)->sig, sizeof(sigset_t))
@@ -199,7 +200,14 @@ ia64_rt_sigreturn (struct sigscratch *scr)
199 if (GET_SIGSET(&set, &sc->sc_mask)) 200 if (GET_SIGSET(&set, &sc->sc_mask))
200 goto give_sigsegv; 201 goto give_sigsegv;
201 202
202 set_current_blocked(&set); 203 sigdelsetmask(&set, ~_BLOCKABLE);
204
205 spin_lock_irq(&current->sighand->siglock);
206 {
207 current->blocked = set;
208 recalc_sigpending();
209 }
210 spin_unlock_irq(&current->sighand->siglock);
203 211
204 if (restore_sigcontext(sc, scr)) 212 if (restore_sigcontext(sc, scr))
205 goto give_sigsegv; 213 goto give_sigsegv;
@@ -220,7 +228,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
220 si.si_errno = 0; 228 si.si_errno = 0;
221 si.si_code = SI_KERNEL; 229 si.si_code = SI_KERNEL;
222 si.si_pid = task_pid_vnr(current); 230 si.si_pid = task_pid_vnr(current);
223 si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); 231 si.si_uid = current_uid();
224 si.si_addr = sc; 232 si.si_addr = sc;
225 force_sig_info(SIGSEGV, &si, current); 233 force_sig_info(SIGSEGV, &si, current);
226 return retval; 234 return retval;
@@ -317,7 +325,7 @@ force_sigsegv_info (int sig, void __user *addr)
317 si.si_errno = 0; 325 si.si_errno = 0;
318 si.si_code = SI_KERNEL; 326 si.si_code = SI_KERNEL;
319 si.si_pid = task_pid_vnr(current); 327 si.si_pid = task_pid_vnr(current);
320 si.si_uid = from_kuid_munged(current_user_ns(), current_uid()); 328 si.si_uid = current_uid();
321 si.si_addr = addr; 329 si.si_addr = addr;
322 force_sig_info(SIGSEGV, &si, current); 330 force_sig_info(SIGSEGV, &si, current);
323 return 0; 331 return 0;
@@ -413,13 +421,23 @@ setup_frame (int sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *set,
413} 421}
414 422
415static long 423static long
416handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, 424handle_signal (unsigned long sig, struct k_sigaction *ka, siginfo_t *info, sigset_t *oldset,
417 struct sigscratch *scr) 425 struct sigscratch *scr)
418{ 426{
419 if (!setup_frame(sig, ka, info, sigmask_to_save(), scr)) 427 if (!setup_frame(sig, ka, info, oldset, scr))
420 return 0; 428 return 0;
421 429
422 signal_delivered(sig, info, ka, &scr->pt, 430 spin_lock_irq(&current->sighand->siglock);
431 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
432 if (!(ka->sa.sa_flags & SA_NODEFER))
433 sigaddset(&current->blocked, sig);
434 recalc_sigpending();
435 spin_unlock_irq(&current->sighand->siglock);
436
437 /*
438 * Let tracing know that we've done the handler setup.
439 */
440 tracehook_signal_handler(sig, info, ka, &scr->pt,
423 test_thread_flag(TIF_SINGLESTEP)); 441 test_thread_flag(TIF_SINGLESTEP));
424 442
425 return 1; 443 return 1;
@@ -433,11 +451,25 @@ void
433ia64_do_signal (struct sigscratch *scr, long in_syscall) 451ia64_do_signal (struct sigscratch *scr, long in_syscall)
434{ 452{
435 struct k_sigaction ka; 453 struct k_sigaction ka;
454 sigset_t *oldset;
436 siginfo_t info; 455 siginfo_t info;
437 long restart = in_syscall; 456 long restart = in_syscall;
438 long errno = scr->pt.r8; 457 long errno = scr->pt.r8;
439 458
440 /* 459 /*
460 * In the ia64_leave_kernel code path, we want the common case to go fast, which
461 * is why we may in certain cases get here from kernel mode. Just return without
462 * doing anything if so.
463 */
464 if (!user_mode(&scr->pt))
465 return;
466
467 if (current_thread_info()->status & TS_RESTORE_SIGMASK)
468 oldset = &current->saved_sigmask;
469 else
470 oldset = &current->blocked;
471
472 /*
441 * This only loops in the rare cases of handle_signal() failing, in which case we 473 * This only loops in the rare cases of handle_signal() failing, in which case we
442 * need to push through a forced SIGSEGV. 474 * need to push through a forced SIGSEGV.
443 */ 475 */
@@ -486,8 +518,16 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
486 * Whee! Actually deliver the signal. If the delivery failed, we need to 518 * Whee! Actually deliver the signal. If the delivery failed, we need to
487 * continue to iterate in this loop so we can deliver the SIGSEGV... 519 * continue to iterate in this loop so we can deliver the SIGSEGV...
488 */ 520 */
489 if (handle_signal(signr, &ka, &info, scr)) 521 if (handle_signal(signr, &ka, &info, oldset, scr)) {
522 /*
523 * A signal was successfully delivered; the saved
524 * sigmask will have been stored in the signal frame,
525 * and will be restored by sigreturn, so we can simply
526 * clear the TS_RESTORE_SIGMASK flag.
527 */
528 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
490 return; 529 return;
530 }
491 } 531 }
492 532
493 /* Did we come from a system call? */ 533 /* Did we come from a system call? */
@@ -509,5 +549,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
509 549
510 /* if there's no signal to deliver, we just put the saved sigmask 550 /* if there's no signal to deliver, we just put the saved sigmask
511 * back */ 551 * back */
512 restore_saved_sigmask(); 552 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
553 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
554 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
555 }
513} 556}
diff --git a/arch/ia64/kernel/smp.c b/arch/ia64/kernel/smp.c
index 9fcd4e63048..0bd537b4ea6 100644
--- a/arch/ia64/kernel/smp.c
+++ b/arch/ia64/kernel/smp.c
@@ -44,6 +44,7 @@
44#include <asm/processor.h> 44#include <asm/processor.h>
45#include <asm/ptrace.h> 45#include <asm/ptrace.h>
46#include <asm/sal.h> 46#include <asm/sal.h>
47#include <asm/system.h>
47#include <asm/tlbflush.h> 48#include <asm/tlbflush.h>
48#include <asm/unistd.h> 49#include <asm/unistd.h>
49#include <asm/mca.h> 50#include <asm/mca.h>
@@ -76,7 +77,7 @@ stop_this_cpu(void)
76 /* 77 /*
77 * Remove this CPU: 78 * Remove this CPU:
78 */ 79 */
79 set_cpu_online(smp_processor_id(), false); 80 cpu_clear(smp_processor_id(), cpu_online_map);
80 max_xtp(); 81 max_xtp();
81 local_irq_disable(); 82 local_irq_disable();
82 cpu_halt(); 83 cpu_halt();
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 500f1e4d9f9..55909798667 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -55,6 +55,7 @@
55#include <asm/processor.h> 55#include <asm/processor.h>
56#include <asm/ptrace.h> 56#include <asm/ptrace.h>
57#include <asm/sal.h> 57#include <asm/sal.h>
58#include <asm/system.h>
58#include <asm/tlbflush.h> 59#include <asm/tlbflush.h>
59#include <asm/unistd.h> 60#include <asm/unistd.h>
60#include <asm/sn/arch.h> 61#include <asm/sn/arch.h>
@@ -75,6 +76,13 @@
75#endif 76#endif
76 77
77/* 78/*
79 * Store all idle threads, this can be reused instead of creating
80 * a new thread. Also avoids complicated thread destroy functionality
81 * for idle threads.
82 */
83struct task_struct *idle_thread_array[NR_CPUS];
84
85/*
78 * Global array allocated for NR_CPUS at boot time 86 * Global array allocated for NR_CPUS at boot time
79 */ 87 */
80struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; 88struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS];
@@ -87,7 +95,13 @@ struct sal_to_os_boot *sal_state_for_booting_cpu = &sal_boot_rendez_state[0];
87 95
88#define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); 96#define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]);
89 97
98#define get_idle_for_cpu(x) (idle_thread_array[(x)])
99#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p))
100
90#else 101#else
102
103#define get_idle_for_cpu(x) (NULL)
104#define set_idle_for_cpu(x,p)
91#define set_brendez_area(x) 105#define set_brendez_area(x)
92#endif 106#endif
93 107
@@ -347,7 +361,8 @@ ia64_sync_itc (unsigned int master)
347/* 361/*
348 * Ideally sets up per-cpu profiling hooks. Doesn't do much now... 362 * Ideally sets up per-cpu profiling hooks. Doesn't do much now...
349 */ 363 */
350static inline void smp_setup_percpu_timer(void) 364static inline void __devinit
365smp_setup_percpu_timer (void)
351{ 366{
352} 367}
353 368
@@ -381,13 +396,15 @@ smp_callin (void)
381 set_numa_node(cpu_to_node_map[cpuid]); 396 set_numa_node(cpu_to_node_map[cpuid]);
382 set_numa_mem(local_memory_node(cpu_to_node_map[cpuid])); 397 set_numa_mem(local_memory_node(cpu_to_node_map[cpuid]));
383 398
399 ipi_call_lock_irq();
384 spin_lock(&vector_lock); 400 spin_lock(&vector_lock);
385 /* Setup the per cpu irq handling data structures */ 401 /* Setup the per cpu irq handling data structures */
386 __setup_vector_irq(cpuid); 402 __setup_vector_irq(cpuid);
387 notify_cpu_starting(cpuid); 403 notify_cpu_starting(cpuid);
388 set_cpu_online(cpuid, true); 404 cpu_set(cpuid, cpu_online_map);
389 per_cpu(cpu_state, cpuid) = CPU_ONLINE; 405 per_cpu(cpu_state, cpuid) = CPU_ONLINE;
390 spin_unlock(&vector_lock); 406 spin_unlock(&vector_lock);
407 ipi_call_unlock_irq();
391 408
392 smp_setup_percpu_timer(); 409 smp_setup_percpu_timer();
393 410
@@ -459,12 +476,59 @@ start_secondary (void *unused)
459 return 0; 476 return 0;
460} 477}
461 478
479struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
480{
481 return NULL;
482}
483
484struct create_idle {
485 struct work_struct work;
486 struct task_struct *idle;
487 struct completion done;
488 int cpu;
489};
490
491void __cpuinit
492do_fork_idle(struct work_struct *work)
493{
494 struct create_idle *c_idle =
495 container_of(work, struct create_idle, work);
496
497 c_idle->idle = fork_idle(c_idle->cpu);
498 complete(&c_idle->done);
499}
500
462static int __cpuinit 501static int __cpuinit
463do_boot_cpu (int sapicid, int cpu, struct task_struct *idle) 502do_boot_cpu (int sapicid, int cpu)
464{ 503{
465 int timeout; 504 int timeout;
505 struct create_idle c_idle = {
506 .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle),
507 .cpu = cpu,
508 .done = COMPLETION_INITIALIZER(c_idle.done),
509 };
510
511 /*
512 * We can't use kernel_thread since we must avoid to
513 * reschedule the child.
514 */
515 c_idle.idle = get_idle_for_cpu(cpu);
516 if (c_idle.idle) {
517 init_idle(c_idle.idle, cpu);
518 goto do_rest;
519 }
520
521 schedule_work(&c_idle.work);
522 wait_for_completion(&c_idle.done);
523
524 if (IS_ERR(c_idle.idle))
525 panic("failed fork for CPU %d", cpu);
526
527 set_idle_for_cpu(cpu, c_idle.idle);
528
529do_rest:
530 task_for_booting_cpu = c_idle.idle;
466 531
467 task_for_booting_cpu = idle;
468 Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); 532 Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);
469 533
470 set_brendez_area(cpu); 534 set_brendez_area(cpu);
@@ -484,7 +548,7 @@ do_boot_cpu (int sapicid, int cpu, struct task_struct *idle)
484 if (!cpu_isset(cpu, cpu_callin_map)) { 548 if (!cpu_isset(cpu, cpu_callin_map)) {
485 printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid); 549 printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid);
486 ia64_cpu_to_sapicid[cpu] = -1; 550 ia64_cpu_to_sapicid[cpu] = -1;
487 set_cpu_online(cpu, false); /* was set in smp_callin() */ 551 cpu_clear(cpu, cpu_online_map); /* was set in smp_callin() */
488 return -EINVAL; 552 return -EINVAL;
489 } 553 }
490 return 0; 554 return 0;
@@ -514,7 +578,8 @@ smp_build_cpu_map (void)
514 } 578 }
515 579
516 ia64_cpu_to_sapicid[0] = boot_cpu_id; 580 ia64_cpu_to_sapicid[0] = boot_cpu_id;
517 init_cpu_present(cpumask_of(0)); 581 cpus_clear(cpu_present_map);
582 set_cpu_present(0, true);
518 set_cpu_possible(0, true); 583 set_cpu_possible(0, true);
519 for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) { 584 for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) {
520 sapicid = smp_boot_data.cpu_phys_id[i]; 585 sapicid = smp_boot_data.cpu_phys_id[i];
@@ -541,6 +606,10 @@ smp_prepare_cpus (unsigned int max_cpus)
541 606
542 smp_setup_percpu_timer(); 607 smp_setup_percpu_timer();
543 608
609 /*
610 * We have the boot CPU online for sure.
611 */
612 cpu_set(0, cpu_online_map);
544 cpu_set(0, cpu_callin_map); 613 cpu_set(0, cpu_callin_map);
545 614
546 local_cpu_data->loops_per_jiffy = loops_per_jiffy; 615 local_cpu_data->loops_per_jiffy = loops_per_jiffy;
@@ -562,9 +631,9 @@ smp_prepare_cpus (unsigned int max_cpus)
562 } 631 }
563} 632}
564 633
565void smp_prepare_boot_cpu(void) 634void __devinit smp_prepare_boot_cpu(void)
566{ 635{
567 set_cpu_online(smp_processor_id(), true); 636 cpu_set(smp_processor_id(), cpu_online_map);
568 cpu_set(smp_processor_id(), cpu_callin_map); 637 cpu_set(smp_processor_id(), cpu_callin_map);
569 set_numa_node(cpu_to_node_map[smp_processor_id()]); 638 set_numa_node(cpu_to_node_map[smp_processor_id()]);
570 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; 639 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
@@ -621,7 +690,7 @@ int migrate_platform_irqs(unsigned int cpu)
621 /* 690 /*
622 * Now re-target the CPEI to a different processor 691 * Now re-target the CPEI to a different processor
623 */ 692 */
624 new_cpei_cpu = cpumask_any(cpu_online_mask); 693 new_cpei_cpu = any_online_cpu(cpu_online_map);
625 mask = cpumask_of(new_cpei_cpu); 694 mask = cpumask_of(new_cpei_cpu);
626 set_cpei_target_cpu(new_cpei_cpu); 695 set_cpei_target_cpu(new_cpei_cpu);
627 data = irq_get_irq_data(ia64_cpe_irq); 696 data = irq_get_irq_data(ia64_cpe_irq);
@@ -663,10 +732,10 @@ int __cpu_disable(void)
663 return -EBUSY; 732 return -EBUSY;
664 } 733 }
665 734
666 set_cpu_online(cpu, false); 735 cpu_clear(cpu, cpu_online_map);
667 736
668 if (migrate_platform_irqs(cpu)) { 737 if (migrate_platform_irqs(cpu)) {
669 set_cpu_online(cpu, true); 738 cpu_set(cpu, cpu_online_map);
670 return -EBUSY; 739 return -EBUSY;
671 } 740 }
672 741
@@ -712,7 +781,8 @@ smp_cpus_done (unsigned int dummy)
712 (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100); 781 (int)num_online_cpus(), bogosum/(500000/HZ), (bogosum/(5000/HZ))%100);
713} 782}
714 783
715static inline void set_cpu_sibling_map(int cpu) 784static inline void __devinit
785set_cpu_sibling_map(int cpu)
716{ 786{
717 int i; 787 int i;
718 788
@@ -729,7 +799,7 @@ static inline void set_cpu_sibling_map(int cpu)
729} 799}
730 800
731int __cpuinit 801int __cpuinit
732__cpu_up(unsigned int cpu, struct task_struct *tidle) 802__cpu_up (unsigned int cpu)
733{ 803{
734 int ret; 804 int ret;
735 int sapicid; 805 int sapicid;
@@ -747,7 +817,7 @@ __cpu_up(unsigned int cpu, struct task_struct *tidle)
747 817
748 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; 818 per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
749 /* Processor goes to start_secondary(), sets online flag */ 819 /* Processor goes to start_secondary(), sets online flag */
750 ret = do_boot_cpu(sapicid, cpu, tidle); 820 ret = do_boot_cpu(sapicid, cpu);
751 if (ret < 0) 821 if (ret < 0)
752 return ret; 822 return ret;
753 823
@@ -791,7 +861,8 @@ init_smp_config(void)
791 * identify_siblings(cpu) gets called from identify_cpu. This populates the 861 * identify_siblings(cpu) gets called from identify_cpu. This populates the
792 * information related to logical execution units in per_cpu_data structure. 862 * information related to logical execution units in per_cpu_data structure.
793 */ 863 */
794void identify_siblings(struct cpuinfo_ia64 *c) 864void __devinit
865identify_siblings(struct cpuinfo_ia64 *c)
795{ 866{
796 long status; 867 long status;
797 u16 pltid; 868 u16 pltid;
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index d9439ef2f66..609d50056a6 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -171,9 +171,22 @@ asmlinkage unsigned long
171ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags, 171ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags,
172 unsigned long new_addr) 172 unsigned long new_addr)
173{ 173{
174 addr = sys_mremap(addr, old_len, new_len, flags, new_addr); 174 extern unsigned long do_mremap (unsigned long addr,
175 if (!IS_ERR((void *) addr)) 175 unsigned long old_len,
176 force_successful_syscall_return(); 176 unsigned long new_len,
177 unsigned long flags,
178 unsigned long new_addr);
179
180 down_write(&current->mm->mmap_sem);
181 {
182 addr = do_mremap(addr, old_len, new_len, flags, new_addr);
183 }
184 up_write(&current->mm->mmap_sem);
185
186 if (IS_ERR((void *) addr))
187 return addr;
188
189 force_successful_syscall_return();
177 return addr; 190 return addr;
178} 191}
179 192
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 88a794536bc..43920de425f 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -19,7 +19,7 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/efi.h> 20#include <linux/efi.h>
21#include <linux/timex.h> 21#include <linux/timex.h>
22#include <linux/timekeeper_internal.h> 22#include <linux/clocksource.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24 24
25#include <asm/machvec.h> 25#include <asm/machvec.h>
@@ -29,12 +29,15 @@
29#include <asm/ptrace.h> 29#include <asm/ptrace.h>
30#include <asm/sal.h> 30#include <asm/sal.h>
31#include <asm/sections.h> 31#include <asm/sections.h>
32#include <asm/system.h>
32 33
33#include "fsyscall_gtod_data.h" 34#include "fsyscall_gtod_data.h"
34 35
35static cycle_t itc_get_cycles(struct clocksource *cs); 36static cycle_t itc_get_cycles(struct clocksource *cs);
36 37
37struct fsyscall_gtod_data_t fsyscall_gtod_data; 38struct fsyscall_gtod_data_t fsyscall_gtod_data = {
39 .lock = __SEQLOCK_UNLOCKED(fsyscall_gtod_data.lock),
40};
38 41
39struct itc_jitter_data_t itc_jitter_data; 42struct itc_jitter_data_t itc_jitter_data;
40 43
@@ -83,29 +86,32 @@ static struct clocksource *itc_clocksource;
83 86
84extern cputime_t cycle_to_cputime(u64 cyc); 87extern cputime_t cycle_to_cputime(u64 cyc);
85 88
86void vtime_account_user(struct task_struct *tsk)
87{
88 cputime_t delta_utime;
89 struct thread_info *ti = task_thread_info(tsk);
90
91 if (ti->ac_utime) {
92 delta_utime = cycle_to_cputime(ti->ac_utime);
93 account_user_time(tsk, delta_utime, delta_utime);
94 ti->ac_utime = 0;
95 }
96}
97
98/* 89/*
99 * Called from the context switch with interrupts disabled, to charge all 90 * Called from the context switch with interrupts disabled, to charge all
100 * accumulated times to the current process, and to prepare accounting on 91 * accumulated times to the current process, and to prepare accounting on
101 * the next process. 92 * the next process.
102 */ 93 */
103void arch_vtime_task_switch(struct task_struct *prev) 94void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next)
104{ 95{
105 struct thread_info *pi = task_thread_info(prev); 96 struct thread_info *pi = task_thread_info(prev);
106 struct thread_info *ni = task_thread_info(current); 97 struct thread_info *ni = task_thread_info(next);
98 cputime_t delta_stime, delta_utime;
99 __u64 now;
100
101 now = ia64_get_itc();
102
103 delta_stime = cycle_to_cputime(pi->ac_stime + (now - pi->ac_stamp));
104 if (idle_task(smp_processor_id()) != prev)
105 account_system_time(prev, 0, delta_stime, delta_stime);
106 else
107 account_idle_time(delta_stime);
107 108
108 pi->ac_stamp = ni->ac_stamp; 109 if (pi->ac_utime) {
110 delta_utime = cycle_to_cputime(pi->ac_utime);
111 account_user_time(prev, delta_utime, delta_utime);
112 }
113
114 pi->ac_stamp = ni->ac_stamp = now;
109 ni->ac_stime = ni->ac_utime = 0; 115 ni->ac_stime = ni->ac_utime = 0;
110} 116}
111 117
@@ -113,33 +119,44 @@ void arch_vtime_task_switch(struct task_struct *prev)
113 * Account time for a transition between system, hard irq or soft irq state. 119 * Account time for a transition between system, hard irq or soft irq state.
114 * Note that this function is called with interrupts enabled. 120 * Note that this function is called with interrupts enabled.
115 */ 121 */
116static cputime_t vtime_delta(struct task_struct *tsk) 122void account_system_vtime(struct task_struct *tsk)
117{ 123{
118 struct thread_info *ti = task_thread_info(tsk); 124 struct thread_info *ti = task_thread_info(tsk);
125 unsigned long flags;
119 cputime_t delta_stime; 126 cputime_t delta_stime;
120 __u64 now; 127 __u64 now;
121 128
122 WARN_ON_ONCE(!irqs_disabled()); 129 local_irq_save(flags);
123 130
124 now = ia64_get_itc(); 131 now = ia64_get_itc();
125 132
126 delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp)); 133 delta_stime = cycle_to_cputime(ti->ac_stime + (now - ti->ac_stamp));
134 if (irq_count() || idle_task(smp_processor_id()) != tsk)
135 account_system_time(tsk, 0, delta_stime, delta_stime);
136 else
137 account_idle_time(delta_stime);
127 ti->ac_stime = 0; 138 ti->ac_stime = 0;
139
128 ti->ac_stamp = now; 140 ti->ac_stamp = now;
129 141
130 return delta_stime; 142 local_irq_restore(flags);
131} 143}
144EXPORT_SYMBOL_GPL(account_system_vtime);
132 145
133void vtime_account_system(struct task_struct *tsk) 146/*
147 * Called from the timer interrupt handler to charge accumulated user time
148 * to the current process. Must be called with interrupts disabled.
149 */
150void account_process_tick(struct task_struct *p, int user_tick)
134{ 151{
135 cputime_t delta = vtime_delta(tsk); 152 struct thread_info *ti = task_thread_info(p);
136 153 cputime_t delta_utime;
137 account_system_time(tsk, 0, delta, delta);
138}
139 154
140void vtime_account_idle(struct task_struct *tsk) 155 if (ti->ac_utime) {
141{ 156 delta_utime = cycle_to_cputime(ti->ac_utime);
142 account_idle_time(vtime_delta(tsk)); 157 account_user_time(p, delta_utime, delta_utime);
158 ti->ac_utime = 0;
159 }
143} 160}
144 161
145#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ 162#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
@@ -243,7 +260,8 @@ static int __init nojitter_setup(char *str)
243__setup("nojitter", nojitter_setup); 260__setup("nojitter", nojitter_setup);
244 261
245 262
246void ia64_init_itm(void) 263void __devinit
264ia64_init_itm (void)
247{ 265{
248 unsigned long platform_base_freq, itc_freq; 266 unsigned long platform_base_freq, itc_freq;
249 struct pal_freq_ratio itc_ratio, proc_ratio; 267 struct pal_freq_ratio itc_ratio, proc_ratio;
@@ -439,10 +457,12 @@ void update_vsyscall_tz(void)
439{ 457{
440} 458}
441 459
442void update_vsyscall_old(struct timespec *wall, struct timespec *wtm, 460void update_vsyscall(struct timespec *wall, struct timespec *wtm,
443 struct clocksource *c, u32 mult) 461 struct clocksource *c, u32 mult)
444{ 462{
445 write_seqcount_begin(&fsyscall_gtod_data.seq); 463 unsigned long flags;
464
465 write_seqlock_irqsave(&fsyscall_gtod_data.lock, flags);
446 466
447 /* copy fsyscall clock data */ 467 /* copy fsyscall clock data */
448 fsyscall_gtod_data.clk_mask = c->mask; 468 fsyscall_gtod_data.clk_mask = c->mask;
@@ -465,6 +485,6 @@ void update_vsyscall_old(struct timespec *wall, struct timespec *wtm,
465 fsyscall_gtod_data.monotonic_time.tv_sec++; 485 fsyscall_gtod_data.monotonic_time.tv_sec++;
466 } 486 }
467 487
468 write_seqcount_end(&fsyscall_gtod_data.seq); 488 write_sequnlock_irqrestore(&fsyscall_gtod_data.lock, flags);
469} 489}
470 490
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index dc00b2c1b42..0e0e0cc9e39 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -22,7 +22,6 @@
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/nodemask.h> 23#include <linux/nodemask.h>
24#include <linux/notifier.h> 24#include <linux/notifier.h>
25#include <linux/export.h>
26#include <asm/mmzone.h> 25#include <asm/mmzone.h>
27#include <asm/numa.h> 26#include <asm/numa.h>
28#include <asm/cpu.h> 27#include <asm/cpu.h>
@@ -220,8 +219,7 @@ static ssize_t show_shared_cpu_map(struct cache_info *this_leaf, char *buf)
220 ssize_t len; 219 ssize_t len;
221 cpumask_t shared_cpu_map; 220 cpumask_t shared_cpu_map;
222 221
223 cpumask_and(&shared_cpu_map, 222 cpus_and(shared_cpu_map, this_leaf->shared_cpu_map, cpu_online_map);
224 &this_leaf->shared_cpu_map, cpu_online_mask);
225 len = cpumask_scnprintf(buf, NR_CPUS+1, &shared_cpu_map); 223 len = cpumask_scnprintf(buf, NR_CPUS+1, &shared_cpu_map);
226 len += sprintf(buf+len, "\n"); 224 len += sprintf(buf+len, "\n");
227 return len; 225 return len;
@@ -275,7 +273,7 @@ static struct attribute * cache_default_attrs[] = {
275#define to_object(k) container_of(k, struct cache_info, kobj) 273#define to_object(k) container_of(k, struct cache_info, kobj)
276#define to_attr(a) container_of(a, struct cache_attr, attr) 274#define to_attr(a) container_of(a, struct cache_attr, attr)
277 275
278static ssize_t ia64_cache_show(struct kobject * kobj, struct attribute * attr, char * buf) 276static ssize_t cache_show(struct kobject * kobj, struct attribute * attr, char * buf)
279{ 277{
280 struct cache_attr *fattr = to_attr(attr); 278 struct cache_attr *fattr = to_attr(attr);
281 struct cache_info *this_leaf = to_object(kobj); 279 struct cache_info *this_leaf = to_object(kobj);
@@ -286,7 +284,7 @@ static ssize_t ia64_cache_show(struct kobject * kobj, struct attribute * attr, c
286} 284}
287 285
288static const struct sysfs_ops cache_sysfs_ops = { 286static const struct sysfs_ops cache_sysfs_ops = {
289 .show = ia64_cache_show 287 .show = cache_show
290}; 288};
291 289
292static struct kobj_type cache_ktype = { 290static struct kobj_type cache_ktype = {
@@ -351,7 +349,7 @@ static int __cpuinit cpu_cache_sysfs_init(unsigned int cpu)
351} 349}
352 350
353/* Add cache interface for CPU device */ 351/* Add cache interface for CPU device */
354static int __cpuinit cache_add_dev(struct device * sys_dev) 352static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
355{ 353{
356 unsigned int cpu = sys_dev->id; 354 unsigned int cpu = sys_dev->id;
357 unsigned long i, j; 355 unsigned long i, j;
@@ -401,7 +399,7 @@ static int __cpuinit cache_add_dev(struct device * sys_dev)
401} 399}
402 400
403/* Remove cache interface for CPU device */ 401/* Remove cache interface for CPU device */
404static int __cpuinit cache_remove_dev(struct device * sys_dev) 402static int __cpuinit cache_remove_dev(struct sys_device * sys_dev)
405{ 403{
406 unsigned int cpu = sys_dev->id; 404 unsigned int cpu = sys_dev->id;
407 unsigned long i; 405 unsigned long i;
@@ -429,9 +427,9 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
429 unsigned long action, void *hcpu) 427 unsigned long action, void *hcpu)
430{ 428{
431 unsigned int cpu = (unsigned long)hcpu; 429 unsigned int cpu = (unsigned long)hcpu;
432 struct device *sys_dev; 430 struct sys_device *sys_dev;
433 431
434 sys_dev = get_cpu_device(cpu); 432 sys_dev = get_cpu_sysdev(cpu);
435 switch (action) { 433 switch (action) {
436 case CPU_ONLINE: 434 case CPU_ONLINE:
437 case CPU_ONLINE_FROZEN: 435 case CPU_ONLINE_FROZEN:
@@ -455,7 +453,7 @@ static int __init cache_sysfs_init(void)
455 int i; 453 int i;
456 454
457 for_each_online_cpu(i) { 455 for_each_online_cpu(i) {
458 struct device *sys_dev = get_cpu_device((unsigned int)i); 456 struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i);
459 cache_add_dev(sys_dev); 457 cache_add_dev(sys_dev);
460 } 458 }
461 459
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index bd42b76000d..fd80e70018a 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -22,7 +22,6 @@
22#include <asm/intrinsics.h> 22#include <asm/intrinsics.h>
23#include <asm/processor.h> 23#include <asm/processor.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/setup.h>
26 25
27fpswa_interface_t *fpswa_interface; 26fpswa_interface_t *fpswa_interface;
28EXPORT_SYMBOL(fpswa_interface); 27EXPORT_SYMBOL(fpswa_interface);
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index a96bcf83a73..6a867dc45c0 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -23,6 +23,7 @@
23#include <linux/gfp.h> 23#include <linux/gfp.h>
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/pal.h> 25#include <asm/pal.h>
26#include <asm/system.h>
26#include <asm/pgtable.h> 27#include <asm/pgtable.h>
27#include <linux/atomic.h> 28#include <linux/atomic.h>
28#include <asm/tlbflush.h> 29#include <asm/tlbflush.h>
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 8f66195999e..fed6afa2e8a 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -41,6 +41,7 @@
41#include <asm/ptrace_offsets.h> 41#include <asm/ptrace_offsets.h>
42#include <asm/rse.h> 42#include <asm/rse.h>
43#include <asm/sections.h> 43#include <asm/sections.h>
44#include <asm/system.h>
44#include <asm/uaccess.h> 45#include <asm/uaccess.h>
45 46
46#include "entry.h" 47#include "entry.h"
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 0ccb28fab27..53c0ba004e9 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -1,6 +1,7 @@
1 1
2#include <asm/cache.h> 2#include <asm/cache.h>
3#include <asm/ptrace.h> 3#include <asm/ptrace.h>
4#include <asm/system.h>
4#include <asm/pgtable.h> 5#include <asm/pgtable.h>
5 6
6#include <asm-generic/vmlinux.lds.h> 7#include <asm-generic/vmlinux.lds.h>
diff --git a/arch/ia64/kvm/Kconfig b/arch/ia64/kvm/Kconfig
index e7947528aee..9806e55f91b 100644
--- a/arch/ia64/kvm/Kconfig
+++ b/arch/ia64/kvm/Kconfig
@@ -19,11 +19,9 @@ if VIRTUALIZATION
19 19
20config KVM 20config KVM
21 tristate "Kernel-based Virtual Machine (KVM) support" 21 tristate "Kernel-based Virtual Machine (KVM) support"
22 depends on BROKEN
23 depends on HAVE_KVM && MODULES && EXPERIMENTAL 22 depends on HAVE_KVM && MODULES && EXPERIMENTAL
24 # for device assignment: 23 # for device assignment:
25 depends on PCI 24 depends on PCI
26 depends on BROKEN
27 select PREEMPT_NOTIFIERS 25 select PREEMPT_NOTIFIERS
28 select ANON_INODES 26 select ANON_INODES
29 select HAVE_KVM_IRQCHIP 27 select HAVE_KVM_IRQCHIP
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index bd1c5155503..43f4c92816e 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * kvm_ia64.c: Basic KVM support On Itanium series processors 2 * kvm_ia64.c: Basic KVM suppport On Itanium series processors
3 * 3 *
4 * 4 *
5 * Copyright (C) 2007, Intel Corporation. 5 * Copyright (C) 2007, Intel Corporation.
@@ -232,12 +232,12 @@ static int handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
232 if ((p->addr & PAGE_MASK) == IOAPIC_DEFAULT_BASE_ADDRESS) 232 if ((p->addr & PAGE_MASK) == IOAPIC_DEFAULT_BASE_ADDRESS)
233 goto mmio; 233 goto mmio;
234 vcpu->mmio_needed = 1; 234 vcpu->mmio_needed = 1;
235 vcpu->mmio_fragments[0].gpa = kvm_run->mmio.phys_addr = p->addr; 235 vcpu->mmio_phys_addr = kvm_run->mmio.phys_addr = p->addr;
236 vcpu->mmio_fragments[0].len = kvm_run->mmio.len = p->size; 236 vcpu->mmio_size = kvm_run->mmio.len = p->size;
237 vcpu->mmio_is_write = kvm_run->mmio.is_write = !p->dir; 237 vcpu->mmio_is_write = kvm_run->mmio.is_write = !p->dir;
238 238
239 if (vcpu->mmio_is_write) 239 if (vcpu->mmio_is_write)
240 memcpy(vcpu->arch.mmio_data, &p->data, p->size); 240 memcpy(vcpu->mmio_data, &p->data, p->size);
241 memcpy(kvm_run->mmio.data, &p->data, p->size); 241 memcpy(kvm_run->mmio.data, &p->data, p->size);
242 kvm_run->exit_reason = KVM_EXIT_MMIO; 242 kvm_run->exit_reason = KVM_EXIT_MMIO;
243 return 0; 243 return 0;
@@ -719,7 +719,7 @@ static void kvm_set_mmio_data(struct kvm_vcpu *vcpu)
719 struct kvm_mmio_req *p = kvm_get_vcpu_ioreq(vcpu); 719 struct kvm_mmio_req *p = kvm_get_vcpu_ioreq(vcpu);
720 720
721 if (!vcpu->mmio_is_write) 721 if (!vcpu->mmio_is_write)
722 memcpy(&p->data, vcpu->arch.mmio_data, 8); 722 memcpy(&p->data, vcpu->mmio_data, 8);
723 p->state = STATE_IORESP_READY; 723 p->state = STATE_IORESP_READY;
724} 724}
725 725
@@ -739,7 +739,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
739 } 739 }
740 740
741 if (vcpu->mmio_needed) { 741 if (vcpu->mmio_needed) {
742 memcpy(vcpu->arch.mmio_data, kvm_run->mmio.data, 8); 742 memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8);
743 kvm_set_mmio_data(vcpu); 743 kvm_set_mmio_data(vcpu);
744 vcpu->mmio_read_completed = 1; 744 vcpu->mmio_read_completed = 1;
745 vcpu->mmio_needed = 0; 745 vcpu->mmio_needed = 0;
@@ -774,13 +774,13 @@ struct kvm *kvm_arch_alloc_vm(void)
774 return kvm; 774 return kvm;
775} 775}
776 776
777struct kvm_ia64_io_range { 777struct kvm_io_range {
778 unsigned long start; 778 unsigned long start;
779 unsigned long size; 779 unsigned long size;
780 unsigned long type; 780 unsigned long type;
781}; 781};
782 782
783static const struct kvm_ia64_io_range io_ranges[] = { 783static const struct kvm_io_range io_ranges[] = {
784 {VGA_IO_START, VGA_IO_SIZE, GPFN_FRAME_BUFFER}, 784 {VGA_IO_START, VGA_IO_SIZE, GPFN_FRAME_BUFFER},
785 {MMIO_START, MMIO_SIZE, GPFN_LOW_MMIO}, 785 {MMIO_START, MMIO_SIZE, GPFN_LOW_MMIO},
786 {LEGACY_IO_START, LEGACY_IO_SIZE, GPFN_LEGACY_IO}, 786 {LEGACY_IO_START, LEGACY_IO_SIZE, GPFN_LEGACY_IO},
@@ -809,13 +809,10 @@ static void kvm_build_io_pmt(struct kvm *kvm)
809#define GUEST_PHYSICAL_RR4 0x2739 809#define GUEST_PHYSICAL_RR4 0x2739
810#define VMM_INIT_RR 0x1660 810#define VMM_INIT_RR 0x1660
811 811
812int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) 812int kvm_arch_init_vm(struct kvm *kvm)
813{ 813{
814 BUG_ON(!kvm); 814 BUG_ON(!kvm);
815 815
816 if (type)
817 return -EINVAL;
818
819 kvm->arch.is_sn2 = ia64_platform_is("sn2"); 816 kvm->arch.is_sn2 = ia64_platform_is("sn2");
820 817
821 kvm->arch.metaphysical_rr0 = GUEST_PHYSICAL_RR0; 818 kvm->arch.metaphysical_rr0 = GUEST_PHYSICAL_RR0;
@@ -924,16 +921,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
924 return 0; 921 return 0;
925} 922}
926 923
927int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event)
928{
929 if (!irqchip_in_kernel(kvm))
930 return -ENXIO;
931
932 irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID,
933 irq_event->irq, irq_event->level);
934 return 0;
935}
936
937long kvm_arch_vm_ioctl(struct file *filp, 924long kvm_arch_vm_ioctl(struct file *filp,
938 unsigned int ioctl, unsigned long arg) 925 unsigned int ioctl, unsigned long arg)
939{ 926{
@@ -973,6 +960,29 @@ long kvm_arch_vm_ioctl(struct file *filp,
973 goto out; 960 goto out;
974 } 961 }
975 break; 962 break;
963 case KVM_IRQ_LINE_STATUS:
964 case KVM_IRQ_LINE: {
965 struct kvm_irq_level irq_event;
966
967 r = -EFAULT;
968 if (copy_from_user(&irq_event, argp, sizeof irq_event))
969 goto out;
970 r = -ENXIO;
971 if (irqchip_in_kernel(kvm)) {
972 __s32 status;
973 status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID,
974 irq_event.irq, irq_event.level);
975 if (ioctl == KVM_IRQ_LINE_STATUS) {
976 r = -EFAULT;
977 irq_event.status = status;
978 if (copy_to_user(argp, &irq_event,
979 sizeof irq_event))
980 goto out;
981 }
982 r = 0;
983 }
984 break;
985 }
976 case KVM_GET_IRQCHIP: { 986 case KVM_GET_IRQCHIP: {
977 /* 0: PIC master, 1: PIC slave, 2: IOAPIC */ 987 /* 0: PIC master, 1: PIC slave, 2: IOAPIC */
978 struct kvm_irqchip chip; 988 struct kvm_irqchip chip;
@@ -1159,11 +1169,6 @@ out:
1159 1169
1160#define PALE_RESET_ENTRY 0x80000000ffffffb0UL 1170#define PALE_RESET_ENTRY 0x80000000ffffffb0UL
1161 1171
1162bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu)
1163{
1164 return irqchip_in_kernel(vcpu->kvm) == (vcpu->arch.apic != NULL);
1165}
1166
1167int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) 1172int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1168{ 1173{
1169 struct kvm_vcpu *v; 1174 struct kvm_vcpu *v;
@@ -1330,11 +1335,6 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
1330 return 0; 1335 return 0;
1331} 1336}
1332 1337
1333int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
1334{
1335 return 0;
1336}
1337
1338int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 1338int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
1339{ 1339{
1340 return -EINVAL; 1340 return -EINVAL;
@@ -1366,10 +1366,14 @@ static void kvm_release_vm_pages(struct kvm *kvm)
1366{ 1366{
1367 struct kvm_memslots *slots; 1367 struct kvm_memslots *slots;
1368 struct kvm_memory_slot *memslot; 1368 struct kvm_memory_slot *memslot;
1369 int j; 1369 int i, j;
1370 unsigned long base_gfn;
1370 1371
1371 slots = kvm_memslots(kvm); 1372 slots = kvm_memslots(kvm);
1372 kvm_for_each_memslot(memslot, slots) { 1373 for (i = 0; i < slots->nmemslots; i++) {
1374 memslot = &slots->memslots[i];
1375 base_gfn = memslot->base_gfn;
1376
1373 for (j = 0; j < memslot->npages; j++) { 1377 for (j = 0; j < memslot->npages; j++) {
1374 if (memslot->rmap[j]) 1378 if (memslot->rmap[j])
1375 put_page((struct page *)memslot->rmap[j]); 1379 put_page((struct page *)memslot->rmap[j]);
@@ -1561,21 +1565,6 @@ out:
1561 return r; 1565 return r;
1562} 1566}
1563 1567
1564int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
1565{
1566 return VM_FAULT_SIGBUS;
1567}
1568
1569void kvm_arch_free_memslot(struct kvm_memory_slot *free,
1570 struct kvm_memory_slot *dont)
1571{
1572}
1573
1574int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
1575{
1576 return 0;
1577}
1578
1579int kvm_arch_prepare_memory_region(struct kvm *kvm, 1568int kvm_arch_prepare_memory_region(struct kvm *kvm,
1580 struct kvm_memory_slot *memslot, 1569 struct kvm_memory_slot *memslot,
1581 struct kvm_memory_slot old, 1570 struct kvm_memory_slot old,
@@ -1616,17 +1605,11 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
1616 return; 1605 return;
1617} 1606}
1618 1607
1619void kvm_arch_flush_shadow_all(struct kvm *kvm) 1608void kvm_arch_flush_shadow(struct kvm *kvm)
1620{ 1609{
1621 kvm_flush_remote_tlbs(kvm); 1610 kvm_flush_remote_tlbs(kvm);
1622} 1611}
1623 1612
1624void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
1625 struct kvm_memory_slot *slot)
1626{
1627 kvm_arch_flush_shadow_all();
1628}
1629
1630long kvm_arch_dev_ioctl(struct file *filp, 1613long kvm_arch_dev_ioctl(struct file *filp,
1631 unsigned int ioctl, unsigned long arg) 1614 unsigned int ioctl, unsigned long arg)
1632{ 1615{
@@ -1837,7 +1820,7 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
1837 if (log->slot >= KVM_MEMORY_SLOTS) 1820 if (log->slot >= KVM_MEMORY_SLOTS)
1838 goto out; 1821 goto out;
1839 1822
1840 memslot = id_to_memslot(kvm->memslots, log->slot); 1823 memslot = &kvm->memslots->memslots[log->slot];
1841 r = -ENOENT; 1824 r = -ENOENT;
1842 if (!memslot->dirty_bitmap) 1825 if (!memslot->dirty_bitmap)
1843 goto out; 1826 goto out;
@@ -1868,6 +1851,21 @@ void kvm_arch_hardware_unsetup(void)
1868{ 1851{
1869} 1852}
1870 1853
1854void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
1855{
1856 int me;
1857 int cpu = vcpu->cpu;
1858
1859 if (waitqueue_active(&vcpu->wq))
1860 wake_up_interruptible(&vcpu->wq);
1861
1862 me = get_cpu();
1863 if (cpu != me && (unsigned) cpu < nr_cpu_ids && cpu_online(cpu))
1864 if (!test_and_set_bit(KVM_REQ_KICK, &vcpu->requests))
1865 smp_send_reschedule(cpu);
1866 put_cpu();
1867}
1868
1871int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq) 1869int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq)
1872{ 1870{
1873 return __apic_accept_irq(vcpu, irq->vector); 1871 return __apic_accept_irq(vcpu, irq->vector);
@@ -1937,11 +1935,6 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
1937 (kvm_highest_pending_irq(vcpu) != -1); 1935 (kvm_highest_pending_irq(vcpu) != -1);
1938} 1936}
1939 1937
1940int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
1941{
1942 return (!test_and_set_bit(KVM_REQ_KICK, &vcpu->requests));
1943}
1944
1945int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, 1938int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
1946 struct kvm_mp_state *mp_state) 1939 struct kvm_mp_state *mp_state)
1947{ 1940{
diff --git a/arch/ia64/kvm/vmm.c b/arch/ia64/kvm/vmm.c
index 176a12cd56d..f0b9cac8241 100644
--- a/arch/ia64/kvm/vmm.c
+++ b/arch/ia64/kvm/vmm.c
@@ -20,9 +20,9 @@
20 */ 20 */
21 21
22 22
23#include <linux/kernel.h> 23#include<linux/kernel.h>
24#include <linux/module.h> 24#include<linux/module.h>
25#include <asm/fpswa.h> 25#include<asm/fpswa.h>
26 26
27#include "vcpu.h" 27#include "vcpu.h"
28 28
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 1516d1dc11f..f114a3b14c6 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -16,7 +16,6 @@
16 */ 16 */
17#include <linux/bootmem.h> 17#include <linux/bootmem.h>
18#include <linux/efi.h> 18#include <linux/efi.h>
19#include <linux/memblock.h>
20#include <linux/mm.h> 19#include <linux/mm.h>
21#include <linux/nmi.h> 20#include <linux/nmi.h>
22#include <linux/swap.h> 21#include <linux/swap.h>
@@ -349,7 +348,7 @@ paging_init (void)
349 printk("Virtual mem_map starts at 0x%p\n", mem_map); 348 printk("Virtual mem_map starts at 0x%p\n", mem_map);
350 } 349 }
351#else /* !CONFIG_VIRTUAL_MEM_MAP */ 350#else /* !CONFIG_VIRTUAL_MEM_MAP */
352 memblock_add_node(0, PFN_PHYS(max_low_pfn), 0); 351 add_active_range(0, 0, max_low_pfn);
353 free_area_init_nodes(max_zone_pfns); 352 free_area_init_nodes(max_zone_pfns);
354#endif /* !CONFIG_VIRTUAL_MEM_MAP */ 353#endif /* !CONFIG_VIRTUAL_MEM_MAP */
355 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page)); 354 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 6cf0341f978..20b35937612 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -14,6 +14,7 @@
14 14
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/processor.h> 16#include <asm/processor.h>
17#include <asm/system.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18 19
19extern int die(char *, struct pt_regs *, long); 20extern int die(char *, struct pt_regs *, long);
@@ -72,10 +73,6 @@ mapped_kernel_page_is_present (unsigned long address)
72 return pte_present(pte); 73 return pte_present(pte);
73} 74}
74 75
75# define VM_READ_BIT 0
76# define VM_WRITE_BIT 1
77# define VM_EXEC_BIT 2
78
79void __kprobes 76void __kprobes
80ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *regs) 77ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *regs)
81{ 78{
@@ -85,12 +82,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
85 struct siginfo si; 82 struct siginfo si;
86 unsigned long mask; 83 unsigned long mask;
87 int fault; 84 int fault;
88 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
89
90 mask = ((((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
91 | (((isr >> IA64_ISR_W_BIT) & 1UL) << VM_WRITE_BIT));
92
93 flags |= ((mask & VM_WRITE) ? FAULT_FLAG_WRITE : 0);
94 85
95 /* mmap_sem is performance critical.... */ 86 /* mmap_sem is performance critical.... */
96 prefetchw(&mm->mmap_sem); 87 prefetchw(&mm->mmap_sem);
@@ -119,7 +110,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
119 if (notify_page_fault(regs, TRAP_BRKPT)) 110 if (notify_page_fault(regs, TRAP_BRKPT))
120 return; 111 return;
121 112
122retry:
123 down_read(&mm->mmap_sem); 113 down_read(&mm->mmap_sem);
124 114
125 vma = find_vma_prev(mm, address, &prev_vma); 115 vma = find_vma_prev(mm, address, &prev_vma);
@@ -141,6 +131,10 @@ retry:
141 131
142 /* OK, we've got a good vm_area for this memory area. Check the access permissions: */ 132 /* OK, we've got a good vm_area for this memory area. Check the access permissions: */
143 133
134# define VM_READ_BIT 0
135# define VM_WRITE_BIT 1
136# define VM_EXEC_BIT 2
137
144# if (((1 << VM_READ_BIT) != VM_READ || (1 << VM_WRITE_BIT) != VM_WRITE) \ 138# if (((1 << VM_READ_BIT) != VM_READ || (1 << VM_WRITE_BIT) != VM_WRITE) \
145 || (1 << VM_EXEC_BIT) != VM_EXEC) 139 || (1 << VM_EXEC_BIT) != VM_EXEC)
146# error File is out of sync with <linux/mm.h>. Please update. 140# error File is out of sync with <linux/mm.h>. Please update.
@@ -149,6 +143,9 @@ retry:
149 if (((isr >> IA64_ISR_R_BIT) & 1UL) && (!(vma->vm_flags & (VM_READ | VM_WRITE)))) 143 if (((isr >> IA64_ISR_R_BIT) & 1UL) && (!(vma->vm_flags & (VM_READ | VM_WRITE))))
150 goto bad_area; 144 goto bad_area;
151 145
146 mask = ( (((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
147 | (((isr >> IA64_ISR_W_BIT) & 1UL) << VM_WRITE_BIT));
148
152 if ((vma->vm_flags & mask) != mask) 149 if ((vma->vm_flags & mask) != mask)
153 goto bad_area; 150 goto bad_area;
154 151
@@ -157,11 +154,7 @@ retry:
157 * sure we exit gracefully rather than endlessly redo the 154 * sure we exit gracefully rather than endlessly redo the
158 * fault. 155 * fault.
159 */ 156 */
160 fault = handle_mm_fault(mm, vma, address, flags); 157 fault = handle_mm_fault(mm, vma, address, (mask & VM_WRITE) ? FAULT_FLAG_WRITE : 0);
161
162 if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
163 return;
164
165 if (unlikely(fault & VM_FAULT_ERROR)) { 158 if (unlikely(fault & VM_FAULT_ERROR)) {
166 /* 159 /*
167 * We ran out of memory, or some other thing happened 160 * We ran out of memory, or some other thing happened
@@ -176,25 +169,10 @@ retry:
176 } 169 }
177 BUG(); 170 BUG();
178 } 171 }
179 172 if (fault & VM_FAULT_MAJOR)
180 if (flags & FAULT_FLAG_ALLOW_RETRY) { 173 current->maj_flt++;
181 if (fault & VM_FAULT_MAJOR) 174 else
182 current->maj_flt++; 175 current->min_flt++;
183 else
184 current->min_flt++;
185 if (fault & VM_FAULT_RETRY) {
186 flags &= ~FAULT_FLAG_ALLOW_RETRY;
187 flags |= FAULT_FLAG_TRIED;
188
189 /* No need to up_read(&mm->mmap_sem) as we would
190 * have already released it in __lock_page_or_retry
191 * in mm/filemap.c.
192 */
193
194 goto retry;
195 }
196 }
197
198 up_read(&mm->mmap_sem); 176 up_read(&mm->mmap_sem);
199 return; 177 return;
200 178
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index b755ea92aea..00cb0e26c64 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -10,7 +10,6 @@
10#include <linux/bootmem.h> 10#include <linux/bootmem.h>
11#include <linux/efi.h> 11#include <linux/efi.h>
12#include <linux/elf.h> 12#include <linux/elf.h>
13#include <linux/memblock.h>
14#include <linux/mm.h> 13#include <linux/mm.h>
15#include <linux/mmzone.h> 14#include <linux/mmzone.h>
16#include <linux/module.h> 15#include <linux/module.h>
@@ -30,6 +29,7 @@
30#include <asm/pgalloc.h> 29#include <asm/pgalloc.h>
31#include <asm/sal.h> 30#include <asm/sal.h>
32#include <asm/sections.h> 31#include <asm/sections.h>
32#include <asm/system.h>
33#include <asm/tlb.h> 33#include <asm/tlb.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include <asm/unistd.h> 35#include <asm/unistd.h>
@@ -138,8 +138,7 @@ ia64_init_addr_space (void)
138 vma->vm_mm = current->mm; 138 vma->vm_mm = current->mm;
139 vma->vm_end = PAGE_SIZE; 139 vma->vm_end = PAGE_SIZE;
140 vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT); 140 vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT);
141 vma->vm_flags = VM_READ | VM_MAYREAD | VM_IO | 141 vma->vm_flags = VM_READ | VM_MAYREAD | VM_IO | VM_RESERVED;
142 VM_DONTEXPAND | VM_DONTDUMP;
143 down_write(&current->mm->mmap_sem); 142 down_write(&current->mm->mmap_sem);
144 if (insert_vm_struct(current->mm, vma)) { 143 if (insert_vm_struct(current->mm, vma)) {
145 up_write(&current->mm->mmap_sem); 144 up_write(&current->mm->mmap_sem);
@@ -294,10 +293,11 @@ setup_gate (void)
294 ia64_patch_gate(); 293 ia64_patch_gate();
295} 294}
296 295
297void ia64_mmu_init(void *my_cpu_data) 296void __devinit
297ia64_mmu_init (void *my_cpu_data)
298{ 298{
299 unsigned long pta, impl_va_bits; 299 unsigned long pta, impl_va_bits;
300 extern void tlb_init(void); 300 extern void __devinit tlb_init (void);
301 301
302#ifdef CONFIG_DISABLE_VHPT 302#ifdef CONFIG_DISABLE_VHPT
303# define VHPT_ENABLE_BIT 0 303# define VHPT_ENABLE_BIT 0
@@ -557,7 +557,8 @@ int __init register_active_ranges(u64 start, u64 len, int nid)
557#endif 557#endif
558 558
559 if (start < end) 559 if (start < end)
560 memblock_add_node(__pa(start), end - start, nid); 560 add_active_range(nid, __pa(start) >> PAGE_SHIFT,
561 __pa(end) >> PAGE_SHIFT);
561 return 0; 562 return 0;
562} 563}
563 564
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index ed612976868..7b3cdc6c6d9 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -337,7 +337,8 @@ flush_tlb_range (struct vm_area_struct *vma, unsigned long start,
337} 337}
338EXPORT_SYMBOL(flush_tlb_range); 338EXPORT_SYMBOL(flush_tlb_range);
339 339
340void ia64_tlb_init(void) 340void __devinit
341ia64_tlb_init (void)
341{ 342{
342 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */ 343 ia64_ptce_info_t uninitialized_var(ptce_info); /* GCC be quiet */
343 u64 tr_pgbits; 344 u64 tr_pgbits;
diff --git a/arch/ia64/oprofile/backtrace.c b/arch/ia64/oprofile/backtrace.c
index 6a219a94605..f7b798993ce 100644
--- a/arch/ia64/oprofile/backtrace.c
+++ b/arch/ia64/oprofile/backtrace.c
@@ -14,6 +14,7 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/system.h>
17 18
18/* 19/*
19 * For IA64 we need to perform a complex little dance to get both 20 * For IA64 we need to perform a complex little dance to get both
diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c
index 5dc969dd4ac..f5959c0c181 100644
--- a/arch/ia64/pci/fixup.c
+++ b/arch/ia64/pci/fixup.c
@@ -24,14 +24,14 @@
24 * video device at this point. 24 * video device at this point.
25 */ 25 */
26 26
27static void pci_fixup_video(struct pci_dev *pdev) 27static void __devinit pci_fixup_video(struct pci_dev *pdev)
28{ 28{
29 struct pci_dev *bridge; 29 struct pci_dev *bridge;
30 struct pci_bus *bus; 30 struct pci_bus *bus;
31 u16 config; 31 u16 config;
32 32
33 if ((strcmp(ia64_platform_name, "dig") != 0) 33 if ((strcmp(platform_name, "dig") != 0)
34 && (strcmp(ia64_platform_name, "hpzx1") != 0)) 34 && (strcmp(platform_name, "hpzx1") != 0))
35 return; 35 return;
36 /* Maybe, this machine supports legacy memory map. */ 36 /* Maybe, this machine supports legacy memory map. */
37 37
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 55b72ad5732..aa2533ae7e9 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -20,10 +20,10 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/export.h>
24 23
25#include <asm/machvec.h> 24#include <asm/machvec.h>
26#include <asm/page.h> 25#include <asm/page.h>
26#include <asm/system.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/sal.h> 28#include <asm/sal.h>
29#include <asm/smp.h> 29#include <asm/smp.h>
@@ -116,7 +116,8 @@ struct pci_ops pci_root_ops = {
116 116
117/* Called by ACPI when it finds a new root bus. */ 117/* Called by ACPI when it finds a new root bus. */
118 118
119static struct pci_controller *alloc_pci_controller(int seg) 119static struct pci_controller * __devinit
120alloc_pci_controller (int seg)
120{ 121{
121 struct pci_controller *controller; 122 struct pci_controller *controller;
122 123
@@ -132,7 +133,6 @@ static struct pci_controller *alloc_pci_controller(int seg)
132struct pci_root_info { 133struct pci_root_info {
133 struct acpi_device *bridge; 134 struct acpi_device *bridge;
134 struct pci_controller *controller; 135 struct pci_controller *controller;
135 struct list_head resources;
136 char *name; 136 char *name;
137}; 137};
138 138
@@ -164,8 +164,8 @@ new_space (u64 phys_base, int sparse)
164 return i; 164 return i;
165} 165}
166 166
167static u64 add_io_space(struct pci_root_info *info, 167static u64 __devinit
168 struct acpi_resource_address64 *addr) 168add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
169{ 169{
170 struct resource *resource; 170 struct resource *resource;
171 char *name; 171 char *name;
@@ -225,8 +225,8 @@ out:
225 return ~0; 225 return ~0;
226} 226}
227 227
228static acpi_status resource_to_window(struct acpi_resource *resource, 228static acpi_status __devinit resource_to_window(struct acpi_resource *resource,
229 struct acpi_resource_address64 *addr) 229 struct acpi_resource_address64 *addr)
230{ 230{
231 acpi_status status; 231 acpi_status status;
232 232
@@ -248,7 +248,8 @@ static acpi_status resource_to_window(struct acpi_resource *resource,
248 return AE_ERROR; 248 return AE_ERROR;
249} 249}
250 250
251static acpi_status count_window(struct acpi_resource *resource, void *data) 251static acpi_status __devinit
252count_window (struct acpi_resource *resource, void *data)
252{ 253{
253 unsigned int *windows = (unsigned int *) data; 254 unsigned int *windows = (unsigned int *) data;
254 struct acpi_resource_address64 addr; 255 struct acpi_resource_address64 addr;
@@ -261,7 +262,7 @@ static acpi_status count_window(struct acpi_resource *resource, void *data)
261 return AE_OK; 262 return AE_OK;
262} 263}
263 264
264static acpi_status add_window(struct acpi_resource *res, void *data) 265static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
265{ 266{
266 struct pci_root_info *info = data; 267 struct pci_root_info *info = data;
267 struct pci_window *window; 268 struct pci_window *window;
@@ -293,6 +294,7 @@ static acpi_status add_window(struct acpi_resource *res, void *data)
293 window->resource.flags = flags; 294 window->resource.flags = flags;
294 window->resource.start = addr.minimum + offset; 295 window->resource.start = addr.minimum + offset;
295 window->resource.end = window->resource.start + addr.address_length - 1; 296 window->resource.end = window->resource.start + addr.address_length - 1;
297 window->resource.child = NULL;
296 window->offset = offset; 298 window->offset = offset;
297 299
298 if (insert_resource(root, &window->resource)) { 300 if (insert_resource(root, &window->resource)) {
@@ -312,24 +314,34 @@ static acpi_status add_window(struct acpi_resource *res, void *data)
312 &window->resource); 314 &window->resource);
313 } 315 }
314 316
315 /* HP's firmware has a hack to work around a Windows bug.
316 * Ignore these tiny memory ranges */
317 if (!((window->resource.flags & IORESOURCE_MEM) &&
318 (window->resource.end - window->resource.start < 16)))
319 pci_add_resource_offset(&info->resources, &window->resource,
320 window->offset);
321
322 return AE_OK; 317 return AE_OK;
323} 318}
324 319
325struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) 320static void __devinit
321pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
322{
323 int i;
324
325 pci_bus_remove_resources(bus);
326 for (i = 0; i < ctrl->windows; i++) {
327 struct resource *res = &ctrl->window[i].resource;
328 /* HP's firmware has a hack to work around a Windows bug.
329 * Ignore these tiny memory ranges */
330 if ((res->flags & IORESOURCE_MEM) &&
331 (res->end - res->start < 16))
332 continue;
333 pci_bus_add_resource(bus, res, 0);
334 }
335}
336
337struct pci_bus * __devinit
338pci_acpi_scan_root(struct acpi_pci_root *root)
326{ 339{
327 struct acpi_device *device = root->device; 340 struct acpi_device *device = root->device;
328 int domain = root->segment; 341 int domain = root->segment;
329 int bus = root->secondary.start; 342 int bus = root->secondary.start;
330 struct pci_controller *controller; 343 struct pci_controller *controller;
331 unsigned int windows = 0; 344 unsigned int windows = 0;
332 struct pci_root_info info;
333 struct pci_bus *pbus; 345 struct pci_bus *pbus;
334 char *name; 346 char *name;
335 int pxm; 347 int pxm;
@@ -346,14 +358,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
346 controller->node = pxm_to_node(pxm); 358 controller->node = pxm_to_node(pxm);
347#endif 359#endif
348 360
349 INIT_LIST_HEAD(&info.resources);
350 /* insert busn resource at first */
351 pci_add_resource(&info.resources, &root->secondary);
352 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window, 361 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
353 &windows); 362 &windows);
354 if (windows) { 363 if (windows) {
364 struct pci_root_info info;
365
355 controller->window = 366 controller->window =
356 kzalloc_node(sizeof(*controller->window) * windows, 367 kmalloc_node(sizeof(*controller->window) * windows,
357 GFP_KERNEL, controller->node); 368 GFP_KERNEL, controller->node);
358 if (!controller->window) 369 if (!controller->window)
359 goto out2; 370 goto out2;
@@ -375,14 +386,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
375 * should handle the case here, but it appears that IA64 hasn't 386 * should handle the case here, but it appears that IA64 hasn't
376 * such quirk. So we just ignore the case now. 387 * such quirk. So we just ignore the case now.
377 */ 388 */
378 pbus = pci_create_root_bus(NULL, bus, &pci_root_ops, controller, 389 pbus = pci_scan_bus_parented(NULL, bus, &pci_root_ops, controller);
379 &info.resources);
380 if (!pbus) {
381 pci_free_resource_list(&info.resources);
382 return NULL;
383 }
384 390
385 pci_scan_child_bus(pbus);
386 return pbus; 391 return pbus;
387 392
388out3: 393out3:
@@ -393,7 +398,55 @@ out1:
393 return NULL; 398 return NULL;
394} 399}
395 400
396static int is_valid_resource(struct pci_dev *dev, int idx) 401void pcibios_resource_to_bus(struct pci_dev *dev,
402 struct pci_bus_region *region, struct resource *res)
403{
404 struct pci_controller *controller = PCI_CONTROLLER(dev);
405 unsigned long offset = 0;
406 int i;
407
408 for (i = 0; i < controller->windows; i++) {
409 struct pci_window *window = &controller->window[i];
410 if (!(window->resource.flags & res->flags))
411 continue;
412 if (window->resource.start > res->start)
413 continue;
414 if (window->resource.end < res->end)
415 continue;
416 offset = window->offset;
417 break;
418 }
419
420 region->start = res->start - offset;
421 region->end = res->end - offset;
422}
423EXPORT_SYMBOL(pcibios_resource_to_bus);
424
425void pcibios_bus_to_resource(struct pci_dev *dev,
426 struct resource *res, struct pci_bus_region *region)
427{
428 struct pci_controller *controller = PCI_CONTROLLER(dev);
429 unsigned long offset = 0;
430 int i;
431
432 for (i = 0; i < controller->windows; i++) {
433 struct pci_window *window = &controller->window[i];
434 if (!(window->resource.flags & res->flags))
435 continue;
436 if (window->resource.start - window->offset > region->start)
437 continue;
438 if (window->resource.end - window->offset < region->end)
439 continue;
440 offset = window->offset;
441 break;
442 }
443
444 res->start = region->start + offset;
445 res->end = region->end + offset;
446}
447EXPORT_SYMBOL(pcibios_bus_to_resource);
448
449static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
397{ 450{
398 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM; 451 unsigned int i, type_mask = IORESOURCE_IO | IORESOURCE_MEM;
399 struct resource *devr = &dev->resource[idx], *busr; 452 struct resource *devr = &dev->resource[idx], *busr;
@@ -411,25 +464,30 @@ static int is_valid_resource(struct pci_dev *dev, int idx)
411 return 0; 464 return 0;
412} 465}
413 466
414static void pcibios_fixup_resources(struct pci_dev *dev, int start, int limit) 467static void __devinit
468pcibios_fixup_resources(struct pci_dev *dev, int start, int limit)
415{ 469{
470 struct pci_bus_region region;
416 int i; 471 int i;
417 472
418 for (i = start; i < limit; i++) { 473 for (i = start; i < limit; i++) {
419 if (!dev->resource[i].flags) 474 if (!dev->resource[i].flags)
420 continue; 475 continue;
476 region.start = dev->resource[i].start;
477 region.end = dev->resource[i].end;
478 pcibios_bus_to_resource(dev, &dev->resource[i], &region);
421 if ((is_valid_resource(dev, i))) 479 if ((is_valid_resource(dev, i)))
422 pci_claim_resource(dev, i); 480 pci_claim_resource(dev, i);
423 } 481 }
424} 482}
425 483
426void pcibios_fixup_device_resources(struct pci_dev *dev) 484void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
427{ 485{
428 pcibios_fixup_resources(dev, 0, PCI_BRIDGE_RESOURCES); 486 pcibios_fixup_resources(dev, 0, PCI_BRIDGE_RESOURCES);
429} 487}
430EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources); 488EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources);
431 489
432static void pcibios_fixup_bridge_resources(struct pci_dev *dev) 490static void __devinit pcibios_fixup_bridge_resources(struct pci_dev *dev)
433{ 491{
434 pcibios_fixup_resources(dev, PCI_BRIDGE_RESOURCES, PCI_NUM_RESOURCES); 492 pcibios_fixup_resources(dev, PCI_BRIDGE_RESOURCES, PCI_NUM_RESOURCES);
435} 493}
@@ -437,22 +495,30 @@ static void pcibios_fixup_bridge_resources(struct pci_dev *dev)
437/* 495/*
438 * Called after each bus is probed, but before its children are examined. 496 * Called after each bus is probed, but before its children are examined.
439 */ 497 */
440void pcibios_fixup_bus(struct pci_bus *b) 498void __devinit
499pcibios_fixup_bus (struct pci_bus *b)
441{ 500{
442 struct pci_dev *dev; 501 struct pci_dev *dev;
443 502
444 if (b->self) { 503 if (b->self) {
445 pci_read_bridge_bases(b); 504 pci_read_bridge_bases(b);
446 pcibios_fixup_bridge_resources(b->self); 505 pcibios_fixup_bridge_resources(b->self);
506 } else {
507 pcibios_setup_root_windows(b, b->sysdata);
447 } 508 }
448 list_for_each_entry(dev, &b->devices, bus_list) 509 list_for_each_entry(dev, &b->devices, bus_list)
449 pcibios_fixup_device_resources(dev); 510 pcibios_fixup_device_resources(dev);
450 platform_pci_fixup_bus(b); 511 platform_pci_fixup_bus(b);
512
513 return;
451} 514}
452 515
453void pcibios_set_master (struct pci_dev *dev) 516void __devinit
517pcibios_update_irq (struct pci_dev *dev, int irq)
454{ 518{
455 /* No special bus mastering setup handling */ 519 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
520
521 /* ??? FIXME -- record old value for shutdown. */
456} 522}
457 523
458int 524int
@@ -484,6 +550,15 @@ pcibios_align_resource (void *data, const struct resource *res,
484 return res->start; 550 return res->start;
485} 551}
486 552
553/*
554 * PCI BIOS setup, always defaults to SAL interface
555 */
556char * __init
557pcibios_setup (char *str)
558{
559 return str;
560}
561
487int 562int
488pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma, 563pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
489 enum pci_mmap_state mmap_state, int write_combine) 564 enum pci_mmap_state mmap_state, int write_combine)
diff --git a/arch/ia64/sn/kernel/huberror.c b/arch/ia64/sn/kernel/huberror.c
index f925dec2da9..08b0d9bb62e 100644
--- a/arch/ia64/sn/kernel/huberror.c
+++ b/arch/ia64/sn/kernel/huberror.c
@@ -192,7 +192,6 @@ void hub_error_init(struct hubdev_info *hubdev_info)
192 hubdev_info); 192 hubdev_info);
193 return; 193 return;
194 } 194 }
195 irq_set_handler(SGI_II_ERROR, handle_level_irq);
196 sn_set_err_irq_affinity(SGI_II_ERROR); 195 sn_set_err_irq_affinity(SGI_II_ERROR);
197} 196}
198 197
@@ -214,7 +213,6 @@ void ice_error_init(struct hubdev_info *hubdev_info)
214 hubdev_info); 213 hubdev_info);
215 return; 214 return;
216 } 215 }
217 irq_set_handler(SGI_TIO_ERROR, handle_level_irq);
218 sn_set_err_irq_affinity(SGI_TIO_ERROR); 216 sn_set_err_irq_affinity(SGI_TIO_ERROR);
219} 217}
220 218
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index b1725398b5a..8cdcb173a13 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -14,7 +14,6 @@
14#include "xtalk/hubdev.h" 14#include "xtalk/hubdev.h"
15#include <linux/acpi.h> 15#include <linux/acpi.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/export.h>
18 17
19 18
20/* 19/*
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 11f2275570f..4433dd019d3 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/export.h>
11#include <linux/slab.h> 10#include <linux/slab.h>
12#include <asm/sn/types.h> 11#include <asm/sn/types.h>
13#include <asm/sn/addrs.h> 12#include <asm/sn/addrs.h>
@@ -229,6 +228,7 @@ void sn_pci_fixup_slot(struct pci_dev *dev, struct pcidev_info *pcidev_info,
229{ 228{
230 int segment = pci_domain_nr(dev->bus); 229 int segment = pci_domain_nr(dev->bus);
231 struct pcibus_bussoft *bs; 230 struct pcibus_bussoft *bs;
231 struct pci_bus *host_pci_bus;
232 struct pci_dev *host_pci_dev; 232 struct pci_dev *host_pci_dev;
233 unsigned int bus_no, devfn; 233 unsigned int bus_no, devfn;
234 234
@@ -244,7 +244,8 @@ void sn_pci_fixup_slot(struct pci_dev *dev, struct pcidev_info *pcidev_info,
244 244
245 bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff; 245 bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff;
246 devfn = pcidev_info->pdi_slot_host_handle & 0xffffffff; 246 devfn = pcidev_info->pdi_slot_host_handle & 0xffffffff;
247 host_pci_dev = pci_get_domain_bus_and_slot(segment, bus_no, devfn); 247 host_pci_bus = pci_find_bus(segment, bus_no);
248 host_pci_dev = pci_get_slot(host_pci_bus, devfn);
248 249
249 pcidev_info->host_pci_dev = host_pci_dev; 250 pcidev_info->host_pci_dev = host_pci_dev;
250 pcidev_info->pdi_linux_pcidev = dev; 251 pcidev_info->pdi_linux_pcidev = dev;
@@ -435,7 +436,8 @@ void sn_generate_path(struct pci_bus *pci_bus, char *address)
435 geo_slot(geoid)); 436 geo_slot(geoid));
436} 437}
437 438
438void sn_pci_fixup_bus(struct pci_bus *bus) 439void __devinit
440sn_pci_fixup_bus(struct pci_bus *bus)
439{ 441{
440 442
441 if (SN_ACPI_BASE_SUPPORT()) 443 if (SN_ACPI_BASE_SUPPORT())
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 238e2c511d9..98079f29d9a 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -7,7 +7,6 @@
7 */ 7 */
8 8
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/export.h>
11#include <asm/sn/types.h> 10#include <asm/sn/types.h>
12#include <asm/sn/addrs.h> 11#include <asm/sn/addrs.h>
13#include <asm/sn/io.h> 12#include <asm/sn/io.h>
@@ -297,8 +296,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
297 s64 status = 0; 296 s64 status = 0;
298 struct pci_controller *controller; 297 struct pci_controller *controller;
299 struct pcibus_bussoft *prom_bussoft_ptr; 298 struct pcibus_bussoft *prom_bussoft_ptr;
300 LIST_HEAD(resources); 299
301 int i;
302 300
303 status = sal_get_pcibus_info((u64) segment, (u64) busnum, 301 status = sal_get_pcibus_info((u64) segment, (u64) busnum,
304 (u64) ia64_tpa(&prom_bussoft_ptr)); 302 (u64) ia64_tpa(&prom_bussoft_ptr));
@@ -316,15 +314,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
316 */ 314 */
317 controller->platform_data = prom_bussoft_ptr; 315 controller->platform_data = prom_bussoft_ptr;
318 316
319 sn_legacy_pci_window_fixup(controller, 317 bus = pci_scan_bus(busnum, &pci_root_ops, controller);
320 prom_bussoft_ptr->bs_legacy_io,
321 prom_bussoft_ptr->bs_legacy_mem);
322 for (i = 0; i < controller->windows; i++)
323 pci_add_resource_offset(&resources,
324 &controller->window[i].resource,
325 controller->window[i].offset);
326 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller,
327 &resources);
328 if (bus == NULL) 318 if (bus == NULL)
329 goto error_return; /* error, or bus already scanned */ 319 goto error_return; /* error, or bus already scanned */
330 320
@@ -357,6 +347,9 @@ sn_bus_fixup(struct pci_bus *bus)
357 return; 347 return;
358 } 348 }
359 sn_common_bus_fixup(bus, prom_bussoft_ptr); 349 sn_common_bus_fixup(bus, prom_bussoft_ptr);
350 sn_legacy_pci_window_fixup(PCI_CONTROLLER(bus),
351 prom_bussoft_ptr->bs_legacy_io,
352 prom_bussoft_ptr->bs_legacy_mem);
360 } 353 }
361 list_for_each_entry(pci_dev, &bus->devices, bus_list) { 354 list_for_each_entry(pci_dev, &bus->devices, bus_list) {
362 sn_io_slot_fixup(pci_dev); 355 sn_io_slot_fixup(pci_dev);
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 62cf4dde6a0..485c42d97e8 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -150,11 +150,12 @@ struct sn_irq_info *sn_retarget_vector(struct sn_irq_info *sn_irq_info,
150 * PROM does not support SAL_INTR_REDIRECT, or it failed. 150 * PROM does not support SAL_INTR_REDIRECT, or it failed.
151 * Revert to old method. 151 * Revert to old method.
152 */ 152 */
153 new_irq_info = kmemdup(sn_irq_info, sizeof(struct sn_irq_info), 153 new_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_ATOMIC);
154 GFP_ATOMIC);
155 if (new_irq_info == NULL) 154 if (new_irq_info == NULL)
156 return NULL; 155 return NULL;
157 156
157 memcpy(new_irq_info, sn_irq_info, sizeof(struct sn_irq_info));
158
158 /* Free the old PROM new_irq_info structure */ 159 /* Free the old PROM new_irq_info structure */
159 sn_intr_free(local_nasid, local_widget, new_irq_info); 160 sn_intr_free(local_nasid, local_widget, new_irq_info);
160 unregister_intr_pda(new_irq_info); 161 unregister_intr_pda(new_irq_info);
@@ -352,8 +353,6 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
352 spin_lock(&sn_irq_info_lock); 353 spin_lock(&sn_irq_info_lock);
353 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]); 354 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]);
354 reserve_irq_vector(sn_irq_info->irq_irq); 355 reserve_irq_vector(sn_irq_info->irq_irq);
355 if (sn_irq_info->irq_int_bit != -1)
356 irq_set_handler(sn_irq_info->irq_irq, handle_level_irq);
357 spin_unlock(&sn_irq_info_lock); 356 spin_unlock(&sn_irq_info_lock);
358 357
359 register_intr_pda(sn_irq_info); 358 register_intr_pda(sn_irq_info);
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index f82e7b462b7..77db0b514fa 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -33,9 +33,9 @@
33#include <asm/io.h> 33#include <asm/io.h>
34#include <asm/sal.h> 34#include <asm/sal.h>
35#include <asm/machvec.h> 35#include <asm/machvec.h>
36#include <asm/system.h>
36#include <asm/processor.h> 37#include <asm/processor.h>
37#include <asm/vga.h> 38#include <asm/vga.h>
38#include <asm/setup.h>
39#include <asm/sn/arch.h> 39#include <asm/sn/arch.h>
40#include <asm/sn/addrs.h> 40#include <asm/sn/addrs.h>
41#include <asm/sn/pda.h> 41#include <asm/sn/pda.h>
diff --git a/arch/ia64/sn/kernel/sn2/prominfo_proc.c b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
index 20b88cb1881..e6332881864 100644
--- a/arch/ia64/sn/kernel/sn2/prominfo_proc.c
+++ b/arch/ia64/sn/kernel/sn2/prominfo_proc.c
@@ -12,6 +12,7 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/nodemask.h> 14#include <linux/nodemask.h>
15#include <asm/system.h>
15#include <asm/io.h> 16#include <asm/io.h>
16#include <asm/sn/sn_sal.h> 17#include <asm/sn/sn_sal.h>
17#include <asm/sn/sn_cpuid.h> 18#include <asm/sn/sn_cpuid.h>
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index 68c84541162..e884ba4e031 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -26,6 +26,7 @@
26#include <asm/processor.h> 26#include <asm/processor.h>
27#include <asm/irq.h> 27#include <asm/irq.h>
28#include <asm/sal.h> 28#include <asm/sal.h>
29#include <asm/system.h>
29#include <asm/delay.h> 30#include <asm/delay.h>
30#include <asm/io.h> 31#include <asm/io.h>
31#include <asm/smp.h> 32#include <asm/smp.h>
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index b9992571c03..30862c0358c 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -25,7 +25,6 @@
25 25
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/export.h>
29#include <linux/vmalloc.h> 28#include <linux/vmalloc.h>
30#include <linux/seq_file.h> 29#include <linux/seq_file.h>
31#include <linux/miscdevice.h> 30#include <linux/miscdevice.h>
@@ -616,15 +615,11 @@ static int sn_hwperf_op_cpu(struct sn_hwperf_op_info *op_info)
616 } 615 }
617 } 616 }
618 617
619 if (cpu == SN_HWPERF_ARG_ANY_CPU) { 618 if (cpu == SN_HWPERF_ARG_ANY_CPU || cpu == get_cpu()) {
620 /* don't care which cpu */ 619 /* don't care, or already on correct cpu */
621 sn_hwperf_call_sal(op_info); 620 sn_hwperf_call_sal(op_info);
622 } else if (cpu == get_cpu()) { 621 }
623 /* already on correct cpu */ 622 else {
624 sn_hwperf_call_sal(op_info);
625 put_cpu();
626 } else {
627 put_cpu();
628 if (use_ipi) { 623 if (use_ipi) {
629 /* use an interprocessor interrupt to call SAL */ 624 /* use an interprocessor interrupt to call SAL */
630 smp_call_function_single(cpu, sn_hwperf_call_sal, 625 smp_call_function_single(cpu, sn_hwperf_call_sal,
@@ -977,7 +972,7 @@ int sn_hwperf_get_nearest_node(cnodeid_t node,
977 return e; 972 return e;
978} 973}
979 974
980static int sn_hwperf_misc_register_init(void) 975static int __devinit sn_hwperf_misc_register_init(void)
981{ 976{
982 int e; 977 int e;
983 978
diff --git a/arch/ia64/sn/kernel/sn2/timer.c b/arch/ia64/sn/kernel/sn2/timer.c
index abab8f99e91..0f8844e4936 100644
--- a/arch/ia64/sn/kernel/sn2/timer.c
+++ b/arch/ia64/sn/kernel/sn2/timer.c
@@ -14,6 +14,7 @@
14#include <linux/clocksource.h> 14#include <linux/clocksource.h>
15 15
16#include <asm/hw_irq.h> 16#include <asm/hw_irq.h>
17#include <asm/system.h>
17#include <asm/timex.h> 18#include <asm/timex.h>
18 19
19#include <asm/sn/leds.h> 20#include <asm/sn/leds.h>
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 14c1711238c..c1bd1cfda32 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -14,6 +14,7 @@
14#include <linux/capability.h> 14#include <linux/capability.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <asm/system.h>
17#include <asm/uaccess.h> 18#include <asm/uaccess.h>
18#include <asm/sn/sn_sal.h> 19#include <asm/sn/sn_sal.h>
19#include <asm/sn/addrs.h> 20#include <asm/sn/addrs.h>
@@ -190,7 +191,6 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
190 struct hubdev_info *hubdev, int bt) 191 struct hubdev_info *hubdev, int bt)
191{ 192{
192 struct cx_dev *cx_dev; 193 struct cx_dev *cx_dev;
193 int r;
194 194
195 cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL); 195 cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL);
196 DBG("cx_dev= 0x%p\n", cx_dev); 196 DBG("cx_dev= 0x%p\n", cx_dev);
@@ -207,11 +207,7 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
207 cx_dev->dev.bus = &tiocx_bus_type; 207 cx_dev->dev.bus = &tiocx_bus_type;
208 cx_dev->dev.release = tiocx_bus_release; 208 cx_dev->dev.release = tiocx_bus_release;
209 dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid); 209 dev_set_name(&cx_dev->dev, "%d", cx_dev->cx_id.nasid);
210 r = device_register(&cx_dev->dev); 210 device_register(&cx_dev->dev);
211 if (r) {
212 kfree(cx_dev);
213 return r;
214 }
215 get_device(&cx_dev->dev); 211 get_device(&cx_dev->dev);
216 212
217 device_create_file(&cx_dev->dev, &dev_attr_cxdev_control); 213 device_create_file(&cx_dev->dev, &dev_attr_cxdev_control);
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 3290d6e00c3..a9d310de57d 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -76,8 +76,7 @@ EXPORT_SYMBOL(sn_dma_set_mask);
76 * more information. 76 * more information.
77 */ 77 */
78static void *sn_dma_alloc_coherent(struct device *dev, size_t size, 78static void *sn_dma_alloc_coherent(struct device *dev, size_t size,
79 dma_addr_t * dma_handle, gfp_t flags, 79 dma_addr_t * dma_handle, gfp_t flags)
80 struct dma_attrs *attrs)
81{ 80{
82 void *cpuaddr; 81 void *cpuaddr;
83 unsigned long phys_addr; 82 unsigned long phys_addr;
@@ -138,7 +137,7 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size,
138 * any associated IOMMU mappings. 137 * any associated IOMMU mappings.
139 */ 138 */
140static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, 139static void sn_dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
141 dma_addr_t dma_handle, struct dma_attrs *attrs) 140 dma_addr_t dma_handle)
142{ 141{
143 struct pci_dev *pdev = to_pci_dev(dev); 142 struct pci_dev *pdev = to_pci_dev(dev);
144 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev); 143 struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
@@ -467,8 +466,8 @@ int sn_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)
467} 466}
468 467
469static struct dma_map_ops sn_dma_ops = { 468static struct dma_map_ops sn_dma_ops = {
470 .alloc = sn_dma_alloc_coherent, 469 .alloc_coherent = sn_dma_alloc_coherent,
471 .free = sn_dma_free_coherent, 470 .free_coherent = sn_dma_free_coherent,
472 .map_page = sn_dma_map_page, 471 .map_page = sn_dma_map_page,
473 .unmap_page = sn_dma_unmap_page, 472 .unmap_page = sn_dma_unmap_page,
474 .map_sg = sn_dma_map_sg, 473 .map_sg = sn_dma_map_sg,
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 1e863b277ac..33def666a66 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/export.h>
12#include <asm/sn/addrs.h> 11#include <asm/sn/addrs.h>
13#include <asm/sn/geo.h> 12#include <asm/sn/geo.h>
14#include <asm/sn/pcibr_provider.h> 13#include <asm/sn/pcibr_provider.h>
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 8dbbef4a4f4..3cb5cf37764 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -10,7 +10,6 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/export.h>
14#include <asm/sn/addrs.h> 13#include <asm/sn/addrs.h>
15#include <asm/sn/geo.h> 14#include <asm/sn/geo.h>
16#include <asm/sn/pcibr_provider.h> 15#include <asm/sn/pcibr_provider.h>
@@ -127,11 +126,12 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
127 * Allocate kernel bus soft and copy from prom. 126 * Allocate kernel bus soft and copy from prom.
128 */ 127 */
129 128
130 soft = kmemdup(prom_bussoft, sizeof(struct pcibus_info), GFP_KERNEL); 129 soft = kmalloc(sizeof(struct pcibus_info), GFP_KERNEL);
131 if (!soft) { 130 if (!soft) {
132 return NULL; 131 return NULL;
133 } 132 }
134 133
134 memcpy(soft, prom_bussoft, sizeof(struct pcibus_info));
135 soft->pbi_buscommon.bs_base = (unsigned long) 135 soft->pbi_buscommon.bs_base = (unsigned long)
136 ioremap(REGION_OFFSET(soft->pbi_buscommon.bs_base), 136 ioremap(REGION_OFFSET(soft->pbi_buscommon.bs_base),
137 sizeof(struct pic)); 137 sizeof(struct pic));
@@ -146,7 +146,6 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
146 printk(KERN_WARNING 146 printk(KERN_WARNING
147 "pcibr cannot allocate interrupt for error handler\n"); 147 "pcibr cannot allocate interrupt for error handler\n");
148 } 148 }
149 irq_set_handler(SGI_PCIASIC_ERROR, handle_level_irq);
150 sn_set_err_irq_affinity(SGI_PCIASIC_ERROR); 149 sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
151 150
152 /* 151 /*
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index a70b11fd57d..9c271be9919 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -11,7 +11,6 @@
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/bitmap.h> 12#include <linux/bitmap.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/export.h>
15#include <asm/sn/sn_sal.h> 14#include <asm/sn/sn_sal.h>
16#include <asm/sn/addrs.h> 15#include <asm/sn/addrs.h>
17#include <asm/sn/io.h> 16#include <asm/sn/io.h>
@@ -600,11 +599,11 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
600 * Allocate kernel bus soft and copy from prom. 599 * Allocate kernel bus soft and copy from prom.
601 */ 600 */
602 601
603 tioca_common = kmemdup(prom_bussoft, sizeof(struct tioca_common), 602 tioca_common = kzalloc(sizeof(struct tioca_common), GFP_KERNEL);
604 GFP_KERNEL);
605 if (!tioca_common) 603 if (!tioca_common)
606 return NULL; 604 return NULL;
607 605
606 memcpy(tioca_common, prom_bussoft, sizeof(struct tioca_common));
608 tioca_common->ca_common.bs_base = (unsigned long) 607 tioca_common->ca_common.bs_base = (unsigned long)
609 ioremap(REGION_OFFSET(tioca_common->ca_common.bs_base), 608 ioremap(REGION_OFFSET(tioca_common->ca_common.bs_base),
610 sizeof(struct tioca_common)); 609 sizeof(struct tioca_common));
@@ -649,7 +648,6 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
649 __func__, SGI_TIOCA_ERROR, 648 __func__, SGI_TIOCA_ERROR,
650 (int)tioca_common->ca_common.bs_persist_busnum); 649 (int)tioca_common->ca_common.bs_persist_busnum);
651 650
652 irq_set_handler(SGI_TIOCA_ERROR, handle_level_irq);
653 sn_set_err_irq_affinity(SGI_TIOCA_ERROR); 651 sn_set_err_irq_affinity(SGI_TIOCA_ERROR);
654 652
655 /* Setup locality information */ 653 /* Setup locality information */
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index 46d3df4b03a..27faba035f3 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -1037,7 +1037,6 @@ tioce_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
1037 tioce_common->ce_pcibus.bs_persist_segment, 1037 tioce_common->ce_pcibus.bs_persist_segment,
1038 tioce_common->ce_pcibus.bs_persist_busnum); 1038 tioce_common->ce_pcibus.bs_persist_busnum);
1039 1039
1040 irq_set_handler(SGI_PCIASIC_ERROR, handle_level_irq);
1041 sn_set_err_irq_affinity(SGI_PCIASIC_ERROR); 1040 sn_set_err_irq_affinity(SGI_PCIASIC_ERROR);
1042 return tioce_common; 1041 return tioce_common;
1043} 1042}
diff --git a/arch/ia64/xen/grant-table.c b/arch/ia64/xen/grant-table.c
index c18281332f8..48cca37625e 100644
--- a/arch/ia64/xen/grant-table.c
+++ b/arch/ia64/xen/grant-table.c
@@ -31,6 +31,68 @@
31 31
32#include <asm/xen/hypervisor.h> 32#include <asm/xen/hypervisor.h>
33 33
34struct vm_struct *xen_alloc_vm_area(unsigned long size)
35{
36 int order;
37 unsigned long virt;
38 unsigned long nr_pages;
39 struct vm_struct *area;
40
41 order = get_order(size);
42 virt = __get_free_pages(GFP_KERNEL, order);
43 if (virt == 0)
44 goto err0;
45 nr_pages = 1 << order;
46 scrub_pages(virt, nr_pages);
47
48 area = kmalloc(sizeof(*area), GFP_KERNEL);
49 if (area == NULL)
50 goto err1;
51
52 area->flags = VM_IOREMAP;
53 area->addr = (void *)virt;
54 area->size = size;
55 area->pages = NULL;
56 area->nr_pages = nr_pages;
57 area->phys_addr = 0; /* xenbus_map_ring_valloc uses this field! */
58
59 return area;
60
61err1:
62 free_pages(virt, order);
63err0:
64 return NULL;
65}
66EXPORT_SYMBOL_GPL(xen_alloc_vm_area);
67
68void xen_free_vm_area(struct vm_struct *area)
69{
70 unsigned int order = get_order(area->size);
71 unsigned long i;
72 unsigned long phys_addr = __pa(area->addr);
73
74 /* This area is used for foreign page mappping.
75 * So underlying machine page may not be assigned. */
76 for (i = 0; i < (1 << order); i++) {
77 unsigned long ret;
78 unsigned long gpfn = (phys_addr >> PAGE_SHIFT) + i;
79 struct xen_memory_reservation reservation = {
80 .nr_extents = 1,
81 .address_bits = 0,
82 .extent_order = 0,
83 .domid = DOMID_SELF
84 };
85 set_xen_guest_handle(reservation.extent_start, &gpfn);
86 ret = HYPERVISOR_memory_op(XENMEM_populate_physmap,
87 &reservation);
88 BUG_ON(ret != 1);
89 }
90 free_pages((unsigned long)area->addr, order);
91 kfree(area);
92}
93EXPORT_SYMBOL_GPL(xen_free_vm_area);
94
95
34/**************************************************************************** 96/****************************************************************************
35 * grant table hack 97 * grant table hack
36 * cmd: GNTTABOP_xxx 98 * cmd: GNTTABOP_xxx
diff --git a/arch/ia64/xen/hypervisor.c b/arch/ia64/xen/hypervisor.c
index 52172eee859..cac4d97c0b5 100644
--- a/arch/ia64/xen/hypervisor.c
+++ b/arch/ia64/xen/hypervisor.c
@@ -21,7 +21,6 @@
21 */ 21 */
22 22
23#include <linux/efi.h> 23#include <linux/efi.h>
24#include <linux/export.h>
25#include <asm/xen/hypervisor.h> 24#include <asm/xen/hypervisor.h>
26#include <asm/xen/privop.h> 25#include <asm/xen/privop.h>
27 26
diff --git a/arch/ia64/xen/irq_xen.c b/arch/ia64/xen/irq_xen.c
index efb74dafec4..b279e142c63 100644
--- a/arch/ia64/xen/irq_xen.c
+++ b/arch/ia64/xen/irq_xen.c
@@ -58,7 +58,7 @@ xen_free_irq_vector(int vector)
58 58
59 irq_op.vector = vector; 59 irq_op.vector = vector;
60 if (HYPERVISOR_physdev_op(PHYSDEVOP_free_irq_vector, &irq_op)) 60 if (HYPERVISOR_physdev_op(PHYSDEVOP_free_irq_vector, &irq_op))
61 printk(KERN_WARNING "%s: xen_free_irq_vector fail vector=%d\n", 61 printk(KERN_WARNING "%s: xen_free_irq_vecotr fail vector=%d\n",
62 __func__, vector); 62 __func__, vector);
63} 63}
64 64
@@ -273,8 +273,9 @@ xen_bind_early_percpu_irq(void)
273 */ 273 */
274 274
275#ifdef CONFIG_HOTPLUG_CPU 275#ifdef CONFIG_HOTPLUG_CPU
276static int unbind_evtchn_callback(struct notifier_block *nfb, 276static int __devinit
277 unsigned long action, void *hcpu) 277unbind_evtchn_callback(struct notifier_block *nfb,
278 unsigned long action, void *hcpu)
278{ 279{
279 unsigned int cpu = (unsigned long)hcpu; 280 unsigned int cpu = (unsigned long)hcpu;
280 281
@@ -432,7 +433,7 @@ xen_resend_irq(unsigned int vector)
432 (void)resend_irq_on_evtchn(vector); 433 (void)resend_irq_on_evtchn(vector);
433} 434}
434 435
435const struct pv_irq_ops xen_irq_ops __initconst = { 436const struct pv_irq_ops xen_irq_ops __initdata = {
436 .register_ipi = xen_register_ipi, 437 .register_ipi = xen_register_ipi,
437 438
438 .assign_irq_vector = xen_assign_irq_vector, 439 .assign_irq_vector = xen_assign_irq_vector,
diff --git a/arch/ia64/xen/irq_xen.h b/arch/ia64/xen/irq_xen.h
index 1778517b90f..26110f330c8 100644
--- a/arch/ia64/xen/irq_xen.h
+++ b/arch/ia64/xen/irq_xen.h
@@ -27,7 +27,7 @@ extern void (*late_time_init)(void);
27extern char xen_event_callback; 27extern char xen_event_callback;
28void __init xen_init_IRQ(void); 28void __init xen_init_IRQ(void);
29 29
30extern const struct pv_irq_ops xen_irq_ops __initconst; 30extern const struct pv_irq_ops xen_irq_ops __initdata;
31extern void xen_smp_intr_init(void); 31extern void xen_smp_intr_init(void);
32extern void xen_send_ipi(int cpu, int vec); 32extern void xen_send_ipi(int cpu, int vec);
33 33
diff --git a/arch/ia64/xen/xencomm.c b/arch/ia64/xen/xencomm.c
index 73d903ca2d6..1f5d7ac82e9 100644
--- a/arch/ia64/xen/xencomm.c
+++ b/arch/ia64/xen/xencomm.c
@@ -17,7 +17,6 @@
17 */ 17 */
18 18
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/err.h>
21 20
22static unsigned long kernel_virtual_offset; 21static unsigned long kernel_virtual_offset;
23static int is_xencomm_initialized; 22static int is_xencomm_initialized;
@@ -99,7 +98,7 @@ xencomm_vtop(unsigned long vaddr)
99 98
100 /* We assume the page is modified. */ 99 /* We assume the page is modified. */
101 page = follow_page(vma, vaddr, FOLL_WRITE | FOLL_TOUCH); 100 page = follow_page(vma, vaddr, FOLL_WRITE | FOLL_TOUCH);
102 if (IS_ERR_OR_NULL(page)) 101 if (!page)
103 return ~0UL; 102 return ~0UL;
104 103
105 return (page_to_pfn(page) << PAGE_SHIFT) | (vaddr & ~PAGE_MASK); 104 return (page_to_pfn(page) << PAGE_SHIFT) | (vaddr & ~PAGE_MASK);
diff --git a/arch/ia64/xen/xensetup.S b/arch/ia64/xen/xensetup.S
index e29519ebe2d..b820ed02ab9 100644
--- a/arch/ia64/xen/xensetup.S
+++ b/arch/ia64/xen/xensetup.S
@@ -7,6 +7,7 @@
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/asmmacro.h> 8#include <asm/asmmacro.h>
9#include <asm/pgtable.h> 9#include <asm/pgtable.h>
10#include <asm/system.h>
10#include <asm/paravirt.h> 11#include <asm/paravirt.h>
11#include <asm/xen/privop.h> 12#include <asm/xen/privop.h>
12#include <linux/elfnote.h> 13#include <linux/elfnote.h>