aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2005-11-07 12:05:22 -0500
committerTony Luck <tony.luck@intel.com>2005-11-07 12:05:22 -0500
commit0ad3a96f8ad910ecf87a25ec69ed360b284dee2e (patch)
tree12d292fd58fc0f7a3eb56c89dfc23569f3ab6c00 /include
parentf79b348856fbaf77e4a0c5cb08a808e5879967a9 (diff)
parent5b2f7ffcb734d3046144dfbd5ac6d76254a9e522 (diff)
Auto-update from upstream
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/pgtable.h3
-rw-r--r--include/asm-alpha/ptrace.h3
-rw-r--r--include/asm-arm/arch-clps711x/hardware.h117
-rw-r--r--include/asm-arm/arch-clps711x/mp1000-seprom.h77
-rw-r--r--include/asm-arm/arch-iop3xx/iop321.h2
-rw-r--r--include/asm-arm/arch-iop3xx/iop331.h2
-rw-r--r--include/asm-arm/arch-ixp2000/irqs.h35
-rw-r--r--include/asm-arm/arch-pxa/pm.h12
-rw-r--r--include/asm-arm/arch-pxa/tosa.h166
-rw-r--r--include/asm-arm/mmu_context.h4
-rw-r--r--include/asm-cris/arch-v10/byteorder.h4
-rw-r--r--include/asm-cris/arch-v10/checksum.h2
-rw-r--r--include/asm-cris/arch-v10/delay.h2
-rw-r--r--include/asm-cris/arch-v10/ide.h8
-rw-r--r--include/asm-cris/arch-v10/system.h8
-rw-r--r--include/asm-cris/arch-v10/thread_info.h2
-rw-r--r--include/asm-cris/arch-v10/timex.h2
-rw-r--r--include/asm-cris/arch-v10/uaccess.h4
-rw-r--r--include/asm-cris/arch-v32/bitops.h10
-rw-r--r--include/asm-cris/arch-v32/byteorder.h4
-rw-r--r--include/asm-cris/arch-v32/checksum.h2
-rw-r--r--include/asm-cris/arch-v32/delay.h2
-rw-r--r--include/asm-cris/arch-v32/ide.h4
-rw-r--r--include/asm-cris/arch-v32/io.h6
-rw-r--r--include/asm-cris/arch-v32/system.h6
-rw-r--r--include/asm-cris/arch-v32/thread_info.h2
-rw-r--r--include/asm-cris/arch-v32/timex.h2
-rw-r--r--include/asm-cris/arch-v32/uaccess.h4
-rw-r--r--include/asm-cris/atomic.h22
-rw-r--r--include/asm-cris/bitops.h18
-rw-r--r--include/asm-cris/checksum.h8
-rw-r--r--include/asm-cris/current.h2
-rw-r--r--include/asm-cris/delay.h2
-rw-r--r--include/asm-cris/io.h6
-rw-r--r--include/asm-cris/irq.h2
-rw-r--r--include/asm-cris/pgalloc.h12
-rw-r--r--include/asm-cris/pgtable.h46
-rw-r--r--include/asm-cris/processor.h6
-rw-r--r--include/asm-cris/semaphore.h16
-rw-r--r--include/asm-cris/system.h2
-rw-r--r--include/asm-cris/timex.h2
-rw-r--r--include/asm-cris/tlbflush.h4
-rw-r--r--include/asm-cris/uaccess.h22
-rw-r--r--include/asm-cris/unistd.h20
-rw-r--r--include/asm-frv/pgtable.h2
-rw-r--r--include/asm-generic/pgtable.h1
-rw-r--r--include/asm-generic/vmlinux.lds.h7
-rw-r--r--include/asm-i386/elf.h2
-rw-r--r--include/asm-i386/kprobes.h17
-rw-r--r--include/asm-i386/pgtable.h3
-rw-r--r--include/asm-i386/processor.h6
-rw-r--r--include/asm-ia64/dma-mapping.h7
-rw-r--r--include/asm-ia64/kprobes.h13
-rw-r--r--include/asm-ia64/pgtable.h1
-rw-r--r--include/asm-ia64/ptrace.h3
-rw-r--r--include/asm-m32r/pgtable.h3
-rw-r--r--include/asm-m32r/ptrace.h3
-rw-r--r--include/asm-m68knommu/cacheflush.h4
-rw-r--r--include/asm-m68knommu/irq.h31
-rw-r--r--include/asm-m68knommu/irqnode.h36
-rw-r--r--include/asm-mips/elf.h2
-rw-r--r--include/asm-mips/pgtable.h3
-rw-r--r--include/asm-parisc/pgtable.h3
-rw-r--r--include/asm-powerpc/bitops.h437
-rw-r--r--include/asm-powerpc/bug.h34
-rw-r--r--include/asm-powerpc/cputable.h3
-rw-r--r--include/asm-powerpc/elf.h24
-rw-r--r--include/asm-powerpc/futex.h (renamed from include/asm-ppc64/futex.h)45
-rw-r--r--include/asm-powerpc/ioctls.h3
-rw-r--r--include/asm-powerpc/iommu.h5
-rw-r--r--include/asm-powerpc/ipcbuf.h34
-rw-r--r--include/asm-powerpc/irq.h2
-rw-r--r--include/asm-powerpc/iseries/hv_call.h (renamed from include/asm-ppc64/iSeries/HvCall.h)10
-rw-r--r--include/asm-powerpc/iseries/hv_call_event.h (renamed from include/asm-ppc64/iSeries/HvCallEvent.h)10
-rw-r--r--include/asm-powerpc/iseries/hv_call_sc.h (renamed from include/asm-ppc64/iSeries/HvCallSc.h)6
-rw-r--r--include/asm-powerpc/iseries/hv_call_xm.h (renamed from include/asm-ppc64/iSeries/HvCallXm.h)10
-rw-r--r--include/asm-powerpc/iseries/hv_lp_config.h (renamed from include/asm-ppc64/iSeries/HvLpConfig.h)12
-rw-r--r--include/asm-powerpc/iseries/hv_lp_event.h (renamed from include/asm-ppc64/iSeries/HvLpEvent.h)10
-rw-r--r--include/asm-powerpc/iseries/hv_types.h (renamed from include/asm-ppc64/iSeries/HvTypes.h)6
-rw-r--r--include/asm-powerpc/iseries/iseries_io.h (renamed from include/asm-ppc64/iSeries/iSeries_io.h)6
-rw-r--r--include/asm-powerpc/iseries/it_exp_vpd_panel.h (renamed from include/asm-ppc64/iSeries/ItExtVpdPanel.h)6
-rw-r--r--include/asm-powerpc/iseries/it_lp_naca.h (renamed from include/asm-ppc64/iSeries/ItLpNaca.h)6
-rw-r--r--include/asm-powerpc/iseries/it_lp_queue.h (renamed from include/asm-ppc64/iSeries/ItLpQueue.h)6
-rw-r--r--include/asm-powerpc/iseries/it_lp_reg_save.h (renamed from include/asm-ppc64/iSeries/ItLpRegSave.h)4
-rw-r--r--include/asm-powerpc/iseries/lpar_map.h (renamed from include/asm-ppc64/iSeries/LparMap.h)6
-rw-r--r--include/asm-powerpc/iseries/mf.h (renamed from include/asm-ppc64/iSeries/mf.h)10
-rw-r--r--include/asm-powerpc/iseries/vio.h (renamed from include/asm-ppc64/iSeries/vio.h)10
-rw-r--r--include/asm-powerpc/kexec.h49
-rw-r--r--include/asm-powerpc/kprobes.h15
-rw-r--r--include/asm-powerpc/machdep.h11
-rw-r--r--include/asm-powerpc/numnodes.h7
-rw-r--r--include/asm-powerpc/ppc_asm.h7
-rw-r--r--include/asm-powerpc/processor.h2
-rw-r--r--include/asm-powerpc/prom.h8
-rw-r--r--include/asm-powerpc/ptrace.h (renamed from include/asm-ppc64/ptrace.h)143
-rw-r--r--include/asm-powerpc/rtas.h25
-rw-r--r--include/asm-powerpc/sigcontext.h (renamed from include/asm-ppc64/sigcontext.h)41
-rw-r--r--include/asm-powerpc/smp.h (renamed from include/asm-ppc64/smp.h)45
-rw-r--r--include/asm-powerpc/sparsemem.h (renamed from include/asm-ppc64/sparsemem.h)6
-rw-r--r--include/asm-powerpc/stat.h81
-rw-r--r--include/asm-powerpc/system.h50
-rw-r--r--include/asm-powerpc/termios.h135
-rw-r--r--include/asm-powerpc/thread_info.h20
-rw-r--r--include/asm-powerpc/time.h2
-rw-r--r--include/asm-powerpc/tlb.h (renamed from include/asm-ppc/tlb.h)59
-rw-r--r--include/asm-powerpc/tlbflush.h147
-rw-r--r--include/asm-powerpc/uaccess.h468
-rw-r--r--include/asm-powerpc/ucontext.h40
-rw-r--r--include/asm-ppc/bitops.h460
-rw-r--r--include/asm-ppc/commproc.h2
-rw-r--r--include/asm-ppc/futex.h53
-rw-r--r--include/asm-ppc/ibm44x.h76
-rw-r--r--include/asm-ppc/ibm4xx.h4
-rw-r--r--include/asm-ppc/ibm_ocp.h19
-rw-r--r--include/asm-ppc/ipcbuf.h29
-rw-r--r--include/asm-ppc/kexec.h40
-rw-r--r--include/asm-ppc/pgtable.h1
-rw-r--r--include/asm-ppc/ppcboot.h6
-rw-r--r--include/asm-ppc/ptrace.h152
-rw-r--r--include/asm-ppc/rio.h18
-rw-r--r--include/asm-ppc/sigcontext.h15
-rw-r--r--include/asm-ppc/stat.h69
-rw-r--r--include/asm-ppc/tlbflush.h115
-rw-r--r--include/asm-ppc/uaccess.h393
-rw-r--r--include/asm-ppc/ucontext.h27
-rw-r--r--include/asm-ppc64/bitops.h360
-rw-r--r--include/asm-ppc64/dart.h59
-rw-r--r--include/asm-ppc64/io.h2
-rw-r--r--include/asm-ppc64/ipcbuf.h28
-rw-r--r--include/asm-ppc64/kexec.h41
-rw-r--r--include/asm-ppc64/mmu.h208
-rw-r--r--include/asm-ppc64/mmu_context.h26
-rw-r--r--include/asm-ppc64/naca.h24
-rw-r--r--include/asm-ppc64/numnodes.h7
-rw-r--r--include/asm-ppc64/nvram.h2
-rw-r--r--include/asm-ppc64/paca.h15
-rw-r--r--include/asm-ppc64/page.h147
-rw-r--r--include/asm-ppc64/pgalloc.h47
-rw-r--r--include/asm-ppc64/pgtable-4k.h91
-rw-r--r--include/asm-ppc64/pgtable-64k.h90
-rw-r--r--include/asm-ppc64/pgtable.h161
-rw-r--r--include/asm-ppc64/plpar_wrappers.h120
-rw-r--r--include/asm-ppc64/ppc32.h122
-rw-r--r--include/asm-ppc64/prom.h8
-rw-r--r--include/asm-ppc64/spinlock.h2
-rw-r--r--include/asm-ppc64/stat.h60
-rw-r--r--include/asm-ppc64/system.h2
-rw-r--r--include/asm-ppc64/tlb.h39
-rw-r--r--include/asm-ppc64/tlbflush.h52
-rw-r--r--include/asm-ppc64/uaccess.h341
-rw-r--r--include/asm-ppc64/ucontext.h22
-rw-r--r--include/asm-s390/bitops.h4
-rw-r--r--include/asm-s390/elf.h1
-rw-r--r--include/asm-s390/pgtable.h1
-rw-r--r--include/asm-s390/ptrace.h2
-rw-r--r--include/asm-s390/uaccess.h28
-rw-r--r--include/asm-s390/vtoc.h505
-rw-r--r--include/asm-sh/elf.h1
-rw-r--r--include/asm-sh/mmzone.h61
-rw-r--r--include/asm-sh/page.h7
-rw-r--r--include/asm-sh/pgtable.h4
-rw-r--r--include/asm-sh64/pgtable.h2
-rw-r--r--include/asm-sparc/ptrace.h3
-rw-r--r--include/asm-sparc64/kprobes.h20
-rw-r--r--include/asm-sparc64/ptrace.h3
-rw-r--r--include/asm-um/ldt-i386.h69
-rw-r--r--include/asm-um/ldt.h69
-rw-r--r--include/asm-um/mmu_context.h3
-rw-r--r--include/asm-v850/atomic.h2
-rw-r--r--include/asm-v850/bitops.h6
-rw-r--r--include/asm-v850/delay.h4
-rw-r--r--include/asm-v850/hw_irq.h2
-rw-r--r--include/asm-v850/processor.h4
-rw-r--r--include/asm-v850/semaphore.h10
-rw-r--r--include/asm-v850/system.h2
-rw-r--r--include/asm-v850/tlbflush.h4
-rw-r--r--include/asm-v850/uaccess.h2
-rw-r--r--include/asm-v850/unaligned.h6
-rw-r--r--include/asm-x86_64/elf.h2
-rw-r--r--include/asm-x86_64/kprobes.h19
-rw-r--r--include/asm-x86_64/pgtable.h2
-rw-r--r--include/asm-xtensa/elf.h2
-rw-r--r--include/asm-xtensa/pgtable.h3
-rw-r--r--include/asm-xtensa/semaphore.h1
-rw-r--r--include/linux/aio.h5
-rw-r--r--include/linux/cn_proc.h127
-rw-r--r--include/linux/config.h4
-rw-r--r--include/linux/connector.h6
-rw-r--r--include/linux/console_struct.h2
-rw-r--r--include/linux/dqblk_xfs.h20
-rw-r--r--include/linux/etherdevice.h27
-rw-r--r--include/linux/ethtool.h3
-rw-r--r--include/linux/fb.h5
-rw-r--r--include/linux/file.h6
-rw-r--r--include/linux/font.h2
-rw-r--r--include/linux/fs.h12
-rw-r--r--include/linux/fuse.h29
-rw-r--r--include/linux/ioport.h2
-rw-r--r--include/linux/ipmi.h5
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/jbd.h3
-rw-r--r--include/linux/kernel.h3
-rw-r--r--include/linux/kernel_stat.h8
-rw-r--r--include/linux/kprobes.h40
-rw-r--r--include/linux/libata.h52
-rw-r--r--include/linux/list.h13
-rw-r--r--include/linux/memory.h3
-rw-r--r--include/linux/mm.h8
-rw-r--r--include/linux/net.h1
-rw-r--r--include/linux/nfs_fs.h2
-rw-r--r--include/linux/nfsd/nfsd.h2
-rw-r--r--include/linux/nfsd/syscall.h17
-rw-r--r--include/linux/nfsd/xdr3.h2
-rw-r--r--include/linux/pci_ids.h7
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/pkt_sched.h50
-rw-r--r--include/linux/platform_device.h6
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/ptrace.h2
-rw-r--r--include/linux/quotaops.h12
-rw-r--r--include/linux/radix-tree.h1
-rw-r--r--include/linux/rio.h325
-rw-r--r--include/linux/rio_drv.h469
-rw-r--r--include/linux/rio_ids.h24
-rw-r--r--include/linux/rio_regs.h215
-rw-r--r--include/linux/sem.h2
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/shm.h1
-rw-r--r--include/linux/skbuff.h38
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/sunrpc/svc.h3
-rw-r--r--include/linux/superhyway.h38
-rw-r--r--include/linux/wait.h1
-rw-r--r--include/net/inet_ecn.h28
-rw-r--r--include/net/inet_hashtables.h2
-rw-r--r--include/net/red.h325
-rw-r--r--include/rdma/ib_user_cm.h19
-rw-r--r--include/scsi/iscsi_if.h245
-rw-r--r--include/scsi/iscsi_proto.h589
-rw-r--r--include/scsi/scsi_device.h22
-rw-r--r--include/scsi/scsi_host.h6
-rw-r--r--include/scsi/scsi_transport_fc.h33
-rw-r--r--include/scsi/scsi_transport_iscsi.h202
-rw-r--r--include/scsi/scsi_transport_sas.h27
-rw-r--r--include/scsi/srp.h226
-rw-r--r--include/sound/ac97_codec.h10
-rw-r--r--include/sound/core.h94
-rw-r--r--include/sound/driver.h17
-rw-r--r--include/sound/emu10k1.h3
-rw-r--r--include/sound/minors.h8
-rw-r--r--include/sound/pcm.h3
-rw-r--r--include/sound/timer.h1
-rw-r--r--include/sound/version.h4
254 files changed, 6261 insertions, 4523 deletions
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
index 8393bf374b2b..a985cd29b6db 100644
--- a/include/asm-alpha/pgtable.h
+++ b/include/asm-alpha/pgtable.h
@@ -17,6 +17,9 @@
17#include <asm/processor.h> /* For TASK_SIZE */ 17#include <asm/processor.h> /* For TASK_SIZE */
18#include <asm/machvec.h> 18#include <asm/machvec.h>
19 19
20struct mm_struct;
21struct vm_area_struct;
22
20/* Certain architectures need to do special things when PTEs 23/* Certain architectures need to do special things when PTEs
21 * within a page table are directly modified. Thus, the following 24 * within a page table are directly modified. Thus, the following
22 * hook is made available. 25 * hook is made available.
diff --git a/include/asm-alpha/ptrace.h b/include/asm-alpha/ptrace.h
index d462c5e14c13..072375c135b4 100644
--- a/include/asm-alpha/ptrace.h
+++ b/include/asm-alpha/ptrace.h
@@ -67,6 +67,9 @@ struct switch_stack {
67}; 67};
68 68
69#ifdef __KERNEL__ 69#ifdef __KERNEL__
70
71#define __ARCH_SYS_PTRACE 1
72
70#define user_mode(regs) (((regs)->ps & 8) != 0) 73#define user_mode(regs) (((regs)->ps & 8) != 0)
71#define instruction_pointer(regs) ((regs)->pc) 74#define instruction_pointer(regs) ((regs)->pc)
72#define profile_pc(regs) instruction_pointer(regs) 75#define profile_pc(regs) instruction_pointer(regs)
diff --git a/include/asm-arm/arch-clps711x/hardware.h b/include/asm-arm/arch-clps711x/hardware.h
index f864c367c934..1386871e1a5a 100644
--- a/include/asm-arm/arch-clps711x/hardware.h
+++ b/include/asm-arm/arch-clps711x/hardware.h
@@ -235,121 +235,4 @@
235#define CEIVA_PB0_BLK_BTN (1<<0) 235#define CEIVA_PB0_BLK_BTN (1<<0)
236#endif // #if defined (CONFIG_ARCH_CEIVA) 236#endif // #if defined (CONFIG_ARCH_CEIVA)
237 237
238#if defined (CONFIG_MACH_MP1000)
239/* NOR FLASH */
240#define MP1000_NIO_BASE 0xf9000000 /* virtual */
241#define MP1000_NIO_START CS0_PHYS_BASE /* physical */
242#define MP1000_NIO_SIZE 0x00400000
243
244/* DSP Interface */
245#define MP1000_DSP_BASE 0xfa000000 /* virtual */
246#define MP1000_DSP_START CS1_PHYS_BASE /* physical */
247#define MP1000_DSP_SIZE 0x00100000
248
249/* LCD, DAA/DSP, RTC, DAA RW Reg all in CS2 */
250#define MP1000_LIO_BASE 0xfb000000 /* virtual */
251#define MP1000_LIO_START CS2_PHYS_BASE /* physical */
252#define MP1000_LIO_SIZE 0x00100000
253
254/* NAND FLASH */
255#define MP1000_FIO_BASE 0xfc000000 /* virtual */
256#define MP1000_FIO_START CS3_PHYS_BASE /* physical */
257#define MP1000_FIO_SIZE 0x00800000
258
259/* Ethernet */
260#define MP1000_EIO_BASE 0xfd000000 /* virtual */
261#define MP1000_EIO_START CS4_PHYS_BASE /* physical */
262#define MP1000_EIO_SIZE 0x00100000
263
264#define MP1000_LCD_OFFSET 0x00000000 /* LCD offset in CS2 */
265#define MP1000_DDD_OFFSET 0x00001000 /* DAA/DAI/DSP sft reset offst*/
266#define MP1000_RTC_OFFSET 0x00002000 /* RTC offset in CS2 */
267#define MP1000_DAA_OFFSET 0x00003000 /* DAA RW reg offset in CS2 */
268
269/* IDE */
270#define MP1000_IDE_BASE 0xfe000000 /* virtual */
271#define MP1000_IDE_START CS5_PHYS_BASE /* physical */
272#define MP1000_IDE_SIZE 0x00100000 /* actually it's only 0x1000 */
273
274#define IRQ_HARDDISK IRQ_EINT2
275
276/*
277 * IDE registers definition
278 */
279
280#define IDE_CONTROL_BASE (MP1000_IDE_BASE + 0x1000)
281#define IDE_BASE_OFF (MP1000_IDE_BASE)
282
283#define IDE_WRITE_DEVICE_DATA (IDE_BASE_OFF + 0x0)
284#define IDE_FEATURES_REGISTER (IDE_BASE_OFF + 0x2)
285#define IDE_SECTOR_COUNT_REGISTER (IDE_BASE_OFF + 0x4)
286#define IDE_SECTOR_NUMBER_REGISTER (IDE_BASE_OFF + 0x6)
287#define IDE_CYLINDER_LOW_REGISTER (IDE_BASE_OFF + 0x8)
288#define IDE_CYLINDER_HIGH_REGISTER (IDE_BASE_OFF + 0xa)
289#define IDE_DEVICE_HEAD_REGISTER (IDE_BASE_OFF + 0xc)
290#define IDE_COMMAND_DATA_REGISTER (IDE_BASE_OFF + 0xe)
291#define IDE_DEVICE_CONTROL_REGISTER (IDE_CONTROL_BASE + 0xc)
292
293#define IDE_IRQ IRQ_EINT2
294
295
296#define RTC_PORT(x) (MP1000_LIO_BASE+0x2000 + (x*2))
297#define RTC_ALWAYS_BCD 0
298
299/*
300// Definitions of the bit fields in the HwPortA register for the
301// MP1000 board.
302*/
303#define HwPortAKeyboardRow1 0x00000001
304#define HwPortAKeyboardRow2 0x00000002
305#define HwPortAKeyboardRow3 0x00000004
306#define HwPortAKeyboardRow4 0x00000008
307#define HwPortAKeyboardRow5 0x00000010
308#define HwPortAKeyboardRow6 0x00000020
309#define HwPortALCDEnable 0x00000040
310#define HwPortAOffhook 0x00000080
311
312/*
313// Definitions of the bit fields in the HwPortB register for the
314// MP1000 board.
315*/
316#define HwPortBL3Mode 0x00000001
317#define HwPortBL3Clk 0x00000002
318#define HwPortBSClk 0x00000001
319#define HwPortBSData 0x00000002
320#define HwPortBL3Data 0x00000004
321#define HwPortBMute 0x00000008
322#define HwPortBQD0 0x00000010
323#define HwPortBQD1 0x00000020
324#define HwPortBQD2 0x00000040
325#define HwPortBQD3 0x00000080
326
327/*
328// Definitions of the bit fields in the HwPortD register for the
329// MP1000 board.
330*/
331#define HwPortDLED1 0x00000001
332#define HwPortDLED2 0x00000002
333#define HwPortDLED3 0x00000004
334#define HwPortDLED4 0x00000008
335#define HwPortDLED5 0x00000010
336#define HwPortDEECS 0x00000020
337#define HwPortBRTS 0x00000040
338#define HwPortBRI 0x00000080
339
340
341/*
342// Definitions of the bit fields in the HwPortE register for the
343// MP1000 board.
344*/
345
346#define HwPortECLE 0x00000001
347#define HwPortESepromDOut 0x00000001
348#define HwPortEALE 0x00000002
349#define HwPortESepromDIn 0x00000002
350#define HwPortENANDCS 0x00000004
351#define HwPortESepromCLK 0x00000004
352
353#endif // #if defined (CONFIG_MACH_MP1000)
354
355#endif 238#endif
diff --git a/include/asm-arm/arch-clps711x/mp1000-seprom.h b/include/asm-arm/arch-clps711x/mp1000-seprom.h
deleted file mode 100644
index 3e5566cf9666..000000000000
--- a/include/asm-arm/arch-clps711x/mp1000-seprom.h
+++ /dev/null
@@ -1,77 +0,0 @@
1#ifndef MP1000_SEPROM_H
2#define MP1000_SEPROM_H
3
4/*
5 * mp1000-seprom.h
6 *
7 *
8 * This file contains the Serial EEPROM definitions for the MP1000 board
9 *
10 * Copyright (C) 2005 Comdial Corporation
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 */
27
28#define COMMAND_ERASE (0x1C0)
29#define COMMAND_ERASE_ALL (0x120)
30#define COMMAND_WRITE_DISABLE (0x100)
31#define COMMAND_WRITE_ENABLE (0x130)
32#define COMMAND_READ (0x180)
33#define COMMAND_WRITE (0x140)
34#define COMMAND_WRITE_ALL (0x110)
35
36//
37// Serial EEPROM data format
38//
39
40#define PACKED __attribute__ ((packed))
41
42typedef struct _EEPROM {
43 union {
44 unsigned char eprom_byte_data[128];
45 unsigned short eprom_short_data[64];
46 struct {
47 unsigned char version PACKED; // EEPROM Version "1" for now
48 unsigned char box_id PACKED; // Box ID (Standalone, SOHO, embedded, etc)
49 unsigned char major_hw_version PACKED; // Major Hardware version (Hex)
50 unsigned char minor_hw_version PACKED; // Minor Hardware Version (Hex)
51 unsigned char mfg_id[3] PACKED; // Manufacturer ID (3 character Alphabetic)
52 unsigned char mfg_serial_number[10] PACKED; // Manufacturer Serial number
53 unsigned char mfg_date[3] PACKED; // Date of Mfg (Formatted YY:MM:DD)
54 unsigned char country PACKED; // Country of deployment
55 unsigned char mac_Address[6] PACKED; // MAC Address
56 unsigned char oem_string[20] PACKED; // OEM ID string
57 unsigned short feature_bits1 PACKED; // Feature Bits 1
58 unsigned short feature_bits2 PACKED; // Feature Bits 2
59 unsigned char filler[75] PACKED; // Unused/Undefined “0” initialized
60 unsigned short checksum PACKED; // byte accumulated short checksum
61 } eprom_struct;
62 } variant;
63} eeprom_struct;
64
65/* These settings must be mutually exclusive */
66#define FEATURE_BITS1_DRAMSIZE_16MEG 0x0001 /* 0 signifies 4 MEG system */
67#define FEATURE_BITS1_DRAMSIZE_8MEG 0x0002 /* 1 in bit 1 = 8MEG system */
68#define FEATURE_BITS1_DRAMSIZE_64MEG 0x0004 /* 1 in bit 2 = 64MEG system */
69
70#define FEATURE_BITS1_CPUIS90MEG 0x0010
71
72extern void seprom_init(void);
73extern eeprom_struct* get_seprom_ptr(void);
74extern unsigned char* get_eeprom_mac_address(void);
75
76#endif /* MP1000_SEPROM_H */
77
diff --git a/include/asm-arm/arch-iop3xx/iop321.h b/include/asm-arm/arch-iop3xx/iop321.h
index 200621ff3690..f8df778a356f 100644
--- a/include/asm-arm/arch-iop3xx/iop321.h
+++ b/include/asm-arm/arch-iop3xx/iop321.h
@@ -40,7 +40,7 @@
40#define IOP321_PCI_UPPER_IO_BA (IOP321_PCI_LOWER_IO_BA + IOP321_PCI_IO_WINDOW_SIZE - 1) 40#define IOP321_PCI_UPPER_IO_BA (IOP321_PCI_LOWER_IO_BA + IOP321_PCI_IO_WINDOW_SIZE - 1)
41#define IOP321_PCI_IO_OFFSET (IOP321_PCI_LOWER_IO_VA - IOP321_PCI_LOWER_IO_BA) 41#define IOP321_PCI_IO_OFFSET (IOP321_PCI_LOWER_IO_VA - IOP321_PCI_LOWER_IO_BA)
42 42
43//#define IOP321_PCI_MEM_WINDOW_SIZE (~*IOP321_IALR1 + 1) 43/* #define IOP321_PCI_MEM_WINDOW_SIZE (~*IOP321_IALR1 + 1) */
44#define IOP321_PCI_MEM_WINDOW_SIZE 0x04000000 /* 64M outbound window */ 44#define IOP321_PCI_MEM_WINDOW_SIZE 0x04000000 /* 64M outbound window */
45#define IOP321_PCI_LOWER_MEM_PA 0x80000000 45#define IOP321_PCI_LOWER_MEM_PA 0x80000000
46#define IOP321_PCI_LOWER_MEM_BA (*IOP321_OMWTVR0) 46#define IOP321_PCI_LOWER_MEM_BA (*IOP321_OMWTVR0)
diff --git a/include/asm-arm/arch-iop3xx/iop331.h b/include/asm-arm/arch-iop3xx/iop331.h
index 96adffd8bad2..fbf0cc11bdd9 100644
--- a/include/asm-arm/arch-iop3xx/iop331.h
+++ b/include/asm-arm/arch-iop3xx/iop331.h
@@ -42,7 +42,7 @@
42 42
43/* this can be 128M if OMWTVR1 is set */ 43/* this can be 128M if OMWTVR1 is set */
44#define IOP331_PCI_MEM_WINDOW_SIZE 0x04000000 /* 64M outbound window */ 44#define IOP331_PCI_MEM_WINDOW_SIZE 0x04000000 /* 64M outbound window */
45//#define IOP331_PCI_MEM_WINDOW_SIZE (~*IOP331_IALR1 + 1) 45/* #define IOP331_PCI_MEM_WINDOW_SIZE (~*IOP331_IALR1 + 1) */
46#define IOP331_PCI_LOWER_MEM_PA 0x80000000 46#define IOP331_PCI_LOWER_MEM_PA 0x80000000
47#define IOP331_PCI_LOWER_MEM_BA (*IOP331_OMWTVR0) 47#define IOP331_PCI_LOWER_MEM_BA (*IOP331_OMWTVR0)
48#define IOP331_PCI_UPPER_MEM_PA (IOP331_PCI_LOWER_MEM_PA + IOP331_PCI_MEM_WINDOW_SIZE - 1) 48#define IOP331_PCI_UPPER_MEM_PA (IOP331_PCI_LOWER_MEM_PA + IOP331_PCI_MEM_WINDOW_SIZE - 1)
diff --git a/include/asm-arm/arch-ixp2000/irqs.h b/include/asm-arm/arch-ixp2000/irqs.h
index 0deb96c12adb..62f09c7ff420 100644
--- a/include/asm-arm/arch-ixp2000/irqs.h
+++ b/include/asm-arm/arch-ixp2000/irqs.h
@@ -67,12 +67,45 @@
67#define IRQ_IXP2000_PCIA 40 67#define IRQ_IXP2000_PCIA 40
68#define IRQ_IXP2000_PCIB 41 68#define IRQ_IXP2000_PCIB 41
69 69
70#define NR_IXP2000_IRQS 42 70/* Int sources from IRQ_ERROR_STATUS */
71#define IRQ_IXP2000_DRAM0_MIN_ERR 42
72#define IRQ_IXP2000_DRAM0_MAJ_ERR 43
73#define IRQ_IXP2000_DRAM1_MIN_ERR 44
74#define IRQ_IXP2000_DRAM1_MAJ_ERR 45
75#define IRQ_IXP2000_DRAM2_MIN_ERR 46
76#define IRQ_IXP2000_DRAM2_MAJ_ERR 47
77/* 48-57 reserved */
78#define IRQ_IXP2000_SRAM0_ERR 58
79#define IRQ_IXP2000_SRAM1_ERR 59
80#define IRQ_IXP2000_SRAM2_ERR 60
81#define IRQ_IXP2000_SRAM3_ERR 61
82/* 62-65 reserved */
83#define IRQ_IXP2000_MEDIA_ERR 66
84#define IRQ_IXP2000_PCI_ERR 67
85#define IRQ_IXP2000_SP_INT 68
86
87#define NR_IXP2000_IRQS 69
71 88
72#define IXP2000_BOARD_IRQ(x) (NR_IXP2000_IRQS + (x)) 89#define IXP2000_BOARD_IRQ(x) (NR_IXP2000_IRQS + (x))
73 90
74#define IXP2000_BOARD_IRQ_MASK(irq) (1 << (irq - NR_IXP2000_IRQS)) 91#define IXP2000_BOARD_IRQ_MASK(irq) (1 << (irq - NR_IXP2000_IRQS))
75 92
93#define IXP2000_ERR_IRQ_MASK(irq) ( 1 << (irq - IRQ_IXP2000_DRAM0_MIN_ERR))
94#define IXP2000_VALID_ERR_IRQ_MASK (\
95 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM0_MIN_ERR) | \
96 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM0_MAJ_ERR) | \
97 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM1_MIN_ERR) | \
98 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM1_MAJ_ERR) | \
99 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM2_MIN_ERR) | \
100 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_DRAM2_MAJ_ERR) | \
101 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM0_ERR) | \
102 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM1_ERR) | \
103 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM2_ERR) | \
104 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SRAM3_ERR) | \
105 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_MEDIA_ERR) | \
106 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_PCI_ERR) | \
107 IXP2000_ERR_IRQ_MASK(IRQ_IXP2000_SP_INT) )
108
76/* 109/*
77 * This allows for all the on-chip sources plus up to 32 CPLD based 110 * This allows for all the on-chip sources plus up to 32 CPLD based
78 * IRQs. Should be more than enough. 111 * IRQs. Should be more than enough.
diff --git a/include/asm-arm/arch-pxa/pm.h b/include/asm-arm/arch-pxa/pm.h
new file mode 100644
index 000000000000..7a8a1cdf430d
--- /dev/null
+++ b/include/asm-arm/arch-pxa/pm.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (c) 2005 Richard Purdie
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 */
9
10extern int pxa_pm_prepare(suspend_state_t state);
11extern int pxa_pm_enter(suspend_state_t state);
12extern int pxa_pm_finish(suspend_state_t state);
diff --git a/include/asm-arm/arch-pxa/tosa.h b/include/asm-arm/arch-pxa/tosa.h
new file mode 100644
index 000000000000..c3364a2c4758
--- /dev/null
+++ b/include/asm-arm/arch-pxa/tosa.h
@@ -0,0 +1,166 @@
1/*
2 * Hardware specific definitions for Sharp SL-C6000x series of PDAs
3 *
4 * Copyright (c) 2005 Dirk Opfer
5 *
6 * Based on Sharp's 2.4 kernel patches
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13#ifndef _ASM_ARCH_TOSA_H_
14#define _ASM_ARCH_TOSA_H_ 1
15
16/* TOSA Chip selects */
17#define TOSA_LCDC_PHYS PXA_CS4_PHYS
18/* Internel Scoop */
19#define TOSA_CF_PHYS (PXA_CS2_PHYS + 0x00800000)
20/* Jacket Scoop */
21#define TOSA_SCOOP_PHYS (PXA_CS5_PHYS + 0x00800000)
22
23/*
24 * SCOOP2 internal GPIOs
25 */
26#define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11
27#define TOSA_SCOOP_TC6393_REST_IN SCOOP_GPCR_PA12
28#define TOSA_SCOOP_IR_POWERDWN SCOOP_GPCR_PA13
29#define TOSA_SCOOP_SD_WP SCOOP_GPCR_PA14
30#define TOSA_SCOOP_PWR_ON SCOOP_GPCR_PA15
31#define TOSA_SCOOP_AUD_PWR_ON SCOOP_GPCR_PA16
32#define TOSA_SCOOP_BT_RESET SCOOP_GPCR_PA17
33#define TOSA_SCOOP_BT_PWR_EN SCOOP_GPCR_PA18
34#define TOSA_SCOOP_AC_IN_OL SCOOP_GPCR_PA19
35
36/* GPIO Direction 1 : output mode / 0:input mode */
37#define TOSA_SCOOP_IO_DIR ( TOSA_SCOOP_PXA_VCORE1 | TOSA_SCOOP_TC6393_REST_IN | \
38 TOSA_SCOOP_IR_POWERDWN | TOSA_SCOOP_PWR_ON | TOSA_SCOOP_AUD_PWR_ON |\
39 TOSA_SCOOP_BT_RESET | TOSA_SCOOP_BT_PWR_EN )
40/* GPIO out put level when init 1: Hi */
41#define TOSA_SCOOP_IO_OUT ( TOSA_SCOOP_TC6393_REST_IN )
42
43/*
44 * SCOOP2 jacket GPIOs
45 */
46#define TOSA_SCOOP_JC_BT_LED SCOOP_GPCR_PA11
47#define TOSA_SCOOP_JC_NOTE_LED SCOOP_GPCR_PA12
48#define TOSA_SCOOP_JC_CHRG_ERR_LED SCOOP_GPCR_PA13
49#define TOSA_SCOOP_JC_USB_PULLUP SCOOP_GPCR_PA14
50#define TOSA_SCOOP_JC_TC6393_SUSPEND SCOOP_GPCR_PA15
51#define TOSA_SCOOP_JC_TC3693_L3V_ON SCOOP_GPCR_PA16
52#define TOSA_SCOOP_JC_WLAN_DETECT SCOOP_GPCR_PA17
53#define TOSA_SCOOP_JC_WLAN_LED SCOOP_GPCR_PA18
54#define TOSA_SCOOP_JC_CARD_LIMIT_SEL SCOOP_GPCR_PA19
55
56/* GPIO Direction 1 : output mode / 0:input mode */
57#define TOSA_SCOOP_JC_IO_DIR ( TOSA_SCOOP_JC_BT_LED | TOSA_SCOOP_JC_NOTE_LED | \
58 TOSA_SCOOP_JC_CHRG_ERR_LED | TOSA_SCOOP_JC_USB_PULLUP | \
59 TOSA_SCOOP_JC_TC6393_SUSPEND | TOSA_SCOOP_JC_TC3693_L3V_ON | \
60 TOSA_SCOOP_JC_WLAN_LED | TOSA_SCOOP_JC_CARD_LIMIT_SEL )
61/* GPIO out put level when init 1: Hi */
62#define TOSA_SCOOP_JC_IO_OUT ( 0 )
63
64/*
65 * Timing Generator
66 */
67#define TG_PNLCTL 0x00
68#define TG_TPOSCTL 0x01
69#define TG_DUTYCTL 0x02
70#define TG_GPOSR 0x03
71#define TG_GPODR1 0x04
72#define TG_GPODR2 0x05
73#define TG_PINICTL 0x06
74#define TG_HPOSCTL 0x07
75
76/*
77 * LED
78 */
79#define TOSA_SCOOP_LED_BLUE TOSA_SCOOP_GPCR_PA11
80#define TOSA_SCOOP_LED_GREEN TOSA_SCOOP_GPCR_PA12
81#define TOSA_SCOOP_LED_ORANGE TOSA_SCOOP_GPCR_PA13
82#define TOSA_SCOOP_LED_WLAN TOSA_SCOOP_GPCR_PA18
83
84
85/*
86 * PXA GPIOs
87 */
88#define TOSA_GPIO_POWERON (0)
89#define TOSA_GPIO_RESET (1)
90#define TOSA_GPIO_AC_IN (2)
91#define TOSA_GPIO_RECORD_BTN (3)
92#define TOSA_GPIO_SYNC (4) /* Cradle SYNC Button */
93#define TOSA_GPIO_USB_IN (5)
94#define TOSA_GPIO_JACKET_DETECT (7)
95#define TOSA_GPIO_nSD_DETECT (9)
96#define TOSA_GPIO_nSD_INT (10)
97#define TOSA_GPIO_TC6393_CLK (11)
98#define TOSA_GPIO_BAT1_CRG (12)
99#define TOSA_GPIO_CF_CD (13)
100#define TOSA_GPIO_BAT0_CRG (14)
101#define TOSA_GPIO_TC6393_INT (15)
102#define TOSA_GPIO_BAT0_LOW (17)
103#define TOSA_GPIO_TC6393_RDY (18)
104#define TOSA_GPIO_ON_RESET (19)
105#define TOSA_GPIO_EAR_IN (20)
106#define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */
107#define TOSA_GPIO_ON_KEY (22)
108#define TOSA_GPIO_VGA_LINE (27)
109#define TOSA_GPIO_TP_INT (32) /* Touch Panel pen down interrupt */
110#define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */
111#define TOSA_GPIO_BAT_LOCKED (38) /* Battery locked */
112#define TOSA_GPIO_TG_SPI_SCLK (81)
113#define TOSA_GPIO_TG_SPI_CS (82)
114#define TOSA_GPIO_TG_SPI_MOSI (83)
115#define TOSA_GPIO_BAT1_LOW (84)
116
117#define TOSA_GPIO_HP_IN GPIO_EAR_IN
118
119#define TOSA_GPIO_MAIN_BAT_LOW GPIO_BAT0_LOW
120
121#define TOSA_KEY_STROBE_NUM (11)
122#define TOSA_KEY_SENSE_NUM (7)
123
124#define TOSA_GPIO_HIGH_STROBE_BIT (0xfc000000)
125#define TOSA_GPIO_LOW_STROBE_BIT (0x0000001f)
126#define TOSA_GPIO_ALL_SENSE_BIT (0x00000fe0)
127#define TOSA_GPIO_ALL_SENSE_RSHIFT (5)
128#define TOSA_GPIO_STROBE_BIT(a) GPIO_bit(58+(a))
129#define TOSA_GPIO_SENSE_BIT(a) GPIO_bit(69+(a))
130#define TOSA_GAFR_HIGH_STROBE_BIT (0xfff00000)
131#define TOSA_GAFR_LOW_STROBE_BIT (0x000003ff)
132#define TOSA_GAFR_ALL_SENSE_BIT (0x00fffc00)
133#define TOSA_GPIO_KEY_SENSE(a) (69+(a))
134#define TOSA_GPIO_KEY_STROBE(a) (58+(a))
135
136/*
137 * Interrupts
138 */
139#define TOSA_IRQ_GPIO_WAKEUP IRQ_GPIO(TOSA_GPIO_WAKEUP)
140#define TOSA_IRQ_GPIO_AC_IN IRQ_GPIO(TOSA_GPIO_AC_IN)
141#define TOSA_IRQ_GPIO_RECORD_BTN IRQ_GPIO(TOSA_GPIO_RECORD_BTN)
142#define TOSA_IRQ_GPIO_SYNC IRQ_GPIO(TOSA_GPIO_SYNC)
143#define TOSA_IRQ_GPIO_USB_IN IRQ_GPIO(TOSA_GPIO_USB_IN)
144#define TOSA_IRQ_GPIO_JACKET_DETECT IRQ_GPIO(TOSA_GPIO_JACKET_DETECT)
145#define TOSA_IRQ_GPIO_nSD_INT IRQ_GPIO(TOSA_GPIO_nSD_INT)
146#define TOSA_IRQ_GPIO_nSD_DETECT IRQ_GPIO(TOSA_GPIO_nSD_DETECT)
147#define TOSA_IRQ_GPIO_BAT1_CRG IRQ_GPIO(TOSA_GPIO_BAT1_CRG)
148#define TOSA_IRQ_GPIO_CF_CD IRQ_GPIO(TOSA_GPIO_CF_CD)
149#define TOSA_IRQ_GPIO_BAT0_CRG IRQ_GPIO(TOSA_GPIO_BAT0_CRG)
150#define TOSA_IRQ_GPIO_TC6393_INT IRQ_GPIO(TOSA_GPIO_TC6393_INT)
151#define TOSA_IRQ_GPIO_BAT0_LOW IRQ_GPIO(TOSA_GPIO_BAT0_LOW)
152#define TOSA_IRQ_GPIO_EAR_IN IRQ_GPIO(TOSA_GPIO_EAR_IN)
153#define TOSA_IRQ_GPIO_CF_IRQ IRQ_GPIO(TOSA_GPIO_CF_IRQ)
154#define TOSA_IRQ_GPIO_ON_KEY IRQ_GPIO(TOSA_GPIO_ON_KEY)
155#define TOSA_IRQ_GPIO_VGA_LINE IRQ_GPIO(TOSA_GPIO_VGA_LINE)
156#define TOSA_IRQ_GPIO_TP_INT IRQ_GPIO(TOSA_GPIO_TP_INT)
157#define TOSA_IRQ_GPIO_JC_CF_IRQ IRQ_GPIO(TOSA_GPIO_JC_CF_IRQ)
158#define TOSA_IRQ_GPIO_BAT_LOCKED IRQ_GPIO(TOSA_GPIO_BAT_LOCKED)
159#define TOSA_IRQ_GPIO_BAT1_LOW IRQ_GPIO(TOSA_GPIO_BAT1_LOW)
160#define TOSA_IRQ_GPIO_KEY_SENSE(a) IRQ_GPIO(69+(a))
161
162#define TOSA_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(TOSA_GPIO_MAIN_BAT_LOW)
163
164extern struct platform_device tosascoop_jc_device;
165extern struct platform_device tosascoop_device;
166#endif /* _ASM_ARCH_TOSA_H_ */
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
index 4af9c411c617..3d4b810d8c38 100644
--- a/include/asm-arm/mmu_context.h
+++ b/include/asm-arm/mmu_context.h
@@ -13,6 +13,7 @@
13#ifndef __ASM_ARM_MMU_CONTEXT_H 13#ifndef __ASM_ARM_MMU_CONTEXT_H
14#define __ASM_ARM_MMU_CONTEXT_H 14#define __ASM_ARM_MMU_CONTEXT_H
15 15
16#include <asm/cacheflush.h>
16#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
17 18
18#if __LINUX_ARM_ARCH__ >= 6 19#if __LINUX_ARM_ARCH__ >= 6
@@ -86,7 +87,8 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
86 cpu_set(cpu, next->cpu_vm_mask); 87 cpu_set(cpu, next->cpu_vm_mask);
87 check_context(next); 88 check_context(next);
88 cpu_switch_mm(next->pgd, next); 89 cpu_switch_mm(next->pgd, next);
89 cpu_clear(cpu, prev->cpu_vm_mask); 90 if (cache_is_vivt())
91 cpu_clear(cpu, prev->cpu_vm_mask);
90 } 92 }
91} 93}
92 94
diff --git a/include/asm-cris/arch-v10/byteorder.h b/include/asm-cris/arch-v10/byteorder.h
index e24465d1f40d..255b646b7fa8 100644
--- a/include/asm-cris/arch-v10/byteorder.h
+++ b/include/asm-cris/arch-v10/byteorder.h
@@ -9,14 +9,14 @@
9 * them together into ntohl etc. 9 * them together into ntohl etc.
10 */ 10 */
11 11
12extern __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) 12static inline __attribute_const__ __u32 ___arch__swab32(__u32 x)
13{ 13{
14 __asm__ ("swapwb %0" : "=r" (x) : "0" (x)); 14 __asm__ ("swapwb %0" : "=r" (x) : "0" (x));
15 15
16 return(x); 16 return(x);
17} 17}
18 18
19extern __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) 19static inline __attribute_const__ __u16 ___arch__swab16(__u16 x)
20{ 20{
21 __asm__ ("swapb %0" : "=r" (x) : "0" (x)); 21 __asm__ ("swapb %0" : "=r" (x) : "0" (x));
22 22
diff --git a/include/asm-cris/arch-v10/checksum.h b/include/asm-cris/arch-v10/checksum.h
index fde1d00aaa90..633f234f336b 100644
--- a/include/asm-cris/arch-v10/checksum.h
+++ b/include/asm-cris/arch-v10/checksum.h
@@ -8,7 +8,7 @@
8 * to split all of those into 16-bit components, then add. 8 * to split all of those into 16-bit components, then add.
9 */ 9 */
10 10
11extern inline unsigned int 11static inline unsigned int
12csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 12csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
13 unsigned short proto, unsigned int sum) 13 unsigned short proto, unsigned int sum)
14{ 14{
diff --git a/include/asm-cris/arch-v10/delay.h b/include/asm-cris/arch-v10/delay.h
index cfedae0d2f53..39481f6e0c30 100644
--- a/include/asm-cris/arch-v10/delay.h
+++ b/include/asm-cris/arch-v10/delay.h
@@ -1,7 +1,7 @@
1#ifndef _CRIS_ARCH_DELAY_H 1#ifndef _CRIS_ARCH_DELAY_H
2#define _CRIS_ARCH_DELAY_H 2#define _CRIS_ARCH_DELAY_H
3 3
4extern __inline__ void __delay(int loops) 4static inline void __delay(int loops)
5{ 5{
6 __asm__ __volatile__ ( 6 __asm__ __volatile__ (
7 "move.d %0,$r9\n\t" 7 "move.d %0,$r9\n\t"
diff --git a/include/asm-cris/arch-v10/ide.h b/include/asm-cris/arch-v10/ide.h
index 8cf2d7cb22ac..78b301ed7b12 100644
--- a/include/asm-cris/arch-v10/ide.h
+++ b/include/asm-cris/arch-v10/ide.h
@@ -25,7 +25,7 @@
25 25
26#define MAX_HWIFS 4 26#define MAX_HWIFS 4
27 27
28extern __inline__ int ide_default_irq(unsigned long base) 28static inline int ide_default_irq(unsigned long base)
29{ 29{
30 /* all IDE busses share the same IRQ, number 4. 30 /* all IDE busses share the same IRQ, number 4.
31 * this has the side-effect that ide-probe.c will cluster our 4 interfaces 31 * this has the side-effect that ide-probe.c will cluster our 4 interfaces
@@ -35,7 +35,7 @@ extern __inline__ int ide_default_irq(unsigned long base)
35 return 4; 35 return 4;
36} 36}
37 37
38extern __inline__ unsigned long ide_default_io_base(int index) 38static inline unsigned long ide_default_io_base(int index)
39{ 39{
40 /* we have no real I/O base address per interface, since all go through the 40 /* we have no real I/O base address per interface, since all go through the
41 * same register. but in a bitfield in that register, we have the i/f number. 41 * same register. but in a bitfield in that register, we have the i/f number.
@@ -54,7 +54,7 @@ extern __inline__ unsigned long ide_default_io_base(int index)
54 * of the ide_default_io_base call above. ctrl_port will be 0, but that is don't care for us. 54 * of the ide_default_io_base call above. ctrl_port will be 0, but that is don't care for us.
55 */ 55 */
56 56
57extern __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq) 57static inline void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long ctrl_port, int *irq)
58{ 58{
59 int i; 59 int i;
60 60
@@ -77,7 +77,7 @@ extern __inline__ void ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_por
77 hw->io_ports[IDE_IRQ_OFFSET] = 0; 77 hw->io_ports[IDE_IRQ_OFFSET] = 0;
78} 78}
79 79
80extern __inline__ void ide_init_default_hwifs(void) 80static inline void ide_init_default_hwifs(void)
81{ 81{
82 hw_regs_t hw; 82 hw_regs_t hw;
83 int index; 83 int index;
diff --git a/include/asm-cris/arch-v10/system.h b/include/asm-cris/arch-v10/system.h
index 6cc35642b8ab..1ac7b639b1b0 100644
--- a/include/asm-cris/arch-v10/system.h
+++ b/include/asm-cris/arch-v10/system.h
@@ -5,7 +5,7 @@
5 5
6/* read the CPU version register */ 6/* read the CPU version register */
7 7
8extern inline unsigned long rdvr(void) { 8static inline unsigned long rdvr(void) {
9 unsigned char vr; 9 unsigned char vr;
10 __asm__ volatile ("move $vr,%0" : "=rm" (vr)); 10 __asm__ volatile ("move $vr,%0" : "=rm" (vr));
11 return vr; 11 return vr;
@@ -15,7 +15,7 @@ extern inline unsigned long rdvr(void) {
15 15
16/* read/write the user-mode stackpointer */ 16/* read/write the user-mode stackpointer */
17 17
18extern inline unsigned long rdusp(void) { 18static inline unsigned long rdusp(void) {
19 unsigned long usp; 19 unsigned long usp;
20 __asm__ __volatile__("move $usp,%0" : "=rm" (usp)); 20 __asm__ __volatile__("move $usp,%0" : "=rm" (usp));
21 return usp; 21 return usp;
@@ -26,13 +26,13 @@ extern inline unsigned long rdusp(void) {
26 26
27/* read the current stackpointer */ 27/* read the current stackpointer */
28 28
29extern inline unsigned long rdsp(void) { 29static inline unsigned long rdsp(void) {
30 unsigned long sp; 30 unsigned long sp;
31 __asm__ __volatile__("move.d $sp,%0" : "=rm" (sp)); 31 __asm__ __volatile__("move.d $sp,%0" : "=rm" (sp));
32 return sp; 32 return sp;
33} 33}
34 34
35extern inline unsigned long _get_base(char * addr) 35static inline unsigned long _get_base(char * addr)
36{ 36{
37 return 0; 37 return 0;
38} 38}
diff --git a/include/asm-cris/arch-v10/thread_info.h b/include/asm-cris/arch-v10/thread_info.h
index 357f5df0c907..218f4152d3e5 100644
--- a/include/asm-cris/arch-v10/thread_info.h
+++ b/include/asm-cris/arch-v10/thread_info.h
@@ -2,7 +2,7 @@
2#define _ASM_ARCH_THREAD_INFO_H 2#define _ASM_ARCH_THREAD_INFO_H
3 3
4/* how to get the thread information struct from C */ 4/* how to get the thread information struct from C */
5extern inline struct thread_info *current_thread_info(void) 5static inline struct thread_info *current_thread_info(void)
6{ 6{
7 struct thread_info *ti; 7 struct thread_info *ti;
8 __asm__("and.d $sp,%0; ":"=r" (ti) : "0" (~8191UL)); 8 __asm__("and.d $sp,%0; ":"=r" (ti) : "0" (~8191UL));
diff --git a/include/asm-cris/arch-v10/timex.h b/include/asm-cris/arch-v10/timex.h
index ecfc553c06a5..e48447d94faf 100644
--- a/include/asm-cris/arch-v10/timex.h
+++ b/include/asm-cris/arch-v10/timex.h
@@ -22,7 +22,7 @@
22 22
23unsigned long get_ns_in_jiffie(void); 23unsigned long get_ns_in_jiffie(void);
24 24
25extern inline unsigned long get_us_in_jiffie_highres(void) 25static inline unsigned long get_us_in_jiffie_highres(void)
26{ 26{
27 return get_ns_in_jiffie()/1000; 27 return get_ns_in_jiffie()/1000;
28} 28}
diff --git a/include/asm-cris/arch-v10/uaccess.h b/include/asm-cris/arch-v10/uaccess.h
index 787d2e60c83c..65b02d9b605a 100644
--- a/include/asm-cris/arch-v10/uaccess.h
+++ b/include/asm-cris/arch-v10/uaccess.h
@@ -87,7 +87,7 @@
87 * bytes copied if we hit a null byte 87 * bytes copied if we hit a null byte
88 * (without the null byte) 88 * (without the null byte)
89 */ 89 */
90extern inline long 90static inline long
91__do_strncpy_from_user(char *dst, const char *src, long count) 91__do_strncpy_from_user(char *dst, const char *src, long count)
92{ 92{
93 long res; 93 long res;
@@ -602,7 +602,7 @@ __do_strncpy_from_user(char *dst, const char *src, long count)
602 * or 0 for error. Return a value greater than N if too long. 602 * or 0 for error. Return a value greater than N if too long.
603 */ 603 */
604 604
605extern inline long 605static inline long
606strnlen_user(const char *s, long n) 606strnlen_user(const char *s, long n)
607{ 607{
608 long res, tmp1; 608 long res, tmp1;
diff --git a/include/asm-cris/arch-v32/bitops.h b/include/asm-cris/arch-v32/bitops.h
index e40a58d3b862..147689d6b624 100644
--- a/include/asm-cris/arch-v32/bitops.h
+++ b/include/asm-cris/arch-v32/bitops.h
@@ -8,7 +8,7 @@
8 * inverts all bits in the input. 8 * inverts all bits in the input.
9 */ 9 */
10 10
11extern inline unsigned long 11static inline unsigned long
12cris_swapnwbrlz(unsigned long w) 12cris_swapnwbrlz(unsigned long w)
13{ 13{
14 unsigned long res; 14 unsigned long res;
@@ -20,7 +20,7 @@ cris_swapnwbrlz(unsigned long w)
20 return res; 20 return res;
21} 21}
22 22
23extern inline unsigned long 23static inline unsigned long
24cris_swapwbrlz(unsigned long w) 24cris_swapwbrlz(unsigned long w)
25{ 25{
26 unsigned long res; 26 unsigned long res;
@@ -36,7 +36,7 @@ cris_swapwbrlz(unsigned long w)
36 * Find First Zero in word. Undefined if no zero exist, so the caller should 36 * Find First Zero in word. Undefined if no zero exist, so the caller should
37 * check against ~0 first. 37 * check against ~0 first.
38 */ 38 */
39extern inline unsigned long 39static inline unsigned long
40ffz(unsigned long w) 40ffz(unsigned long w)
41{ 41{
42 return cris_swapnwbrlz(w); 42 return cris_swapnwbrlz(w);
@@ -46,7 +46,7 @@ ffz(unsigned long w)
46 * Find First Set bit in word. Undefined if no 1 exist, so the caller 46 * Find First Set bit in word. Undefined if no 1 exist, so the caller
47 * should check against 0 first. 47 * should check against 0 first.
48 */ 48 */
49extern inline unsigned long 49static inline unsigned long
50__ffs(unsigned long w) 50__ffs(unsigned long w)
51{ 51{
52 return cris_swapnwbrlz(~w); 52 return cris_swapnwbrlz(~w);
@@ -55,7 +55,7 @@ __ffs(unsigned long w)
55/* 55/*
56 * Find First Bit that is set. 56 * Find First Bit that is set.
57 */ 57 */
58extern inline unsigned long 58static inline unsigned long
59kernel_ffs(unsigned long w) 59kernel_ffs(unsigned long w)
60{ 60{
61 return w ? cris_swapwbrlz (w) + 1 : 0; 61 return w ? cris_swapwbrlz (w) + 1 : 0;
diff --git a/include/asm-cris/arch-v32/byteorder.h b/include/asm-cris/arch-v32/byteorder.h
index 74846ee6cf99..6ef8fb4a35f2 100644
--- a/include/asm-cris/arch-v32/byteorder.h
+++ b/include/asm-cris/arch-v32/byteorder.h
@@ -3,14 +3,14 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6extern __inline__ __const__ __u32 6static inline __const__ __u32
7___arch__swab32(__u32 x) 7___arch__swab32(__u32 x)
8{ 8{
9 __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x)); 9 __asm__ __volatile__ ("swapwb %0" : "=r" (x) : "0" (x));
10 return (x); 10 return (x);
11} 11}
12 12
13extern __inline__ __const__ __u16 13static inline __const__ __u16
14___arch__swab16(__u16 x) 14___arch__swab16(__u16 x)
15{ 15{
16 __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x)); 16 __asm__ __volatile__ ("swapb %0" : "=r" (x) : "0" (x));
diff --git a/include/asm-cris/arch-v32/checksum.h b/include/asm-cris/arch-v32/checksum.h
index a1d6b2a6cc44..97ef89efea62 100644
--- a/include/asm-cris/arch-v32/checksum.h
+++ b/include/asm-cris/arch-v32/checksum.h
@@ -9,7 +9,7 @@
9 * checksum. Which means it would be necessary to split all those into 9 * checksum. Which means it would be necessary to split all those into
10 * 16-bit components and then add. 10 * 16-bit components and then add.
11 */ 11 */
12extern inline unsigned int 12static inline unsigned int
13csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 13csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
14 unsigned short len, unsigned short proto, unsigned int sum) 14 unsigned short len, unsigned short proto, unsigned int sum)
15{ 15{
diff --git a/include/asm-cris/arch-v32/delay.h b/include/asm-cris/arch-v32/delay.h
index f36f7f760e89..b6e941e637de 100644
--- a/include/asm-cris/arch-v32/delay.h
+++ b/include/asm-cris/arch-v32/delay.h
@@ -1,7 +1,7 @@
1#ifndef _ASM_CRIS_ARCH_DELAY_H 1#ifndef _ASM_CRIS_ARCH_DELAY_H
2#define _ASM_CRIS_ARCH_DELAY_H 2#define _ASM_CRIS_ARCH_DELAY_H
3 3
4extern __inline__ void 4static inline void
5__delay(int loops) 5__delay(int loops)
6{ 6{
7 __asm__ __volatile__ ( 7 __asm__ __volatile__ (
diff --git a/include/asm-cris/arch-v32/ide.h b/include/asm-cris/arch-v32/ide.h
index 24f5604f566a..6590f657500d 100644
--- a/include/asm-cris/arch-v32/ide.h
+++ b/include/asm-cris/arch-v32/ide.h
@@ -26,7 +26,7 @@
26 26
27#define MAX_HWIFS 4 27#define MAX_HWIFS 4
28 28
29extern __inline__ int ide_default_irq(unsigned long base) 29static inline int ide_default_irq(unsigned long base)
30{ 30{
31 /* all IDE busses share the same IRQ, 31 /* all IDE busses share the same IRQ,
32 * this has the side-effect that ide-probe.c will cluster our 4 interfaces 32 * this has the side-effect that ide-probe.c will cluster our 4 interfaces
@@ -36,7 +36,7 @@ extern __inline__ int ide_default_irq(unsigned long base)
36 return ATA_INTR_VECT; 36 return ATA_INTR_VECT;
37} 37}
38 38
39extern __inline__ unsigned long ide_default_io_base(int index) 39static inline unsigned long ide_default_io_base(int index)
40{ 40{
41 reg_ata_rw_ctrl2 ctrl2 = {.sel = index}; 41 reg_ata_rw_ctrl2 ctrl2 = {.sel = index};
42 /* we have no real I/O base address per interface, since all go through the 42 /* we have no real I/O base address per interface, since all go through the
diff --git a/include/asm-cris/arch-v32/io.h b/include/asm-cris/arch-v32/io.h
index 4c80263ec634..043c9ce5294e 100644
--- a/include/asm-cris/arch-v32/io.h
+++ b/include/asm-cris/arch-v32/io.h
@@ -35,7 +35,7 @@ extern struct crisv32_iopin crisv32_led2_red;
35extern struct crisv32_iopin crisv32_led3_green; 35extern struct crisv32_iopin crisv32_led3_green;
36extern struct crisv32_iopin crisv32_led3_red; 36extern struct crisv32_iopin crisv32_led3_red;
37 37
38extern inline void crisv32_io_set(struct crisv32_iopin* iopin, 38static inline void crisv32_io_set(struct crisv32_iopin* iopin,
39 int val) 39 int val)
40{ 40{
41 if (val) 41 if (val)
@@ -44,7 +44,7 @@ extern inline void crisv32_io_set(struct crisv32_iopin* iopin,
44 *iopin->port->data &= ~iopin->bit; 44 *iopin->port->data &= ~iopin->bit;
45} 45}
46 46
47extern inline void crisv32_io_set_dir(struct crisv32_iopin* iopin, 47static inline void crisv32_io_set_dir(struct crisv32_iopin* iopin,
48 enum crisv32_io_dir dir) 48 enum crisv32_io_dir dir)
49{ 49{
50 if (dir == crisv32_io_dir_in) 50 if (dir == crisv32_io_dir_in)
@@ -53,7 +53,7 @@ extern inline void crisv32_io_set_dir(struct crisv32_iopin* iopin,
53 *iopin->port->oe |= iopin->bit; 53 *iopin->port->oe |= iopin->bit;
54} 54}
55 55
56extern inline int crisv32_io_rd(struct crisv32_iopin* iopin) 56static inline int crisv32_io_rd(struct crisv32_iopin* iopin)
57{ 57{
58 return ((*iopin->port->data_in & iopin->bit) ? 1 : 0); 58 return ((*iopin->port->data_in & iopin->bit) ? 1 : 0);
59} 59}
diff --git a/include/asm-cris/arch-v32/system.h b/include/asm-cris/arch-v32/system.h
index b9afbb95e0bb..a3d75d581e2f 100644
--- a/include/asm-cris/arch-v32/system.h
+++ b/include/asm-cris/arch-v32/system.h
@@ -4,7 +4,7 @@
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6/* Read the CPU version register. */ 6/* Read the CPU version register. */
7extern inline unsigned long rdvr(void) 7static inline unsigned long rdvr(void)
8{ 8{
9 unsigned char vr; 9 unsigned char vr;
10 10
@@ -15,7 +15,7 @@ extern inline unsigned long rdvr(void)
15#define cris_machine_name "crisv32" 15#define cris_machine_name "crisv32"
16 16
17/* Read the user-mode stack pointer. */ 17/* Read the user-mode stack pointer. */
18extern inline unsigned long rdusp(void) 18static inline unsigned long rdusp(void)
19{ 19{
20 unsigned long usp; 20 unsigned long usp;
21 21
@@ -24,7 +24,7 @@ extern inline unsigned long rdusp(void)
24} 24}
25 25
26/* Read the current stack pointer. */ 26/* Read the current stack pointer. */
27extern inline unsigned long rdsp(void) 27static inline unsigned long rdsp(void)
28{ 28{
29 unsigned long sp; 29 unsigned long sp;
30 30
diff --git a/include/asm-cris/arch-v32/thread_info.h b/include/asm-cris/arch-v32/thread_info.h
index a7a182307da0..d6936956a3c6 100644
--- a/include/asm-cris/arch-v32/thread_info.h
+++ b/include/asm-cris/arch-v32/thread_info.h
@@ -2,7 +2,7 @@
2#define _ASM_CRIS_ARCH_THREAD_INFO_H 2#define _ASM_CRIS_ARCH_THREAD_INFO_H
3 3
4/* Return a thread_info struct. */ 4/* Return a thread_info struct. */
5extern inline struct thread_info *current_thread_info(void) 5static inline struct thread_info *current_thread_info(void)
6{ 6{
7 struct thread_info *ti; 7 struct thread_info *ti;
8 8
diff --git a/include/asm-cris/arch-v32/timex.h b/include/asm-cris/arch-v32/timex.h
index 4d0fd23b21e9..5a4aa285d5fd 100644
--- a/include/asm-cris/arch-v32/timex.h
+++ b/include/asm-cris/arch-v32/timex.h
@@ -22,7 +22,7 @@
22 22
23extern unsigned long get_ns_in_jiffie(void); 23extern unsigned long get_ns_in_jiffie(void);
24 24
25extern inline unsigned long get_us_in_jiffie_highres(void) 25static inline unsigned long get_us_in_jiffie_highres(void)
26{ 26{
27 return get_ns_in_jiffie() / 1000; 27 return get_ns_in_jiffie() / 1000;
28} 28}
diff --git a/include/asm-cris/arch-v32/uaccess.h b/include/asm-cris/arch-v32/uaccess.h
index 055a0bdbe835..6b207f1b6622 100644
--- a/include/asm-cris/arch-v32/uaccess.h
+++ b/include/asm-cris/arch-v32/uaccess.h
@@ -93,7 +93,7 @@
93 * bytes copied if we hit a null byte 93 * bytes copied if we hit a null byte
94 * (without the null byte) 94 * (without the null byte)
95 */ 95 */
96extern inline long 96static inline long
97__do_strncpy_from_user(char *dst, const char *src, long count) 97__do_strncpy_from_user(char *dst, const char *src, long count)
98{ 98{
99 long res; 99 long res;
@@ -695,7 +695,7 @@ __do_strncpy_from_user(char *dst, const char *src, long count)
695 * or 0 for error. Return a value greater than N if too long. 695 * or 0 for error. Return a value greater than N if too long.
696 */ 696 */
697 697
698extern inline long 698static inline long
699strnlen_user(const char *s, long n) 699strnlen_user(const char *s, long n)
700{ 700{
701 long res, tmp1; 701 long res, tmp1;
diff --git a/include/asm-cris/atomic.h b/include/asm-cris/atomic.h
index 70605b09e8b7..8c2e78304523 100644
--- a/include/asm-cris/atomic.h
+++ b/include/asm-cris/atomic.h
@@ -20,7 +20,7 @@ typedef struct { volatile int counter; } atomic_t;
20 20
21/* These should be written in asm but we do it in C for now. */ 21/* These should be written in asm but we do it in C for now. */
22 22
23extern __inline__ void atomic_add(int i, volatile atomic_t *v) 23static inline void atomic_add(int i, volatile atomic_t *v)
24{ 24{
25 unsigned long flags; 25 unsigned long flags;
26 cris_atomic_save(v, flags); 26 cris_atomic_save(v, flags);
@@ -28,7 +28,7 @@ extern __inline__ void atomic_add(int i, volatile atomic_t *v)
28 cris_atomic_restore(v, flags); 28 cris_atomic_restore(v, flags);
29} 29}
30 30
31extern __inline__ void atomic_sub(int i, volatile atomic_t *v) 31static inline void atomic_sub(int i, volatile atomic_t *v)
32{ 32{
33 unsigned long flags; 33 unsigned long flags;
34 cris_atomic_save(v, flags); 34 cris_atomic_save(v, flags);
@@ -36,7 +36,7 @@ extern __inline__ void atomic_sub(int i, volatile atomic_t *v)
36 cris_atomic_restore(v, flags); 36 cris_atomic_restore(v, flags);
37} 37}
38 38
39extern __inline__ int atomic_add_return(int i, volatile atomic_t *v) 39static inline int atomic_add_return(int i, volatile atomic_t *v)
40{ 40{
41 unsigned long flags; 41 unsigned long flags;
42 int retval; 42 int retval;
@@ -48,7 +48,7 @@ extern __inline__ int atomic_add_return(int i, volatile atomic_t *v)
48 48
49#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) 49#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
50 50
51extern __inline__ int atomic_sub_return(int i, volatile atomic_t *v) 51static inline int atomic_sub_return(int i, volatile atomic_t *v)
52{ 52{
53 unsigned long flags; 53 unsigned long flags;
54 int retval; 54 int retval;
@@ -58,7 +58,7 @@ extern __inline__ int atomic_sub_return(int i, volatile atomic_t *v)
58 return retval; 58 return retval;
59} 59}
60 60
61extern __inline__ int atomic_sub_and_test(int i, volatile atomic_t *v) 61static inline int atomic_sub_and_test(int i, volatile atomic_t *v)
62{ 62{
63 int retval; 63 int retval;
64 unsigned long flags; 64 unsigned long flags;
@@ -68,7 +68,7 @@ extern __inline__ int atomic_sub_and_test(int i, volatile atomic_t *v)
68 return retval; 68 return retval;
69} 69}
70 70
71extern __inline__ void atomic_inc(volatile atomic_t *v) 71static inline void atomic_inc(volatile atomic_t *v)
72{ 72{
73 unsigned long flags; 73 unsigned long flags;
74 cris_atomic_save(v, flags); 74 cris_atomic_save(v, flags);
@@ -76,7 +76,7 @@ extern __inline__ void atomic_inc(volatile atomic_t *v)
76 cris_atomic_restore(v, flags); 76 cris_atomic_restore(v, flags);
77} 77}
78 78
79extern __inline__ void atomic_dec(volatile atomic_t *v) 79static inline void atomic_dec(volatile atomic_t *v)
80{ 80{
81 unsigned long flags; 81 unsigned long flags;
82 cris_atomic_save(v, flags); 82 cris_atomic_save(v, flags);
@@ -84,7 +84,7 @@ extern __inline__ void atomic_dec(volatile atomic_t *v)
84 cris_atomic_restore(v, flags); 84 cris_atomic_restore(v, flags);
85} 85}
86 86
87extern __inline__ int atomic_inc_return(volatile atomic_t *v) 87static inline int atomic_inc_return(volatile atomic_t *v)
88{ 88{
89 unsigned long flags; 89 unsigned long flags;
90 int retval; 90 int retval;
@@ -94,7 +94,7 @@ extern __inline__ int atomic_inc_return(volatile atomic_t *v)
94 return retval; 94 return retval;
95} 95}
96 96
97extern __inline__ int atomic_dec_return(volatile atomic_t *v) 97static inline int atomic_dec_return(volatile atomic_t *v)
98{ 98{
99 unsigned long flags; 99 unsigned long flags;
100 int retval; 100 int retval;
@@ -103,7 +103,7 @@ extern __inline__ int atomic_dec_return(volatile atomic_t *v)
103 cris_atomic_restore(v, flags); 103 cris_atomic_restore(v, flags);
104 return retval; 104 return retval;
105} 105}
106extern __inline__ int atomic_dec_and_test(volatile atomic_t *v) 106static inline int atomic_dec_and_test(volatile atomic_t *v)
107{ 107{
108 int retval; 108 int retval;
109 unsigned long flags; 109 unsigned long flags;
@@ -113,7 +113,7 @@ extern __inline__ int atomic_dec_and_test(volatile atomic_t *v)
113 return retval; 113 return retval;
114} 114}
115 115
116extern __inline__ int atomic_inc_and_test(volatile atomic_t *v) 116static inline int atomic_inc_and_test(volatile atomic_t *v)
117{ 117{
118 int retval; 118 int retval;
119 unsigned long flags; 119 unsigned long flags;
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index e3da57f97964..1bddb3f3a289 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -89,7 +89,7 @@ struct __dummy { unsigned long a[100]; };
89 * It also implies a memory barrier. 89 * It also implies a memory barrier.
90 */ 90 */
91 91
92extern inline int test_and_set_bit(int nr, volatile unsigned long *addr) 92static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
93{ 93{
94 unsigned int mask, retval; 94 unsigned int mask, retval;
95 unsigned long flags; 95 unsigned long flags;
@@ -105,7 +105,7 @@ extern inline int test_and_set_bit(int nr, volatile unsigned long *addr)
105 return retval; 105 return retval;
106} 106}
107 107
108extern inline int __test_and_set_bit(int nr, volatile unsigned long *addr) 108static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
109{ 109{
110 unsigned int mask, retval; 110 unsigned int mask, retval;
111 unsigned int *adr = (unsigned int *)addr; 111 unsigned int *adr = (unsigned int *)addr;
@@ -132,7 +132,7 @@ extern inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
132 * It also implies a memory barrier. 132 * It also implies a memory barrier.
133 */ 133 */
134 134
135extern inline int test_and_clear_bit(int nr, volatile unsigned long *addr) 135static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
136{ 136{
137 unsigned int mask, retval; 137 unsigned int mask, retval;
138 unsigned long flags; 138 unsigned long flags;
@@ -157,7 +157,7 @@ extern inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
157 * but actually fail. You must protect multiple accesses with a lock. 157 * but actually fail. You must protect multiple accesses with a lock.
158 */ 158 */
159 159
160extern inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) 160static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
161{ 161{
162 unsigned int mask, retval; 162 unsigned int mask, retval;
163 unsigned int *adr = (unsigned int *)addr; 163 unsigned int *adr = (unsigned int *)addr;
@@ -177,7 +177,7 @@ extern inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
177 * It also implies a memory barrier. 177 * It also implies a memory barrier.
178 */ 178 */
179 179
180extern inline int test_and_change_bit(int nr, volatile unsigned long *addr) 180static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
181{ 181{
182 unsigned int mask, retval; 182 unsigned int mask, retval;
183 unsigned long flags; 183 unsigned long flags;
@@ -193,7 +193,7 @@ extern inline int test_and_change_bit(int nr, volatile unsigned long *addr)
193 193
194/* WARNING: non atomic and it can be reordered! */ 194/* WARNING: non atomic and it can be reordered! */
195 195
196extern inline int __test_and_change_bit(int nr, volatile unsigned long *addr) 196static inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
197{ 197{
198 unsigned int mask, retval; 198 unsigned int mask, retval;
199 unsigned int *adr = (unsigned int *)addr; 199 unsigned int *adr = (unsigned int *)addr;
@@ -214,7 +214,7 @@ extern inline int __test_and_change_bit(int nr, volatile unsigned long *addr)
214 * This routine doesn't need to be atomic. 214 * This routine doesn't need to be atomic.
215 */ 215 */
216 216
217extern inline int test_bit(int nr, const volatile unsigned long *addr) 217static inline int test_bit(int nr, const volatile unsigned long *addr)
218{ 218{
219 unsigned int mask; 219 unsigned int mask;
220 unsigned int *adr = (unsigned int *)addr; 220 unsigned int *adr = (unsigned int *)addr;
@@ -258,7 +258,7 @@ extern inline int test_bit(int nr, const volatile unsigned long *addr)
258 * @offset: The bitnumber to start searching at 258 * @offset: The bitnumber to start searching at
259 * @size: The maximum size to search 259 * @size: The maximum size to search
260 */ 260 */
261extern inline int find_next_zero_bit (const unsigned long * addr, int size, int offset) 261static inline int find_next_zero_bit (const unsigned long * addr, int size, int offset)
262{ 262{
263 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 263 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
264 unsigned long result = offset & ~31UL; 264 unsigned long result = offset & ~31UL;
@@ -366,7 +366,7 @@ found_middle:
366#define minix_test_bit(nr,addr) test_bit(nr,addr) 366#define minix_test_bit(nr,addr) test_bit(nr,addr)
367#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size) 367#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
368 368
369extern inline int sched_find_first_bit(const unsigned long *b) 369static inline int sched_find_first_bit(const unsigned long *b)
370{ 370{
371 if (unlikely(b[0])) 371 if (unlikely(b[0]))
372 return __ffs(b[0]); 372 return __ffs(b[0]);
diff --git a/include/asm-cris/checksum.h b/include/asm-cris/checksum.h
index 15ca8aec5c63..26a7719bbb84 100644
--- a/include/asm-cris/checksum.h
+++ b/include/asm-cris/checksum.h
@@ -34,7 +34,7 @@ unsigned int csum_partial_copy_nocheck(const char *src, char *dst,
34 * Fold a partial checksum into a word 34 * Fold a partial checksum into a word
35 */ 35 */
36 36
37extern inline unsigned int csum_fold(unsigned int sum) 37static inline unsigned int csum_fold(unsigned int sum)
38{ 38{
39 /* the while loop is unnecessary really, it's always enough with two 39 /* the while loop is unnecessary really, it's always enough with two
40 iterations */ 40 iterations */
@@ -55,7 +55,7 @@ extern unsigned int csum_partial_copy_from_user(const char *src, char *dst,
55 * 55 *
56 */ 56 */
57 57
58extern inline unsigned short ip_fast_csum(unsigned char * iph, 58static inline unsigned short ip_fast_csum(unsigned char * iph,
59 unsigned int ihl) 59 unsigned int ihl)
60{ 60{
61 return csum_fold(csum_partial(iph, ihl * 4, 0)); 61 return csum_fold(csum_partial(iph, ihl * 4, 0));
@@ -66,7 +66,7 @@ extern inline unsigned short ip_fast_csum(unsigned char * iph,
66 * returns a 16-bit checksum, already complemented 66 * returns a 16-bit checksum, already complemented
67 */ 67 */
68 68
69extern inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 69static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
70 unsigned long daddr, 70 unsigned long daddr,
71 unsigned short len, 71 unsigned short len,
72 unsigned short proto, 72 unsigned short proto,
@@ -80,7 +80,7 @@ extern inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
80 * in icmp.c 80 * in icmp.c
81 */ 81 */
82 82
83extern inline unsigned short ip_compute_csum(unsigned char * buff, int len) { 83static inline unsigned short ip_compute_csum(unsigned char * buff, int len) {
84 return csum_fold (csum_partial(buff, len, 0)); 84 return csum_fold (csum_partial(buff, len, 0));
85} 85}
86 86
diff --git a/include/asm-cris/current.h b/include/asm-cris/current.h
index dce69c99da39..5f5c0efd00be 100644
--- a/include/asm-cris/current.h
+++ b/include/asm-cris/current.h
@@ -5,7 +5,7 @@
5 5
6struct task_struct; 6struct task_struct;
7 7
8extern inline struct task_struct * get_current(void) 8static inline struct task_struct * get_current(void)
9{ 9{
10 return current_thread_info()->task; 10 return current_thread_info()->task;
11} 11}
diff --git a/include/asm-cris/delay.h b/include/asm-cris/delay.h
index efc41aad4845..d3a397803719 100644
--- a/include/asm-cris/delay.h
+++ b/include/asm-cris/delay.h
@@ -13,7 +13,7 @@
13 13
14extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */ 14extern unsigned long loops_per_usec; /* arch/cris/mm/init.c */
15 15
16extern __inline__ void udelay(unsigned long usecs) 16static inline void udelay(unsigned long usecs)
17{ 17{
18 __delay(usecs * loops_per_usec); 18 __delay(usecs * loops_per_usec);
19} 19}
diff --git a/include/asm-cris/io.h b/include/asm-cris/io.h
index 16e791b3c721..716c69bc58f8 100644
--- a/include/asm-cris/io.h
+++ b/include/asm-cris/io.h
@@ -23,12 +23,12 @@ extern struct cris_io_operations *cris_iops;
23 * Change virtual addresses to physical addresses and vv. 23 * Change virtual addresses to physical addresses and vv.
24 */ 24 */
25 25
26extern inline unsigned long virt_to_phys(volatile void * address) 26static inline unsigned long virt_to_phys(volatile void * address)
27{ 27{
28 return __pa(address); 28 return __pa(address);
29} 29}
30 30
31extern inline void * phys_to_virt(unsigned long address) 31static inline void * phys_to_virt(unsigned long address)
32{ 32{
33 return __va(address); 33 return __va(address);
34} 34}
@@ -36,7 +36,7 @@ extern inline void * phys_to_virt(unsigned long address)
36extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags); 36extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
37extern void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgprot_t prot); 37extern void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgprot_t prot);
38 38
39extern inline void __iomem * ioremap (unsigned long offset, unsigned long size) 39static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
40{ 40{
41 return __ioremap(offset, size, 0); 41 return __ioremap(offset, size, 0);
42} 42}
diff --git a/include/asm-cris/irq.h b/include/asm-cris/irq.h
index 4fab5c3b2e15..4b338792218b 100644
--- a/include/asm-cris/irq.h
+++ b/include/asm-cris/irq.h
@@ -8,7 +8,7 @@
8 8
9#include <asm/arch/irq.h> 9#include <asm/arch/irq.h>
10 10
11extern __inline__ int irq_canonicalize(int irq) 11static inline int irq_canonicalize(int irq)
12{ 12{
13 return irq; 13 return irq;
14} 14}
diff --git a/include/asm-cris/pgalloc.h b/include/asm-cris/pgalloc.h
index a131776edf41..deaddfe79bbc 100644
--- a/include/asm-cris/pgalloc.h
+++ b/include/asm-cris/pgalloc.h
@@ -11,35 +11,35 @@
11 * Allocate and free page tables. 11 * Allocate and free page tables.
12 */ 12 */
13 13
14extern inline pgd_t *pgd_alloc (struct mm_struct *mm) 14static inline pgd_t *pgd_alloc (struct mm_struct *mm)
15{ 15{
16 return (pgd_t *)get_zeroed_page(GFP_KERNEL); 16 return (pgd_t *)get_zeroed_page(GFP_KERNEL);
17} 17}
18 18
19extern inline void pgd_free (pgd_t *pgd) 19static inline void pgd_free (pgd_t *pgd)
20{ 20{
21 free_page((unsigned long)pgd); 21 free_page((unsigned long)pgd);
22} 22}
23 23
24extern inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) 24static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
25{ 25{
26 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); 26 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
27 return pte; 27 return pte;
28} 28}
29 29
30extern inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) 30static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
31{ 31{
32 struct page *pte; 32 struct page *pte;
33 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); 33 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
34 return pte; 34 return pte;
35} 35}
36 36
37extern inline void pte_free_kernel(pte_t *pte) 37static inline void pte_free_kernel(pte_t *pte)
38{ 38{
39 free_page((unsigned long)pte); 39 free_page((unsigned long)pte);
40} 40}
41 41
42extern inline void pte_free(struct page *pte) 42static inline void pte_free(struct page *pte)
43{ 43{
44 __free_page(pte); 44 __free_page(pte);
45} 45}
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
index a9143bed99db..70a832514f62 100644
--- a/include/asm-cris/pgtable.h
+++ b/include/asm-cris/pgtable.h
@@ -112,44 +112,44 @@ extern unsigned long empty_zero_page;
112 * Undefined behaviour if not.. 112 * Undefined behaviour if not..
113 */ 113 */
114 114
115extern inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; } 115static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
116extern inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 116static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
117extern inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_READ; } 117static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_READ; }
118extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 118static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
119extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 119static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
120extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 120static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
121 121
122extern inline pte_t pte_wrprotect(pte_t pte) 122static inline pte_t pte_wrprotect(pte_t pte)
123{ 123{
124 pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE); 124 pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_SILENT_WRITE);
125 return pte; 125 return pte;
126} 126}
127 127
128extern inline pte_t pte_rdprotect(pte_t pte) 128static inline pte_t pte_rdprotect(pte_t pte)
129{ 129{
130 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); 130 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
131 return pte; 131 return pte;
132} 132}
133 133
134extern inline pte_t pte_exprotect(pte_t pte) 134static inline pte_t pte_exprotect(pte_t pte)
135{ 135{
136 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ); 136 pte_val(pte) &= ~(_PAGE_READ | _PAGE_SILENT_READ);
137 return pte; 137 return pte;
138} 138}
139 139
140extern inline pte_t pte_mkclean(pte_t pte) 140static inline pte_t pte_mkclean(pte_t pte)
141{ 141{
142 pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE); 142 pte_val(pte) &= ~(_PAGE_MODIFIED | _PAGE_SILENT_WRITE);
143 return pte; 143 return pte;
144} 144}
145 145
146extern inline pte_t pte_mkold(pte_t pte) 146static inline pte_t pte_mkold(pte_t pte)
147{ 147{
148 pte_val(pte) &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ); 148 pte_val(pte) &= ~(_PAGE_ACCESSED | _PAGE_SILENT_READ);
149 return pte; 149 return pte;
150} 150}
151 151
152extern inline pte_t pte_mkwrite(pte_t pte) 152static inline pte_t pte_mkwrite(pte_t pte)
153{ 153{
154 pte_val(pte) |= _PAGE_WRITE; 154 pte_val(pte) |= _PAGE_WRITE;
155 if (pte_val(pte) & _PAGE_MODIFIED) 155 if (pte_val(pte) & _PAGE_MODIFIED)
@@ -157,7 +157,7 @@ extern inline pte_t pte_mkwrite(pte_t pte)
157 return pte; 157 return pte;
158} 158}
159 159
160extern inline pte_t pte_mkread(pte_t pte) 160static inline pte_t pte_mkread(pte_t pte)
161{ 161{
162 pte_val(pte) |= _PAGE_READ; 162 pte_val(pte) |= _PAGE_READ;
163 if (pte_val(pte) & _PAGE_ACCESSED) 163 if (pte_val(pte) & _PAGE_ACCESSED)
@@ -165,7 +165,7 @@ extern inline pte_t pte_mkread(pte_t pte)
165 return pte; 165 return pte;
166} 166}
167 167
168extern inline pte_t pte_mkexec(pte_t pte) 168static inline pte_t pte_mkexec(pte_t pte)
169{ 169{
170 pte_val(pte) |= _PAGE_READ; 170 pte_val(pte) |= _PAGE_READ;
171 if (pte_val(pte) & _PAGE_ACCESSED) 171 if (pte_val(pte) & _PAGE_ACCESSED)
@@ -173,7 +173,7 @@ extern inline pte_t pte_mkexec(pte_t pte)
173 return pte; 173 return pte;
174} 174}
175 175
176extern inline pte_t pte_mkdirty(pte_t pte) 176static inline pte_t pte_mkdirty(pte_t pte)
177{ 177{
178 pte_val(pte) |= _PAGE_MODIFIED; 178 pte_val(pte) |= _PAGE_MODIFIED;
179 if (pte_val(pte) & _PAGE_WRITE) 179 if (pte_val(pte) & _PAGE_WRITE)
@@ -181,7 +181,7 @@ extern inline pte_t pte_mkdirty(pte_t pte)
181 return pte; 181 return pte;
182} 182}
183 183
184extern inline pte_t pte_mkyoung(pte_t pte) 184static inline pte_t pte_mkyoung(pte_t pte)
185{ 185{
186 pte_val(pte) |= _PAGE_ACCESSED; 186 pte_val(pte) |= _PAGE_ACCESSED;
187 if (pte_val(pte) & _PAGE_READ) 187 if (pte_val(pte) & _PAGE_READ)
@@ -205,7 +205,7 @@ extern inline pte_t pte_mkyoung(pte_t pte)
205 * addresses (the 0xc0xxxxxx's) goes as void *'s. 205 * addresses (the 0xc0xxxxxx's) goes as void *'s.
206 */ 206 */
207 207
208extern inline pte_t __mk_pte(void * page, pgprot_t pgprot) 208static inline pte_t __mk_pte(void * page, pgprot_t pgprot)
209{ 209{
210 pte_t pte; 210 pte_t pte;
211 /* the PTE needs a physical address */ 211 /* the PTE needs a physical address */
@@ -223,7 +223,7 @@ extern inline pte_t __mk_pte(void * page, pgprot_t pgprot)
223 __pte; \ 223 __pte; \
224}) 224})
225 225
226extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 226static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
227{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; } 227{ pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); return pte; }
228 228
229 229
@@ -232,7 +232,7 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
232 * pte_pagenr refers to the page-number counted starting from the virtual DRAM start 232 * pte_pagenr refers to the page-number counted starting from the virtual DRAM start
233 */ 233 */
234 234
235extern inline unsigned long __pte_page(pte_t pte) 235static inline unsigned long __pte_page(pte_t pte)
236{ 236{
237 /* the PTE contains a physical address */ 237 /* the PTE contains a physical address */
238 return (unsigned long)__va(pte_val(pte) & PAGE_MASK); 238 return (unsigned long)__va(pte_val(pte) & PAGE_MASK);
@@ -250,7 +250,7 @@ extern inline unsigned long __pte_page(pte_t pte)
250 * don't need the __pa and __va transformations. 250 * don't need the __pa and __va transformations.
251 */ 251 */
252 252
253extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep) 253static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
254{ pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; } 254{ pmd_val(*pmdp) = _PAGE_TABLE | (unsigned long) ptep; }
255 255
256#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) 256#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
@@ -260,7 +260,7 @@ extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
260#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 260#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
261 261
262/* to find an entry in a page-table-directory */ 262/* to find an entry in a page-table-directory */
263extern inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) 263static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
264{ 264{
265 return mm->pgd + pgd_index(address); 265 return mm->pgd + pgd_index(address);
266} 266}
@@ -296,7 +296,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; /* defined in head.S */
296 * 296 *
297 * Actually I am not sure on what this could be used for. 297 * Actually I am not sure on what this could be used for.
298 */ 298 */
299extern inline void update_mmu_cache(struct vm_area_struct * vma, 299static inline void update_mmu_cache(struct vm_area_struct * vma,
300 unsigned long address, pte_t pte) 300 unsigned long address, pte_t pte)
301{ 301{
302} 302}
diff --git a/include/asm-cris/processor.h b/include/asm-cris/processor.h
index 0dc218117bd8..dce41009eeb0 100644
--- a/include/asm-cris/processor.h
+++ b/include/asm-cris/processor.h
@@ -16,6 +16,8 @@
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/arch/processor.h> 17#include <asm/arch/processor.h>
18 18
19struct task_struct;
20
19/* This decides where the kernel will search for a free chunk of vm 21/* This decides where the kernel will search for a free chunk of vm
20 * space during mmap's. 22 * space during mmap's.
21 */ 23 */
@@ -45,7 +47,7 @@
45 47
46#define current_regs() user_regs(current->thread_info) 48#define current_regs() user_regs(current->thread_info)
47 49
48extern inline void prepare_to_copy(struct task_struct *tsk) 50static inline void prepare_to_copy(struct task_struct *tsk)
49{ 51{
50} 52}
51 53
@@ -58,7 +60,7 @@ unsigned long get_wchan(struct task_struct *p);
58extern unsigned long thread_saved_pc(struct task_struct *tsk); 60extern unsigned long thread_saved_pc(struct task_struct *tsk);
59 61
60/* Free all resources held by a thread. */ 62/* Free all resources held by a thread. */
61extern inline void release_thread(struct task_struct *dead_task) 63static inline void release_thread(struct task_struct *dead_task)
62{ 64{
63 /* Nothing needs to be done. */ 65 /* Nothing needs to be done. */
64} 66}
diff --git a/include/asm-cris/semaphore.h b/include/asm-cris/semaphore.h
index 39faf69bcf76..53f548b791c1 100644
--- a/include/asm-cris/semaphore.h
+++ b/include/asm-cris/semaphore.h
@@ -18,8 +18,6 @@
18 * CRIS semaphores, implemented in C-only so far. 18 * CRIS semaphores, implemented in C-only so far.
19 */ 19 */
20 20
21int printk(const char *fmt, ...);
22
23struct semaphore { 21struct semaphore {
24 atomic_t count; 22 atomic_t count;
25 atomic_t waking; 23 atomic_t waking;
@@ -39,17 +37,17 @@ struct semaphore {
39#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1) 37#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
40#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0) 38#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
41 39
42extern inline void sema_init(struct semaphore *sem, int val) 40static inline void sema_init(struct semaphore *sem, int val)
43{ 41{
44 *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); 42 *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val);
45} 43}
46 44
47extern inline void init_MUTEX (struct semaphore *sem) 45static inline void init_MUTEX (struct semaphore *sem)
48{ 46{
49 sema_init(sem, 1); 47 sema_init(sem, 1);
50} 48}
51 49
52extern inline void init_MUTEX_LOCKED (struct semaphore *sem) 50static inline void init_MUTEX_LOCKED (struct semaphore *sem)
53{ 51{
54 sema_init(sem, 0); 52 sema_init(sem, 0);
55} 53}
@@ -61,7 +59,7 @@ extern void __up(struct semaphore * sem);
61 59
62/* notice - we probably can do cli/sti here instead of saving */ 60/* notice - we probably can do cli/sti here instead of saving */
63 61
64extern inline void down(struct semaphore * sem) 62static inline void down(struct semaphore * sem)
65{ 63{
66 unsigned long flags; 64 unsigned long flags;
67 int failed; 65 int failed;
@@ -83,7 +81,7 @@ extern inline void down(struct semaphore * sem)
83 * returns negative for signalled and zero for semaphore acquired. 81 * returns negative for signalled and zero for semaphore acquired.
84 */ 82 */
85 83
86extern inline int down_interruptible(struct semaphore * sem) 84static inline int down_interruptible(struct semaphore * sem)
87{ 85{
88 unsigned long flags; 86 unsigned long flags;
89 int failed; 87 int failed;
@@ -99,7 +97,7 @@ extern inline int down_interruptible(struct semaphore * sem)
99 return(failed); 97 return(failed);
100} 98}
101 99
102extern inline int down_trylock(struct semaphore * sem) 100static inline int down_trylock(struct semaphore * sem)
103{ 101{
104 unsigned long flags; 102 unsigned long flags;
105 int failed; 103 int failed;
@@ -119,7 +117,7 @@ extern inline int down_trylock(struct semaphore * sem)
119 * The default case (no contention) will result in NO 117 * The default case (no contention) will result in NO
120 * jumps for both down() and up(). 118 * jumps for both down() and up().
121 */ 119 */
122extern inline void up(struct semaphore * sem) 120static inline void up(struct semaphore * sem)
123{ 121{
124 unsigned long flags; 122 unsigned long flags;
125 int wakeup; 123 int wakeup;
diff --git a/include/asm-cris/system.h b/include/asm-cris/system.h
index e06739806d4e..d48670107a85 100644
--- a/include/asm-cris/system.h
+++ b/include/asm-cris/system.h
@@ -41,7 +41,7 @@ extern struct task_struct *resume(struct task_struct *prev, struct task_struct *
41void disable_hlt(void); 41void disable_hlt(void);
42void enable_hlt(void); 42void enable_hlt(void);
43 43
44extern inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) 44static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
45{ 45{
46 /* since Etrax doesn't have any atomic xchg instructions, we need to disable 46 /* since Etrax doesn't have any atomic xchg instructions, we need to disable
47 irq's (if enabled) and do it with move.d's */ 47 irq's (if enabled) and do it with move.d's */
diff --git a/include/asm-cris/timex.h b/include/asm-cris/timex.h
index 3fb069a37717..b92e0e80fe86 100644
--- a/include/asm-cris/timex.h
+++ b/include/asm-cris/timex.h
@@ -16,7 +16,7 @@
16 16
17typedef unsigned long long cycles_t; 17typedef unsigned long long cycles_t;
18 18
19extern inline cycles_t get_cycles(void) 19static inline cycles_t get_cycles(void)
20{ 20{
21 return 0; 21 return 0;
22} 22}
diff --git a/include/asm-cris/tlbflush.h b/include/asm-cris/tlbflush.h
index 6ed7d9ae90db..c52238005b55 100644
--- a/include/asm-cris/tlbflush.h
+++ b/include/asm-cris/tlbflush.h
@@ -39,14 +39,14 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st
39 flush_tlb_mm(vma->vm_mm); 39 flush_tlb_mm(vma->vm_mm);
40} 40}
41 41
42extern inline void flush_tlb_pgtables(struct mm_struct *mm, 42static inline void flush_tlb_pgtables(struct mm_struct *mm,
43 unsigned long start, unsigned long end) 43 unsigned long start, unsigned long end)
44{ 44{
45 /* CRIS does not keep any page table caches in TLB */ 45 /* CRIS does not keep any page table caches in TLB */
46} 46}
47 47
48 48
49extern inline void flush_tlb(void) 49static inline void flush_tlb(void)
50{ 50{
51 flush_tlb_mm(current->mm); 51 flush_tlb_mm(current->mm);
52} 52}
diff --git a/include/asm-cris/uaccess.h b/include/asm-cris/uaccess.h
index 7d50086eb5ea..69d48a2dc8e1 100644
--- a/include/asm-cris/uaccess.h
+++ b/include/asm-cris/uaccess.h
@@ -213,7 +213,7 @@ extern unsigned long __copy_user(void *to, const void *from, unsigned long n);
213extern unsigned long __copy_user_zeroing(void *to, const void *from, unsigned long n); 213extern unsigned long __copy_user_zeroing(void *to, const void *from, unsigned long n);
214extern unsigned long __do_clear_user(void *to, unsigned long n); 214extern unsigned long __do_clear_user(void *to, unsigned long n);
215 215
216extern inline unsigned long 216static inline unsigned long
217__generic_copy_to_user(void __user *to, const void *from, unsigned long n) 217__generic_copy_to_user(void __user *to, const void *from, unsigned long n)
218{ 218{
219 if (access_ok(VERIFY_WRITE, to, n)) 219 if (access_ok(VERIFY_WRITE, to, n))
@@ -221,7 +221,7 @@ __generic_copy_to_user(void __user *to, const void *from, unsigned long n)
221 return n; 221 return n;
222} 222}
223 223
224extern inline unsigned long 224static inline unsigned long
225__generic_copy_from_user(void *to, const void __user *from, unsigned long n) 225__generic_copy_from_user(void *to, const void __user *from, unsigned long n)
226{ 226{
227 if (access_ok(VERIFY_READ, from, n)) 227 if (access_ok(VERIFY_READ, from, n))
@@ -229,7 +229,7 @@ __generic_copy_from_user(void *to, const void __user *from, unsigned long n)
229 return n; 229 return n;
230} 230}
231 231
232extern inline unsigned long 232static inline unsigned long
233__generic_clear_user(void __user *to, unsigned long n) 233__generic_clear_user(void __user *to, unsigned long n)
234{ 234{
235 if (access_ok(VERIFY_WRITE, to, n)) 235 if (access_ok(VERIFY_WRITE, to, n))
@@ -237,13 +237,13 @@ __generic_clear_user(void __user *to, unsigned long n)
237 return n; 237 return n;
238} 238}
239 239
240extern inline long 240static inline long
241__strncpy_from_user(char *dst, const char __user *src, long count) 241__strncpy_from_user(char *dst, const char __user *src, long count)
242{ 242{
243 return __do_strncpy_from_user(dst, src, count); 243 return __do_strncpy_from_user(dst, src, count);
244} 244}
245 245
246extern inline long 246static inline long
247strncpy_from_user(char *dst, const char __user *src, long count) 247strncpy_from_user(char *dst, const char __user *src, long count)
248{ 248{
249 long res = -EFAULT; 249 long res = -EFAULT;
@@ -256,7 +256,7 @@ strncpy_from_user(char *dst, const char __user *src, long count)
256/* Note that if these expand awfully if made into switch constructs, so 256/* Note that if these expand awfully if made into switch constructs, so
257 don't do that. */ 257 don't do that. */
258 258
259extern inline unsigned long 259static inline unsigned long
260__constant_copy_from_user(void *to, const void __user *from, unsigned long n) 260__constant_copy_from_user(void *to, const void __user *from, unsigned long n)
261{ 261{
262 unsigned long ret = 0; 262 unsigned long ret = 0;
@@ -306,7 +306,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n)
306 306
307/* Ditto, don't make a switch out of this. */ 307/* Ditto, don't make a switch out of this. */
308 308
309extern inline unsigned long 309static inline unsigned long
310__constant_copy_to_user(void __user *to, const void *from, unsigned long n) 310__constant_copy_to_user(void __user *to, const void *from, unsigned long n)
311{ 311{
312 unsigned long ret = 0; 312 unsigned long ret = 0;
@@ -356,7 +356,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n)
356 356
357/* No switch, please. */ 357/* No switch, please. */
358 358
359extern inline unsigned long 359static inline unsigned long
360__constant_clear_user(void __user *to, unsigned long n) 360__constant_clear_user(void __user *to, unsigned long n)
361{ 361{
362 unsigned long ret = 0; 362 unsigned long ret = 0;
@@ -406,19 +406,19 @@ __constant_clear_user(void __user *to, unsigned long n)
406 * used in fast paths and have only a small space overhead. 406 * used in fast paths and have only a small space overhead.
407 */ 407 */
408 408
409extern inline unsigned long 409static inline unsigned long
410__generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n) 410__generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n)
411{ 411{
412 return __copy_user_zeroing(to,from,n); 412 return __copy_user_zeroing(to,from,n);
413} 413}
414 414
415extern inline unsigned long 415static inline unsigned long
416__generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n) 416__generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n)
417{ 417{
418 return __copy_user(to,from,n); 418 return __copy_user(to,from,n);
419} 419}
420 420
421extern inline unsigned long 421static inline unsigned long
422__generic_clear_user_nocheck(void *to, unsigned long n) 422__generic_clear_user_nocheck(void *to, unsigned long n)
423{ 423{
424 return __do_clear_user(to,n); 424 return __do_clear_user(to,n);
diff --git a/include/asm-cris/unistd.h b/include/asm-cris/unistd.h
index 156a34bfc583..2627bbdf8a11 100644
--- a/include/asm-cris/unistd.h
+++ b/include/asm-cris/unistd.h
@@ -343,14 +343,14 @@
343 * some others too. 343 * some others too.
344 */ 344 */
345#define __NR__exit __NR_exit 345#define __NR__exit __NR_exit
346extern inline _syscall0(pid_t,setsid) 346static inline _syscall0(pid_t,setsid)
347extern inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) 347static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
348extern inline _syscall3(int,read,int,fd,char *,buf,off_t,count) 348static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
349extern inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) 349static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
350extern inline _syscall1(int,dup,int,fd) 350static inline _syscall1(int,dup,int,fd)
351extern inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) 351static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
352extern inline _syscall3(int,open,const char *,file,int,flag,int,mode) 352static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
353extern inline _syscall1(int,close,int,fd) 353static inline _syscall1(int,close,int,fd)
354 354
355struct pt_regs; 355struct pt_regs;
356asmlinkage long sys_mmap2( 356asmlinkage long sys_mmap2(
@@ -382,8 +382,8 @@ asmlinkage long sys_rt_sigaction(int sig,
382#ifdef __KERNEL__ 382#ifdef __KERNEL__
383#define _exit kernel_syscall_exit 383#define _exit kernel_syscall_exit
384#endif 384#endif
385extern inline _syscall1(int,_exit,int,exitcode) 385static inline _syscall1(int,_exit,int,exitcode)
386extern inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options) 386static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
387#endif 387#endif
388 388
389 389
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index b247e99dff49..844666377dcb 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -26,6 +26,8 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29struct mm_struct;
30struct vm_area_struct;
29#endif 31#endif
30 32
31#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 7dca30a26c53..358e4d309ceb 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -128,6 +128,7 @@ do { \
128#endif 128#endif
129 129
130#ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT 130#ifndef __HAVE_ARCH_PTEP_SET_WRPROTECT
131struct mm_struct;
131static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep) 132static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep)
132{ 133{
133 pte_t old_pte = *ptep; 134 pte_t old_pte = *ptep;
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index a9c55490fb82..094d4917c1a9 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -35,6 +35,13 @@
35 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \ 35 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
36 } \ 36 } \
37 \ 37 \
38 /* RapidIO route ops */ \
39 .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \
40 VMLINUX_SYMBOL(__start_rio_route_ops) = .; \
41 *(.rio_route_ops) \
42 VMLINUX_SYMBOL(__end_rio_route_ops) = .; \
43 } \
44 \
38 /* Kernel symbol table: Normal symbols */ \ 45 /* Kernel symbol table: Normal symbols */ \
39 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ 46 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
40 VMLINUX_SYMBOL(__start___ksymtab) = .; \ 47 VMLINUX_SYMBOL(__start___ksymtab) = .; \
diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h
index fa11117d3cfa..4153d80e4d2b 100644
--- a/include/asm-i386/elf.h
+++ b/include/asm-i386/elf.h
@@ -119,6 +119,8 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
119 */ 119 */
120#define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) 120#define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X)
121 121
122struct task_struct;
123
122extern int dump_task_regs (struct task_struct *, elf_gregset_t *); 124extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
123extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); 125extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
124extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *); 126extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *);
diff --git a/include/asm-i386/kprobes.h b/include/asm-i386/kprobes.h
index 8b6d3a90cd78..ca916a892877 100644
--- a/include/asm-i386/kprobes.h
+++ b/include/asm-i386/kprobes.h
@@ -49,6 +49,23 @@ struct arch_specific_insn {
49 kprobe_opcode_t insn[MAX_INSN_SIZE]; 49 kprobe_opcode_t insn[MAX_INSN_SIZE];
50}; 50};
51 51
52struct prev_kprobe {
53 struct kprobe *kp;
54 unsigned long status;
55 unsigned long old_eflags;
56 unsigned long saved_eflags;
57};
58
59/* per-cpu kprobe control block */
60struct kprobe_ctlblk {
61 unsigned long kprobe_status;
62 unsigned long kprobe_old_eflags;
63 unsigned long kprobe_saved_eflags;
64 long *jprobe_saved_esp;
65 struct pt_regs jprobe_saved_regs;
66 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
67 struct prev_kprobe prev_kprobe;
68};
52 69
53/* trap3/1 are intr gates for kprobes. So, restore the status of IF, 70/* trap3/1 are intr gates for kprobes. So, restore the status of IF,
54 * if necessary, before executing the original int3/1 (trap) handler. 71 * if necessary, before executing the original int3/1 (trap) handler.
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index 03f3c8ac6383..088a945bf26b 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -25,6 +25,9 @@
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27 27
28struct mm_struct;
29struct vm_area_struct;
30
28/* 31/*
29 * ZERO_PAGE is a global shared page that is always zero: used 32 * ZERO_PAGE is a global shared page that is always zero: used
30 * for zero-mapped memory areas etc.. 33 * for zero-mapped memory areas etc..
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index 0a4ec764377c..8c02b0318703 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -718,4 +718,10 @@ extern void mtrr_bp_init(void);
718#define mtrr_bp_init() do {} while (0) 718#define mtrr_bp_init() do {} while (0)
719#endif 719#endif
720 720
721#ifdef CONFIG_X86_MCE
722extern void mcheck_init(struct cpuinfo_x86 *c);
723#else
724#define mcheck_init(c) do {} while(0)
725#endif
726
721#endif /* __ASM_I386_PROCESSOR_H */ 727#endif /* __ASM_I386_PROCESSOR_H */
diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h
index 6347c9845642..df67d40801de 100644
--- a/include/asm-ia64/dma-mapping.h
+++ b/include/asm-ia64/dma-mapping.h
@@ -48,12 +48,7 @@ dma_set_mask (struct device *dev, u64 mask)
48 return 0; 48 return 0;
49} 49}
50 50
51static inline int 51extern int dma_get_cache_alignment(void);
52dma_get_cache_alignment (void)
53{
54 extern int ia64_max_cacheline_size;
55 return ia64_max_cacheline_size;
56}
57 52
58static inline void 53static inline void
59dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir) 54dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir)
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h
index 573a3574a24f..592abb000e29 100644
--- a/include/asm-ia64/kprobes.h
+++ b/include/asm-ia64/kprobes.h
@@ -26,6 +26,7 @@
26 */ 26 */
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/ptrace.h> 28#include <linux/ptrace.h>
29#include <linux/percpu.h>
29#include <asm/break.h> 30#include <asm/break.h>
30 31
31#define MAX_INSN_SIZE 16 32#define MAX_INSN_SIZE 16
@@ -62,6 +63,18 @@ typedef struct _bundle {
62 } quad1; 63 } quad1;
63} __attribute__((__aligned__(16))) bundle_t; 64} __attribute__((__aligned__(16))) bundle_t;
64 65
66struct prev_kprobe {
67 struct kprobe *kp;
68 unsigned long status;
69};
70
71/* per-cpu kprobe control block */
72struct kprobe_ctlblk {
73 unsigned long kprobe_status;
74 struct pt_regs jprobe_saved_regs;
75 struct prev_kprobe prev_kprobe;
76};
77
65#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry 78#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
66 79
67#define ARCH_SUPPORTS_KRETPROBES 80#define ARCH_SUPPORTS_KRETPROBES
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index 21e32a06bc82..c34ba80c1c31 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -127,6 +127,7 @@
127 127
128# ifndef __ASSEMBLY__ 128# ifndef __ASSEMBLY__
129 129
130#include <linux/sched.h> /* for mm_struct */
130#include <asm/bitops.h> 131#include <asm/bitops.h>
131#include <asm/cacheflush.h> 132#include <asm/cacheflush.h>
132#include <asm/mmu_context.h> 133#include <asm/mmu_context.h>
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h
index a79d1a7ecc77..2c703d6e0c86 100644
--- a/include/asm-ia64/ptrace.h
+++ b/include/asm-ia64/ptrace.h
@@ -229,6 +229,9 @@ struct switch_stack {
229}; 229};
230 230
231#ifdef __KERNEL__ 231#ifdef __KERNEL__
232
233#define __ARCH_SYS_PTRACE 1
234
232/* 235/*
233 * We use the ia64_psr(regs)->ri to determine which of the three 236 * We use the ia64_psr(regs)->ri to determine which of the three
234 * instructions in bundle (16 bytes) took the sample. Generate 237 * instructions in bundle (16 bytes) took the sample. Generate
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
index 1cd5fd4a5b2c..75740debcd01 100644
--- a/include/asm-m32r/pgtable.h
+++ b/include/asm-m32r/pgtable.h
@@ -27,6 +27,9 @@
27#include <asm/bitops.h> 27#include <asm/bitops.h>
28#include <asm/page.h> 28#include <asm/page.h>
29 29
30struct mm_struct;
31struct vm_area_struct;
32
30extern pgd_t swapper_pg_dir[1024]; 33extern pgd_t swapper_pg_dir[1024];
31extern void paging_init(void); 34extern void paging_init(void);
32 35
diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h
index 976417126b2d..55cd7ecfde43 100644
--- a/include/asm-m32r/ptrace.h
+++ b/include/asm-m32r/ptrace.h
@@ -145,6 +145,9 @@ struct pt_regs {
145#define PTRACE_O_TRACESYSGOOD 0x00000001 145#define PTRACE_O_TRACESYSGOOD 0x00000001
146 146
147#ifdef __KERNEL__ 147#ifdef __KERNEL__
148
149#define __ARCH_SYS_PTRACE 1
150
148#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) 151#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2)
149#define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) 152#define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0)
150#elif defined(CONFIG_ISA_M32R) 153#elif defined(CONFIG_ISA_M32R)
diff --git a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
index 026bbc9565b4..49925e91e89c 100644
--- a/include/asm-m68knommu/cacheflush.h
+++ b/include/asm-m68knommu/cacheflush.h
@@ -25,7 +25,7 @@
25#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 25#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
26 memcpy(dst, src, len) 26 memcpy(dst, src, len)
27 27
28extern inline void __flush_cache_all(void) 28static inline void __flush_cache_all(void)
29{ 29{
30#ifdef CONFIG_M5407 30#ifdef CONFIG_M5407
31 /* 31 /*
@@ -64,7 +64,7 @@ extern inline void __flush_cache_all(void)
64 "nop\n\t" 64 "nop\n\t"
65 : : : "d0" ); 65 : : : "d0" );
66#endif /* CONFIG_M5272 */ 66#endif /* CONFIG_M5272 */
67#if CONFIG_M5249 67#ifdef CONFIG_M5249
68 __asm__ __volatile__ ( 68 __asm__ __volatile__ (
69 "movel #0xa1000200, %%d0\n\t" 69 "movel #0xa1000200, %%d0\n\t"
70 "movec %%d0, %%CACR\n\t" 70 "movec %%d0, %%CACR\n\t"
diff --git a/include/asm-m68knommu/irq.h b/include/asm-m68knommu/irq.h
index 208ccd969e4b..a08fa9b958da 100644
--- a/include/asm-m68knommu/irq.h
+++ b/include/asm-m68knommu/irq.h
@@ -2,7 +2,6 @@
2#define _M68K_IRQ_H_ 2#define _M68K_IRQ_H_
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/interrupt.h>
6#include <asm/ptrace.h> 5#include <asm/ptrace.h>
7 6
8#ifdef CONFIG_COLDFIRE 7#ifdef CONFIG_COLDFIRE
@@ -83,36 +82,6 @@ extern void (*mach_disable_irq)(unsigned int);
83#endif /* CONFIG_M68360 */ 82#endif /* CONFIG_M68360 */
84 83
85/* 84/*
86 * This structure is used to chain together the ISRs for a particular
87 * interrupt source (if it supports chaining).
88 */
89typedef struct irq_node {
90 irqreturn_t (*handler)(int, void *, struct pt_regs *);
91 unsigned long flags;
92 void *dev_id;
93 const char *devname;
94 struct irq_node *next;
95} irq_node_t;
96
97/*
98 * This structure has only 4 elements for speed reasons
99 */
100typedef struct irq_handler {
101 irqreturn_t (*handler)(int, void *, struct pt_regs *);
102 unsigned long flags;
103 void *dev_id;
104 const char *devname;
105} irq_handler_t;
106
107/* count of spurious interrupts */
108extern volatile unsigned int num_spurious;
109
110/*
111 * This function returns a new irq_node_t
112 */
113extern irq_node_t *new_irq_node(void);
114
115/*
116 * Some drivers want these entry points 85 * Some drivers want these entry points
117 */ 86 */
118#define enable_irq(x) (mach_enable_irq ? (*mach_enable_irq)(x) : 0) 87#define enable_irq(x) (mach_enable_irq ? (*mach_enable_irq)(x) : 0)
diff --git a/include/asm-m68knommu/irqnode.h b/include/asm-m68knommu/irqnode.h
new file mode 100644
index 000000000000..a2503dfc554c
--- /dev/null
+++ b/include/asm-m68knommu/irqnode.h
@@ -0,0 +1,36 @@
1#ifndef _M68K_IRQNODE_H_
2#define _M68K_IRQNODE_H_
3
4#include <linux/interrupt.h>
5
6/*
7 * This structure is used to chain together the ISRs for a particular
8 * interrupt source (if it supports chaining).
9 */
10typedef struct irq_node {
11 irqreturn_t (*handler)(int, void *, struct pt_regs *);
12 unsigned long flags;
13 void *dev_id;
14 const char *devname;
15 struct irq_node *next;
16} irq_node_t;
17
18/*
19 * This structure has only 4 elements for speed reasons
20 */
21typedef struct irq_handler {
22 irqreturn_t (*handler)(int, void *, struct pt_regs *);
23 unsigned long flags;
24 void *dev_id;
25 const char *devname;
26} irq_handler_t;
27
28/* count of spurious interrupts */
29extern volatile unsigned int num_spurious;
30
31/*
32 * This function returns a new irq_node_t
33 */
34extern irq_node_t *new_irq_node(void);
35
36#endif /* _M68K_IRQNODE_H_ */
diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h
index 7420f12742bb..d2c9a25f8459 100644
--- a/include/asm-mips/elf.h
+++ b/include/asm-mips/elf.h
@@ -275,6 +275,8 @@ do { \
275 275
276#endif /* CONFIG_64BIT */ 276#endif /* CONFIG_64BIT */
277 277
278struct task_struct;
279
278extern void dump_regs(elf_greg_t *, struct pt_regs *regs); 280extern void dump_regs(elf_greg_t *, struct pt_regs *regs);
279extern int dump_task_regs (struct task_struct *, elf_gregset_t *); 281extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
280extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); 282extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *);
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 34facd996503..702a28fa7a34 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -19,6 +19,9 @@
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/pgtable-bits.h> 20#include <asm/pgtable-bits.h>
21 21
22struct mm_struct;
23struct vm_area_struct;
24
22#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) 25#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
23#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ 26#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
24 PAGE_CACHABLE_DEFAULT) 27 PAGE_CACHABLE_DEFAULT)
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
index c28fb6f48c6c..b4554711c3e7 100644
--- a/include/asm-parisc/pgtable.h
+++ b/include/asm-parisc/pgtable.h
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/mm.h> /* for vm_area_struct */
15#include <asm/processor.h> 16#include <asm/processor.h>
16#include <asm/cache.h> 17#include <asm/cache.h>
17#include <asm/bitops.h> 18#include <asm/bitops.h>
@@ -418,7 +419,6 @@ extern void paging_init (void);
418 419
419#define PG_dcache_dirty PG_arch_1 420#define PG_dcache_dirty PG_arch_1
420 421
421struct vm_area_struct; /* forward declaration (include/linux/mm.h) */
422extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); 422extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
423 423
424/* Encode and de-code a swap entry */ 424/* Encode and de-code a swap entry */
@@ -464,6 +464,7 @@ static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned
464 464
465extern spinlock_t pa_dbit_lock; 465extern spinlock_t pa_dbit_lock;
466 466
467struct mm_struct;
467static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 468static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
468{ 469{
469 pte_t old_pte; 470 pte_t old_pte;
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
new file mode 100644
index 000000000000..dc25c53704d5
--- /dev/null
+++ b/include/asm-powerpc/bitops.h
@@ -0,0 +1,437 @@
1/*
2 * PowerPC atomic bit operations.
3 *
4 * Merged version by David Gibson <david@gibson.dropbear.id.au>.
5 * Based on ppc64 versions by: Dave Engebretsen, Todd Inglett, Don
6 * Reed, Pat McCarthy, Peter Bergner, Anton Blanchard. They
7 * originally took it from the ppc32 code.
8 *
9 * Within a word, bits are numbered LSB first. Lot's of places make
10 * this assumption by directly testing bits with (val & (1<<nr)).
11 * This can cause confusion for large (> 1 word) bitmaps on a
12 * big-endian system because, unlike little endian, the number of each
13 * bit depends on the word size.
14 *
15 * The bitop functions are defined to work on unsigned longs, so for a
16 * ppc64 system the bits end up numbered:
17 * |63..............0|127............64|191...........128|255...........196|
18 * and on ppc32:
19 * |31.....0|63....31|95....64|127...96|159..128|191..160|223..192|255..224|
20 *
21 * There are a few little-endian macros used mostly for filesystem
22 * bitmaps, these work on similar bit arrays layouts, but
23 * byte-oriented:
24 * |7...0|15...8|23...16|31...24|39...32|47...40|55...48|63...56|
25 *
26 * The main difference is that bit 3-5 (64b) or 3-4 (32b) in the bit
27 * number field needs to be reversed compared to the big-endian bit
28 * fields. This can be achieved by XOR with 0x38 (64b) or 0x18 (32b).
29 *
30 * This program is free software; you can redistribute it and/or
31 * modify it under the terms of the GNU General Public License
32 * as published by the Free Software Foundation; either version
33 * 2 of the License, or (at your option) any later version.
34 */
35
36#ifndef _ASM_POWERPC_BITOPS_H
37#define _ASM_POWERPC_BITOPS_H
38
39#ifdef __KERNEL__
40
41#include <linux/compiler.h>
42#include <asm/atomic.h>
43#include <asm/synch.h>
44
45/*
46 * clear_bit doesn't imply a memory barrier
47 */
48#define smp_mb__before_clear_bit() smp_mb()
49#define smp_mb__after_clear_bit() smp_mb()
50
51#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
52#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
53#define BITOP_LE_SWIZZLE ((BITS_PER_LONG-1) & ~0x7)
54
55#ifdef CONFIG_PPC64
56#define LARXL "ldarx"
57#define STCXL "stdcx."
58#define CNTLZL "cntlzd"
59#else
60#define LARXL "lwarx"
61#define STCXL "stwcx."
62#define CNTLZL "cntlzw"
63#endif
64
65static __inline__ void set_bit(int nr, volatile unsigned long *addr)
66{
67 unsigned long old;
68 unsigned long mask = BITOP_MASK(nr);
69 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
70
71 __asm__ __volatile__(
72"1:" LARXL " %0,0,%3 # set_bit\n"
73 "or %0,%0,%2\n"
74 PPC405_ERR77(0,%3)
75 STCXL " %0,0,%3\n"
76 "bne- 1b"
77 : "=&r"(old), "=m"(*p)
78 : "r"(mask), "r"(p), "m"(*p)
79 : "cc" );
80}
81
82static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
83{
84 unsigned long old;
85 unsigned long mask = BITOP_MASK(nr);
86 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
87
88 __asm__ __volatile__(
89"1:" LARXL " %0,0,%3 # set_bit\n"
90 "andc %0,%0,%2\n"
91 PPC405_ERR77(0,%3)
92 STCXL " %0,0,%3\n"
93 "bne- 1b"
94 : "=&r"(old), "=m"(*p)
95 : "r"(mask), "r"(p), "m"(*p)
96 : "cc" );
97}
98
99static __inline__ void change_bit(int nr, volatile unsigned long *addr)
100{
101 unsigned long old;
102 unsigned long mask = BITOP_MASK(nr);
103 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
104
105 __asm__ __volatile__(
106"1:" LARXL " %0,0,%3 # set_bit\n"
107 "xor %0,%0,%2\n"
108 PPC405_ERR77(0,%3)
109 STCXL " %0,0,%3\n"
110 "bne- 1b"
111 : "=&r"(old), "=m"(*p)
112 : "r"(mask), "r"(p), "m"(*p)
113 : "cc" );
114}
115
116static __inline__ int test_and_set_bit(unsigned long nr,
117 volatile unsigned long *addr)
118{
119 unsigned long old, t;
120 unsigned long mask = BITOP_MASK(nr);
121 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
122
123 __asm__ __volatile__(
124 EIEIO_ON_SMP
125"1:" LARXL " %0,0,%3 # test_and_set_bit\n"
126 "or %1,%0,%2 \n"
127 PPC405_ERR77(0,%3)
128 STCXL " %1,0,%3 \n"
129 "bne- 1b"
130 ISYNC_ON_SMP
131 : "=&r" (old), "=&r" (t)
132 : "r" (mask), "r" (p)
133 : "cc", "memory");
134
135 return (old & mask) != 0;
136}
137
138static __inline__ int test_and_clear_bit(unsigned long nr,
139 volatile unsigned long *addr)
140{
141 unsigned long old, t;
142 unsigned long mask = BITOP_MASK(nr);
143 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
144
145 __asm__ __volatile__(
146 EIEIO_ON_SMP
147"1:" LARXL " %0,0,%3 # test_and_clear_bit\n"
148 "andc %1,%0,%2 \n"
149 PPC405_ERR77(0,%3)
150 STCXL " %1,0,%3 \n"
151 "bne- 1b"
152 ISYNC_ON_SMP
153 : "=&r" (old), "=&r" (t)
154 : "r" (mask), "r" (p)
155 : "cc", "memory");
156
157 return (old & mask) != 0;
158}
159
160static __inline__ int test_and_change_bit(unsigned long nr,
161 volatile unsigned long *addr)
162{
163 unsigned long old, t;
164 unsigned long mask = BITOP_MASK(nr);
165 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
166
167 __asm__ __volatile__(
168 EIEIO_ON_SMP
169"1:" LARXL " %0,0,%3 # test_and_change_bit\n"
170 "xor %1,%0,%2 \n"
171 PPC405_ERR77(0,%3)
172 STCXL " %1,0,%3 \n"
173 "bne- 1b"
174 ISYNC_ON_SMP
175 : "=&r" (old), "=&r" (t)
176 : "r" (mask), "r" (p)
177 : "cc", "memory");
178
179 return (old & mask) != 0;
180}
181
182static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
183{
184 unsigned long old;
185
186 __asm__ __volatile__(
187"1:" LARXL " %0,0,%3 # set_bit\n"
188 "or %0,%0,%2\n"
189 STCXL " %0,0,%3\n"
190 "bne- 1b"
191 : "=&r" (old), "=m" (*addr)
192 : "r" (mask), "r" (addr), "m" (*addr)
193 : "cc");
194}
195
196/* Non-atomic versions */
197static __inline__ int test_bit(unsigned long nr,
198 __const__ volatile unsigned long *addr)
199{
200 return 1UL & (addr[BITOP_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
201}
202
203static __inline__ void __set_bit(unsigned long nr,
204 volatile unsigned long *addr)
205{
206 unsigned long mask = BITOP_MASK(nr);
207 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
208
209 *p |= mask;
210}
211
212static __inline__ void __clear_bit(unsigned long nr,
213 volatile unsigned long *addr)
214{
215 unsigned long mask = BITOP_MASK(nr);
216 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
217
218 *p &= ~mask;
219}
220
221static __inline__ void __change_bit(unsigned long nr,
222 volatile unsigned long *addr)
223{
224 unsigned long mask = BITOP_MASK(nr);
225 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
226
227 *p ^= mask;
228}
229
230static __inline__ int __test_and_set_bit(unsigned long nr,
231 volatile unsigned long *addr)
232{
233 unsigned long mask = BITOP_MASK(nr);
234 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
235 unsigned long old = *p;
236
237 *p = old | mask;
238 return (old & mask) != 0;
239}
240
241static __inline__ int __test_and_clear_bit(unsigned long nr,
242 volatile unsigned long *addr)
243{
244 unsigned long mask = BITOP_MASK(nr);
245 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
246 unsigned long old = *p;
247
248 *p = old & ~mask;
249 return (old & mask) != 0;
250}
251
252static __inline__ int __test_and_change_bit(unsigned long nr,
253 volatile unsigned long *addr)
254{
255 unsigned long mask = BITOP_MASK(nr);
256 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
257 unsigned long old = *p;
258
259 *p = old ^ mask;
260 return (old & mask) != 0;
261}
262
263/*
264 * Return the zero-based bit position (LE, not IBM bit numbering) of
265 * the most significant 1-bit in a double word.
266 */
267static __inline__ int __ilog2(unsigned long x)
268{
269 int lz;
270
271 asm (CNTLZL " %0,%1" : "=r" (lz) : "r" (x));
272 return BITS_PER_LONG - 1 - lz;
273}
274
275/*
276 * Determines the bit position of the least significant 0 bit in the
277 * specified double word. The returned bit position will be
278 * zero-based, starting from the right side (63/31 - 0).
279 */
280static __inline__ unsigned long ffz(unsigned long x)
281{
282 /* no zero exists anywhere in the 8 byte area. */
283 if ((x = ~x) == 0)
284 return BITS_PER_LONG;
285
286 /*
287 * Calculate the bit position of the least signficant '1' bit in x
288 * (since x has been changed this will actually be the least signficant
289 * '0' bit in * the original x). Note: (x & -x) gives us a mask that
290 * is the least significant * (RIGHT-most) 1-bit of the value in x.
291 */
292 return __ilog2(x & -x);
293}
294
295static __inline__ int __ffs(unsigned long x)
296{
297 return __ilog2(x & -x);
298}
299
300/*
301 * ffs: find first bit set. This is defined the same way as
302 * the libc and compiler builtin ffs routines, therefore
303 * differs in spirit from the above ffz (man ffs).
304 */
305static __inline__ int ffs(int x)
306{
307 unsigned long i = (unsigned long)x;
308 return __ilog2(i & -i) + 1;
309}
310
311/*
312 * fls: find last (most-significant) bit set.
313 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
314 */
315static __inline__ int fls(unsigned int x)
316{
317 int lz;
318
319 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
320 return 32 - lz;
321}
322
323/*
324 * hweightN: returns the hamming weight (i.e. the number
325 * of bits set) of a N-bit word
326 */
327#define hweight64(x) generic_hweight64(x)
328#define hweight32(x) generic_hweight32(x)
329#define hweight16(x) generic_hweight16(x)
330#define hweight8(x) generic_hweight8(x)
331
332#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
333unsigned long find_next_zero_bit(const unsigned long *addr,
334 unsigned long size, unsigned long offset);
335/**
336 * find_first_bit - find the first set bit in a memory region
337 * @addr: The address to start the search at
338 * @size: The maximum size to search
339 *
340 * Returns the bit-number of the first set bit, not the number of the byte
341 * containing a bit.
342 */
343#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
344unsigned long find_next_bit(const unsigned long *addr,
345 unsigned long size, unsigned long offset);
346
347/* Little-endian versions */
348
349static __inline__ int test_le_bit(unsigned long nr,
350 __const__ unsigned long *addr)
351{
352 __const__ unsigned char *tmp = (__const__ unsigned char *) addr;
353 return (tmp[nr >> 3] >> (nr & 7)) & 1;
354}
355
356#define __set_le_bit(nr, addr) \
357 __set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
358#define __clear_le_bit(nr, addr) \
359 __clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
360
361#define test_and_set_le_bit(nr, addr) \
362 test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
363#define test_and_clear_le_bit(nr, addr) \
364 test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
365
366#define __test_and_set_le_bit(nr, addr) \
367 __test_and_set_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
368#define __test_and_clear_le_bit(nr, addr) \
369 __test_and_clear_bit((nr) ^ BITOP_LE_SWIZZLE, (addr))
370
371#define find_first_zero_le_bit(addr, size) find_next_zero_le_bit((addr), (size), 0)
372unsigned long find_next_zero_le_bit(const unsigned long *addr,
373 unsigned long size, unsigned long offset);
374
375/* Bitmap functions for the ext2 filesystem */
376
377#define ext2_set_bit(nr,addr) \
378 __test_and_set_le_bit((nr), (unsigned long*)addr)
379#define ext2_clear_bit(nr, addr) \
380 __test_and_clear_le_bit((nr), (unsigned long*)addr)
381
382#define ext2_set_bit_atomic(lock, nr, addr) \
383 test_and_set_le_bit((nr), (unsigned long*)addr)
384#define ext2_clear_bit_atomic(lock, nr, addr) \
385 test_and_clear_le_bit((nr), (unsigned long*)addr)
386
387#define ext2_test_bit(nr, addr) test_le_bit((nr),(unsigned long*)addr)
388
389#define ext2_find_first_zero_bit(addr, size) \
390 find_first_zero_le_bit((unsigned long*)addr, size)
391#define ext2_find_next_zero_bit(addr, size, off) \
392 find_next_zero_le_bit((unsigned long*)addr, size, off)
393
394/* Bitmap functions for the minix filesystem. */
395
396#define minix_test_and_set_bit(nr,addr) \
397 __test_and_set_le_bit(nr, (unsigned long *)addr)
398#define minix_set_bit(nr,addr) \
399 __set_le_bit(nr, (unsigned long *)addr)
400#define minix_test_and_clear_bit(nr,addr) \
401 __test_and_clear_le_bit(nr, (unsigned long *)addr)
402#define minix_test_bit(nr,addr) \
403 test_le_bit(nr, (unsigned long *)addr)
404
405#define minix_find_first_zero_bit(addr,size) \
406 find_first_zero_le_bit((unsigned long *)addr, size)
407
408/*
409 * Every architecture must define this function. It's the fastest
410 * way of searching a 140-bit bitmap where the first 100 bits are
411 * unlikely to be set. It's guaranteed that at least one of the 140
412 * bits is cleared.
413 */
414static inline int sched_find_first_bit(const unsigned long *b)
415{
416#ifdef CONFIG_PPC64
417 if (unlikely(b[0]))
418 return __ffs(b[0]);
419 if (unlikely(b[1]))
420 return __ffs(b[1]) + 64;
421 return __ffs(b[2]) + 128;
422#else
423 if (unlikely(b[0]))
424 return __ffs(b[0]);
425 if (unlikely(b[1]))
426 return __ffs(b[1]) + 32;
427 if (unlikely(b[2]))
428 return __ffs(b[2]) + 64;
429 if (b[3])
430 return __ffs(b[3]) + 96;
431 return __ffs(b[4]) + 128;
432#endif
433}
434
435#endif /* __KERNEL__ */
436
437#endif /* _ASM_POWERPC_BITOPS_H */
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index e4d028e87020..d625ee55f957 100644
--- a/include/asm-powerpc/bug.h
+++ b/include/asm-powerpc/bug.h
@@ -12,20 +12,16 @@
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13 13
14#ifdef __powerpc64__ 14#ifdef __powerpc64__
15#define BUG_TABLE_ENTRY(label, line, file, func) \ 15#define BUG_TABLE_ENTRY ".llong"
16 ".llong " #label "\n .long " #line "\n .llong " #file ", " #func "\n" 16#define BUG_TRAP_OP "tdnei"
17#define TRAP_OP(ra, rb) "1: tdnei " #ra ", " #rb "\n"
18#define DATA_TYPE long long
19#else 17#else
20#define BUG_TABLE_ENTRY(label, line, file, func) \ 18#define BUG_TABLE_ENTRY ".long"
21 ".long " #label ", " #line ", " #file ", " #func "\n" 19#define BUG_TRAP_OP "twnei"
22#define TRAP_OP(ra, rb) "1: twnei " #ra ", " #rb "\n"
23#define DATA_TYPE int
24#endif /* __powerpc64__ */ 20#endif /* __powerpc64__ */
25 21
26struct bug_entry { 22struct bug_entry {
27 unsigned long bug_addr; 23 unsigned long bug_addr;
28 int line; 24 long line;
29 const char *file; 25 const char *file;
30 const char *function; 26 const char *function;
31}; 27};
@@ -43,29 +39,29 @@ struct bug_entry *find_bug(unsigned long bugaddr);
43#define BUG() do { \ 39#define BUG() do { \
44 __asm__ __volatile__( \ 40 __asm__ __volatile__( \
45 "1: twi 31,0,0\n" \ 41 "1: twi 31,0,0\n" \
46 ".section __bug_table,\"a\"\n\t" \ 42 ".section __bug_table,\"a\"\n" \
47 BUG_TABLE_ENTRY(1b,%0,%1,%2) \ 43 "\t"BUG_TABLE_ENTRY" 1b,%0,%1,%2\n" \
48 ".previous" \ 44 ".previous" \
49 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \ 45 : : "i" (__LINE__), "i" (__FILE__), "i" (__FUNCTION__)); \
50} while (0) 46} while (0)
51 47
52#define BUG_ON(x) do { \ 48#define BUG_ON(x) do { \
53 __asm__ __volatile__( \ 49 __asm__ __volatile__( \
54 TRAP_OP(%0,0) \ 50 "1: "BUG_TRAP_OP" %0,0\n" \
55 ".section __bug_table,\"a\"\n\t" \ 51 ".section __bug_table,\"a\"\n" \
56 BUG_TABLE_ENTRY(1b,%1,%2,%3) \ 52 "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \
57 ".previous" \ 53 ".previous" \
58 : : "r" ((DATA_TYPE)(x)), "i" (__LINE__), \ 54 : : "r" ((long)(x)), "i" (__LINE__), \
59 "i" (__FILE__), "i" (__FUNCTION__)); \ 55 "i" (__FILE__), "i" (__FUNCTION__)); \
60} while (0) 56} while (0)
61 57
62#define WARN_ON(x) do { \ 58#define WARN_ON(x) do { \
63 __asm__ __volatile__( \ 59 __asm__ __volatile__( \
64 TRAP_OP(%0,0) \ 60 "1: "BUG_TRAP_OP" %0,0\n" \
65 ".section __bug_table,\"a\"\n\t" \ 61 ".section __bug_table,\"a\"\n" \
66 BUG_TABLE_ENTRY(1b,%1,%2,%3) \ 62 "\t"BUG_TABLE_ENTRY" 1b,%1,%2,%3\n" \
67 ".previous" \ 63 ".previous" \
68 : : "r" ((DATA_TYPE)(x)), \ 64 : : "r" ((long)(x)), \
69 "i" (__LINE__ + BUG_WARNING_TRAP), \ 65 "i" (__LINE__ + BUG_WARNING_TRAP), \
70 "i" (__FILE__), "i" (__FUNCTION__)); \ 66 "i" (__FILE__), "i" (__FUNCTION__)); \
71} while (0) 67} while (0)
diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h
index c019501daceb..79a0556a0ab8 100644
--- a/include/asm-powerpc/cputable.h
+++ b/include/asm-powerpc/cputable.h
@@ -101,6 +101,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
101#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) 101#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000)
102#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) 102#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000)
103#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) 103#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000)
104#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000)
104#else 105#else
105/* ensure on 32b processors the flags are available for compiling but 106/* ensure on 32b processors the flags are available for compiling but
106 * don't do anything */ 107 * don't do anything */
@@ -116,6 +117,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset);
116#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0) 117#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0)
117#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0) 118#define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0)
118#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0) 119#define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0)
120#define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0)
119#endif 121#endif
120 122
121#ifndef __ASSEMBLY__ 123#ifndef __ASSEMBLY__
@@ -339,6 +341,7 @@ enum {
339#ifdef __powerpc64__ 341#ifdef __powerpc64__
340 CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | 342 CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 |
341 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL | 343 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_CELL |
344 CPU_FTR_CI_LARGE_PAGE |
342#endif 345#endif
343 0, 346 0,
344 347
diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h
index d22b10021b5d..feac3458d71f 100644
--- a/include/asm-powerpc/elf.h
+++ b/include/asm-powerpc/elf.h
@@ -1,11 +1,13 @@
1#ifndef _ASM_POWERPC_ELF_H 1#ifndef _ASM_POWERPC_ELF_H
2#define _ASM_POWERPC_ELF_H 2#define _ASM_POWERPC_ELF_H
3 3
4#include <linux/sched.h> /* for task_struct */
4#include <asm/types.h> 5#include <asm/types.h>
5#include <asm/ptrace.h> 6#include <asm/ptrace.h>
6#include <asm/cputable.h> 7#include <asm/cputable.h>
7#include <asm/auxvec.h> 8#include <asm/auxvec.h>
8#include <asm/page.h> 9#include <asm/page.h>
10#include <asm/string.h>
9 11
10/* PowerPC relocations defined by the ABIs */ 12/* PowerPC relocations defined by the ABIs */
11#define R_PPC_NONE 0 13#define R_PPC_NONE 0
@@ -178,18 +180,22 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32];
178static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs, 180static inline void ppc_elf_core_copy_regs(elf_gregset_t elf_regs,
179 struct pt_regs *regs) 181 struct pt_regs *regs)
180{ 182{
181 int i; 183 int i, nregs;
182 int gprs = sizeof(struct pt_regs)/sizeof(ELF_GREG_TYPE);
183 184
184 if (gprs > ELF_NGREG) 185 memset((void *)elf_regs, 0, sizeof(elf_gregset_t));
185 gprs = ELF_NGREG;
186 186
187 for (i=0; i < gprs; i++) 187 /* Our registers are always unsigned longs, whether we're a 32 bit
188 elf_regs[i] = (elf_greg_t)((ELF_GREG_TYPE *)regs)[i]; 188 * process or 64 bit, on either a 64 bit or 32 bit kernel.
189 189 * Don't use ELF_GREG_TYPE here. */
190 memset((char *)(elf_regs) + sizeof(struct pt_regs), 0, \ 190 nregs = sizeof(struct pt_regs) / sizeof(unsigned long);
191 sizeof(elf_gregset_t) - sizeof(struct pt_regs)); 191 if (nregs > ELF_NGREG)
192 nregs = ELF_NGREG;
192 193
194 for (i = 0; i < nregs; i++) {
195 /* This will correctly truncate 64 bit registers to 32 bits
196 * for a 32 bit process on a 64 bit kernel. */
197 elf_regs[i] = (elf_greg_t)((ELF_GREG_TYPE *)regs)[i];
198 }
193} 199}
194#define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, regs); 200#define ELF_CORE_COPY_REGS(gregs, regs) ppc_elf_core_copy_regs(gregs, regs);
195 201
diff --git a/include/asm-ppc64/futex.h b/include/asm-powerpc/futex.h
index 266b460de44e..37c94e52ab6d 100644
--- a/include/asm-ppc64/futex.h
+++ b/include/asm-powerpc/futex.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_FUTEX_H 1#ifndef _ASM_POWERPC_FUTEX_H
2#define _ASM_FUTEX_H 2#define _ASM_POWERPC_FUTEX_H
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
@@ -7,28 +7,29 @@
7#include <asm/errno.h> 7#include <asm/errno.h>
8#include <asm/synch.h> 8#include <asm/synch.h>
9#include <asm/uaccess.h> 9#include <asm/uaccess.h>
10#include <asm/ppc_asm.h>
10 11
11#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 12#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
12 __asm__ __volatile (SYNC_ON_SMP \ 13 __asm__ __volatile ( \
13"1: lwarx %0,0,%2\n" \ 14 SYNC_ON_SMP \
14 insn \ 15"1: lwarx %0,0,%2\n" \
15"2: stwcx. %1,0,%2\n\ 16 insn \
16 bne- 1b\n\ 17"2: stwcx. %1,0,%2\n" \
17 li %1,0\n\ 18 "bne- 1b\n" \
183: .section .fixup,\"ax\"\n\ 19 "li %1,0\n" \
194: li %1,%3\n\ 20"3: .section .fixup,\"ax\"\n" \
20 b 3b\n\ 21"4: li %1,%3\n" \
21 .previous\n\ 22 "b 3b\n" \
22 .section __ex_table,\"a\"\n\ 23 ".previous\n" \
23 .align 3\n\ 24 ".section __ex_table,\"a\"\n" \
24 .llong 1b,4b,2b,4b\n\ 25 ".align 3\n" \
25 .previous" \ 26 DATAL " 1b,4b,2b,4b\n" \
26 : "=&r" (oldval), "=&r" (ret) \ 27 ".previous" \
27 : "b" (uaddr), "i" (-EFAULT), "1" (oparg) \ 28 : "=&r" (oldval), "=&r" (ret) \
29 : "b" (uaddr), "i" (-EFAULT), "1" (oparg) \
28 : "cr0", "memory") 30 : "cr0", "memory")
29 31
30static inline int 32static inline int futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
31futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
32{ 33{
33 int op = (encoded_op >> 28) & 7; 34 int op = (encoded_op >> 28) & 7;
34 int cmp = (encoded_op >> 24) & 15; 35 int cmp = (encoded_op >> 24) & 15;
@@ -79,5 +80,5 @@ futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
79 return ret; 80 return ret;
80} 81}
81 82
82#endif 83#endif /* __KERNEL__ */
83#endif 84#endif /* _ASM_POWERPC_FUTEX_H */
diff --git a/include/asm-powerpc/ioctls.h b/include/asm-powerpc/ioctls.h
index 5b94ff489b8b..279a6229584b 100644
--- a/include/asm-powerpc/ioctls.h
+++ b/include/asm-powerpc/ioctls.h
@@ -62,6 +62,9 @@
62# define TIOCM_DSR 0x100 62# define TIOCM_DSR 0x100
63# define TIOCM_CD TIOCM_CAR 63# define TIOCM_CD TIOCM_CAR
64# define TIOCM_RI TIOCM_RNG 64# define TIOCM_RI TIOCM_RNG
65#define TIOCM_OUT1 0x2000
66#define TIOCM_OUT2 0x4000
67#define TIOCM_LOOP 0x8000
65 68
66#define TIOCGSOFTCAR 0x5419 69#define TIOCGSOFTCAR 0x5419
67#define TIOCSSOFTCAR 0x541A 70#define TIOCSSOFTCAR 0x541A
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 9d91bdd667ae..6a35e6570ccd 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -74,6 +74,11 @@ extern void iommu_devnode_init_pSeries(struct device_node *dn);
74 74
75/* Creates table for an individual device node */ 75/* Creates table for an individual device node */
76extern void iommu_devnode_init_iSeries(struct device_node *dn); 76extern void iommu_devnode_init_iSeries(struct device_node *dn);
77/* Get table parameters from HV */
78extern void iommu_table_getparms_iSeries(unsigned long busno,
79 unsigned char slotno,
80 unsigned char virtbus,
81 struct iommu_table* tbl);
77 82
78#endif /* CONFIG_PPC_ISERIES */ 83#endif /* CONFIG_PPC_ISERIES */
79 84
diff --git a/include/asm-powerpc/ipcbuf.h b/include/asm-powerpc/ipcbuf.h
new file mode 100644
index 000000000000..2c3e1d94db1d
--- /dev/null
+++ b/include/asm-powerpc/ipcbuf.h
@@ -0,0 +1,34 @@
1#ifndef _ASM_POWERPC_IPCBUF_H
2#define _ASM_POWERPC_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for the powerpc is identical to
6 * kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the
7 * kernel. Note extra padding because this structure is passed back
8 * and forth between kernel and user space. Pad space is left for:
9 * - 1 32-bit value to fill up for 8-byte alignment
10 * - 2 miscellaneous 64-bit values
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/types.h>
19
20struct ipc64_perm
21{
22 __kernel_key_t key;
23 __kernel_uid_t uid;
24 __kernel_gid_t gid;
25 __kernel_uid_t cuid;
26 __kernel_gid_t cgid;
27 __kernel_mode_t mode;
28 unsigned int seq;
29 unsigned int __pad1;
30 unsigned long long __unused1;
31 unsigned long long __unused2;
32};
33
34#endif /* _ASM_POWERPC_IPCBUF_H */
diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h
index c7c3f912a3c2..b3935ea28fff 100644
--- a/include/asm-powerpc/irq.h
+++ b/include/asm-powerpc/irq.h
@@ -73,7 +73,7 @@ extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq);
73#define IC_INVALID 0 73#define IC_INVALID 0
74#define IC_OPEN_PIC 1 74#define IC_OPEN_PIC 1
75#define IC_PPC_XIC 2 75#define IC_PPC_XIC 2
76#define IC_BPA_IIC 3 76#define IC_CELL_PIC 3
77#define IC_ISERIES 4 77#define IC_ISERIES 4
78 78
79extern u64 ppc64_interrupt_controller; 79extern u64 ppc64_interrupt_controller;
diff --git a/include/asm-ppc64/iSeries/HvCall.h b/include/asm-powerpc/iseries/hv_call.h
index c3f19475c0d9..e9f831c9a5e5 100644
--- a/include/asm-ppc64/iSeries/HvCall.h
+++ b/include/asm-powerpc/iseries/hv_call.h
@@ -20,11 +20,11 @@
20 * This file contains the "hypervisor call" interface which is used to 20 * This file contains the "hypervisor call" interface which is used to
21 * drive the hypervisor from the OS. 21 * drive the hypervisor from the OS.
22 */ 22 */
23#ifndef _HVCALL_H 23#ifndef _ASM_POWERPC_ISERIES_HV_CALL_H
24#define _HVCALL_H 24#define _ASM_POWERPC_ISERIES_HV_CALL_H
25 25
26#include <asm/iSeries/HvCallSc.h> 26#include <asm/iseries/hv_call_sc.h>
27#include <asm/iSeries/HvTypes.h> 27#include <asm/iseries/hv_types.h>
28#include <asm/paca.h> 28#include <asm/paca.h>
29 29
30/* Type of yield for HvCallBaseYieldProcessor */ 30/* Type of yield for HvCallBaseYieldProcessor */
@@ -110,4 +110,4 @@ static inline void HvCall_sendIPI(struct paca_struct *targetPaca)
110 HvCall1(HvCallBaseSendIPI, targetPaca->paca_index); 110 HvCall1(HvCallBaseSendIPI, targetPaca->paca_index);
111} 111}
112 112
113#endif /* _HVCALL_H */ 113#endif /* _ASM_POWERPC_ISERIES_HV_CALL_H */
diff --git a/include/asm-ppc64/iSeries/HvCallEvent.h b/include/asm-powerpc/iseries/hv_call_event.h
index 5d9a327d0122..46763a30590a 100644
--- a/include/asm-ppc64/iSeries/HvCallEvent.h
+++ b/include/asm-powerpc/iseries/hv_call_event.h
@@ -20,11 +20,11 @@
20 * This file contains the "hypervisor call" interface which is used to 20 * This file contains the "hypervisor call" interface which is used to
21 * drive the hypervisor from the OS. 21 * drive the hypervisor from the OS.
22 */ 22 */
23#ifndef _HVCALLEVENT_H 23#ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
24#define _HVCALLEVENT_H 24#define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
25 25
26#include <asm/iSeries/HvCallSc.h> 26#include <asm/iseries/hv_call_sc.h>
27#include <asm/iSeries/HvTypes.h> 27#include <asm/iseries/hv_types.h>
28#include <asm/abs_addr.h> 28#include <asm/abs_addr.h>
29 29
30struct HvLpEvent; 30struct HvLpEvent;
@@ -250,4 +250,4 @@ static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
250 return HvCall4(HvCallEventDmaToSp, abs_addr, remote, length, dir); 250 return HvCall4(HvCallEventDmaToSp, abs_addr, remote, length, dir);
251} 251}
252 252
253#endif /* _HVCALLEVENT_H */ 253#endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */
diff --git a/include/asm-ppc64/iSeries/HvCallSc.h b/include/asm-powerpc/iseries/hv_call_sc.h
index a62cef3822f9..dec7e9d9ab78 100644
--- a/include/asm-ppc64/iSeries/HvCallSc.h
+++ b/include/asm-powerpc/iseries/hv_call_sc.h
@@ -16,8 +16,8 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#ifndef _HVCALLSC_H 19#ifndef _ASM_POWERPC_ISERIES_HV_CALL_SC_H
20#define _HVCALLSC_H 20#define _ASM_POWERPC_ISERIES_HV_CALL_SC_H
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23 23
@@ -48,4 +48,4 @@ extern u64 HvCall5Ret16(u64, void *, u64, u64, u64, u64, u64);
48extern u64 HvCall6Ret16(u64, void *, u64, u64, u64, u64, u64, u64); 48extern u64 HvCall6Ret16(u64, void *, u64, u64, u64, u64, u64, u64);
49extern u64 HvCall7Ret16(u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64); 49extern u64 HvCall7Ret16(u64, void *, u64, u64 ,u64 ,u64 ,u64 ,u64 ,u64);
50 50
51#endif /* _HVCALLSC_H */ 51#endif /* _ASM_POWERPC_ISERIES_HV_CALL_SC_H */
diff --git a/include/asm-ppc64/iSeries/HvCallXm.h b/include/asm-powerpc/iseries/hv_call_xm.h
index 8b9ba608daaf..ca9202cb01ed 100644
--- a/include/asm-ppc64/iSeries/HvCallXm.h
+++ b/include/asm-powerpc/iseries/hv_call_xm.h
@@ -2,11 +2,11 @@
2 * This file contains the "hypervisor call" interface which is used to 2 * This file contains the "hypervisor call" interface which is used to
3 * drive the hypervisor from SLIC. 3 * drive the hypervisor from SLIC.
4 */ 4 */
5#ifndef _HVCALLXM_H 5#ifndef _ASM_POWERPC_ISERIES_HV_CALL_XM_H
6#define _HVCALLXM_H 6#define _ASM_POWERPC_ISERIES_HV_CALL_XM_H
7 7
8#include <asm/iSeries/HvCallSc.h> 8#include <asm/iseries/hv_call_sc.h>
9#include <asm/iSeries/HvTypes.h> 9#include <asm/iseries/hv_types.h>
10 10
11#define HvCallXmGetTceTableParms HvCallXm + 0 11#define HvCallXmGetTceTableParms HvCallXm + 0
12#define HvCallXmTestBus HvCallXm + 1 12#define HvCallXmTestBus HvCallXm + 1
@@ -75,4 +75,4 @@ static inline u64 HvCallXm_loadTod(void)
75 return HvCall0(HvCallXmLoadTod); 75 return HvCall0(HvCallXmLoadTod);
76} 76}
77 77
78#endif /* _HVCALLXM_H */ 78#endif /* _ASM_POWERPC_ISERIES_HV_CALL_XM_H */
diff --git a/include/asm-ppc64/iSeries/HvLpConfig.h b/include/asm-powerpc/iseries/hv_lp_config.h
index f1cf1e70ca3c..bc00f036bca0 100644
--- a/include/asm-ppc64/iSeries/HvLpConfig.h
+++ b/include/asm-powerpc/iseries/hv_lp_config.h
@@ -16,17 +16,17 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#ifndef _HVLPCONFIG_H 19#ifndef _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H
20#define _HVLPCONFIG_H 20#define _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H
21 21
22/* 22/*
23 * This file contains the interface to the LPAR configuration data 23 * This file contains the interface to the LPAR configuration data
24 * to determine which resources should be allocated to each partition. 24 * to determine which resources should be allocated to each partition.
25 */ 25 */
26 26
27#include <asm/iSeries/HvCallSc.h> 27#include <asm/iseries/hv_call_sc.h>
28#include <asm/iSeries/HvTypes.h> 28#include <asm/iseries/hv_types.h>
29#include <asm/iSeries/ItLpNaca.h> 29#include <asm/iseries/it_lp_naca.h>
30 30
31enum { 31enum {
32 HvCallCfg_Cur = 0, 32 HvCallCfg_Cur = 0,
@@ -135,4 +135,4 @@ static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp)
135 return HvCall1(HvCallCfgGetHostingLpIndex, lp); 135 return HvCall1(HvCallCfgGetHostingLpIndex, lp);
136} 136}
137 137
138#endif /* _HVLPCONFIG_H */ 138#endif /* _ASM_POWERPC_ISERIES_HV_LP_CONFIG_H */
diff --git a/include/asm-ppc64/iSeries/HvLpEvent.h b/include/asm-powerpc/iseries/hv_lp_event.h
index 865000de79b6..499ab1ad0185 100644
--- a/include/asm-ppc64/iSeries/HvLpEvent.h
+++ b/include/asm-powerpc/iseries/hv_lp_event.h
@@ -19,13 +19,13 @@
19 19
20/* This file contains the class for HV events in the system. */ 20/* This file contains the class for HV events in the system. */
21 21
22#ifndef _HVLPEVENT_H 22#ifndef _ASM_POWERPC_ISERIES_HV_LP_EVENT_H
23#define _HVLPEVENT_H 23#define _ASM_POWERPC_ISERIES_HV_LP_EVENT_H
24 24
25#include <asm/types.h> 25#include <asm/types.h>
26#include <asm/ptrace.h> 26#include <asm/ptrace.h>
27#include <asm/iSeries/HvTypes.h> 27#include <asm/iseries/hv_types.h>
28#include <asm/iSeries/HvCallEvent.h> 28#include <asm/iseries/hv_call_event.h>
29 29
30/* 30/*
31 * HvLpEvent is the structure for Lp Event messages passed between 31 * HvLpEvent is the structure for Lp Event messages passed between
@@ -139,4 +139,4 @@ extern int HvLpEvent_closePath(HvLpEvent_Type eventType, HvLpIndex lpIndex);
139#define HvLpDma_Rc_InvalidAddress 4 139#define HvLpDma_Rc_InvalidAddress 4
140#define HvLpDma_Rc_InvalidLength 5 140#define HvLpDma_Rc_InvalidLength 5
141 141
142#endif /* _HVLPEVENT_H */ 142#endif /* _ASM_POWERPC_ISERIES_HV_LP_EVENT_H */
diff --git a/include/asm-ppc64/iSeries/HvTypes.h b/include/asm-powerpc/iseries/hv_types.h
index b1ef2b4cb3e3..c38f7e3d01dc 100644
--- a/include/asm-ppc64/iSeries/HvTypes.h
+++ b/include/asm-powerpc/iseries/hv_types.h
@@ -16,8 +16,8 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#ifndef _HVTYPES_H 19#ifndef _ASM_POWERPC_ISERIES_HV_TYPES_H
20#define _HVTYPES_H 20#define _ASM_POWERPC_ISERIES_HV_TYPES_H
21 21
22/* 22/*
23 * General typedefs for the hypervisor. 23 * General typedefs for the hypervisor.
@@ -110,4 +110,4 @@ struct HvLpBufferList {
110 u64 len; 110 u64 len;
111}; 111};
112 112
113#endif /* _HVTYPES_H */ 113#endif /* _ASM_POWERPC_ISERIES_HV_TYPES_H */
diff --git a/include/asm-ppc64/iSeries/iSeries_io.h b/include/asm-powerpc/iseries/iseries_io.h
index 9f79413342b3..56b2113ff0f5 100644
--- a/include/asm-ppc64/iSeries/iSeries_io.h
+++ b/include/asm-powerpc/iseries/iseries_io.h
@@ -1,5 +1,5 @@
1#ifndef _ISERIES_IO_H 1#ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H
2#define _ISERIES_IO_H 2#define _ASM_POWERPC_ISERIES_ISERIES_IO_H
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
@@ -46,4 +46,4 @@ extern void iSeries_memcpy_fromio(void *dest,
46 const volatile void __iomem *source, size_t n); 46 const volatile void __iomem *source, size_t n);
47 47
48#endif /* CONFIG_PPC_ISERIES */ 48#endif /* CONFIG_PPC_ISERIES */
49#endif /* _ISERIES_IO_H */ 49#endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
diff --git a/include/asm-ppc64/iSeries/ItExtVpdPanel.h b/include/asm-powerpc/iseries/it_exp_vpd_panel.h
index 4c546a8802b4..66a17a230c52 100644
--- a/include/asm-ppc64/iSeries/ItExtVpdPanel.h
+++ b/include/asm-powerpc/iseries/it_exp_vpd_panel.h
@@ -16,8 +16,8 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#ifndef _ITEXTVPDPANEL_H 19#ifndef _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H
20#define _ITEXTVPDPANEL_H 20#define _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H
21 21
22/* 22/*
23 * This struct maps the panel information 23 * This struct maps the panel information
@@ -49,4 +49,4 @@ struct ItExtVpdPanel {
49 49
50extern struct ItExtVpdPanel xItExtVpdPanel; 50extern struct ItExtVpdPanel xItExtVpdPanel;
51 51
52#endif /* _ITEXTVPDPANEL_H */ 52#endif /* _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H */
diff --git a/include/asm-ppc64/iSeries/ItLpNaca.h b/include/asm-powerpc/iseries/it_lp_naca.h
index 225d0176779d..c3ef1de45d82 100644
--- a/include/asm-ppc64/iSeries/ItLpNaca.h
+++ b/include/asm-powerpc/iseries/it_lp_naca.h
@@ -16,8 +16,8 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#ifndef _ITLPNACA_H 19#ifndef _ASM_POWERPC_ISERIES_IT_LP_NACA_H
20#define _ITLPNACA_H 20#define _ASM_POWERPC_ISERIES_IT_LP_NACA_H
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23 23
@@ -77,4 +77,4 @@ struct ItLpNaca {
77 77
78extern struct ItLpNaca itLpNaca; 78extern struct ItLpNaca itLpNaca;
79 79
80#endif /* _ITLPNACA_H */ 80#endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */
diff --git a/include/asm-ppc64/iSeries/ItLpQueue.h b/include/asm-powerpc/iseries/it_lp_queue.h
index 69b26ad74135..a60d03afbf95 100644
--- a/include/asm-ppc64/iSeries/ItLpQueue.h
+++ b/include/asm-powerpc/iseries/it_lp_queue.h
@@ -16,8 +16,8 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#ifndef _ITLPQUEUE_H 19#ifndef _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H
20#define _ITLPQUEUE_H 20#define _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H
21 21
22/* 22/*
23 * This control block defines the simple LP queue structure that is 23 * This control block defines the simple LP queue structure that is
@@ -78,4 +78,4 @@ extern int hvlpevent_is_pending(void);
78extern void process_hvlpevents(struct pt_regs *); 78extern void process_hvlpevents(struct pt_regs *);
79extern void setup_hvlpevent_queue(void); 79extern void setup_hvlpevent_queue(void);
80 80
81#endif /* _ITLPQUEUE_H */ 81#endif /* _ASM_POWERPC_ISERIES_IT_LP_QUEUE_H */
diff --git a/include/asm-ppc64/iSeries/ItLpRegSave.h b/include/asm-powerpc/iseries/it_lp_reg_save.h
index 1b3087e76205..288044b702de 100644
--- a/include/asm-ppc64/iSeries/ItLpRegSave.h
+++ b/include/asm-powerpc/iseries/it_lp_reg_save.h
@@ -16,8 +16,8 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#ifndef _ITLPREGSAVE_H 19#ifndef _ASM_POWERPC_ISERIES_IT_LP_REG_SAVE_H
20#define _ITLPREGSAVE_H 20#define _ASM_POWERPC_ISERIES_IT_LP_REG_SAVE_H
21 21
22/* 22/*
23 * This control block contains the data that is shared between PLIC 23 * This control block contains the data that is shared between PLIC
diff --git a/include/asm-ppc64/iSeries/LparMap.h b/include/asm-powerpc/iseries/lpar_map.h
index a6840b186d03..84fc321615bf 100644
--- a/include/asm-ppc64/iSeries/LparMap.h
+++ b/include/asm-powerpc/iseries/lpar_map.h
@@ -16,8 +16,8 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#ifndef _LPARMAP_H 19#ifndef _ASM_POWERPC_ISERIES_LPAR_MAP_H
20#define _LPARMAP_H 20#define _ASM_POWERPC_ISERIES_LPAR_MAP_H
21 21
22#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
23 23
@@ -80,4 +80,4 @@ extern const struct LparMap xLparMap;
80/* the fixed address where the LparMap exists */ 80/* the fixed address where the LparMap exists */
81#define LPARMAP_PHYS 0x7000 81#define LPARMAP_PHYS 0x7000
82 82
83#endif /* _LPARMAP_H */ 83#endif /* _ASM_POWERPC_ISERIES_LPAR_MAP_H */
diff --git a/include/asm-ppc64/iSeries/mf.h b/include/asm-powerpc/iseries/mf.h
index 7e6a0d936999..e7bd57a03fb1 100644
--- a/include/asm-ppc64/iSeries/mf.h
+++ b/include/asm-powerpc/iseries/mf.h
@@ -23,13 +23,13 @@
23 * along with this program; if not, write to the Free Software 23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */ 25 */
26#ifndef _ASM_PPC64_ISERIES_MF_H 26#ifndef _ASM_POWERPC_ISERIES_MF_H
27#define _ASM_PPC64_ISERIES_MF_H 27#define _ASM_POWERPC_ISERIES_MF_H
28 28
29#include <linux/types.h> 29#include <linux/types.h>
30 30
31#include <asm/iSeries/HvTypes.h> 31#include <asm/iseries/hv_types.h>
32#include <asm/iSeries/HvCallEvent.h> 32#include <asm/iseries/hv_call_event.h>
33 33
34struct rtc_time; 34struct rtc_time;
35 35
@@ -54,4 +54,4 @@ extern int mf_get_rtc(struct rtc_time *tm);
54extern int mf_get_boot_rtc(struct rtc_time *tm); 54extern int mf_get_boot_rtc(struct rtc_time *tm);
55extern int mf_set_rtc(struct rtc_time *tm); 55extern int mf_set_rtc(struct rtc_time *tm);
56 56
57#endif /* _ASM_PPC64_ISERIES_MF_H */ 57#endif /* _ASM_POWERPC_ISERIES_MF_H */
diff --git a/include/asm-ppc64/iSeries/vio.h b/include/asm-powerpc/iseries/vio.h
index 6c05e6257f53..7e3a469420dd 100644
--- a/include/asm-ppc64/iSeries/vio.h
+++ b/include/asm-powerpc/iseries/vio.h
@@ -38,11 +38,11 @@
38 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 38 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 * 39 *
40 */ 40 */
41#ifndef _ISERIES_VIO_H 41#ifndef _ASM_POWERPC_ISERIES_VIO_H
42#define _ISERIES_VIO_H 42#define _ASM_POWERPC_ISERIES_VIO_H
43 43
44#include <asm/iSeries/HvTypes.h> 44#include <asm/iseries/hv_types.h>
45#include <asm/iSeries/HvLpEvent.h> 45#include <asm/iseries/hv_lp_event.h>
46 46
47/* 47/*
48 * iSeries virtual I/O events use the subtype field in 48 * iSeries virtual I/O events use the subtype field in
@@ -127,4 +127,4 @@ struct device;
127 127
128extern struct device *iSeries_vio_dev; 128extern struct device *iSeries_vio_dev;
129 129
130#endif /* _ISERIES_VIO_H */ 130#endif /* _ASM_POWERPC_ISERIES_VIO_H */
diff --git a/include/asm-powerpc/kexec.h b/include/asm-powerpc/kexec.h
new file mode 100644
index 000000000000..062ab9ba68eb
--- /dev/null
+++ b/include/asm-powerpc/kexec.h
@@ -0,0 +1,49 @@
1#ifndef _ASM_POWERPC_KEXEC_H
2#define _ASM_POWERPC_KEXEC_H
3
4/*
5 * Maximum page that is mapped directly into kernel memory.
6 * XXX: Since we copy virt we can use any page we allocate
7 */
8#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
9
10/*
11 * Maximum address we can reach in physical address mode.
12 * XXX: I want to allow initrd in highmem. Otherwise set to rmo on LPAR.
13 */
14#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
15
16/* Maximum address we can use for the control code buffer */
17#ifdef __powerpc64__
18#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
19#else
20/* TASK_SIZE, probably left over from use_mm ?? */
21#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
22#endif
23
24#define KEXEC_CONTROL_CODE_SIZE 4096
25
26/* The native architecture */
27#ifdef __powerpc64__
28#define KEXEC_ARCH KEXEC_ARCH_PPC64
29#else
30#define KEXEC_ARCH KEXEC_ARCH_PPC
31#endif
32
33#ifndef __ASSEMBLY__
34
35#define MAX_NOTE_BYTES 1024
36typedef u32 note_buf_t[MAX_NOTE_BYTES / sizeof(u32)];
37
38extern note_buf_t crash_notes[];
39
40#ifdef __powerpc64__
41extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
42 master to copy new code to 0 */
43#else
44struct kimage;
45extern void machine_kexec_simple(struct kimage *image);
46#endif
47
48#endif /* ! __ASSEMBLY__ */
49#endif /* _ASM_POWERPC_KEXEC_H */
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h
index b2f09f17fbe0..6cd0a3bfa280 100644
--- a/include/asm-powerpc/kprobes.h
+++ b/include/asm-powerpc/kprobes.h
@@ -27,6 +27,7 @@
27 */ 27 */
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/ptrace.h> 29#include <linux/ptrace.h>
30#include <linux/percpu.h>
30 31
31struct pt_regs; 32struct pt_regs;
32 33
@@ -53,6 +54,20 @@ struct arch_specific_insn {
53 kprobe_opcode_t *insn; 54 kprobe_opcode_t *insn;
54}; 55};
55 56
57struct prev_kprobe {
58 struct kprobe *kp;
59 unsigned long status;
60 unsigned long saved_msr;
61};
62
63/* per-cpu kprobe control block */
64struct kprobe_ctlblk {
65 unsigned long kprobe_status;
66 unsigned long kprobe_saved_msr;
67 struct pt_regs jprobe_saved_regs;
68 struct prev_kprobe prev_kprobe;
69};
70
56#ifdef CONFIG_KPROBES 71#ifdef CONFIG_KPROBES
57extern int kprobe_exceptions_notify(struct notifier_block *self, 72extern int kprobe_exceptions_notify(struct notifier_block *self,
58 unsigned long val, void *data); 73 unsigned long val, void *data);
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h
index 451b345cfc78..fa03864d06eb 100644
--- a/include/asm-powerpc/machdep.h
+++ b/include/asm-powerpc/machdep.h
@@ -47,20 +47,22 @@ struct machdep_calls {
47#ifdef CONFIG_PPC64 47#ifdef CONFIG_PPC64
48 void (*hpte_invalidate)(unsigned long slot, 48 void (*hpte_invalidate)(unsigned long slot,
49 unsigned long va, 49 unsigned long va,
50 int large, 50 int psize,
51 int local); 51 int local);
52 long (*hpte_updatepp)(unsigned long slot, 52 long (*hpte_updatepp)(unsigned long slot,
53 unsigned long newpp, 53 unsigned long newpp,
54 unsigned long va, 54 unsigned long va,
55 int large, 55 int pize,
56 int local); 56 int local);
57 void (*hpte_updateboltedpp)(unsigned long newpp, 57 void (*hpte_updateboltedpp)(unsigned long newpp,
58 unsigned long ea); 58 unsigned long ea,
59 int psize);
59 long (*hpte_insert)(unsigned long hpte_group, 60 long (*hpte_insert)(unsigned long hpte_group,
60 unsigned long va, 61 unsigned long va,
61 unsigned long prpn, 62 unsigned long prpn,
63 unsigned long rflags,
62 unsigned long vflags, 64 unsigned long vflags,
63 unsigned long rflags); 65 int psize);
64 long (*hpte_remove)(unsigned long hpte_group); 66 long (*hpte_remove)(unsigned long hpte_group);
65 void (*flush_hash_range)(unsigned long number, int local); 67 void (*flush_hash_range)(unsigned long number, int local);
66 68
@@ -80,6 +82,7 @@ struct machdep_calls {
80 void (*iommu_dev_setup)(struct pci_dev *dev); 82 void (*iommu_dev_setup)(struct pci_dev *dev);
81 void (*iommu_bus_setup)(struct pci_bus *bus); 83 void (*iommu_bus_setup)(struct pci_bus *bus);
82 void (*irq_bus_setup)(struct pci_bus *bus); 84 void (*irq_bus_setup)(struct pci_bus *bus);
85 int (*set_dabr)(unsigned long dabr);
83#endif 86#endif
84 87
85 int (*probe)(int platform); 88 int (*probe)(int platform);
diff --git a/include/asm-powerpc/numnodes.h b/include/asm-powerpc/numnodes.h
new file mode 100644
index 000000000000..795533aca095
--- /dev/null
+++ b/include/asm-powerpc/numnodes.h
@@ -0,0 +1,7 @@
1#ifndef _ASM_POWERPC_MAX_NUMNODES_H
2#define _ASM_POWERPC_MAX_NUMNODES_H
3
4/* Max 16 Nodes */
5#define NODES_SHIFT 4
6
7#endif /* _ASM_POWERPC_MAX_NUMNODES_H */
diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h
index f99f2af82ca5..c534ca41224b 100644
--- a/include/asm-powerpc/ppc_asm.h
+++ b/include/asm-powerpc/ppc_asm.h
@@ -506,6 +506,13 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601)
506#else 506#else
507 #define __ASM_CONST(x) x##UL 507 #define __ASM_CONST(x) x##UL
508 #define ASM_CONST(x) __ASM_CONST(x) 508 #define ASM_CONST(x) __ASM_CONST(x)
509
510#ifdef CONFIG_PPC64
511#define DATAL ".llong"
512#else
513#define DATAL ".long"
514#endif
515
509#endif /* __ASSEMBLY__ */ 516#endif /* __ASSEMBLY__ */
510 517
511#endif /* _ASM_POWERPC_PPC_ASM_H */ 518#endif /* _ASM_POWERPC_PPC_ASM_H */
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index eee954a001fd..1dc4bf7b52b3 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -70,7 +70,7 @@ extern unsigned char ucBoardRevMaj, ucBoardRevMin;
70#define PLATFORM_LPAR 0x0001 70#define PLATFORM_LPAR 0x0001
71#define PLATFORM_POWERMAC 0x0400 71#define PLATFORM_POWERMAC 0x0400
72#define PLATFORM_MAPLE 0x0500 72#define PLATFORM_MAPLE 0x0500
73#define PLATFORM_BPA 0x1000 73#define PLATFORM_CELL 0x1000
74 74
75/* Compatibility with drivers coming from PPC32 world */ 75/* Compatibility with drivers coming from PPC32 world */
76#define _machine (systemcfg->platform) 76#define _machine (systemcfg->platform)
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 3a0104fa0462..7587bf5f38c6 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -178,6 +178,14 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
178extern struct device_node *of_node_get(struct device_node *node); 178extern struct device_node *of_node_get(struct device_node *node);
179extern void of_node_put(struct device_node *node); 179extern void of_node_put(struct device_node *node);
180 180
181/* For scanning the flat device-tree at boot time */
182int __init of_scan_flat_dt(int (*it)(unsigned long node,
183 const char *uname, int depth,
184 void *data),
185 void *data);
186void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
187 unsigned long *size);
188
181/* For updating the device tree at runtime */ 189/* For updating the device tree at runtime */
182extern void of_attach_node(struct device_node *); 190extern void of_attach_node(struct device_node *);
183extern void of_detach_node(const struct device_node *); 191extern void of_detach_node(const struct device_node *);
diff --git a/include/asm-ppc64/ptrace.h b/include/asm-powerpc/ptrace.h
index 3a55377f1fd3..1f7ecdb0b6ce 100644
--- a/include/asm-ppc64/ptrace.h
+++ b/include/asm-powerpc/ptrace.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_PTRACE_H 1#ifndef _ASM_POWERPC_PTRACE_H
2#define _PPC64_PTRACE_H 2#define _ASM_POWERPC_PTRACE_H
3 3
4/* 4/*
5 * Copyright (C) 2001 PPC64 Team, IBM Corp 5 * Copyright (C) 2001 PPC64 Team, IBM Corp
@@ -16,7 +16,7 @@
16 * that the overall structure is a multiple of 16 bytes in length. 16 * that the overall structure is a multiple of 16 bytes in length.
17 * 17 *
18 * Note that the offsets of the fields in this struct correspond with 18 * Note that the offsets of the fields in this struct correspond with
19 * the PT_* values below. This simplifies arch/ppc64/kernel/ptrace.c. 19 * the PT_* values below. This simplifies arch/powerpc/kernel/ptrace.c.
20 * 20 *
21 * This program is free software; you can redistribute it and/or 21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License 22 * modify it under the terms of the GNU General Public License
@@ -30,70 +30,96 @@ struct pt_regs {
30 unsigned long gpr[32]; 30 unsigned long gpr[32];
31 unsigned long nip; 31 unsigned long nip;
32 unsigned long msr; 32 unsigned long msr;
33 unsigned long orig_gpr3; /* Used for restarting system calls */ 33 unsigned long orig_gpr3; /* Used for restarting system calls */
34 unsigned long ctr; 34 unsigned long ctr;
35 unsigned long link; 35 unsigned long link;
36 unsigned long xer; 36 unsigned long xer;
37 unsigned long ccr; 37 unsigned long ccr;
38 unsigned long softe; /* Soft enabled/disabled */ 38#ifdef __powerpc64__
39 unsigned long trap; /* Reason for being here */ 39 unsigned long softe; /* Soft enabled/disabled */
40 unsigned long dar; /* Fault registers */ 40#else
41 unsigned long dsisr; 41 unsigned long mq; /* 601 only (not used at present) */
42 unsigned long result; /* Result of a system call */ 42 /* Used on APUS to hold IPL value. */
43#endif
44 unsigned long trap; /* Reason for being here */
45 /* N.B. for critical exceptions on 4xx, the dar and dsisr
46 fields are overloaded to hold srr0 and srr1. */
47 unsigned long dar; /* Fault registers */
48 unsigned long dsisr; /* on 4xx/Book-E used for ESR */
49 unsigned long result; /* Result of a system call */
43}; 50};
44 51
45struct pt_regs32 { 52#endif /* __ASSEMBLY__ */
46 unsigned int gpr[32];
47 unsigned int nip;
48 unsigned int msr;
49 unsigned int orig_gpr3; /* Used for restarting system calls */
50 unsigned int ctr;
51 unsigned int link;
52 unsigned int xer;
53 unsigned int ccr;
54 unsigned int mq; /* 601 only (not used at present) */
55 unsigned int trap; /* Reason for being here */
56 unsigned int dar; /* Fault registers */
57 unsigned int dsisr;
58 unsigned int result; /* Result of a system call */
59};
60 53
61#ifdef __KERNEL__ 54#ifdef __KERNEL__
62 55
63#define instruction_pointer(regs) ((regs)->nip) 56#ifdef __powerpc64__
57
58#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */
59
60/* Size of dummy stack frame allocated when calling signal handler. */
61#define __SIGNAL_FRAMESIZE 128
62#define __SIGNAL_FRAMESIZE32 64
63
64#else /* __powerpc64__ */
65
66#define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */
67
68/* Size of stack frame allocated when calling signal handler. */
69#define __SIGNAL_FRAMESIZE 64
70
71#endif /* __powerpc64__ */
64 72
73#ifndef __ASSEMBLY__
74
75#define instruction_pointer(regs) ((regs)->nip)
65#ifdef CONFIG_SMP 76#ifdef CONFIG_SMP
66extern unsigned long profile_pc(struct pt_regs *regs); 77extern unsigned long profile_pc(struct pt_regs *regs);
67#else 78#else
68#define profile_pc(regs) instruction_pointer(regs) 79#define profile_pc(regs) instruction_pointer(regs)
69#endif 80#endif
70 81
82#ifdef __powerpc64__
71#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1) 83#define user_mode(regs) ((((regs)->msr) >> MSR_PR_LG) & 0x1)
84#else
85#define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
86#endif
72 87
73#define force_successful_syscall_return() \ 88#define force_successful_syscall_return() \
74 (current_thread_info()->syscall_noerror = 1) 89 do { \
90 current_thread_info()->syscall_noerror = 1; \
91 } while(0)
75 92
76/* 93/*
77 * We use the least-significant bit of the trap field to indicate 94 * We use the least-significant bit of the trap field to indicate
78 * whether we have saved the full set of registers, or only a 95 * whether we have saved the full set of registers, or only a
79 * partial set. A 1 there means the partial set. 96 * partial set. A 1 there means the partial set.
97 * On 4xx we use the next bit to indicate whether the exception
98 * is a critical exception (1 means it is).
80 */ 99 */
81#define FULL_REGS(regs) (((regs)->trap & 1) == 0) 100#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
101#ifndef __powerpc64__
102#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) == 0)
103#endif /* ! __powerpc64__ */
82#define TRAP(regs) ((regs)->trap & ~0xF) 104#define TRAP(regs) ((regs)->trap & ~0xF)
105#ifdef __powerpc64__
83#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1) 106#define CHECK_FULL_REGS(regs) BUG_ON(regs->trap & 1)
84 107#else
85#endif /* __KERNEL__ */ 108#define CHECK_FULL_REGS(regs) \
109do { \
110 if ((regs)->trap & 1) \
111 printk(KERN_CRIT "%s: partial register set\n", __FUNCTION__); \
112} while (0)
113#endif /* __powerpc64__ */
86 114
87#endif /* __ASSEMBLY__ */ 115#endif /* __ASSEMBLY__ */
88 116
89#define STACK_FRAME_OVERHEAD 112 /* size of minimum stack frame */ 117#endif /* __KERNEL__ */
90
91/* Size of dummy stack frame allocated when calling signal handler. */
92#define __SIGNAL_FRAMESIZE 128
93#define __SIGNAL_FRAMESIZE32 64
94 118
95/* 119/*
96 * Offsets used by 'ptrace' system call interface. 120 * Offsets used by 'ptrace' system call interface.
121 * These can't be changed without breaking binary compatibility
122 * with MkLinux, etc.
97 */ 123 */
98#define PT_R0 0 124#define PT_R0 0
99#define PT_R1 1 125#define PT_R1 1
@@ -137,18 +163,25 @@ extern unsigned long profile_pc(struct pt_regs *regs);
137#define PT_LNK 36 163#define PT_LNK 36
138#define PT_XER 37 164#define PT_XER 37
139#define PT_CCR 38 165#define PT_CCR 38
166#ifndef __powerpc64__
167#define PT_MQ 39
168#else
140#define PT_SOFTE 39 169#define PT_SOFTE 39
141#define PT_TRAP 40 170#define PT_TRAP 40
142#define PT_DAR 41 171#define PT_DAR 41
143#define PT_DSISR 42 172#define PT_DSISR 42
144#define PT_RESULT 43 173#define PT_RESULT 43
174#endif
145 175
146#define PT_FPR0 48 176#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
177
178#ifndef __powerpc64__
179
180#define PT_FPR31 (PT_FPR0 + 2*31)
181#define PT_FPSCR (PT_FPR0 + 2*32 + 1)
182
183#else /* __powerpc64__ */
147 184
148/*
149 * Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will
150 * have visibility to the asm-ppc/ptrace.h header instead of this one.
151 */
152#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ 185#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */
153 186
154#ifdef __KERNEL__ 187#ifdef __KERNEL__
@@ -165,29 +198,29 @@ extern unsigned long profile_pc(struct pt_regs *regs);
165#define PT_VRSAVE_32 (PT_VR0 + 33*4) 198#define PT_VRSAVE_32 (PT_VR0 + 33*4)
166#endif 199#endif
167 200
201#endif /* __powerpc64__ */
202
168/* 203/*
169 * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go. 204 * Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go.
170 * The transfer totals 34 quadword. Quadwords 0-31 contain the 205 * The transfer totals 34 quadword. Quadwords 0-31 contain the
171 * corresponding vector registers. Quadword 32 contains the vscr as the 206 * corresponding vector registers. Quadword 32 contains the vscr as the
172 * last word (offset 12) within that quadword. Quadword 33 contains the 207 * last word (offset 12) within that quadword. Quadword 33 contains the
173 * vrsave as the first word (offset 0) within the quadword. 208 * vrsave as the first word (offset 0) within the quadword.
174 * 209 *
175 * This definition of the VMX state is compatible with the current PPC32 210 * This definition of the VMX state is compatible with the current PPC32
176 * ptrace interface. This allows signal handling and ptrace to use the same 211 * ptrace interface. This allows signal handling and ptrace to use the same
177 * structures. This also simplifies the implementation of a bi-arch 212 * structures. This also simplifies the implementation of a bi-arch
178 * (combined (32- and 64-bit) gdb. 213 * (combined (32- and 64-bit) gdb.
179 */ 214 */
180#define PTRACE_GETVRREGS 18 215#define PTRACE_GETVRREGS 18
181#define PTRACE_SETVRREGS 19 216#define PTRACE_SETVRREGS 19
182 217
183/* 218#ifndef __powerpc64__
184 * While we dont have 64bit book E processors, we need to reserve the 219/* Get/set all the upper 32-bits of the SPE registers, accumulator, and
185 * relevant ptrace calls for 32bit compatibility. 220 * spefscr, in one go */
186 */ 221#define PTRACE_GETEVRREGS 20
187#if 0 222#define PTRACE_SETEVRREGS 21
188#define PTRACE_GETEVRREGS 20 223#endif /* __powerpc64__ */
189#define PTRACE_SETEVRREGS 21
190#endif
191 224
192/* 225/*
193 * Get or set a debug register. The first 16 are DABR registers and the 226 * Get or set a debug register. The first 16 are DABR registers and the
@@ -196,6 +229,7 @@ extern unsigned long profile_pc(struct pt_regs *regs);
196#define PTRACE_GET_DEBUGREG 25 229#define PTRACE_GET_DEBUGREG 25
197#define PTRACE_SET_DEBUGREG 26 230#define PTRACE_SET_DEBUGREG 26
198 231
232#ifdef __powerpc64__
199/* Additional PTRACE requests implemented on PowerPC. */ 233/* Additional PTRACE requests implemented on PowerPC. */
200#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */ 234#define PPC_PTRACE_GETREGS 0x99 /* Get GPRs 0 - 31 */
201#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */ 235#define PPC_PTRACE_SETREGS 0x98 /* Set GPRs 0 - 31 */
@@ -209,5 +243,6 @@ extern unsigned long profile_pc(struct pt_regs *regs);
209#define PPC_PTRACE_POKEDATA_3264 0x92 243#define PPC_PTRACE_POKEDATA_3264 0x92
210#define PPC_PTRACE_PEEKUSR_3264 0x91 244#define PPC_PTRACE_PEEKUSR_3264 0x91
211#define PPC_PTRACE_POKEUSR_3264 0x90 245#define PPC_PTRACE_POKEUSR_3264 0x90
246#endif /* __powerpc64__ */
212 247
213#endif /* _PPC64_PTRACE_H */ 248#endif /* _ASM_POWERPC_PTRACE_H */
diff --git a/include/asm-powerpc/rtas.h b/include/asm-powerpc/rtas.h
index 2c050332471d..d1bb611ea626 100644
--- a/include/asm-powerpc/rtas.h
+++ b/include/asm-powerpc/rtas.h
@@ -149,28 +149,11 @@ struct rtas_error_log {
149 unsigned char buffer[1]; 149 unsigned char buffer[1];
150}; 150};
151 151
152struct flash_block { 152/*
153 char *data; 153 * This can be set by the rtas_flash module so that it can get called
154 unsigned long length; 154 * as the absolutely last thing before the kernel terminates.
155};
156
157/* This struct is very similar but not identical to
158 * that needed by the rtas flash update.
159 * All we need to do for rtas is rewrite num_blocks
160 * into a version/length and translate the pointers
161 * to absolute.
162 */ 155 */
163#define FLASH_BLOCKS_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct flash_block)) 156extern void (*rtas_flash_term_hook)(int);
164struct flash_block_list {
165 unsigned long num_blocks;
166 struct flash_block_list *next;
167 struct flash_block blocks[FLASH_BLOCKS_PER_NODE];
168};
169struct flash_block_list_header { /* just the header of flash_block_list */
170 unsigned long num_blocks;
171 struct flash_block_list *next;
172};
173extern struct flash_block_list_header rtas_firmware_flash_list;
174 157
175extern struct rtas_t rtas; 158extern struct rtas_t rtas;
176 159
diff --git a/include/asm-ppc64/sigcontext.h b/include/asm-powerpc/sigcontext.h
index 6f8aee768c5e..165d630e1cf3 100644
--- a/include/asm-ppc64/sigcontext.h
+++ b/include/asm-powerpc/sigcontext.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_PPC64_SIGCONTEXT_H 1#ifndef _ASM_POWERPC_SIGCONTEXT_H
2#define _ASM_PPC64_SIGCONTEXT_H 2#define _ASM_POWERPC_SIGCONTEXT_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -9,39 +9,44 @@
9 */ 9 */
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <asm/ptrace.h> 11#include <asm/ptrace.h>
12#ifdef __powerpc64__
12#include <asm/elf.h> 13#include <asm/elf.h>
13 14#endif
14 15
15struct sigcontext { 16struct sigcontext {
16 unsigned long _unused[4]; 17 unsigned long _unused[4];
17 int signal; 18 int signal;
19#ifdef __powerpc64__
18 int _pad0; 20 int _pad0;
21#endif
19 unsigned long handler; 22 unsigned long handler;
20 unsigned long oldmask; 23 unsigned long oldmask;
21 struct pt_regs __user *regs; 24 struct pt_regs __user *regs;
25#ifdef __powerpc64__
22 elf_gregset_t gp_regs; 26 elf_gregset_t gp_regs;
23 elf_fpregset_t fp_regs; 27 elf_fpregset_t fp_regs;
24/* 28/*
25 * To maintain compatibility with current implementations the sigcontext is 29 * To maintain compatibility with current implementations the sigcontext is
26 * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t) 30 * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t)
27 * followed by an unstructured (vmx_reserve) field of 69 doublewords. This 31 * followed by an unstructured (vmx_reserve) field of 69 doublewords. This
28 * allows the array of vector registers to be quadword aligned independent of 32 * allows the array of vector registers to be quadword aligned independent of
29 * the alignment of the containing sigcontext or ucontext. It is the 33 * the alignment of the containing sigcontext or ucontext. It is the
30 * responsibility of the code setting the sigcontext to set this pointer to 34 * responsibility of the code setting the sigcontext to set this pointer to
31 * either NULL (if this processor does not support the VMX feature) or the 35 * either NULL (if this processor does not support the VMX feature) or the
32 * address of the first quadword within the allocated (vmx_reserve) area. 36 * address of the first quadword within the allocated (vmx_reserve) area.
33 * 37 *
34 * The pointer (v_regs) of vector type (elf_vrreg_t) is type compatible with 38 * The pointer (v_regs) of vector type (elf_vrreg_t) is type compatible with
35 * an array of 34 quadword entries (elf_vrregset_t). The entries with 39 * an array of 34 quadword entries (elf_vrregset_t). The entries with
36 * indexes 0-31 contain the corresponding vector registers. The entry with 40 * indexes 0-31 contain the corresponding vector registers. The entry with
37 * index 32 contains the vscr as the last word (offset 12) within the 41 * index 32 contains the vscr as the last word (offset 12) within the
38 * quadword. This allows the vscr to be stored as either a quadword (since 42 * quadword. This allows the vscr to be stored as either a quadword (since
39 * it must be copied via a vector register to/from storage) or as a word. 43 * it must be copied via a vector register to/from storage) or as a word.
40 * The entry with index 33 contains the vrsave as the first word (offset 0) 44 * The entry with index 33 contains the vrsave as the first word (offset 0)
41 * within the quadword. 45 * within the quadword.
42 */ 46 */
43 elf_vrreg_t __user *v_regs; 47 elf_vrreg_t __user *v_regs;
44 long vmx_reserve[ELF_NVRREG+ELF_NVRREG+1]; 48 long vmx_reserve[ELF_NVRREG+ELF_NVRREG+1];
49#endif
45}; 50};
46 51
47#endif /* _ASM_PPC64_SIGCONTEXT_H */ 52#endif /* _ASM_POWERPC_SIGCONTEXT_H */
diff --git a/include/asm-ppc64/smp.h b/include/asm-powerpc/smp.h
index c5e9052e7967..8bcdd0faefea 100644
--- a/include/asm-ppc64/smp.h
+++ b/include/asm-powerpc/smp.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * smp.h: PPC64 specific SMP code. 2 * smp.h: PowerPC-specific SMP code.
3 * 3 *
4 * Original was a copy of sparc smp.h. Now heavily modified 4 * Original was a copy of sparc smp.h. Now heavily modified
5 * for PPC. 5 * for PPC.
@@ -13,9 +13,9 @@
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15 15
16#ifndef _ASM_POWERPC_SMP_H
17#define _ASM_POWERPC_SMP_H
16#ifdef __KERNEL__ 18#ifdef __KERNEL__
17#ifndef _PPC64_SMP_H
18#define _PPC64_SMP_H
19 19
20#include <linux/config.h> 20#include <linux/config.h>
21#include <linux/threads.h> 21#include <linux/threads.h>
@@ -24,7 +24,9 @@
24 24
25#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
26 26
27#ifdef CONFIG_PPC64
27#include <asm/paca.h> 28#include <asm/paca.h>
29#endif
28 30
29extern int boot_cpuid; 31extern int boot_cpuid;
30extern int boot_cpuid_phys; 32extern int boot_cpuid_phys;
@@ -45,8 +47,19 @@ void generic_cpu_die(unsigned int cpu);
45void generic_mach_cpu_die(void); 47void generic_mach_cpu_die(void);
46#endif 48#endif
47 49
50#ifdef CONFIG_PPC64
48#define raw_smp_processor_id() (get_paca()->paca_index) 51#define raw_smp_processor_id() (get_paca()->paca_index)
49#define hard_smp_processor_id() (get_paca()->hw_cpu_id) 52#define hard_smp_processor_id() (get_paca()->hw_cpu_id)
53#else
54/* 32-bit */
55extern int smp_hw_index[];
56
57#define raw_smp_processor_id() (current_thread_info()->cpu)
58#define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
59#define get_hard_smp_processor_id(cpu) (smp_hw_index[(cpu)])
60#define set_hard_smp_processor_id(cpu, phys)\
61 (smp_hw_index[(cpu)] = (phys))
62#endif
50 63
51extern cpumask_t cpu_sibling_map[NR_CPUS]; 64extern cpumask_t cpu_sibling_map[NR_CPUS];
52 65
@@ -64,14 +77,30 @@ extern cpumask_t cpu_sibling_map[NR_CPUS];
64 77
65void smp_init_iSeries(void); 78void smp_init_iSeries(void);
66void smp_init_pSeries(void); 79void smp_init_pSeries(void);
80void smp_init_cell(void);
81void smp_setup_cpu_maps(void);
67 82
68extern int __cpu_disable(void); 83extern int __cpu_disable(void);
69extern void __cpu_die(unsigned int cpu); 84extern void __cpu_die(unsigned int cpu);
85
86#else
87/* for UP */
88#define smp_setup_cpu_maps()
89#define smp_release_cpus()
90
70#endif /* CONFIG_SMP */ 91#endif /* CONFIG_SMP */
71 92
93#ifdef CONFIG_PPC64
72#define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id) 94#define get_hard_smp_processor_id(CPU) (paca[(CPU)].hw_cpu_id)
73#define set_hard_smp_processor_id(CPU, VAL) \ 95#define set_hard_smp_processor_id(CPU, VAL) \
74 do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0) 96 do { (paca[(CPU)].hw_cpu_id = (VAL)); } while (0)
97#else
98/* 32-bit */
99#ifndef CONFIG_SMP
100#define get_hard_smp_processor_id(cpu) boot_cpuid_phys
101#define set_hard_smp_processor_id(cpu, phys)
102#endif
103#endif
75 104
76extern int smt_enabled_at_boot; 105extern int smt_enabled_at_boot;
77 106
@@ -84,15 +113,7 @@ extern void smp_generic_take_timebase(void);
84 113
85extern struct smp_ops_t *smp_ops; 114extern struct smp_ops_t *smp_ops;
86 115
87#ifdef CONFIG_PPC_PSERIES
88void vpa_init(int cpu);
89#else
90static inline void vpa_init(int cpu)
91{
92}
93#endif /* CONFIG_PPC_PSERIES */
94
95#endif /* __ASSEMBLY__ */ 116#endif /* __ASSEMBLY__ */
96 117
97#endif /* !(_PPC64_SMP_H) */
98#endif /* __KERNEL__ */ 118#endif /* __KERNEL__ */
119#endif /* _ASM_POWERPC_SMP_H) */
diff --git a/include/asm-ppc64/sparsemem.h b/include/asm-powerpc/sparsemem.h
index c5bd47e57f17..1c95ab99deb3 100644
--- a/include/asm-ppc64/sparsemem.h
+++ b/include/asm-powerpc/sparsemem.h
@@ -1,5 +1,5 @@
1#ifndef _ASM_PPC64_SPARSEMEM_H 1#ifndef _ASM_POWERPC_SPARSEMEM_H
2#define _ASM_PPC64_SPARSEMEM_H 1 2#define _ASM_POWERPC_SPARSEMEM_H 1
3 3
4#ifdef CONFIG_SPARSEMEM 4#ifdef CONFIG_SPARSEMEM
5/* 5/*
@@ -13,4 +13,4 @@
13 13
14#endif /* CONFIG_SPARSEMEM */ 14#endif /* CONFIG_SPARSEMEM */
15 15
16#endif /* _ASM_PPC64_SPARSEMEM_H */ 16#endif /* _ASM_POWERPC_SPARSEMEM_H */
diff --git a/include/asm-powerpc/stat.h b/include/asm-powerpc/stat.h
new file mode 100644
index 000000000000..e4edc510b530
--- /dev/null
+++ b/include/asm-powerpc/stat.h
@@ -0,0 +1,81 @@
1#ifndef _ASM_POWERPC_STAT_H
2#define _ASM_POWERPC_STAT_H
3/*
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/types.h>
10
11#define STAT_HAVE_NSEC 1
12
13#ifndef __powerpc64__
14struct __old_kernel_stat {
15 unsigned short st_dev;
16 unsigned short st_ino;
17 unsigned short st_mode;
18 unsigned short st_nlink;
19 unsigned short st_uid;
20 unsigned short st_gid;
21 unsigned short st_rdev;
22 unsigned long st_size;
23 unsigned long st_atime;
24 unsigned long st_mtime;
25 unsigned long st_ctime;
26};
27#endif /* !__powerpc64__ */
28
29struct stat {
30 unsigned long st_dev;
31 ino_t st_ino;
32#ifdef __powerpc64__
33 nlink_t st_nlink;
34 mode_t st_mode;
35#else
36 mode_t st_mode;
37 nlink_t st_nlink;
38#endif
39 uid_t st_uid;
40 gid_t st_gid;
41 unsigned long st_rdev;
42 off_t st_size;
43 unsigned long st_blksize;
44 unsigned long st_blocks;
45 unsigned long st_atime;
46 unsigned long st_atime_nsec;
47 unsigned long st_mtime;
48 unsigned long st_mtime_nsec;
49 unsigned long st_ctime;
50 unsigned long st_ctime_nsec;
51 unsigned long __unused4;
52 unsigned long __unused5;
53#ifdef __powerpc64__
54 unsigned long __unused6;
55#endif
56};
57
58/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
59struct stat64 {
60 unsigned long long st_dev; /* Device. */
61 unsigned long long st_ino; /* File serial number. */
62 unsigned int st_mode; /* File mode. */
63 unsigned int st_nlink; /* Link count. */
64 unsigned int st_uid; /* User ID of the file's owner. */
65 unsigned int st_gid; /* Group ID of the file's group. */
66 unsigned long long st_rdev; /* Device number, if device. */
67 unsigned short __pad2;
68 long long st_size; /* Size of file, in bytes. */
69 int st_blksize; /* Optimal block size for I/O. */
70 long long st_blocks; /* Number 512-byte blocks allocated. */
71 int st_atime; /* Time of last access. */
72 unsigned int st_atime_nsec;
73 int st_mtime; /* Time of last modification. */
74 unsigned int st_mtime_nsec;
75 int st_ctime; /* Time of last status change. */
76 unsigned int st_ctime_nsec;
77 unsigned int __unused4;
78 unsigned int __unused5;
79};
80
81#endif /* _ASM_POWERPC_STAT_H */
diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h
index 5b2ecbc47907..3536a5cd7a2d 100644
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -289,7 +289,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
289 289
290#ifdef CONFIG_PPC64 290#ifdef CONFIG_PPC64
291static __inline__ unsigned long 291static __inline__ unsigned long
292__cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new) 292__cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
293{ 293{
294 unsigned long prev; 294 unsigned long prev;
295 295
@@ -359,5 +359,53 @@ extern void reloc_got2(unsigned long);
359 359
360#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) 360#define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x)))
361 361
362static inline void create_instruction(unsigned long addr, unsigned int instr)
363{
364 unsigned int *p;
365 p = (unsigned int *)addr;
366 *p = instr;
367 asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (p));
368}
369
370/* Flags for create_branch:
371 * "b" == create_branch(addr, target, 0);
372 * "ba" == create_branch(addr, target, BRANCH_ABSOLUTE);
373 * "bl" == create_branch(addr, target, BRANCH_SET_LINK);
374 * "bla" == create_branch(addr, target, BRANCH_ABSOLUTE | BRANCH_SET_LINK);
375 */
376#define BRANCH_SET_LINK 0x1
377#define BRANCH_ABSOLUTE 0x2
378
379static inline void create_branch(unsigned long addr,
380 unsigned long target, int flags)
381{
382 unsigned int instruction;
383
384 if (! (flags & BRANCH_ABSOLUTE))
385 target = target - addr;
386
387 /* Mask out the flags and target, so they don't step on each other. */
388 instruction = 0x48000000 | (flags & 0x3) | (target & 0x03FFFFFC);
389
390 create_instruction(addr, instruction);
391}
392
393static inline void create_function_call(unsigned long addr, void * func)
394{
395 unsigned long func_addr;
396
397#ifdef CONFIG_PPC64
398 /*
399 * On PPC64 the function pointer actually points to the function's
400 * descriptor. The first entry in the descriptor is the address
401 * of the function text.
402 */
403 func_addr = *(unsigned long *)func;
404#else
405 func_addr = (unsigned long)func;
406#endif
407 create_branch(addr, func_addr, BRANCH_SET_LINK);
408}
409
362#endif /* __KERNEL__ */ 410#endif /* __KERNEL__ */
363#endif /* _ASM_POWERPC_SYSTEM_H */ 411#endif /* _ASM_POWERPC_SYSTEM_H */
diff --git a/include/asm-powerpc/termios.h b/include/asm-powerpc/termios.h
index c5b8e5358f83..7f80a019b6a0 100644
--- a/include/asm-powerpc/termios.h
+++ b/include/asm-powerpc/termios.h
@@ -94,142 +94,9 @@ struct termio {
94#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" 94#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025"
95#endif 95#endif
96 96
97#define FIOCLEX _IO('f', 1)
98#define FIONCLEX _IO('f', 2)
99#define FIOASYNC _IOW('f', 125, int)
100#define FIONBIO _IOW('f', 126, int)
101#define FIONREAD _IOR('f', 127, int)
102#define TIOCINQ FIONREAD
103
104#define TIOCGETP _IOR('t', 8, struct sgttyb)
105#define TIOCSETP _IOW('t', 9, struct sgttyb)
106#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
107
108#define TIOCSETC _IOW('t', 17, struct tchars)
109#define TIOCGETC _IOR('t', 18, struct tchars)
110#define TCGETS _IOR('t', 19, struct termios)
111#define TCSETS _IOW('t', 20, struct termios)
112#define TCSETSW _IOW('t', 21, struct termios)
113#define TCSETSF _IOW('t', 22, struct termios)
114
115#define TCGETA _IOR('t', 23, struct termio)
116#define TCSETA _IOW('t', 24, struct termio)
117#define TCSETAW _IOW('t', 25, struct termio)
118#define TCSETAF _IOW('t', 28, struct termio)
119
120#define TCSBRK _IO('t', 29)
121#define TCXONC _IO('t', 30)
122#define TCFLSH _IO('t', 31)
123
124#define TIOCSWINSZ _IOW('t', 103, struct winsize)
125#define TIOCGWINSZ _IOR('t', 104, struct winsize)
126#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
127#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
128#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
129
130#define TIOCGLTC _IOR('t', 116, struct ltchars)
131#define TIOCSLTC _IOW('t', 117, struct ltchars)
132#define TIOCSPGRP _IOW('t', 118, int)
133#define TIOCGPGRP _IOR('t', 119, int)
134
135#define TIOCEXCL 0x540C
136#define TIOCNXCL 0x540D
137#define TIOCSCTTY 0x540E
138
139#define TIOCSTI 0x5412
140#define TIOCMGET 0x5415
141#define TIOCMBIS 0x5416
142#define TIOCMBIC 0x5417
143#define TIOCMSET 0x5418
144#define TIOCGSOFTCAR 0x5419
145#define TIOCSSOFTCAR 0x541A
146#define TIOCLINUX 0x541C
147#define TIOCCONS 0x541D
148#define TIOCGSERIAL 0x541E
149#define TIOCSSERIAL 0x541F
150#define TIOCPKT 0x5420
151
152#define TIOCNOTTY 0x5422
153#define TIOCSETD 0x5423
154#define TIOCGETD 0x5424
155#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
156
157#define TIOCSERCONFIG 0x5453
158#define TIOCSERGWILD 0x5454
159#define TIOCSERSWILD 0x5455
160#define TIOCGLCKTRMIOS 0x5456
161#define TIOCSLCKTRMIOS 0x5457
162#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
163#define TIOCSERGETLSR 0x5459 /* Get line status register */
164#define TIOCSERGETMULTI 0x545A /* Get multiport config */
165#define TIOCSERSETMULTI 0x545B /* Set multiport config */
166
167#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
168#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
169
170/* Used for packet mode */
171#define TIOCPKT_DATA 0
172#define TIOCPKT_FLUSHREAD 1
173#define TIOCPKT_FLUSHWRITE 2
174#define TIOCPKT_STOP 4
175#define TIOCPKT_START 8
176#define TIOCPKT_NOSTOP 16
177#define TIOCPKT_DOSTOP 32
178
179/* modem lines */
180#define TIOCM_LE 0x001
181#define TIOCM_DTR 0x002
182#define TIOCM_RTS 0x004
183#define TIOCM_ST 0x008
184#define TIOCM_SR 0x010
185#define TIOCM_CTS 0x020
186#define TIOCM_CAR 0x040
187#define TIOCM_RNG 0x080
188#define TIOCM_DSR 0x100
189#define TIOCM_CD TIOCM_CAR
190#define TIOCM_RI TIOCM_RNG
191#define TIOCM_OUT1 0x2000
192#define TIOCM_OUT2 0x4000
193#define TIOCM_LOOP 0x8000
194
195/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
196#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
197
198#ifdef __KERNEL__ 97#ifdef __KERNEL__
199 98
200/* 99#include <asm-generic/termios.h>
201 * Translate a "termio" structure into a "termios". Ugh.
202 */
203#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
204 unsigned short __tmp; \
205 get_user(__tmp,&(termio)->x); \
206 (termios)->x = (0xffff0000 & (termios)->x) | __tmp; \
207}
208
209#define user_termio_to_kernel_termios(termios, termio) \
210({ \
211 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
212 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
213 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
214 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
215 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
216})
217
218/*
219 * Translate a "termios" structure into a "termio". Ugh.
220 */
221#define kernel_termios_to_user_termio(termio, termios) \
222({ \
223 put_user((termios)->c_iflag, &(termio)->c_iflag); \
224 put_user((termios)->c_oflag, &(termio)->c_oflag); \
225 put_user((termios)->c_cflag, &(termio)->c_cflag); \
226 put_user((termios)->c_lflag, &(termio)->c_lflag); \
227 put_user((termios)->c_line, &(termio)->c_line); \
228 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
229})
230
231#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
232#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
233 100
234#endif /* __KERNEL__ */ 101#endif /* __KERNEL__ */
235 102
diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h
index ab17db79f69d..e525f49bd179 100644
--- a/include/asm-powerpc/thread_info.h
+++ b/include/asm-powerpc/thread_info.h
@@ -65,23 +65,27 @@ struct thread_info {
65 65
66/* thread information allocation */ 66/* thread information allocation */
67 67
68#ifdef CONFIG_DEBUG_STACK_USAGE
69#define THREAD_INFO_GFP GFP_KERNEL | __GFP_ZERO
70#else
71#define THREAD_INFO_GFP GFP_KERNEL
72#endif
73
74#if THREAD_SHIFT >= PAGE_SHIFT 68#if THREAD_SHIFT >= PAGE_SHIFT
75 69
76#define THREAD_ORDER (THREAD_SHIFT - PAGE_SHIFT) 70#define THREAD_ORDER (THREAD_SHIFT - PAGE_SHIFT)
77 71
72#ifdef CONFIG_DEBUG_STACK_USAGE
78#define alloc_thread_info(tsk) \ 73#define alloc_thread_info(tsk) \
79 ((struct thread_info *)__get_free_pages(THREAD_INFO_GFP, THREAD_ORDER)) 74 ((struct thread_info *)__get_free_pages(GFP_KERNEL | \
75 __GFP_ZERO, THREAD_ORDER))
76#else
77#define alloc_thread_info(tsk) \
78 ((struct thread_info *)__get_free_pages(GFP_KERNEL, THREAD_ORDER))
79#endif
80#define free_thread_info(ti) free_pages((unsigned long)ti, THREAD_ORDER) 80#define free_thread_info(ti) free_pages((unsigned long)ti, THREAD_ORDER)
81 81
82#else /* THREAD_SHIFT < PAGE_SHIFT */ 82#else /* THREAD_SHIFT < PAGE_SHIFT */
83 83
84#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, THREAD_INFO_GFP) 84#ifdef CONFIG_DEBUG_STACK_USAGE
85#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
86#else
87#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
88#endif
85#define free_thread_info(ti) kfree(ti) 89#define free_thread_info(ti) kfree(ti)
86 90
87#endif /* THREAD_SHIFT < PAGE_SHIFT */ 91#endif /* THREAD_SHIFT < PAGE_SHIFT */
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 410e795f7d43..d9b86a17271b 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -21,7 +21,7 @@
21#include <asm/processor.h> 21#include <asm/processor.h>
22#ifdef CONFIG_PPC64 22#ifdef CONFIG_PPC64
23#include <asm/paca.h> 23#include <asm/paca.h>
24#include <asm/iSeries/HvCall.h> 24#include <asm/iseries/hv_call.h>
25#endif 25#endif
26 26
27/* time.c */ 27/* time.c */
diff --git a/include/asm-ppc/tlb.h b/include/asm-powerpc/tlb.h
index 2c142c5d8584..56659f121779 100644
--- a/include/asm-ppc/tlb.h
+++ b/include/asm-powerpc/tlb.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * TLB shootdown specifics for PPC 2 * TLB shootdown specifics for powerpc
3 * 3 *
4 * Copyright (C) 2002 Anton Blanchard, IBM Corp.
4 * Copyright (C) 2002 Paul Mackerras, IBM Corp. 5 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
5 * 6 *
6 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
@@ -8,29 +9,53 @@
8 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
10 */ 11 */
11#ifndef _PPC_TLB_H 12#ifndef _ASM_POWERPC_TLB_H
12#define _PPC_TLB_H 13#define _ASM_POWERPC_TLB_H
13 14
14#include <linux/config.h> 15#include <linux/config.h>
16#ifndef __powerpc64__
15#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#endif
16#include <asm/pgalloc.h> 19#include <asm/pgalloc.h>
17#include <asm/tlbflush.h> 20#include <asm/tlbflush.h>
21#ifndef __powerpc64__
18#include <asm/page.h> 22#include <asm/page.h>
19#include <asm/mmu.h> 23#include <asm/mmu.h>
20 24#endif
21#ifdef CONFIG_PPC_STD_MMU
22/* Classic PPC with hash-table based MMU... */
23 25
24struct mmu_gather; 26struct mmu_gather;
27
28#define tlb_start_vma(tlb, vma) do { } while (0)
29#define tlb_end_vma(tlb, vma) do { } while (0)
30
31#if !defined(CONFIG_PPC_STD_MMU)
32
33#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
34
35#elif defined(__powerpc64__)
36
37extern void pte_free_finish(void);
38
39static inline void tlb_flush(struct mmu_gather *tlb)
40{
41 flush_tlb_pending();
42 pte_free_finish();
43}
44
45#else
46
25extern void tlb_flush(struct mmu_gather *tlb); 47extern void tlb_flush(struct mmu_gather *tlb);
26 48
49#endif
50
27/* Get the generic bits... */ 51/* Get the generic bits... */
28#include <asm-generic/tlb.h> 52#include <asm-generic/tlb.h>
29 53
30/* Nothing needed here in fact... */ 54#if !defined(CONFIG_PPC_STD_MMU) || defined(__powerpc64__)
31#define tlb_start_vma(tlb, vma) do { } while (0) 55
32#define tlb_end_vma(tlb, vma) do { } while (0) 56#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
33 57
58#else
34extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep, 59extern void flush_hash_entry(struct mm_struct *mm, pte_t *ptep,
35 unsigned long address); 60 unsigned long address);
36 61
@@ -41,17 +66,5 @@ static inline void __tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep,
41 flush_hash_entry(tlb->mm, ptep, address); 66 flush_hash_entry(tlb->mm, ptep, address);
42} 67}
43 68
44#else 69#endif
45/* Embedded PPC with software-loaded TLB, very simple... */ 70#endif /* __ASM_POWERPC_TLB_H */
46
47#define tlb_start_vma(tlb, vma) do { } while (0)
48#define tlb_end_vma(tlb, vma) do { } while (0)
49#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
50#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
51
52/* Get the generic bits... */
53#include <asm-generic/tlb.h>
54
55#endif /* CONFIG_PPC_STD_MMU */
56
57#endif /* __PPC_TLB_H */
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h
new file mode 100644
index 000000000000..a2998eee37bb
--- /dev/null
+++ b/include/asm-powerpc/tlbflush.h
@@ -0,0 +1,147 @@
1#ifndef _ASM_POWERPC_TLBFLUSH_H
2#define _ASM_POWERPC_TLBFLUSH_H
3/*
4 * TLB flushing:
5 *
6 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
7 * - flush_tlb_page(vma, vmaddr) flushes one page
8 * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB
9 * - flush_tlb_range(vma, start, end) flushes a range of pages
10 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
11 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18#ifdef __KERNEL__
19
20#include <linux/config.h>
21
22struct mm_struct;
23
24#ifdef CONFIG_PPC64
25
26#include <linux/percpu.h>
27#include <asm/page.h>
28
29#define PPC64_TLB_BATCH_NR 192
30
31struct ppc64_tlb_batch {
32 unsigned long index;
33 struct mm_struct *mm;
34 real_pte_t pte[PPC64_TLB_BATCH_NR];
35 unsigned long vaddr[PPC64_TLB_BATCH_NR];
36 unsigned int psize;
37};
38DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
39
40extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch);
41
42static inline void flush_tlb_pending(void)
43{
44 struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch);
45
46 if (batch->index)
47 __flush_tlb_pending(batch);
48 put_cpu_var(ppc64_tlb_batch);
49}
50
51extern void flush_hash_page(unsigned long va, real_pte_t pte, int psize,
52 int local);
53extern void flush_hash_range(unsigned long number, int local);
54
55#else /* CONFIG_PPC64 */
56
57#include <linux/mm.h>
58
59extern void _tlbie(unsigned long address);
60extern void _tlbia(void);
61
62/*
63 * TODO: (CONFIG_FSL_BOOKE) determine if flush_tlb_range &
64 * flush_tlb_kernel_range are best implemented as tlbia vs
65 * specific tlbie's
66 */
67
68#if (defined(CONFIG_4xx) && !defined(CONFIG_44x)) || defined(CONFIG_8xx)
69#define flush_tlb_pending() asm volatile ("tlbia; sync" : : : "memory")
70#elif defined(CONFIG_4xx) || defined(CONFIG_FSL_BOOKE)
71#define flush_tlb_pending() _tlbia()
72#endif
73
74/*
75 * This gets called at the end of handling a page fault, when
76 * the kernel has put a new PTE into the page table for the process.
77 * We use it to ensure coherency between the i-cache and d-cache
78 * for the page which has just been mapped in.
79 * On machines which use an MMU hash table, we use this to put a
80 * corresponding HPTE into the hash table ahead of time, instead of
81 * waiting for the inevitable extra hash-table miss exception.
82 */
83extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
84
85#endif /* CONFIG_PPC64 */
86
87#if defined(CONFIG_PPC64) || defined(CONFIG_4xx) || \
88 defined(CONFIG_FSL_BOOKE) || defined(CONFIG_8xx)
89
90static inline void flush_tlb_mm(struct mm_struct *mm)
91{
92 flush_tlb_pending();
93}
94
95static inline void flush_tlb_page(struct vm_area_struct *vma,
96 unsigned long vmaddr)
97{
98#ifdef CONFIG_PPC64
99 flush_tlb_pending();
100#else
101 _tlbie(vmaddr);
102#endif
103}
104
105static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
106 unsigned long vmaddr)
107{
108#ifndef CONFIG_PPC64
109 _tlbie(vmaddr);
110#endif
111}
112
113static inline void flush_tlb_range(struct vm_area_struct *vma,
114 unsigned long start, unsigned long end)
115{
116 flush_tlb_pending();
117}
118
119static inline void flush_tlb_kernel_range(unsigned long start,
120 unsigned long end)
121{
122 flush_tlb_pending();
123}
124
125#else /* 6xx, 7xx, 7xxx cpus */
126
127extern void flush_tlb_mm(struct mm_struct *mm);
128extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
129extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
130extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
131 unsigned long end);
132extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
133
134#endif
135
136/*
137 * This is called in munmap when we have freed up some page-table
138 * pages. We don't need to do anything here, there's nothing special
139 * about our page-table pages. -- paulus
140 */
141static inline void flush_tlb_pgtables(struct mm_struct *mm,
142 unsigned long start, unsigned long end)
143{
144}
145
146#endif /*__KERNEL__ */
147#endif /* _ASM_POWERPC_TLBFLUSH_H */
diff --git a/include/asm-powerpc/uaccess.h b/include/asm-powerpc/uaccess.h
new file mode 100644
index 000000000000..33af730f0d19
--- /dev/null
+++ b/include/asm-powerpc/uaccess.h
@@ -0,0 +1,468 @@
1#ifndef _ARCH_POWERPC_UACCESS_H
2#define _ARCH_POWERPC_UACCESS_H
3
4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__
6
7#include <linux/sched.h>
8#include <linux/errno.h>
9#include <asm/processor.h>
10
11#define VERIFY_READ 0
12#define VERIFY_WRITE 1
13
14/*
15 * The fs value determines whether argument validity checking should be
16 * performed or not. If get_fs() == USER_DS, checking is performed, with
17 * get_fs() == KERNEL_DS, checking is bypassed.
18 *
19 * For historical reasons, these macros are grossly misnamed.
20 *
21 * The fs/ds values are now the highest legal address in the "segment".
22 * This simplifies the checking in the routines below.
23 */
24
25#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
26
27#define KERNEL_DS MAKE_MM_SEG(~0UL)
28#ifdef __powerpc64__
29/* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */
30#define USER_DS MAKE_MM_SEG(TASK_SIZE_USER64 - 1)
31#else
32#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
33#endif
34
35#define get_ds() (KERNEL_DS)
36#define get_fs() (current->thread.fs)
37#define set_fs(val) (current->thread.fs = (val))
38
39#define segment_eq(a, b) ((a).seg == (b).seg)
40
41#ifdef __powerpc64__
42/*
43 * This check is sufficient because there is a large enough
44 * gap between user addresses and the kernel addresses
45 */
46#define __access_ok(addr, size, segment) \
47 (((addr) <= (segment).seg) && ((size) <= (segment).seg))
48
49#else
50
51#define __access_ok(addr, size, segment) \
52 (((addr) <= (segment).seg) && \
53 (((size) == 0) || (((size) - 1) <= ((segment).seg - (addr)))))
54
55#endif
56
57#define access_ok(type, addr, size) \
58 (__chk_user_ptr(addr), \
59 __access_ok((__force unsigned long)(addr), (size), get_fs()))
60
61/*
62 * The exception table consists of pairs of addresses: the first is the
63 * address of an instruction that is allowed to fault, and the second is
64 * the address at which the program should continue. No registers are
65 * modified, so it is entirely up to the continuation code to figure out
66 * what to do.
67 *
68 * All the routines below use bits of fixup code that are out of line
69 * with the main instruction path. This means when everything is well,
70 * we don't even have to jump over them. Further, they do not intrude
71 * on our cache or tlb entries.
72 */
73
74struct exception_table_entry {
75 unsigned long insn;
76 unsigned long fixup;
77};
78
79/*
80 * These are the main single-value transfer routines. They automatically
81 * use the right size if we just have the right pointer type.
82 *
83 * This gets kind of ugly. We want to return _two_ values in "get_user()"
84 * and yet we don't want to do any pointers, because that is too much
85 * of a performance impact. Thus we have a few rather ugly macros here,
86 * and hide all the ugliness from the user.
87 *
88 * The "__xxx" versions of the user access functions are versions that
89 * do not verify the address space, that must have been done previously
90 * with a separate "access_ok()" call (this is used when we do multiple
91 * accesses to the same area of user memory).
92 *
93 * As we use the same address space for kernel and user data on the
94 * PowerPC, we can just do these as direct assignments. (Of course, the
95 * exception handling means that it's no longer "just"...)
96 *
97 * The "user64" versions of the user access functions are versions that
98 * allow access of 64-bit data. The "get_user" functions do not
99 * properly handle 64-bit data because the value gets down cast to a long.
100 * The "put_user" functions already handle 64-bit data properly but we add
101 * "user64" versions for completeness
102 */
103#define get_user(x, ptr) \
104 __get_user_check((x), (ptr), sizeof(*(ptr)))
105#define put_user(x, ptr) \
106 __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
107
108#define __get_user(x, ptr) \
109 __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
110#define __put_user(x, ptr) \
111 __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)))
112#ifndef __powerpc64__
113#define __get_user64(x, ptr) \
114 __get_user64_nocheck((x), (ptr), sizeof(*(ptr)))
115#define __put_user64(x, ptr) __put_user(x, ptr)
116#endif
117
118#define __get_user_unaligned __get_user
119#define __put_user_unaligned __put_user
120
121extern long __put_user_bad(void);
122
123#ifdef __powerpc64__
124#define __EX_TABLE_ALIGN "3"
125#define __EX_TABLE_TYPE "llong"
126#else
127#define __EX_TABLE_ALIGN "2"
128#define __EX_TABLE_TYPE "long"
129#endif
130
131/*
132 * We don't tell gcc that we are accessing memory, but this is OK
133 * because we do not write to any memory gcc knows about, so there
134 * are no aliasing issues.
135 */
136#define __put_user_asm(x, addr, err, op) \
137 __asm__ __volatile__( \
138 "1: " op " %1,0(%2) # put_user\n" \
139 "2:\n" \
140 ".section .fixup,\"ax\"\n" \
141 "3: li %0,%3\n" \
142 " b 2b\n" \
143 ".previous\n" \
144 ".section __ex_table,\"a\"\n" \
145 " .align " __EX_TABLE_ALIGN "\n" \
146 " ."__EX_TABLE_TYPE" 1b,3b\n" \
147 ".previous" \
148 : "=r" (err) \
149 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
150
151#ifdef __powerpc64__
152#define __put_user_asm2(x, ptr, retval) \
153 __put_user_asm(x, ptr, retval, "std")
154#else /* __powerpc64__ */
155#define __put_user_asm2(x, addr, err) \
156 __asm__ __volatile__( \
157 "1: stw %1,0(%2)\n" \
158 "2: stw %1+1,4(%2)\n" \
159 "3:\n" \
160 ".section .fixup,\"ax\"\n" \
161 "4: li %0,%3\n" \
162 " b 3b\n" \
163 ".previous\n" \
164 ".section __ex_table,\"a\"\n" \
165 " .align " __EX_TABLE_ALIGN "\n" \
166 " ." __EX_TABLE_TYPE " 1b,4b\n" \
167 " ." __EX_TABLE_TYPE " 2b,4b\n" \
168 ".previous" \
169 : "=r" (err) \
170 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
171#endif /* __powerpc64__ */
172
173#define __put_user_size(x, ptr, size, retval) \
174do { \
175 retval = 0; \
176 switch (size) { \
177 case 1: __put_user_asm(x, ptr, retval, "stb"); break; \
178 case 2: __put_user_asm(x, ptr, retval, "sth"); break; \
179 case 4: __put_user_asm(x, ptr, retval, "stw"); break; \
180 case 8: __put_user_asm2(x, ptr, retval); break; \
181 default: __put_user_bad(); \
182 } \
183} while (0)
184
185#define __put_user_nocheck(x, ptr, size) \
186({ \
187 long __pu_err; \
188 might_sleep(); \
189 __chk_user_ptr(ptr); \
190 __put_user_size((x), (ptr), (size), __pu_err); \
191 __pu_err; \
192})
193
194#define __put_user_check(x, ptr, size) \
195({ \
196 long __pu_err = -EFAULT; \
197 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
198 might_sleep(); \
199 if (access_ok(VERIFY_WRITE, __pu_addr, size)) \
200 __put_user_size((x), __pu_addr, (size), __pu_err); \
201 __pu_err; \
202})
203
204extern long __get_user_bad(void);
205
206#define __get_user_asm(x, addr, err, op) \
207 __asm__ __volatile__( \
208 "1: "op" %1,0(%2) # get_user\n" \
209 "2:\n" \
210 ".section .fixup,\"ax\"\n" \
211 "3: li %0,%3\n" \
212 " li %1,0\n" \
213 " b 2b\n" \
214 ".previous\n" \
215 ".section __ex_table,\"a\"\n" \
216 " .align "__EX_TABLE_ALIGN "\n" \
217 " ." __EX_TABLE_TYPE " 1b,3b\n" \
218 ".previous" \
219 : "=r" (err), "=r" (x) \
220 : "b" (addr), "i" (-EFAULT), "0" (err))
221
222#ifdef __powerpc64__
223#define __get_user_asm2(x, addr, err) \
224 __get_user_asm(x, addr, err, "ld")
225#else /* __powerpc64__ */
226#define __get_user_asm2(x, addr, err) \
227 __asm__ __volatile__( \
228 "1: lwz %1,0(%2)\n" \
229 "2: lwz %1+1,4(%2)\n" \
230 "3:\n" \
231 ".section .fixup,\"ax\"\n" \
232 "4: li %0,%3\n" \
233 " li %1,0\n" \
234 " li %1+1,0\n" \
235 " b 3b\n" \
236 ".previous\n" \
237 ".section __ex_table,\"a\"\n" \
238 " .align " __EX_TABLE_ALIGN "\n" \
239 " ." __EX_TABLE_TYPE " 1b,4b\n" \
240 " ." __EX_TABLE_TYPE " 2b,4b\n" \
241 ".previous" \
242 : "=r" (err), "=&r" (x) \
243 : "b" (addr), "i" (-EFAULT), "0" (err))
244#endif /* __powerpc64__ */
245
246#define __get_user_size(x, ptr, size, retval) \
247do { \
248 retval = 0; \
249 __chk_user_ptr(ptr); \
250 if (size > sizeof(x)) \
251 (x) = __get_user_bad(); \
252 switch (size) { \
253 case 1: __get_user_asm(x, ptr, retval, "lbz"); break; \
254 case 2: __get_user_asm(x, ptr, retval, "lhz"); break; \
255 case 4: __get_user_asm(x, ptr, retval, "lwz"); break; \
256 case 8: __get_user_asm2(x, ptr, retval); break; \
257 default: (x) = __get_user_bad(); \
258 } \
259} while (0)
260
261#define __get_user_nocheck(x, ptr, size) \
262({ \
263 long __gu_err; \
264 unsigned long __gu_val; \
265 __chk_user_ptr(ptr); \
266 might_sleep(); \
267 __get_user_size(__gu_val, (ptr), (size), __gu_err); \
268 (x) = (__typeof__(*(ptr)))__gu_val; \
269 __gu_err; \
270})
271
272#ifndef __powerpc64__
273#define __get_user64_nocheck(x, ptr, size) \
274({ \
275 long __gu_err; \
276 long long __gu_val; \
277 __chk_user_ptr(ptr); \
278 might_sleep(); \
279 __get_user_size(__gu_val, (ptr), (size), __gu_err); \
280 (x) = (__typeof__(*(ptr)))__gu_val; \
281 __gu_err; \
282})
283#endif /* __powerpc64__ */
284
285#define __get_user_check(x, ptr, size) \
286({ \
287 long __gu_err = -EFAULT; \
288 unsigned long __gu_val = 0; \
289 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
290 might_sleep(); \
291 if (access_ok(VERIFY_READ, __gu_addr, (size))) \
292 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
293 (x) = (__typeof__(*(ptr)))__gu_val; \
294 __gu_err; \
295})
296
297/* more complex routines */
298
299extern unsigned long __copy_tofrom_user(void __user *to,
300 const void __user *from, unsigned long size);
301
302#ifndef __powerpc64__
303
304extern inline unsigned long copy_from_user(void *to,
305 const void __user *from, unsigned long n)
306{
307 unsigned long over;
308
309 if (access_ok(VERIFY_READ, from, n))
310 return __copy_tofrom_user((__force void __user *)to, from, n);
311 if ((unsigned long)from < TASK_SIZE) {
312 over = (unsigned long)from + n - TASK_SIZE;
313 return __copy_tofrom_user((__force void __user *)to, from,
314 n - over) + over;
315 }
316 return n;
317}
318
319extern inline unsigned long copy_to_user(void __user *to,
320 const void *from, unsigned long n)
321{
322 unsigned long over;
323
324 if (access_ok(VERIFY_WRITE, to, n))
325 return __copy_tofrom_user(to, (__force void __user *)from, n);
326 if ((unsigned long)to < TASK_SIZE) {
327 over = (unsigned long)to + n - TASK_SIZE;
328 return __copy_tofrom_user(to, (__force void __user *)from,
329 n - over) + over;
330 }
331 return n;
332}
333
334#else /* __powerpc64__ */
335
336#define __copy_in_user(to, from, size) \
337 __copy_tofrom_user((to), (from), (size))
338
339extern unsigned long copy_from_user(void *to, const void __user *from,
340 unsigned long n);
341extern unsigned long copy_to_user(void __user *to, const void *from,
342 unsigned long n);
343extern unsigned long copy_in_user(void __user *to, const void __user *from,
344 unsigned long n);
345
346#endif /* __powerpc64__ */
347
348static inline unsigned long __copy_from_user_inatomic(void *to,
349 const void __user *from, unsigned long n)
350{
351 if (__builtin_constant_p(n) && (n <= 8)) {
352 unsigned long ret;
353
354 switch (n) {
355 case 1:
356 __get_user_size(*(u8 *)to, from, 1, ret);
357 break;
358 case 2:
359 __get_user_size(*(u16 *)to, from, 2, ret);
360 break;
361 case 4:
362 __get_user_size(*(u32 *)to, from, 4, ret);
363 break;
364 case 8:
365 __get_user_size(*(u64 *)to, from, 8, ret);
366 break;
367 }
368 if (ret == 0)
369 return 0;
370 }
371 return __copy_tofrom_user((__force void __user *)to, from, n);
372}
373
374static inline unsigned long __copy_to_user_inatomic(void __user *to,
375 const void *from, unsigned long n)
376{
377 if (__builtin_constant_p(n) && (n <= 8)) {
378 unsigned long ret;
379
380 switch (n) {
381 case 1:
382 __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret);
383 break;
384 case 2:
385 __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret);
386 break;
387 case 4:
388 __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret);
389 break;
390 case 8:
391 __put_user_size(*(u64 *)from, (u64 __user *)to, 8, ret);
392 break;
393 }
394 if (ret == 0)
395 return 0;
396 }
397 return __copy_tofrom_user(to, (__force const void __user *)from, n);
398}
399
400static inline unsigned long __copy_from_user(void *to,
401 const void __user *from, unsigned long size)
402{
403 might_sleep();
404 return __copy_from_user_inatomic(to, from, size);
405}
406
407static inline unsigned long __copy_to_user(void __user *to,
408 const void *from, unsigned long size)
409{
410 might_sleep();
411 return __copy_to_user_inatomic(to, from, size);
412}
413
414extern unsigned long __clear_user(void __user *addr, unsigned long size);
415
416static inline unsigned long clear_user(void __user *addr, unsigned long size)
417{
418 might_sleep();
419 if (likely(access_ok(VERIFY_WRITE, addr, size)))
420 return __clear_user(addr, size);
421 if ((unsigned long)addr < TASK_SIZE) {
422 unsigned long over = (unsigned long)addr + size - TASK_SIZE;
423 return __clear_user(addr, size - over) + over;
424 }
425 return size;
426}
427
428extern int __strncpy_from_user(char *dst, const char __user *src, long count);
429
430static inline long strncpy_from_user(char *dst, const char __user *src,
431 long count)
432{
433 might_sleep();
434 if (likely(access_ok(VERIFY_READ, src, 1)))
435 return __strncpy_from_user(dst, src, count);
436 return -EFAULT;
437}
438
439/*
440 * Return the size of a string (including the ending 0)
441 *
442 * Return 0 for error
443 */
444extern int __strnlen_user(const char __user *str, long len, unsigned long top);
445
446/*
447 * Returns the length of the string at str (including the null byte),
448 * or 0 if we hit a page we can't access,
449 * or something > len if we didn't find a null byte.
450 *
451 * The `top' parameter to __strnlen_user is to make sure that
452 * we can never overflow from the user area into kernel space.
453 */
454static inline int strnlen_user(const char __user *str, long len)
455{
456 unsigned long top = current->thread.fs.seg;
457
458 if ((unsigned long)str > top)
459 return 0;
460 return __strnlen_user(str, len, top);
461}
462
463#define strlen_user(str) strnlen_user((str), 0x7ffffffe)
464
465#endif /* __ASSEMBLY__ */
466#endif /* __KERNEL__ */
467
468#endif /* _ARCH_POWERPC_UACCESS_H */
diff --git a/include/asm-powerpc/ucontext.h b/include/asm-powerpc/ucontext.h
new file mode 100644
index 000000000000..d9a4ddf0cc86
--- /dev/null
+++ b/include/asm-powerpc/ucontext.h
@@ -0,0 +1,40 @@
1#ifndef _ASM_POWERPC_UCONTEXT_H
2#define _ASM_POWERPC_UCONTEXT_H
3
4#ifdef __powerpc64__
5#include <asm/sigcontext.h>
6#else
7#include <asm/elf.h>
8#endif
9#include <asm/signal.h>
10
11#ifndef __powerpc64__
12struct mcontext {
13 elf_gregset_t mc_gregs;
14 elf_fpregset_t mc_fregs;
15 unsigned long mc_pad[2];
16 elf_vrregset_t mc_vregs __attribute__((__aligned__(16)));
17};
18#endif
19
20struct ucontext {
21 unsigned long uc_flags;
22 struct ucontext __user *uc_link;
23 stack_t uc_stack;
24#ifndef __powerpc64__
25 int uc_pad[7];
26 struct mcontext __user *uc_regs;/* points to uc_mcontext field */
27#endif
28 sigset_t uc_sigmask;
29 /* glibc has 1024-bit signal masks, ours are 64-bit */
30#ifdef __powerpc64__
31 sigset_t __unused[15]; /* Allow for uc_sigmask growth */
32 struct sigcontext uc_mcontext; /* last for extensibility */
33#else
34 int uc_maskext[30];
35 int uc_pad2[3];
36 struct mcontext uc_mcontext;
37#endif
38};
39
40#endif /* _ASM_POWERPC_UCONTEXT_H */
diff --git a/include/asm-ppc/bitops.h b/include/asm-ppc/bitops.h
deleted file mode 100644
index e30f536fd830..000000000000
--- a/include/asm-ppc/bitops.h
+++ /dev/null
@@ -1,460 +0,0 @@
1/*
2 * bitops.h: Bit string operations on the ppc
3 */
4
5#ifdef __KERNEL__
6#ifndef _PPC_BITOPS_H
7#define _PPC_BITOPS_H
8
9#include <linux/config.h>
10#include <linux/compiler.h>
11#include <asm/byteorder.h>
12#include <asm/atomic.h>
13
14/*
15 * The test_and_*_bit operations are taken to imply a memory barrier
16 * on SMP systems.
17 */
18#ifdef CONFIG_SMP
19#define SMP_WMB "eieio\n"
20#define SMP_MB "\nsync"
21#else
22#define SMP_WMB
23#define SMP_MB
24#endif /* CONFIG_SMP */
25
26static __inline__ void set_bit(int nr, volatile unsigned long * addr)
27{
28 unsigned long old;
29 unsigned long mask = 1 << (nr & 0x1f);
30 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
31
32 __asm__ __volatile__("\n\
331: lwarx %0,0,%3 \n\
34 or %0,%0,%2 \n"
35 PPC405_ERR77(0,%3)
36" stwcx. %0,0,%3 \n\
37 bne- 1b"
38 : "=&r" (old), "=m" (*p)
39 : "r" (mask), "r" (p), "m" (*p)
40 : "cc" );
41}
42
43/*
44 * non-atomic version
45 */
46static __inline__ void __set_bit(int nr, volatile unsigned long *addr)
47{
48 unsigned long mask = 1 << (nr & 0x1f);
49 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
50
51 *p |= mask;
52}
53
54/*
55 * clear_bit doesn't imply a memory barrier
56 */
57#define smp_mb__before_clear_bit() smp_mb()
58#define smp_mb__after_clear_bit() smp_mb()
59
60static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
61{
62 unsigned long old;
63 unsigned long mask = 1 << (nr & 0x1f);
64 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
65
66 __asm__ __volatile__("\n\
671: lwarx %0,0,%3 \n\
68 andc %0,%0,%2 \n"
69 PPC405_ERR77(0,%3)
70" stwcx. %0,0,%3 \n\
71 bne- 1b"
72 : "=&r" (old), "=m" (*p)
73 : "r" (mask), "r" (p), "m" (*p)
74 : "cc");
75}
76
77/*
78 * non-atomic version
79 */
80static __inline__ void __clear_bit(int nr, volatile unsigned long *addr)
81{
82 unsigned long mask = 1 << (nr & 0x1f);
83 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
84
85 *p &= ~mask;
86}
87
88static __inline__ void change_bit(int nr, volatile unsigned long *addr)
89{
90 unsigned long old;
91 unsigned long mask = 1 << (nr & 0x1f);
92 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
93
94 __asm__ __volatile__("\n\
951: lwarx %0,0,%3 \n\
96 xor %0,%0,%2 \n"
97 PPC405_ERR77(0,%3)
98" stwcx. %0,0,%3 \n\
99 bne- 1b"
100 : "=&r" (old), "=m" (*p)
101 : "r" (mask), "r" (p), "m" (*p)
102 : "cc");
103}
104
105/*
106 * non-atomic version
107 */
108static __inline__ void __change_bit(int nr, volatile unsigned long *addr)
109{
110 unsigned long mask = 1 << (nr & 0x1f);
111 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
112
113 *p ^= mask;
114}
115
116/*
117 * test_and_*_bit do imply a memory barrier (?)
118 */
119static __inline__ int test_and_set_bit(int nr, volatile unsigned long *addr)
120{
121 unsigned int old, t;
122 unsigned int mask = 1 << (nr & 0x1f);
123 volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
124
125 __asm__ __volatile__(SMP_WMB "\n\
1261: lwarx %0,0,%4 \n\
127 or %1,%0,%3 \n"
128 PPC405_ERR77(0,%4)
129" stwcx. %1,0,%4 \n\
130 bne 1b"
131 SMP_MB
132 : "=&r" (old), "=&r" (t), "=m" (*p)
133 : "r" (mask), "r" (p), "m" (*p)
134 : "cc", "memory");
135
136 return (old & mask) != 0;
137}
138
139/*
140 * non-atomic version
141 */
142static __inline__ int __test_and_set_bit(int nr, volatile unsigned long *addr)
143{
144 unsigned long mask = 1 << (nr & 0x1f);
145 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
146 unsigned long old = *p;
147
148 *p = old | mask;
149 return (old & mask) != 0;
150}
151
152static __inline__ int test_and_clear_bit(int nr, volatile unsigned long *addr)
153{
154 unsigned int old, t;
155 unsigned int mask = 1 << (nr & 0x1f);
156 volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
157
158 __asm__ __volatile__(SMP_WMB "\n\
1591: lwarx %0,0,%4 \n\
160 andc %1,%0,%3 \n"
161 PPC405_ERR77(0,%4)
162" stwcx. %1,0,%4 \n\
163 bne 1b"
164 SMP_MB
165 : "=&r" (old), "=&r" (t), "=m" (*p)
166 : "r" (mask), "r" (p), "m" (*p)
167 : "cc", "memory");
168
169 return (old & mask) != 0;
170}
171
172/*
173 * non-atomic version
174 */
175static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long *addr)
176{
177 unsigned long mask = 1 << (nr & 0x1f);
178 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
179 unsigned long old = *p;
180
181 *p = old & ~mask;
182 return (old & mask) != 0;
183}
184
185static __inline__ int test_and_change_bit(int nr, volatile unsigned long *addr)
186{
187 unsigned int old, t;
188 unsigned int mask = 1 << (nr & 0x1f);
189 volatile unsigned int *p = ((volatile unsigned int *)addr) + (nr >> 5);
190
191 __asm__ __volatile__(SMP_WMB "\n\
1921: lwarx %0,0,%4 \n\
193 xor %1,%0,%3 \n"
194 PPC405_ERR77(0,%4)
195" stwcx. %1,0,%4 \n\
196 bne 1b"
197 SMP_MB
198 : "=&r" (old), "=&r" (t), "=m" (*p)
199 : "r" (mask), "r" (p), "m" (*p)
200 : "cc", "memory");
201
202 return (old & mask) != 0;
203}
204
205/*
206 * non-atomic version
207 */
208static __inline__ int __test_and_change_bit(int nr, volatile unsigned long *addr)
209{
210 unsigned long mask = 1 << (nr & 0x1f);
211 unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
212 unsigned long old = *p;
213
214 *p = old ^ mask;
215 return (old & mask) != 0;
216}
217
218static __inline__ int test_bit(int nr, __const__ volatile unsigned long *addr)
219{
220 return ((addr[nr >> 5] >> (nr & 0x1f)) & 1) != 0;
221}
222
223/* Return the bit position of the most significant 1 bit in a word */
224static __inline__ int __ilog2(unsigned long x)
225{
226 int lz;
227
228 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
229 return 31 - lz;
230}
231
232static __inline__ int ffz(unsigned long x)
233{
234 if ((x = ~x) == 0)
235 return 32;
236 return __ilog2(x & -x);
237}
238
239static inline int __ffs(unsigned long x)
240{
241 return __ilog2(x & -x);
242}
243
244/*
245 * ffs: find first bit set. This is defined the same way as
246 * the libc and compiler builtin ffs routines, therefore
247 * differs in spirit from the above ffz (man ffs).
248 */
249static __inline__ int ffs(int x)
250{
251 return __ilog2(x & -x) + 1;
252}
253
254/*
255 * fls: find last (most-significant) bit set.
256 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
257 */
258static __inline__ int fls(unsigned int x)
259{
260 int lz;
261
262 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
263 return 32 - lz;
264}
265
266/*
267 * hweightN: returns the hamming weight (i.e. the number
268 * of bits set) of a N-bit word
269 */
270
271#define hweight32(x) generic_hweight32(x)
272#define hweight16(x) generic_hweight16(x)
273#define hweight8(x) generic_hweight8(x)
274
275/*
276 * Find the first bit set in a 140-bit bitmap.
277 * The first 100 bits are unlikely to be set.
278 */
279static inline int sched_find_first_bit(const unsigned long *b)
280{
281 if (unlikely(b[0]))
282 return __ffs(b[0]);
283 if (unlikely(b[1]))
284 return __ffs(b[1]) + 32;
285 if (unlikely(b[2]))
286 return __ffs(b[2]) + 64;
287 if (b[3])
288 return __ffs(b[3]) + 96;
289 return __ffs(b[4]) + 128;
290}
291
292/**
293 * find_next_bit - find the next set bit in a memory region
294 * @addr: The address to base the search on
295 * @offset: The bitnumber to start searching at
296 * @size: The maximum size to search
297 */
298static __inline__ unsigned long find_next_bit(const unsigned long *addr,
299 unsigned long size, unsigned long offset)
300{
301 unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
302 unsigned int result = offset & ~31UL;
303 unsigned int tmp;
304
305 if (offset >= size)
306 return size;
307 size -= result;
308 offset &= 31UL;
309 if (offset) {
310 tmp = *p++;
311 tmp &= ~0UL << offset;
312 if (size < 32)
313 goto found_first;
314 if (tmp)
315 goto found_middle;
316 size -= 32;
317 result += 32;
318 }
319 while (size >= 32) {
320 if ((tmp = *p++) != 0)
321 goto found_middle;
322 result += 32;
323 size -= 32;
324 }
325 if (!size)
326 return result;
327 tmp = *p;
328
329found_first:
330 tmp &= ~0UL >> (32 - size);
331 if (tmp == 0UL) /* Are any bits set? */
332 return result + size; /* Nope. */
333found_middle:
334 return result + __ffs(tmp);
335}
336
337/**
338 * find_first_bit - find the first set bit in a memory region
339 * @addr: The address to start the search at
340 * @size: The maximum size to search
341 *
342 * Returns the bit-number of the first set bit, not the number of the byte
343 * containing a bit.
344 */
345#define find_first_bit(addr, size) \
346 find_next_bit((addr), (size), 0)
347
348/*
349 * This implementation of find_{first,next}_zero_bit was stolen from
350 * Linus' asm-alpha/bitops.h.
351 */
352#define find_first_zero_bit(addr, size) \
353 find_next_zero_bit((addr), (size), 0)
354
355static __inline__ unsigned long find_next_zero_bit(const unsigned long *addr,
356 unsigned long size, unsigned long offset)
357{
358 unsigned int * p = ((unsigned int *) addr) + (offset >> 5);
359 unsigned int result = offset & ~31UL;
360 unsigned int tmp;
361
362 if (offset >= size)
363 return size;
364 size -= result;
365 offset &= 31UL;
366 if (offset) {
367 tmp = *p++;
368 tmp |= ~0UL >> (32-offset);
369 if (size < 32)
370 goto found_first;
371 if (tmp != ~0U)
372 goto found_middle;
373 size -= 32;
374 result += 32;
375 }
376 while (size >= 32) {
377 if ((tmp = *p++) != ~0U)
378 goto found_middle;
379 result += 32;
380 size -= 32;
381 }
382 if (!size)
383 return result;
384 tmp = *p;
385found_first:
386 tmp |= ~0UL << size;
387 if (tmp == ~0UL) /* Are any bits zero? */
388 return result + size; /* Nope. */
389found_middle:
390 return result + ffz(tmp);
391}
392
393
394#define ext2_set_bit(nr, addr) __test_and_set_bit((nr) ^ 0x18, (unsigned long *)(addr))
395#define ext2_set_bit_atomic(lock, nr, addr) test_and_set_bit((nr) ^ 0x18, (unsigned long *)(addr))
396#define ext2_clear_bit(nr, addr) __test_and_clear_bit((nr) ^ 0x18, (unsigned long *)(addr))
397#define ext2_clear_bit_atomic(lock, nr, addr) test_and_clear_bit((nr) ^ 0x18, (unsigned long *)(addr))
398
399static __inline__ int ext2_test_bit(int nr, __const__ void * addr)
400{
401 __const__ unsigned char *ADDR = (__const__ unsigned char *) addr;
402
403 return (ADDR[nr >> 3] >> (nr & 7)) & 1;
404}
405
406/*
407 * This implementation of ext2_find_{first,next}_zero_bit was stolen from
408 * Linus' asm-alpha/bitops.h and modified for a big-endian machine.
409 */
410
411#define ext2_find_first_zero_bit(addr, size) \
412 ext2_find_next_zero_bit((addr), (size), 0)
413
414static __inline__ unsigned long ext2_find_next_zero_bit(const void *addr,
415 unsigned long size, unsigned long offset)
416{
417 unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
418 unsigned int result = offset & ~31UL;
419 unsigned int tmp;
420
421 if (offset >= size)
422 return size;
423 size -= result;
424 offset &= 31UL;
425 if (offset) {
426 tmp = cpu_to_le32p(p++);
427 tmp |= ~0UL >> (32-offset);
428 if (size < 32)
429 goto found_first;
430 if (tmp != ~0U)
431 goto found_middle;
432 size -= 32;
433 result += 32;
434 }
435 while (size >= 32) {
436 if ((tmp = cpu_to_le32p(p++)) != ~0U)
437 goto found_middle;
438 result += 32;
439 size -= 32;
440 }
441 if (!size)
442 return result;
443 tmp = cpu_to_le32p(p);
444found_first:
445 tmp |= ~0U << size;
446 if (tmp == ~0UL) /* Are any bits zero? */
447 return result + size; /* Nope. */
448found_middle:
449 return result + ffz(tmp);
450}
451
452/* Bitmap functions for the minix filesystem. */
453#define minix_test_and_set_bit(nr,addr) ext2_set_bit(nr,addr)
454#define minix_set_bit(nr,addr) ((void)ext2_set_bit(nr,addr))
455#define minix_test_and_clear_bit(nr,addr) ext2_clear_bit(nr,addr)
456#define minix_test_bit(nr,addr) ext2_test_bit(nr,addr)
457#define minix_find_first_zero_bit(addr,size) ext2_find_first_zero_bit(addr,size)
458
459#endif /* _PPC_BITOPS_H */
460#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/commproc.h b/include/asm-ppc/commproc.h
index 5bbb8e2c1c6d..973e60908234 100644
--- a/include/asm-ppc/commproc.h
+++ b/include/asm-ppc/commproc.h
@@ -83,6 +83,8 @@ extern uint m8xx_cpm_hostalloc(uint size);
83extern int m8xx_cpm_hostfree(uint start); 83extern int m8xx_cpm_hostfree(uint start);
84extern void m8xx_cpm_hostdump(void); 84extern void m8xx_cpm_hostdump(void);
85 85
86extern void cpm_load_patch(volatile immap_t *immr);
87
86/* Buffer descriptors used by many of the CPM protocols. 88/* Buffer descriptors used by many of the CPM protocols.
87*/ 89*/
88typedef struct cpm_buf_desc { 90typedef struct cpm_buf_desc {
diff --git a/include/asm-ppc/futex.h b/include/asm-ppc/futex.h
deleted file mode 100644
index 9feff4ce1424..000000000000
--- a/include/asm-ppc/futex.h
+++ /dev/null
@@ -1,53 +0,0 @@
1#ifndef _ASM_FUTEX_H
2#define _ASM_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <asm/errno.h>
8#include <asm/uaccess.h>
9
10static inline int
11futex_atomic_op_inuser (int encoded_op, int __user *uaddr)
12{
13 int op = (encoded_op >> 28) & 7;
14 int cmp = (encoded_op >> 24) & 15;
15 int oparg = (encoded_op << 8) >> 20;
16 int cmparg = (encoded_op << 20) >> 20;
17 int oldval = 0, ret;
18 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
19 oparg = 1 << oparg;
20
21 if (! access_ok (VERIFY_WRITE, uaddr, sizeof(int)))
22 return -EFAULT;
23
24 inc_preempt_count();
25
26 switch (op) {
27 case FUTEX_OP_SET:
28 case FUTEX_OP_ADD:
29 case FUTEX_OP_OR:
30 case FUTEX_OP_ANDN:
31 case FUTEX_OP_XOR:
32 default:
33 ret = -ENOSYS;
34 }
35
36 dec_preempt_count();
37
38 if (!ret) {
39 switch (cmp) {
40 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
41 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
42 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
43 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
44 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
45 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
46 default: ret = -ENOSYS;
47 }
48 }
49 return ret;
50}
51
52#endif
53#endif
diff --git a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h
index e5374be86aef..f835066fb3ca 100644
--- a/include/asm-ppc/ibm44x.h
+++ b/include/asm-ppc/ibm44x.h
@@ -34,12 +34,20 @@
34/* Lowest TLB slot consumed by the default pinned TLBs */ 34/* Lowest TLB slot consumed by the default pinned TLBs */
35#define PPC44x_LOW_SLOT 63 35#define PPC44x_LOW_SLOT 63
36 36
37/* LS 32-bits of UART0 physical address location for early serial text debug */ 37/*
38 * Least significant 32-bits and extended real page number (ERPN) of
39 * UART0 physical address location for early serial text debug
40 */
38#if defined(CONFIG_440SP) 41#if defined(CONFIG_440SP)
42#define UART0_PHYS_ERPN 1
43#define UART0_PHYS_IO_BASE 0xf0000200
44#elif defined(CONFIG_440SPE)
45#define UART0_PHYS_ERPN 4
39#define UART0_PHYS_IO_BASE 0xf0000200 46#define UART0_PHYS_IO_BASE 0xf0000200
40#elif defined(CONFIG_440EP) 47#elif defined(CONFIG_440EP)
41#define UART0_PHYS_IO_BASE 0xe0000000 48#define UART0_PHYS_IO_BASE 0xe0000000
42#else 49#else
50#define UART0_PHYS_ERPN 1
43#define UART0_PHYS_IO_BASE 0x40000200 51#define UART0_PHYS_IO_BASE 0x40000200
44#endif 52#endif
45 53
@@ -56,6 +64,11 @@
56#define PPC44x_PCICFG_PAGE 0x0000000900000000ULL 64#define PPC44x_PCICFG_PAGE 0x0000000900000000ULL
57#define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE 65#define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE
58#define PPC44x_PCIMEM_PAGE 0x0000000a00000000ULL 66#define PPC44x_PCIMEM_PAGE 0x0000000a00000000ULL
67#elif defined(CONFIG_440SPE)
68#define PPC44x_IO_PAGE 0x0000000400000000ULL
69#define PPC44x_PCICFG_PAGE 0x0000000c00000000ULL
70#define PPC44x_PCIIO_PAGE PPC44x_PCICFG_PAGE
71#define PPC44x_PCIMEM_PAGE 0x0000000d00000000ULL
59#elif defined(CONFIG_440EP) 72#elif defined(CONFIG_440EP)
60#define PPC44x_IO_PAGE 0x0000000000000000ULL 73#define PPC44x_IO_PAGE 0x0000000000000000ULL
61#define PPC44x_PCICFG_PAGE 0x0000000000000000ULL 74#define PPC44x_PCICFG_PAGE 0x0000000000000000ULL
@@ -71,7 +84,7 @@
71/* 84/*
72 * 36-bit trap ranges 85 * 36-bit trap ranges
73 */ 86 */
74#if defined(CONFIG_440SP) 87#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
75#define PPC44x_IO_LO 0xf0000000UL 88#define PPC44x_IO_LO 0xf0000000UL
76#define PPC44x_IO_HI 0xf0000fffUL 89#define PPC44x_IO_HI 0xf0000fffUL
77#define PPC44x_PCI0CFG_LO 0x0ec00000UL 90#define PPC44x_PCI0CFG_LO 0x0ec00000UL
@@ -109,7 +122,7 @@
109 */ 122 */
110 123
111 124
112/* CPRs (440GX and 440SP) */ 125/* CPRs (440GX and 440SP/440SPe) */
113#define DCRN_CPR_CONFIG_ADDR 0xc 126#define DCRN_CPR_CONFIG_ADDR 0xc
114#define DCRN_CPR_CONFIG_DATA 0xd 127#define DCRN_CPR_CONFIG_DATA 0xd
115 128
@@ -130,7 +143,7 @@
130 mtdcr(DCRN_CPR_CONFIG_ADDR, offset); \ 143 mtdcr(DCRN_CPR_CONFIG_ADDR, offset); \
131 mtdcr(DCRN_CPR_CONFIG_DATA, data);}) 144 mtdcr(DCRN_CPR_CONFIG_DATA, data);})
132 145
133/* SDRs (440GX and 440SP) */ 146/* SDRs (440GX and 440SP/440SPe) */
134#define DCRN_SDR_CONFIG_ADDR 0xe 147#define DCRN_SDR_CONFIG_ADDR 0xe
135#define DCRN_SDR_CONFIG_DATA 0xf 148#define DCRN_SDR_CONFIG_DATA 0xf
136#define DCRN_SDR_PFC0 0x4100 149#define DCRN_SDR_PFC0 0x4100
@@ -180,7 +193,7 @@
180 mtdcr(DCRN_SDR_CONFIG_ADDR, offset); \ 193 mtdcr(DCRN_SDR_CONFIG_ADDR, offset); \
181 mtdcr(DCRN_SDR_CONFIG_DATA,data);}) 194 mtdcr(DCRN_SDR_CONFIG_DATA,data);})
182 195
183/* DMA (excluding 440SP) */ 196/* DMA (excluding 440SP/440SPe) */
184#define DCRN_DMA0_BASE 0x100 197#define DCRN_DMA0_BASE 0x100
185#define DCRN_DMA1_BASE 0x108 198#define DCRN_DMA1_BASE 0x108
186#define DCRN_DMA2_BASE 0x110 199#define DCRN_DMA2_BASE 0x110
@@ -200,12 +213,20 @@
200/* UIC */ 213/* UIC */
201#define DCRN_UIC0_BASE 0xc0 214#define DCRN_UIC0_BASE 0xc0
202#define DCRN_UIC1_BASE 0xd0 215#define DCRN_UIC1_BASE 0xd0
203#define DCRN_UIC2_BASE 0x210
204#define DCRN_UICB_BASE 0x200
205#define UIC0 DCRN_UIC0_BASE 216#define UIC0 DCRN_UIC0_BASE
206#define UIC1 DCRN_UIC1_BASE 217#define UIC1 DCRN_UIC1_BASE
218
219#ifdef CONFIG_440SPE
220#define DCRN_UIC2_BASE 0xe0
221#define DCRN_UIC3_BASE 0xf0
222#define UIC2 DCRN_UIC2_BASE
223#define UIC3 DCRN_UIC3_BASE
224#else
225#define DCRN_UIC2_BASE 0x210
226#define DCRN_UICB_BASE 0x200
207#define UIC2 DCRN_UIC2_BASE 227#define UIC2 DCRN_UIC2_BASE
208#define UICB DCRN_UICB_BASE 228#define UICB DCRN_UICB_BASE
229#endif
209 230
210#define DCRN_UIC_SR(base) (base + 0x0) 231#define DCRN_UIC_SR(base) (base + 0x0)
211#define DCRN_UIC_ER(base) (base + 0x2) 232#define DCRN_UIC_ER(base) (base + 0x2)
@@ -218,6 +239,12 @@
218 239
219#define UIC0_UIC1NC 0x00000002 240#define UIC0_UIC1NC 0x00000002
220 241
242#ifdef CONFIG_440SPE
243#define UIC0_UIC1NC 0x00000002
244#define UIC0_UIC2NC 0x00200000
245#define UIC0_UIC3NC 0x00008000
246#endif
247
221#define UICB_UIC0NC 0x40000000 248#define UICB_UIC0NC 0x40000000
222#define UICB_UIC1NC 0x10000000 249#define UICB_UIC1NC 0x10000000
223#define UICB_UIC2NC 0x04000000 250#define UICB_UIC2NC 0x04000000
@@ -297,6 +324,23 @@
297#define MALOBISR_CH0 0x80000000 /* EOB channel 1 bit */ 324#define MALOBISR_CH0 0x80000000 /* EOB channel 1 bit */
298#define MALOBISR_CH2 0x40000000 /* EOB channel 2 bit */ 325#define MALOBISR_CH2 0x40000000 /* EOB channel 2 bit */
299 326
327#if defined(CONFIG_440SP) || defined(CONFIG_440SPE)
328/* 440SP/440SPe PLB Arbiter DCRs */
329#define DCRN_PLB_REVID 0x080 /* PLB Revision ID */
330#define DCRN_PLB_CCR 0x088 /* PLB Crossbar Control */
331
332#define DCRN_PLB0_ACR 0x081 /* PLB Arbiter Control */
333#define DCRN_PLB0_BESRL 0x082 /* PLB Error Status */
334#define DCRN_PLB0_BESRH 0x083 /* PLB Error Status */
335#define DCRN_PLB0_BEARL 0x084 /* PLB Error Address Low */
336#define DCRN_PLB0_BEARH 0x085 /* PLB Error Address High */
337
338#define DCRN_PLB1_ACR 0x089 /* PLB Arbiter Control */
339#define DCRN_PLB1_BESRL 0x08a /* PLB Error Status */
340#define DCRN_PLB1_BESRH 0x08b /* PLB Error Status */
341#define DCRN_PLB1_BEARL 0x08c /* PLB Error Address Low */
342#define DCRN_PLB1_BEARH 0x08d /* PLB Error Address High */
343#else
300/* 440GP/GX PLB Arbiter DCRs */ 344/* 440GP/GX PLB Arbiter DCRs */
301#define DCRN_PLB0_REVID 0x082 /* PLB Arbiter Revision ID */ 345#define DCRN_PLB0_REVID 0x082 /* PLB Arbiter Revision ID */
302#define DCRN_PLB0_ACR 0x083 /* PLB Arbiter Control */ 346#define DCRN_PLB0_ACR 0x083 /* PLB Arbiter Control */
@@ -304,6 +348,7 @@
304#define DCRN_PLB0_BEARL 0x086 /* PLB Error Address Low */ 348#define DCRN_PLB0_BEARL 0x086 /* PLB Error Address Low */
305#define DCRN_PLB0_BEAR DCRN_PLB0_BEARL /* 40x compatibility */ 349#define DCRN_PLB0_BEAR DCRN_PLB0_BEARL /* 40x compatibility */
306#define DCRN_PLB0_BEARH 0x087 /* PLB Error Address High */ 350#define DCRN_PLB0_BEARH 0x087 /* PLB Error Address High */
351#endif
307 352
308/* 440GP/GX PLB to OPB bridge DCRs */ 353/* 440GP/GX PLB to OPB bridge DCRs */
309#define DCRN_POB0_BESR0 0x090 354#define DCRN_POB0_BESR0 0x090
@@ -407,9 +452,13 @@
407#define PPC44x_MEM_SIZE_1G 0x40000000 452#define PPC44x_MEM_SIZE_1G 0x40000000
408#define PPC44x_MEM_SIZE_2G 0x80000000 453#define PPC44x_MEM_SIZE_2G 0x80000000
409 454
410/* 440SP memory controller DCRs */ 455/* 440SP/440SPe memory controller DCRs */
411#define DCRN_MQ0_BS0BAS 0x40 456#define DCRN_MQ0_BS0BAS 0x40
412#define DCRN_MQ0_BS1BAS 0x41 457#if defined(CONFIG_440SP)
458#define MQ0_NUM_BANKS 2
459#elif defined(CONFIG_440SPE)
460#define MQ0_NUM_BANKS 4
461#endif
413 462
414#define MQ0_CONFIG_SIZE_MASK 0x0000fff0 463#define MQ0_CONFIG_SIZE_MASK 0x0000fff0
415#define MQ0_CONFIG_SIZE_8M 0x0000ffc0 464#define MQ0_CONFIG_SIZE_8M 0x0000ffc0
@@ -421,8 +470,9 @@
421#define MQ0_CONFIG_SIZE_512M 0x0000f000 470#define MQ0_CONFIG_SIZE_512M 0x0000f000
422#define MQ0_CONFIG_SIZE_1G 0x0000e000 471#define MQ0_CONFIG_SIZE_1G 0x0000e000
423#define MQ0_CONFIG_SIZE_2G 0x0000c000 472#define MQ0_CONFIG_SIZE_2G 0x0000c000
473#define MQ0_CONFIG_SIZE_4G 0x00008000
424 474
425/* Internal SRAM Controller 440GX/440SP */ 475/* Internal SRAM Controller 440GX/440SP/440SPe */
426#define DCRN_SRAM0_BASE 0x000 476#define DCRN_SRAM0_BASE 0x000
427 477
428#define DCRN_SRAM0_SB0CR (DCRN_SRAM0_BASE + 0x020) 478#define DCRN_SRAM0_SB0CR (DCRN_SRAM0_BASE + 0x020)
@@ -446,7 +496,7 @@
446#define DCRN_SRAM0_DPC (DCRN_SRAM0_BASE + 0x02a) 496#define DCRN_SRAM0_DPC (DCRN_SRAM0_BASE + 0x02a)
447#define SRAM_DPC_ENABLE 0x80000000 497#define SRAM_DPC_ENABLE 0x80000000
448 498
449/* L2 Cache Controller 440GX/440SP */ 499/* L2 Cache Controller 440GX/440SP/440SPe */
450#define DCRN_L2C0_CFG 0x030 500#define DCRN_L2C0_CFG 0x030
451#define L2C_CFG_L2M 0x80000000 501#define L2C_CFG_L2M 0x80000000
452#define L2C_CFG_ICU 0x40000000 502#define L2C_CFG_ICU 0x40000000
@@ -610,8 +660,10 @@
610#define IIC_CLOCK 50 660#define IIC_CLOCK 50
611 661
612#undef NR_UICS 662#undef NR_UICS
613#ifdef CONFIG_440GX 663#if defined(CONFIG_440GX)
614#define NR_UICS 3 664#define NR_UICS 3
665#elif defined(CONFIG_440SPE)
666#define NR_UICS 4
615#else 667#else
616#define NR_UICS 2 668#define NR_UICS 2
617#endif 669#endif
diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h
index e992369cb8e9..6c28ae7807f4 100644
--- a/include/asm-ppc/ibm4xx.h
+++ b/include/asm-ppc/ibm4xx.h
@@ -97,6 +97,10 @@ void ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5,
97#include <platforms/4xx/luan.h> 97#include <platforms/4xx/luan.h>
98#endif 98#endif
99 99
100#if defined(CONFIG_YUCCA)
101#include <platforms/4xx/yucca.h>
102#endif
103
100#if defined(CONFIG_OCOTEA) 104#if defined(CONFIG_OCOTEA)
101#include <platforms/4xx/ocotea.h> 105#include <platforms/4xx/ocotea.h>
102#endif 106#endif
diff --git a/include/asm-ppc/ibm_ocp.h b/include/asm-ppc/ibm_ocp.h
index 6f10a25bd628..9c21de1ff4ed 100644
--- a/include/asm-ppc/ibm_ocp.h
+++ b/include/asm-ppc/ibm_ocp.h
@@ -131,9 +131,22 @@ static inline void ibm_ocp_set_emac(int start, int end)
131 /* Copy MAC addresses to EMAC additions */ 131 /* Copy MAC addresses to EMAC additions */
132 for (i=start; i<=end; i++) { 132 for (i=start; i<=end; i++) {
133 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i); 133 def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, i);
134 memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr, 134 if (i == 0)
135 &__res.bi_enetaddr[i], 135 memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
136 6); 136 __res.bi_enetaddr, 6);
137#if defined(CONFIG_405EP) || defined(CONFIG_44x)
138 else if (i == 1)
139 memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
140 __res.bi_enet1addr, 6);
141#endif
142#if defined(CONFIG_440GX)
143 else if (i == 2)
144 memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
145 __res.bi_enet2addr, 6);
146 else if (i == 3)
147 memcpy(((struct ocp_func_emac_data *)def->additions)->mac_addr,
148 __res.bi_enet3addr, 6);
149#endif
137 } 150 }
138} 151}
139#endif 152#endif
diff --git a/include/asm-ppc/ipcbuf.h b/include/asm-ppc/ipcbuf.h
deleted file mode 100644
index fab6752c7480..000000000000
--- a/include/asm-ppc/ipcbuf.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef __PPC_IPCBUF_H__
2#define __PPC_IPCBUF_H__
3
4/*
5 * The ipc64_perm structure for PPC 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 * - 1 32-bit value to fill up for 8-byte alignment
11 * - 2 miscellaneous 64-bit values (so that this structure matches
12 * PPC64 ipc64_perm)
13 */
14
15struct ipc64_perm
16{
17 __kernel_key_t key;
18 __kernel_uid_t uid;
19 __kernel_gid_t gid;
20 __kernel_uid_t cuid;
21 __kernel_gid_t cgid;
22 __kernel_mode_t mode;
23 unsigned long seq;
24 unsigned int __pad2;
25 unsigned long long __unused1;
26 unsigned long long __unused2;
27};
28
29#endif /* __PPC_IPCBUF_H__ */
diff --git a/include/asm-ppc/kexec.h b/include/asm-ppc/kexec.h
deleted file mode 100644
index 6d2aa0aa4642..000000000000
--- a/include/asm-ppc/kexec.h
+++ /dev/null
@@ -1,40 +0,0 @@
1#ifndef _PPC_KEXEC_H
2#define _PPC_KEXEC_H
3
4#ifdef CONFIG_KEXEC
5
6/*
7 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
8 * I.e. Maximum page that is mapped directly into kernel memory,
9 * and kmap is not required.
10 *
11 * Someone correct me if FIXADDR_START - PAGEOFFSET is not the correct
12 * calculation for the amount of memory directly mappable into the
13 * kernel memory space.
14 */
15
16/* Maximum physical address we can use pages from */
17#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
18/* Maximum address we can reach in physical address mode */
19#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
20/* Maximum address we can use for the control code buffer */
21#define KEXEC_CONTROL_MEMORY_LIMIT TASK_SIZE
22
23#define KEXEC_CONTROL_CODE_SIZE 4096
24
25/* The native architecture */
26#define KEXEC_ARCH KEXEC_ARCH_PPC
27
28#ifndef __ASSEMBLY__
29
30extern void *crash_notes;
31
32struct kimage;
33
34extern void machine_kexec_simple(struct kimage *image);
35
36#endif /* __ASSEMBLY__ */
37
38#endif /* CONFIG_KEXEC */
39
40#endif /* _PPC_KEXEC_H */
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index b28a713ba862..6d1c39e8a6af 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -12,6 +12,7 @@
12#include <asm/processor.h> /* For TASK_SIZE */ 12#include <asm/processor.h> /* For TASK_SIZE */
13#include <asm/mmu.h> 13#include <asm/mmu.h>
14#include <asm/page.h> 14#include <asm/page.h>
15struct mm_struct;
15 16
16extern unsigned long va_to_phys(unsigned long address); 17extern unsigned long va_to_phys(unsigned long address);
17extern pte_t *va_to_pte(unsigned long address); 18extern pte_t *va_to_pte(unsigned long address);
diff --git a/include/asm-ppc/ppcboot.h b/include/asm-ppc/ppcboot.h
index fe24e4520208..6b7b63f71daa 100644
--- a/include/asm-ppc/ppcboot.h
+++ b/include/asm-ppc/ppcboot.h
@@ -73,8 +73,8 @@ typedef struct bd_info {
73#if defined(CONFIG_HYMOD) 73#if defined(CONFIG_HYMOD)
74 hymod_conf_t bi_hymod_conf; /* hymod configuration information */ 74 hymod_conf_t bi_hymod_conf; /* hymod configuration information */
75#endif 75#endif
76#if defined(CONFIG_EVB64260) || defined(CONFIG_44x) || defined(CONFIG_85xx) ||\ 76#if defined(CONFIG_EVB64260) || defined(CONFIG_405EP) || defined(CONFIG_44x) || \
77 defined(CONFIG_83xx) 77 defined(CONFIG_85xx) || defined(CONFIG_83xx)
78 /* second onboard ethernet port */ 78 /* second onboard ethernet port */
79 unsigned char bi_enet1addr[6]; 79 unsigned char bi_enet1addr[6];
80#endif 80#endif
@@ -96,5 +96,7 @@ typedef struct bd_info {
96#endif 96#endif
97} bd_t; 97} bd_t;
98 98
99#define bi_tbfreq bi_intfreq
100
99#endif /* __ASSEMBLY__ */ 101#endif /* __ASSEMBLY__ */
100#endif /* __ASM_PPCBOOT_H__ */ 102#endif /* __ASM_PPCBOOT_H__ */
diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h
deleted file mode 100644
index c34fb4e37a97..000000000000
--- a/include/asm-ppc/ptrace.h
+++ /dev/null
@@ -1,152 +0,0 @@
1#ifndef _PPC_PTRACE_H
2#define _PPC_PTRACE_H
3
4/*
5 * This struct defines the way the registers are stored on the
6 * kernel stack during a system call or other kernel entry.
7 *
8 * this should only contain volatile regs
9 * since we can keep non-volatile in the thread_struct
10 * should set this up when only volatiles are saved
11 * by intr code.
12 *
13 * Since this is going on the stack, *CARE MUST BE TAKEN* to insure
14 * that the overall structure is a multiple of 16 bytes in length.
15 *
16 * Note that the offsets of the fields in this struct correspond with
17 * the PT_* values below. This simplifies arch/ppc/kernel/ptrace.c.
18 */
19
20#ifndef __ASSEMBLY__
21struct pt_regs {
22 unsigned long gpr[32];
23 unsigned long nip;
24 unsigned long msr;
25 unsigned long orig_gpr3; /* Used for restarting system calls */
26 unsigned long ctr;
27 unsigned long link;
28 unsigned long xer;
29 unsigned long ccr;
30 unsigned long mq; /* 601 only (not used at present) */
31 /* Used on APUS to hold IPL value. */
32 unsigned long trap; /* Reason for being here */
33 /* N.B. for critical exceptions on 4xx, the dar and dsisr
34 fields are overloaded to hold srr0 and srr1. */
35 unsigned long dar; /* Fault registers */
36 unsigned long dsisr; /* on 4xx/Book-E used for ESR */
37 unsigned long result; /* Result of a system call */
38};
39
40#endif /* __ASSEMBLY__ */
41
42#ifdef __KERNEL__
43#define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */
44
45/* Size of stack frame allocated when calling signal handler. */
46#define __SIGNAL_FRAMESIZE 64
47
48#ifndef __ASSEMBLY__
49#define instruction_pointer(regs) ((regs)->nip)
50#ifdef CONFIG_SMP
51extern unsigned long profile_pc(struct pt_regs *regs);
52#else
53#define profile_pc(regs) instruction_pointer(regs)
54#endif
55
56#define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
57
58#define force_successful_syscall_return() \
59 do { \
60 current_thread_info()->syscall_noerror = 1; \
61 } while(0)
62
63/*
64 * We use the least-significant bit of the trap field to indicate
65 * whether we have saved the full set of registers, or only a
66 * partial set. A 1 there means the partial set.
67 * On 4xx we use the next bit to indicate whether the exception
68 * is a critical exception (1 means it is).
69 */
70#define FULL_REGS(regs) (((regs)->trap & 1) == 0)
71#define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) == 0)
72#define TRAP(regs) ((regs)->trap & ~0xF)
73
74#define CHECK_FULL_REGS(regs) \
75do { \
76 if ((regs)->trap & 1) \
77 printk(KERN_CRIT "%s: partial register set\n", __FUNCTION__); \
78} while (0)
79#endif /* __ASSEMBLY__ */
80
81#endif /* __KERNEL__ */
82
83/*
84 * Offsets used by 'ptrace' system call interface.
85 * These can't be changed without breaking binary compatibility
86 * with MkLinux, etc.
87 */
88#define PT_R0 0
89#define PT_R1 1
90#define PT_R2 2
91#define PT_R3 3
92#define PT_R4 4
93#define PT_R5 5
94#define PT_R6 6
95#define PT_R7 7
96#define PT_R8 8
97#define PT_R9 9
98#define PT_R10 10
99#define PT_R11 11
100#define PT_R12 12
101#define PT_R13 13
102#define PT_R14 14
103#define PT_R15 15
104#define PT_R16 16
105#define PT_R17 17
106#define PT_R18 18
107#define PT_R19 19
108#define PT_R20 20
109#define PT_R21 21
110#define PT_R22 22
111#define PT_R23 23
112#define PT_R24 24
113#define PT_R25 25
114#define PT_R26 26
115#define PT_R27 27
116#define PT_R28 28
117#define PT_R29 29
118#define PT_R30 30
119#define PT_R31 31
120
121#define PT_NIP 32
122#define PT_MSR 33
123#ifdef __KERNEL__
124#define PT_ORIG_R3 34
125#endif
126#define PT_CTR 35
127#define PT_LNK 36
128#define PT_XER 37
129#define PT_CCR 38
130#define PT_MQ 39
131
132#define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
133#define PT_FPR31 (PT_FPR0 + 2*31)
134#define PT_FPSCR (PT_FPR0 + 2*32 + 1)
135
136/* Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go */
137#define PTRACE_GETVRREGS 18
138#define PTRACE_SETVRREGS 19
139
140/* Get/set all the upper 32-bits of the SPE registers, accumulator, and
141 * spefscr, in one go */
142#define PTRACE_GETEVRREGS 20
143#define PTRACE_SETEVRREGS 21
144
145/*
146 * Get or set a debug register. The first 16 are DABR registers and the
147 * second 16 are IABR registers.
148 */
149#define PTRACE_GET_DEBUGREG 25
150#define PTRACE_SET_DEBUGREG 26
151
152#endif
diff --git a/include/asm-ppc/rio.h b/include/asm-ppc/rio.h
new file mode 100644
index 000000000000..0018bf80cb25
--- /dev/null
+++ b/include/asm-ppc/rio.h
@@ -0,0 +1,18 @@
1/*
2 * RapidIO architecture support
3 *
4 * Copyright 2005 MontaVista Software, Inc.
5 * Matt Porter <mporter@kernel.crashing.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef ASM_PPC_RIO_H
14#define ASM_PPC_RIO_H
15
16extern void platform_rio_init(void);
17
18#endif /* ASM_PPC_RIO_H */
diff --git a/include/asm-ppc/sigcontext.h b/include/asm-ppc/sigcontext.h
deleted file mode 100644
index b7a417e0a921..000000000000
--- a/include/asm-ppc/sigcontext.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASM_PPC_SIGCONTEXT_H
2#define _ASM_PPC_SIGCONTEXT_H
3
4#include <asm/ptrace.h>
5#include <linux/compiler.h>
6
7struct sigcontext {
8 unsigned long _unused[4];
9 int signal;
10 unsigned long handler;
11 unsigned long oldmask;
12 struct pt_regs __user *regs;
13};
14
15#endif
diff --git a/include/asm-ppc/stat.h b/include/asm-ppc/stat.h
deleted file mode 100644
index cadb34298496..000000000000
--- a/include/asm-ppc/stat.h
+++ /dev/null
@@ -1,69 +0,0 @@
1#ifndef _PPC_STAT_H
2#define _PPC_STAT_H
3
4#ifdef __KERNEL__
5#include <linux/types.h>
6#endif /* __KERNEL__ */
7
8struct __old_kernel_stat {
9 unsigned short st_dev;
10 unsigned short st_ino;
11 unsigned short st_mode;
12 unsigned short st_nlink;
13 unsigned short st_uid;
14 unsigned short st_gid;
15 unsigned short st_rdev;
16 unsigned long st_size;
17 unsigned long st_atime;
18 unsigned long st_mtime;
19 unsigned long st_ctime;
20};
21
22#define STAT_HAVE_NSEC 1
23
24struct stat {
25 unsigned st_dev;
26 ino_t st_ino;
27 mode_t st_mode;
28 nlink_t st_nlink;
29 uid_t st_uid;
30 gid_t st_gid;
31 unsigned st_rdev;
32 off_t st_size;
33 unsigned long st_blksize;
34 unsigned long st_blocks;
35 unsigned long st_atime;
36 unsigned long st_atime_nsec;
37 unsigned long st_mtime;
38 unsigned long st_mtime_nsec;
39 unsigned long st_ctime;
40 unsigned long st_ctime_nsec;
41 unsigned long __unused4;
42 unsigned long __unused5;
43};
44
45/* This matches struct stat64 in glibc2.1.
46 */
47struct stat64 {
48 unsigned long long st_dev; /* Device. */
49 unsigned long long st_ino; /* File serial number. */
50 unsigned int st_mode; /* File mode. */
51 unsigned int st_nlink; /* Link count. */
52 unsigned int st_uid; /* User ID of the file's owner. */
53 unsigned int st_gid; /* Group ID of the file's group. */
54 unsigned long long st_rdev; /* Device number, if device. */
55 unsigned short int __pad2;
56 long long st_size; /* Size of file, in bytes. */
57 long st_blksize; /* Optimal block size for I/O. */
58
59 long long st_blocks; /* Number 512-byte blocks allocated. */
60 long st_atime; /* Time of last access. */
61 unsigned long st_atime_nsec;
62 long st_mtime; /* Time of last modification. */
63 unsigned long int st_mtime_nsec;
64 long st_ctime; /* Time of last status change. */
65 unsigned long int st_ctime_nsec;
66 unsigned long int __unused4;
67 unsigned long int __unused5;
68};
69#endif
diff --git a/include/asm-ppc/tlbflush.h b/include/asm-ppc/tlbflush.h
deleted file mode 100644
index 9afee4ffc835..000000000000
--- a/include/asm-ppc/tlbflush.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 * include/asm-ppc/tlbflush.h
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifdef __KERNEL__
10#ifndef _PPC_TLBFLUSH_H
11#define _PPC_TLBFLUSH_H
12
13#include <linux/config.h>
14#include <linux/mm.h>
15
16extern void _tlbie(unsigned long address);
17extern void _tlbia(void);
18
19#if defined(CONFIG_4xx)
20
21#ifndef CONFIG_44x
22#define __tlbia() asm volatile ("sync; tlbia; isync" : : : "memory")
23#else
24#define __tlbia _tlbia
25#endif
26
27static inline void flush_tlb_mm(struct mm_struct *mm)
28 { __tlbia(); }
29static inline void flush_tlb_page(struct vm_area_struct *vma,
30 unsigned long vmaddr)
31 { _tlbie(vmaddr); }
32static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
33 unsigned long vmaddr)
34 { _tlbie(vmaddr); }
35static inline void flush_tlb_range(struct vm_area_struct *vma,
36 unsigned long start, unsigned long end)
37 { __tlbia(); }
38static inline void flush_tlb_kernel_range(unsigned long start,
39 unsigned long end)
40 { __tlbia(); }
41
42#elif defined(CONFIG_FSL_BOOKE)
43
44/* TODO: determine if flush_tlb_range & flush_tlb_kernel_range
45 * are best implemented as tlbia vs specific tlbie's */
46
47#define __tlbia() _tlbia()
48
49static inline void flush_tlb_mm(struct mm_struct *mm)
50 { __tlbia(); }
51static inline void flush_tlb_page(struct vm_area_struct *vma,
52 unsigned long vmaddr)
53 { _tlbie(vmaddr); }
54static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
55 unsigned long vmaddr)
56 { _tlbie(vmaddr); }
57static inline void flush_tlb_range(struct vm_area_struct *vma,
58 unsigned long start, unsigned long end)
59 { __tlbia(); }
60static inline void flush_tlb_kernel_range(unsigned long start,
61 unsigned long end)
62 { __tlbia(); }
63
64#elif defined(CONFIG_8xx)
65#define __tlbia() asm volatile ("tlbia; sync" : : : "memory")
66
67static inline void flush_tlb_mm(struct mm_struct *mm)
68 { __tlbia(); }
69static inline void flush_tlb_page(struct vm_area_struct *vma,
70 unsigned long vmaddr)
71 { _tlbie(vmaddr); }
72static inline void flush_tlb_page_nohash(struct vm_area_struct *vma,
73 unsigned long vmaddr)
74 { _tlbie(vmaddr); }
75static inline void flush_tlb_range(struct vm_area_struct *vma,
76 unsigned long start, unsigned long end)
77 { __tlbia(); }
78static inline void flush_tlb_kernel_range(unsigned long start,
79 unsigned long end)
80 { __tlbia(); }
81
82#else /* 6xx, 7xx, 7xxx cpus */
83struct mm_struct;
84struct vm_area_struct;
85extern void flush_tlb_mm(struct mm_struct *mm);
86extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
87extern void flush_tlb_page_nohash(struct vm_area_struct *vma, unsigned long addr);
88extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
89 unsigned long end);
90extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
91#endif
92
93/*
94 * This is called in munmap when we have freed up some page-table
95 * pages. We don't need to do anything here, there's nothing special
96 * about our page-table pages. -- paulus
97 */
98static inline void flush_tlb_pgtables(struct mm_struct *mm,
99 unsigned long start, unsigned long end)
100{
101}
102
103/*
104 * This gets called at the end of handling a page fault, when
105 * the kernel has put a new PTE into the page table for the process.
106 * We use it to ensure coherency between the i-cache and d-cache
107 * for the page which has just been mapped in.
108 * On machines which use an MMU hash table, we use this to put a
109 * corresponding HPTE into the hash table ahead of time, instead of
110 * waiting for the inevitable extra hash-table miss exception.
111 */
112extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
113
114#endif /* _PPC_TLBFLUSH_H */
115#endif /*__KERNEL__ */
diff --git a/include/asm-ppc/uaccess.h b/include/asm-ppc/uaccess.h
deleted file mode 100644
index 63f56224da8c..000000000000
--- a/include/asm-ppc/uaccess.h
+++ /dev/null
@@ -1,393 +0,0 @@
1#ifdef __KERNEL__
2#ifndef _PPC_UACCESS_H
3#define _PPC_UACCESS_H
4
5#ifndef __ASSEMBLY__
6#include <linux/sched.h>
7#include <linux/errno.h>
8#include <asm/processor.h>
9
10#define VERIFY_READ 0
11#define VERIFY_WRITE 1
12
13/*
14 * The fs value determines whether argument validity checking should be
15 * performed or not. If get_fs() == USER_DS, checking is performed, with
16 * get_fs() == KERNEL_DS, checking is bypassed.
17 *
18 * For historical reasons, these macros are grossly misnamed.
19 *
20 * The fs/ds values are now the highest legal address in the "segment".
21 * This simplifies the checking in the routines below.
22 */
23
24#define KERNEL_DS ((mm_segment_t) { ~0UL })
25#define USER_DS ((mm_segment_t) { TASK_SIZE - 1 })
26
27#define get_ds() (KERNEL_DS)
28#define get_fs() (current->thread.fs)
29#define set_fs(val) (current->thread.fs = (val))
30
31#define segment_eq(a,b) ((a).seg == (b).seg)
32
33#define __access_ok(addr,size) \
34 ((addr) <= current->thread.fs.seg \
35 && ((size) == 0 || (size) - 1 <= current->thread.fs.seg - (addr)))
36
37#define access_ok(type, addr, size) \
38 (__chk_user_ptr(addr),__access_ok((unsigned long)(addr),(size)))
39
40/*
41 * The exception table consists of pairs of addresses: the first is the
42 * address of an instruction that is allowed to fault, and the second is
43 * the address at which the program should continue. No registers are
44 * modified, so it is entirely up to the continuation code to figure out
45 * what to do.
46 *
47 * All the routines below use bits of fixup code that are out of line
48 * with the main instruction path. This means when everything is well,
49 * we don't even have to jump over them. Further, they do not intrude
50 * on our cache or tlb entries.
51 */
52
53struct exception_table_entry
54{
55 unsigned long insn, fixup;
56};
57
58/*
59 * These are the main single-value transfer routines. They automatically
60 * use the right size if we just have the right pointer type.
61 *
62 * This gets kind of ugly. We want to return _two_ values in "get_user()"
63 * and yet we don't want to do any pointers, because that is too much
64 * of a performance impact. Thus we have a few rather ugly macros here,
65 * and hide all the ugliness from the user.
66 *
67 * The "__xxx" versions of the user access functions are versions that
68 * do not verify the address space, that must have been done previously
69 * with a separate "access_ok()" call (this is used when we do multiple
70 * accesses to the same area of user memory).
71 *
72 * As we use the same address space for kernel and user data on the
73 * PowerPC, we can just do these as direct assignments. (Of course, the
74 * exception handling means that it's no longer "just"...)
75 *
76 * The "user64" versions of the user access functions are versions that
77 * allow access of 64-bit data. The "get_user" functions do not
78 * properly handle 64-bit data because the value gets down cast to a long.
79 * The "put_user" functions already handle 64-bit data properly but we add
80 * "user64" versions for completeness
81 */
82#define get_user(x,ptr) \
83 __get_user_check((x),(ptr),sizeof(*(ptr)))
84#define get_user64(x,ptr) \
85 __get_user64_check((x),(ptr),sizeof(*(ptr)))
86#define put_user(x,ptr) \
87 __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
88#define put_user64(x,ptr) put_user(x,ptr)
89
90#define __get_user(x,ptr) \
91 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
92#define __get_user64(x,ptr) \
93 __get_user64_nocheck((x),(ptr),sizeof(*(ptr)))
94#define __put_user(x,ptr) \
95 __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
96#define __put_user64(x,ptr) __put_user(x,ptr)
97
98extern long __put_user_bad(void);
99
100#define __put_user_nocheck(x,ptr,size) \
101({ \
102 long __pu_err; \
103 __chk_user_ptr(ptr); \
104 __put_user_size((x),(ptr),(size),__pu_err); \
105 __pu_err; \
106})
107
108#define __put_user_check(x,ptr,size) \
109({ \
110 long __pu_err = -EFAULT; \
111 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \
112 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
113 __put_user_size((x),__pu_addr,(size),__pu_err); \
114 __pu_err; \
115})
116
117#define __put_user_size(x,ptr,size,retval) \
118do { \
119 retval = 0; \
120 switch (size) { \
121 case 1: \
122 __put_user_asm(x, ptr, retval, "stb"); \
123 break; \
124 case 2: \
125 __put_user_asm(x, ptr, retval, "sth"); \
126 break; \
127 case 4: \
128 __put_user_asm(x, ptr, retval, "stw"); \
129 break; \
130 case 8: \
131 __put_user_asm2(x, ptr, retval); \
132 break; \
133 default: \
134 __put_user_bad(); \
135 } \
136} while (0)
137
138/*
139 * We don't tell gcc that we are accessing memory, but this is OK
140 * because we do not write to any memory gcc knows about, so there
141 * are no aliasing issues.
142 */
143#define __put_user_asm(x, addr, err, op) \
144 __asm__ __volatile__( \
145 "1: "op" %1,0(%2)\n" \
146 "2:\n" \
147 ".section .fixup,\"ax\"\n" \
148 "3: li %0,%3\n" \
149 " b 2b\n" \
150 ".previous\n" \
151 ".section __ex_table,\"a\"\n" \
152 " .align 2\n" \
153 " .long 1b,3b\n" \
154 ".previous" \
155 : "=r" (err) \
156 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
157
158#define __put_user_asm2(x, addr, err) \
159 __asm__ __volatile__( \
160 "1: stw %1,0(%2)\n" \
161 "2: stw %1+1,4(%2)\n" \
162 "3:\n" \
163 ".section .fixup,\"ax\"\n" \
164 "4: li %0,%3\n" \
165 " b 3b\n" \
166 ".previous\n" \
167 ".section __ex_table,\"a\"\n" \
168 " .align 2\n" \
169 " .long 1b,4b\n" \
170 " .long 2b,4b\n" \
171 ".previous" \
172 : "=r" (err) \
173 : "r" (x), "b" (addr), "i" (-EFAULT), "0" (err))
174
175#define __get_user_nocheck(x, ptr, size) \
176({ \
177 long __gu_err; \
178 unsigned long __gu_val; \
179 __chk_user_ptr(ptr); \
180 __get_user_size(__gu_val, (ptr), (size), __gu_err); \
181 (x) = (__typeof__(*(ptr)))__gu_val; \
182 __gu_err; \
183})
184
185#define __get_user64_nocheck(x, ptr, size) \
186({ \
187 long __gu_err; \
188 long long __gu_val; \
189 __chk_user_ptr(ptr); \
190 __get_user_size64(__gu_val, (ptr), (size), __gu_err); \
191 (x) = (__typeof__(*(ptr)))__gu_val; \
192 __gu_err; \
193})
194
195#define __get_user_check(x, ptr, size) \
196({ \
197 long __gu_err = -EFAULT; \
198 unsigned long __gu_val = 0; \
199 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
200 if (access_ok(VERIFY_READ, __gu_addr, (size))) \
201 __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
202 (x) = (__typeof__(*(ptr)))__gu_val; \
203 __gu_err; \
204})
205
206#define __get_user64_check(x, ptr, size) \
207({ \
208 long __gu_err = -EFAULT; \
209 long long __gu_val = 0; \
210 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
211 if (access_ok(VERIFY_READ, __gu_addr, (size))) \
212 __get_user_size64(__gu_val, __gu_addr, (size), __gu_err); \
213 (x) = (__typeof__(*(ptr)))__gu_val; \
214 __gu_err; \
215})
216
217extern long __get_user_bad(void);
218
219#define __get_user_size(x, ptr, size, retval) \
220do { \
221 retval = 0; \
222 switch (size) { \
223 case 1: \
224 __get_user_asm(x, ptr, retval, "lbz"); \
225 break; \
226 case 2: \
227 __get_user_asm(x, ptr, retval, "lhz"); \
228 break; \
229 case 4: \
230 __get_user_asm(x, ptr, retval, "lwz"); \
231 break; \
232 default: \
233 x = __get_user_bad(); \
234 } \
235} while (0)
236
237#define __get_user_size64(x, ptr, size, retval) \
238do { \
239 retval = 0; \
240 switch (size) { \
241 case 1: \
242 __get_user_asm(x, ptr, retval, "lbz"); \
243 break; \
244 case 2: \
245 __get_user_asm(x, ptr, retval, "lhz"); \
246 break; \
247 case 4: \
248 __get_user_asm(x, ptr, retval, "lwz"); \
249 break; \
250 case 8: \
251 __get_user_asm2(x, ptr, retval); \
252 break; \
253 default: \
254 x = __get_user_bad(); \
255 } \
256} while (0)
257
258#define __get_user_asm(x, addr, err, op) \
259 __asm__ __volatile__( \
260 "1: "op" %1,0(%2)\n" \
261 "2:\n" \
262 ".section .fixup,\"ax\"\n" \
263 "3: li %0,%3\n" \
264 " li %1,0\n" \
265 " b 2b\n" \
266 ".previous\n" \
267 ".section __ex_table,\"a\"\n" \
268 " .align 2\n" \
269 " .long 1b,3b\n" \
270 ".previous" \
271 : "=r"(err), "=r"(x) \
272 : "b"(addr), "i"(-EFAULT), "0"(err))
273
274#define __get_user_asm2(x, addr, err) \
275 __asm__ __volatile__( \
276 "1: lwz %1,0(%2)\n" \
277 "2: lwz %1+1,4(%2)\n" \
278 "3:\n" \
279 ".section .fixup,\"ax\"\n" \
280 "4: li %0,%3\n" \
281 " li %1,0\n" \
282 " li %1+1,0\n" \
283 " b 3b\n" \
284 ".previous\n" \
285 ".section __ex_table,\"a\"\n" \
286 " .align 2\n" \
287 " .long 1b,4b\n" \
288 " .long 2b,4b\n" \
289 ".previous" \
290 : "=r"(err), "=&r"(x) \
291 : "b"(addr), "i"(-EFAULT), "0"(err))
292
293/* more complex routines */
294
295extern int __copy_tofrom_user(void __user *to, const void __user *from,
296 unsigned long size);
297
298extern inline unsigned long
299copy_from_user(void *to, const void __user *from, unsigned long n)
300{
301 unsigned long over;
302
303 if (access_ok(VERIFY_READ, from, n))
304 return __copy_tofrom_user((__force void __user *)to, from, n);
305 if ((unsigned long)from < TASK_SIZE) {
306 over = (unsigned long)from + n - TASK_SIZE;
307 return __copy_tofrom_user((__force void __user *)to, from, n - over) + over;
308 }
309 return n;
310}
311
312extern inline unsigned long
313copy_to_user(void __user *to, const void *from, unsigned long n)
314{
315 unsigned long over;
316
317 if (access_ok(VERIFY_WRITE, to, n))
318 return __copy_tofrom_user(to, (__force void __user *) from, n);
319 if ((unsigned long)to < TASK_SIZE) {
320 over = (unsigned long)to + n - TASK_SIZE;
321 return __copy_tofrom_user(to, (__force void __user *) from, n - over) + over;
322 }
323 return n;
324}
325
326static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long size)
327{
328 return __copy_tofrom_user((__force void __user *)to, from, size);
329}
330
331static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long size)
332{
333 return __copy_tofrom_user(to, (__force void __user *)from, size);
334}
335
336#define __copy_to_user_inatomic __copy_to_user
337#define __copy_from_user_inatomic __copy_from_user
338
339extern unsigned long __clear_user(void __user *addr, unsigned long size);
340
341extern inline unsigned long
342clear_user(void __user *addr, unsigned long size)
343{
344 if (access_ok(VERIFY_WRITE, addr, size))
345 return __clear_user(addr, size);
346 if ((unsigned long)addr < TASK_SIZE) {
347 unsigned long over = (unsigned long)addr + size - TASK_SIZE;
348 return __clear_user(addr, size - over) + over;
349 }
350 return size;
351}
352
353extern int __strncpy_from_user(char *dst, const char __user *src, long count);
354
355extern inline long
356strncpy_from_user(char *dst, const char __user *src, long count)
357{
358 if (access_ok(VERIFY_READ, src, 1))
359 return __strncpy_from_user(dst, src, count);
360 return -EFAULT;
361}
362
363/*
364 * Return the size of a string (including the ending 0)
365 *
366 * Return 0 for error
367 */
368
369extern int __strnlen_user(const char __user *str, long len, unsigned long top);
370
371/*
372 * Returns the length of the string at str (including the null byte),
373 * or 0 if we hit a page we can't access,
374 * or something > len if we didn't find a null byte.
375 *
376 * The `top' parameter to __strnlen_user is to make sure that
377 * we can never overflow from the user area into kernel space.
378 */
379extern __inline__ int strnlen_user(const char __user *str, long len)
380{
381 unsigned long top = current->thread.fs.seg;
382
383 if ((unsigned long)str > top)
384 return 0;
385 return __strnlen_user(str, len, top);
386}
387
388#define strlen_user(str) strnlen_user((str), 0x7ffffffe)
389
390#endif /* __ASSEMBLY__ */
391
392#endif /* _PPC_UACCESS_H */
393#endif /* __KERNEL__ */
diff --git a/include/asm-ppc/ucontext.h b/include/asm-ppc/ucontext.h
deleted file mode 100644
index 664bc984d51f..000000000000
--- a/include/asm-ppc/ucontext.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _ASMPPC_UCONTEXT_H
2#define _ASMPPC_UCONTEXT_H
3
4#include <asm/elf.h>
5#include <asm/signal.h>
6
7struct mcontext {
8 elf_gregset_t mc_gregs;
9 elf_fpregset_t mc_fregs;
10 unsigned long mc_pad[2];
11 elf_vrregset_t mc_vregs __attribute__((__aligned__(16)));
12};
13
14struct ucontext {
15 unsigned long uc_flags;
16 struct ucontext __user *uc_link;
17 stack_t uc_stack;
18 int uc_pad[7];
19 struct mcontext __user *uc_regs;/* points to uc_mcontext field */
20 sigset_t uc_sigmask;
21 /* glibc has 1024-bit signal masks, ours are 64-bit */
22 int uc_maskext[30];
23 int uc_pad2[3];
24 struct mcontext uc_mcontext;
25};
26
27#endif /* !_ASMPPC_UCONTEXT_H */
diff --git a/include/asm-ppc64/bitops.h b/include/asm-ppc64/bitops.h
deleted file mode 100644
index dbfa42ef4a99..000000000000
--- a/include/asm-ppc64/bitops.h
+++ /dev/null
@@ -1,360 +0,0 @@
1/*
2 * PowerPC64 atomic bit operations.
3 * Dave Engebretsen, Todd Inglett, Don Reed, Pat McCarthy, Peter Bergner,
4 * Anton Blanchard
5 *
6 * Originally taken from the 32b PPC code. Modified to use 64b values for
7 * the various counters & memory references.
8 *
9 * Bitops are odd when viewed on big-endian systems. They were designed
10 * on little endian so the size of the bitset doesn't matter (low order bytes
11 * come first) as long as the bit in question is valid.
12 *
13 * Bits are "tested" often using the C expression (val & (1<<nr)) so we do
14 * our best to stay compatible with that. The assumption is that val will
15 * be unsigned long for such tests. As such, we assume the bits are stored
16 * as an array of unsigned long (the usual case is a single unsigned long,
17 * of course). Here's an example bitset with bit numbering:
18 *
19 * |63..........0|127........64|195.......128|255.......196|
20 *
21 * This leads to a problem. If an int, short or char is passed as a bitset
22 * it will be a bad memory reference since we want to store in chunks
23 * of unsigned long (64 bits here) size.
24 *
25 * There are a few little-endian macros used mostly for filesystem bitmaps,
26 * these work on similar bit arrays layouts, but byte-oriented:
27 *
28 * |7...0|15...8|23...16|31...24|39...32|47...40|55...48|63...56|
29 *
30 * The main difference is that bit 3-5 in the bit number field needs to be
31 * reversed compared to the big-endian bit fields. This can be achieved
32 * by XOR with 0b111000 (0x38).
33 *
34 * This program is free software; you can redistribute it and/or
35 * modify it under the terms of the GNU General Public License
36 * as published by the Free Software Foundation; either version
37 * 2 of the License, or (at your option) any later version.
38 */
39
40#ifndef _PPC64_BITOPS_H
41#define _PPC64_BITOPS_H
42
43#ifdef __KERNEL__
44
45#include <asm/synch.h>
46
47/*
48 * clear_bit doesn't imply a memory barrier
49 */
50#define smp_mb__before_clear_bit() smp_mb()
51#define smp_mb__after_clear_bit() smp_mb()
52
53static __inline__ int test_bit(unsigned long nr, __const__ volatile unsigned long *addr)
54{
55 return (1UL & (addr[nr >> 6] >> (nr & 63)));
56}
57
58static __inline__ void set_bit(unsigned long nr, volatile unsigned long *addr)
59{
60 unsigned long old;
61 unsigned long mask = 1UL << (nr & 0x3f);
62 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
63
64 __asm__ __volatile__(
65"1: ldarx %0,0,%3 # set_bit\n\
66 or %0,%0,%2\n\
67 stdcx. %0,0,%3\n\
68 bne- 1b"
69 : "=&r" (old), "=m" (*p)
70 : "r" (mask), "r" (p), "m" (*p)
71 : "cc");
72}
73
74static __inline__ void clear_bit(unsigned long nr, volatile unsigned long *addr)
75{
76 unsigned long old;
77 unsigned long mask = 1UL << (nr & 0x3f);
78 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
79
80 __asm__ __volatile__(
81"1: ldarx %0,0,%3 # clear_bit\n\
82 andc %0,%0,%2\n\
83 stdcx. %0,0,%3\n\
84 bne- 1b"
85 : "=&r" (old), "=m" (*p)
86 : "r" (mask), "r" (p), "m" (*p)
87 : "cc");
88}
89
90static __inline__ void change_bit(unsigned long nr, volatile unsigned long *addr)
91{
92 unsigned long old;
93 unsigned long mask = 1UL << (nr & 0x3f);
94 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
95
96 __asm__ __volatile__(
97"1: ldarx %0,0,%3 # change_bit\n\
98 xor %0,%0,%2\n\
99 stdcx. %0,0,%3\n\
100 bne- 1b"
101 : "=&r" (old), "=m" (*p)
102 : "r" (mask), "r" (p), "m" (*p)
103 : "cc");
104}
105
106static __inline__ int test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
107{
108 unsigned long old, t;
109 unsigned long mask = 1UL << (nr & 0x3f);
110 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
111
112 __asm__ __volatile__(
113 EIEIO_ON_SMP
114"1: ldarx %0,0,%3 # test_and_set_bit\n\
115 or %1,%0,%2 \n\
116 stdcx. %1,0,%3 \n\
117 bne- 1b"
118 ISYNC_ON_SMP
119 : "=&r" (old), "=&r" (t)
120 : "r" (mask), "r" (p)
121 : "cc", "memory");
122
123 return (old & mask) != 0;
124}
125
126static __inline__ int test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
127{
128 unsigned long old, t;
129 unsigned long mask = 1UL << (nr & 0x3f);
130 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
131
132 __asm__ __volatile__(
133 EIEIO_ON_SMP
134"1: ldarx %0,0,%3 # test_and_clear_bit\n\
135 andc %1,%0,%2\n\
136 stdcx. %1,0,%3\n\
137 bne- 1b"
138 ISYNC_ON_SMP
139 : "=&r" (old), "=&r" (t)
140 : "r" (mask), "r" (p)
141 : "cc", "memory");
142
143 return (old & mask) != 0;
144}
145
146static __inline__ int test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
147{
148 unsigned long old, t;
149 unsigned long mask = 1UL << (nr & 0x3f);
150 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
151
152 __asm__ __volatile__(
153 EIEIO_ON_SMP
154"1: ldarx %0,0,%3 # test_and_change_bit\n\
155 xor %1,%0,%2\n\
156 stdcx. %1,0,%3\n\
157 bne- 1b"
158 ISYNC_ON_SMP
159 : "=&r" (old), "=&r" (t)
160 : "r" (mask), "r" (p)
161 : "cc", "memory");
162
163 return (old & mask) != 0;
164}
165
166static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
167{
168 unsigned long old;
169
170 __asm__ __volatile__(
171"1: ldarx %0,0,%3 # set_bit\n\
172 or %0,%0,%2\n\
173 stdcx. %0,0,%3\n\
174 bne- 1b"
175 : "=&r" (old), "=m" (*addr)
176 : "r" (mask), "r" (addr), "m" (*addr)
177 : "cc");
178}
179
180/*
181 * non-atomic versions
182 */
183static __inline__ void __set_bit(unsigned long nr, volatile unsigned long *addr)
184{
185 unsigned long mask = 1UL << (nr & 0x3f);
186 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
187
188 *p |= mask;
189}
190
191static __inline__ void __clear_bit(unsigned long nr, volatile unsigned long *addr)
192{
193 unsigned long mask = 1UL << (nr & 0x3f);
194 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
195
196 *p &= ~mask;
197}
198
199static __inline__ void __change_bit(unsigned long nr, volatile unsigned long *addr)
200{
201 unsigned long mask = 1UL << (nr & 0x3f);
202 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
203
204 *p ^= mask;
205}
206
207static __inline__ int __test_and_set_bit(unsigned long nr, volatile unsigned long *addr)
208{
209 unsigned long mask = 1UL << (nr & 0x3f);
210 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
211 unsigned long old = *p;
212
213 *p = old | mask;
214 return (old & mask) != 0;
215}
216
217static __inline__ int __test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
218{
219 unsigned long mask = 1UL << (nr & 0x3f);
220 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
221 unsigned long old = *p;
222
223 *p = old & ~mask;
224 return (old & mask) != 0;
225}
226
227static __inline__ int __test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
228{
229 unsigned long mask = 1UL << (nr & 0x3f);
230 unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
231 unsigned long old = *p;
232
233 *p = old ^ mask;
234 return (old & mask) != 0;
235}
236
237/*
238 * Return the zero-based bit position (from RIGHT TO LEFT, 63 -> 0) of the
239 * most significant (left-most) 1-bit in a double word.
240 */
241static __inline__ int __ilog2(unsigned long x)
242{
243 int lz;
244
245 asm ("cntlzd %0,%1" : "=r" (lz) : "r" (x));
246 return 63 - lz;
247}
248
249/*
250 * Determines the bit position of the least significant (rightmost) 0 bit
251 * in the specified double word. The returned bit position will be zero-based,
252 * starting from the right side (63 - 0).
253 */
254static __inline__ unsigned long ffz(unsigned long x)
255{
256 /* no zero exists anywhere in the 8 byte area. */
257 if ((x = ~x) == 0)
258 return 64;
259
260 /*
261 * Calculate the bit position of the least signficant '1' bit in x
262 * (since x has been changed this will actually be the least signficant
263 * '0' bit in * the original x). Note: (x & -x) gives us a mask that
264 * is the least significant * (RIGHT-most) 1-bit of the value in x.
265 */
266 return __ilog2(x & -x);
267}
268
269static __inline__ int __ffs(unsigned long x)
270{
271 return __ilog2(x & -x);
272}
273
274/*
275 * ffs: find first bit set. This is defined the same way as
276 * the libc and compiler builtin ffs routines, therefore
277 * differs in spirit from the above ffz (man ffs).
278 */
279static __inline__ int ffs(int x)
280{
281 unsigned long i = (unsigned long)x;
282 return __ilog2(i & -i) + 1;
283}
284
285/*
286 * fls: find last (most-significant) bit set.
287 * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
288 */
289#define fls(x) generic_fls(x)
290
291/*
292 * hweightN: returns the hamming weight (i.e. the number
293 * of bits set) of a N-bit word
294 */
295#define hweight64(x) generic_hweight64(x)
296#define hweight32(x) generic_hweight32(x)
297#define hweight16(x) generic_hweight16(x)
298#define hweight8(x) generic_hweight8(x)
299
300extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, unsigned long offset);
301#define find_first_zero_bit(addr, size) \
302 find_next_zero_bit((addr), (size), 0)
303
304extern unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset);
305#define find_first_bit(addr, size) \
306 find_next_bit((addr), (size), 0)
307
308extern unsigned long find_next_zero_le_bit(const unsigned long *addr, unsigned long size, unsigned long offset);
309#define find_first_zero_le_bit(addr, size) \
310 find_next_zero_le_bit((addr), (size), 0)
311
312static __inline__ int test_le_bit(unsigned long nr, __const__ unsigned long * addr)
313{
314 __const__ unsigned char *ADDR = (__const__ unsigned char *) addr;
315 return (ADDR[nr >> 3] >> (nr & 7)) & 1;
316}
317
318#define test_and_clear_le_bit(nr, addr) \
319 test_and_clear_bit((nr) ^ 0x38, (addr))
320#define test_and_set_le_bit(nr, addr) \
321 test_and_set_bit((nr) ^ 0x38, (addr))
322
323/*
324 * non-atomic versions
325 */
326
327#define __set_le_bit(nr, addr) \
328 __set_bit((nr) ^ 0x38, (addr))
329#define __clear_le_bit(nr, addr) \
330 __clear_bit((nr) ^ 0x38, (addr))
331#define __test_and_clear_le_bit(nr, addr) \
332 __test_and_clear_bit((nr) ^ 0x38, (addr))
333#define __test_and_set_le_bit(nr, addr) \
334 __test_and_set_bit((nr) ^ 0x38, (addr))
335
336#define ext2_set_bit(nr,addr) \
337 __test_and_set_le_bit((nr), (unsigned long*)addr)
338#define ext2_clear_bit(nr, addr) \
339 __test_and_clear_le_bit((nr), (unsigned long*)addr)
340
341#define ext2_set_bit_atomic(lock, nr, addr) \
342 test_and_set_le_bit((nr), (unsigned long*)addr)
343#define ext2_clear_bit_atomic(lock, nr, addr) \
344 test_and_clear_le_bit((nr), (unsigned long*)addr)
345
346
347#define ext2_test_bit(nr, addr) test_le_bit((nr),(unsigned long*)addr)
348#define ext2_find_first_zero_bit(addr, size) \
349 find_first_zero_le_bit((unsigned long*)addr, size)
350#define ext2_find_next_zero_bit(addr, size, off) \
351 find_next_zero_le_bit((unsigned long*)addr, size, off)
352
353#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
354#define minix_set_bit(nr,addr) set_bit(nr,addr)
355#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
356#define minix_test_bit(nr,addr) test_bit(nr,addr)
357#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
358
359#endif /* __KERNEL__ */
360#endif /* _PPC64_BITOPS_H */
diff --git a/include/asm-ppc64/dart.h b/include/asm-ppc64/dart.h
deleted file mode 100644
index cdf8a2dec05f..000000000000
--- a/include/asm-ppc64/dart.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Copyright (C) 2004 Olof Johansson <olof@austin.ibm.com>, IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef _ASM_DART_H
20#define _ASM_DART_H
21
22
23/* physical base of DART registers */
24#define DART_BASE 0xf8033000UL
25
26/* Offset from base to control register */
27#define DARTCNTL 0
28/* Offset from base to exception register */
29#define DARTEXCP 0x10
30/* Offset from base to TLB tag registers */
31#define DARTTAG 0x1000
32
33
34/* Control Register fields */
35
36/* base address of table (pfn) */
37#define DARTCNTL_BASE_MASK 0xfffff
38#define DARTCNTL_BASE_SHIFT 12
39
40#define DARTCNTL_FLUSHTLB 0x400
41#define DARTCNTL_ENABLE 0x200
42
43/* size of table in pages */
44#define DARTCNTL_SIZE_MASK 0x1ff
45#define DARTCNTL_SIZE_SHIFT 0
46
47
48/* DART table fields */
49
50#define DARTMAP_VALID 0x80000000
51#define DARTMAP_RPNMASK 0x00ffffff
52
53
54#define DART_PAGE_SHIFT 12
55#define DART_PAGE_SIZE (1 << DART_PAGE_SHIFT)
56#define DART_PAGE_FACTOR (PAGE_SHIFT - DART_PAGE_SHIFT)
57
58
59#endif
diff --git a/include/asm-ppc64/io.h b/include/asm-ppc64/io.h
index bd7c9532d77b..77fc07c3c6bd 100644
--- a/include/asm-ppc64/io.h
+++ b/include/asm-ppc64/io.h
@@ -13,7 +13,7 @@
13#include <asm/page.h> 13#include <asm/page.h>
14#include <asm/byteorder.h> 14#include <asm/byteorder.h>
15#ifdef CONFIG_PPC_ISERIES 15#ifdef CONFIG_PPC_ISERIES
16#include <asm/iSeries/iSeries_io.h> 16#include <asm/iseries/iseries_io.h>
17#endif 17#endif
18#include <asm/synch.h> 18#include <asm/synch.h>
19#include <asm/delay.h> 19#include <asm/delay.h>
diff --git a/include/asm-ppc64/ipcbuf.h b/include/asm-ppc64/ipcbuf.h
deleted file mode 100644
index fa393c8342af..000000000000
--- a/include/asm-ppc64/ipcbuf.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef __PPC64_IPCBUF_H__
2#define __PPC64_IPCBUF_H__
3
4/*
5 * The ipc64_perm structure for the PPC is identical to kern_ipc_perm
6 * as we have always had 32-bit UIDs and GIDs in the kernel.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid_t uid;
18 __kernel_gid_t gid;
19 __kernel_uid_t cuid;
20 __kernel_gid_t cgid;
21 __kernel_mode_t mode;
22 unsigned int seq;
23 unsigned int __pad1;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* __PPC64_IPCBUF_H__ */
diff --git a/include/asm-ppc64/kexec.h b/include/asm-ppc64/kexec.h
deleted file mode 100644
index 511908afaeeb..000000000000
--- a/include/asm-ppc64/kexec.h
+++ /dev/null
@@ -1,41 +0,0 @@
1#ifndef _PPC64_KEXEC_H
2#define _PPC64_KEXEC_H
3
4/*
5 * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
6 * I.e. Maximum page that is mapped directly into kernel memory,
7 * and kmap is not required.
8 */
9
10/* Maximum physical address we can use pages from */
11/* XXX: since we copy virt we can use any page we allocate */
12#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
13
14/* Maximum address we can reach in physical address mode */
15/* XXX: I want to allow initrd in highmem. otherwise set to rmo on lpar */
16#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
17
18/* Maximum address we can use for the control code buffer */
19/* XXX: unused today, ppc32 uses TASK_SIZE, probably left over from use_mm */
20#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
21
22/* XXX: today we don't use this at all, althogh we have a static stack */
23#define KEXEC_CONTROL_CODE_SIZE 4096
24
25/* The native architecture */
26#define KEXEC_ARCH KEXEC_ARCH_PPC64
27
28#define MAX_NOTE_BYTES 1024
29
30#ifndef __ASSEMBLY__
31
32typedef u32 note_buf_t[MAX_NOTE_BYTES/4];
33
34extern note_buf_t crash_notes[];
35
36extern void kexec_smp_wait(void); /* get and clear naca physid, wait for
37 master to copy new code to 0 */
38
39#endif /* __ASSEMBLY__ */
40#endif /* _PPC_KEXEC_H */
41
diff --git a/include/asm-ppc64/mmu.h b/include/asm-ppc64/mmu.h
index e0505acb77d9..4c18a5cb69f5 100644
--- a/include/asm-ppc64/mmu.h
+++ b/include/asm-ppc64/mmu.h
@@ -48,13 +48,21 @@ extern char initial_stab[];
48 48
49/* Bits in the SLB VSID word */ 49/* Bits in the SLB VSID word */
50#define SLB_VSID_SHIFT 12 50#define SLB_VSID_SHIFT 12
51#define SLB_VSID_B ASM_CONST(0xc000000000000000)
52#define SLB_VSID_B_256M ASM_CONST(0x0000000000000000)
53#define SLB_VSID_B_1T ASM_CONST(0x4000000000000000)
51#define SLB_VSID_KS ASM_CONST(0x0000000000000800) 54#define SLB_VSID_KS ASM_CONST(0x0000000000000800)
52#define SLB_VSID_KP ASM_CONST(0x0000000000000400) 55#define SLB_VSID_KP ASM_CONST(0x0000000000000400)
53#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */ 56#define SLB_VSID_N ASM_CONST(0x0000000000000200) /* no-execute */
54#define SLB_VSID_L ASM_CONST(0x0000000000000100) /* largepage */ 57#define SLB_VSID_L ASM_CONST(0x0000000000000100)
55#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */ 58#define SLB_VSID_C ASM_CONST(0x0000000000000080) /* class */
56#define SLB_VSID_LS ASM_CONST(0x0000000000000070) /* size of largepage */ 59#define SLB_VSID_LP ASM_CONST(0x0000000000000030)
57 60#define SLB_VSID_LP_00 ASM_CONST(0x0000000000000000)
61#define SLB_VSID_LP_01 ASM_CONST(0x0000000000000010)
62#define SLB_VSID_LP_10 ASM_CONST(0x0000000000000020)
63#define SLB_VSID_LP_11 ASM_CONST(0x0000000000000030)
64#define SLB_VSID_LLP (SLB_VSID_L|SLB_VSID_LP)
65
58#define SLB_VSID_KERNEL (SLB_VSID_KP) 66#define SLB_VSID_KERNEL (SLB_VSID_KP)
59#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C) 67#define SLB_VSID_USER (SLB_VSID_KP|SLB_VSID_KS|SLB_VSID_C)
60 68
@@ -69,6 +77,7 @@ extern char initial_stab[];
69#define HPTE_V_AVPN_SHIFT 7 77#define HPTE_V_AVPN_SHIFT 7
70#define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80) 78#define HPTE_V_AVPN ASM_CONST(0xffffffffffffff80)
71#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT) 79#define HPTE_V_AVPN_VAL(x) (((x) & HPTE_V_AVPN) >> HPTE_V_AVPN_SHIFT)
80#define HPTE_V_COMPARE(x,y) (!(((x) ^ (y)) & HPTE_V_AVPN))
72#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010) 81#define HPTE_V_BOLTED ASM_CONST(0x0000000000000010)
73#define HPTE_V_LOCK ASM_CONST(0x0000000000000008) 82#define HPTE_V_LOCK ASM_CONST(0x0000000000000008)
74#define HPTE_V_LARGE ASM_CONST(0x0000000000000004) 83#define HPTE_V_LARGE ASM_CONST(0x0000000000000004)
@@ -81,6 +90,7 @@ extern char initial_stab[];
81#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000) 90#define HPTE_R_RPN ASM_CONST(0x3ffffffffffff000)
82#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff) 91#define HPTE_R_FLAGS ASM_CONST(0x00000000000003ff)
83#define HPTE_R_PP ASM_CONST(0x0000000000000003) 92#define HPTE_R_PP ASM_CONST(0x0000000000000003)
93#define HPTE_R_N ASM_CONST(0x0000000000000004)
84 94
85/* Values for PP (assumes Ks=0, Kp=1) */ 95/* Values for PP (assumes Ks=0, Kp=1) */
86/* pp0 will always be 0 for linux */ 96/* pp0 will always be 0 for linux */
@@ -99,100 +109,120 @@ typedef struct {
99extern hpte_t *htab_address; 109extern hpte_t *htab_address;
100extern unsigned long htab_hash_mask; 110extern unsigned long htab_hash_mask;
101 111
102static inline unsigned long hpt_hash(unsigned long vpn, int large) 112/*
113 * Page size definition
114 *
115 * shift : is the "PAGE_SHIFT" value for that page size
116 * sllp : is a bit mask with the value of SLB L || LP to be or'ed
117 * directly to a slbmte "vsid" value
118 * penc : is the HPTE encoding mask for the "LP" field:
119 *
120 */
121struct mmu_psize_def
103{ 122{
104 unsigned long vsid; 123 unsigned int shift; /* number of bits */
105 unsigned long page; 124 unsigned int penc; /* HPTE encoding */
106 125 unsigned int tlbiel; /* tlbiel supported for that page size */
107 if (large) { 126 unsigned long avpnm; /* bits to mask out in AVPN in the HPTE */
108 vsid = vpn >> 4; 127 unsigned long sllp; /* SLB L||LP (exact mask to use in slbmte) */
109 page = vpn & 0xf; 128};
110 } else {
111 vsid = vpn >> 16;
112 page = vpn & 0xffff;
113 }
114 129
115 return (vsid & 0x7fffffffffUL) ^ page; 130#endif /* __ASSEMBLY__ */
116}
117
118static inline void __tlbie(unsigned long va, int large)
119{
120 /* clear top 16 bits, non SLS segment */
121 va &= ~(0xffffULL << 48);
122
123 if (large) {
124 va &= HPAGE_MASK;
125 asm volatile("tlbie %0,1" : : "r"(va) : "memory");
126 } else {
127 va &= PAGE_MASK;
128 asm volatile("tlbie %0,0" : : "r"(va) : "memory");
129 }
130}
131 131
132static inline void tlbie(unsigned long va, int large) 132/*
133{ 133 * The kernel use the constants below to index in the page sizes array.
134 asm volatile("ptesync": : :"memory"); 134 * The use of fixed constants for this purpose is better for performances
135 __tlbie(va, large); 135 * of the low level hash refill handlers.
136 asm volatile("eieio; tlbsync; ptesync": : :"memory"); 136 *
137} 137 * A non supported page size has a "shift" field set to 0
138 *
139 * Any new page size being implemented can get a new entry in here. Whether
140 * the kernel will use it or not is a different matter though. The actual page
141 * size used by hugetlbfs is not defined here and may be made variable
142 */
138 143
139static inline void __tlbiel(unsigned long va) 144#define MMU_PAGE_4K 0 /* 4K */
140{ 145#define MMU_PAGE_64K 1 /* 64K */
141 /* clear top 16 bits, non SLS segment */ 146#define MMU_PAGE_64K_AP 2 /* 64K Admixed (in a 4K segment) */
142 va &= ~(0xffffULL << 48); 147#define MMU_PAGE_1M 3 /* 1M */
143 va &= PAGE_MASK; 148#define MMU_PAGE_16M 4 /* 16M */
144 149#define MMU_PAGE_16G 5 /* 16G */
145 /* 150#define MMU_PAGE_COUNT 6
146 * Thanks to Alan Modra we are now able to use machine specific
147 * assembly instructions (like tlbiel) by using the gas -many flag.
148 * However we have to support older toolchains so for the moment
149 * we hardwire it.
150 */
151#if 0
152 asm volatile("tlbiel %0" : : "r"(va) : "memory");
153#else
154 asm volatile(".long 0x7c000224 | (%0 << 11)" : : "r"(va) : "memory");
155#endif
156}
157 151
158static inline void tlbiel(unsigned long va) 152#ifndef __ASSEMBLY__
159{
160 asm volatile("ptesync": : :"memory");
161 __tlbiel(va);
162 asm volatile("ptesync": : :"memory");
163}
164 153
165static inline unsigned long slot2va(unsigned long hpte_v, unsigned long slot) 154/*
166{ 155 * The current system page sizes
167 unsigned long avpn = HPTE_V_AVPN_VAL(hpte_v); 156 */
168 unsigned long va; 157extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
158extern int mmu_linear_psize;
159extern int mmu_virtual_psize;
169 160
170 va = avpn << 23; 161#ifdef CONFIG_HUGETLB_PAGE
162/*
163 * The page size index of the huge pages for use by hugetlbfs
164 */
165extern int mmu_huge_psize;
171 166
172 if (! (hpte_v & HPTE_V_LARGE)) { 167#endif /* CONFIG_HUGETLB_PAGE */
173 unsigned long vpi, pteg;
174 168
175 pteg = slot / HPTES_PER_GROUP; 169/*
176 if (hpte_v & HPTE_V_SECONDARY) 170 * This function sets the AVPN and L fields of the HPTE appropriately
177 pteg = ~pteg; 171 * for the page size
172 */
173static inline unsigned long hpte_encode_v(unsigned long va, int psize)
174{
175 unsigned long v =
176 v = (va >> 23) & ~(mmu_psize_defs[psize].avpnm);
177 v <<= HPTE_V_AVPN_SHIFT;
178 if (psize != MMU_PAGE_4K)
179 v |= HPTE_V_LARGE;
180 return v;
181}
178 182
179 vpi = ((va >> 28) ^ pteg) & htab_hash_mask; 183/*
184 * This function sets the ARPN, and LP fields of the HPTE appropriately
185 * for the page size. We assume the pa is already "clean" that is properly
186 * aligned for the requested page size
187 */
188static inline unsigned long hpte_encode_r(unsigned long pa, int psize)
189{
190 unsigned long r;
180 191
181 va |= vpi << PAGE_SHIFT; 192 /* A 4K page needs no special encoding */
193 if (psize == MMU_PAGE_4K)
194 return pa & HPTE_R_RPN;
195 else {
196 unsigned int penc = mmu_psize_defs[psize].penc;
197 unsigned int shift = mmu_psize_defs[psize].shift;
198 return (pa & ~((1ul << shift) - 1)) | (penc << 12);
182 } 199 }
183 200 return r;
184 return va;
185} 201}
186 202
187/* 203/*
188 * Handle a fault by adding an HPTE. If the address can't be determined 204 * This hashes a virtual address for a 256Mb segment only for now
189 * to be valid via Linux page tables, return 1. If handled return 0
190 */ 205 */
191extern int __hash_page(unsigned long ea, unsigned long access, 206
192 unsigned long vsid, pte_t *ptep, unsigned long trap, 207static inline unsigned long hpt_hash(unsigned long va, unsigned int shift)
193 int local); 208{
209 return ((va >> 28) & 0x7fffffffffUL) ^ ((va & 0x0fffffffUL) >> shift);
210}
211
212extern int __hash_page_4K(unsigned long ea, unsigned long access,
213 unsigned long vsid, pte_t *ptep, unsigned long trap,
214 unsigned int local);
215extern int __hash_page_64K(unsigned long ea, unsigned long access,
216 unsigned long vsid, pte_t *ptep, unsigned long trap,
217 unsigned int local);
218struct mm_struct;
219extern int hash_huge_page(struct mm_struct *mm, unsigned long access,
220 unsigned long ea, unsigned long vsid, int local);
194 221
195extern void htab_finish_init(void); 222extern void htab_finish_init(void);
223extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
224 unsigned long pstart, unsigned long mode,
225 int psize);
196 226
197extern void hpte_init_native(void); 227extern void hpte_init_native(void);
198extern void hpte_init_lpar(void); 228extern void hpte_init_lpar(void);
@@ -200,17 +230,21 @@ extern void hpte_init_iSeries(void);
200 230
201extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, 231extern long pSeries_lpar_hpte_insert(unsigned long hpte_group,
202 unsigned long va, unsigned long prpn, 232 unsigned long va, unsigned long prpn,
203 unsigned long vflags, 233 unsigned long rflags,
204 unsigned long rflags); 234 unsigned long vflags, int psize);
205extern long native_hpte_insert(unsigned long hpte_group, unsigned long va, 235
206 unsigned long prpn, 236extern long native_hpte_insert(unsigned long hpte_group,
207 unsigned long vflags, unsigned long rflags); 237 unsigned long va, unsigned long prpn,
238 unsigned long rflags,
239 unsigned long vflags, int psize);
208 240
209extern long iSeries_hpte_bolt_or_insert(unsigned long hpte_group, 241extern long iSeries_hpte_insert(unsigned long hpte_group,
210 unsigned long va, unsigned long prpn, 242 unsigned long va, unsigned long prpn,
211 unsigned long vflags, unsigned long rflags); 243 unsigned long rflags,
244 unsigned long vflags, int psize);
212 245
213extern void stabs_alloc(void); 246extern void stabs_alloc(void);
247extern void slb_initialize(void);
214 248
215#endif /* __ASSEMBLY__ */ 249#endif /* __ASSEMBLY__ */
216 250
diff --git a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h
index 77a743402db4..4f512e9fa6b8 100644
--- a/include/asm-ppc64/mmu_context.h
+++ b/include/asm-ppc64/mmu_context.h
@@ -17,22 +17,15 @@
17 */ 17 */
18 18
19/* 19/*
20 * Every architecture must define this function. It's the fastest 20 * Getting into a kernel thread, there is no valid user segment, mark
21 * way of searching a 140-bit bitmap where the first 100 bits are 21 * paca->pgdir NULL so that SLB miss on user addresses will fault
22 * unlikely to be set. It's guaranteed that at least one of the 140
23 * bits is cleared.
24 */ 22 */
25static inline int sched_find_first_bit(unsigned long *b) 23static inline void enter_lazy_tlb(struct mm_struct *mm,
26{ 24 struct task_struct *tsk)
27 if (unlikely(b[0]))
28 return __ffs(b[0]);
29 if (unlikely(b[1]))
30 return __ffs(b[1]) + 64;
31 return __ffs(b[2]) + 128;
32}
33
34static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
35{ 25{
26#ifdef CONFIG_PPC_64K_PAGES
27 get_paca()->pgdir = NULL;
28#endif /* CONFIG_PPC_64K_PAGES */
36} 29}
37 30
38#define NO_CONTEXT 0 31#define NO_CONTEXT 0
@@ -55,8 +48,13 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
55 cpu_set(smp_processor_id(), next->cpu_vm_mask); 48 cpu_set(smp_processor_id(), next->cpu_vm_mask);
56 49
57 /* No need to flush userspace segments if the mm doesnt change */ 50 /* No need to flush userspace segments if the mm doesnt change */
51#ifdef CONFIG_PPC_64K_PAGES
52 if (prev == next && get_paca()->pgdir == next->pgd)
53 return;
54#else
58 if (prev == next) 55 if (prev == next)
59 return; 56 return;
57#endif /* CONFIG_PPC_64K_PAGES */
60 58
61#ifdef CONFIG_ALTIVEC 59#ifdef CONFIG_ALTIVEC
62 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 60 if (cpu_has_feature(CPU_FTR_ALTIVEC))
diff --git a/include/asm-ppc64/naca.h b/include/asm-ppc64/naca.h
deleted file mode 100644
index d2afe6447597..000000000000
--- a/include/asm-ppc64/naca.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef _NACA_H
2#define _NACA_H
3
4/*
5 * c 2001 PPC 64 Team, IBM Corp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <asm/types.h>
14
15struct naca_struct {
16 /* Kernel only data - undefined for user space */
17 void *xItVpdAreas; /* VPD Data 0x00 */
18 void *xRamDisk; /* iSeries ramdisk 0x08 */
19 u64 xRamDiskSize; /* In pages 0x10 */
20};
21
22extern struct naca_struct naca;
23
24#endif /* _NACA_H */
diff --git a/include/asm-ppc64/numnodes.h b/include/asm-ppc64/numnodes.h
deleted file mode 100644
index 75ae0b906708..000000000000
--- a/include/asm-ppc64/numnodes.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef _ASM_MAX_NUMNODES_H
2#define _ASM_MAX_NUMNODES_H
3
4/* Max 16 Nodes */
5#define NODES_SHIFT 4
6
7#endif /* _ASM_MAX_NUMNODES_H */
diff --git a/include/asm-ppc64/nvram.h b/include/asm-ppc64/nvram.h
index dfaa21566c9a..def47d720d3d 100644
--- a/include/asm-ppc64/nvram.h
+++ b/include/asm-ppc64/nvram.h
@@ -70,7 +70,7 @@ extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
70 70
71extern int pSeries_nvram_init(void); 71extern int pSeries_nvram_init(void);
72extern int pmac_nvram_init(void); 72extern int pmac_nvram_init(void);
73extern int bpa_nvram_init(void); 73extern int mmio_nvram_init(void);
74 74
75/* PowerMac specific nvram stuffs */ 75/* PowerMac specific nvram stuffs */
76 76
diff --git a/include/asm-ppc64/paca.h b/include/asm-ppc64/paca.h
index 2f0f36f73d38..bccacd6aa93a 100644
--- a/include/asm-ppc64/paca.h
+++ b/include/asm-ppc64/paca.h
@@ -19,7 +19,7 @@
19#include <linux/config.h> 19#include <linux/config.h>
20#include <asm/types.h> 20#include <asm/types.h>
21#include <asm/lppaca.h> 21#include <asm/lppaca.h>
22#include <asm/iSeries/ItLpRegSave.h> 22#include <asm/iseries/it_lp_reg_save.h>
23#include <asm/mmu.h> 23#include <asm/mmu.h>
24 24
25register struct paca_struct *local_paca asm("r13"); 25register struct paca_struct *local_paca asm("r13");
@@ -72,10 +72,15 @@ struct paca_struct {
72 /* 72 /*
73 * Now, starting in cacheline 2, the exception save areas 73 * Now, starting in cacheline 2, the exception save areas
74 */ 74 */
75 u64 exgen[8] __attribute__((aligned(0x80))); /* used for most interrupts/exceptions */ 75 /* used for most interrupts/exceptions */
76 u64 exmc[8]; /* used for machine checks */ 76 u64 exgen[10] __attribute__((aligned(0x80)));
77 u64 exslb[8]; /* used for SLB/segment table misses 77 u64 exmc[10]; /* used for machine checks */
78 * on the linear mapping */ 78 u64 exslb[10]; /* used for SLB/segment table misses
79 * on the linear mapping */
80#ifdef CONFIG_PPC_64K_PAGES
81 pgd_t *pgdir;
82#endif /* CONFIG_PPC_64K_PAGES */
83
79 mm_context_t context; 84 mm_context_t context;
80 u16 slb_cache[SLB_CACHE_ENTRIES]; 85 u16 slb_cache[SLB_CACHE_ENTRIES];
81 u16 slb_cache_ptr; 86 u16 slb_cache_ptr;
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
index d404431f0a9a..82ce187e5be8 100644
--- a/include/asm-ppc64/page.h
+++ b/include/asm-ppc64/page.h
@@ -13,32 +13,59 @@
13#include <linux/config.h> 13#include <linux/config.h>
14#include <asm/ppc_asm.h> /* for ASM_CONST */ 14#include <asm/ppc_asm.h> /* for ASM_CONST */
15 15
16/* PAGE_SHIFT determines the page size */ 16/*
17#define PAGE_SHIFT 12 17 * We support either 4k or 64k software page size. When using 64k pages
18#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) 18 * however, wether we are really supporting 64k pages in HW or not is
19#define PAGE_MASK (~(PAGE_SIZE-1)) 19 * irrelevant to those definitions. We always define HW_PAGE_SHIFT to 12
20 * as use of 64k pages remains a linux kernel specific, every notion of
21 * page number shared with the firmware, TCEs, iommu, etc... still assumes
22 * a page size of 4096.
23 */
24#ifdef CONFIG_PPC_64K_PAGES
25#define PAGE_SHIFT 16
26#else
27#define PAGE_SHIFT 12
28#endif
20 29
21#define SID_SHIFT 28 30#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
22#define SID_MASK 0xfffffffffUL 31#define PAGE_MASK (~(PAGE_SIZE-1))
23#define ESID_MASK 0xfffffffff0000000UL
24#define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK)
25 32
26#define HPAGE_SHIFT 24 33/* HW_PAGE_SHIFT is always 4k pages */
27#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) 34#define HW_PAGE_SHIFT 12
28#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 35#define HW_PAGE_SIZE (ASM_CONST(1) << HW_PAGE_SHIFT)
36#define HW_PAGE_MASK (~(HW_PAGE_SIZE-1))
29 37
30#ifdef CONFIG_HUGETLB_PAGE 38/* PAGE_FACTOR is the number of bits factor between PAGE_SHIFT and
39 * HW_PAGE_SHIFT, that is 4k pages
40 */
41#define PAGE_FACTOR (PAGE_SHIFT - HW_PAGE_SHIFT)
42
43/* Segment size */
44#define SID_SHIFT 28
45#define SID_MASK 0xfffffffffUL
46#define ESID_MASK 0xfffffffff0000000UL
47#define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK)
31 48
49/* Large pages size */
50
51#ifndef __ASSEMBLY__
52extern unsigned int HPAGE_SHIFT;
53#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
54#define HPAGE_MASK (~(HPAGE_SIZE - 1))
32#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 55#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
56#endif /* __ASSEMBLY__ */
57
58#ifdef CONFIG_HUGETLB_PAGE
59
33 60
34#define HTLB_AREA_SHIFT 40 61#define HTLB_AREA_SHIFT 40
35#define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT) 62#define HTLB_AREA_SIZE (1UL << HTLB_AREA_SHIFT)
36#define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT) 63#define GET_HTLB_AREA(x) ((x) >> HTLB_AREA_SHIFT)
37 64
38#define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \ 65#define LOW_ESID_MASK(addr, len) (((1U << (GET_ESID(addr+len-1)+1)) \
39 - (1U << GET_ESID(addr))) & 0xffff) 66 - (1U << GET_ESID(addr))) & 0xffff)
40#define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \ 67#define HTLB_AREA_MASK(addr, len) (((1U << (GET_HTLB_AREA(addr+len-1)+1)) \
41 - (1U << GET_HTLB_AREA(addr))) & 0xffff) 68 - (1U << GET_HTLB_AREA(addr))) & 0xffff)
42 69
43#define ARCH_HAS_HUGEPAGE_ONLY_RANGE 70#define ARCH_HAS_HUGEPAGE_ONLY_RANGE
44#define ARCH_HAS_PREPARE_HUGEPAGE_RANGE 71#define ARCH_HAS_PREPARE_HUGEPAGE_RANGE
@@ -114,7 +141,25 @@ static __inline__ void clear_page(void *addr)
114 : "ctr", "memory"); 141 : "ctr", "memory");
115} 142}
116 143
117extern void copy_page(void *to, void *from); 144extern void copy_4K_page(void *to, void *from);
145
146#ifdef CONFIG_PPC_64K_PAGES
147static inline void copy_page(void *to, void *from)
148{
149 unsigned int i;
150 for (i=0; i < (1 << (PAGE_SHIFT - 12)); i++) {
151 copy_4K_page(to, from);
152 to += 4096;
153 from += 4096;
154 }
155}
156#else /* CONFIG_PPC_64K_PAGES */
157static inline void copy_page(void *to, void *from)
158{
159 copy_4K_page(to, from);
160}
161#endif /* CONFIG_PPC_64K_PAGES */
162
118struct page; 163struct page;
119extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); 164extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
120extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *p); 165extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *p);
@@ -124,43 +169,75 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct pag
124 * These are used to make use of C type-checking. 169 * These are used to make use of C type-checking.
125 * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b. 170 * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b.
126 */ 171 */
127typedef struct { unsigned long pte; } pte_t;
128typedef struct { unsigned long pmd; } pmd_t;
129typedef struct { unsigned long pud; } pud_t;
130typedef struct { unsigned long pgd; } pgd_t;
131typedef struct { unsigned long pgprot; } pgprot_t;
132 172
173/* PTE level */
174typedef struct { unsigned long pte; } pte_t;
133#define pte_val(x) ((x).pte) 175#define pte_val(x) ((x).pte)
134#define pmd_val(x) ((x).pmd)
135#define pud_val(x) ((x).pud)
136#define pgd_val(x) ((x).pgd)
137#define pgprot_val(x) ((x).pgprot)
138
139#define __pte(x) ((pte_t) { (x) }) 176#define __pte(x) ((pte_t) { (x) })
177
178/* 64k pages additionally define a bigger "real PTE" type that gathers
179 * the "second half" part of the PTE for pseudo 64k pages
180 */
181#ifdef CONFIG_PPC_64K_PAGES
182typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
183#else
184typedef struct { pte_t pte; } real_pte_t;
185#endif
186
187/* PMD level */
188typedef struct { unsigned long pmd; } pmd_t;
189#define pmd_val(x) ((x).pmd)
140#define __pmd(x) ((pmd_t) { (x) }) 190#define __pmd(x) ((pmd_t) { (x) })
191
192/* PUD level exusts only on 4k pages */
193#ifndef CONFIG_PPC_64K_PAGES
194typedef struct { unsigned long pud; } pud_t;
195#define pud_val(x) ((x).pud)
141#define __pud(x) ((pud_t) { (x) }) 196#define __pud(x) ((pud_t) { (x) })
197#endif
198
199/* PGD level */
200typedef struct { unsigned long pgd; } pgd_t;
201#define pgd_val(x) ((x).pgd)
142#define __pgd(x) ((pgd_t) { (x) }) 202#define __pgd(x) ((pgd_t) { (x) })
203
204/* Page protection bits */
205typedef struct { unsigned long pgprot; } pgprot_t;
206#define pgprot_val(x) ((x).pgprot)
143#define __pgprot(x) ((pgprot_t) { (x) }) 207#define __pgprot(x) ((pgprot_t) { (x) })
144 208
145#else 209#else
210
146/* 211/*
147 * .. while these make it easier on the compiler 212 * .. while these make it easier on the compiler
148 */ 213 */
149typedef unsigned long pte_t;
150typedef unsigned long pmd_t;
151typedef unsigned long pud_t;
152typedef unsigned long pgd_t;
153typedef unsigned long pgprot_t;
154 214
215typedef unsigned long pte_t;
155#define pte_val(x) (x) 216#define pte_val(x) (x)
217#define __pte(x) (x)
218
219#ifdef CONFIG_PPC_64K_PAGES
220typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
221#else
222typedef unsigned long real_pte_t;
223#endif
224
225
226typedef unsigned long pmd_t;
156#define pmd_val(x) (x) 227#define pmd_val(x) (x)
228#define __pmd(x) (x)
229
230#ifndef CONFIG_PPC_64K_PAGES
231typedef unsigned long pud_t;
157#define pud_val(x) (x) 232#define pud_val(x) (x)
233#define __pud(x) (x)
234#endif
235
236typedef unsigned long pgd_t;
158#define pgd_val(x) (x) 237#define pgd_val(x) (x)
159#define pgprot_val(x) (x) 238#define pgprot_val(x) (x)
160 239
161#define __pte(x) (x) 240typedef unsigned long pgprot_t;
162#define __pmd(x) (x)
163#define __pud(x) (x)
164#define __pgd(x) (x) 241#define __pgd(x) (x)
165#define __pgprot(x) (x) 242#define __pgprot(x) (x)
166 243
diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h
index 26bc49c1108d..98da0e4262bd 100644
--- a/include/asm-ppc64/pgalloc.h
+++ b/include/asm-ppc64/pgalloc.h
@@ -8,10 +8,16 @@
8 8
9extern kmem_cache_t *pgtable_cache[]; 9extern kmem_cache_t *pgtable_cache[];
10 10
11#ifdef CONFIG_PPC_64K_PAGES
12#define PTE_CACHE_NUM 0
13#define PMD_CACHE_NUM 0
14#define PGD_CACHE_NUM 1
15#else
11#define PTE_CACHE_NUM 0 16#define PTE_CACHE_NUM 0
12#define PMD_CACHE_NUM 1 17#define PMD_CACHE_NUM 1
13#define PUD_CACHE_NUM 1 18#define PUD_CACHE_NUM 1
14#define PGD_CACHE_NUM 0 19#define PGD_CACHE_NUM 0
20#endif
15 21
16/* 22/*
17 * This program is free software; you can redistribute it and/or 23 * This program is free software; you can redistribute it and/or
@@ -30,6 +36,8 @@ static inline void pgd_free(pgd_t *pgd)
30 kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd); 36 kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd);
31} 37}
32 38
39#ifndef CONFIG_PPC_64K_PAGES
40
33#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD) 41#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD)
34 42
35static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) 43static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
@@ -43,7 +51,30 @@ static inline void pud_free(pud_t *pud)
43 kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud); 51 kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud);
44} 52}
45 53
46#define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) 54static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
55{
56 pud_set(pud, (unsigned long)pmd);
57}
58
59#define pmd_populate(mm, pmd, pte_page) \
60 pmd_populate_kernel(mm, pmd, page_address(pte_page))
61#define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, (unsigned long)(pte))
62
63
64#else /* CONFIG_PPC_64K_PAGES */
65
66#define pud_populate(mm, pud, pmd) pud_set(pud, (unsigned long)pmd)
67
68static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
69 pte_t *pte)
70{
71 pmd_set(pmd, (unsigned long)pte);
72}
73
74#define pmd_populate(mm, pmd, pte_page) \
75 pmd_populate_kernel(mm, pmd, page_address(pte_page))
76
77#endif /* CONFIG_PPC_64K_PAGES */
47 78
48static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 79static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
49{ 80{
@@ -56,17 +87,15 @@ static inline void pmd_free(pmd_t *pmd)
56 kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd); 87 kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd);
57} 88}
58 89
59#define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) 90static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
60#define pmd_populate(mm, pmd, pte_page) \ 91 unsigned long address)
61 pmd_populate_kernel(mm, pmd, page_address(pte_page))
62
63static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
64{ 92{
65 return kmem_cache_alloc(pgtable_cache[PTE_CACHE_NUM], 93 return kmem_cache_alloc(pgtable_cache[PTE_CACHE_NUM],
66 GFP_KERNEL|__GFP_REPEAT); 94 GFP_KERNEL|__GFP_REPEAT);
67} 95}
68 96
69static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) 97static inline struct page *pte_alloc_one(struct mm_struct *mm,
98 unsigned long address)
70{ 99{
71 return virt_to_page(pte_alloc_one_kernel(mm, address)); 100 return virt_to_page(pte_alloc_one_kernel(mm, address));
72} 101}
@@ -103,7 +132,7 @@ static inline void pgtable_free(pgtable_free_t pgf)
103 kmem_cache_free(pgtable_cache[cachenum], p); 132 kmem_cache_free(pgtable_cache[cachenum], p);
104} 133}
105 134
106void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); 135extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
107 136
108#define __pte_free_tlb(tlb, ptepage) \ 137#define __pte_free_tlb(tlb, ptepage) \
109 pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \ 138 pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \
@@ -111,9 +140,11 @@ void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
111#define __pmd_free_tlb(tlb, pmd) \ 140#define __pmd_free_tlb(tlb, pmd) \
112 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \ 141 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \
113 PMD_CACHE_NUM, PMD_TABLE_SIZE-1)) 142 PMD_CACHE_NUM, PMD_TABLE_SIZE-1))
143#ifndef CONFIG_PPC_64K_PAGES
114#define __pud_free_tlb(tlb, pmd) \ 144#define __pud_free_tlb(tlb, pmd) \
115 pgtable_free_tlb(tlb, pgtable_free_cache(pud, \ 145 pgtable_free_tlb(tlb, pgtable_free_cache(pud, \
116 PUD_CACHE_NUM, PUD_TABLE_SIZE-1)) 146 PUD_CACHE_NUM, PUD_TABLE_SIZE-1))
147#endif /* CONFIG_PPC_64K_PAGES */
117 148
118#define check_pgt_cache() do { } while (0) 149#define check_pgt_cache() do { } while (0)
119 150
diff --git a/include/asm-ppc64/pgtable-4k.h b/include/asm-ppc64/pgtable-4k.h
new file mode 100644
index 000000000000..e9590c06ad92
--- /dev/null
+++ b/include/asm-ppc64/pgtable-4k.h
@@ -0,0 +1,91 @@
1/*
2 * Entries per page directory level. The PTE level must use a 64b record
3 * for each page table entry. The PMD and PGD level use a 32b record for
4 * each entry by assuming that each entry is page aligned.
5 */
6#define PTE_INDEX_SIZE 9
7#define PMD_INDEX_SIZE 7
8#define PUD_INDEX_SIZE 7
9#define PGD_INDEX_SIZE 9
10
11#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE)
12#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
13#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE)
14#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
15
16#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
17#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
18#define PTRS_PER_PUD (1 << PMD_INDEX_SIZE)
19#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
20
21/* PMD_SHIFT determines what a second-level page table entry can map */
22#define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
23#define PMD_SIZE (1UL << PMD_SHIFT)
24#define PMD_MASK (~(PMD_SIZE-1))
25
26/* With 4k base page size, hugepage PTEs go at the PMD level */
27#define MIN_HUGEPTE_SHIFT PMD_SHIFT
28
29/* PUD_SHIFT determines what a third-level page table entry can map */
30#define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE)
31#define PUD_SIZE (1UL << PUD_SHIFT)
32#define PUD_MASK (~(PUD_SIZE-1))
33
34/* PGDIR_SHIFT determines what a fourth-level page table entry can map */
35#define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE)
36#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
37#define PGDIR_MASK (~(PGDIR_SIZE-1))
38
39/* PTE bits */
40#define _PAGE_SECONDARY 0x8000 /* software: HPTE is in secondary group */
41#define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */
42#define _PAGE_F_SECOND _PAGE_SECONDARY
43#define _PAGE_F_GIX _PAGE_GROUP_IX
44
45/* PTE flags to conserve for HPTE identification */
46#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | \
47 _PAGE_SECONDARY | _PAGE_GROUP_IX)
48
49/* PAGE_MASK gives the right answer below, but only by accident */
50/* It should be preserving the high 48 bits and then specifically */
51/* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */
52#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \
53 _PAGE_HPTEFLAGS)
54
55/* Bits to mask out from a PMD to get to the PTE page */
56#define PMD_MASKED_BITS 0
57/* Bits to mask out from a PUD to get to the PMD page */
58#define PUD_MASKED_BITS 0
59/* Bits to mask out from a PGD to get to the PUD page */
60#define PGD_MASKED_BITS 0
61
62/* shift to put page number into pte */
63#define PTE_RPN_SHIFT (17)
64
65#define __real_pte(e,p) ((real_pte_t)(e))
66#define __rpte_to_pte(r) (r)
67#define __rpte_to_hidx(r,index) (pte_val((r)) >> 12)
68
69#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
70 do { \
71 index = 0; \
72 shift = mmu_psize_defs[psize].shift; \
73
74#define pte_iterate_hashed_end() } while(0)
75
76/*
77 * 4-level page tables related bits
78 */
79
80#define pgd_none(pgd) (!pgd_val(pgd))
81#define pgd_bad(pgd) (pgd_val(pgd) == 0)
82#define pgd_present(pgd) (pgd_val(pgd) != 0)
83#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0)
84#define pgd_page(pgd) (pgd_val(pgd) & ~PGD_MASKED_BITS)
85
86#define pud_offset(pgdp, addr) \
87 (((pud_t *) pgd_page(*(pgdp))) + \
88 (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)))
89
90#define pud_ERROR(e) \
91 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pud_val(e))
diff --git a/include/asm-ppc64/pgtable-64k.h b/include/asm-ppc64/pgtable-64k.h
new file mode 100644
index 000000000000..154f1840ece4
--- /dev/null
+++ b/include/asm-ppc64/pgtable-64k.h
@@ -0,0 +1,90 @@
1#include <asm-generic/pgtable-nopud.h>
2
3
4#define PTE_INDEX_SIZE 12
5#define PMD_INDEX_SIZE 12
6#define PUD_INDEX_SIZE 0
7#define PGD_INDEX_SIZE 4
8
9#define PTE_TABLE_SIZE (sizeof(real_pte_t) << PTE_INDEX_SIZE)
10#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
11#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
12
13#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
14#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
15#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
16
17/* With 4k base page size, hugepage PTEs go at the PMD level */
18#define MIN_HUGEPTE_SHIFT PAGE_SHIFT
19
20/* PMD_SHIFT determines what a second-level page table entry can map */
21#define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
22#define PMD_SIZE (1UL << PMD_SHIFT)
23#define PMD_MASK (~(PMD_SIZE-1))
24
25/* PGDIR_SHIFT determines what a third-level page table entry can map */
26#define PGDIR_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE)
27#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
28#define PGDIR_MASK (~(PGDIR_SIZE-1))
29
30/* Additional PTE bits (don't change without checking asm in hash_low.S) */
31#define _PAGE_HPTE_SUB 0x0ffff000 /* combo only: sub pages HPTE bits */
32#define _PAGE_HPTE_SUB0 0x08000000 /* combo only: first sub page */
33#define _PAGE_COMBO 0x10000000 /* this is a combo 4k page */
34#define _PAGE_F_SECOND 0x00008000 /* full page: hidx bits */
35#define _PAGE_F_GIX 0x00007000 /* full page: hidx bits */
36
37/* PTE flags to conserve for HPTE identification */
38#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_HPTE_SUB |\
39 _PAGE_COMBO)
40
41/* Shift to put page number into pte.
42 *
43 * That gives us a max RPN of 32 bits, which means a max of 48 bits
44 * of addressable physical space.
45 * We could get 3 more bits here by setting PTE_RPN_SHIFT to 29 but
46 * 32 makes PTEs more readable for debugging for now :)
47 */
48#define PTE_RPN_SHIFT (32)
49#define PTE_RPN_MAX (1UL << (64 - PTE_RPN_SHIFT))
50#define PTE_RPN_MASK (~((1UL<<PTE_RPN_SHIFT)-1))
51
52/* _PAGE_CHG_MASK masks of bits that are to be preserved accross
53 * pgprot changes
54 */
55#define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
56 _PAGE_ACCESSED)
57
58/* Bits to mask out from a PMD to get to the PTE page */
59#define PMD_MASKED_BITS 0x1ff
60/* Bits to mask out from a PGD/PUD to get to the PMD page */
61#define PUD_MASKED_BITS 0x1ff
62
63#ifndef __ASSEMBLY__
64
65/* Manipulate "rpte" values */
66#define __real_pte(e,p) ((real_pte_t) { \
67 (e), pte_val(*((p) + PTRS_PER_PTE)) })
68#define __rpte_to_hidx(r,index) ((pte_val((r).pte) & _PAGE_COMBO) ? \
69 (((r).hidx >> ((index)<<2)) & 0xf) : ((pte_val((r).pte) >> 12) & 0xf))
70#define __rpte_to_pte(r) ((r).pte)
71#define __rpte_sub_valid(rpte, index) \
72 (pte_val(rpte.pte) & (_PAGE_HPTE_SUB0 >> (index)))
73
74
75/* Trick: we set __end to va + 64k, which happens works for
76 * a 16M page as well as we want only one iteration
77 */
78#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
79 do { \
80 unsigned long __end = va + PAGE_SIZE; \
81 unsigned __split = (psize == MMU_PAGE_4K || \
82 psize == MMU_PAGE_64K_AP); \
83 shift = mmu_psize_defs[psize].shift; \
84 for (index = 0; va < __end; index++, va += (1 << shift)) { \
85 if (!__split || __rpte_sub_valid(rpte, index)) do { \
86
87#define pte_iterate_hashed_end() } while(0); } } while(0)
88
89
90#endif /* __ASSEMBLY__ */
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h
index 8c3f574046b6..a9783ba7fe98 100644
--- a/include/asm-ppc64/pgtable.h
+++ b/include/asm-ppc64/pgtable.h
@@ -13,42 +13,14 @@
13#include <asm/mmu.h> 13#include <asm/mmu.h>
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
16struct mm_struct;
16#endif /* __ASSEMBLY__ */ 17#endif /* __ASSEMBLY__ */
17 18
18/* 19#ifdef CONFIG_PPC_64K_PAGES
19 * Entries per page directory level. The PTE level must use a 64b record 20#include <asm/pgtable-64k.h>
20 * for each page table entry. The PMD and PGD level use a 32b record for 21#else
21 * each entry by assuming that each entry is page aligned. 22#include <asm/pgtable-4k.h>
22 */ 23#endif
23#define PTE_INDEX_SIZE 9
24#define PMD_INDEX_SIZE 7
25#define PUD_INDEX_SIZE 7
26#define PGD_INDEX_SIZE 9
27
28#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE)
29#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE)
30#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE)
31#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE)
32
33#define PTRS_PER_PTE (1 << PTE_INDEX_SIZE)
34#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
35#define PTRS_PER_PUD (1 << PMD_INDEX_SIZE)
36#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
37
38/* PMD_SHIFT determines what a second-level page table entry can map */
39#define PMD_SHIFT (PAGE_SHIFT + PTE_INDEX_SIZE)
40#define PMD_SIZE (1UL << PMD_SHIFT)
41#define PMD_MASK (~(PMD_SIZE-1))
42
43/* PUD_SHIFT determines what a third-level page table entry can map */
44#define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE)
45#define PUD_SIZE (1UL << PUD_SHIFT)
46#define PUD_MASK (~(PUD_SIZE-1))
47
48/* PGDIR_SHIFT determines what a fourth-level page table entry can map */
49#define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE)
50#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
51#define PGDIR_MASK (~(PGDIR_SIZE-1))
52 24
53#define FIRST_USER_ADDRESS 0 25#define FIRST_USER_ADDRESS 0
54 26
@@ -75,8 +47,9 @@
75#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) 47#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
76 48
77/* 49/*
78 * Bits in a linux-style PTE. These match the bits in the 50 * Common bits in a linux-style PTE. These match the bits in the
79 * (hardware-defined) PowerPC PTE as closely as possible. 51 * (hardware-defined) PowerPC PTE as closely as possible. Additional
52 * bits may be defined in pgtable-*.h
80 */ 53 */
81#define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */ 54#define _PAGE_PRESENT 0x0001 /* software: pte contains a translation */
82#define _PAGE_USER 0x0002 /* matches one of the PP bits */ 55#define _PAGE_USER 0x0002 /* matches one of the PP bits */
@@ -91,15 +64,6 @@
91#define _PAGE_RW 0x0200 /* software: user write access allowed */ 64#define _PAGE_RW 0x0200 /* software: user write access allowed */
92#define _PAGE_HASHPTE 0x0400 /* software: pte has an associated HPTE */ 65#define _PAGE_HASHPTE 0x0400 /* software: pte has an associated HPTE */
93#define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */ 66#define _PAGE_BUSY 0x0800 /* software: PTE & hash are busy */
94#define _PAGE_SECONDARY 0x8000 /* software: HPTE is in secondary group */
95#define _PAGE_GROUP_IX 0x7000 /* software: HPTE index within group */
96#define _PAGE_HUGE 0x10000 /* 16MB page */
97/* Bits 0x7000 identify the index within an HPT Group */
98#define _PAGE_HPTEFLAGS (_PAGE_BUSY | _PAGE_HASHPTE | _PAGE_SECONDARY | _PAGE_GROUP_IX)
99/* PAGE_MASK gives the right answer below, but only by accident */
100/* It should be preserving the high 48 bits and then specifically */
101/* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */
102#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_HPTEFLAGS)
103 67
104#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT) 68#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_COHERENT)
105 69
@@ -122,10 +86,10 @@
122#define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE) 86#define PAGE_AGP __pgprot(_PAGE_BASE | _PAGE_WRENABLE | _PAGE_NO_CACHE)
123#define HAVE_PAGE_AGP 87#define HAVE_PAGE_AGP
124 88
125/* 89/* PTEIDX nibble */
126 * This bit in a hardware PTE indicates that the page is *not* executable. 90#define _PTEIDX_SECONDARY 0x8
127 */ 91#define _PTEIDX_GROUP_IX 0x7
128#define HW_NO_EXEC _PAGE_EXEC 92
129 93
130/* 94/*
131 * POWER4 and newer have per page execute protection, older chips can only 95 * POWER4 and newer have per page execute protection, older chips can only
@@ -164,21 +128,10 @@ extern unsigned long empty_zero_page[PAGE_SIZE/sizeof(unsigned long)];
164#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 128#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
165#endif /* __ASSEMBLY__ */ 129#endif /* __ASSEMBLY__ */
166 130
167/* shift to put page number into pte */
168#define PTE_SHIFT (17)
169
170#ifdef CONFIG_HUGETLB_PAGE 131#ifdef CONFIG_HUGETLB_PAGE
171 132
172#ifndef __ASSEMBLY__
173int hash_huge_page(struct mm_struct *mm, unsigned long access,
174 unsigned long ea, unsigned long vsid, int local);
175#endif /* __ASSEMBLY__ */
176
177#define HAVE_ARCH_UNMAPPED_AREA 133#define HAVE_ARCH_UNMAPPED_AREA
178#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN 134#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
179#else
180
181#define hash_huge_page(mm,a,ea,vsid,local) -1
182 135
183#endif 136#endif
184 137
@@ -197,7 +150,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
197 pte_t pte; 150 pte_t pte;
198 151
199 152
200 pte_val(pte) = (pfn << PTE_SHIFT) | pgprot_val(pgprot); 153 pte_val(pte) = (pfn << PTE_RPN_SHIFT) | pgprot_val(pgprot);
201 return pte; 154 return pte;
202} 155}
203 156
@@ -209,30 +162,25 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
209 162
210/* pte_clear moved to later in this file */ 163/* pte_clear moved to later in this file */
211 164
212#define pte_pfn(x) ((unsigned long)((pte_val(x) >> PTE_SHIFT))) 165#define pte_pfn(x) ((unsigned long)((pte_val(x)>>PTE_RPN_SHIFT)))
213#define pte_page(x) pfn_to_page(pte_pfn(x)) 166#define pte_page(x) pfn_to_page(pte_pfn(x))
214 167
215#define pmd_set(pmdp, ptep) ({BUG_ON((u64)ptep < KERNELBASE); pmd_val(*(pmdp)) = (unsigned long)(ptep);}) 168#define pmd_set(pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval))
216#define pmd_none(pmd) (!pmd_val(pmd)) 169#define pmd_none(pmd) (!pmd_val(pmd))
217#define pmd_bad(pmd) (pmd_val(pmd) == 0) 170#define pmd_bad(pmd) (pmd_val(pmd) == 0)
218#define pmd_present(pmd) (pmd_val(pmd) != 0) 171#define pmd_present(pmd) (pmd_val(pmd) != 0)
219#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) 172#define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0)
220#define pmd_page_kernel(pmd) (pmd_val(pmd)) 173#define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS)
221#define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) 174#define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd))
222 175
223#define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (unsigned long)(pmdp)) 176#define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval))
224#define pud_none(pud) (!pud_val(pud)) 177#define pud_none(pud) (!pud_val(pud))
225#define pud_bad(pud) ((pud_val(pud)) == 0) 178#define pud_bad(pud) ((pud_val(pud)) == 0)
226#define pud_present(pud) (pud_val(pud) != 0) 179#define pud_present(pud) (pud_val(pud) != 0)
227#define pud_clear(pudp) (pud_val(*(pudp)) = 0) 180#define pud_clear(pudp) (pud_val(*(pudp)) = 0)
228#define pud_page(pud) (pud_val(pud)) 181#define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS)
229 182
230#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) 183#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);})
231#define pgd_none(pgd) (!pgd_val(pgd))
232#define pgd_bad(pgd) (pgd_val(pgd) == 0)
233#define pgd_present(pgd) (pgd_val(pgd) != 0)
234#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0)
235#define pgd_page(pgd) (pgd_val(pgd))
236 184
237/* 185/*
238 * Find an entry in a page-table-directory. We combine the address region 186 * Find an entry in a page-table-directory. We combine the address region
@@ -243,9 +191,6 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot)
243 191
244#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) 192#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
245 193
246#define pud_offset(pgdp, addr) \
247 (((pud_t *) pgd_page(*(pgdp))) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1)))
248
249#define pmd_offset(pudp,addr) \ 194#define pmd_offset(pudp,addr) \
250 (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) 195 (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)))
251 196
@@ -271,7 +216,6 @@ static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC;}
271static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} 216static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;}
272static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} 217static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;}
273static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} 218static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;}
274static inline int pte_huge(pte_t pte) { return pte_val(pte) & _PAGE_HUGE;}
275 219
276static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 220static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
277static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 221static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
@@ -286,7 +230,6 @@ static inline pte_t pte_mkclean(pte_t pte) {
286 pte_val(pte) &= ~(_PAGE_DIRTY); return pte; } 230 pte_val(pte) &= ~(_PAGE_DIRTY); return pte; }
287static inline pte_t pte_mkold(pte_t pte) { 231static inline pte_t pte_mkold(pte_t pte) {
288 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 232 pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
289
290static inline pte_t pte_mkread(pte_t pte) { 233static inline pte_t pte_mkread(pte_t pte) {
291 pte_val(pte) |= _PAGE_USER; return pte; } 234 pte_val(pte) |= _PAGE_USER; return pte; }
292static inline pte_t pte_mkexec(pte_t pte) { 235static inline pte_t pte_mkexec(pte_t pte) {
@@ -298,7 +241,7 @@ static inline pte_t pte_mkdirty(pte_t pte) {
298static inline pte_t pte_mkyoung(pte_t pte) { 241static inline pte_t pte_mkyoung(pte_t pte) {
299 pte_val(pte) |= _PAGE_ACCESSED; return pte; } 242 pte_val(pte) |= _PAGE_ACCESSED; return pte; }
300static inline pte_t pte_mkhuge(pte_t pte) { 243static inline pte_t pte_mkhuge(pte_t pte) {
301 pte_val(pte) |= _PAGE_HUGE; return pte; } 244 return pte; }
302 245
303/* Atomic PTE updates */ 246/* Atomic PTE updates */
304static inline unsigned long pte_update(pte_t *p, unsigned long clr) 247static inline unsigned long pte_update(pte_t *p, unsigned long clr)
@@ -321,11 +264,13 @@ static inline unsigned long pte_update(pte_t *p, unsigned long clr)
321/* PTE updating functions, this function puts the PTE in the 264/* PTE updating functions, this function puts the PTE in the
322 * batch, doesn't actually triggers the hash flush immediately, 265 * batch, doesn't actually triggers the hash flush immediately,
323 * you need to call flush_tlb_pending() to do that. 266 * you need to call flush_tlb_pending() to do that.
267 * Pass -1 for "normal" size (4K or 64K)
324 */ 268 */
325extern void hpte_update(struct mm_struct *mm, unsigned long addr, unsigned long pte, 269extern void hpte_update(struct mm_struct *mm, unsigned long addr,
326 int wrprot); 270 pte_t *ptep, unsigned long pte, int huge);
327 271
328static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 272static inline int __ptep_test_and_clear_young(struct mm_struct *mm,
273 unsigned long addr, pte_t *ptep)
329{ 274{
330 unsigned long old; 275 unsigned long old;
331 276
@@ -333,7 +278,7 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned lon
333 return 0; 278 return 0;
334 old = pte_update(ptep, _PAGE_ACCESSED); 279 old = pte_update(ptep, _PAGE_ACCESSED);
335 if (old & _PAGE_HASHPTE) { 280 if (old & _PAGE_HASHPTE) {
336 hpte_update(mm, addr, old, 0); 281 hpte_update(mm, addr, ptep, old, 0);
337 flush_tlb_pending(); 282 flush_tlb_pending();
338 } 283 }
339 return (old & _PAGE_ACCESSED) != 0; 284 return (old & _PAGE_ACCESSED) != 0;
@@ -351,7 +296,8 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned lon
351 * moment we always flush but we need to fix hpte_update and test if the 296 * moment we always flush but we need to fix hpte_update and test if the
352 * optimisation is worth it. 297 * optimisation is worth it.
353 */ 298 */
354static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 299static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm,
300 unsigned long addr, pte_t *ptep)
355{ 301{
356 unsigned long old; 302 unsigned long old;
357 303
@@ -359,7 +305,7 @@ static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned lon
359 return 0; 305 return 0;
360 old = pte_update(ptep, _PAGE_DIRTY); 306 old = pte_update(ptep, _PAGE_DIRTY);
361 if (old & _PAGE_HASHPTE) 307 if (old & _PAGE_HASHPTE)
362 hpte_update(mm, addr, old, 0); 308 hpte_update(mm, addr, ptep, old, 0);
363 return (old & _PAGE_DIRTY) != 0; 309 return (old & _PAGE_DIRTY) != 0;
364} 310}
365#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY 311#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
@@ -371,7 +317,8 @@ static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned lon
371}) 317})
372 318
373#define __HAVE_ARCH_PTEP_SET_WRPROTECT 319#define __HAVE_ARCH_PTEP_SET_WRPROTECT
374static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 320static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
321 pte_t *ptep)
375{ 322{
376 unsigned long old; 323 unsigned long old;
377 324
@@ -379,7 +326,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
379 return; 326 return;
380 old = pte_update(ptep, _PAGE_RW); 327 old = pte_update(ptep, _PAGE_RW);
381 if (old & _PAGE_HASHPTE) 328 if (old & _PAGE_HASHPTE)
382 hpte_update(mm, addr, old, 0); 329 hpte_update(mm, addr, ptep, old, 0);
383} 330}
384 331
385/* 332/*
@@ -408,21 +355,23 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
408}) 355})
409 356
410#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 357#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
411static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) 358static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
359 unsigned long addr, pte_t *ptep)
412{ 360{
413 unsigned long old = pte_update(ptep, ~0UL); 361 unsigned long old = pte_update(ptep, ~0UL);
414 362
415 if (old & _PAGE_HASHPTE) 363 if (old & _PAGE_HASHPTE)
416 hpte_update(mm, addr, old, 0); 364 hpte_update(mm, addr, ptep, old, 0);
417 return __pte(old); 365 return __pte(old);
418} 366}
419 367
420static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t * ptep) 368static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
369 pte_t * ptep)
421{ 370{
422 unsigned long old = pte_update(ptep, ~0UL); 371 unsigned long old = pte_update(ptep, ~0UL);
423 372
424 if (old & _PAGE_HASHPTE) 373 if (old & _PAGE_HASHPTE)
425 hpte_update(mm, addr, old, 0); 374 hpte_update(mm, addr, ptep, old, 0);
426} 375}
427 376
428/* 377/*
@@ -435,7 +384,14 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
435 pte_clear(mm, addr, ptep); 384 pte_clear(mm, addr, ptep);
436 flush_tlb_pending(); 385 flush_tlb_pending();
437 } 386 }
438 *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); 387 pte = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
388
389#ifdef CONFIG_PPC_64K_PAGES
390 if (mmu_virtual_psize != MMU_PAGE_64K)
391 pte = __pte(pte_val(pte) | _PAGE_COMBO);
392#endif /* CONFIG_PPC_64K_PAGES */
393
394 *ptep = pte;
439} 395}
440 396
441/* Set the dirty and/or accessed bits atomically in a linux PTE, this 397/* Set the dirty and/or accessed bits atomically in a linux PTE, this
@@ -482,8 +438,6 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
482 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) 438 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
483#define pmd_ERROR(e) \ 439#define pmd_ERROR(e) \
484 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) 440 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
485#define pud_ERROR(e) \
486 printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pud_val(e))
487#define pgd_ERROR(e) \ 441#define pgd_ERROR(e) \
488 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) 442 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
489 443
@@ -509,12 +463,12 @@ extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
509/* Encode and de-code a swap entry */ 463/* Encode and de-code a swap entry */
510#define __swp_type(entry) (((entry).val >> 1) & 0x3f) 464#define __swp_type(entry) (((entry).val >> 1) & 0x3f)
511#define __swp_offset(entry) ((entry).val >> 8) 465#define __swp_offset(entry) ((entry).val >> 8)
512#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 8) }) 466#define __swp_entry(type, offset) ((swp_entry_t){((type)<< 1)|((offset)<<8)})
513#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) >> PTE_SHIFT }) 467#define __pte_to_swp_entry(pte) ((swp_entry_t){pte_val(pte) >> PTE_RPN_SHIFT})
514#define __swp_entry_to_pte(x) ((pte_t) { (x).val << PTE_SHIFT }) 468#define __swp_entry_to_pte(x) ((pte_t) { (x).val << PTE_RPN_SHIFT })
515#define pte_to_pgoff(pte) (pte_val(pte) >> PTE_SHIFT) 469#define pte_to_pgoff(pte) (pte_val(pte) >> PTE_RPN_SHIFT)
516#define pgoff_to_pte(off) ((pte_t) {((off) << PTE_SHIFT)|_PAGE_FILE}) 470#define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE})
517#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_SHIFT) 471#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT)
518 472
519/* 473/*
520 * kern_addr_valid is intended to indicate whether an address is a valid 474 * kern_addr_valid is intended to indicate whether an address is a valid
@@ -532,29 +486,22 @@ void pgtable_cache_init(void);
532/* 486/*
533 * find_linux_pte returns the address of a linux pte for a given 487 * find_linux_pte returns the address of a linux pte for a given
534 * effective address and directory. If not found, it returns zero. 488 * effective address and directory. If not found, it returns zero.
535 */ 489 */static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea)
536static inline pte_t *find_linux_pte(pgd_t *pgdir, unsigned long ea)
537{ 490{
538 pgd_t *pg; 491 pgd_t *pg;
539 pud_t *pu; 492 pud_t *pu;
540 pmd_t *pm; 493 pmd_t *pm;
541 pte_t *pt = NULL; 494 pte_t *pt = NULL;
542 pte_t pte;
543 495
544 pg = pgdir + pgd_index(ea); 496 pg = pgdir + pgd_index(ea);
545 if (!pgd_none(*pg)) { 497 if (!pgd_none(*pg)) {
546 pu = pud_offset(pg, ea); 498 pu = pud_offset(pg, ea);
547 if (!pud_none(*pu)) { 499 if (!pud_none(*pu)) {
548 pm = pmd_offset(pu, ea); 500 pm = pmd_offset(pu, ea);
549 if (pmd_present(*pm)) { 501 if (pmd_present(*pm))
550 pt = pte_offset_kernel(pm, ea); 502 pt = pte_offset_kernel(pm, ea);
551 pte = *pt;
552 if (!pte_present(pte))
553 pt = NULL;
554 }
555 } 503 }
556 } 504 }
557
558 return pt; 505 return pt;
559} 506}
560 507
diff --git a/include/asm-ppc64/plpar_wrappers.h b/include/asm-ppc64/plpar_wrappers.h
deleted file mode 100644
index 72dd2449ee76..000000000000
--- a/include/asm-ppc64/plpar_wrappers.h
+++ /dev/null
@@ -1,120 +0,0 @@
1#ifndef _PPC64_PLPAR_WRAPPERS_H
2#define _PPC64_PLPAR_WRAPPERS_H
3
4#include <asm/hvcall.h>
5
6static inline long poll_pending(void)
7{
8 unsigned long dummy;
9 return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0,
10 &dummy, &dummy, &dummy);
11}
12
13static inline long prod_processor(void)
14{
15 plpar_hcall_norets(H_PROD);
16 return(0);
17}
18
19static inline long cede_processor(void)
20{
21 plpar_hcall_norets(H_CEDE);
22 return(0);
23}
24
25static inline long register_vpa(unsigned long flags, unsigned long proc,
26 unsigned long vpa)
27{
28 return plpar_hcall_norets(H_REGISTER_VPA, flags, proc, vpa);
29}
30
31void vpa_init(int cpu);
32
33static inline long plpar_pte_remove(unsigned long flags,
34 unsigned long ptex,
35 unsigned long avpn,
36 unsigned long *old_pteh_ret,
37 unsigned long *old_ptel_ret)
38{
39 unsigned long dummy;
40 return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0,
41 old_pteh_ret, old_ptel_ret, &dummy);
42}
43
44static inline long plpar_pte_read(unsigned long flags,
45 unsigned long ptex,
46 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret)
47{
48 unsigned long dummy;
49 return plpar_hcall(H_READ, flags, ptex, 0, 0,
50 old_pteh_ret, old_ptel_ret, &dummy);
51}
52
53static inline long plpar_pte_protect(unsigned long flags,
54 unsigned long ptex,
55 unsigned long avpn)
56{
57 return plpar_hcall_norets(H_PROTECT, flags, ptex, avpn);
58}
59
60static inline long plpar_tce_get(unsigned long liobn,
61 unsigned long ioba,
62 unsigned long *tce_ret)
63{
64 unsigned long dummy;
65 return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0,
66 tce_ret, &dummy, &dummy);
67}
68
69static inline long plpar_tce_put(unsigned long liobn,
70 unsigned long ioba,
71 unsigned long tceval)
72{
73 return plpar_hcall_norets(H_PUT_TCE, liobn, ioba, tceval);
74}
75
76static inline long plpar_tce_put_indirect(unsigned long liobn,
77 unsigned long ioba,
78 unsigned long page,
79 unsigned long count)
80{
81 return plpar_hcall_norets(H_PUT_TCE_INDIRECT, liobn, ioba, page, count);
82}
83
84static inline long plpar_tce_stuff(unsigned long liobn,
85 unsigned long ioba,
86 unsigned long tceval,
87 unsigned long count)
88{
89 return plpar_hcall_norets(H_STUFF_TCE, liobn, ioba, tceval, count);
90}
91
92static inline long plpar_get_term_char(unsigned long termno,
93 unsigned long *len_ret,
94 char *buf_ret)
95{
96 unsigned long *lbuf = (unsigned long *)buf_ret; /* ToDo: alignment? */
97 return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0,
98 len_ret, lbuf+0, lbuf+1);
99}
100
101static inline long plpar_put_term_char(unsigned long termno,
102 unsigned long len,
103 const char *buffer)
104{
105 unsigned long *lbuf = (unsigned long *)buffer; /* ToDo: alignment? */
106 return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0],
107 lbuf[1]);
108}
109
110static inline long plpar_set_xdabr(unsigned long address, unsigned long flags)
111{
112 return plpar_hcall_norets(H_SET_XDABR, address, flags);
113}
114
115static inline long plpar_set_dabr(unsigned long val)
116{
117 return plpar_hcall_norets(H_SET_DABR, val);
118}
119
120#endif /* _PPC64_PLPAR_WRAPPERS_H */
diff --git a/include/asm-ppc64/ppc32.h b/include/asm-ppc64/ppc32.h
deleted file mode 100644
index 3945a55d112a..000000000000
--- a/include/asm-ppc64/ppc32.h
+++ /dev/null
@@ -1,122 +0,0 @@
1#ifndef _PPC64_PPC32_H
2#define _PPC64_PPC32_H
3
4#include <linux/compat.h>
5#include <asm/siginfo.h>
6#include <asm/signal.h>
7
8/*
9 * Data types and macros for providing 32b PowerPC support.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 */
16
17/* These are here to support 32-bit syscalls on a 64-bit kernel. */
18
19typedef struct compat_siginfo {
20 int si_signo;
21 int si_errno;
22 int si_code;
23
24 union {
25 int _pad[SI_PAD_SIZE32];
26
27 /* kill() */
28 struct {
29 compat_pid_t _pid; /* sender's pid */
30 compat_uid_t _uid; /* sender's uid */
31 } _kill;
32
33 /* POSIX.1b timers */
34 struct {
35 compat_timer_t _tid; /* timer id */
36 int _overrun; /* overrun count */
37 compat_sigval_t _sigval; /* same as below */
38 int _sys_private; /* not to be passed to user */
39 } _timer;
40
41 /* POSIX.1b signals */
42 struct {
43 compat_pid_t _pid; /* sender's pid */
44 compat_uid_t _uid; /* sender's uid */
45 compat_sigval_t _sigval;
46 } _rt;
47
48 /* SIGCHLD */
49 struct {
50 compat_pid_t _pid; /* which child */
51 compat_uid_t _uid; /* sender's uid */
52 int _status; /* exit code */
53 compat_clock_t _utime;
54 compat_clock_t _stime;
55 } _sigchld;
56
57 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
58 struct {
59 unsigned int _addr; /* faulting insn/memory ref. */
60 } _sigfault;
61
62 /* SIGPOLL */
63 struct {
64 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
65 int _fd;
66 } _sigpoll;
67 } _sifields;
68} compat_siginfo_t;
69
70#define __old_sigaction32 old_sigaction32
71
72struct __old_sigaction32 {
73 compat_uptr_t sa_handler;
74 compat_old_sigset_t sa_mask;
75 unsigned int sa_flags;
76 compat_uptr_t sa_restorer; /* not used by Linux/SPARC yet */
77};
78
79
80
81struct sigaction32 {
82 compat_uptr_t sa_handler; /* Really a pointer, but need to deal with 32 bits */
83 unsigned int sa_flags;
84 compat_uptr_t sa_restorer; /* Another 32 bit pointer */
85 compat_sigset_t sa_mask; /* A 32 bit mask */
86};
87
88typedef struct sigaltstack_32 {
89 unsigned int ss_sp;
90 int ss_flags;
91 compat_size_t ss_size;
92} stack_32_t;
93
94struct sigcontext32 {
95 unsigned int _unused[4];
96 int signal;
97 compat_uptr_t handler;
98 unsigned int oldmask;
99 compat_uptr_t regs; /* 4 byte pointer to the pt_regs32 structure. */
100};
101
102struct mcontext32 {
103 elf_gregset_t32 mc_gregs;
104 elf_fpregset_t mc_fregs;
105 unsigned int mc_pad[2];
106 elf_vrregset_t32 mc_vregs __attribute__((__aligned__(16)));
107};
108
109struct ucontext32 {
110 unsigned int uc_flags;
111 unsigned int uc_link;
112 stack_32_t uc_stack;
113 int uc_pad[7];
114 compat_uptr_t uc_regs; /* points to uc_mcontext field */
115 compat_sigset_t uc_sigmask; /* mask last for extensibility */
116 /* glibc has 1024-bit signal masks, ours are 64-bit */
117 int uc_maskext[30];
118 int uc_pad2[3];
119 struct mcontext32 uc_mcontext;
120};
121
122#endif /* _PPC64_PPC32_H */
diff --git a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h
index e8d0d2ab4c0f..bdb47174ff0e 100644
--- a/include/asm-ppc64/prom.h
+++ b/include/asm-ppc64/prom.h
@@ -188,6 +188,14 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
188extern struct device_node *of_node_get(struct device_node *node); 188extern struct device_node *of_node_get(struct device_node *node);
189extern void of_node_put(struct device_node *node); 189extern void of_node_put(struct device_node *node);
190 190
191/* For scanning the flat device-tree at boot time */
192int __init of_scan_flat_dt(int (*it)(unsigned long node,
193 const char *uname, int depth,
194 void *data),
195 void *data);
196void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
197 unsigned long *size);
198
191/* For updating the device tree at runtime */ 199/* For updating the device tree at runtime */
192extern void of_attach_node(struct device_node *); 200extern void of_attach_node(struct device_node *);
193extern void of_detach_node(const struct device_node *); 201extern void of_detach_node(const struct device_node *);
diff --git a/include/asm-ppc64/spinlock.h b/include/asm-ppc64/spinlock.h
index 14cb895bb607..7d84fb5e39f1 100644
--- a/include/asm-ppc64/spinlock.h
+++ b/include/asm-ppc64/spinlock.h
@@ -21,7 +21,7 @@
21#include <linux/config.h> 21#include <linux/config.h>
22#include <asm/paca.h> 22#include <asm/paca.h>
23#include <asm/hvcall.h> 23#include <asm/hvcall.h>
24#include <asm/iSeries/HvCall.h> 24#include <asm/iseries/hv_call.h>
25 25
26#define __raw_spin_is_locked(x) ((x)->slock != 0) 26#define __raw_spin_is_locked(x) ((x)->slock != 0)
27 27
diff --git a/include/asm-ppc64/stat.h b/include/asm-ppc64/stat.h
deleted file mode 100644
index 973a5f97951d..000000000000
--- a/include/asm-ppc64/stat.h
+++ /dev/null
@@ -1,60 +0,0 @@
1#ifndef _PPC64_STAT_H
2#define _PPC64_STAT_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <linux/types.h>
12
13struct stat {
14 unsigned long st_dev;
15 ino_t st_ino;
16 nlink_t st_nlink;
17 mode_t st_mode;
18 uid_t st_uid;
19 gid_t st_gid;
20 unsigned long st_rdev;
21 off_t st_size;
22 unsigned long st_blksize;
23 unsigned long st_blocks;
24 unsigned long st_atime;
25 unsigned long st_atime_nsec;
26 unsigned long st_mtime;
27 unsigned long st_mtime_nsec;
28 unsigned long st_ctime;
29 unsigned long st_ctime_nsec;
30 unsigned long __unused4;
31 unsigned long __unused5;
32 unsigned long __unused6;
33};
34
35#define STAT_HAVE_NSEC 1
36
37/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
38struct stat64 {
39 unsigned long st_dev; /* Device. */
40 unsigned long st_ino; /* File serial number. */
41 unsigned int st_mode; /* File mode. */
42 unsigned int st_nlink; /* Link count. */
43 unsigned int st_uid; /* User ID of the file's owner. */
44 unsigned int st_gid; /* Group ID of the file's group. */
45 unsigned long st_rdev; /* Device number, if device. */
46 unsigned short __pad2;
47 long st_size; /* Size of file, in bytes. */
48 int st_blksize; /* Optimal block size for I/O. */
49
50 long st_blocks; /* Number 512-byte blocks allocated. */
51 int st_atime; /* Time of last access. */
52 int st_atime_nsec;
53 int st_mtime; /* Time of last modification. */
54 int st_mtime_nsec;
55 int st_ctime; /* Time of last status change. */
56 int st_ctime_nsec;
57 unsigned int __unused4;
58 unsigned int __unused5;
59};
60#endif
diff --git a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
index 99b8ca52f101..0cdd66c9f4b7 100644
--- a/include/asm-ppc64/system.h
+++ b/include/asm-ppc64/system.h
@@ -248,7 +248,7 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
248} 248}
249 249
250static __inline__ unsigned long 250static __inline__ unsigned long
251__cmpxchg_u64(volatile long *p, unsigned long old, unsigned long new) 251__cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
252{ 252{
253 unsigned long prev; 253 unsigned long prev;
254 254
diff --git a/include/asm-ppc64/tlb.h b/include/asm-ppc64/tlb.h
deleted file mode 100644
index 97cb696ce68d..000000000000
--- a/include/asm-ppc64/tlb.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * TLB shootdown specifics for PPC64
3 *
4 * Copyright (C) 2002 Anton Blanchard, IBM Corp.
5 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#ifndef _PPC64_TLB_H
13#define _PPC64_TLB_H
14
15#include <asm/tlbflush.h>
16
17struct mmu_gather;
18
19extern void pte_free_finish(void);
20
21static inline void tlb_flush(struct mmu_gather *tlb)
22{
23 flush_tlb_pending();
24 pte_free_finish();
25}
26
27/* Avoid pulling in another include just for this */
28#define check_pgt_cache() do { } while (0)
29
30/* Get the generic bits... */
31#include <asm-generic/tlb.h>
32
33/* Nothing needed here in fact... */
34#define tlb_start_vma(tlb, vma) do { } while (0)
35#define tlb_end_vma(tlb, vma) do { } while (0)
36
37#define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
38
39#endif /* _PPC64_TLB_H */
diff --git a/include/asm-ppc64/tlbflush.h b/include/asm-ppc64/tlbflush.h
deleted file mode 100644
index 626f505c6ee3..000000000000
--- a/include/asm-ppc64/tlbflush.h
+++ /dev/null
@@ -1,52 +0,0 @@
1#ifndef _PPC64_TLBFLUSH_H
2#define _PPC64_TLBFLUSH_H
3
4/*
5 * TLB flushing:
6 *
7 * - flush_tlb_mm(mm) flushes the specified mm context TLB's
8 * - flush_tlb_page(vma, vmaddr) flushes one page
9 * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB
10 * - flush_tlb_range(vma, start, end) flushes a range of pages
11 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
12 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
13 */
14
15#include <linux/percpu.h>
16#include <asm/page.h>
17
18#define PPC64_TLB_BATCH_NR 192
19
20struct mm_struct;
21struct ppc64_tlb_batch {
22 unsigned long index;
23 struct mm_struct *mm;
24 pte_t pte[PPC64_TLB_BATCH_NR];
25 unsigned long vaddr[PPC64_TLB_BATCH_NR];
26 unsigned int large;
27};
28DECLARE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
29
30extern void __flush_tlb_pending(struct ppc64_tlb_batch *batch);
31
32static inline void flush_tlb_pending(void)
33{
34 struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch);
35
36 if (batch->index)
37 __flush_tlb_pending(batch);
38 put_cpu_var(ppc64_tlb_batch);
39}
40
41#define flush_tlb_mm(mm) flush_tlb_pending()
42#define flush_tlb_page(vma, addr) flush_tlb_pending()
43#define flush_tlb_page_nohash(vma, addr) do { } while (0)
44#define flush_tlb_range(vma, start, end) \
45 do { (void)(start); flush_tlb_pending(); } while (0)
46#define flush_tlb_kernel_range(start, end) flush_tlb_pending()
47#define flush_tlb_pgtables(mm, start, end) do { } while (0)
48
49extern void flush_hash_page(unsigned long va, pte_t pte, int local);
50void flush_hash_range(unsigned long number, int local);
51
52#endif /* _PPC64_TLBFLUSH_H */
diff --git a/include/asm-ppc64/uaccess.h b/include/asm-ppc64/uaccess.h
deleted file mode 100644
index 132c1276547b..000000000000
--- a/include/asm-ppc64/uaccess.h
+++ /dev/null
@@ -1,341 +0,0 @@
1#ifndef _PPC64_UACCESS_H
2#define _PPC64_UACCESS_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#ifndef __ASSEMBLY__
12#include <linux/sched.h>
13#include <linux/errno.h>
14#include <asm/processor.h>
15
16#define VERIFY_READ 0
17#define VERIFY_WRITE 1
18
19/*
20 * The fs value determines whether argument validity checking should be
21 * performed or not. If get_fs() == USER_DS, checking is performed, with
22 * get_fs() == KERNEL_DS, checking is bypassed.
23 *
24 * For historical reasons, these macros are grossly misnamed.
25 */
26
27#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
28
29#define KERNEL_DS MAKE_MM_SEG(0UL)
30#define USER_DS MAKE_MM_SEG(0xf000000000000000UL)
31
32#define get_ds() (KERNEL_DS)
33#define get_fs() (current->thread.fs)
34#define set_fs(val) (current->thread.fs = (val))
35
36#define segment_eq(a,b) ((a).seg == (b).seg)
37
38/*
39 * Use the alpha trick for checking ranges:
40 *
41 * Is a address valid? This does a straightforward calculation rather
42 * than tests.
43 *
44 * Address valid if:
45 * - "addr" doesn't have any high-bits set
46 * - AND "size" doesn't have any high-bits set
47 * - OR we are in kernel mode.
48 *
49 * We dont have to check for high bits in (addr+size) because the first
50 * two checks force the maximum result to be below the start of the
51 * kernel region.
52 */
53#define __access_ok(addr,size,segment) \
54 (((segment).seg & (addr | size )) == 0)
55
56#define access_ok(type,addr,size) \
57 __access_ok(((__force unsigned long)(addr)),(size),get_fs())
58
59/*
60 * The exception table consists of pairs of addresses: the first is the
61 * address of an instruction that is allowed to fault, and the second is
62 * the address at which the program should continue. No registers are
63 * modified, so it is entirely up to the continuation code to figure out
64 * what to do.
65 *
66 * All the routines below use bits of fixup code that are out of line
67 * with the main instruction path. This means when everything is well,
68 * we don't even have to jump over them. Further, they do not intrude
69 * on our cache or tlb entries.
70 */
71
72struct exception_table_entry
73{
74 unsigned long insn, fixup;
75};
76
77/* Returns 0 if exception not found and fixup otherwise. */
78extern unsigned long search_exception_table(unsigned long);
79
80/*
81 * These are the main single-value transfer routines. They automatically
82 * use the right size if we just have the right pointer type.
83 *
84 * This gets kind of ugly. We want to return _two_ values in "get_user()"
85 * and yet we don't want to do any pointers, because that is too much
86 * of a performance impact. Thus we have a few rather ugly macros here,
87 * and hide all the ugliness from the user.
88 *
89 * The "__xxx" versions of the user access functions are versions that
90 * do not verify the address space, that must have been done previously
91 * with a separate "access_ok()" call (this is used when we do multiple
92 * accesses to the same area of user memory).
93 *
94 * As we use the same address space for kernel and user data on the
95 * PowerPC, we can just do these as direct assignments. (Of course, the
96 * exception handling means that it's no longer "just"...)
97 */
98#define get_user(x,ptr) \
99 __get_user_check((x),(ptr),sizeof(*(ptr)))
100#define put_user(x,ptr) \
101 __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
102
103#define __get_user(x,ptr) \
104 __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
105#define __put_user(x,ptr) \
106 __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
107
108#define __get_user_unaligned __get_user
109#define __put_user_unaligned __put_user
110
111extern long __put_user_bad(void);
112
113#define __put_user_nocheck(x,ptr,size) \
114({ \
115 long __pu_err; \
116 might_sleep(); \
117 __chk_user_ptr(ptr); \
118 __put_user_size((x),(ptr),(size),__pu_err,-EFAULT); \
119 __pu_err; \
120})
121
122#define __put_user_check(x,ptr,size) \
123({ \
124 long __pu_err = -EFAULT; \
125 void __user *__pu_addr = (ptr); \
126 might_sleep(); \
127 if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
128 __put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT); \
129 __pu_err; \
130})
131
132#define __put_user_size(x,ptr,size,retval,errret) \
133do { \
134 retval = 0; \
135 switch (size) { \
136 case 1: __put_user_asm(x,ptr,retval,"stb",errret); break; \
137 case 2: __put_user_asm(x,ptr,retval,"sth",errret); break; \
138 case 4: __put_user_asm(x,ptr,retval,"stw",errret); break; \
139 case 8: __put_user_asm(x,ptr,retval,"std",errret); break; \
140 default: __put_user_bad(); \
141 } \
142} while (0)
143
144/*
145 * We don't tell gcc that we are accessing memory, but this is OK
146 * because we do not write to any memory gcc knows about, so there
147 * are no aliasing issues.
148 */
149#define __put_user_asm(x, addr, err, op, errret) \
150 __asm__ __volatile__( \
151 "1: "op" %1,0(%2) # put_user\n" \
152 "2:\n" \
153 ".section .fixup,\"ax\"\n" \
154 "3: li %0,%3\n" \
155 " b 2b\n" \
156 ".previous\n" \
157 ".section __ex_table,\"a\"\n" \
158 " .align 3\n" \
159 " .llong 1b,3b\n" \
160 ".previous" \
161 : "=r"(err) \
162 : "r"(x), "b"(addr), "i"(errret), "0"(err))
163
164
165#define __get_user_nocheck(x,ptr,size) \
166({ \
167 long __gu_err; \
168 unsigned long __gu_val; \
169 might_sleep(); \
170 __get_user_size(__gu_val,(ptr),(size),__gu_err,-EFAULT);\
171 (x) = (__typeof__(*(ptr)))__gu_val; \
172 __gu_err; \
173})
174
175#define __get_user_check(x,ptr,size) \
176({ \
177 long __gu_err = -EFAULT; \
178 unsigned long __gu_val = 0; \
179 const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
180 might_sleep(); \
181 if (access_ok(VERIFY_READ,__gu_addr,size)) \
182 __get_user_size(__gu_val,__gu_addr,(size),__gu_err,-EFAULT);\
183 (x) = (__typeof__(*(ptr)))__gu_val; \
184 __gu_err; \
185})
186
187extern long __get_user_bad(void);
188
189#define __get_user_size(x,ptr,size,retval,errret) \
190do { \
191 retval = 0; \
192 __chk_user_ptr(ptr); \
193 switch (size) { \
194 case 1: __get_user_asm(x,ptr,retval,"lbz",errret); break; \
195 case 2: __get_user_asm(x,ptr,retval,"lhz",errret); break; \
196 case 4: __get_user_asm(x,ptr,retval,"lwz",errret); break; \
197 case 8: __get_user_asm(x,ptr,retval,"ld",errret); break; \
198 default: (x) = __get_user_bad(); \
199 } \
200} while (0)
201
202#define __get_user_asm(x, addr, err, op, errret) \
203 __asm__ __volatile__( \
204 "1: "op" %1,0(%2) # get_user\n" \
205 "2:\n" \
206 ".section .fixup,\"ax\"\n" \
207 "3: li %0,%3\n" \
208 " li %1,0\n" \
209 " b 2b\n" \
210 ".previous\n" \
211 ".section __ex_table,\"a\"\n" \
212 " .align 3\n" \
213 " .llong 1b,3b\n" \
214 ".previous" \
215 : "=r"(err), "=r"(x) \
216 : "b"(addr), "i"(errret), "0"(err))
217
218/* more complex routines */
219
220extern unsigned long __copy_tofrom_user(void __user *to, const void __user *from,
221 unsigned long size);
222
223static inline unsigned long
224__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
225{
226 if (__builtin_constant_p(n)) {
227 unsigned long ret;
228
229 switch (n) {
230 case 1:
231 __get_user_size(*(u8 *)to, from, 1, ret, 1);
232 return ret;
233 case 2:
234 __get_user_size(*(u16 *)to, from, 2, ret, 2);
235 return ret;
236 case 4:
237 __get_user_size(*(u32 *)to, from, 4, ret, 4);
238 return ret;
239 case 8:
240 __get_user_size(*(u64 *)to, from, 8, ret, 8);
241 return ret;
242 }
243 }
244 return __copy_tofrom_user((__force void __user *) to, from, n);
245}
246
247static inline unsigned long
248__copy_from_user(void *to, const void __user *from, unsigned long n)
249{
250 might_sleep();
251 return __copy_from_user_inatomic(to, from, n);
252}
253
254static inline unsigned long
255__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
256{
257 if (__builtin_constant_p(n)) {
258 unsigned long ret;
259
260 switch (n) {
261 case 1:
262 __put_user_size(*(u8 *)from, (u8 __user *)to, 1, ret, 1);
263 return ret;
264 case 2:
265 __put_user_size(*(u16 *)from, (u16 __user *)to, 2, ret, 2);
266 return ret;
267 case 4:
268 __put_user_size(*(u32 *)from, (u32 __user *)to, 4, ret, 4);
269 return ret;
270 case 8:
271 __put_user_size(*(u64 *)from, (u64 __user *)to, 8, ret, 8);
272 return ret;
273 }
274 }
275 return __copy_tofrom_user(to, (__force const void __user *) from, n);
276}
277
278static inline unsigned long
279__copy_to_user(void __user *to, const void *from, unsigned long n)
280{
281 might_sleep();
282 return __copy_to_user_inatomic(to, from, n);
283}
284
285#define __copy_in_user(to, from, size) \
286 __copy_tofrom_user((to), (from), (size))
287
288extern unsigned long copy_from_user(void *to, const void __user *from,
289 unsigned long n);
290extern unsigned long copy_to_user(void __user *to, const void *from,
291 unsigned long n);
292extern unsigned long copy_in_user(void __user *to, const void __user *from,
293 unsigned long n);
294
295extern unsigned long __clear_user(void __user *addr, unsigned long size);
296
297static inline unsigned long
298clear_user(void __user *addr, unsigned long size)
299{
300 might_sleep();
301 if (likely(access_ok(VERIFY_WRITE, addr, size)))
302 size = __clear_user(addr, size);
303 return size;
304}
305
306extern int __strncpy_from_user(char *dst, const char __user *src, long count);
307
308static inline long
309strncpy_from_user(char *dst, const char __user *src, long count)
310{
311 might_sleep();
312 if (likely(access_ok(VERIFY_READ, src, 1)))
313 return __strncpy_from_user(dst, src, count);
314 return -EFAULT;
315}
316
317/*
318 * Return the size of a string (including the ending 0)
319 *
320 * Return 0 for error
321 */
322extern int __strnlen_user(const char __user *str, long len);
323
324/*
325 * Returns the length of the string at str (including the null byte),
326 * or 0 if we hit a page we can't access,
327 * or something > len if we didn't find a null byte.
328 */
329static inline int strnlen_user(const char __user *str, long len)
330{
331 might_sleep();
332 if (likely(access_ok(VERIFY_READ, str, 1)))
333 return __strnlen_user(str, len);
334 return 0;
335}
336
337#define strlen_user(str) strnlen_user((str), 0x7ffffffe)
338
339#endif /* __ASSEMBLY__ */
340
341#endif /* _PPC64_UACCESS_H */
diff --git a/include/asm-ppc64/ucontext.h b/include/asm-ppc64/ucontext.h
deleted file mode 100644
index ef8cc5b37542..000000000000
--- a/include/asm-ppc64/ucontext.h
+++ /dev/null
@@ -1,22 +0,0 @@
1#ifndef _ASMPPC64_UCONTEXT_H
2#define _ASMPPC64_UCONTEXT_H
3
4#include <asm/sigcontext.h>
5
6/*
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13struct ucontext {
14 unsigned long uc_flags;
15 struct ucontext *uc_link;
16 stack_t uc_stack;
17 sigset_t uc_sigmask;
18 sigset_t __unsued[15]; /* Allow for uc_sigmask growth */
19 struct sigcontext uc_mcontext; /* last for extensibility */
20};
21
22#endif /* _ASMPPC64_UCONTEXT_H */
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index 8651524217fd..b07c578b22ea 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -518,8 +518,8 @@ static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr
518 518
519static inline int 519static inline int
520__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) { 520__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
521 return (((volatile char *) addr) 521 return ((((volatile char *) addr)
522 [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7))); 522 [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7)))) != 0;
523} 523}
524 524
525#define test_bit(nr,addr) \ 525#define test_bit(nr,addr) \
diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h
index 3b8bd46832a1..372d51cccd53 100644
--- a/include/asm-s390/elf.h
+++ b/include/asm-s390/elf.h
@@ -96,6 +96,7 @@
96 * ELF register definitions.. 96 * ELF register definitions..
97 */ 97 */
98 98
99#include <linux/sched.h> /* for task_struct */
99#include <asm/ptrace.h> 100#include <asm/ptrace.h>
100#include <asm/user.h> 101#include <asm/user.h>
101#include <asm/system.h> /* for save_access_regs */ 102#include <asm/system.h> /* for save_access_regs */
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index df94f89038cc..9be741bb1496 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -36,6 +36,7 @@
36#include <linux/threads.h> 36#include <linux/threads.h>
37 37
38struct vm_area_struct; /* forward declaration (include/linux/mm.h) */ 38struct vm_area_struct; /* forward declaration (include/linux/mm.h) */
39struct mm_struct;
39 40
40extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096))); 41extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096)));
41extern void paging_init(void); 42extern void paging_init(void);
diff --git a/include/asm-s390/ptrace.h b/include/asm-s390/ptrace.h
index fc7c96edc697..a949cc077cc7 100644
--- a/include/asm-s390/ptrace.h
+++ b/include/asm-s390/ptrace.h
@@ -468,6 +468,8 @@ struct user_regs_struct
468}; 468};
469 469
470#ifdef __KERNEL__ 470#ifdef __KERNEL__
471#define __ARCH_SYS_PTRACE 1
472
471#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) 473#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
472#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) 474#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
473#define profile_pc(regs) instruction_pointer(regs) 475#define profile_pc(regs) instruction_pointer(regs)
diff --git a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
index 38a5cf8ab9e3..10a619da4761 100644
--- a/include/asm-s390/uaccess.h
+++ b/include/asm-s390/uaccess.h
@@ -200,21 +200,37 @@ extern int __put_user_bad(void) __attribute__((noreturn));
200 200
201#define __get_user(x, ptr) \ 201#define __get_user(x, ptr) \
202({ \ 202({ \
203 __typeof__(*(ptr)) __x; \
204 int __gu_err; \ 203 int __gu_err; \
205 __chk_user_ptr(ptr); \ 204 __chk_user_ptr(ptr); \
206 switch (sizeof(*(ptr))) { \ 205 switch (sizeof(*(ptr))) { \
207 case 1: \ 206 case 1: { \
208 case 2: \ 207 unsigned char __x; \
209 case 4: \ 208 __get_user_asm(__x, ptr, __gu_err); \
210 case 8: \ 209 (x) = (__typeof__(*(ptr))) __x; \
210 break; \
211 }; \
212 case 2: { \
213 unsigned short __x; \
214 __get_user_asm(__x, ptr, __gu_err); \
215 (x) = (__typeof__(*(ptr))) __x; \
216 break; \
217 }; \
218 case 4: { \
219 unsigned int __x; \
220 __get_user_asm(__x, ptr, __gu_err); \
221 (x) = (__typeof__(*(ptr))) __x; \
222 break; \
223 }; \
224 case 8: { \
225 unsigned long long __x; \
211 __get_user_asm(__x, ptr, __gu_err); \ 226 __get_user_asm(__x, ptr, __gu_err); \
227 (x) = (__typeof__(*(ptr))) __x; \
212 break; \ 228 break; \
229 }; \
213 default: \ 230 default: \
214 __get_user_bad(); \ 231 __get_user_bad(); \
215 break; \ 232 break; \
216 } \ 233 } \
217 (x) = __x; \
218 __gu_err; \ 234 __gu_err; \
219}) 235})
220 236
diff --git a/include/asm-s390/vtoc.h b/include/asm-s390/vtoc.h
index a14e34e80b88..41d369f38b0e 100644
--- a/include/asm-s390/vtoc.h
+++ b/include/asm-s390/vtoc.h
@@ -1,372 +1,179 @@
1#ifndef __KERNEL__ 1/*
2#include <string.h> 2 * include/asm-s390/vtoc.h
3#include <stdlib.h> 3 *
4#include <stdio.h> 4 * This file contains volume label definitions for DASD devices.
5#include <errno.h> 5 *
6#include <ctype.h> 6 * (C) Copyright IBM Corp. 2005
7#include <time.h> 7 *
8#include <fcntl.h> 8 * Author(s): Volker Sameske <sameske@de.ibm.com>
9#include <unistd.h> 9 *
10 */
11
12#ifndef _ASM_S390_VTOC_H
13#define _ASM_S390_VTOC_H
10 14
11#include <sys/stat.h>
12#include <sys/ioctl.h>
13
14#include <linux/fs.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/hdreg.h>
17#include <asm/dasd.h>
18#endif
19
20
21#define LINE_LENGTH 80
22#define VTOC_START_CC 0x0
23#define VTOC_START_HH 0x1
24#define FIRST_USABLE_CYL 1
25#define FIRST_USABLE_TRK 2
26
27#define DASD_3380_TYPE 13148
28#define DASD_3390_TYPE 13200
29#define DASD_9345_TYPE 37701
30
31#define DASD_3380_VALUE 0xbb60
32#define DASD_3390_VALUE 0xe5a2
33#define DASD_9345_VALUE 0xbc98
34
35#define VOLSER_LENGTH 6
36#define BIG_DISK_SIZE 0x10000
37
38#define VTOC_ERROR "VTOC error:"
39
40 16
41typedef struct ttr 17struct vtoc_ttr
42{ 18{
43 __u16 tt; 19 __u16 tt;
44 __u8 r; 20 __u8 r;
45} __attribute__ ((packed)) ttr_t; 21} __attribute__ ((packed));
46 22
47typedef struct cchhb 23struct vtoc_cchhb
48{ 24{
49 __u16 cc; 25 __u16 cc;
50 __u16 hh; 26 __u16 hh;
51 __u8 b; 27 __u8 b;
52} __attribute__ ((packed)) cchhb_t; 28} __attribute__ ((packed));
53 29
54typedef struct cchh 30struct vtoc_cchh
55{ 31{
56 __u16 cc; 32 __u16 cc;
57 __u16 hh; 33 __u16 hh;
58} __attribute__ ((packed)) cchh_t; 34} __attribute__ ((packed));
59 35
60typedef struct labeldate 36struct vtoc_labeldate
61{ 37{
62 __u8 year; 38 __u8 year;
63 __u16 day; 39 __u16 day;
64} __attribute__ ((packed)) labeldate_t; 40} __attribute__ ((packed));
65 41
66 42struct vtoc_volume_label
67typedef struct volume_label
68{ 43{
69 char volkey[4]; /* volume key = volume label */ 44 char volkey[4]; /* volume key = volume label */
70 char vollbl[4]; /* volume label */ 45 char vollbl[4]; /* volume label */
71 char volid[6]; /* volume identifier */ 46 char volid[6]; /* volume identifier */
72 __u8 security; /* security byte */ 47 __u8 security; /* security byte */
73 cchhb_t vtoc; /* VTOC address */ 48 struct vtoc_cchhb vtoc; /* VTOC address */
74 char res1[5]; /* reserved */ 49 char res1[5]; /* reserved */
75 char cisize[4]; /* CI-size for FBA,... */ 50 char cisize[4]; /* CI-size for FBA,... */
76 /* ...blanks for CKD */ 51 /* ...blanks for CKD */
77 char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */ 52 char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */
78 char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */ 53 char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */
79 char res2[4]; /* reserved */ 54 char res2[4]; /* reserved */
80 char lvtoc[14]; /* owner code for LVTOC */ 55 char lvtoc[14]; /* owner code for LVTOC */
81 char res3[29]; /* reserved */ 56 char res3[29]; /* reserved */
82} __attribute__ ((packed)) volume_label_t; 57} __attribute__ ((packed));
83 58
84 59struct vtoc_extent
85typedef struct extent
86{ 60{
87 __u8 typeind; /* extent type indicator */ 61 __u8 typeind; /* extent type indicator */
88 __u8 seqno; /* extent sequence number */ 62 __u8 seqno; /* extent sequence number */
89 cchh_t llimit; /* starting point of this extent */ 63 struct vtoc_cchh llimit; /* starting point of this extent */
90 cchh_t ulimit; /* ending point of this extent */ 64 struct vtoc_cchh ulimit; /* ending point of this extent */
91} __attribute__ ((packed)) extent_t; 65} __attribute__ ((packed));
92
93 66
94typedef struct dev_const 67struct vtoc_dev_const
95{ 68{
96 __u16 DS4DSCYL; /* number of logical cyls */ 69 __u16 DS4DSCYL; /* number of logical cyls */
97 __u16 DS4DSTRK; /* number of tracks in a logical cylinder */ 70 __u16 DS4DSTRK; /* number of tracks in a logical cylinder */
98 __u16 DS4DEVTK; /* device track length */ 71 __u16 DS4DEVTK; /* device track length */
99 __u8 DS4DEVI; /* non-last keyed record overhead */ 72 __u8 DS4DEVI; /* non-last keyed record overhead */
100 __u8 DS4DEVL; /* last keyed record overhead */ 73 __u8 DS4DEVL; /* last keyed record overhead */
101 __u8 DS4DEVK; /* non-keyed record overhead differential */ 74 __u8 DS4DEVK; /* non-keyed record overhead differential */
102 __u8 DS4DEVFG; /* flag byte */ 75 __u8 DS4DEVFG; /* flag byte */
103 __u16 DS4DEVTL; /* device tolerance */ 76 __u16 DS4DEVTL; /* device tolerance */
104 __u8 DS4DEVDT; /* number of DSCB's per track */ 77 __u8 DS4DEVDT; /* number of DSCB's per track */
105 __u8 DS4DEVDB; /* number of directory blocks per track */ 78 __u8 DS4DEVDB; /* number of directory blocks per track */
106} __attribute__ ((packed)) dev_const_t; 79} __attribute__ ((packed));
107 80
108 81struct vtoc_format1_label
109typedef struct format1_label
110{ 82{
111 char DS1DSNAM[44]; /* data set name */ 83 char DS1DSNAM[44]; /* data set name */
112 __u8 DS1FMTID; /* format identifier */ 84 __u8 DS1FMTID; /* format identifier */
113 char DS1DSSN[6]; /* data set serial number */ 85 char DS1DSSN[6]; /* data set serial number */
114 __u16 DS1VOLSQ; /* volume sequence number */ 86 __u16 DS1VOLSQ; /* volume sequence number */
115 labeldate_t DS1CREDT; /* creation date: ydd */ 87 struct vtoc_labeldate DS1CREDT; /* creation date: ydd */
116 labeldate_t DS1EXPDT; /* expiration date */ 88 struct vtoc_labeldate DS1EXPDT; /* expiration date */
117 __u8 DS1NOEPV; /* number of extents on volume */ 89 __u8 DS1NOEPV; /* number of extents on volume */
118 __u8 DS1NOBDB; /* no. of bytes used in last direction blk */ 90 __u8 DS1NOBDB; /* no. of bytes used in last direction blk */
119 __u8 DS1FLAG1; /* flag 1 */ 91 __u8 DS1FLAG1; /* flag 1 */
120 char DS1SYSCD[13]; /* system code */ 92 char DS1SYSCD[13]; /* system code */
121 labeldate_t DS1REFD; /* date last referenced */ 93 struct vtoc_labeldate DS1REFD; /* date last referenced */
122 __u8 DS1SMSFG; /* system managed storage indicators */ 94 __u8 DS1SMSFG; /* system managed storage indicators */
123 __u8 DS1SCXTF; /* sec. space extension flag byte */ 95 __u8 DS1SCXTF; /* sec. space extension flag byte */
124 __u16 DS1SCXTV; /* secondary space extension value */ 96 __u16 DS1SCXTV; /* secondary space extension value */
125 __u8 DS1DSRG1; /* data set organisation byte 1 */ 97 __u8 DS1DSRG1; /* data set organisation byte 1 */
126 __u8 DS1DSRG2; /* data set organisation byte 2 */ 98 __u8 DS1DSRG2; /* data set organisation byte 2 */
127 __u8 DS1RECFM; /* record format */ 99 __u8 DS1RECFM; /* record format */
128 __u8 DS1OPTCD; /* option code */ 100 __u8 DS1OPTCD; /* option code */
129 __u16 DS1BLKL; /* block length */ 101 __u16 DS1BLKL; /* block length */
130 __u16 DS1LRECL; /* record length */ 102 __u16 DS1LRECL; /* record length */
131 __u8 DS1KEYL; /* key length */ 103 __u8 DS1KEYL; /* key length */
132 __u16 DS1RKP; /* relative key position */ 104 __u16 DS1RKP; /* relative key position */
133 __u8 DS1DSIND; /* data set indicators */ 105 __u8 DS1DSIND; /* data set indicators */
134 __u8 DS1SCAL1; /* secondary allocation flag byte */ 106 __u8 DS1SCAL1; /* secondary allocation flag byte */
135 char DS1SCAL3[3]; /* secondary allocation quantity */ 107 char DS1SCAL3[3]; /* secondary allocation quantity */
136 ttr_t DS1LSTAR; /* last used track and block on track */ 108 struct vtoc_ttr DS1LSTAR; /* last used track and block on track */
137 __u16 DS1TRBAL; /* space remaining on last used track */ 109 __u16 DS1TRBAL; /* space remaining on last used track */
138 __u16 res1; /* reserved */ 110 __u16 res1; /* reserved */
139 extent_t DS1EXT1; /* first extent description */ 111 struct vtoc_extent DS1EXT1; /* first extent description */
140 extent_t DS1EXT2; /* second extent description */ 112 struct vtoc_extent DS1EXT2; /* second extent description */
141 extent_t DS1EXT3; /* third extent description */ 113 struct vtoc_extent DS1EXT3; /* third extent description */
142 cchhb_t DS1PTRDS; /* possible pointer to f2 or f3 DSCB */ 114 struct vtoc_cchhb DS1PTRDS; /* possible pointer to f2 or f3 DSCB */
143} __attribute__ ((packed)) format1_label_t; 115} __attribute__ ((packed));
144 116
145 117struct vtoc_format4_label
146typedef struct format4_label
147{ 118{
148 char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */ 119 char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */
149 __u8 DS4IDFMT; /* format identifier */ 120 __u8 DS4IDFMT; /* format identifier */
150 cchhb_t DS4HPCHR; /* highest address of a format 1 DSCB */ 121 struct vtoc_cchhb DS4HPCHR; /* highest address of a format 1 DSCB */
151 __u16 DS4DSREC; /* number of available DSCB's */ 122 __u16 DS4DSREC; /* number of available DSCB's */
152 cchh_t DS4HCCHH; /* CCHH of next available alternate track */ 123 struct vtoc_cchh DS4HCCHH; /* CCHH of next available alternate track */
153 __u16 DS4NOATK; /* number of remaining alternate tracks */ 124 __u16 DS4NOATK; /* number of remaining alternate tracks */
154 __u8 DS4VTOCI; /* VTOC indicators */ 125 __u8 DS4VTOCI; /* VTOC indicators */
155 __u8 DS4NOEXT; /* number of extents in VTOC */ 126 __u8 DS4NOEXT; /* number of extents in VTOC */
156 __u8 DS4SMSFG; /* system managed storage indicators */ 127 __u8 DS4SMSFG; /* system managed storage indicators */
157 __u8 DS4DEVAC; /* number of alternate cylinders. 128 __u8 DS4DEVAC; /* number of alternate cylinders.
158 Subtract from first two bytes of 129 * Subtract from first two bytes of
159 DS4DEVSZ to get number of usable 130 * DS4DEVSZ to get number of usable
160 cylinders. can be zero. valid 131 * cylinders. can be zero. valid
161 only if DS4DEVAV on. */ 132 * only if DS4DEVAV on. */
162 dev_const_t DS4DEVCT; /* device constants */ 133 struct vtoc_dev_const DS4DEVCT; /* device constants */
163 char DS4AMTIM[8]; /* VSAM time stamp */ 134 char DS4AMTIM[8]; /* VSAM time stamp */
164 char DS4AMCAT[3]; /* VSAM catalog indicator */ 135 char DS4AMCAT[3]; /* VSAM catalog indicator */
165 char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */ 136 char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */
166 char res1[5]; /* reserved */ 137 char res1[5]; /* reserved */
167 char DS4F6PTR[5]; /* pointer to first format 6 DSCB */ 138 char DS4F6PTR[5]; /* pointer to first format 6 DSCB */
168 extent_t DS4VTOCE; /* VTOC extent description */ 139 struct vtoc_extent DS4VTOCE; /* VTOC extent description */
169 char res2[10]; /* reserved */ 140 char res2[10]; /* reserved */
170 __u8 DS4EFLVL; /* extended free-space management level */ 141 __u8 DS4EFLVL; /* extended free-space management level */
171 cchhb_t DS4EFPTR; /* pointer to extended free-space info */ 142 struct vtoc_cchhb DS4EFPTR; /* pointer to extended free-space info */
172 char res3[9]; /* reserved */ 143 char res3[9]; /* reserved */
173} __attribute__ ((packed)) format4_label_t; 144} __attribute__ ((packed));
174 145
175 146struct vtoc_ds5ext
176typedef struct ds5ext
177{ 147{
178 __u16 t; /* RTA of the first track of free extent */ 148 __u16 t; /* RTA of the first track of free extent */
179 __u16 fc; /* number of whole cylinders in free ext. */ 149 __u16 fc; /* number of whole cylinders in free ext. */
180 __u8 ft; /* number of remaining free tracks */ 150 __u8 ft; /* number of remaining free tracks */
181} __attribute__ ((packed)) ds5ext_t; 151} __attribute__ ((packed));
182
183 152
184typedef struct format5_label 153struct vtoc_format5_label
185{ 154{
186 char DS5KEYID[4]; /* key identifier */ 155 char DS5KEYID[4]; /* key identifier */
187 ds5ext_t DS5AVEXT; /* first available (free-space) extent. */ 156 struct vtoc_ds5ext DS5AVEXT; /* first available (free-space) extent. */
188 ds5ext_t DS5EXTAV[7]; /* seven available extents */ 157 struct vtoc_ds5ext DS5EXTAV[7]; /* seven available extents */
189 __u8 DS5FMTID; /* format identifier */ 158 __u8 DS5FMTID; /* format identifier */
190 ds5ext_t DS5MAVET[18]; /* eighteen available extents */ 159 struct vtoc_ds5ext DS5MAVET[18]; /* eighteen available extents */
191 cchhb_t DS5PTRDS; /* pointer to next format5 DSCB */ 160 struct vtoc_cchhb DS5PTRDS; /* pointer to next format5 DSCB */
192} __attribute__ ((packed)) format5_label_t; 161} __attribute__ ((packed));
193 162
194 163struct vtoc_ds7ext
195typedef struct ds7ext
196{ 164{
197 __u32 a; /* starting RTA value */ 165 __u32 a; /* starting RTA value */
198 __u32 b; /* ending RTA value + 1 */ 166 __u32 b; /* ending RTA value + 1 */
199} __attribute__ ((packed)) ds7ext_t; 167} __attribute__ ((packed));
200 168
201 169struct vtoc_format7_label
202typedef struct format7_label
203{ 170{
204 char DS7KEYID[4]; /* key identifier */ 171 char DS7KEYID[4]; /* key identifier */
205 ds7ext_t DS7EXTNT[5]; /* space for 5 extent descriptions */ 172 struct vtoc_ds7ext DS7EXTNT[5]; /* space for 5 extent descriptions */
206 __u8 DS7FMTID; /* format identifier */ 173 __u8 DS7FMTID; /* format identifier */
207 ds7ext_t DS7ADEXT[11]; /* space for 11 extent descriptions */ 174 struct vtoc_ds7ext DS7ADEXT[11]; /* space for 11 extent descriptions */
208 char res1[2]; /* reserved */ 175 char res1[2]; /* reserved */
209 cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */ 176 struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */
210} __attribute__ ((packed)) format7_label_t; 177} __attribute__ ((packed));
211 178
212 179#endif /* _ASM_S390_VTOC_H */
213char * vtoc_ebcdic_enc (
214 unsigned char source[LINE_LENGTH],
215 unsigned char target[LINE_LENGTH],
216 int l);
217char * vtoc_ebcdic_dec (
218 unsigned char source[LINE_LENGTH],
219 unsigned char target[LINE_LENGTH],
220 int l);
221void vtoc_set_extent (
222 extent_t * ext,
223 __u8 typeind,
224 __u8 seqno,
225 cchh_t * lower,
226 cchh_t * upper);
227void vtoc_set_cchh (
228 cchh_t * addr,
229 __u16 cc,
230 __u16 hh);
231void vtoc_set_cchhb (
232 cchhb_t * addr,
233 __u16 cc,
234 __u16 hh,
235 __u8 b);
236void vtoc_set_date (
237 labeldate_t * d,
238 __u8 year,
239 __u16 day);
240
241void vtoc_volume_label_init (
242 volume_label_t *vlabel);
243
244int vtoc_read_volume_label (
245 char * device,
246 unsigned long vlabel_start,
247 volume_label_t * vlabel);
248
249int vtoc_write_volume_label (
250 char *device,
251 unsigned long vlabel_start,
252 volume_label_t *vlabel);
253
254void vtoc_volume_label_set_volser (
255 volume_label_t *vlabel,
256 char *volser);
257
258char *vtoc_volume_label_get_volser (
259 volume_label_t *vlabel,
260 char *volser);
261
262void vtoc_volume_label_set_key (
263 volume_label_t *vlabel,
264 char *key);
265
266void vtoc_volume_label_set_label (
267 volume_label_t *vlabel,
268 char *lbl);
269
270char *vtoc_volume_label_get_label (
271 volume_label_t *vlabel,
272 char *lbl);
273
274void vtoc_read_label (
275 char *device,
276 unsigned long position,
277 format1_label_t *f1,
278 format4_label_t *f4,
279 format5_label_t *f5,
280 format7_label_t *f7);
281
282void vtoc_write_label (
283 char *device,
284 unsigned long position,
285 format1_label_t *f1,
286 format4_label_t *f4,
287 format5_label_t *f5,
288 format7_label_t *f7);
289
290
291void vtoc_init_format1_label (
292 char *volid,
293 unsigned int blksize,
294 extent_t *part_extent,
295 format1_label_t *f1);
296
297
298void vtoc_init_format4_label (
299 format4_label_t *f4lbl,
300 unsigned int usable_partitions,
301 unsigned int cylinders,
302 unsigned int tracks,
303 unsigned int blocks,
304 unsigned int blksize,
305 __u16 dev_type);
306
307void vtoc_update_format4_label (
308 format4_label_t *f4,
309 cchhb_t *highest_f1,
310 __u16 unused_update);
311
312
313void vtoc_init_format5_label (
314 format5_label_t *f5);
315
316void vtoc_update_format5_label_add (
317 format5_label_t *f5,
318 int verbose,
319 int cyl,
320 int trk,
321 __u16 a,
322 __u16 b,
323 __u8 c);
324
325void vtoc_update_format5_label_del (
326 format5_label_t *f5,
327 int verbose,
328 int cyl,
329 int trk,
330 __u16 a,
331 __u16 b,
332 __u8 c);
333
334
335void vtoc_init_format7_label (
336 format7_label_t *f7);
337
338void vtoc_update_format7_label_add (
339 format7_label_t *f7,
340 int verbose,
341 __u32 a,
342 __u32 b);
343
344void vtoc_update_format7_label_del (
345 format7_label_t *f7,
346 int verbose,
347 __u32 a,
348 __u32 b);
349
350
351void vtoc_set_freespace(
352 format4_label_t *f4,
353 format5_label_t *f5,
354 format7_label_t *f7,
355 char ch,
356 int verbose,
357 __u32 start,
358 __u32 stop,
359 int cyl,
360 int trk);
361
362
363
364
365
366
367
368
369
370
371
372
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h
index 8fe00a1981ce..1b63dfeea4f2 100644
--- a/include/asm-sh/elf.h
+++ b/include/asm-sh/elf.h
@@ -111,6 +111,7 @@ typedef struct user_fpu_struct elf_fpregset_t;
111 111
112#ifdef __KERNEL__ 112#ifdef __KERNEL__
113#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 113#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
114struct task_struct;
114extern int dump_task_regs (struct task_struct *, elf_gregset_t *); 115extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
115extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); 116extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
116 117
diff --git a/include/asm-sh/mmzone.h b/include/asm-sh/mmzone.h
deleted file mode 100644
index 0e7406601fdf..000000000000
--- a/include/asm-sh/mmzone.h
+++ /dev/null
@@ -1,61 +0,0 @@
1/*
2 * linux/include/asm-sh/mmzone.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#ifndef __ASM_SH_MMZONE_H
9#define __ASM_SH_MMZONE_H
10
11#include <linux/config.h>
12
13#ifdef CONFIG_DISCONTIGMEM
14
15/* Currently, just for HP690 */
16#define PHYSADDR_TO_NID(phys) ((((phys) - __MEMORY_START) >= 0x01000000)?1:0)
17
18extern pg_data_t discontig_page_data[MAX_NUMNODES];
19extern bootmem_data_t discontig_node_bdata[MAX_NUMNODES];
20
21/*
22 * Following are macros that each numa implmentation must define.
23 */
24
25/*
26 * Given a kernel address, find the home node of the underlying memory.
27 */
28#define KVADDR_TO_NID(kaddr) PHYSADDR_TO_NID(__pa(kaddr))
29
30/*
31 * Return a pointer to the node data for node n.
32 */
33#define NODE_DATA(nid) (&discontig_page_data[nid])
34
35/*
36 * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
37 */
38#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
39
40#define phys_to_page(phys) \
41({ unsigned int node = PHYSADDR_TO_NID(phys); \
42 NODE_MEM_MAP(node) \
43 + (((phys) - NODE_DATA(node)->node_start_paddr) >> PAGE_SHIFT); })
44
45static inline int is_valid_page(struct page *page)
46{
47 unsigned int i;
48
49 for (i = 0; i < MAX_NUMNODES; i++) {
50 if (page >= NODE_MEM_MAP(i) &&
51 page < NODE_MEM_MAP(i) + NODE_DATA(i)->node_size)
52 return 1;
53 }
54 return 0;
55}
56
57#define VALID_PAGE(page) is_valid_page(page)
58#define page_to_phys(page) PHYSADDR(page_address(page))
59
60#endif /* CONFIG_DISCONTIGMEM */
61#endif
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 324e6cc5ecf7..972c3f655b2a 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -93,11 +93,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
93 93
94#define __MEMORY_START CONFIG_MEMORY_START 94#define __MEMORY_START CONFIG_MEMORY_START
95#define __MEMORY_SIZE CONFIG_MEMORY_SIZE 95#define __MEMORY_SIZE CONFIG_MEMORY_SIZE
96#ifdef CONFIG_DISCONTIGMEM
97/* Just for HP690, for now.. */
98#define __MEMORY_START_2ND (__MEMORY_START+0x02000000)
99#define __MEMORY_SIZE_2ND 0x001000000 /* 16MB */
100#endif
101 96
102#define PAGE_OFFSET (0x80000000UL) 97#define PAGE_OFFSET (0x80000000UL)
103#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) 98#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
@@ -105,10 +100,8 @@ typedef struct { unsigned long pgprot; } pgprot_t;
105 100
106#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 101#define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
107 102
108#ifndef CONFIG_DISCONTIGMEM
109#define phys_to_page(phys) (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT)) 103#define phys_to_page(phys) (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT))
110#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START) 104#define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START)
111#endif
112 105
113/* PFN start number, because of __MEMORY_START */ 106/* PFN start number, because of __MEMORY_START */
114#define PFN_START (__MEMORY_START >> PAGE_SHIFT) 107#define PFN_START (__MEMORY_START >> PAGE_SHIFT)
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index aef8ae43de13..bb0efb31a8cb 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -196,7 +196,9 @@ static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _
196static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 196static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
197static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 197static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
198static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } 198static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
199#ifdef CONFIG_HUGETLB_PAGE
199static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } 200static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; }
201#endif
200 202
201/* 203/*
202 * Macro and implementation to make a page protection as uncachable. 204 * Macro and implementation to make a page protection as uncachable.
@@ -282,6 +284,8 @@ typedef pte_t *pte_addr_t;
282#define GET_IOSPACE(pfn) 0 284#define GET_IOSPACE(pfn) 0
283#define GET_PFN(pfn) (pfn) 285#define GET_PFN(pfn) (pfn)
284 286
287struct mm_struct;
288
285/* 289/*
286 * No page table caches to initialise 290 * No page table caches to initialise
287 */ 291 */
diff --git a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h
index 51b05818e4eb..a1906a772df9 100644
--- a/include/asm-sh64/pgtable.h
+++ b/include/asm-sh64/pgtable.h
@@ -24,6 +24,8 @@
24#include <linux/threads.h> 24#include <linux/threads.h>
25#include <linux/config.h> 25#include <linux/config.h>
26 26
27struct vm_area_struct;
28
27extern void paging_init(void); 29extern void paging_init(void);
28 30
29/* We provide our own get_unmapped_area to avoid cache synonym issue */ 31/* We provide our own get_unmapped_area to avoid cache synonym issue */
diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h
index a8ecb2d6977a..714497099a42 100644
--- a/include/asm-sparc/ptrace.h
+++ b/include/asm-sparc/ptrace.h
@@ -60,6 +60,9 @@ struct sparc_stackf {
60#define STACKFRAME_SZ sizeof(struct sparc_stackf) 60#define STACKFRAME_SZ sizeof(struct sparc_stackf)
61 61
62#ifdef __KERNEL__ 62#ifdef __KERNEL__
63
64#define __ARCH_SYS_PTRACE 1
65
63#define user_mode(regs) (!((regs)->psr & PSR_PS)) 66#define user_mode(regs) (!((regs)->psr & PSR_PS))
64#define instruction_pointer(regs) ((regs)->pc) 67#define instruction_pointer(regs) ((regs)->pc)
65unsigned long profile_pc(struct pt_regs *); 68unsigned long profile_pc(struct pt_regs *);
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h
index a8d326a598f0..7ba845320f5c 100644
--- a/include/asm-sparc64/kprobes.h
+++ b/include/asm-sparc64/kprobes.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/percpu.h>
6 7
7typedef u32 kprobe_opcode_t; 8typedef u32 kprobe_opcode_t;
8 9
@@ -18,6 +19,25 @@ struct arch_specific_insn {
18 kprobe_opcode_t insn[MAX_INSN_SIZE]; 19 kprobe_opcode_t insn[MAX_INSN_SIZE];
19}; 20};
20 21
22struct prev_kprobe {
23 struct kprobe *kp;
24 unsigned int status;
25 unsigned long orig_tnpc;
26 unsigned long orig_tstate_pil;
27};
28
29/* per-cpu kprobe control block */
30struct kprobe_ctlblk {
31 unsigned long kprobe_status;
32 unsigned long kprobe_orig_tnpc;
33 unsigned long kprobe_orig_tstate_pil;
34 long *jprobe_saved_esp;
35 struct pt_regs jprobe_saved_regs;
36 struct pt_regs *jprobe_saved_regs_location;
37 struct sparc_stackf jprobe_saved_stack;
38 struct prev_kprobe prev_kprobe;
39};
40
21#ifdef CONFIG_KPROBES 41#ifdef CONFIG_KPROBES
22extern int kprobe_exceptions_notify(struct notifier_block *self, 42extern int kprobe_exceptions_notify(struct notifier_block *self,
23 unsigned long val, void *data); 43 unsigned long val, void *data);
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h
index 6194f771e9fc..7eba90c6c753 100644
--- a/include/asm-sparc64/ptrace.h
+++ b/include/asm-sparc64/ptrace.h
@@ -94,6 +94,9 @@ struct sparc_trapf {
94#define STACKFRAME32_SZ sizeof(struct sparc_stackf32) 94#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
95 95
96#ifdef __KERNEL__ 96#ifdef __KERNEL__
97
98#define __ARCH_SYS_PTRACE 1
99
97#define force_successful_syscall_return() \ 100#define force_successful_syscall_return() \
98do { current_thread_info()->syscall_noerror = 1; \ 101do { current_thread_info()->syscall_noerror = 1; \
99} while (0) 102} while (0)
diff --git a/include/asm-um/ldt-i386.h b/include/asm-um/ldt-i386.h
new file mode 100644
index 000000000000..b42662929b6c
--- /dev/null
+++ b/include/asm-um/ldt-i386.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Licensed under the GPL
4 *
5 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
6 */
7
8#ifndef __ASM_LDT_I386_H
9#define __ASM_LDT_I386_H
10
11#include "asm/semaphore.h"
12#include "asm/arch/ldt.h"
13
14struct mmu_context_skas;
15extern void ldt_host_info(void);
16extern long init_new_ldt(struct mmu_context_skas * to_mm,
17 struct mmu_context_skas * from_mm);
18extern void free_ldt(struct mmu_context_skas * mm);
19
20#define LDT_PAGES_MAX \
21 ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
22#define LDT_ENTRIES_PER_PAGE \
23 (PAGE_SIZE/LDT_ENTRY_SIZE)
24#define LDT_DIRECT_ENTRIES \
25 ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
26
27struct ldt_entry {
28 __u32 a;
29 __u32 b;
30};
31
32typedef struct uml_ldt {
33 int entry_count;
34 struct semaphore semaphore;
35 union {
36 struct ldt_entry * pages[LDT_PAGES_MAX];
37 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
38 };
39} uml_ldt_t;
40
41/*
42 * macros stolen from include/asm-i386/desc.h
43 */
44#define LDT_entry_a(info) \
45 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
46
47#define LDT_entry_b(info) \
48 (((info)->base_addr & 0xff000000) | \
49 (((info)->base_addr & 0x00ff0000) >> 16) | \
50 ((info)->limit & 0xf0000) | \
51 (((info)->read_exec_only ^ 1) << 9) | \
52 ((info)->contents << 10) | \
53 (((info)->seg_not_present ^ 1) << 15) | \
54 ((info)->seg_32bit << 22) | \
55 ((info)->limit_in_pages << 23) | \
56 ((info)->useable << 20) | \
57 0x7000)
58
59#define LDT_empty(info) (\
60 (info)->base_addr == 0 && \
61 (info)->limit == 0 && \
62 (info)->contents == 0 && \
63 (info)->read_exec_only == 1 && \
64 (info)->seg_32bit == 0 && \
65 (info)->limit_in_pages == 0 && \
66 (info)->seg_not_present == 1 && \
67 (info)->useable == 0 )
68
69#endif
diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt.h
index e908439d338a..4466ff6de0fd 100644
--- a/include/asm-um/ldt.h
+++ b/include/asm-um/ldt.h
@@ -1,3 +1,72 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Licensed under the GPL
4 *
5 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
6 */
7
8#ifndef __ASM_LDT_I386_H
9#define __ASM_LDT_I386_H
10
11#include "asm/semaphore.h"
12#include "asm/arch/ldt.h"
13
14struct mmu_context_skas;
15extern void ldt_host_info(void);
16extern long init_new_ldt(struct mmu_context_skas * to_mm,
17 struct mmu_context_skas * from_mm);
18extern void free_ldt(struct mmu_context_skas * mm);
19
20#define LDT_PAGES_MAX \
21 ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
22#define LDT_ENTRIES_PER_PAGE \
23 (PAGE_SIZE/LDT_ENTRY_SIZE)
24#define LDT_DIRECT_ENTRIES \
25 ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
26
27struct ldt_entry {
28 __u32 a;
29 __u32 b;
30};
31
32typedef struct uml_ldt {
33 int entry_count;
34 struct semaphore semaphore;
35 union {
36 struct ldt_entry * pages[LDT_PAGES_MAX];
37 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
38 };
39} uml_ldt_t;
40
41/*
42 * macros stolen from include/asm-i386/desc.h
43 */
44#define LDT_entry_a(info) \
45 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
46
47#define LDT_entry_b(info) \
48 (((info)->base_addr & 0xff000000) | \
49 (((info)->base_addr & 0x00ff0000) >> 16) | \
50 ((info)->limit & 0xf0000) | \
51 (((info)->read_exec_only ^ 1) << 9) | \
52 ((info)->contents << 10) | \
53 (((info)->seg_not_present ^ 1) << 15) | \
54 ((info)->seg_32bit << 22) | \
55 ((info)->limit_in_pages << 23) | \
56 ((info)->useable << 20) | \
57 0x7000)
58
59#define LDT_empty(info) (\
60 (info)->base_addr == 0 && \
61 (info)->limit == 0 && \
62 (info)->contents == 0 && \
63 (info)->read_exec_only == 1 && \
64 (info)->seg_32bit == 0 && \
65 (info)->limit_in_pages == 0 && \
66 (info)->seg_not_present == 1 && \
67 (info)->useable == 0 )
68
69#endif
1#ifndef __UM_LDT_H 70#ifndef __UM_LDT_H
2#define __UM_LDT_H 71#define __UM_LDT_H
3 72
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
index 2edb4f1f789c..9a0e48eb542e 100644
--- a/include/asm-um/mmu_context.h
+++ b/include/asm-um/mmu_context.h
@@ -29,7 +29,8 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
29 * possible. 29 * possible.
30 */ 30 */
31 if (old != new && (current->flags & PF_BORROWED_MM)) 31 if (old != new && (current->flags & PF_BORROWED_MM))
32 force_flush_all(); 32 CHOOSE_MODE(force_flush_all(),
33 switch_mm_skas(&new->context.skas.id));
33} 34}
34 35
35static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 36static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
diff --git a/include/asm-v850/atomic.h b/include/asm-v850/atomic.h
index 8284aa7363f2..395268a8c0de 100644
--- a/include/asm-v850/atomic.h
+++ b/include/asm-v850/atomic.h
@@ -31,7 +31,7 @@ typedef struct { int counter; } atomic_t;
31#define atomic_read(v) ((v)->counter) 31#define atomic_read(v) ((v)->counter)
32#define atomic_set(v,i) (((v)->counter) = (i)) 32#define atomic_set(v,i) (((v)->counter) = (i))
33 33
34extern __inline__ int atomic_add_return (int i, volatile atomic_t *v) 34static inline int atomic_add_return (int i, volatile atomic_t *v)
35{ 35{
36 unsigned long flags; 36 unsigned long flags;
37 int res; 37 int res;
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h
index 0e5c2f210872..b91e799763fd 100644
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -30,7 +30,7 @@
30 * ffz = Find First Zero in word. Undefined if no zero exists, 30 * ffz = Find First Zero in word. Undefined if no zero exists,
31 * so code should check against ~0UL first.. 31 * so code should check against ~0UL first..
32 */ 32 */
33extern __inline__ unsigned long ffz (unsigned long word) 33static inline unsigned long ffz (unsigned long word)
34{ 34{
35 unsigned long result = 0; 35 unsigned long result = 0;
36 36
@@ -135,7 +135,7 @@ extern __inline__ unsigned long ffz (unsigned long word)
135 "m" (*((const char *)(addr) + ((nr) >> 3)))); \ 135 "m" (*((const char *)(addr) + ((nr) >> 3)))); \
136 __test_bit_res; \ 136 __test_bit_res; \
137 }) 137 })
138extern __inline__ int __test_bit (int nr, const void *addr) 138static inline int __test_bit (int nr, const void *addr)
139{ 139{
140 int res; 140 int res;
141 __asm__ __volatile__ ("tst1 %1, [%2]; setf nz, %0" 141 __asm__ __volatile__ ("tst1 %1, [%2]; setf nz, %0"
@@ -157,7 +157,7 @@ extern __inline__ int __test_bit (int nr, const void *addr)
157#define find_first_zero_bit(addr, size) \ 157#define find_first_zero_bit(addr, size) \
158 find_next_zero_bit ((addr), (size), 0) 158 find_next_zero_bit ((addr), (size), 0)
159 159
160extern __inline__ int find_next_zero_bit(const void *addr, int size, int offset) 160static inline int find_next_zero_bit(const void *addr, int size, int offset)
161{ 161{
162 unsigned long *p = ((unsigned long *) addr) + (offset >> 5); 162 unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
163 unsigned long result = offset & ~31UL; 163 unsigned long result = offset & ~31UL;
diff --git a/include/asm-v850/delay.h b/include/asm-v850/delay.h
index 1ce65d48a7c5..6d028e6b2354 100644
--- a/include/asm-v850/delay.h
+++ b/include/asm-v850/delay.h
@@ -16,7 +16,7 @@
16 16
17#include <asm/param.h> 17#include <asm/param.h>
18 18
19extern __inline__ void __delay(unsigned long loops) 19static inline void __delay(unsigned long loops)
20{ 20{
21 if (loops) 21 if (loops)
22 __asm__ __volatile__ ("1: add -1, %0; bnz 1b" 22 __asm__ __volatile__ ("1: add -1, %0; bnz 1b"
@@ -33,7 +33,7 @@ extern __inline__ void __delay(unsigned long loops)
33 33
34extern unsigned long loops_per_jiffy; 34extern unsigned long loops_per_jiffy;
35 35
36extern __inline__ void udelay(unsigned long usecs) 36static inline void udelay(unsigned long usecs)
37{ 37{
38 register unsigned long full_loops, part_loops; 38 register unsigned long full_loops, part_loops;
39 39
diff --git a/include/asm-v850/hw_irq.h b/include/asm-v850/hw_irq.h
index 4bdc98edb9f8..a8aab4342712 100644
--- a/include/asm-v850/hw_irq.h
+++ b/include/asm-v850/hw_irq.h
@@ -1,7 +1,7 @@
1#ifndef __V850_HW_IRQ_H__ 1#ifndef __V850_HW_IRQ_H__
2#define __V850_HW_IRQ_H__ 2#define __V850_HW_IRQ_H__
3 3
4extern inline void hw_resend_irq (struct hw_interrupt_type *h, unsigned int i) 4static inline void hw_resend_irq (struct hw_interrupt_type *h, unsigned int i)
5{ 5{
6} 6}
7 7
diff --git a/include/asm-v850/processor.h b/include/asm-v850/processor.h
index d41f925f5182..98f929427d3d 100644
--- a/include/asm-v850/processor.h
+++ b/include/asm-v850/processor.h
@@ -59,7 +59,7 @@ struct thread_struct {
59 59
60 60
61/* Do necessary setup to start up a newly executed thread. */ 61/* Do necessary setup to start up a newly executed thread. */
62extern inline void start_thread (struct pt_regs *regs, 62static inline void start_thread (struct pt_regs *regs,
63 unsigned long pc, unsigned long usp) 63 unsigned long pc, unsigned long usp)
64{ 64{
65 regs->pc = pc; 65 regs->pc = pc;
@@ -68,7 +68,7 @@ extern inline void start_thread (struct pt_regs *regs,
68} 68}
69 69
70/* Free all resources held by a thread. */ 70/* Free all resources held by a thread. */
71extern inline void release_thread (struct task_struct *dead_task) 71static inline void release_thread (struct task_struct *dead_task)
72{ 72{
73} 73}
74 74
diff --git a/include/asm-v850/semaphore.h b/include/asm-v850/semaphore.h
index df6cdecf6c1f..735baaf3a16e 100644
--- a/include/asm-v850/semaphore.h
+++ b/include/asm-v850/semaphore.h
@@ -24,7 +24,7 @@ struct semaphore {
24#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC (name,1) 24#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC (name,1)
25#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC (name,0) 25#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC (name,0)
26 26
27extern inline void sema_init (struct semaphore *sem, int val) 27static inline void sema_init (struct semaphore *sem, int val)
28{ 28{
29 *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val); 29 *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val);
30} 30}
@@ -52,14 +52,14 @@ extern int __down_interruptible (struct semaphore * sem);
52extern int __down_trylock (struct semaphore * sem); 52extern int __down_trylock (struct semaphore * sem);
53extern void __up (struct semaphore * sem); 53extern void __up (struct semaphore * sem);
54 54
55extern inline void down (struct semaphore * sem) 55static inline void down (struct semaphore * sem)
56{ 56{
57 might_sleep(); 57 might_sleep();
58 if (atomic_dec_return (&sem->count) < 0) 58 if (atomic_dec_return (&sem->count) < 0)
59 __down (sem); 59 __down (sem);
60} 60}
61 61
62extern inline int down_interruptible (struct semaphore * sem) 62static inline int down_interruptible (struct semaphore * sem)
63{ 63{
64 int ret = 0; 64 int ret = 0;
65 might_sleep(); 65 might_sleep();
@@ -68,7 +68,7 @@ extern inline int down_interruptible (struct semaphore * sem)
68 return ret; 68 return ret;
69} 69}
70 70
71extern inline int down_trylock (struct semaphore *sem) 71static inline int down_trylock (struct semaphore *sem)
72{ 72{
73 int ret = 0; 73 int ret = 0;
74 if (atomic_dec_return (&sem->count) < 0) 74 if (atomic_dec_return (&sem->count) < 0)
@@ -76,7 +76,7 @@ extern inline int down_trylock (struct semaphore *sem)
76 return ret; 76 return ret;
77} 77}
78 78
79extern inline void up (struct semaphore * sem) 79static inline void up (struct semaphore * sem)
80{ 80{
81 if (atomic_inc_return (&sem->count) <= 0) 81 if (atomic_inc_return (&sem->count) <= 0)
82 __up (sem); 82 __up (sem);
diff --git a/include/asm-v850/system.h b/include/asm-v850/system.h
index 20f4c738c04e..107decbd6e6c 100644
--- a/include/asm-v850/system.h
+++ b/include/asm-v850/system.h
@@ -81,7 +81,7 @@ static inline int irqs_disabled (void)
81 ((__typeof__ (*(ptr)))__xchg ((unsigned long)(with), (ptr), sizeof (*(ptr)))) 81 ((__typeof__ (*(ptr)))__xchg ((unsigned long)(with), (ptr), sizeof (*(ptr))))
82#define tas(ptr) (xchg ((ptr), 1)) 82#define tas(ptr) (xchg ((ptr), 1))
83 83
84extern inline unsigned long __xchg (unsigned long with, 84static inline unsigned long __xchg (unsigned long with,
85 __volatile__ void *ptr, int size) 85 __volatile__ void *ptr, int size)
86{ 86{
87 unsigned long tmp, flags; 87 unsigned long tmp, flags;
diff --git a/include/asm-v850/tlbflush.h b/include/asm-v850/tlbflush.h
index 501e4498172c..5f2f85f636ea 100644
--- a/include/asm-v850/tlbflush.h
+++ b/include/asm-v850/tlbflush.h
@@ -56,12 +56,12 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
56 BUG (); 56 BUG ();
57} 57}
58 58
59extern inline void flush_tlb_kernel_page(unsigned long addr) 59static inline void flush_tlb_kernel_page(unsigned long addr)
60{ 60{
61 BUG (); 61 BUG ();
62} 62}
63 63
64extern inline void flush_tlb_pgtables(struct mm_struct *mm, 64static inline void flush_tlb_pgtables(struct mm_struct *mm,
65 unsigned long start, unsigned long end) 65 unsigned long start, unsigned long end)
66{ 66{
67 BUG (); 67 BUG ();
diff --git a/include/asm-v850/uaccess.h b/include/asm-v850/uaccess.h
index 188b28597cf1..64563c409bb2 100644
--- a/include/asm-v850/uaccess.h
+++ b/include/asm-v850/uaccess.h
@@ -14,7 +14,7 @@
14#define VERIFY_READ 0 14#define VERIFY_READ 0
15#define VERIFY_WRITE 1 15#define VERIFY_WRITE 1
16 16
17extern inline int access_ok (int type, const void *addr, unsigned long size) 17static inline int access_ok (int type, const void *addr, unsigned long size)
18{ 18{
19 /* XXX I guess we should check against real ram bounds at least, and 19 /* XXX I guess we should check against real ram bounds at least, and
20 possibly make sure ADDR is not within the kernel. 20 possibly make sure ADDR is not within the kernel.
diff --git a/include/asm-v850/unaligned.h b/include/asm-v850/unaligned.h
index 65e38362142b..e30b18653a94 100644
--- a/include/asm-v850/unaligned.h
+++ b/include/asm-v850/unaligned.h
@@ -82,19 +82,19 @@ extern int __bug_unaligned_x(void *ptr);
82 }) 82 })
83 83
84 84
85extern inline void __put_unaligned_2(__u32 __v, register __u8 *__p) 85static inline void __put_unaligned_2(__u32 __v, register __u8 *__p)
86{ 86{
87 *__p++ = __v; 87 *__p++ = __v;
88 *__p++ = __v >> 8; 88 *__p++ = __v >> 8;
89} 89}
90 90
91extern inline void __put_unaligned_4(__u32 __v, register __u8 *__p) 91static inline void __put_unaligned_4(__u32 __v, register __u8 *__p)
92{ 92{
93 __put_unaligned_2(__v >> 16, __p + 2); 93 __put_unaligned_2(__v >> 16, __p + 2);
94 __put_unaligned_2(__v, __p); 94 __put_unaligned_2(__v, __p);
95} 95}
96 96
97extern inline void __put_unaligned_8(const unsigned long long __v, register __u8 *__p) 97static inline void __put_unaligned_8(const unsigned long long __v, register __u8 *__p)
98{ 98{
99 /* 99 /*
100 * tradeoff: 8 bytes of stack for all unaligned puts (2 100 * tradeoff: 8 bytes of stack for all unaligned puts (2
diff --git a/include/asm-x86_64/elf.h b/include/asm-x86_64/elf.h
index a60a35e79222..43862cd6a569 100644
--- a/include/asm-x86_64/elf.h
+++ b/include/asm-x86_64/elf.h
@@ -149,6 +149,8 @@ extern void set_personality_64bit(void);
149 */ 149 */
150#define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) 150#define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X)
151 151
152struct task_struct;
153
152extern int dump_task_regs (struct task_struct *, elf_gregset_t *); 154extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
153extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); 155extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
154 156
diff --git a/include/asm-x86_64/kprobes.h b/include/asm-x86_64/kprobes.h
index 6d6d883fdf6d..4dd7a7e148d4 100644
--- a/include/asm-x86_64/kprobes.h
+++ b/include/asm-x86_64/kprobes.h
@@ -25,6 +25,7 @@
25 */ 25 */
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/ptrace.h> 27#include <linux/ptrace.h>
28#include <linux/percpu.h>
28 29
29struct pt_regs; 30struct pt_regs;
30 31
@@ -48,6 +49,24 @@ struct arch_specific_insn {
48 kprobe_opcode_t *insn; 49 kprobe_opcode_t *insn;
49}; 50};
50 51
52struct prev_kprobe {
53 struct kprobe *kp;
54 unsigned long status;
55 unsigned long old_rflags;
56 unsigned long saved_rflags;
57};
58
59/* per-cpu kprobe control block */
60struct kprobe_ctlblk {
61 unsigned long kprobe_status;
62 unsigned long kprobe_old_rflags;
63 unsigned long kprobe_saved_rflags;
64 long *jprobe_saved_rsp;
65 struct pt_regs jprobe_saved_regs;
66 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
67 struct prev_kprobe prev_kprobe;
68};
69
51/* trap3/1 are intr gates for kprobes. So, restore the status of IF, 70/* trap3/1 are intr gates for kprobes. So, restore the status of IF,
52 * if necessary, before executing the original int3/1 (trap) handler. 71 * if necessary, before executing the original int3/1 (trap) handler.
53 */ 72 */
diff --git a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
index 7a07196a7202..7309fffeec9a 100644
--- a/include/asm-x86_64/pgtable.h
+++ b/include/asm-x86_64/pgtable.h
@@ -105,6 +105,8 @@ static inline void pgd_clear (pgd_t * pgd)
105 105
106#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) 106#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0))
107 107
108struct mm_struct;
109
108static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full) 110static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long addr, pte_t *ptep, int full)
109{ 111{
110 pte_t pte; 112 pte_t pte;
diff --git a/include/asm-xtensa/elf.h b/include/asm-xtensa/elf.h
index 64f1f53874fe..de0667453b2e 100644
--- a/include/asm-xtensa/elf.h
+++ b/include/asm-xtensa/elf.h
@@ -209,6 +209,8 @@ extern void xtensa_elf_core_copy_regs (xtensa_gregset_t *, struct pt_regs *);
209 209
210#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 210#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)
211 211
212struct task_struct;
213
212extern void do_copy_regs (xtensa_gregset_t*, struct pt_regs*, 214extern void do_copy_regs (xtensa_gregset_t*, struct pt_regs*,
213 struct task_struct*); 215 struct task_struct*);
214extern void do_restore_regs (xtensa_gregset_t*, struct pt_regs*, 216extern void do_restore_regs (xtensa_gregset_t*, struct pt_regs*,
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
index 987e3b802313..7b15afb70c56 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/include/asm-xtensa/pgtable.h
@@ -278,6 +278,8 @@ static inline void update_pte(pte_t *ptep, pte_t pteval)
278#endif 278#endif
279} 279}
280 280
281struct mm_struct;
282
281static inline void 283static inline void
282set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval) 284set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval)
283{ 285{
@@ -294,6 +296,7 @@ set_pmd(pmd_t *pmdp, pmd_t pmdval)
294#endif 296#endif
295} 297}
296 298
299struct vm_area_struct;
297 300
298static inline int 301static inline int
299ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, 302ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr,
diff --git a/include/asm-xtensa/semaphore.h b/include/asm-xtensa/semaphore.h
index 2a10e193b929..f10c3487cd4c 100644
--- a/include/asm-xtensa/semaphore.h
+++ b/include/asm-xtensa/semaphore.h
@@ -38,6 +38,7 @@ struct semaphore {
38static inline void sema_init (struct semaphore *sem, int val) 38static inline void sema_init (struct semaphore *sem, int val)
39{ 39{
40 atomic_set(&sem->count, val); 40 atomic_set(&sem->count, val);
41 sem->sleepers = 0;
41 init_waitqueue_head(&sem->wait); 42 init_waitqueue_head(&sem->wait);
42} 43}
43 44
diff --git a/include/linux/aio.h b/include/linux/aio.h
index 0decf66117c1..403d71dcb7c8 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -183,6 +183,7 @@ struct kioctx {
183 struct list_head active_reqs; /* used for cancellation */ 183 struct list_head active_reqs; /* used for cancellation */
184 struct list_head run_list; /* used for kicked reqs */ 184 struct list_head run_list; /* used for kicked reqs */
185 185
186 /* sys_io_setup currently limits this to an unsigned int */
186 unsigned max_reqs; 187 unsigned max_reqs;
187 188
188 struct aio_ring_info ring_info; 189 struct aio_ring_info ring_info;
@@ -234,7 +235,7 @@ static inline struct kiocb *list_kiocb(struct list_head *h)
234} 235}
235 236
236/* for sysctl: */ 237/* for sysctl: */
237extern atomic_t aio_nr; 238extern unsigned long aio_nr;
238extern unsigned aio_max_nr; 239extern unsigned long aio_max_nr;
239 240
240#endif /* __LINUX__AIO_H */ 241#endif /* __LINUX__AIO_H */
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
new file mode 100644
index 000000000000..70ab56317380
--- /dev/null
+++ b/include/linux/cn_proc.h
@@ -0,0 +1,127 @@
1/*
2 * cn_proc.h - process events connector
3 *
4 * Copyright (C) Matt Helsley, IBM Corp. 2005
5 * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin
6 * Original copyright notice follows:
7 * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com>
8 * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net>
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 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#ifndef CN_PROC_H
26#define CN_PROC_H
27
28#include <linux/types.h>
29#include <linux/connector.h>
30
31/*
32 * Userspace sends this enum to register with the kernel that it is listening
33 * for events on the connector.
34 */
35enum proc_cn_mcast_op {
36 PROC_CN_MCAST_LISTEN = 1,
37 PROC_CN_MCAST_IGNORE = 2
38};
39
40/*
41 * From the user's point of view, the process
42 * ID is the thread group ID and thread ID is the internal
43 * kernel "pid". So, fields are assigned as follow:
44 *
45 * In user space - In kernel space
46 *
47 * parent process ID = parent->tgid
48 * parent thread ID = parent->pid
49 * child process ID = child->tgid
50 * child thread ID = child->pid
51 */
52
53struct proc_event {
54 enum what {
55 /* Use successive bits so the enums can be used to record
56 * sets of events as well
57 */
58 PROC_EVENT_NONE = 0x00000000,
59 PROC_EVENT_FORK = 0x00000001,
60 PROC_EVENT_EXEC = 0x00000002,
61 PROC_EVENT_UID = 0x00000004,
62 PROC_EVENT_GID = 0x00000040,
63 /* "next" should be 0x00000400 */
64 /* "last" is the last process event: exit */
65 PROC_EVENT_EXIT = 0x80000000
66 } what;
67 __u32 cpu;
68 union { /* must be last field of proc_event struct */
69 struct {
70 __u32 err;
71 } ack;
72
73 struct fork_proc_event {
74 pid_t parent_pid;
75 pid_t parent_tgid;
76 pid_t child_pid;
77 pid_t child_tgid;
78 } fork;
79
80 struct exec_proc_event {
81 pid_t process_pid;
82 pid_t process_tgid;
83 } exec;
84
85 struct id_proc_event {
86 pid_t process_pid;
87 pid_t process_tgid;
88 union {
89 uid_t ruid; /* current->uid */
90 gid_t rgid; /* current->gid */
91 } r;
92 union {
93 uid_t euid;
94 gid_t egid;
95 } e;
96 } id;
97
98 struct exit_proc_event {
99 pid_t process_pid;
100 pid_t process_tgid;
101 __u32 exit_code, exit_signal;
102 } exit;
103 } event_data;
104};
105
106#ifdef __KERNEL__
107#ifdef CONFIG_PROC_EVENTS
108void proc_fork_connector(struct task_struct *task);
109void proc_exec_connector(struct task_struct *task);
110void proc_id_connector(struct task_struct *task, int which_id);
111void proc_exit_connector(struct task_struct *task);
112#else
113static inline void proc_fork_connector(struct task_struct *task)
114{}
115
116static inline void proc_exec_connector(struct task_struct *task)
117{}
118
119static inline void proc_id_connector(struct task_struct *task,
120 int which_id)
121{}
122
123static inline void proc_exit_connector(struct task_struct *task)
124{}
125#endif /* CONFIG_PROC_EVENTS */
126#endif /* __KERNEL__ */
127#endif /* CN_PROC_H */
diff --git a/include/linux/config.h b/include/linux/config.h
index 9d1c14f7ad6d..a91f5e55b525 100644
--- a/include/linux/config.h
+++ b/include/linux/config.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_CONFIG_H 1#ifndef _LINUX_CONFIG_H
2#define _LINUX_CONFIG_H 2#define _LINUX_CONFIG_H
3 3/* This file is no longer in use and kept only for backward compatibility.
4 * autoconf.h is now included via -imacros on the commandline
5 */
4#include <linux/autoconf.h> 6#include <linux/autoconf.h>
5 7
6#endif 8#endif
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 95952cc1f525..c5769c6585f4 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -27,6 +27,12 @@
27#define CN_IDX_CONNECTOR 0xffffffff 27#define CN_IDX_CONNECTOR 0xffffffff
28#define CN_VAL_CONNECTOR 0xffffffff 28#define CN_VAL_CONNECTOR 0xffffffff
29 29
30/*
31 * Process Events connector unique ids -- used for message routing
32 */
33#define CN_IDX_PROC 0x1
34#define CN_VAL_PROC 0x1
35
30#define CN_NETLINK_USERS 1 36#define CN_NETLINK_USERS 1
31 37
32/* 38/*
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
index 725be90ef55e..f8e5587a0f92 100644
--- a/include/linux/console_struct.h
+++ b/include/linux/console_struct.h
@@ -9,6 +9,8 @@
9 * to achieve effects such as fast scrolling by changing the origin. 9 * to achieve effects such as fast scrolling by changing the origin.
10 */ 10 */
11 11
12#include <linux/vt.h>
13
12struct vt_struct; 14struct vt_struct;
13 15
14#define NPAR 16 16#define NPAR 16
diff --git a/include/linux/dqblk_xfs.h b/include/linux/dqblk_xfs.h
index cb31719ee192..2fda1b2aabd9 100644
--- a/include/linux/dqblk_xfs.h
+++ b/include/linux/dqblk_xfs.h
@@ -1,22 +1,18 @@
1/* 1/*
2 * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 1995-2001,2004 Silicon Graphics, Inc. All Rights Reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2.1 of the GNU Lesser General Public License 5 * modify it under the terms of the GNU Lesser General Public License
6 * as published by the Free Software Foundation. 6 * as published by the Free Software Foundation.
7 * 7 *
8 * This program is distributed in the hope that it will be useful, 8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details. 11 * GNU Lesser General Public License for more details.
12 * 12 *
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU Lesset General Public License
14 * along with this program; if not, write to the Free Software 14 * along with this program; if not, write to the Free Software Foundation,
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 * USA
17 *
18 * Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
19 * Mountain View, CA 94043, USA, or: http://www.sgi.com
20 */ 16 */
21#ifndef _LINUX_DQBLK_XFS_H 17#ifndef _LINUX_DQBLK_XFS_H
22#define _LINUX_DQBLK_XFS_H 18#define _LINUX_DQBLK_XFS_H
@@ -32,7 +28,8 @@
32 28
33#define XQM_USRQUOTA 0 /* system call user quota type */ 29#define XQM_USRQUOTA 0 /* system call user quota type */
34#define XQM_GRPQUOTA 1 /* system call group quota type */ 30#define XQM_GRPQUOTA 1 /* system call group quota type */
35#define XQM_MAXQUOTAS 2 31#define XQM_PRJQUOTA 2 /* system call project quota type */
32#define XQM_MAXQUOTAS 3
36 33
37#define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */ 34#define Q_XQUOTAON XQM_CMD(1) /* enable accounting/enforcement */
38#define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */ 35#define Q_XQUOTAOFF XQM_CMD(2) /* disable accounting/enforcement */
@@ -40,6 +37,7 @@
40#define Q_XSETQLIM XQM_CMD(4) /* set disk limits */ 37#define Q_XSETQLIM XQM_CMD(4) /* set disk limits */
41#define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */ 38#define Q_XGETQSTAT XQM_CMD(5) /* get quota subsystem status */
42#define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */ 39#define Q_XQUOTARM XQM_CMD(6) /* free disk space used by dquots */
40#define Q_XQUOTASYNC XQM_CMD(7) /* delalloc flush, updates dquots */
43 41
44/* 42/*
45 * fs_disk_quota structure: 43 * fs_disk_quota structure:
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index cc84934f9059..5f49a30eb6f2 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -48,8 +48,10 @@ static inline void eth_copy_and_sum (struct sk_buff *dest,
48} 48}
49 49
50/** 50/**
51 * is_zero_ether_addr - Determine if give Ethernet address is all 51 * is_zero_ether_addr - Determine if give Ethernet address is all zeros.
52 * zeros. 52 * @addr: Pointer to a six-byte array containing the Ethernet address
53 *
54 * Return true if the address is all zeroes.
53 */ 55 */
54static inline int is_zero_ether_addr(const u8 *addr) 56static inline int is_zero_ether_addr(const u8 *addr)
55{ 57{
@@ -57,9 +59,7 @@ static inline int is_zero_ether_addr(const u8 *addr)
57} 59}
58 60
59/** 61/**
60 * is_multicast_ether_addr - Determine if the given Ethernet address is a 62 * is_multicast_ether_addr - Determine if the Ethernet address is a multicast.
61 * multicast address.
62 *
63 * @addr: Pointer to a six-byte array containing the Ethernet address 63 * @addr: Pointer to a six-byte array containing the Ethernet address
64 * 64 *
65 * Return true if the address is a multicast address. 65 * Return true if the address is a multicast address.
@@ -69,10 +69,15 @@ static inline int is_multicast_ether_addr(const u8 *addr)
69 return ((addr[0] != 0xff) && (0x01 & addr[0])); 69 return ((addr[0] != 0xff) && (0x01 & addr[0]));
70} 70}
71 71
72/**
73 * is_broadcast_ether_addr - Determine if the Ethernet address is broadcast
74 * @addr: Pointer to a six-byte array containing the Ethernet address
75 *
76 * Return true if the address is the broadcast address.
77 */
72static inline int is_broadcast_ether_addr(const u8 *addr) 78static inline int is_broadcast_ether_addr(const u8 *addr)
73{ 79{
74 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && 80 return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
75 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
76} 81}
77 82
78/** 83/**
@@ -108,14 +113,14 @@ static inline void random_ether_addr(u8 *addr)
108/** 113/**
109 * compare_ether_addr - Compare two Ethernet addresses 114 * compare_ether_addr - Compare two Ethernet addresses
110 * @addr1: Pointer to a six-byte array containing the Ethernet address 115 * @addr1: Pointer to a six-byte array containing the Ethernet address
111 * @addr2 Pointer other six-byte array containing the Ethernet address 116 * @addr2: Pointer other six-byte array containing the Ethernet address
112 * 117 *
113 * Compare two ethernet addresses, returns 0 if equal 118 * Compare two ethernet addresses, returns 0 if equal
114 */ 119 */
115static inline unsigned compare_ether_addr(const u8 *_a, const u8 *_b) 120static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
116{ 121{
117 const u16 *a = (const u16 *) _a; 122 const u16 *a = (const u16 *) addr1;
118 const u16 *b = (const u16 *) _b; 123 const u16 *b = (const u16 *) addr2;
119 124
120 BUILD_BUG_ON(ETH_ALEN != 6); 125 BUILD_BUG_ON(ETH_ALEN != 6);
121 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 126 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index d2c390eff1b2..93535f093216 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -453,10 +453,11 @@ struct ethtool_ops {
453 * it was foced up into this mode or autonegotiated. 453 * it was foced up into this mode or autonegotiated.
454 */ 454 */
455 455
456/* The forced speed, 10Mb, 100Mb, gigabit, 10GbE. */ 456/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
457#define SPEED_10 10 457#define SPEED_10 10
458#define SPEED_100 100 458#define SPEED_100 100
459#define SPEED_1000 1000 459#define SPEED_1000 1000
460#define SPEED_2500 2500
460#define SPEED_10000 10000 461#define SPEED_10000 10000
461 462
462/* Duplex, half or full. */ 463/* Duplex, half or full. */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index c698055266d0..e7ff98e395f6 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -810,7 +810,6 @@ struct fb_info {
810extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); 810extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var);
811extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); 811extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var);
812extern int fb_blank(struct fb_info *info, int blank); 812extern int fb_blank(struct fb_info *info, int blank);
813extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
814extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); 813extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
815extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); 814extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
816extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image); 815extern void cfb_imageblit(struct fb_info *info, const struct fb_image *image);
@@ -898,11 +897,13 @@ extern struct fb_videomode *fb_match_mode(struct fb_var_screeninfo *var,
898 struct list_head *head); 897 struct list_head *head);
899extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var, 898extern struct fb_videomode *fb_find_best_mode(struct fb_var_screeninfo *var,
900 struct list_head *head); 899 struct list_head *head);
901extern struct fb_videomode *fb_find_nearest_mode(struct fb_var_screeninfo *var, 900extern struct fb_videomode *fb_find_nearest_mode(struct fb_videomode *mode,
902 struct list_head *head); 901 struct list_head *head);
903extern void fb_destroy_modelist(struct list_head *head); 902extern void fb_destroy_modelist(struct list_head *head);
904extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num, 903extern void fb_videomode_to_modelist(struct fb_videomode *modedb, int num,
905 struct list_head *head); 904 struct list_head *head);
905extern struct fb_videomode *fb_find_best_display(struct fb_monspecs *specs,
906 struct list_head *head);
906 907
907/* drivers/video/fbcmap.c */ 908/* drivers/video/fbcmap.c */
908extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp); 909extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
diff --git a/include/linux/file.h b/include/linux/file.h
index f5bbd4c508b3..d3b1a15d5f21 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -59,9 +59,9 @@ extern void FASTCALL(set_close_on_exec(unsigned int fd, int flag));
59extern void put_filp(struct file *); 59extern void put_filp(struct file *);
60extern int get_unused_fd(void); 60extern int get_unused_fd(void);
61extern void FASTCALL(put_unused_fd(unsigned int fd)); 61extern void FASTCALL(put_unused_fd(unsigned int fd));
62struct kmem_cache_s; 62struct kmem_cache;
63extern void filp_ctor(void * objp, struct kmem_cache_s *cachep, unsigned long cflags); 63extern void filp_ctor(void * objp, struct kmem_cache *cachep, unsigned long cflags);
64extern void filp_dtor(void * objp, struct kmem_cache_s *cachep, unsigned long dflags); 64extern void filp_dtor(void * objp, struct kmem_cache *cachep, unsigned long dflags);
65 65
66extern struct file ** alloc_fd_array(int); 66extern struct file ** alloc_fd_array(int);
67extern void free_fd_array(struct file **, int); 67extern void free_fd_array(struct file **, int);
diff --git a/include/linux/font.h b/include/linux/font.h
index 53b129f07f6f..8aac48c37f3d 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -31,6 +31,7 @@ struct font_desc {
31#define SUN12x22_IDX 7 31#define SUN12x22_IDX 7
32#define ACORN8x8_IDX 8 32#define ACORN8x8_IDX 8
33#define MINI4x6_IDX 9 33#define MINI4x6_IDX 9
34#define RL_IDX 10
34 35
35extern const struct font_desc font_vga_8x8, 36extern const struct font_desc font_vga_8x8,
36 font_vga_8x16, 37 font_vga_8x16,
@@ -41,6 +42,7 @@ extern const struct font_desc font_vga_8x8,
41 font_sun_8x16, 42 font_sun_8x16,
42 font_sun_12x22, 43 font_sun_12x22,
43 font_acorn_8x8, 44 font_acorn_8x8,
45 font_rl,
44 font_mini_4x6; 46 font_mini_4x6;
45 47
46/* Find a font with a specific name */ 48/* Find a font with a specific name */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6d6226732c93..9a593ef262ef 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -264,6 +264,7 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
264#define ATTR_ATTR_FLAG 1024 264#define ATTR_ATTR_FLAG 1024
265#define ATTR_KILL_SUID 2048 265#define ATTR_KILL_SUID 2048
266#define ATTR_KILL_SGID 4096 266#define ATTR_KILL_SGID 4096
267#define ATTR_FILE 8192
267 268
268/* 269/*
269 * This is the Inode Attributes structure, used for notify_change(). It 270 * This is the Inode Attributes structure, used for notify_change(). It
@@ -283,6 +284,13 @@ struct iattr {
283 struct timespec ia_atime; 284 struct timespec ia_atime;
284 struct timespec ia_mtime; 285 struct timespec ia_mtime;
285 struct timespec ia_ctime; 286 struct timespec ia_ctime;
287
288 /*
289 * Not an attribute, but an auxilary info for filesystems wanting to
290 * implement an ftruncate() like method. NOTE: filesystem should
291 * check for (ia_valid & ATTR_FILE), and not for (ia_file != NULL).
292 */
293 struct file *ia_file;
286}; 294};
287 295
288/* 296/*
@@ -1088,6 +1096,8 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1088 * @get_name: find the name for a given inode in a given directory 1096 * @get_name: find the name for a given inode in a given directory
1089 * @get_parent: find the parent of a given directory 1097 * @get_parent: find the parent of a given directory
1090 * @get_dentry: find a dentry for the inode given a file handle sub-fragment 1098 * @get_dentry: find a dentry for the inode given a file handle sub-fragment
1099 * @find_exported_dentry:
1100 * set by the exporting module to a standard helper function.
1091 * 1101 *
1092 * Description: 1102 * Description:
1093 * The export_operations structure provides a means for nfsd to communicate 1103 * The export_operations structure provides a means for nfsd to communicate
@@ -1288,7 +1298,7 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1288 1298
1289/* fs/open.c */ 1299/* fs/open.c */
1290 1300
1291extern int do_truncate(struct dentry *, loff_t start); 1301extern int do_truncate(struct dentry *, loff_t start, struct file *filp);
1292extern long do_sys_open(const char __user *filename, int flags, int mode); 1302extern long do_sys_open(const char __user *filename, int flags, int mode);
1293extern struct file *filp_open(const char *, int, int); 1303extern struct file *filp_open(const char *, int, int);
1294extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1304extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index f98854c2abd7..b76b558b03d4 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -14,7 +14,7 @@
14#define FUSE_KERNEL_VERSION 7 14#define FUSE_KERNEL_VERSION 7
15 15
16/** Minor version number of this interface */ 16/** Minor version number of this interface */
17#define FUSE_KERNEL_MINOR_VERSION 2 17#define FUSE_KERNEL_MINOR_VERSION 3
18 18
19/** The node ID of the root inode */ 19/** The node ID of the root inode */
20#define FUSE_ROOT_ID 1 20#define FUSE_ROOT_ID 1
@@ -61,6 +61,7 @@ struct fuse_kstatfs {
61#define FATTR_SIZE (1 << 3) 61#define FATTR_SIZE (1 << 3)
62#define FATTR_ATIME (1 << 4) 62#define FATTR_ATIME (1 << 4)
63#define FATTR_MTIME (1 << 5) 63#define FATTR_MTIME (1 << 5)
64#define FATTR_FH (1 << 6)
64 65
65/** 66/**
66 * Flags returned by the OPEN request 67 * Flags returned by the OPEN request
@@ -99,7 +100,9 @@ enum fuse_opcode {
99 FUSE_OPENDIR = 27, 100 FUSE_OPENDIR = 27,
100 FUSE_READDIR = 28, 101 FUSE_READDIR = 28,
101 FUSE_RELEASEDIR = 29, 102 FUSE_RELEASEDIR = 29,
102 FUSE_FSYNCDIR = 30 103 FUSE_FSYNCDIR = 30,
104 FUSE_ACCESS = 34,
105 FUSE_CREATE = 35
103}; 106};
104 107
105/* Conservative buffer size for the client */ 108/* Conservative buffer size for the client */
@@ -152,12 +155,25 @@ struct fuse_link_in {
152struct fuse_setattr_in { 155struct fuse_setattr_in {
153 __u32 valid; 156 __u32 valid;
154 __u32 padding; 157 __u32 padding;
155 struct fuse_attr attr; 158 __u64 fh;
159 __u64 size;
160 __u64 unused1;
161 __u64 atime;
162 __u64 mtime;
163 __u64 unused2;
164 __u32 atimensec;
165 __u32 mtimensec;
166 __u32 unused3;
167 __u32 mode;
168 __u32 unused4;
169 __u32 uid;
170 __u32 gid;
171 __u32 unused5;
156}; 172};
157 173
158struct fuse_open_in { 174struct fuse_open_in {
159 __u32 flags; 175 __u32 flags;
160 __u32 padding; 176 __u32 mode;
161}; 177};
162 178
163struct fuse_open_out { 179struct fuse_open_out {
@@ -222,6 +238,11 @@ struct fuse_getxattr_out {
222 __u32 padding; 238 __u32 padding;
223}; 239};
224 240
241struct fuse_access_in {
242 __u32 mask;
243 __u32 padding;
244};
245
225struct fuse_init_in_out { 246struct fuse_init_in_out {
226 __u32 major; 247 __u32 major;
227 __u32 minor; 248 __u32 minor;
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 18d010bee635..cd6bd001ba4e 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -94,7 +94,7 @@ extern struct resource iomem_resource;
94extern int request_resource(struct resource *root, struct resource *new); 94extern int request_resource(struct resource *root, struct resource *new);
95extern struct resource * ____request_resource(struct resource *root, struct resource *new); 95extern struct resource * ____request_resource(struct resource *root, struct resource *new);
96extern int release_resource(struct resource *new); 96extern int release_resource(struct resource *new);
97extern int insert_resource(struct resource *parent, struct resource *new); 97extern __deprecated_for_modules int insert_resource(struct resource *parent, struct resource *new);
98extern int allocate_resource(struct resource *root, struct resource *new, 98extern int allocate_resource(struct resource *root, struct resource *new,
99 unsigned long size, 99 unsigned long size,
100 unsigned long min, unsigned long max, 100 unsigned long min, unsigned long max,
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 938d55b813a5..d6276e60b3bf 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -256,10 +256,7 @@ struct ipmi_recv_msg
256}; 256};
257 257
258/* Allocate and free the receive message. */ 258/* Allocate and free the receive message. */
259static inline void ipmi_free_recv_msg(struct ipmi_recv_msg *msg) 259void ipmi_free_recv_msg(struct ipmi_recv_msg *msg);
260{
261 msg->done(msg);
262}
263 260
264struct ipmi_user_hndl 261struct ipmi_user_hndl
265{ 262{
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 69681c3b1f05..c516382fbec2 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13#include <asm/smp.h> /* cpu_online_map */
13 14
14#if !defined(CONFIG_ARCH_S390) 15#if !defined(CONFIG_ARCH_S390)
15 16
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index be197eb90077..aa56172c6fed 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -611,6 +611,9 @@ struct transaction_s
611 * @j_revoke: The revoke table - maintains the list of revoked blocks in the 611 * @j_revoke: The revoke table - maintains the list of revoked blocks in the
612 * current transaction. 612 * current transaction.
613 * @j_revoke_table: alternate revoke tables for j_revoke 613 * @j_revoke_table: alternate revoke tables for j_revoke
614 * @j_wbuf: array of buffer_heads for journal_commit_transaction
615 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
616 * number that will fit in j_blocksize
614 * @j_private: An opaque pointer to fs-private information. 617 * @j_private: An opaque pointer to fs-private information.
615 */ 618 */
616 619
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f1925ccc9fe1..b1e407a4fbda 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -168,7 +168,7 @@ static inline void console_verbose(void)
168 168
169extern void bust_spinlocks(int yes); 169extern void bust_spinlocks(int yes);
170extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 170extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
171extern int panic_timeout; 171extern __deprecated_for_modules int panic_timeout;
172extern int panic_on_oops; 172extern int panic_on_oops;
173extern int tainted; 173extern int tainted;
174extern const char *print_tainted(void); 174extern const char *print_tainted(void);
@@ -266,7 +266,6 @@ extern void dump_stack(void);
266 266
267/** 267/**
268 * container_of - cast a member of a structure out to the containing structure 268 * container_of - cast a member of a structure out to the containing structure
269 *
270 * @ptr: the pointer to the member. 269 * @ptr: the pointer to the member.
271 * @type: the type of the container struct this is embedded in. 270 * @type: the type of the container struct this is embedded in.
272 * @member: the name of the member within the struct. 271 * @member: the name of the member within the struct.
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index dba27749b428..a484572c302e 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -6,6 +6,7 @@
6#include <linux/smp.h> 6#include <linux/smp.h>
7#include <linux/threads.h> 7#include <linux/threads.h>
8#include <linux/percpu.h> 8#include <linux/percpu.h>
9#include <linux/cpumask.h>
9#include <asm/cputime.h> 10#include <asm/cputime.h>
10 11
11/* 12/*
@@ -43,11 +44,10 @@ extern unsigned long long nr_context_switches(void);
43 */ 44 */
44static inline int kstat_irqs(int irq) 45static inline int kstat_irqs(int irq)
45{ 46{
46 int i, sum=0; 47 int cpu, sum = 0;
47 48
48 for (i = 0; i < NR_CPUS; i++) 49 for_each_cpu(cpu)
49 if (cpu_possible(i)) 50 sum += kstat_cpu(cpu).irqs[irq];
50 sum += kstat_cpu(i).irqs[irq];
51 51
52 return sum; 52 return sum;
53} 53}
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index e30afdca7917..e373c4a9de53 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -33,6 +33,9 @@
33#include <linux/list.h> 33#include <linux/list.h>
34#include <linux/notifier.h> 34#include <linux/notifier.h>
35#include <linux/smp.h> 35#include <linux/smp.h>
36#include <linux/percpu.h>
37#include <linux/spinlock.h>
38#include <linux/rcupdate.h>
36 39
37#include <asm/kprobes.h> 40#include <asm/kprobes.h>
38 41
@@ -106,6 +109,9 @@ struct jprobe {
106 kprobe_opcode_t *entry; /* probe handling code to jump to */ 109 kprobe_opcode_t *entry; /* probe handling code to jump to */
107}; 110};
108 111
112DECLARE_PER_CPU(struct kprobe *, current_kprobe);
113DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
114
109#ifdef ARCH_SUPPORTS_KRETPROBES 115#ifdef ARCH_SUPPORTS_KRETPROBES
110extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs); 116extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs);
111#else /* ARCH_SUPPORTS_KRETPROBES */ 117#else /* ARCH_SUPPORTS_KRETPROBES */
@@ -142,17 +148,7 @@ struct kretprobe_instance {
142}; 148};
143 149
144#ifdef CONFIG_KPROBES 150#ifdef CONFIG_KPROBES
145/* Locks kprobe: irq must be disabled */ 151extern spinlock_t kretprobe_lock;
146void lock_kprobes(void);
147void unlock_kprobes(void);
148
149/* kprobe running now on this CPU? */
150static inline int kprobe_running(void)
151{
152 extern unsigned int kprobe_cpu;
153 return kprobe_cpu == smp_processor_id();
154}
155
156extern int arch_prepare_kprobe(struct kprobe *p); 152extern int arch_prepare_kprobe(struct kprobe *p);
157extern void arch_copy_kprobe(struct kprobe *p); 153extern void arch_copy_kprobe(struct kprobe *p);
158extern void arch_arm_kprobe(struct kprobe *p); 154extern void arch_arm_kprobe(struct kprobe *p);
@@ -163,10 +159,26 @@ extern void show_registers(struct pt_regs *regs);
163extern kprobe_opcode_t *get_insn_slot(void); 159extern kprobe_opcode_t *get_insn_slot(void);
164extern void free_insn_slot(kprobe_opcode_t *slot); 160extern void free_insn_slot(kprobe_opcode_t *slot);
165 161
166/* Get the kprobe at this addr (if any). Must have called lock_kprobes */ 162/* Get the kprobe at this addr (if any) - called with preemption disabled */
167struct kprobe *get_kprobe(void *addr); 163struct kprobe *get_kprobe(void *addr);
168struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk); 164struct hlist_head * kretprobe_inst_table_head(struct task_struct *tsk);
169 165
166/* kprobe_running() will just return the current_kprobe on this CPU */
167static inline struct kprobe *kprobe_running(void)
168{
169 return (__get_cpu_var(current_kprobe));
170}
171
172static inline void reset_current_kprobe(void)
173{
174 __get_cpu_var(current_kprobe) = NULL;
175}
176
177static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
178{
179 return (&__get_cpu_var(kprobe_ctlblk));
180}
181
170int register_kprobe(struct kprobe *p); 182int register_kprobe(struct kprobe *p);
171void unregister_kprobe(struct kprobe *p); 183void unregister_kprobe(struct kprobe *p);
172int setjmp_pre_handler(struct kprobe *, struct pt_regs *); 184int setjmp_pre_handler(struct kprobe *, struct pt_regs *);
@@ -183,9 +195,9 @@ void add_rp_inst(struct kretprobe_instance *ri);
183void kprobe_flush_task(struct task_struct *tk); 195void kprobe_flush_task(struct task_struct *tk);
184void recycle_rp_inst(struct kretprobe_instance *ri); 196void recycle_rp_inst(struct kretprobe_instance *ri);
185#else /* CONFIG_KPROBES */ 197#else /* CONFIG_KPROBES */
186static inline int kprobe_running(void) 198static inline struct kprobe *kprobe_running(void)
187{ 199{
188 return 0; 200 return NULL;
189} 201}
190static inline int register_kprobe(struct kprobe *p) 202static inline int register_kprobe(struct kprobe *p)
191{ 203{
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0ba3af7a1236..dcd17e7458ab 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -155,6 +155,10 @@ enum {
155 ATA_SHIFT_UDMA = 0, 155 ATA_SHIFT_UDMA = 0,
156 ATA_SHIFT_MWDMA = 8, 156 ATA_SHIFT_MWDMA = 8,
157 ATA_SHIFT_PIO = 11, 157 ATA_SHIFT_PIO = 11,
158
159 /* size of buffer to pad xfers ending on unaligned boundaries */
160 ATA_DMA_PAD_SZ = 4,
161 ATA_DMA_PAD_BUF_SZ = ATA_DMA_PAD_SZ * ATA_MAX_QUEUE,
158 162
159 /* Masks for port functions */ 163 /* Masks for port functions */
160 ATA_PORT_PRIMARY = (1 << 0), 164 ATA_PORT_PRIMARY = (1 << 0),
@@ -249,9 +253,12 @@ struct ata_queued_cmd {
249 unsigned long flags; /* ATA_QCFLAG_xxx */ 253 unsigned long flags; /* ATA_QCFLAG_xxx */
250 unsigned int tag; 254 unsigned int tag;
251 unsigned int n_elem; 255 unsigned int n_elem;
256 unsigned int orig_n_elem;
252 257
253 int dma_dir; 258 int dma_dir;
254 259
260 unsigned int pad_len;
261
255 unsigned int nsect; 262 unsigned int nsect;
256 unsigned int cursect; 263 unsigned int cursect;
257 264
@@ -262,9 +269,11 @@ struct ata_queued_cmd {
262 unsigned int cursg_ofs; 269 unsigned int cursg_ofs;
263 270
264 struct scatterlist sgent; 271 struct scatterlist sgent;
272 struct scatterlist pad_sgent;
265 void *buf_virt; 273 void *buf_virt;
266 274
267 struct scatterlist *sg; 275 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */
276 struct scatterlist *__sg;
268 277
269 ata_qc_cb_t complete_fn; 278 ata_qc_cb_t complete_fn;
270 279
@@ -310,6 +319,9 @@ struct ata_port {
310 struct ata_prd *prd; /* our SG list */ 319 struct ata_prd *prd; /* our SG list */
311 dma_addr_t prd_dma; /* and its DMA mapping */ 320 dma_addr_t prd_dma; /* and its DMA mapping */
312 321
322 void *pad; /* array of DMA pad buffers */
323 dma_addr_t pad_dma;
324
313 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 325 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
314 326
315 u8 ctl; /* cache of ATA control register */ 327 u8 ctl; /* cache of ATA control register */
@@ -512,6 +524,31 @@ extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bit
512#endif /* CONFIG_PCI */ 524#endif /* CONFIG_PCI */
513 525
514 526
527static inline int
528ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
529{
530 if (sg == &qc->pad_sgent)
531 return 1;
532 if (qc->pad_len)
533 return 0;
534 if (((sg - qc->__sg) + 1) == qc->n_elem)
535 return 1;
536 return 0;
537}
538
539static inline struct scatterlist *
540ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
541{
542 if (sg == &qc->pad_sgent)
543 return NULL;
544 if (++sg - qc->__sg < qc->n_elem)
545 return sg;
546 return qc->pad_len ? &qc->pad_sgent : NULL;
547}
548
549#define ata_for_each_sg(sg, qc) \
550 for (sg = qc->__sg; sg; sg = ata_qc_next_sg(sg, qc))
551
515static inline unsigned int ata_tag_valid(unsigned int tag) 552static inline unsigned int ata_tag_valid(unsigned int tag)
516{ 553{
517 return (tag < ATA_MAX_QUEUE) ? 1 : 0; 554 return (tag < ATA_MAX_QUEUE) ? 1 : 0;
@@ -740,4 +777,17 @@ static inline unsigned int __ac_err_mask(u8 status)
740 return mask; 777 return mask;
741} 778}
742 779
780static inline int ata_pad_alloc(struct ata_port *ap, struct device *dev)
781{
782 ap->pad_dma = 0;
783 ap->pad = dma_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ,
784 &ap->pad_dma, GFP_KERNEL);
785 return (ap->pad == NULL) ? -ENOMEM : 0;
786}
787
788static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
789{
790 dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma);
791}
792
743#endif /* __LINUX_LIBATA_H__ */ 793#endif /* __LINUX_LIBATA_H__ */
diff --git a/include/linux/list.h b/include/linux/list.h
index 084971f333fe..fbfca73355a3 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -601,7 +601,7 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
601 * or hlist_del_rcu(), running on this same list. 601 * or hlist_del_rcu(), running on this same list.
602 * However, it is perfectly legal to run concurrently with 602 * However, it is perfectly legal to run concurrently with
603 * the _rcu list-traversal primitives, such as 603 * the _rcu list-traversal primitives, such as
604 * hlist_for_each_rcu(), used to prevent memory-consistency 604 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
605 * problems on Alpha CPUs. Regardless of the type of CPU, the 605 * problems on Alpha CPUs. Regardless of the type of CPU, the
606 * list-traversal primitive must be guarded by rcu_read_lock(). 606 * list-traversal primitive must be guarded by rcu_read_lock().
607 */ 607 */
@@ -650,7 +650,7 @@ static inline void hlist_add_after(struct hlist_node *n,
650 * or hlist_del_rcu(), running on this same list. 650 * or hlist_del_rcu(), running on this same list.
651 * However, it is perfectly legal to run concurrently with 651 * However, it is perfectly legal to run concurrently with
652 * the _rcu list-traversal primitives, such as 652 * the _rcu list-traversal primitives, such as
653 * hlist_for_each_rcu(), used to prevent memory-consistency 653 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
654 * problems on Alpha CPUs. 654 * problems on Alpha CPUs.
655 */ 655 */
656static inline void hlist_add_before_rcu(struct hlist_node *n, 656static inline void hlist_add_before_rcu(struct hlist_node *n,
@@ -675,7 +675,7 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
675 * or hlist_del_rcu(), running on this same list. 675 * or hlist_del_rcu(), running on this same list.
676 * However, it is perfectly legal to run concurrently with 676 * However, it is perfectly legal to run concurrently with
677 * the _rcu list-traversal primitives, such as 677 * the _rcu list-traversal primitives, such as
678 * hlist_for_each_rcu(), used to prevent memory-consistency 678 * hlist_for_each_entry_rcu(), used to prevent memory-consistency
679 * problems on Alpha CPUs. 679 * problems on Alpha CPUs.
680 */ 680 */
681static inline void hlist_add_after_rcu(struct hlist_node *prev, 681static inline void hlist_add_after_rcu(struct hlist_node *prev,
@@ -699,11 +699,6 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
699 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 699 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
700 pos = n) 700 pos = n)
701 701
702#define hlist_for_each_rcu(pos, head) \
703 for ((pos) = (head)->first; \
704 rcu_dereference((pos)) && ({ prefetch((pos)->next); 1; }); \
705 (pos) = (pos)->next)
706
707/** 702/**
708 * hlist_for_each_entry - iterate over list of given type 703 * hlist_for_each_entry - iterate over list of given type
709 * @tpos: the type * to use as a loop counter. 704 * @tpos: the type * to use as a loop counter.
@@ -756,7 +751,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
756 751
757/** 752/**
758 * hlist_for_each_entry_rcu - iterate over rcu list of given type 753 * hlist_for_each_entry_rcu - iterate over rcu list of given type
759 * @pos: the type * to use as a loop counter. 754 * @tpos: the type * to use as a loop counter.
760 * @pos: the &struct hlist_node to use as a loop counter. 755 * @pos: the &struct hlist_node to use as a loop counter.
761 * @head: the head for your list. 756 * @head: the head for your list.
762 * @member: the name of the hlist_node within the struct. 757 * @member: the name of the hlist_node within the struct.
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 0def328ab5cf..9a424383e6c6 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -54,6 +54,9 @@ struct memory_block {
54 */ 54 */
55#define MEM_MAPPING_INVALID (1<<3) 55#define MEM_MAPPING_INVALID (1<<3)
56 56
57struct notifier_block;
58struct mem_section;
59
57#ifndef CONFIG_MEMORY_HOTPLUG 60#ifndef CONFIG_MEMORY_HOTPLUG
58static inline int memory_dev_init(void) 61static inline int memory_dev_init(void)
59{ 62{
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 5c1fb0a2e806..7b115feca4df 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -932,13 +932,13 @@ int write_one_page(struct page *page, int wait);
932 * turning readahead off */ 932 * turning readahead off */
933 933
934int do_page_cache_readahead(struct address_space *mapping, struct file *filp, 934int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
935 unsigned long offset, unsigned long nr_to_read); 935 pgoff_t offset, unsigned long nr_to_read);
936int force_page_cache_readahead(struct address_space *mapping, struct file *filp, 936int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
937 unsigned long offset, unsigned long nr_to_read); 937 pgoff_t offset, unsigned long nr_to_read);
938unsigned long page_cache_readahead(struct address_space *mapping, 938unsigned long page_cache_readahead(struct address_space *mapping,
939 struct file_ra_state *ra, 939 struct file_ra_state *ra,
940 struct file *filp, 940 struct file *filp,
941 unsigned long offset, 941 pgoff_t offset,
942 unsigned long size); 942 unsigned long size);
943void handle_ra_miss(struct address_space *mapping, 943void handle_ra_miss(struct address_space *mapping,
944 struct file_ra_state *ra, pgoff_t offset); 944 struct file_ra_state *ra, pgoff_t offset);
diff --git a/include/linux/net.h b/include/linux/net.h
index 4e981585a89a..d6a41e6577f6 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -71,6 +71,7 @@ typedef enum {
71 * @SOCK_RAW: raw socket 71 * @SOCK_RAW: raw socket
72 * @SOCK_RDM: reliably-delivered message 72 * @SOCK_RDM: reliably-delivered message
73 * @SOCK_SEQPACKET: sequential packet socket 73 * @SOCK_SEQPACKET: sequential packet socket
74 * @SOCK_DCCP: Datagram Congestion Control Protocol socket
74 * @SOCK_PACKET: linux specific way of getting packets at the dev level. 75 * @SOCK_PACKET: linux specific way of getting packets at the dev level.
75 * For writing rarp and other similar things on the user level. 76 * For writing rarp and other similar things on the user level.
76 * 77 *
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 325fe7ae49bb..12787a9b0259 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -316,7 +316,7 @@ extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, st
316extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 316extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
317extern void put_nfs_open_context(struct nfs_open_context *ctx); 317extern void put_nfs_open_context(struct nfs_open_context *ctx);
318extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 318extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
319extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, int mode); 319extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
320extern void nfs_file_clear_open_context(struct file *filp); 320extern void nfs_file_clear_open_context(struct file *filp);
321 321
322/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 322/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 6d5a24f3fc6d..51c231a1e5a6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -60,7 +60,7 @@ typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int);
60extern struct svc_program nfsd_program; 60extern struct svc_program nfsd_program;
61extern struct svc_version nfsd_version2, nfsd_version3, 61extern struct svc_version nfsd_version2, nfsd_version3,
62 nfsd_version4; 62 nfsd_version4;
63 63extern struct svc_serv *nfsd_serv;
64/* 64/*
65 * Function prototypes. 65 * Function prototypes.
66 */ 66 */
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h
index e65c9db6d13f..781efbf94ed3 100644
--- a/include/linux/nfsd/syscall.h
+++ b/include/linux/nfsd/syscall.h
@@ -39,6 +39,21 @@
39#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */ 39#define NFSCTL_GETFD 7 /* get an fh by path (used by mountd) */
40#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */ 40#define NFSCTL_GETFS 8 /* get an fh by path with max FH len */
41 41
42/*
43 * Macros used to set version
44 */
45#define NFSCTL_VERSET(_cltbits, _v) ((_cltbits) |= (1 << (_v)))
46#define NFSCTL_VERUNSET(_cltbits, _v) ((_cltbits) &= ~(1 << (_v)))
47#define NFSCTL_VERISSET(_cltbits, _v) ((_cltbits) & (1 << (_v)))
48
49#if defined(CONFIG_NFSD_V4)
50#define NFSCTL_VERALL (0x1c /* 0b011100 */)
51#elif defined(CONFIG_NFSD_V3)
52#define NFSCTL_VERALL (0x0c /* 0b001100 */)
53#else
54#define NFSCTL_VERALL (0x04 /* 0b000100 */)
55#endif
56
42/* SVC */ 57/* SVC */
43struct nfsctl_svc { 58struct nfsctl_svc {
44 unsigned short svc_port; 59 unsigned short svc_port;
@@ -120,6 +135,8 @@ extern int exp_delclient(struct nfsctl_client *ncp);
120extern int exp_export(struct nfsctl_export *nxp); 135extern int exp_export(struct nfsctl_export *nxp);
121extern int exp_unexport(struct nfsctl_export *nxp); 136extern int exp_unexport(struct nfsctl_export *nxp);
122 137
138extern unsigned int nfsd_versbits;
139
123#endif /* __KERNEL__ */ 140#endif /* __KERNEL__ */
124 141
125#endif /* NFSD_SYSCALL_H */ 142#endif /* NFSD_SYSCALL_H */
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 21e18ce7ca63..3c2a71b43bac 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -42,7 +42,7 @@ struct nfsd3_writeargs {
42 __u64 offset; 42 __u64 offset;
43 __u32 count; 43 __u32 count;
44 int stable; 44 int stable;
45 int len; 45 __u32 len;
46 struct kvec vec[RPCSVC_MAXPAGES]; 46 struct kvec vec[RPCSVC_MAXPAGES];
47 int vlen; 47 int vlen;
48}; 48};
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 56192005fa4d..9a96f0588393 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -519,6 +519,7 @@
519#define PCI_DEVICE_ID_MATROX_MIL 0x0519 519#define PCI_DEVICE_ID_MATROX_MIL 0x0519
520#define PCI_DEVICE_ID_MATROX_MYS 0x051A 520#define PCI_DEVICE_ID_MATROX_MYS 0x051A
521#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b 521#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b
522#define PCI_DEVICE_ID_MATROX_MYS_AGP 0x051e
522#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f 523#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f
523#define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 524#define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10
524#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 525#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000
@@ -990,6 +991,10 @@
990#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a 991#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a
991#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c 992#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c
992#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e 993#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e
994#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT 0x0090
995#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX 0x0091
996#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_7800 0x0098
997#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_7800_GTX 0x0099
993#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 998#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0
994#define PCI_DEVICE_ID_GEFORCE_6800A 0x00c1 999#define PCI_DEVICE_ID_GEFORCE_6800A 0x00c1
995#define PCI_DEVICE_ID_GEFORCE_6800A_LE 0x00c2 1000#define PCI_DEVICE_ID_GEFORCE_6800A_LE 0x00c2
@@ -1781,6 +1786,7 @@
1781#define PCI_DEVICE_ID_TIGON3_5704 0x1648 1786#define PCI_DEVICE_ID_TIGON3_5704 0x1648
1782#define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649 1787#define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649
1783#define PCI_DEVICE_ID_NX2_5706 0x164a 1788#define PCI_DEVICE_ID_NX2_5706 0x164a
1789#define PCI_DEVICE_ID_NX2_5708 0x164c
1784#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d 1790#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d
1785#define PCI_DEVICE_ID_TIGON3_5705 0x1653 1791#define PCI_DEVICE_ID_TIGON3_5705 0x1653
1786#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 1792#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
@@ -1805,6 +1811,7 @@
1805#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 1811#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7
1806#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 1812#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8
1807#define PCI_DEVICE_ID_NX2_5706S 0x16aa 1813#define PCI_DEVICE_ID_NX2_5706S 0x16aa
1814#define PCI_DEVICE_ID_NX2_5708S 0x16ac
1808#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 1815#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6
1809#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 1816#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7
1810#define PCI_DEVICE_ID_TIGON3_5781 0x16dd 1817#define PCI_DEVICE_ID_TIGON3_5781 0x16dd
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 72cb67b66e0c..92a9696fdebe 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -72,6 +72,9 @@ struct mii_bus {
72 /* list of all PHYs on bus */ 72 /* list of all PHYs on bus */
73 struct phy_device *phy_map[PHY_MAX_ADDR]; 73 struct phy_device *phy_map[PHY_MAX_ADDR];
74 74
75 /* Phy addresses to be ignored when probing */
76 u32 phy_mask;
77
75 /* Pointer to an array of interrupts, each PHY's 78 /* Pointer to an array of interrupts, each PHY's
76 * interrupt at the index matching its address */ 79 * interrupt at the index matching its address */
77 int *irq; 80 int *irq;
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 60ffcb9c5791..e87b233615b3 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -93,6 +93,7 @@ struct tc_fifo_qopt
93/* PRIO section */ 93/* PRIO section */
94 94
95#define TCQ_PRIO_BANDS 16 95#define TCQ_PRIO_BANDS 16
96#define TCQ_MIN_PRIO_BANDS 2
96 97
97struct tc_prio_qopt 98struct tc_prio_qopt
98{ 99{
@@ -169,6 +170,7 @@ struct tc_red_qopt
169 unsigned char Scell_log; /* cell size for idle damping */ 170 unsigned char Scell_log; /* cell size for idle damping */
170 unsigned char flags; 171 unsigned char flags;
171#define TC_RED_ECN 1 172#define TC_RED_ECN 1
173#define TC_RED_HARDDROP 2
172}; 174};
173 175
174struct tc_red_xstats 176struct tc_red_xstats
@@ -194,38 +196,34 @@ enum
194 196
195#define TCA_GRED_MAX (__TCA_GRED_MAX - 1) 197#define TCA_GRED_MAX (__TCA_GRED_MAX - 1)
196 198
197#define TCA_SET_OFF TCA_GRED_PARMS
198struct tc_gred_qopt 199struct tc_gred_qopt
199{ 200{
200 __u32 limit; /* HARD maximal queue length (bytes) 201 __u32 limit; /* HARD maximal queue length (bytes) */
201*/ 202 __u32 qth_min; /* Min average length threshold (bytes) */
202 __u32 qth_min; /* Min average length threshold (bytes) 203 __u32 qth_max; /* Max average length threshold (bytes) */
203*/ 204 __u32 DP; /* upto 2^32 DPs */
204 __u32 qth_max; /* Max average length threshold (bytes) 205 __u32 backlog;
205*/ 206 __u32 qave;
206 __u32 DP; /* upto 2^32 DPs */ 207 __u32 forced;
207 __u32 backlog; 208 __u32 early;
208 __u32 qave; 209 __u32 other;
209 __u32 forced; 210 __u32 pdrop;
210 __u32 early; 211 __u8 Wlog; /* log(W) */
211 __u32 other; 212 __u8 Plog; /* log(P_max/(qth_max-qth_min)) */
212 __u32 pdrop; 213 __u8 Scell_log; /* cell size for idle damping */
213 214 __u8 prio; /* prio of this VQ */
214 unsigned char Wlog; /* log(W) */ 215 __u32 packets;
215 unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 216 __u32 bytesin;
216 unsigned char Scell_log; /* cell size for idle damping */
217 __u8 prio; /* prio of this VQ */
218 __u32 packets;
219 __u32 bytesin;
220}; 217};
218
221/* gred setup */ 219/* gred setup */
222struct tc_gred_sopt 220struct tc_gred_sopt
223{ 221{
224 __u32 DPs; 222 __u32 DPs;
225 __u32 def_DP; 223 __u32 def_DP;
226 __u8 grio; 224 __u8 grio;
227 __u8 pad1; 225 __u8 flags;
228 __u16 pad2; 226 __u16 pad1;
229}; 227};
230 228
231/* HTB section */ 229/* HTB section */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index a726225e0afe..1a165b7ae01b 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -37,4 +37,10 @@ extern int platform_add_devices(struct platform_device **, int);
37 37
38extern struct platform_device *platform_device_register_simple(char *, unsigned int, struct resource *, unsigned int); 38extern struct platform_device *platform_device_register_simple(char *, unsigned int, struct resource *, unsigned int);
39 39
40extern struct platform_device *platform_device_alloc(const char *name, unsigned int id);
41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
42extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size);
43extern int platform_device_add(struct platform_device *pdev);
44extern void platform_device_put(struct platform_device *pdev);
45
40#endif /* _PLATFORM_DEVICE_H_ */ 46#endif /* _PLATFORM_DEVICE_H_ */
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index aadbac29103c..584d57cb393a 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -353,7 +353,6 @@ struct pnp_protocol {
353int pnp_register_protocol(struct pnp_protocol *protocol); 353int pnp_register_protocol(struct pnp_protocol *protocol);
354void pnp_unregister_protocol(struct pnp_protocol *protocol); 354void pnp_unregister_protocol(struct pnp_protocol *protocol);
355int pnp_add_device(struct pnp_dev *dev); 355int pnp_add_device(struct pnp_dev *dev);
356void pnp_remove_device(struct pnp_dev *dev);
357int pnp_device_attach(struct pnp_dev *pnp_dev); 356int pnp_device_attach(struct pnp_dev *pnp_dev);
358void pnp_device_detach(struct pnp_dev *pnp_dev); 357void pnp_device_detach(struct pnp_dev *pnp_dev);
359extern struct list_head pnp_global; 358extern struct list_head pnp_global;
@@ -399,7 +398,6 @@ static inline int pnp_register_protocol(struct pnp_protocol *protocol) { return
399static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { } 398static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { }
400static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; } 399static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; }
401static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; } 400static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; }
402static inline void pnp_remove_device(struct pnp_dev *dev) { }
403static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; } 401static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
404static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; } 402static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; }
405 403
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index dc6f3647bfbc..b2b3dba1298d 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -78,6 +78,8 @@
78#include <linux/compiler.h> /* For unlikely. */ 78#include <linux/compiler.h> /* For unlikely. */
79#include <linux/sched.h> /* For struct task_struct. */ 79#include <linux/sched.h> /* For struct task_struct. */
80 80
81
82extern long arch_ptrace(struct task_struct *child, long request, long addr, long data);
81extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 83extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
82extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 84extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
83extern int ptrace_attach(struct task_struct *tsk); 85extern int ptrace_attach(struct task_struct *tsk);
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index d211507ab246..4f34d3d60f2e 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -198,38 +198,38 @@ static __inline__ int DQUOT_OFF(struct super_block *sb)
198#define DQUOT_SYNC(sb) do { } while(0) 198#define DQUOT_SYNC(sb) do { } while(0)
199#define DQUOT_OFF(sb) do { } while(0) 199#define DQUOT_OFF(sb) do { } while(0)
200#define DQUOT_TRANSFER(inode, iattr) (0) 200#define DQUOT_TRANSFER(inode, iattr) (0)
201extern __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 201static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
202{ 202{
203 inode_add_bytes(inode, nr); 203 inode_add_bytes(inode, nr);
204 return 0; 204 return 0;
205} 205}
206 206
207extern __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 207static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
208{ 208{
209 DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr); 209 DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr);
210 mark_inode_dirty(inode); 210 mark_inode_dirty(inode);
211 return 0; 211 return 0;
212} 212}
213 213
214extern __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 214static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
215{ 215{
216 inode_add_bytes(inode, nr); 216 inode_add_bytes(inode, nr);
217 return 0; 217 return 0;
218} 218}
219 219
220extern __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 220static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
221{ 221{
222 DQUOT_ALLOC_SPACE_NODIRTY(inode, nr); 222 DQUOT_ALLOC_SPACE_NODIRTY(inode, nr);
223 mark_inode_dirty(inode); 223 mark_inode_dirty(inode);
224 return 0; 224 return 0;
225} 225}
226 226
227extern __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 227static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
228{ 228{
229 inode_sub_bytes(inode, nr); 229 inode_sub_bytes(inode, nr);
230} 230}
231 231
232extern __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 232static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
233{ 233{
234 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 234 DQUOT_FREE_SPACE_NODIRTY(inode, nr);
235 mark_inode_dirty(inode); 235 mark_inode_dirty(inode);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 9f0f9281f42a..36e5d269612f 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -46,6 +46,7 @@ do { \
46 46
47int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); 47int radix_tree_insert(struct radix_tree_root *, unsigned long, void *);
48void *radix_tree_lookup(struct radix_tree_root *, unsigned long); 48void *radix_tree_lookup(struct radix_tree_root *, unsigned long);
49void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long);
49void *radix_tree_delete(struct radix_tree_root *, unsigned long); 50void *radix_tree_delete(struct radix_tree_root *, unsigned long);
50unsigned int 51unsigned int
51radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 52radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
diff --git a/include/linux/rio.h b/include/linux/rio.h
new file mode 100644
index 000000000000..c7e907faae9c
--- /dev/null
+++ b/include/linux/rio.h
@@ -0,0 +1,325 @@
1/*
2 * RapidIO interconnect services
3 * (RapidIO Interconnect Specification, http://www.rapidio.org)
4 *
5 * Copyright 2005 MontaVista Software, Inc.
6 * Matt Porter <mporter@kernel.crashing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef LINUX_RIO_H
15#define LINUX_RIO_H
16
17#ifdef __KERNEL__
18
19#include <linux/types.h>
20#include <linux/config.h>
21#include <linux/ioport.h>
22#include <linux/list.h>
23#include <linux/errno.h>
24#include <linux/device.h>
25#include <linux/rio_regs.h>
26
27#define RIO_ANY_DESTID 0xff
28#define RIO_NO_HOPCOUNT -1
29
30#define RIO_MAX_MPORT_RESOURCES 16
31#define RIO_MAX_DEV_RESOURCES 16
32
33#define RIO_GLOBAL_TABLE 0xff /* Indicates access of a switch's
34 global routing table if it
35 has multiple (or per port)
36 tables */
37
38#define RIO_INVALID_ROUTE 0xff /* Indicates that a route table
39 entry is invalid (no route
40 exists for the device ID) */
41
42#ifdef CONFIG_RAPIDIO_8_BIT_TRANSPORT
43#define RIO_MAX_ROUTE_ENTRIES (1 << 8)
44#else
45#define RIO_MAX_ROUTE_ENTRIES (1 << 16)
46#endif
47
48#define RIO_MAX_MBOX 4
49#define RIO_MAX_MSG_SIZE 0x1000
50
51/*
52 * Error values that may be returned by RIO functions.
53 */
54#define RIO_SUCCESSFUL 0x00
55#define RIO_BAD_SIZE 0x81
56
57/*
58 * For RIO devices, the region numbers are assigned this way:
59 *
60 * 0 RapidIO outbound doorbells
61 * 1-15 RapidIO memory regions
62 *
63 * For RIO master ports, the region number are assigned this way:
64 *
65 * 0 RapidIO inbound doorbells
66 * 1 RapidIO inbound mailboxes
67 * 1 RapidIO outbound mailboxes
68 */
69#define RIO_DOORBELL_RESOURCE 0
70#define RIO_INB_MBOX_RESOURCE 1
71#define RIO_OUTB_MBOX_RESOURCE 2
72
73extern struct bus_type rio_bus_type;
74extern struct list_head rio_devices; /* list of all devices */
75
76struct rio_mport;
77
78/**
79 * struct rio_dev - RIO device info
80 * @global_list: Node in list of all RIO devices
81 * @net_list: Node in list of RIO devices in a network
82 * @net: Network this device is a part of
83 * @did: Device ID
84 * @vid: Vendor ID
85 * @device_rev: Device revision
86 * @asm_did: Assembly device ID
87 * @asm_vid: Assembly vendor ID
88 * @asm_rev: Assembly revision
89 * @efptr: Extended feature pointer
90 * @pef: Processing element features
91 * @swpinfo: Switch port info
92 * @src_ops: Source operation capabilities
93 * @dst_ops: Destination operation capabilities
94 * @dma_mask: Mask of bits of RIO address this device implements
95 * @rswitch: Pointer to &struct rio_switch if valid for this device
96 * @driver: Driver claiming this device
97 * @dev: Device model device
98 * @riores: RIO resources this device owns
99 * @destid: Network destination ID
100 */
101struct rio_dev {
102 struct list_head global_list; /* node in list of all RIO devices */
103 struct list_head net_list; /* node in per net list */
104 struct rio_net *net; /* RIO net this device resides in */
105 u16 did;
106 u16 vid;
107 u32 device_rev;
108 u16 asm_did;
109 u16 asm_vid;
110 u16 asm_rev;
111 u16 efptr;
112 u32 pef;
113 u32 swpinfo; /* Only used for switches */
114 u32 src_ops;
115 u32 dst_ops;
116 u64 dma_mask;
117 struct rio_switch *rswitch; /* RIO switch info */
118 struct rio_driver *driver; /* RIO driver claiming this device */
119 struct device dev; /* LDM device structure */
120 struct resource riores[RIO_MAX_DEV_RESOURCES];
121 u16 destid;
122};
123
124#define rio_dev_g(n) list_entry(n, struct rio_dev, global_list)
125#define rio_dev_f(n) list_entry(n, struct rio_dev, net_list)
126#define to_rio_dev(n) container_of(n, struct rio_dev, dev)
127
128/**
129 * struct rio_msg - RIO message event
130 * @res: Mailbox resource
131 * @mcback: Message event callback
132 */
133struct rio_msg {
134 struct resource *res;
135 void (*mcback) (struct rio_mport * mport, void *dev_id, int mbox, int slot);
136};
137
138/**
139 * struct rio_dbell - RIO doorbell event
140 * @node: Node in list of doorbell events
141 * @res: Doorbell resource
142 * @dinb: Doorbell event callback
143 * @dev_id: Device specific pointer to pass on event
144 */
145struct rio_dbell {
146 struct list_head node;
147 struct resource *res;
148 void (*dinb) (struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info);
149 void *dev_id;
150};
151
152/**
153 * struct rio_mport - RIO master port info
154 * @dbells: List of doorbell events
155 * @node: Node in global list of master ports
156 * @nnode: Node in network list of master ports
157 * @iores: I/O mem resource that this master port interface owns
158 * @riores: RIO resources that this master port interfaces owns
159 * @inb_msg: RIO inbound message event descriptors
160 * @outb_msg: RIO outbound message event descriptors
161 * @host_deviceid: Host device ID associated with this master port
162 * @ops: configuration space functions
163 * @id: Port ID, unique among all ports
164 * @index: Port index, unique among all port interfaces of the same type
165 * @name: Port name string
166 */
167struct rio_mport {
168 struct list_head dbells; /* list of doorbell events */
169 struct list_head node; /* node in global list of ports */
170 struct list_head nnode; /* node in net list of ports */
171 struct resource iores;
172 struct resource riores[RIO_MAX_MPORT_RESOURCES];
173 struct rio_msg inb_msg[RIO_MAX_MBOX];
174 struct rio_msg outb_msg[RIO_MAX_MBOX];
175 int host_deviceid; /* Host device ID */
176 struct rio_ops *ops; /* maintenance transaction functions */
177 unsigned char id; /* port ID, unique among all ports */
178 unsigned char index; /* port index, unique among all port
179 interfaces of the same type */
180 unsigned char name[40];
181};
182
183/**
184 * struct rio_net - RIO network info
185 * @node: Node in global list of RIO networks
186 * @devices: List of devices in this network
187 * @mports: List of master ports accessing this network
188 * @hport: Default port for accessing this network
189 * @id: RIO network ID
190 */
191struct rio_net {
192 struct list_head node; /* node in list of networks */
193 struct list_head devices; /* list of devices in this net */
194 struct list_head mports; /* list of ports accessing net */
195 struct rio_mport *hport; /* primary port for accessing net */
196 unsigned char id; /* RIO network ID */
197};
198
199/**
200 * struct rio_switch - RIO switch info
201 * @node: Node in global list of switches
202 * @switchid: Switch ID that is unique across a network
203 * @hopcount: Hopcount to this switch
204 * @destid: Associated destid in the path
205 * @route_table: Copy of switch routing table
206 * @add_entry: Callback for switch-specific route add function
207 * @get_entry: Callback for switch-specific route get function
208 */
209struct rio_switch {
210 struct list_head node;
211 u16 switchid;
212 u16 hopcount;
213 u16 destid;
214 u8 route_table[RIO_MAX_ROUTE_ENTRIES];
215 int (*add_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
216 u16 table, u16 route_destid, u8 route_port);
217 int (*get_entry) (struct rio_mport * mport, u16 destid, u8 hopcount,
218 u16 table, u16 route_destid, u8 * route_port);
219};
220
221/* Low-level architecture-dependent routines */
222
223/**
224 * struct rio_ops - Low-level RIO configuration space operations
225 * @lcread: Callback to perform local (master port) read of config space.
226 * @lcwrite: Callback to perform local (master port) write of config space.
227 * @cread: Callback to perform network read of config space.
228 * @cwrite: Callback to perform network write of config space.
229 * @dsend: Callback to send a doorbell message.
230 */
231struct rio_ops {
232 int (*lcread) (int index, u32 offset, int len, u32 * data);
233 int (*lcwrite) (int index, u32 offset, int len, u32 data);
234 int (*cread) (int index, u16 destid, u8 hopcount, u32 offset, int len,
235 u32 * data);
236 int (*cwrite) (int index, u16 destid, u8 hopcount, u32 offset, int len,
237 u32 data);
238 int (*dsend) (int index, u16 destid, u16 data);
239};
240
241#define RIO_RESOURCE_MEM 0x00000100
242#define RIO_RESOURCE_DOORBELL 0x00000200
243#define RIO_RESOURCE_MAILBOX 0x00000400
244
245#define RIO_RESOURCE_CACHEABLE 0x00010000
246#define RIO_RESOURCE_PCI 0x00020000
247
248#define RIO_RESOURCE_BUSY 0x80000000
249
250/**
251 * struct rio_driver - RIO driver info
252 * @node: Node in list of drivers
253 * @name: RIO driver name
254 * @id_table: RIO device ids to be associated with this driver
255 * @probe: RIO device inserted
256 * @remove: RIO device removed
257 * @suspend: RIO device suspended
258 * @resume: RIO device awakened
259 * @enable_wake: RIO device enable wake event
260 * @driver: LDM driver struct
261 *
262 * Provides info on a RIO device driver for insertion/removal and
263 * power management purposes.
264 */
265struct rio_driver {
266 struct list_head node;
267 char *name;
268 const struct rio_device_id *id_table;
269 int (*probe) (struct rio_dev * dev, const struct rio_device_id * id);
270 void (*remove) (struct rio_dev * dev);
271 int (*suspend) (struct rio_dev * dev, u32 state);
272 int (*resume) (struct rio_dev * dev);
273 int (*enable_wake) (struct rio_dev * dev, u32 state, int enable);
274 struct device_driver driver;
275};
276
277#define to_rio_driver(drv) container_of(drv,struct rio_driver, driver)
278
279/**
280 * struct rio_device_id - RIO device identifier
281 * @did: RIO device ID
282 * @vid: RIO vendor ID
283 * @asm_did: RIO assembly device ID
284 * @asm_vid: RIO assembly vendor ID
285 *
286 * Identifies a RIO device based on both the device/vendor IDs and
287 * the assembly device/vendor IDs.
288 */
289struct rio_device_id {
290 u16 did, vid;
291 u16 asm_did, asm_vid;
292};
293
294/**
295 * struct rio_route_ops - Per-switch route operations
296 * @vid: RIO vendor ID
297 * @did: RIO device ID
298 * @add_hook: Callback that adds a route entry
299 * @get_hook: Callback that gets a route entry
300 *
301 * Defines the operations that are necessary to manipulate the route
302 * tables for a particular RIO switch device.
303 */
304struct rio_route_ops {
305 u16 vid, did;
306 int (*add_hook) (struct rio_mport * mport, u16 destid, u8 hopcount,
307 u16 table, u16 route_destid, u8 route_port);
308 int (*get_hook) (struct rio_mport * mport, u16 destid, u8 hopcount,
309 u16 table, u16 route_destid, u8 * route_port);
310};
311
312/* Architecture and hardware-specific functions */
313extern int rio_init_mports(void);
314extern void rio_register_mport(struct rio_mport *);
315extern int rio_hw_add_outb_message(struct rio_mport *, struct rio_dev *, int,
316 void *, size_t);
317extern int rio_hw_add_inb_buffer(struct rio_mport *, int, void *);
318extern void *rio_hw_get_inb_message(struct rio_mport *, int);
319extern int rio_open_inb_mbox(struct rio_mport *, void *, int, int);
320extern void rio_close_inb_mbox(struct rio_mport *, int);
321extern int rio_open_outb_mbox(struct rio_mport *, void *, int, int);
322extern void rio_close_outb_mbox(struct rio_mport *, int);
323
324#endif /* __KERNEL__ */
325#endif /* LINUX_RIO_H */
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
new file mode 100644
index 000000000000..3bd7cce19e26
--- /dev/null
+++ b/include/linux/rio_drv.h
@@ -0,0 +1,469 @@
1/*
2 * RapidIO driver services
3 *
4 * Copyright 2005 MontaVista Software, Inc.
5 * Matt Porter <mporter@kernel.crashing.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef LINUX_RIO_DRV_H
14#define LINUX_RIO_DRV_H
15
16#ifdef __KERNEL__
17
18#include <linux/types.h>
19#include <linux/config.h>
20#include <linux/ioport.h>
21#include <linux/list.h>
22#include <linux/errno.h>
23#include <linux/device.h>
24#include <linux/rio.h>
25
26extern int __rio_local_read_config_32(struct rio_mport *port, u32 offset,
27 u32 * data);
28extern int __rio_local_write_config_32(struct rio_mport *port, u32 offset,
29 u32 data);
30extern int __rio_local_read_config_16(struct rio_mport *port, u32 offset,
31 u16 * data);
32extern int __rio_local_write_config_16(struct rio_mport *port, u32 offset,
33 u16 data);
34extern int __rio_local_read_config_8(struct rio_mport *port, u32 offset,
35 u8 * data);
36extern int __rio_local_write_config_8(struct rio_mport *port, u32 offset,
37 u8 data);
38
39extern int rio_mport_read_config_32(struct rio_mport *port, u16 destid,
40 u8 hopcount, u32 offset, u32 * data);
41extern int rio_mport_write_config_32(struct rio_mport *port, u16 destid,
42 u8 hopcount, u32 offset, u32 data);
43extern int rio_mport_read_config_16(struct rio_mport *port, u16 destid,
44 u8 hopcount, u32 offset, u16 * data);
45extern int rio_mport_write_config_16(struct rio_mport *port, u16 destid,
46 u8 hopcount, u32 offset, u16 data);
47extern int rio_mport_read_config_8(struct rio_mport *port, u16 destid,
48 u8 hopcount, u32 offset, u8 * data);
49extern int rio_mport_write_config_8(struct rio_mport *port, u16 destid,
50 u8 hopcount, u32 offset, u8 data);
51
52/**
53 * rio_local_read_config_32 - Read 32 bits from local configuration space
54 * @port: Master port
55 * @offset: Offset into local configuration space
56 * @data: Pointer to read data into
57 *
58 * Reads 32 bits of data from the specified offset within the local
59 * device's configuration space.
60 */
61static inline int rio_local_read_config_32(struct rio_mport *port, u32 offset,
62 u32 * data)
63{
64 return __rio_local_read_config_32(port, offset, data);
65}
66
67/**
68 * rio_local_write_config_32 - Write 32 bits to local configuration space
69 * @port: Master port
70 * @offset: Offset into local configuration space
71 * @data: Data to be written
72 *
73 * Writes 32 bits of data to the specified offset within the local
74 * device's configuration space.
75 */
76static inline int rio_local_write_config_32(struct rio_mport *port, u32 offset,
77 u32 data)
78{
79 return __rio_local_write_config_32(port, offset, data);
80}
81
82/**
83 * rio_local_read_config_16 - Read 16 bits from local configuration space
84 * @port: Master port
85 * @offset: Offset into local configuration space
86 * @data: Pointer to read data into
87 *
88 * Reads 16 bits of data from the specified offset within the local
89 * device's configuration space.
90 */
91static inline int rio_local_read_config_16(struct rio_mport *port, u32 offset,
92 u16 * data)
93{
94 return __rio_local_read_config_16(port, offset, data);
95}
96
97/**
98 * rio_local_write_config_16 - Write 16 bits to local configuration space
99 * @port: Master port
100 * @offset: Offset into local configuration space
101 * @data: Data to be written
102 *
103 * Writes 16 bits of data to the specified offset within the local
104 * device's configuration space.
105 */
106
107static inline int rio_local_write_config_16(struct rio_mport *port, u32 offset,
108 u16 data)
109{
110 return __rio_local_write_config_16(port, offset, data);
111}
112
113/**
114 * rio_local_read_config_8 - Read 8 bits from local configuration space
115 * @port: Master port
116 * @offset: Offset into local configuration space
117 * @data: Pointer to read data into
118 *
119 * Reads 8 bits of data from the specified offset within the local
120 * device's configuration space.
121 */
122static inline int rio_local_read_config_8(struct rio_mport *port, u32 offset,
123 u8 * data)
124{
125 return __rio_local_read_config_8(port, offset, data);
126}
127
128/**
129 * rio_local_write_config_8 - Write 8 bits to local configuration space
130 * @port: Master port
131 * @offset: Offset into local configuration space
132 * @data: Data to be written
133 *
134 * Writes 8 bits of data to the specified offset within the local
135 * device's configuration space.
136 */
137static inline int rio_local_write_config_8(struct rio_mport *port, u32 offset,
138 u8 data)
139{
140 return __rio_local_write_config_8(port, offset, data);
141}
142
143/**
144 * rio_read_config_32 - Read 32 bits from configuration space
145 * @rdev: RIO device
146 * @offset: Offset into device configuration space
147 * @data: Pointer to read data into
148 *
149 * Reads 32 bits of data from the specified offset within the
150 * RIO device's configuration space.
151 */
152static inline int rio_read_config_32(struct rio_dev *rdev, u32 offset,
153 u32 * data)
154{
155 u8 hopcount = 0xff;
156 u16 destid = rdev->destid;
157
158 if (rdev->rswitch) {
159 destid = rdev->rswitch->destid;
160 hopcount = rdev->rswitch->hopcount;
161 }
162
163 return rio_mport_read_config_32(rdev->net->hport, destid, hopcount,
164 offset, data);
165};
166
167/**
168 * rio_write_config_32 - Write 32 bits to configuration space
169 * @rdev: RIO device
170 * @offset: Offset into device configuration space
171 * @data: Data to be written
172 *
173 * Writes 32 bits of data to the specified offset within the
174 * RIO device's configuration space.
175 */
176static inline int rio_write_config_32(struct rio_dev *rdev, u32 offset,
177 u32 data)
178{
179 u8 hopcount = 0xff;
180 u16 destid = rdev->destid;
181
182 if (rdev->rswitch) {
183 destid = rdev->rswitch->destid;
184 hopcount = rdev->rswitch->hopcount;
185 }
186
187 return rio_mport_write_config_32(rdev->net->hport, destid, hopcount,
188 offset, data);
189};
190
191/**
192 * rio_read_config_16 - Read 16 bits from configuration space
193 * @rdev: RIO device
194 * @offset: Offset into device configuration space
195 * @data: Pointer to read data into
196 *
197 * Reads 16 bits of data from the specified offset within the
198 * RIO device's configuration space.
199 */
200static inline int rio_read_config_16(struct rio_dev *rdev, u32 offset,
201 u16 * data)
202{
203 u8 hopcount = 0xff;
204 u16 destid = rdev->destid;
205
206 if (rdev->rswitch) {
207 destid = rdev->rswitch->destid;
208 hopcount = rdev->rswitch->hopcount;
209 }
210
211 return rio_mport_read_config_16(rdev->net->hport, destid, hopcount,
212 offset, data);
213};
214
215/**
216 * rio_write_config_16 - Write 16 bits to configuration space
217 * @rdev: RIO device
218 * @offset: Offset into device configuration space
219 * @data: Data to be written
220 *
221 * Writes 16 bits of data to the specified offset within the
222 * RIO device's configuration space.
223 */
224static inline int rio_write_config_16(struct rio_dev *rdev, u32 offset,
225 u16 data)
226{
227 u8 hopcount = 0xff;
228 u16 destid = rdev->destid;
229
230 if (rdev->rswitch) {
231 destid = rdev->rswitch->destid;
232 hopcount = rdev->rswitch->hopcount;
233 }
234
235 return rio_mport_write_config_16(rdev->net->hport, destid, hopcount,
236 offset, data);
237};
238
239/**
240 * rio_read_config_8 - Read 8 bits from configuration space
241 * @rdev: RIO device
242 * @offset: Offset into device configuration space
243 * @data: Pointer to read data into
244 *
245 * Reads 8 bits of data from the specified offset within the
246 * RIO device's configuration space.
247 */
248static inline int rio_read_config_8(struct rio_dev *rdev, u32 offset, u8 * data)
249{
250 u8 hopcount = 0xff;
251 u16 destid = rdev->destid;
252
253 if (rdev->rswitch) {
254 destid = rdev->rswitch->destid;
255 hopcount = rdev->rswitch->hopcount;
256 }
257
258 return rio_mport_read_config_8(rdev->net->hport, destid, hopcount,
259 offset, data);
260};
261
262/**
263 * rio_write_config_8 - Write 8 bits to configuration space
264 * @rdev: RIO device
265 * @offset: Offset into device configuration space
266 * @data: Data to be written
267 *
268 * Writes 8 bits of data to the specified offset within the
269 * RIO device's configuration space.
270 */
271static inline int rio_write_config_8(struct rio_dev *rdev, u32 offset, u8 data)
272{
273 u8 hopcount = 0xff;
274 u16 destid = rdev->destid;
275
276 if (rdev->rswitch) {
277 destid = rdev->rswitch->destid;
278 hopcount = rdev->rswitch->hopcount;
279 }
280
281 return rio_mport_write_config_8(rdev->net->hport, destid, hopcount,
282 offset, data);
283};
284
285extern int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid,
286 u16 data);
287
288/**
289 * rio_send_doorbell - Send a doorbell message to a device
290 * @rdev: RIO device
291 * @data: Doorbell message data
292 *
293 * Send a doorbell message to a RIO device. The doorbell message
294 * has a 16-bit info field provided by the @data argument.
295 */
296static inline int rio_send_doorbell(struct rio_dev *rdev, u16 data)
297{
298 return rio_mport_send_doorbell(rdev->net->hport, rdev->destid, data);
299};
300
301/**
302 * rio_init_mbox_res - Initialize a RIO mailbox resource
303 * @res: resource struct
304 * @start: start of mailbox range
305 * @end: end of mailbox range
306 *
307 * This function is used to initialize the fields of a resource
308 * for use as a mailbox resource. It initializes a range of
309 * mailboxes using the start and end arguments.
310 */
311static inline void rio_init_mbox_res(struct resource *res, int start, int end)
312{
313 memset(res, 0, sizeof(struct resource));
314 res->start = start;
315 res->end = end;
316 res->flags = RIO_RESOURCE_MAILBOX;
317}
318
319/**
320 * rio_init_dbell_res - Initialize a RIO doorbell resource
321 * @res: resource struct
322 * @start: start of doorbell range
323 * @end: end of doorbell range
324 *
325 * This function is used to initialize the fields of a resource
326 * for use as a doorbell resource. It initializes a range of
327 * doorbell messages using the start and end arguments.
328 */
329static inline void rio_init_dbell_res(struct resource *res, u16 start, u16 end)
330{
331 memset(res, 0, sizeof(struct resource));
332 res->start = start;
333 res->end = end;
334 res->flags = RIO_RESOURCE_DOORBELL;
335}
336
337/**
338 * RIO_DEVICE - macro used to describe a specific RIO device
339 * @vid: the 16 bit RIO vendor ID
340 * @did: the 16 bit RIO device ID
341 *
342 * This macro is used to create a struct rio_device_id that matches a
343 * specific device. The assembly vendor and assembly device fields
344 * will be set to %RIO_ANY_ID.
345 */
346#define RIO_DEVICE(dev,ven) \
347 .did = (dev), .vid = (ven), \
348 .asm_did = RIO_ANY_ID, .asm_vid = RIO_ANY_ID
349
350/* Mailbox management */
351extern int rio_request_outb_mbox(struct rio_mport *, void *, int, int,
352 void (*)(struct rio_mport *, void *,int, int));
353extern int rio_release_outb_mbox(struct rio_mport *, int);
354
355/**
356 * rio_add_outb_message - Add RIO message to an outbound mailbox queue
357 * @mport: RIO master port containing the outbound queue
358 * @rdev: RIO device the message is be sent to
359 * @mbox: The outbound mailbox queue
360 * @buffer: Pointer to the message buffer
361 * @len: Length of the message buffer
362 *
363 * Adds a RIO message buffer to an outbound mailbox queue for
364 * transmission. Returns 0 on success.
365 */
366static inline int rio_add_outb_message(struct rio_mport *mport,
367 struct rio_dev *rdev, int mbox,
368 void *buffer, size_t len)
369{
370 return rio_hw_add_outb_message(mport, rdev, mbox, buffer, len);
371}
372
373extern int rio_request_inb_mbox(struct rio_mport *, void *, int, int,
374 void (*)(struct rio_mport *, void *, int, int));
375extern int rio_release_inb_mbox(struct rio_mport *, int);
376
377/**
378 * rio_add_inb_buffer - Add buffer to an inbound mailbox queue
379 * @mport: Master port containing the inbound mailbox
380 * @mbox: The inbound mailbox number
381 * @buffer: Pointer to the message buffer
382 *
383 * Adds a buffer to an inbound mailbox queue for reception. Returns
384 * 0 on success.
385 */
386static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
387 void *buffer)
388{
389 return rio_hw_add_inb_buffer(mport, mbox, buffer);
390}
391
392/**
393 * rio_get_inb_message - Get A RIO message from an inbound mailbox queue
394 * @mport: Master port containing the inbound mailbox
395 * @mbox: The inbound mailbox number
396 * @buffer: Pointer to the message buffer
397 *
398 * Get a RIO message from an inbound mailbox queue. Returns 0 on success.
399 */
400static inline void *rio_get_inb_message(struct rio_mport *mport, int mbox)
401{
402 return rio_hw_get_inb_message(mport, mbox);
403}
404
405/* Doorbell management */
406extern int rio_request_inb_dbell(struct rio_mport *, void *, u16, u16,
407 void (*)(struct rio_mport *, void *, u16, u16, u16));
408extern int rio_release_inb_dbell(struct rio_mport *, u16, u16);
409extern struct resource *rio_request_outb_dbell(struct rio_dev *, u16, u16);
410extern int rio_release_outb_dbell(struct rio_dev *, struct resource *);
411
412/* Memory region management */
413int rio_claim_resource(struct rio_dev *, int);
414int rio_request_regions(struct rio_dev *, char *);
415void rio_release_regions(struct rio_dev *);
416int rio_request_region(struct rio_dev *, int, char *);
417void rio_release_region(struct rio_dev *, int);
418
419/* LDM support */
420int rio_register_driver(struct rio_driver *);
421void rio_unregister_driver(struct rio_driver *);
422struct rio_dev *rio_dev_get(struct rio_dev *);
423void rio_dev_put(struct rio_dev *);
424
425/**
426 * rio_name - Get the unique RIO device identifier
427 * @rdev: RIO device
428 *
429 * Get the unique RIO device identifier. Returns the device
430 * identifier string.
431 */
432static inline char *rio_name(struct rio_dev *rdev)
433{
434 return rdev->dev.bus_id;
435}
436
437/**
438 * rio_get_drvdata - Get RIO driver specific data
439 * @rdev: RIO device
440 *
441 * Get RIO driver specific data. Returns a pointer to the
442 * driver specific data.
443 */
444static inline void *rio_get_drvdata(struct rio_dev *rdev)
445{
446 return dev_get_drvdata(&rdev->dev);
447}
448
449/**
450 * rio_set_drvdata - Set RIO driver specific data
451 * @rdev: RIO device
452 * @data: Pointer to driver specific data
453 *
454 * Set RIO driver specific data. device struct driver data pointer
455 * is set to the @data argument.
456 */
457static inline void rio_set_drvdata(struct rio_dev *rdev, void *data)
458{
459 dev_set_drvdata(&rdev->dev, data);
460}
461
462/* Misc driver helpers */
463extern u16 rio_local_get_device_id(struct rio_mport *port);
464extern struct rio_dev *rio_get_device(u16 vid, u16 did, struct rio_dev *from);
465extern struct rio_dev *rio_get_asm(u16 vid, u16 did, u16 asm_vid, u16 asm_did,
466 struct rio_dev *from);
467
468#endif /* __KERNEL__ */
469#endif /* LINUX_RIO_DRV_H */
diff --git a/include/linux/rio_ids.h b/include/linux/rio_ids.h
new file mode 100644
index 000000000000..919d4e07d54e
--- /dev/null
+++ b/include/linux/rio_ids.h
@@ -0,0 +1,24 @@
1/*
2 * RapidIO devices
3 *
4 * Copyright 2005 MontaVista Software, Inc.
5 * Matt Porter <mporter@kernel.crashing.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef LINUX_RIO_IDS_H
14#define LINUX_RIO_IDS_H
15
16#define RIO_ANY_ID 0xffff
17
18#define RIO_VID_FREESCALE 0x0002
19#define RIO_DID_MPC8560 0x0003
20
21#define RIO_VID_TUNDRA 0x000d
22#define RIO_DID_TSI500 0x0500
23
24#endif /* LINUX_RIO_IDS_H */
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h
new file mode 100644
index 000000000000..326540f9b54e
--- /dev/null
+++ b/include/linux/rio_regs.h
@@ -0,0 +1,215 @@
1/*
2 * RapidIO register definitions
3 *
4 * Copyright 2005 MontaVista Software, Inc.
5 * Matt Porter <mporter@kernel.crashing.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef LINUX_RIO_REGS_H
14#define LINUX_RIO_REGS_H
15
16/*
17 * In RapidIO, each device has a 2MB configuration space that is
18 * accessed via maintenance transactions. Portions of configuration
19 * space are standardized and/or reserved.
20 */
21#define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */
22#define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */
23#define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */
24#define RIO_ASM_ID_MASK 0xffff0000 /* [I] Asm ID Mask */
25#define RIO_ASM_VEN_ID_MASK 0x0000ffff /* [I] Asm Vend Mask */
26
27#define RIO_ASM_INFO_CAR 0x0c /* [I] Assembly Information CAR */
28#define RIO_ASM_REV_MASK 0xffff0000 /* [I] Asm Rev Mask */
29#define RIO_EXT_FTR_PTR_MASK 0x0000ffff /* [I] EF_PTR Mask */
30
31#define RIO_PEF_CAR 0x10 /* [I] Processing Element Features CAR */
32#define RIO_PEF_BRIDGE 0x80000000 /* [I] Bridge */
33#define RIO_PEF_MEMORY 0x40000000 /* [I] MMIO */
34#define RIO_PEF_PROCESSOR 0x20000000 /* [I] Processor */
35#define RIO_PEF_SWITCH 0x10000000 /* [I] Switch */
36#define RIO_PEF_INB_MBOX 0x00f00000 /* [II] Mailboxes */
37#define RIO_PEF_INB_MBOX0 0x00800000 /* [II] Mailbox 0 */
38#define RIO_PEF_INB_MBOX1 0x00400000 /* [II] Mailbox 1 */
39#define RIO_PEF_INB_MBOX2 0x00200000 /* [II] Mailbox 2 */
40#define RIO_PEF_INB_MBOX3 0x00100000 /* [II] Mailbox 3 */
41#define RIO_PEF_INB_DOORBELL 0x00080000 /* [II] Doorbells */
42#define RIO_PEF_CTLS 0x00000010 /* [III] CTLS */
43#define RIO_PEF_EXT_FEATURES 0x00000008 /* [I] EFT_PTR valid */
44#define RIO_PEF_ADDR_66 0x00000004 /* [I] 66 bits */
45#define RIO_PEF_ADDR_50 0x00000002 /* [I] 50 bits */
46#define RIO_PEF_ADDR_34 0x00000001 /* [I] 34 bits */
47
48#define RIO_SWP_INFO_CAR 0x14 /* [I] Switch Port Information CAR */
49#define RIO_SWP_INFO_PORT_TOTAL_MASK 0x0000ff00 /* [I] Total number of ports */
50#define RIO_SWP_INFO_PORT_NUM_MASK 0x000000ff /* [I] Maintenance transaction port number */
51#define RIO_GET_TOTAL_PORTS(x) ((x & RIO_SWP_INFO_PORT_TOTAL_MASK) >> 8)
52
53#define RIO_SRC_OPS_CAR 0x18 /* [I] Source Operations CAR */
54#define RIO_SRC_OPS_READ 0x00008000 /* [I] Read op */
55#define RIO_SRC_OPS_WRITE 0x00004000 /* [I] Write op */
56#define RIO_SRC_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */
57#define RIO_SRC_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */
58#define RIO_SRC_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */
59#define RIO_SRC_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */
60#define RIO_SRC_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */
61#define RIO_SRC_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */
62#define RIO_SRC_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */
63#define RIO_SRC_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */
64#define RIO_SRC_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */
65#define RIO_SRC_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */
66
67#define RIO_DST_OPS_CAR 0x1c /* Destination Operations CAR */
68#define RIO_DST_OPS_READ 0x00008000 /* [I] Read op */
69#define RIO_DST_OPS_WRITE 0x00004000 /* [I] Write op */
70#define RIO_DST_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */
71#define RIO_DST_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */
72#define RIO_DST_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */
73#define RIO_DST_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */
74#define RIO_DST_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */
75#define RIO_DST_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */
76#define RIO_DST_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */
77#define RIO_DST_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */
78#define RIO_DST_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */
79#define RIO_DST_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */
80
81#define RIO_OPS_READ 0x00008000 /* [I] Read op */
82#define RIO_OPS_WRITE 0x00004000 /* [I] Write op */
83#define RIO_OPS_STREAM_WRITE 0x00002000 /* [I] Str-write op */
84#define RIO_OPS_WRITE_RESPONSE 0x00001000 /* [I] Write/resp op */
85#define RIO_OPS_DATA_MSG 0x00000800 /* [II] Data msg op */
86#define RIO_OPS_DOORBELL 0x00000400 /* [II] Doorbell op */
87#define RIO_OPS_ATOMIC_TST_SWP 0x00000100 /* [I] Atomic TAS op */
88#define RIO_OPS_ATOMIC_INC 0x00000080 /* [I] Atomic inc op */
89#define RIO_OPS_ATOMIC_DEC 0x00000040 /* [I] Atomic dec op */
90#define RIO_OPS_ATOMIC_SET 0x00000020 /* [I] Atomic set op */
91#define RIO_OPS_ATOMIC_CLR 0x00000010 /* [I] Atomic clr op */
92#define RIO_OPS_PORT_WRITE 0x00000004 /* [I] Port-write op */
93
94 /* 0x20-0x3c *//* Reserved */
95
96#define RIO_MBOX_CSR 0x40 /* [II] Mailbox CSR */
97#define RIO_MBOX0_AVAIL 0x80000000 /* [II] Mbox 0 avail */
98#define RIO_MBOX0_FULL 0x40000000 /* [II] Mbox 0 full */
99#define RIO_MBOX0_EMPTY 0x20000000 /* [II] Mbox 0 empty */
100#define RIO_MBOX0_BUSY 0x10000000 /* [II] Mbox 0 busy */
101#define RIO_MBOX0_FAIL 0x08000000 /* [II] Mbox 0 fail */
102#define RIO_MBOX0_ERROR 0x04000000 /* [II] Mbox 0 error */
103#define RIO_MBOX1_AVAIL 0x00800000 /* [II] Mbox 1 avail */
104#define RIO_MBOX1_FULL 0x00200000 /* [II] Mbox 1 full */
105#define RIO_MBOX1_EMPTY 0x00200000 /* [II] Mbox 1 empty */
106#define RIO_MBOX1_BUSY 0x00100000 /* [II] Mbox 1 busy */
107#define RIO_MBOX1_FAIL 0x00080000 /* [II] Mbox 1 fail */
108#define RIO_MBOX1_ERROR 0x00040000 /* [II] Mbox 1 error */
109#define RIO_MBOX2_AVAIL 0x00008000 /* [II] Mbox 2 avail */
110#define RIO_MBOX2_FULL 0x00004000 /* [II] Mbox 2 full */
111#define RIO_MBOX2_EMPTY 0x00002000 /* [II] Mbox 2 empty */
112#define RIO_MBOX2_BUSY 0x00001000 /* [II] Mbox 2 busy */
113#define RIO_MBOX2_FAIL 0x00000800 /* [II] Mbox 2 fail */
114#define RIO_MBOX2_ERROR 0x00000400 /* [II] Mbox 2 error */
115#define RIO_MBOX3_AVAIL 0x00000080 /* [II] Mbox 3 avail */
116#define RIO_MBOX3_FULL 0x00000040 /* [II] Mbox 3 full */
117#define RIO_MBOX3_EMPTY 0x00000020 /* [II] Mbox 3 empty */
118#define RIO_MBOX3_BUSY 0x00000010 /* [II] Mbox 3 busy */
119#define RIO_MBOX3_FAIL 0x00000008 /* [II] Mbox 3 fail */
120#define RIO_MBOX3_ERROR 0x00000004 /* [II] Mbox 3 error */
121
122#define RIO_WRITE_PORT_CSR 0x44 /* [I] Write Port CSR */
123#define RIO_DOORBELL_CSR 0x44 /* [II] Doorbell CSR */
124#define RIO_DOORBELL_AVAIL 0x80000000 /* [II] Doorbell avail */
125#define RIO_DOORBELL_FULL 0x40000000 /* [II] Doorbell full */
126#define RIO_DOORBELL_EMPTY 0x20000000 /* [II] Doorbell empty */
127#define RIO_DOORBELL_BUSY 0x10000000 /* [II] Doorbell busy */
128#define RIO_DOORBELL_FAILED 0x08000000 /* [II] Doorbell failed */
129#define RIO_DOORBELL_ERROR 0x04000000 /* [II] Doorbell error */
130#define RIO_WRITE_PORT_AVAILABLE 0x00000080 /* [I] Write Port Available */
131#define RIO_WRITE_PORT_FULL 0x00000040 /* [I] Write Port Full */
132#define RIO_WRITE_PORT_EMPTY 0x00000020 /* [I] Write Port Empty */
133#define RIO_WRITE_PORT_BUSY 0x00000010 /* [I] Write Port Busy */
134#define RIO_WRITE_PORT_FAILED 0x00000008 /* [I] Write Port Failed */
135#define RIO_WRITE_PORT_ERROR 0x00000004 /* [I] Write Port Error */
136
137 /* 0x48 *//* Reserved */
138
139#define RIO_PELL_CTRL_CSR 0x4c /* [I] PE Logical Layer Control CSR */
140#define RIO_PELL_ADDR_66 0x00000004 /* [I] 66-bit addr */
141#define RIO_PELL_ADDR_50 0x00000002 /* [I] 50-bit addr */
142#define RIO_PELL_ADDR_34 0x00000001 /* [I] 34-bit addr */
143
144 /* 0x50-0x54 *//* Reserved */
145
146#define RIO_LCSH_BA 0x58 /* [I] LCS High Base Address */
147#define RIO_LCSL_BA 0x5c /* [I] LCS Base Address */
148
149#define RIO_DID_CSR 0x60 /* [III] Base Device ID CSR */
150
151 /* 0x64 *//* Reserved */
152
153#define RIO_HOST_DID_LOCK_CSR 0x68 /* [III] Host Base Device ID Lock CSR */
154#define RIO_COMPONENT_TAG_CSR 0x6c /* [III] Component Tag CSR */
155
156 /* 0x70-0xf8 *//* Reserved */
157 /* 0x100-0xfff8 *//* [I] Extended Features Space */
158 /* 0x10000-0xfffff8 *//* [I] Implementation-defined Space */
159
160/*
161 * Extended Features Space is a configuration space area where
162 * functionality is mapped into extended feature blocks via a
163 * singly linked list of extended feature pointers (EFT_PTR).
164 *
165 * Each extended feature block can be identified/located in
166 * Extended Features Space by walking the extended feature
167 * list starting with the Extended Feature Pointer located
168 * in the Assembly Information CAR.
169 *
170 * Extended Feature Blocks (EFBs) are identified with an assigned
171 * EFB ID. Extended feature block offsets in the definitions are
172 * relative to the offset of the EFB within the Extended Features
173 * Space.
174 */
175
176/* Helper macros to parse the Extended Feature Block header */
177#define RIO_EFB_PTR_MASK 0xffff0000
178#define RIO_EFB_ID_MASK 0x0000ffff
179#define RIO_GET_BLOCK_PTR(x) ((x & RIO_EFB_PTR_MASK) >> 16)
180#define RIO_GET_BLOCK_ID(x) (x & RIO_EFB_ID_MASK)
181
182/* Extended Feature Block IDs */
183#define RIO_EFB_PAR_EP_ID 0x0001 /* [IV] LP/LVDS EP Devices */
184#define RIO_EFB_PAR_EP_REC_ID 0x0002 /* [IV] LP/LVDS EP Recovery Devices */
185#define RIO_EFB_PAR_EP_FREE_ID 0x0003 /* [IV] LP/LVDS EP Free Devices */
186#define RIO_EFB_SER_EP_ID 0x0004 /* [VI] LP/Serial EP Devices */
187#define RIO_EFB_SER_EP_REC_ID 0x0005 /* [VI] LP/Serial EP Recovery Devices */
188#define RIO_EFB_SER_EP_FREE_ID 0x0006 /* [VI] LP/Serial EP Free Devices */
189
190/*
191 * Physical 8/16 LP-LVDS
192 * ID=0x0001, Generic End Point Devices
193 * ID=0x0002, Generic End Point Devices, software assisted recovery option
194 * ID=0x0003, Generic End Point Free Devices
195 *
196 * Physical LP-Serial
197 * ID=0x0004, Generic End Point Devices
198 * ID=0x0005, Generic End Point Devices, software assisted recovery option
199 * ID=0x0006, Generic End Point Free Devices
200 */
201#define RIO_PORT_MNT_HEADER 0x0000
202#define RIO_PORT_REQ_CTL_CSR 0x0020
203#define RIO_PORT_RSP_CTL_CSR 0x0024 /* 0x0001/0x0002 */
204#define RIO_PORT_GEN_CTL_CSR 0x003c
205#define RIO_PORT_GEN_HOST 0x80000000
206#define RIO_PORT_GEN_MASTER 0x40000000
207#define RIO_PORT_GEN_DISCOVERED 0x20000000
208#define RIO_PORT_N_MNT_REQ_CSR(x) (0x0040 + x*0x20) /* 0x0002 */
209#define RIO_PORT_N_MNT_RSP_CSR(x) (0x0044 + x*0x20) /* 0x0002 */
210#define RIO_PORT_N_ACK_STS_CSR(x) (0x0048 + x*0x20) /* 0x0002 */
211#define RIO_PORT_N_ERR_STS_CSR(x) (0x58 + x*0x20)
212#define PORT_N_ERR_STS_PORT_OK 0x00000002
213#define RIO_PORT_N_CTL_CSR(x) (0x5c + x*0x20)
214
215#endif /* LINUX_RIO_REGS_H */
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 106f9757339a..3c1f1120fe88 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -79,6 +79,8 @@ struct seminfo {
79 79
80#ifdef __KERNEL__ 80#ifdef __KERNEL__
81 81
82struct task_struct;
83
82/* One semaphore structure for each semaphore in the system. */ 84/* One semaphore structure for each semaphore in the system. */
83struct sem { 85struct sem {
84 int semval; /* current value */ 86 int semval; /* current value */
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 2b799d40d669..cee302aefdb7 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -42,6 +42,7 @@ enum {
42 PLAT8250_DEV_BOCA, 42 PLAT8250_DEV_BOCA,
43 PLAT8250_DEV_HUB6, 43 PLAT8250_DEV_HUB6,
44 PLAT8250_DEV_MCA, 44 PLAT8250_DEV_MCA,
45 PLAT8250_DEV_AU1X00,
45}; 46};
46 47
47/* 48/*
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 9d2579230689..a3ac92b19aca 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -211,6 +211,7 @@ struct uart_port {
211#define UPIO_HUB6 (1) 211#define UPIO_HUB6 (1)
212#define UPIO_MEM (2) 212#define UPIO_MEM (2)
213#define UPIO_MEM32 (3) 213#define UPIO_MEM32 (3)
214#define UPIO_AU (4) /* Au1x00 type IO */
214 215
215 unsigned int read_status_mask; /* driver specific */ 216 unsigned int read_status_mask; /* driver specific */
216 unsigned int ignore_status_mask; /* driver specific */ 217 unsigned int ignore_status_mask; /* driver specific */
diff --git a/include/linux/shm.h b/include/linux/shm.h
index 80113a1f60bc..a2c896ad0bef 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -92,6 +92,7 @@ struct shmid_kernel /* private to the kernel */
92#define SHM_DEST 01000 /* segment will be destroyed on last detach */ 92#define SHM_DEST 01000 /* segment will be destroyed on last detach */
93#define SHM_LOCKED 02000 /* segment will not be swapped */ 93#define SHM_LOCKED 02000 /* segment will not be swapped */
94#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ 94#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
95#define SHM_NORESERVE 010000 /* don't check for reservations */
95 96
96#ifdef CONFIG_SYSVIPC 97#ifdef CONFIG_SYSVIPC
97long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); 98long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4286d832166f..fdfb8fe8c38c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -603,23 +603,23 @@ static inline void skb_queue_head_init(struct sk_buff_head *list)
603 */ 603 */
604 604
605/** 605/**
606 * __skb_queue_head - queue a buffer at the list head 606 * __skb_queue_after - queue a buffer at the list head
607 * @list: list to use 607 * @list: list to use
608 * @prev: place after this buffer
608 * @newsk: buffer to queue 609 * @newsk: buffer to queue
609 * 610 *
610 * Queue a buffer at the start of a list. This function takes no locks 611 * Queue a buffer int the middle of a list. This function takes no locks
611 * and you must therefore hold required locks before calling it. 612 * and you must therefore hold required locks before calling it.
612 * 613 *
613 * A buffer cannot be placed on two lists at the same time. 614 * A buffer cannot be placed on two lists at the same time.
614 */ 615 */
615extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk); 616static inline void __skb_queue_after(struct sk_buff_head *list,
616static inline void __skb_queue_head(struct sk_buff_head *list, 617 struct sk_buff *prev,
617 struct sk_buff *newsk) 618 struct sk_buff *newsk)
618{ 619{
619 struct sk_buff *prev, *next; 620 struct sk_buff *next;
620
621 list->qlen++; 621 list->qlen++;
622 prev = (struct sk_buff *)list; 622
623 next = prev->next; 623 next = prev->next;
624 newsk->next = next; 624 newsk->next = next;
625 newsk->prev = prev; 625 newsk->prev = prev;
@@ -627,6 +627,23 @@ static inline void __skb_queue_head(struct sk_buff_head *list,
627} 627}
628 628
629/** 629/**
630 * __skb_queue_head - queue a buffer at the list head
631 * @list: list to use
632 * @newsk: buffer to queue
633 *
634 * Queue a buffer at the start of a list. This function takes no locks
635 * and you must therefore hold required locks before calling it.
636 *
637 * A buffer cannot be placed on two lists at the same time.
638 */
639extern void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk);
640static inline void __skb_queue_head(struct sk_buff_head *list,
641 struct sk_buff *newsk)
642{
643 __skb_queue_after(list, (struct sk_buff *)list, newsk);
644}
645
646/**
630 * __skb_queue_tail - queue a buffer at the list tail 647 * __skb_queue_tail - queue a buffer at the list tail
631 * @list: list to use 648 * @list: list to use
632 * @newsk: buffer to queue 649 * @newsk: buffer to queue
@@ -1203,6 +1220,11 @@ static inline void kunmap_skb_frag(void *vaddr)
1203 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \ 1220 prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
1204 skb = skb->next) 1221 skb = skb->next)
1205 1222
1223#define skb_queue_reverse_walk(queue, skb) \
1224 for (skb = (queue)->prev; \
1225 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
1226 skb = skb->prev)
1227
1206 1228
1207extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 1229extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
1208 int noblock, int *err); 1230 int noblock, int *err);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 09b9aa60063d..d1ea4051b996 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -9,7 +9,7 @@
9 9
10#if defined(__KERNEL__) 10#if defined(__KERNEL__)
11 11
12typedef struct kmem_cache_s kmem_cache_t; 12typedef struct kmem_cache kmem_cache_t;
13 13
14#include <linux/config.h> /* kmalloc_sizes.h needs CONFIG_ options */ 14#include <linux/config.h> /* kmalloc_sizes.h needs CONFIG_ options */
15#include <linux/gfp.h> 15#include <linux/gfp.h>
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 5af8800e0ce3..e4086ec8b952 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -171,7 +171,8 @@ xdr_argsize_check(struct svc_rqst *rqstp, u32 *p)
171{ 171{
172 char *cp = (char *)p; 172 char *cp = (char *)p;
173 struct kvec *vec = &rqstp->rq_arg.head[0]; 173 struct kvec *vec = &rqstp->rq_arg.head[0];
174 return cp - (char*)vec->iov_base <= vec->iov_len; 174 return cp >= (char*)vec->iov_base
175 && cp <= (char*)vec->iov_base + vec->iov_len;
175} 176}
176 177
177static inline int 178static inline int
diff --git a/include/linux/superhyway.h b/include/linux/superhyway.h
index c906c5a0aaef..17ea468fa362 100644
--- a/include/linux/superhyway.h
+++ b/include/linux/superhyway.h
@@ -19,7 +19,7 @@
19 */ 19 */
20#define SUPERHYWAY_DEVICE_ID_SH5_DMAC 0x0183 20#define SUPERHYWAY_DEVICE_ID_SH5_DMAC 0x0183
21 21
22struct vcr_info { 22struct superhyway_vcr_info {
23 u8 perr_flags; /* P-port Error flags */ 23 u8 perr_flags; /* P-port Error flags */
24 u8 merr_flags; /* Module Error flags */ 24 u8 merr_flags; /* Module Error flags */
25 u16 mod_vers; /* Module Version */ 25 u16 mod_vers; /* Module Version */
@@ -28,6 +28,17 @@ struct vcr_info {
28 u8 top_mb; /* Top Memory block */ 28 u8 top_mb; /* Top Memory block */
29}; 29};
30 30
31struct superhyway_ops {
32 int (*read_vcr)(unsigned long base, struct superhyway_vcr_info *vcr);
33 int (*write_vcr)(unsigned long base, struct superhyway_vcr_info vcr);
34};
35
36struct superhyway_bus {
37 struct superhyway_ops *ops;
38};
39
40extern struct superhyway_bus superhyway_channels[];
41
31struct superhyway_device_id { 42struct superhyway_device_id {
32 unsigned int id; 43 unsigned int id;
33 unsigned long driver_data; 44 unsigned long driver_data;
@@ -55,9 +66,11 @@ struct superhyway_device {
55 66
56 struct superhyway_device_id id; 67 struct superhyway_device_id id;
57 struct superhyway_driver *drv; 68 struct superhyway_driver *drv;
69 struct superhyway_bus *bus;
58 70
59 struct resource resource; 71 int num_resources;
60 struct vcr_info vcr; 72 struct resource *resource;
73 struct superhyway_vcr_info vcr;
61}; 74};
62 75
63#define to_superhyway_device(d) container_of((d), struct superhyway_device, dev) 76#define to_superhyway_device(d) container_of((d), struct superhyway_device, dev)
@@ -65,12 +78,27 @@ struct superhyway_device {
65#define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev) 78#define superhyway_get_drvdata(d) dev_get_drvdata(&(d)->dev)
66#define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p)) 79#define superhyway_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p))
67 80
68extern int superhyway_scan_bus(void); 81static inline int
82superhyway_read_vcr(struct superhyway_device *dev, unsigned long base,
83 struct superhyway_vcr_info *vcr)
84{
85 return dev->bus->ops->read_vcr(base, vcr);
86}
87
88static inline int
89superhyway_write_vcr(struct superhyway_device *dev, unsigned long base,
90 struct superhyway_vcr_info vcr)
91{
92 return dev->bus->ops->write_vcr(base, vcr);
93}
94
95extern int superhyway_scan_bus(struct superhyway_bus *);
69 96
70/* drivers/sh/superhyway/superhyway.c */ 97/* drivers/sh/superhyway/superhyway.c */
71int superhyway_register_driver(struct superhyway_driver *); 98int superhyway_register_driver(struct superhyway_driver *);
72void superhyway_unregister_driver(struct superhyway_driver *); 99void superhyway_unregister_driver(struct superhyway_driver *);
73int superhyway_add_device(unsigned int, unsigned long, unsigned long long); 100int superhyway_add_device(unsigned long base, struct superhyway_device *, struct superhyway_bus *);
101int superhyway_add_devices(struct superhyway_bus *bus, struct superhyway_device **devices, int nr_devices);
74 102
75/* drivers/sh/superhyway/superhyway-sysfs.c */ 103/* drivers/sh/superhyway/superhyway-sysfs.c */
76extern struct device_attribute superhyway_dev_attrs[]; 104extern struct device_attribute superhyway_dev_attrs[];
diff --git a/include/linux/wait.h b/include/linux/wait.h
index d38c9fecdc36..d28518236b62 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -54,6 +54,7 @@ struct __wait_queue_head {
54}; 54};
55typedef struct __wait_queue_head wait_queue_head_t; 55typedef struct __wait_queue_head wait_queue_head_t;
56 56
57struct task_struct;
57 58
58/* 59/*
59 * Macros for declaration and initialisaton of the datatypes 60 * Macros for declaration and initialisaton of the datatypes
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index f87845e2e965..b0c47e2eccf1 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -2,6 +2,7 @@
2#define _INET_ECN_H_ 2#define _INET_ECN_H_
3 3
4#include <linux/ip.h> 4#include <linux/ip.h>
5#include <linux/skbuff.h>
5#include <net/dsfield.h> 6#include <net/dsfield.h>
6 7
7enum { 8enum {
@@ -48,7 +49,7 @@ static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner)
48 (label) |= __constant_htons(INET_ECN_ECT_0 << 4); \ 49 (label) |= __constant_htons(INET_ECN_ECT_0 << 4); \
49 } while (0) 50 } while (0)
50 51
51static inline void IP_ECN_set_ce(struct iphdr *iph) 52static inline int IP_ECN_set_ce(struct iphdr *iph)
52{ 53{
53 u32 check = iph->check; 54 u32 check = iph->check;
54 u32 ecn = (iph->tos + 1) & INET_ECN_MASK; 55 u32 ecn = (iph->tos + 1) & INET_ECN_MASK;
@@ -61,7 +62,7 @@ static inline void IP_ECN_set_ce(struct iphdr *iph)
61 * INET_ECN_CE => 00 62 * INET_ECN_CE => 00
62 */ 63 */
63 if (!(ecn & 2)) 64 if (!(ecn & 2))
64 return; 65 return !ecn;
65 66
66 /* 67 /*
67 * The following gives us: 68 * The following gives us:
@@ -72,6 +73,7 @@ static inline void IP_ECN_set_ce(struct iphdr *iph)
72 73
73 iph->check = check + (check>=0xFFFF); 74 iph->check = check + (check>=0xFFFF);
74 iph->tos |= INET_ECN_CE; 75 iph->tos |= INET_ECN_CE;
76 return 1;
75} 77}
76 78
77static inline void IP_ECN_clear(struct iphdr *iph) 79static inline void IP_ECN_clear(struct iphdr *iph)
@@ -87,11 +89,12 @@ static inline void ipv4_copy_dscp(struct iphdr *outer, struct iphdr *inner)
87 89
88struct ipv6hdr; 90struct ipv6hdr;
89 91
90static inline void IP6_ECN_set_ce(struct ipv6hdr *iph) 92static inline int IP6_ECN_set_ce(struct ipv6hdr *iph)
91{ 93{
92 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) 94 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
93 return; 95 return 0;
94 *(u32*)iph |= htonl(INET_ECN_CE << 20); 96 *(u32*)iph |= htonl(INET_ECN_CE << 20);
97 return 1;
95} 98}
96 99
97static inline void IP6_ECN_clear(struct ipv6hdr *iph) 100static inline void IP6_ECN_clear(struct ipv6hdr *iph)
@@ -105,4 +108,21 @@ static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner)
105 ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); 108 ipv6_change_dsfield(inner, INET_ECN_MASK, dscp);
106} 109}
107 110
111static inline int INET_ECN_set_ce(struct sk_buff *skb)
112{
113 switch (skb->protocol) {
114 case __constant_htons(ETH_P_IP):
115 if (skb->nh.raw + sizeof(struct iphdr) <= skb->tail)
116 return IP_ECN_set_ce(skb->nh.iph);
117 break;
118
119 case __constant_htons(ETH_P_IPV6):
120 if (skb->nh.raw + sizeof(struct ipv6hdr) <= skb->tail)
121 return IP6_ECN_set_ce(skb->nh.ipv6h);
122 break;
123 }
124
125 return 0;
126}
127
108#endif 128#endif
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index f50f95968340..07840baa9341 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -125,9 +125,7 @@ struct inet_hashinfo {
125 rwlock_t lhash_lock ____cacheline_aligned; 125 rwlock_t lhash_lock ____cacheline_aligned;
126 atomic_t lhash_users; 126 atomic_t lhash_users;
127 wait_queue_head_t lhash_wait; 127 wait_queue_head_t lhash_wait;
128 spinlock_t portalloc_lock;
129 kmem_cache_t *bind_bucket_cachep; 128 kmem_cache_t *bind_bucket_cachep;
130 int port_rover;
131}; 129};
132 130
133static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, 131static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
diff --git a/include/net/red.h b/include/net/red.h
new file mode 100644
index 000000000000..2ed4358e3295
--- /dev/null
+++ b/include/net/red.h
@@ -0,0 +1,325 @@
1#ifndef __NET_SCHED_RED_H
2#define __NET_SCHED_RED_H
3
4#include <linux/config.h>
5#include <linux/types.h>
6#include <net/pkt_sched.h>
7#include <net/inet_ecn.h>
8#include <net/dsfield.h>
9
10/* Random Early Detection (RED) algorithm.
11 =======================================
12
13 Source: Sally Floyd and Van Jacobson, "Random Early Detection Gateways
14 for Congestion Avoidance", 1993, IEEE/ACM Transactions on Networking.
15
16 This file codes a "divisionless" version of RED algorithm
17 as written down in Fig.17 of the paper.
18
19 Short description.
20 ------------------
21
22 When a new packet arrives we calculate the average queue length:
23
24 avg = (1-W)*avg + W*current_queue_len,
25
26 W is the filter time constant (chosen as 2^(-Wlog)), it controls
27 the inertia of the algorithm. To allow larger bursts, W should be
28 decreased.
29
30 if (avg > th_max) -> packet marked (dropped).
31 if (avg < th_min) -> packet passes.
32 if (th_min < avg < th_max) we calculate probability:
33
34 Pb = max_P * (avg - th_min)/(th_max-th_min)
35
36 and mark (drop) packet with this probability.
37 Pb changes from 0 (at avg==th_min) to max_P (avg==th_max).
38 max_P should be small (not 1), usually 0.01..0.02 is good value.
39
40 max_P is chosen as a number, so that max_P/(th_max-th_min)
41 is a negative power of two in order arithmetics to contain
42 only shifts.
43
44
45 Parameters, settable by user:
46 -----------------------------
47
48 qth_min - bytes (should be < qth_max/2)
49 qth_max - bytes (should be at least 2*qth_min and less limit)
50 Wlog - bits (<32) log(1/W).
51 Plog - bits (<32)
52
53 Plog is related to max_P by formula:
54
55 max_P = (qth_max-qth_min)/2^Plog;
56
57 F.e. if qth_max=128K and qth_min=32K, then Plog=22
58 corresponds to max_P=0.02
59
60 Scell_log
61 Stab
62
63 Lookup table for log((1-W)^(t/t_ave).
64
65
66 NOTES:
67
68 Upper bound on W.
69 -----------------
70
71 If you want to allow bursts of L packets of size S,
72 you should choose W:
73
74 L + 1 - th_min/S < (1-(1-W)^L)/W
75
76 th_min/S = 32 th_min/S = 4
77
78 log(W) L
79 -1 33
80 -2 35
81 -3 39
82 -4 46
83 -5 57
84 -6 75
85 -7 101
86 -8 135
87 -9 190
88 etc.
89 */
90
91#define RED_STAB_SIZE 256
92#define RED_STAB_MASK (RED_STAB_SIZE - 1)
93
94struct red_stats
95{
96 u32 prob_drop; /* Early probability drops */
97 u32 prob_mark; /* Early probability marks */
98 u32 forced_drop; /* Forced drops, qavg > max_thresh */
99 u32 forced_mark; /* Forced marks, qavg > max_thresh */
100 u32 pdrop; /* Drops due to queue limits */
101 u32 other; /* Drops due to drop() calls */
102 u32 backlog;
103};
104
105struct red_parms
106{
107 /* Parameters */
108 u32 qth_min; /* Min avg length threshold: A scaled */
109 u32 qth_max; /* Max avg length threshold: A scaled */
110 u32 Scell_max;
111 u32 Rmask; /* Cached random mask, see red_rmask */
112 u8 Scell_log;
113 u8 Wlog; /* log(W) */
114 u8 Plog; /* random number bits */
115 u8 Stab[RED_STAB_SIZE];
116
117 /* Variables */
118 int qcount; /* Number of packets since last random
119 number generation */
120 u32 qR; /* Cached random number */
121
122 unsigned long qavg; /* Average queue length: A scaled */
123 psched_time_t qidlestart; /* Start of current idle period */
124};
125
126static inline u32 red_rmask(u8 Plog)
127{
128 return Plog < 32 ? ((1 << Plog) - 1) : ~0UL;
129}
130
131static inline void red_set_parms(struct red_parms *p,
132 u32 qth_min, u32 qth_max, u8 Wlog, u8 Plog,
133 u8 Scell_log, u8 *stab)
134{
135 /* Reset average queue length, the value is strictly bound
136 * to the parameters below, reseting hurts a bit but leaving
137 * it might result in an unreasonable qavg for a while. --TGR
138 */
139 p->qavg = 0;
140
141 p->qcount = -1;
142 p->qth_min = qth_min << Wlog;
143 p->qth_max = qth_max << Wlog;
144 p->Wlog = Wlog;
145 p->Plog = Plog;
146 p->Rmask = red_rmask(Plog);
147 p->Scell_log = Scell_log;
148 p->Scell_max = (255 << Scell_log);
149
150 memcpy(p->Stab, stab, sizeof(p->Stab));
151}
152
153static inline int red_is_idling(struct red_parms *p)
154{
155 return !PSCHED_IS_PASTPERFECT(p->qidlestart);
156}
157
158static inline void red_start_of_idle_period(struct red_parms *p)
159{
160 PSCHED_GET_TIME(p->qidlestart);
161}
162
163static inline void red_end_of_idle_period(struct red_parms *p)
164{
165 PSCHED_SET_PASTPERFECT(p->qidlestart);
166}
167
168static inline void red_restart(struct red_parms *p)
169{
170 red_end_of_idle_period(p);
171 p->qavg = 0;
172 p->qcount = -1;
173}
174
175static inline unsigned long red_calc_qavg_from_idle_time(struct red_parms *p)
176{
177 psched_time_t now;
178 long us_idle;
179 int shift;
180
181 PSCHED_GET_TIME(now);
182 us_idle = PSCHED_TDIFF_SAFE(now, p->qidlestart, p->Scell_max);
183
184 /*
185 * The problem: ideally, average length queue recalcultion should
186 * be done over constant clock intervals. This is too expensive, so
187 * that the calculation is driven by outgoing packets.
188 * When the queue is idle we have to model this clock by hand.
189 *
190 * SF+VJ proposed to "generate":
191 *
192 * m = idletime / (average_pkt_size / bandwidth)
193 *
194 * dummy packets as a burst after idle time, i.e.
195 *
196 * p->qavg *= (1-W)^m
197 *
198 * This is an apparently overcomplicated solution (f.e. we have to
199 * precompute a table to make this calculation in reasonable time)
200 * I believe that a simpler model may be used here,
201 * but it is field for experiments.
202 */
203
204 shift = p->Stab[(us_idle >> p->Scell_log) & RED_STAB_MASK];
205
206 if (shift)
207 return p->qavg >> shift;
208 else {
209 /* Approximate initial part of exponent with linear function:
210 *
211 * (1-W)^m ~= 1-mW + ...
212 *
213 * Seems, it is the best solution to
214 * problem of too coarse exponent tabulation.
215 */
216 us_idle = (p->qavg * us_idle) >> p->Scell_log;
217
218 if (us_idle < (p->qavg >> 1))
219 return p->qavg - us_idle;
220 else
221 return p->qavg >> 1;
222 }
223}
224
225static inline unsigned long red_calc_qavg_no_idle_time(struct red_parms *p,
226 unsigned int backlog)
227{
228 /*
229 * NOTE: p->qavg is fixed point number with point at Wlog.
230 * The formula below is equvalent to floating point
231 * version:
232 *
233 * qavg = qavg*(1-W) + backlog*W;
234 *
235 * --ANK (980924)
236 */
237 return p->qavg + (backlog - (p->qavg >> p->Wlog));
238}
239
240static inline unsigned long red_calc_qavg(struct red_parms *p,
241 unsigned int backlog)
242{
243 if (!red_is_idling(p))
244 return red_calc_qavg_no_idle_time(p, backlog);
245 else
246 return red_calc_qavg_from_idle_time(p);
247}
248
249static inline u32 red_random(struct red_parms *p)
250{
251 return net_random() & p->Rmask;
252}
253
254static inline int red_mark_probability(struct red_parms *p, unsigned long qavg)
255{
256 /* The formula used below causes questions.
257
258 OK. qR is random number in the interval 0..Rmask
259 i.e. 0..(2^Plog). If we used floating point
260 arithmetics, it would be: (2^Plog)*rnd_num,
261 where rnd_num is less 1.
262
263 Taking into account, that qavg have fixed
264 point at Wlog, and Plog is related to max_P by
265 max_P = (qth_max-qth_min)/2^Plog; two lines
266 below have the following floating point equivalent:
267
268 max_P*(qavg - qth_min)/(qth_max-qth_min) < rnd/qcount
269
270 Any questions? --ANK (980924)
271 */
272 return !(((qavg - p->qth_min) >> p->Wlog) * p->qcount < p->qR);
273}
274
275enum {
276 RED_BELOW_MIN_THRESH,
277 RED_BETWEEN_TRESH,
278 RED_ABOVE_MAX_TRESH,
279};
280
281static inline int red_cmp_thresh(struct red_parms *p, unsigned long qavg)
282{
283 if (qavg < p->qth_min)
284 return RED_BELOW_MIN_THRESH;
285 else if (qavg >= p->qth_max)
286 return RED_ABOVE_MAX_TRESH;
287 else
288 return RED_BETWEEN_TRESH;
289}
290
291enum {
292 RED_DONT_MARK,
293 RED_PROB_MARK,
294 RED_HARD_MARK,
295};
296
297static inline int red_action(struct red_parms *p, unsigned long qavg)
298{
299 switch (red_cmp_thresh(p, qavg)) {
300 case RED_BELOW_MIN_THRESH:
301 p->qcount = -1;
302 return RED_DONT_MARK;
303
304 case RED_BETWEEN_TRESH:
305 if (++p->qcount) {
306 if (red_mark_probability(p, qavg)) {
307 p->qcount = 0;
308 p->qR = red_random(p);
309 return RED_PROB_MARK;
310 }
311 } else
312 p->qR = red_random(p);
313
314 return RED_DONT_MARK;
315
316 case RED_ABOVE_MAX_TRESH:
317 p->qcount = -1;
318 return RED_HARD_MARK;
319 }
320
321 BUG();
322 return RED_DONT_MARK;
323}
324
325#endif
diff --git a/include/rdma/ib_user_cm.h b/include/rdma/ib_user_cm.h
index 3037588b8464..19be116047f6 100644
--- a/include/rdma/ib_user_cm.h
+++ b/include/rdma/ib_user_cm.h
@@ -38,7 +38,7 @@
38 38
39#include <linux/types.h> 39#include <linux/types.h>
40 40
41#define IB_USER_CM_ABI_VERSION 3 41#define IB_USER_CM_ABI_VERSION 4
42 42
43enum { 43enum {
44 IB_USER_CM_CMD_CREATE_ID, 44 IB_USER_CM_CMD_CREATE_ID,
@@ -84,6 +84,7 @@ struct ib_ucm_create_id_resp {
84struct ib_ucm_destroy_id { 84struct ib_ucm_destroy_id {
85 __u64 response; 85 __u64 response;
86 __u32 id; 86 __u32 id;
87 __u32 reserved;
87}; 88};
88 89
89struct ib_ucm_destroy_id_resp { 90struct ib_ucm_destroy_id_resp {
@@ -93,6 +94,7 @@ struct ib_ucm_destroy_id_resp {
93struct ib_ucm_attr_id { 94struct ib_ucm_attr_id {
94 __u64 response; 95 __u64 response;
95 __u32 id; 96 __u32 id;
97 __u32 reserved;
96}; 98};
97 99
98struct ib_ucm_attr_id_resp { 100struct ib_ucm_attr_id_resp {
@@ -164,6 +166,7 @@ struct ib_ucm_listen {
164 __be64 service_id; 166 __be64 service_id;
165 __be64 service_mask; 167 __be64 service_mask;
166 __u32 id; 168 __u32 id;
169 __u32 reserved;
167}; 170};
168 171
169struct ib_ucm_establish { 172struct ib_ucm_establish {
@@ -219,7 +222,7 @@ struct ib_ucm_req {
219 __u8 rnr_retry_count; 222 __u8 rnr_retry_count;
220 __u8 max_cm_retries; 223 __u8 max_cm_retries;
221 __u8 srq; 224 __u8 srq;
222 __u8 reserved[1]; 225 __u8 reserved[5];
223}; 226};
224 227
225struct ib_ucm_rep { 228struct ib_ucm_rep {
@@ -236,6 +239,7 @@ struct ib_ucm_rep {
236 __u8 flow_control; 239 __u8 flow_control;
237 __u8 rnr_retry_count; 240 __u8 rnr_retry_count;
238 __u8 srq; 241 __u8 srq;
242 __u8 reserved[4];
239}; 243};
240 244
241struct ib_ucm_info { 245struct ib_ucm_info {
@@ -245,7 +249,7 @@ struct ib_ucm_info {
245 __u64 data; 249 __u64 data;
246 __u8 info_len; 250 __u8 info_len;
247 __u8 data_len; 251 __u8 data_len;
248 __u8 reserved[2]; 252 __u8 reserved[6];
249}; 253};
250 254
251struct ib_ucm_mra { 255struct ib_ucm_mra {
@@ -273,6 +277,7 @@ struct ib_ucm_sidr_req {
273 __u16 pkey; 277 __u16 pkey;
274 __u8 len; 278 __u8 len;
275 __u8 max_cm_retries; 279 __u8 max_cm_retries;
280 __u8 reserved[4];
276}; 281};
277 282
278struct ib_ucm_sidr_rep { 283struct ib_ucm_sidr_rep {
@@ -284,7 +289,7 @@ struct ib_ucm_sidr_rep {
284 __u64 data; 289 __u64 data;
285 __u8 info_len; 290 __u8 info_len;
286 __u8 data_len; 291 __u8 data_len;
287 __u8 reserved[2]; 292 __u8 reserved[6];
288}; 293};
289/* 294/*
290 * event notification ABI structures. 295 * event notification ABI structures.
@@ -295,7 +300,7 @@ struct ib_ucm_event_get {
295 __u64 info; 300 __u64 info;
296 __u8 data_len; 301 __u8 data_len;
297 __u8 info_len; 302 __u8 info_len;
298 __u8 reserved[2]; 303 __u8 reserved[6];
299}; 304};
300 305
301struct ib_ucm_req_event_resp { 306struct ib_ucm_req_event_resp {
@@ -315,6 +320,7 @@ struct ib_ucm_req_event_resp {
315 __u8 rnr_retry_count; 320 __u8 rnr_retry_count;
316 __u8 srq; 321 __u8 srq;
317 __u8 port; 322 __u8 port;
323 __u8 reserved[7];
318}; 324};
319 325
320struct ib_ucm_rep_event_resp { 326struct ib_ucm_rep_event_resp {
@@ -329,7 +335,7 @@ struct ib_ucm_rep_event_resp {
329 __u8 flow_control; 335 __u8 flow_control;
330 __u8 rnr_retry_count; 336 __u8 rnr_retry_count;
331 __u8 srq; 337 __u8 srq;
332 __u8 reserved[1]; 338 __u8 reserved[5];
333}; 339};
334 340
335struct ib_ucm_rej_event_resp { 341struct ib_ucm_rej_event_resp {
@@ -374,6 +380,7 @@ struct ib_ucm_event_resp {
374 __u32 id; 380 __u32 id;
375 __u32 event; 381 __u32 event;
376 __u32 present; 382 __u32 present;
383 __u32 reserved;
377 union { 384 union {
378 struct ib_ucm_req_event_resp req_resp; 385 struct ib_ucm_req_event_resp req_resp;
379 struct ib_ucm_rep_event_resp rep_resp; 386 struct ib_ucm_rep_event_resp rep_resp;
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
new file mode 100644
index 000000000000..be1bc792ab18
--- /dev/null
+++ b/include/scsi/iscsi_if.h
@@ -0,0 +1,245 @@
1/*
2 * iSCSI User/Kernel Shares (Defines, Constants, Protocol definitions, etc)
3 *
4 * Copyright (C) 2005 Dmitry Yusupov
5 * Copyright (C) 2005 Alex Aizman
6 * maintained by open-iscsi@googlegroups.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * See the file COPYING included with this distribution for more details.
19 */
20
21#ifndef ISCSI_IF_H
22#define ISCSI_IF_H
23
24#include <scsi/iscsi_proto.h>
25
26#define UEVENT_BASE 10
27#define KEVENT_BASE 100
28#define ISCSI_ERR_BASE 1000
29
30enum iscsi_uevent_e {
31 ISCSI_UEVENT_UNKNOWN = 0,
32
33 /* down events */
34 ISCSI_UEVENT_CREATE_SESSION = UEVENT_BASE + 1,
35 ISCSI_UEVENT_DESTROY_SESSION = UEVENT_BASE + 2,
36 ISCSI_UEVENT_CREATE_CONN = UEVENT_BASE + 3,
37 ISCSI_UEVENT_DESTROY_CONN = UEVENT_BASE + 4,
38 ISCSI_UEVENT_BIND_CONN = UEVENT_BASE + 5,
39 ISCSI_UEVENT_SET_PARAM = UEVENT_BASE + 6,
40 ISCSI_UEVENT_START_CONN = UEVENT_BASE + 7,
41 ISCSI_UEVENT_STOP_CONN = UEVENT_BASE + 8,
42 ISCSI_UEVENT_SEND_PDU = UEVENT_BASE + 9,
43 ISCSI_UEVENT_GET_STATS = UEVENT_BASE + 10,
44 ISCSI_UEVENT_GET_PARAM = UEVENT_BASE + 11,
45
46 /* up events */
47 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
48 ISCSI_KEVENT_CONN_ERROR = KEVENT_BASE + 2,
49 ISCSI_KEVENT_IF_ERROR = KEVENT_BASE + 3,
50};
51
52struct iscsi_uevent {
53 uint32_t type; /* k/u events type */
54 uint32_t iferror; /* carries interface or resource errors */
55 uint64_t transport_handle;
56
57 union {
58 /* messages u -> k */
59 struct msg_create_session {
60 uint32_t initial_cmdsn;
61 } c_session;
62 struct msg_destroy_session {
63 uint64_t session_handle;
64 uint32_t sid;
65 } d_session;
66 struct msg_create_conn {
67 uint64_t session_handle;
68 uint32_t cid;
69 uint32_t sid;
70 } c_conn;
71 struct msg_bind_conn {
72 uint64_t session_handle;
73 uint64_t conn_handle;
74 uint32_t transport_fd;
75 uint32_t is_leading;
76 } b_conn;
77 struct msg_destroy_conn {
78 uint64_t conn_handle;
79 uint32_t cid;
80 } d_conn;
81 struct msg_send_pdu {
82 uint32_t hdr_size;
83 uint32_t data_size;
84 uint64_t conn_handle;
85 } send_pdu;
86 struct msg_set_param {
87 uint64_t conn_handle;
88 uint32_t param; /* enum iscsi_param */
89 uint32_t value;
90 } set_param;
91 struct msg_start_conn {
92 uint64_t conn_handle;
93 } start_conn;
94 struct msg_stop_conn {
95 uint64_t conn_handle;
96 uint32_t flag;
97 } stop_conn;
98 struct msg_get_stats {
99 uint64_t conn_handle;
100 } get_stats;
101 } u;
102 union {
103 /* messages k -> u */
104 uint64_t handle;
105 int retcode;
106 struct msg_create_session_ret {
107 uint64_t session_handle;
108 uint32_t sid;
109 } c_session_ret;
110 struct msg_recv_req {
111 uint64_t recv_handle;
112 uint64_t conn_handle;
113 } recv_req;
114 struct msg_conn_error {
115 uint64_t conn_handle;
116 uint32_t error; /* enum iscsi_err */
117 } connerror;
118 } r;
119} __attribute__ ((aligned (sizeof(uint64_t))));
120
121/*
122 * Common error codes
123 */
124enum iscsi_err {
125 ISCSI_OK = 0,
126
127 ISCSI_ERR_DATASN = ISCSI_ERR_BASE + 1,
128 ISCSI_ERR_DATA_OFFSET = ISCSI_ERR_BASE + 2,
129 ISCSI_ERR_MAX_CMDSN = ISCSI_ERR_BASE + 3,
130 ISCSI_ERR_EXP_CMDSN = ISCSI_ERR_BASE + 4,
131 ISCSI_ERR_BAD_OPCODE = ISCSI_ERR_BASE + 5,
132 ISCSI_ERR_DATALEN = ISCSI_ERR_BASE + 6,
133 ISCSI_ERR_AHSLEN = ISCSI_ERR_BASE + 7,
134 ISCSI_ERR_PROTO = ISCSI_ERR_BASE + 8,
135 ISCSI_ERR_LUN = ISCSI_ERR_BASE + 9,
136 ISCSI_ERR_BAD_ITT = ISCSI_ERR_BASE + 10,
137 ISCSI_ERR_CONN_FAILED = ISCSI_ERR_BASE + 11,
138 ISCSI_ERR_R2TSN = ISCSI_ERR_BASE + 12,
139 ISCSI_ERR_SESSION_FAILED = ISCSI_ERR_BASE + 13,
140 ISCSI_ERR_HDR_DGST = ISCSI_ERR_BASE + 14,
141 ISCSI_ERR_DATA_DGST = ISCSI_ERR_BASE + 15,
142 ISCSI_ERR_PARAM_NOT_FOUND = ISCSI_ERR_BASE + 16
143};
144
145/*
146 * iSCSI Parameters (RFC3720)
147 */
148enum iscsi_param {
149 ISCSI_PARAM_MAX_RECV_DLENGTH = 0,
150 ISCSI_PARAM_MAX_XMIT_DLENGTH = 1,
151 ISCSI_PARAM_HDRDGST_EN = 2,
152 ISCSI_PARAM_DATADGST_EN = 3,
153 ISCSI_PARAM_INITIAL_R2T_EN = 4,
154 ISCSI_PARAM_MAX_R2T = 5,
155 ISCSI_PARAM_IMM_DATA_EN = 6,
156 ISCSI_PARAM_FIRST_BURST = 7,
157 ISCSI_PARAM_MAX_BURST = 8,
158 ISCSI_PARAM_PDU_INORDER_EN = 9,
159 ISCSI_PARAM_DATASEQ_INORDER_EN = 10,
160 ISCSI_PARAM_ERL = 11,
161 ISCSI_PARAM_IFMARKER_EN = 12,
162 ISCSI_PARAM_OFMARKER_EN = 13,
163};
164#define ISCSI_PARAM_MAX 14
165
166typedef uint64_t iscsi_sessionh_t; /* iSCSI Data-Path session handle */
167typedef uint64_t iscsi_connh_t; /* iSCSI Data-Path connection handle */
168
169#define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
170#define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
171#define iscsi_hostdata(_hostdata) ((void*)_hostdata + sizeof(unsigned long))
172
173/*
174 * These flags presents iSCSI Data-Path capabilities.
175 */
176#define CAP_RECOVERY_L0 0x1
177#define CAP_RECOVERY_L1 0x2
178#define CAP_RECOVERY_L2 0x4
179#define CAP_MULTI_R2T 0x8
180#define CAP_HDRDGST 0x10
181#define CAP_DATADGST 0x20
182#define CAP_MULTI_CONN 0x40
183#define CAP_TEXT_NEGO 0x80
184#define CAP_MARKERS 0x100
185
186/*
187 * These flags describes reason of stop_conn() call
188 */
189#define STOP_CONN_TERM 0x1
190#define STOP_CONN_SUSPEND 0x2
191#define STOP_CONN_RECOVER 0x3
192
193#define ISCSI_STATS_CUSTOM_MAX 32
194#define ISCSI_STATS_CUSTOM_DESC_MAX 64
195struct iscsi_stats_custom {
196 char desc[ISCSI_STATS_CUSTOM_DESC_MAX];
197 uint64_t value;
198};
199
200/*
201 * struct iscsi_stats - iSCSI Statistics (iSCSI MIB)
202 *
203 * Note: this structure contains counters collected on per-connection basis.
204 */
205struct iscsi_stats {
206 /* octets */
207 uint64_t txdata_octets;
208 uint64_t rxdata_octets;
209
210 /* xmit pdus */
211 uint32_t noptx_pdus;
212 uint32_t scsicmd_pdus;
213 uint32_t tmfcmd_pdus;
214 uint32_t login_pdus;
215 uint32_t text_pdus;
216 uint32_t dataout_pdus;
217 uint32_t logout_pdus;
218 uint32_t snack_pdus;
219
220 /* recv pdus */
221 uint32_t noprx_pdus;
222 uint32_t scsirsp_pdus;
223 uint32_t tmfrsp_pdus;
224 uint32_t textrsp_pdus;
225 uint32_t datain_pdus;
226 uint32_t logoutrsp_pdus;
227 uint32_t r2t_pdus;
228 uint32_t async_pdus;
229 uint32_t rjt_pdus;
230
231 /* errors */
232 uint32_t digest_err;
233 uint32_t timeout_err;
234
235 /*
236 * iSCSI Custom Statistics support, i.e. Transport could
237 * extend existing MIB statistics with its own specific statistics
238 * up to ISCSI_STATS_CUSTOM_MAX
239 */
240 uint32_t custom_length;
241 struct iscsi_stats_custom custom[0]
242 __attribute__ ((aligned (sizeof(uint64_t))));
243};
244
245#endif
diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h
new file mode 100644
index 000000000000..4feda05fdf25
--- /dev/null
+++ b/include/scsi/iscsi_proto.h
@@ -0,0 +1,589 @@
1/*
2 * RFC 3720 (iSCSI) protocol data types
3 *
4 * Copyright (C) 2005 Dmitry Yusupov
5 * Copyright (C) 2005 Alex Aizman
6 * maintained by open-iscsi@googlegroups.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * See the file COPYING included with this distribution for more details.
19 */
20
21#ifndef ISCSI_PROTO_H
22#define ISCSI_PROTO_H
23
24#define ISCSI_VERSION_STR "0.3"
25#define ISCSI_DATE_STR "22-Apr-2005"
26#define ISCSI_DRAFT20_VERSION 0x00
27
28/* default iSCSI listen port for incoming connections */
29#define ISCSI_LISTEN_PORT 3260
30
31/* Padding word length */
32#define PAD_WORD_LEN 4
33
34/*
35 * useful common(control and data pathes) macro
36 */
37#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
38#define hton24(p, v) { \
39 p[0] = (((v) >> 16) & 0xFF); \
40 p[1] = (((v) >> 8) & 0xFF); \
41 p[2] = ((v) & 0xFF); \
42}
43#define zero_data(p) {p[0]=0;p[1]=0;p[2]=0;}
44
45/*
46 * iSCSI Template Message Header
47 */
48struct iscsi_hdr {
49 uint8_t opcode;
50 uint8_t flags; /* Final bit */
51 uint8_t rsvd2[2];
52 uint8_t hlength; /* AHSs total length */
53 uint8_t dlength[3]; /* Data length */
54 uint8_t lun[8];
55 __be32 itt; /* Initiator Task Tag */
56 __be32 ttt; /* Target Task Tag */
57 __be32 statsn;
58 __be32 exp_statsn;
59 __be32 max_statsn;
60 uint8_t other[12];
61};
62
63/************************* RFC 3720 Begin *****************************/
64
65#define ISCSI_RESERVED_TAG 0xffffffff
66
67/* Opcode encoding bits */
68#define ISCSI_OP_RETRY 0x80
69#define ISCSI_OP_IMMEDIATE 0x40
70#define ISCSI_OPCODE_MASK 0x3F
71
72/* Initiator Opcode values */
73#define ISCSI_OP_NOOP_OUT 0x00
74#define ISCSI_OP_SCSI_CMD 0x01
75#define ISCSI_OP_SCSI_TMFUNC 0x02
76#define ISCSI_OP_LOGIN 0x03
77#define ISCSI_OP_TEXT 0x04
78#define ISCSI_OP_SCSI_DATA_OUT 0x05
79#define ISCSI_OP_LOGOUT 0x06
80#define ISCSI_OP_SNACK 0x10
81
82#define ISCSI_OP_VENDOR1_CMD 0x1c
83#define ISCSI_OP_VENDOR2_CMD 0x1d
84#define ISCSI_OP_VENDOR3_CMD 0x1e
85#define ISCSI_OP_VENDOR4_CMD 0x1f
86
87/* Target Opcode values */
88#define ISCSI_OP_NOOP_IN 0x20
89#define ISCSI_OP_SCSI_CMD_RSP 0x21
90#define ISCSI_OP_SCSI_TMFUNC_RSP 0x22
91#define ISCSI_OP_LOGIN_RSP 0x23
92#define ISCSI_OP_TEXT_RSP 0x24
93#define ISCSI_OP_SCSI_DATA_IN 0x25
94#define ISCSI_OP_LOGOUT_RSP 0x26
95#define ISCSI_OP_R2T 0x31
96#define ISCSI_OP_ASYNC_EVENT 0x32
97#define ISCSI_OP_REJECT 0x3f
98
99struct iscsi_ahs_hdr {
100 __be16 ahslength;
101 uint8_t ahstype;
102 uint8_t ahspec[5];
103};
104
105#define ISCSI_AHSTYPE_CDB 1
106#define ISCSI_AHSTYPE_RLENGTH 2
107
108/* iSCSI PDU Header */
109struct iscsi_cmd {
110 uint8_t opcode;
111 uint8_t flags;
112 __be16 rsvd2;
113 uint8_t hlength;
114 uint8_t dlength[3];
115 uint8_t lun[8];
116 __be32 itt; /* Initiator Task Tag */
117 __be32 data_length;
118 __be32 cmdsn;
119 __be32 exp_statsn;
120 uint8_t cdb[16]; /* SCSI Command Block */
121 /* Additional Data (Command Dependent) */
122};
123
124/* Command PDU flags */
125#define ISCSI_FLAG_CMD_FINAL 0x80
126#define ISCSI_FLAG_CMD_READ 0x40
127#define ISCSI_FLAG_CMD_WRITE 0x20
128#define ISCSI_FLAG_CMD_ATTR_MASK 0x07 /* 3 bits */
129
130/* SCSI Command Attribute values */
131#define ISCSI_ATTR_UNTAGGED 0
132#define ISCSI_ATTR_SIMPLE 1
133#define ISCSI_ATTR_ORDERED 2
134#define ISCSI_ATTR_HEAD_OF_QUEUE 3
135#define ISCSI_ATTR_ACA 4
136
137struct iscsi_rlength_ahdr {
138 __be16 ahslength;
139 uint8_t ahstype;
140 uint8_t reserved;
141 __be32 read_length;
142};
143
144/* SCSI Response Header */
145struct iscsi_cmd_rsp {
146 uint8_t opcode;
147 uint8_t flags;
148 uint8_t response;
149 uint8_t cmd_status;
150 uint8_t hlength;
151 uint8_t dlength[3];
152 uint8_t rsvd[8];
153 __be32 itt; /* Initiator Task Tag */
154 __be32 rsvd1;
155 __be32 statsn;
156 __be32 exp_cmdsn;
157 __be32 max_cmdsn;
158 __be32 exp_datasn;
159 __be32 bi_residual_count;
160 __be32 residual_count;
161 /* Response or Sense Data (optional) */
162};
163
164/* Command Response PDU flags */
165#define ISCSI_FLAG_CMD_BIDI_OVERFLOW 0x10
166#define ISCSI_FLAG_CMD_BIDI_UNDERFLOW 0x08
167#define ISCSI_FLAG_CMD_OVERFLOW 0x04
168#define ISCSI_FLAG_CMD_UNDERFLOW 0x02
169
170/* iSCSI Status values. Valid if Rsp Selector bit is not set */
171#define ISCSI_STATUS_CMD_COMPLETED 0
172#define ISCSI_STATUS_TARGET_FAILURE 1
173#define ISCSI_STATUS_SUBSYS_FAILURE 2
174
175/* Asynchronous Event Header */
176struct iscsi_async {
177 uint8_t opcode;
178 uint8_t flags;
179 uint8_t rsvd2[2];
180 uint8_t rsvd3;
181 uint8_t dlength[3];
182 uint8_t lun[8];
183 uint8_t rsvd4[8];
184 __be32 statsn;
185 __be32 exp_cmdsn;
186 __be32 max_cmdsn;
187 uint8_t async_event;
188 uint8_t async_vcode;
189 __be16 param1;
190 __be16 param2;
191 __be16 param3;
192 uint8_t rsvd5[4];
193};
194
195/* iSCSI Event Codes */
196#define ISCSI_ASYNC_MSG_SCSI_EVENT 0
197#define ISCSI_ASYNC_MSG_REQUEST_LOGOUT 1
198#define ISCSI_ASYNC_MSG_DROPPING_CONNECTION 2
199#define ISCSI_ASYNC_MSG_DROPPING_ALL_CONNECTIONS 3
200#define ISCSI_ASYNC_MSG_PARAM_NEGOTIATION 4
201#define ISCSI_ASYNC_MSG_VENDOR_SPECIFIC 255
202
203/* NOP-Out Message */
204struct iscsi_nopout {
205 uint8_t opcode;
206 uint8_t flags;
207 __be16 rsvd2;
208 uint8_t rsvd3;
209 uint8_t dlength[3];
210 uint8_t lun[8];
211 __be32 itt; /* Initiator Task Tag */
212 __be32 ttt; /* Target Transfer Tag */
213 __be32 cmdsn;
214 __be32 exp_statsn;
215 uint8_t rsvd4[16];
216};
217
218/* NOP-In Message */
219struct iscsi_nopin {
220 uint8_t opcode;
221 uint8_t flags;
222 __be16 rsvd2;
223 uint8_t rsvd3;
224 uint8_t dlength[3];
225 uint8_t lun[8];
226 __be32 itt; /* Initiator Task Tag */
227 __be32 ttt; /* Target Transfer Tag */
228 __be32 statsn;
229 __be32 exp_cmdsn;
230 __be32 max_cmdsn;
231 uint8_t rsvd4[12];
232};
233
234/* SCSI Task Management Message Header */
235struct iscsi_tm {
236 uint8_t opcode;
237 uint8_t flags;
238 uint8_t rsvd1[2];
239 uint8_t hlength;
240 uint8_t dlength[3];
241 uint8_t lun[8];
242 __be32 itt; /* Initiator Task Tag */
243 __be32 rtt; /* Reference Task Tag */
244 __be32 cmdsn;
245 __be32 exp_statsn;
246 __be32 refcmdsn;
247 __be32 exp_datasn;
248 uint8_t rsvd2[8];
249};
250
251#define ISCSI_FLAG_TM_FUNC_MASK 0x7F
252
253/* Function values */
254#define ISCSI_TM_FUNC_ABORT_TASK 1
255#define ISCSI_TM_FUNC_ABORT_TASK_SET 2
256#define ISCSI_TM_FUNC_CLEAR_ACA 3
257#define ISCSI_TM_FUNC_CLEAR_TASK_SET 4
258#define ISCSI_TM_FUNC_LOGICAL_UNIT_RESET 5
259#define ISCSI_TM_FUNC_TARGET_WARM_RESET 6
260#define ISCSI_TM_FUNC_TARGET_COLD_RESET 7
261#define ISCSI_TM_FUNC_TASK_REASSIGN 8
262
263/* SCSI Task Management Response Header */
264struct iscsi_tm_rsp {
265 uint8_t opcode;
266 uint8_t flags;
267 uint8_t response; /* see Response values below */
268 uint8_t qualifier;
269 uint8_t hlength;
270 uint8_t dlength[3];
271 uint8_t rsvd2[8];
272 __be32 itt; /* Initiator Task Tag */
273 __be32 rtt; /* Reference Task Tag */
274 __be32 statsn;
275 __be32 exp_cmdsn;
276 __be32 max_cmdsn;
277 uint8_t rsvd3[12];
278};
279
280/* Response values */
281#define ISCSI_TMF_RSP_COMPLETE 0x00
282#define ISCSI_TMF_RSP_NO_TASK 0x01
283#define ISCSI_TMF_RSP_NO_LUN 0x02
284#define ISCSI_TMF_RSP_TASK_ALLEGIANT 0x03
285#define ISCSI_TMF_RSP_NO_FAILOVER 0x04
286#define ISCSI_TMF_RSP_NOT_SUPPORTED 0x05
287#define ISCSI_TMF_RSP_AUTH_FAILED 0x06
288#define ISCSI_TMF_RSP_REJECTED 0xff
289
290/* Ready To Transfer Header */
291struct iscsi_r2t_rsp {
292 uint8_t opcode;
293 uint8_t flags;
294 uint8_t rsvd2[2];
295 uint8_t hlength;
296 uint8_t dlength[3];
297 uint8_t lun[8];
298 __be32 itt; /* Initiator Task Tag */
299 __be32 ttt; /* Target Transfer Tag */
300 __be32 statsn;
301 __be32 exp_cmdsn;
302 __be32 max_cmdsn;
303 __be32 r2tsn;
304 __be32 data_offset;
305 __be32 data_length;
306};
307
308/* SCSI Data Hdr */
309struct iscsi_data {
310 uint8_t opcode;
311 uint8_t flags;
312 uint8_t rsvd2[2];
313 uint8_t rsvd3;
314 uint8_t dlength[3];
315 uint8_t lun[8];
316 __be32 itt;
317 __be32 ttt;
318 __be32 rsvd4;
319 __be32 exp_statsn;
320 __be32 rsvd5;
321 __be32 datasn;
322 __be32 offset;
323 __be32 rsvd6;
324 /* Payload */
325};
326
327/* SCSI Data Response Hdr */
328struct iscsi_data_rsp {
329 uint8_t opcode;
330 uint8_t flags;
331 uint8_t rsvd2;
332 uint8_t cmd_status;
333 uint8_t hlength;
334 uint8_t dlength[3];
335 uint8_t lun[8];
336 __be32 itt;
337 __be32 ttt;
338 __be32 statsn;
339 __be32 exp_cmdsn;
340 __be32 max_cmdsn;
341 __be32 datasn;
342 __be32 offset;
343 __be32 residual_count;
344};
345
346/* Data Response PDU flags */
347#define ISCSI_FLAG_DATA_ACK 0x40
348#define ISCSI_FLAG_DATA_OVERFLOW 0x04
349#define ISCSI_FLAG_DATA_UNDERFLOW 0x02
350#define ISCSI_FLAG_DATA_STATUS 0x01
351
352/* Text Header */
353struct iscsi_text {
354 uint8_t opcode;
355 uint8_t flags;
356 uint8_t rsvd2[2];
357 uint8_t hlength;
358 uint8_t dlength[3];
359 uint8_t rsvd4[8];
360 __be32 itt;
361 __be32 ttt;
362 __be32 cmdsn;
363 __be32 exp_statsn;
364 uint8_t rsvd5[16];
365 /* Text - key=value pairs */
366};
367
368#define ISCSI_FLAG_TEXT_CONTINUE 0x40
369
370/* Text Response Header */
371struct iscsi_text_rsp {
372 uint8_t opcode;
373 uint8_t flags;
374 uint8_t rsvd2[2];
375 uint8_t hlength;
376 uint8_t dlength[3];
377 uint8_t rsvd4[8];
378 __be32 itt;
379 __be32 ttt;
380 __be32 statsn;
381 __be32 exp_cmdsn;
382 __be32 max_cmdsn;
383 uint8_t rsvd5[12];
384 /* Text Response - key:value pairs */
385};
386
387/* Login Header */
388struct iscsi_login {
389 uint8_t opcode;
390 uint8_t flags;
391 uint8_t max_version; /* Max. version supported */
392 uint8_t min_version; /* Min. version supported */
393 uint8_t hlength;
394 uint8_t dlength[3];
395 uint8_t isid[6]; /* Initiator Session ID */
396 __be16 tsih; /* Target Session Handle */
397 __be32 itt; /* Initiator Task Tag */
398 __be16 cid;
399 __be16 rsvd3;
400 __be32 cmdsn;
401 __be32 exp_statsn;
402 uint8_t rsvd5[16];
403};
404
405/* Login PDU flags */
406#define ISCSI_FLAG_LOGIN_TRANSIT 0x80
407#define ISCSI_FLAG_LOGIN_CONTINUE 0x40
408#define ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK 0x0C /* 2 bits */
409#define ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK 0x03 /* 2 bits */
410
411#define ISCSI_LOGIN_CURRENT_STAGE(flags) \
412 ((flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2)
413#define ISCSI_LOGIN_NEXT_STAGE(flags) \
414 (flags & ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK)
415
416/* Login Response Header */
417struct iscsi_login_rsp {
418 uint8_t opcode;
419 uint8_t flags;
420 uint8_t max_version; /* Max. version supported */
421 uint8_t active_version; /* Active version */
422 uint8_t hlength;
423 uint8_t dlength[3];
424 uint8_t isid[6]; /* Initiator Session ID */
425 __be16 tsih; /* Target Session Handle */
426 __be32 itt; /* Initiator Task Tag */
427 __be32 rsvd3;
428 __be32 statsn;
429 __be32 exp_cmdsn;
430 __be32 max_cmdsn;
431 uint8_t status_class; /* see Login RSP ststus classes below */
432 uint8_t status_detail; /* see Login RSP Status details below */
433 uint8_t rsvd4[10];
434};
435
436/* Login stage (phase) codes for CSG, NSG */
437#define ISCSI_INITIAL_LOGIN_STAGE -1
438#define ISCSI_SECURITY_NEGOTIATION_STAGE 0
439#define ISCSI_OP_PARMS_NEGOTIATION_STAGE 1
440#define ISCSI_FULL_FEATURE_PHASE 3
441
442/* Login Status response classes */
443#define ISCSI_STATUS_CLS_SUCCESS 0x00
444#define ISCSI_STATUS_CLS_REDIRECT 0x01
445#define ISCSI_STATUS_CLS_INITIATOR_ERR 0x02
446#define ISCSI_STATUS_CLS_TARGET_ERR 0x03
447
448/* Login Status response detail codes */
449/* Class-0 (Success) */
450#define ISCSI_LOGIN_STATUS_ACCEPT 0x00
451
452/* Class-1 (Redirection) */
453#define ISCSI_LOGIN_STATUS_TGT_MOVED_TEMP 0x01
454#define ISCSI_LOGIN_STATUS_TGT_MOVED_PERM 0x02
455
456/* Class-2 (Initiator Error) */
457#define ISCSI_LOGIN_STATUS_INIT_ERR 0x00
458#define ISCSI_LOGIN_STATUS_AUTH_FAILED 0x01
459#define ISCSI_LOGIN_STATUS_TGT_FORBIDDEN 0x02
460#define ISCSI_LOGIN_STATUS_TGT_NOT_FOUND 0x03
461#define ISCSI_LOGIN_STATUS_TGT_REMOVED 0x04
462#define ISCSI_LOGIN_STATUS_NO_VERSION 0x05
463#define ISCSI_LOGIN_STATUS_ISID_ERROR 0x06
464#define ISCSI_LOGIN_STATUS_MISSING_FIELDS 0x07
465#define ISCSI_LOGIN_STATUS_CONN_ADD_FAILED 0x08
466#define ISCSI_LOGIN_STATUS_NO_SESSION_TYPE 0x09
467#define ISCSI_LOGIN_STATUS_NO_SESSION 0x0a
468#define ISCSI_LOGIN_STATUS_INVALID_REQUEST 0x0b
469
470/* Class-3 (Target Error) */
471#define ISCSI_LOGIN_STATUS_TARGET_ERROR 0x00
472#define ISCSI_LOGIN_STATUS_SVC_UNAVAILABLE 0x01
473#define ISCSI_LOGIN_STATUS_NO_RESOURCES 0x02
474
475/* Logout Header */
476struct iscsi_logout {
477 uint8_t opcode;
478 uint8_t flags;
479 uint8_t rsvd1[2];
480 uint8_t hlength;
481 uint8_t dlength[3];
482 uint8_t rsvd2[8];
483 __be32 itt; /* Initiator Task Tag */
484 __be16 cid;
485 uint8_t rsvd3[2];
486 __be32 cmdsn;
487 __be32 exp_statsn;
488 uint8_t rsvd4[16];
489};
490
491/* Logout PDU flags */
492#define ISCSI_FLAG_LOGOUT_REASON_MASK 0x7F
493
494/* logout reason_code values */
495
496#define ISCSI_LOGOUT_REASON_CLOSE_SESSION 0
497#define ISCSI_LOGOUT_REASON_CLOSE_CONNECTION 1
498#define ISCSI_LOGOUT_REASON_RECOVERY 2
499#define ISCSI_LOGOUT_REASON_AEN_REQUEST 3
500
501/* Logout Response Header */
502struct iscsi_logout_rsp {
503 uint8_t opcode;
504 uint8_t flags;
505 uint8_t response; /* see Logout response values below */
506 uint8_t rsvd2;
507 uint8_t hlength;
508 uint8_t dlength[3];
509 uint8_t rsvd3[8];
510 __be32 itt; /* Initiator Task Tag */
511 __be32 rsvd4;
512 __be32 statsn;
513 __be32 exp_cmdsn;
514 __be32 max_cmdsn;
515 __be32 rsvd5;
516 __be16 t2wait;
517 __be16 t2retain;
518 __be32 rsvd6;
519};
520
521/* logout response status values */
522
523#define ISCSI_LOGOUT_SUCCESS 0
524#define ISCSI_LOGOUT_CID_NOT_FOUND 1
525#define ISCSI_LOGOUT_RECOVERY_UNSUPPORTED 2
526#define ISCSI_LOGOUT_CLEANUP_FAILED 3
527
528/* SNACK Header */
529struct iscsi_snack {
530 uint8_t opcode;
531 uint8_t flags;
532 uint8_t rsvd2[14];
533 __be32 itt;
534 __be32 begrun;
535 __be32 runlength;
536 __be32 exp_statsn;
537 __be32 rsvd3;
538 __be32 exp_datasn;
539 uint8_t rsvd6[8];
540};
541
542/* SNACK PDU flags */
543#define ISCSI_FLAG_SNACK_TYPE_MASK 0x0F /* 4 bits */
544
545/* Reject Message Header */
546struct iscsi_reject {
547 uint8_t opcode;
548 uint8_t flags;
549 uint8_t reason;
550 uint8_t rsvd2;
551 uint8_t hlength;
552 uint8_t dlength[3];
553 uint8_t rsvd3[8];
554 __be32 ffffffff;
555 uint8_t rsvd4[4];
556 __be32 statsn;
557 __be32 exp_cmdsn;
558 __be32 max_cmdsn;
559 __be32 datasn;
560 uint8_t rsvd5[8];
561 /* Text - Rejected hdr */
562};
563
564/* Reason for Reject */
565#define ISCSI_REASON_CMD_BEFORE_LOGIN 1
566#define ISCSI_REASON_DATA_DIGEST_ERROR 2
567#define ISCSI_REASON_DATA_SNACK_REJECT 3
568#define ISCSI_REASON_PROTOCOL_ERROR 4
569#define ISCSI_REASON_CMD_NOT_SUPPORTED 5
570#define ISCSI_REASON_IMM_CMD_REJECT 6
571#define ISCSI_REASON_TASK_IN_PROGRESS 7
572#define ISCSI_REASON_INVALID_SNACK 8
573#define ISCSI_REASON_BOOKMARK_INVALID 9
574#define ISCSI_REASON_BOOKMARK_NO_RESOURCES 10
575#define ISCSI_REASON_NEGOTIATION_RESET 11
576
577/* Max. number of Key=Value pairs in a text message */
578#define MAX_KEY_VALUE_PAIRS 8192
579
580/* maximum length for text keys/values */
581#define KEY_MAXLEN 64
582#define VALUE_MAXLEN 255
583#define TARGET_NAME_MAXLEN VALUE_MAXLEN
584
585#define DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH 8192
586
587/************************* RFC 3720 End *****************************/
588
589#endif /* ISCSI_PROTO_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 7ece05666feb..85cfd88461c8 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -148,6 +148,12 @@ struct scsi_device {
148#define transport_class_to_sdev(class_dev) \ 148#define transport_class_to_sdev(class_dev) \
149 to_scsi_device(class_dev->dev) 149 to_scsi_device(class_dev->dev)
150 150
151#define sdev_printk(prefix, sdev, fmt, a...) \
152 dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
153
154#define scmd_printk(prefix, scmd, fmt, a...) \
155 dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a)
156
151/* 157/*
152 * scsi_target: representation of a scsi target, for now, this is only 158 * scsi_target: representation of a scsi target, for now, this is only
153 * used for single_lun devices. If no one has active IO to the target, 159 * used for single_lun devices. If no one has active IO to the target,
@@ -177,6 +183,9 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
177#define transport_class_to_starget(class_dev) \ 183#define transport_class_to_starget(class_dev) \
178 to_scsi_target(class_dev->dev) 184 to_scsi_target(class_dev->dev)
179 185
186#define starget_printk(prefix, starget, fmt, a...) \
187 dev_printk(prefix, &(starget)->dev, fmt, ##a)
188
180extern struct scsi_device *__scsi_add_device(struct Scsi_Host *, 189extern struct scsi_device *__scsi_add_device(struct Scsi_Host *,
181 uint, uint, uint, void *hostdata); 190 uint, uint, uint, void *hostdata);
182extern int scsi_add_device(struct Scsi_Host *host, uint channel, 191extern int scsi_add_device(struct Scsi_Host *host, uint channel,
@@ -266,6 +275,19 @@ extern int scsi_execute_req(struct scsi_device *sdev, const unsigned char *cmd,
266 int data_direction, void *buffer, unsigned bufflen, 275 int data_direction, void *buffer, unsigned bufflen,
267 struct scsi_sense_hdr *, int timeout, int retries); 276 struct scsi_sense_hdr *, int timeout, int retries);
268 277
278static inline unsigned int sdev_channel(struct scsi_device *sdev)
279{
280 return sdev->channel;
281}
282
283static inline unsigned int sdev_id(struct scsi_device *sdev)
284{
285 return sdev->id;
286}
287
288#define scmd_id(scmd) sdev_id((scmd)->device)
289#define scmd_channel(scmd) sdev_channel((scmd)->device)
290
269static inline int scsi_device_online(struct scsi_device *sdev) 291static inline int scsi_device_online(struct scsi_device *sdev)
270{ 292{
271 return sdev->sdev_state != SDEV_OFFLINE; 293 return sdev->sdev_state != SDEV_OFFLINE;
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 69313ba7505b..ecd53d7872d2 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -609,6 +609,10 @@ struct Scsi_Host {
609#define class_to_shost(d) \ 609#define class_to_shost(d) \
610 container_of(d, struct Scsi_Host, shost_classdev) 610 container_of(d, struct Scsi_Host, shost_classdev)
611 611
612#define shost_printk(prefix, shost, fmt, a...) \
613 dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
614
615
612int scsi_is_host_device(const struct device *); 616int scsi_is_host_device(const struct device *);
613 617
614static inline struct Scsi_Host *dev_to_shost(struct device *dev) 618static inline struct Scsi_Host *dev_to_shost(struct device *dev)
@@ -634,8 +638,6 @@ extern void scsi_flush_work(struct Scsi_Host *);
634extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int); 638extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
635extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *); 639extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *);
636extern void scsi_scan_host(struct Scsi_Host *); 640extern void scsi_scan_host(struct Scsi_Host *);
637extern void scsi_scan_single_target(struct Scsi_Host *, unsigned int,
638 unsigned int);
639extern void scsi_rescan_device(struct device *); 641extern void scsi_rescan_device(struct device *);
640extern void scsi_remove_host(struct Scsi_Host *); 642extern void scsi_remove_host(struct Scsi_Host *);
641extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); 643extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index c04405bead2d..fac547d32a98 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -29,6 +29,7 @@
29 29
30#include <linux/config.h> 30#include <linux/config.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <scsi/scsi.h>
32 33
33struct scsi_transport_template; 34struct scsi_transport_template;
34 35
@@ -385,6 +386,8 @@ struct fc_function_template {
385 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *); 386 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *);
386 void (*reset_fc_host_stats)(struct Scsi_Host *); 387 void (*reset_fc_host_stats)(struct Scsi_Host *);
387 388
389 int (*issue_fc_host_lip)(struct Scsi_Host *);
390
388 /* allocation lengths for host-specific data */ 391 /* allocation lengths for host-specific data */
389 u32 dd_fcrport_size; 392 u32 dd_fcrport_size;
390 393
@@ -428,6 +431,34 @@ struct fc_function_template {
428}; 431};
429 432
430 433
434/**
435 * fc_remote_port_chkready - called to validate the remote port state
436 * prior to initiating io to the port.
437 *
438 * Returns a scsi result code that can be returned by the LLDD.
439 *
440 * @rport: remote port to be checked
441 **/
442static inline int
443fc_remote_port_chkready(struct fc_rport *rport)
444{
445 int result;
446
447 switch (rport->port_state) {
448 case FC_PORTSTATE_ONLINE:
449 result = 0;
450 break;
451 case FC_PORTSTATE_BLOCKED:
452 result = DID_BUS_BUSY << 16;
453 break;
454 default:
455 result = DID_NO_CONNECT << 16;
456 break;
457 }
458 return result;
459}
460
461
431struct scsi_transport_template *fc_attach_transport( 462struct scsi_transport_template *fc_attach_transport(
432 struct fc_function_template *); 463 struct fc_function_template *);
433void fc_release_transport(struct scsi_transport_template *); 464void fc_release_transport(struct scsi_transport_template *);
@@ -436,8 +467,6 @@ struct fc_rport *fc_remote_port_add(struct Scsi_Host *shost,
436 int channel, struct fc_rport_identifiers *ids); 467 int channel, struct fc_rport_identifiers *ids);
437void fc_remote_port_delete(struct fc_rport *rport); 468void fc_remote_port_delete(struct fc_rport *rport);
438void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles); 469void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles);
439int fc_remote_port_block(struct fc_rport *rport);
440void fc_remote_port_unblock(struct fc_rport *rport);
441int scsi_is_fc_rport(const struct device *); 470int scsi_is_fc_rport(const struct device *);
442 471
443static inline u64 wwn_to_u64(u8 *wwn) 472static inline u64 wwn_to_u64(u8 *wwn)
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 1b26a6c0aa2a..f25041c386ec 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -1,8 +1,10 @@
1/* 1/*
2 * iSCSI transport class definitions 2 * iSCSI transport class definitions
3 * 3 *
4 * Copyright (C) IBM Corporation, 2004 4 * Copyright (C) IBM Corporation, 2004
5 * Copyright (C) Mike Christie, 2004 5 * Copyright (C) Mike Christie, 2004 - 2005
6 * Copyright (C) Dmitry Yusupov, 2004 - 2005
7 * Copyright (C) Alex Aizman, 2004 - 2005
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -21,158 +23,64 @@
21#ifndef SCSI_TRANSPORT_ISCSI_H 23#ifndef SCSI_TRANSPORT_ISCSI_H
22#define SCSI_TRANSPORT_ISCSI_H 24#define SCSI_TRANSPORT_ISCSI_H
23 25
24#include <linux/config.h> 26#include <scsi/iscsi_if.h>
25#include <linux/in6.h>
26#include <linux/in.h>
27
28struct scsi_transport_template;
29 27
30struct iscsi_class_session { 28/**
31 uint8_t isid[6]; 29 * struct iscsi_transport - iSCSI Transport template
32 uint16_t tsih; 30 *
33 int header_digest; /* 1 CRC32, 0 None */ 31 * @name: transport name
34 int data_digest; /* 1 CRC32, 0 None */ 32 * @caps: iSCSI Data-Path capabilities
35 uint16_t tpgt; 33 * @create_session: create new iSCSI session object
36 union { 34 * @destroy_session: destroy existing iSCSI session object
37 struct in6_addr sin6_addr; 35 * @create_conn: create new iSCSI connection
38 struct in_addr sin_addr; 36 * @bind_conn: associate this connection with existing iSCSI session
39 } u; 37 * and specified transport descriptor
40 sa_family_t addr_type; /* must be AF_INET or AF_INET6 */ 38 * @destroy_conn: destroy inactive iSCSI connection
41 uint16_t port; /* must be in network byte order */ 39 * @set_param: set iSCSI Data-Path operational parameter
42 int initial_r2t; /* 1 Yes, 0 No */ 40 * @start_conn: set connection to be operational
43 int immediate_data; /* 1 Yes, 0 No */ 41 * @stop_conn: suspend/recover/terminate connection
44 uint32_t max_recv_data_segment_len; 42 * @send_pdu: send iSCSI PDU, Login, Logout, NOP-Out, Reject, Text.
45 uint32_t max_burst_len; 43 *
46 uint32_t first_burst_len; 44 * Template API provided by iSCSI Transport
47 uint16_t def_time2wait; 45 */
48 uint16_t def_time2retain; 46struct iscsi_transport {
49 uint16_t max_outstanding_r2t; 47 struct module *owner;
50 int data_pdu_in_order; /* 1 Yes, 0 No */ 48 char *name;
51 int data_sequence_in_order; /* 1 Yes, 0 No */ 49 unsigned int caps;
52 int erl; 50 struct scsi_host_template *host_template;
51 int hostdata_size;
52 int max_lun;
53 unsigned int max_conn;
54 unsigned int max_cmd_len;
55 iscsi_sessionh_t (*create_session) (uint32_t initial_cmdsn,
56 struct Scsi_Host *shost);
57 void (*destroy_session) (iscsi_sessionh_t session);
58 iscsi_connh_t (*create_conn) (iscsi_sessionh_t session, uint32_t cid);
59 int (*bind_conn) (iscsi_sessionh_t session, iscsi_connh_t conn,
60 uint32_t transport_fd, int is_leading);
61 int (*start_conn) (iscsi_connh_t conn);
62 void (*stop_conn) (iscsi_connh_t conn, int flag);
63 void (*destroy_conn) (iscsi_connh_t conn);
64 int (*set_param) (iscsi_connh_t conn, enum iscsi_param param,
65 uint32_t value);
66 int (*get_param) (iscsi_connh_t conn, enum iscsi_param param,
67 uint32_t *value);
68 int (*send_pdu) (iscsi_connh_t conn, struct iscsi_hdr *hdr,
69 char *data, uint32_t data_size);
70 void (*get_stats) (iscsi_connh_t conn, struct iscsi_stats *stats);
53}; 71};
54 72
55/* 73/*
56 * accessor macros 74 * transport registration upcalls
57 */ 75 */
58#define iscsi_isid(x) \ 76extern int iscsi_register_transport(struct iscsi_transport *tt);
59 (((struct iscsi_class_session *)&(x)->starget_data)->isid) 77extern int iscsi_unregister_transport(struct iscsi_transport *tt);
60#define iscsi_tsih(x) \
61 (((struct iscsi_class_session *)&(x)->starget_data)->tsih)
62#define iscsi_header_digest(x) \
63 (((struct iscsi_class_session *)&(x)->starget_data)->header_digest)
64#define iscsi_data_digest(x) \
65 (((struct iscsi_class_session *)&(x)->starget_data)->data_digest)
66#define iscsi_port(x) \
67 (((struct iscsi_class_session *)&(x)->starget_data)->port)
68#define iscsi_addr_type(x) \
69 (((struct iscsi_class_session *)&(x)->starget_data)->addr_type)
70#define iscsi_sin_addr(x) \
71 (((struct iscsi_class_session *)&(x)->starget_data)->u.sin_addr)
72#define iscsi_sin6_addr(x) \
73 (((struct iscsi_class_session *)&(x)->starget_data)->u.sin6_addr)
74#define iscsi_tpgt(x) \
75 (((struct iscsi_class_session *)&(x)->starget_data)->tpgt)
76#define iscsi_initial_r2t(x) \
77 (((struct iscsi_class_session *)&(x)->starget_data)->initial_r2t)
78#define iscsi_immediate_data(x) \
79 (((struct iscsi_class_session *)&(x)->starget_data)->immediate_data)
80#define iscsi_max_recv_data_segment_len(x) \
81 (((struct iscsi_class_session *)&(x)->starget_data)->max_recv_data_segment_len)
82#define iscsi_max_burst_len(x) \
83 (((struct iscsi_class_session *)&(x)->starget_data)->max_burst_len)
84#define iscsi_first_burst_len(x) \
85 (((struct iscsi_class_session *)&(x)->starget_data)->first_burst_len)
86#define iscsi_def_time2wait(x) \
87 (((struct iscsi_class_session *)&(x)->starget_data)->def_time2wait)
88#define iscsi_def_time2retain(x) \
89 (((struct iscsi_class_session *)&(x)->starget_data)->def_time2retain)
90#define iscsi_max_outstanding_r2t(x) \
91 (((struct iscsi_class_session *)&(x)->starget_data)->max_outstanding_r2t)
92#define iscsi_data_pdu_in_order(x) \
93 (((struct iscsi_class_session *)&(x)->starget_data)->data_pdu_in_order)
94#define iscsi_data_sequence_in_order(x) \
95 (((struct iscsi_class_session *)&(x)->starget_data)->data_sequence_in_order)
96#define iscsi_erl(x) \
97 (((struct iscsi_class_session *)&(x)->starget_data)->erl)
98 78
99/* 79/*
100 * The functions by which the transport class and the driver communicate 80 * control plane upcalls
101 */ 81 */
102struct iscsi_function_template { 82extern void iscsi_conn_error(iscsi_connh_t conn, enum iscsi_err error);
103 /* 83extern int iscsi_recv_pdu(iscsi_connh_t conn, struct iscsi_hdr *hdr,
104 * target attrs 84 char *data, uint32_t data_size);
105 */
106 void (*get_isid)(struct scsi_target *);
107 void (*get_tsih)(struct scsi_target *);
108 void (*get_header_digest)(struct scsi_target *);
109 void (*get_data_digest)(struct scsi_target *);
110 void (*get_port)(struct scsi_target *);
111 void (*get_tpgt)(struct scsi_target *);
112 /*
113 * In get_ip_address the lld must set the address and
114 * the address type
115 */
116 void (*get_ip_address)(struct scsi_target *);
117 /*
118 * The lld should snprintf the name or alias to the buffer
119 */
120 ssize_t (*get_target_name)(struct scsi_target *, char *, ssize_t);
121 ssize_t (*get_target_alias)(struct scsi_target *, char *, ssize_t);
122 void (*get_initial_r2t)(struct scsi_target *);
123 void (*get_immediate_data)(struct scsi_target *);
124 void (*get_max_recv_data_segment_len)(struct scsi_target *);
125 void (*get_max_burst_len)(struct scsi_target *);
126 void (*get_first_burst_len)(struct scsi_target *);
127 void (*get_def_time2wait)(struct scsi_target *);
128 void (*get_def_time2retain)(struct scsi_target *);
129 void (*get_max_outstanding_r2t)(struct scsi_target *);
130 void (*get_data_pdu_in_order)(struct scsi_target *);
131 void (*get_data_sequence_in_order)(struct scsi_target *);
132 void (*get_erl)(struct scsi_target *);
133
134 /*
135 * host atts
136 */
137
138 /*
139 * The lld should snprintf the name or alias to the buffer
140 */
141 ssize_t (*get_initiator_alias)(struct Scsi_Host *, char *, ssize_t);
142 ssize_t (*get_initiator_name)(struct Scsi_Host *, char *, ssize_t);
143 /*
144 * The driver sets these to tell the transport class it
145 * wants the attributes displayed in sysfs. If the show_ flag
146 * is not set, the attribute will be private to the transport
147 * class. We could probably just test if a get_ fn was set
148 * since we only use the values for sysfs but this is how
149 * fc does it too.
150 */
151 unsigned long show_isid:1;
152 unsigned long show_tsih:1;
153 unsigned long show_header_digest:1;
154 unsigned long show_data_digest:1;
155 unsigned long show_port:1;
156 unsigned long show_tpgt:1;
157 unsigned long show_ip_address:1;
158 unsigned long show_target_name:1;
159 unsigned long show_target_alias:1;
160 unsigned long show_initial_r2t:1;
161 unsigned long show_immediate_data:1;
162 unsigned long show_max_recv_data_segment_len:1;
163 unsigned long show_max_burst_len:1;
164 unsigned long show_first_burst_len:1;
165 unsigned long show_def_time2wait:1;
166 unsigned long show_def_time2retain:1;
167 unsigned long show_max_outstanding_r2t:1;
168 unsigned long show_data_pdu_in_order:1;
169 unsigned long show_data_sequence_in_order:1;
170 unsigned long show_erl:1;
171 unsigned long show_initiator_name:1;
172 unsigned long show_initiator_alias:1;
173};
174
175struct scsi_transport_template *iscsi_attach_transport(struct iscsi_function_template *);
176void iscsi_release_transport(struct scsi_transport_template *);
177 85
178#endif 86#endif
diff --git a/include/scsi/scsi_transport_sas.h b/include/scsi/scsi_transport_sas.h
index bc4aeb660dd3..b91400bfb02a 100644
--- a/include/scsi/scsi_transport_sas.h
+++ b/include/scsi/scsi_transport_sas.h
@@ -41,20 +41,31 @@ struct sas_identify {
41 u8 phy_identifier; 41 u8 phy_identifier;
42}; 42};
43 43
44/* The functions by which the transport class and the driver communicate */
45struct sas_function_template {
46};
47
48struct sas_phy { 44struct sas_phy {
49 struct device dev; 45 struct device dev;
50 int number; 46 int number;
47
48 /* phy identification */
51 struct sas_identify identify; 49 struct sas_identify identify;
50
51 /* phy attributes */
52 enum sas_linkrate negotiated_linkrate; 52 enum sas_linkrate negotiated_linkrate;
53 enum sas_linkrate minimum_linkrate_hw; 53 enum sas_linkrate minimum_linkrate_hw;
54 enum sas_linkrate minimum_linkrate; 54 enum sas_linkrate minimum_linkrate;
55 enum sas_linkrate maximum_linkrate_hw; 55 enum sas_linkrate maximum_linkrate_hw;
56 enum sas_linkrate maximum_linkrate; 56 enum sas_linkrate maximum_linkrate;
57 u8 port_identifier; 57 u8 port_identifier;
58
59 /* internal state */
60 unsigned int local_attached : 1;
61
62 /* link error statistics */
63 u32 invalid_dword_count;
64 u32 running_disparity_error_count;
65 u32 loss_of_dword_sync_count;
66 u32 phy_reset_problem_count;
67
68 /* the other end of the link */
58 struct sas_rphy *rphy; 69 struct sas_rphy *rphy;
59}; 70};
60 71
@@ -79,6 +90,14 @@ struct sas_rphy {
79#define rphy_to_shost(rphy) \ 90#define rphy_to_shost(rphy) \
80 dev_to_shost((rphy)->dev.parent) 91 dev_to_shost((rphy)->dev.parent)
81 92
93
94/* The functions by which the transport class and the driver communicate */
95struct sas_function_template {
96 int (*get_linkerrors)(struct sas_phy *);
97 int (*phy_reset)(struct sas_phy *, int);
98};
99
100
82extern void sas_remove_host(struct Scsi_Host *); 101extern void sas_remove_host(struct Scsi_Host *);
83 102
84extern struct sas_phy *sas_phy_alloc(struct device *, int); 103extern struct sas_phy *sas_phy_alloc(struct device *, int);
diff --git a/include/scsi/srp.h b/include/scsi/srp.h
new file mode 100644
index 000000000000..6c2681dc5b46
--- /dev/null
+++ b/include/scsi/srp.h
@@ -0,0 +1,226 @@
1/*
2 * Copyright (c) 2005 Cisco Systems. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 *
32 * $Id$
33 */
34
35#ifndef SCSI_SRP_H
36#define SCSI_SRP_H
37
38/*
39 * Structures and constants for the SCSI RDMA Protocol (SRP) as
40 * defined by the INCITS T10 committee. This file was written using
41 * draft Revision 16a of the SRP standard.
42 */
43
44#include <linux/types.h>
45
46enum {
47 SRP_LOGIN_REQ = 0x00,
48 SRP_TSK_MGMT = 0x01,
49 SRP_CMD = 0x02,
50 SRP_I_LOGOUT = 0x03,
51 SRP_LOGIN_RSP = 0xc0,
52 SRP_RSP = 0xc1,
53 SRP_LOGIN_REJ = 0xc2,
54 SRP_T_LOGOUT = 0x80,
55 SRP_CRED_REQ = 0x81,
56 SRP_AER_REQ = 0x82,
57 SRP_CRED_RSP = 0x41,
58 SRP_AER_RSP = 0x42
59};
60
61enum {
62 SRP_BUF_FORMAT_DIRECT = 1 << 1,
63 SRP_BUF_FORMAT_INDIRECT = 1 << 2
64};
65
66enum {
67 SRP_NO_DATA_DESC = 0,
68 SRP_DATA_DESC_DIRECT = 1,
69 SRP_DATA_DESC_INDIRECT = 2
70};
71
72enum {
73 SRP_TSK_ABORT_TASK = 0x01,
74 SRP_TSK_ABORT_TASK_SET = 0x02,
75 SRP_TSK_CLEAR_TASK_SET = 0x04,
76 SRP_TSK_LUN_RESET = 0x08,
77 SRP_TSK_CLEAR_ACA = 0x40
78};
79
80enum srp_login_rej_reason {
81 SRP_LOGIN_REJ_UNABLE_ESTABLISH_CHANNEL = 0x00010000,
82 SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES = 0x00010001,
83 SRP_LOGIN_REJ_REQ_IT_IU_LENGTH_TOO_LARGE = 0x00010002,
84 SRP_LOGIN_REJ_UNABLE_ASSOCIATE_CHANNEL = 0x00010003,
85 SRP_LOGIN_REJ_UNSUPPORTED_DESCRIPTOR_FMT = 0x00010004,
86 SRP_LOGIN_REJ_MULTI_CHANNEL_UNSUPPORTED = 0x00010005,
87 SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED = 0x00010006
88};
89
90struct srp_direct_buf {
91 __be64 va;
92 __be32 key;
93 __be32 len;
94};
95
96/*
97 * We need the packed attribute because the SRP spec puts the list of
98 * descriptors at an offset of 20, which is not aligned to the size
99 * of struct srp_direct_buf.
100 */
101struct srp_indirect_buf {
102 struct srp_direct_buf table_desc;
103 __be32 len;
104 struct srp_direct_buf desc_list[0] __attribute__((packed));
105};
106
107enum {
108 SRP_MULTICHAN_SINGLE = 0,
109 SRP_MULTICHAN_MULTI = 1
110};
111
112struct srp_login_req {
113 u8 opcode;
114 u8 reserved1[7];
115 u64 tag;
116 __be32 req_it_iu_len;
117 u8 reserved2[4];
118 __be16 req_buf_fmt;
119 u8 req_flags;
120 u8 reserved3[5];
121 u8 initiator_port_id[16];
122 u8 target_port_id[16];
123};
124
125struct srp_login_rsp {
126 u8 opcode;
127 u8 reserved1[3];
128 __be32 req_lim_delta;
129 u64 tag;
130 __be32 max_it_iu_len;
131 __be32 max_ti_iu_len;
132 __be16 buf_fmt;
133 u8 rsp_flags;
134 u8 reserved2[25];
135};
136
137struct srp_login_rej {
138 u8 opcode;
139 u8 reserved1[3];
140 __be32 reason;
141 u64 tag;
142 u8 reserved2[8];
143 __be16 buf_fmt;
144 u8 reserved3[6];
145};
146
147struct srp_i_logout {
148 u8 opcode;
149 u8 reserved[7];
150 u64 tag;
151};
152
153struct srp_t_logout {
154 u8 opcode;
155 u8 sol_not;
156 u8 reserved[2];
157 __be32 reason;
158 u64 tag;
159};
160
161/*
162 * We need the packed attribute because the SRP spec only aligns the
163 * 8-byte LUN field to 4 bytes.
164 */
165struct srp_tsk_mgmt {
166 u8 opcode;
167 u8 sol_not;
168 u8 reserved1[6];
169 u64 tag;
170 u8 reserved2[4];
171 __be64 lun __attribute__((packed));
172 u8 reserved3[2];
173 u8 tsk_mgmt_func;
174 u8 reserved4;
175 u64 task_tag;
176 u8 reserved5[8];
177};
178
179/*
180 * We need the packed attribute because the SRP spec only aligns the
181 * 8-byte LUN field to 4 bytes.
182 */
183struct srp_cmd {
184 u8 opcode;
185 u8 sol_not;
186 u8 reserved1[3];
187 u8 buf_fmt;
188 u8 data_out_desc_cnt;
189 u8 data_in_desc_cnt;
190 u64 tag;
191 u8 reserved2[4];
192 __be64 lun __attribute__((packed));
193 u8 reserved3;
194 u8 task_attr;
195 u8 reserved4;
196 u8 add_cdb_len;
197 u8 cdb[16];
198 u8 add_data[0];
199};
200
201enum {
202 SRP_RSP_FLAG_RSPVALID = 1 << 0,
203 SRP_RSP_FLAG_SNSVALID = 1 << 1,
204 SRP_RSP_FLAG_DOOVER = 1 << 2,
205 SRP_RSP_FLAG_DOUNDER = 1 << 3,
206 SRP_RSP_FLAG_DIOVER = 1 << 4,
207 SRP_RSP_FLAG_DIUNDER = 1 << 5
208};
209
210struct srp_rsp {
211 u8 opcode;
212 u8 sol_not;
213 u8 reserved1[2];
214 __be32 req_lim_delta;
215 u64 tag;
216 u8 reserved2[2];
217 u8 flags;
218 u8 status;
219 __be32 data_out_res_cnt;
220 __be32 data_in_res_cnt;
221 __be32 sense_data_len;
222 __be32 resp_data_len;
223 u8 data[0];
224};
225
226#endif /* SCSI_SRP_H */
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index d11f34832a97..7f0ca79d6c98 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -387,15 +387,6 @@
387#define AC97_RATES_MIC_ADC 4 387#define AC97_RATES_MIC_ADC 4
388#define AC97_RATES_SPDIF 5 388#define AC97_RATES_SPDIF 5
389 389
390/* shared controllers */
391enum {
392 AC97_SHARED_TYPE_NONE,
393 AC97_SHARED_TYPE_ICH,
394 AC97_SHARED_TYPE_ATIIXP,
395 AC97_SHARED_TYPE_VIA,
396 AC97_SHARED_TYPES
397};
398
399/* 390/*
400 * 391 *
401 */ 392 */
@@ -468,7 +459,6 @@ struct _snd_ac97_bus {
468 unsigned short used_slots[2][4]; /* actually used PCM slots */ 459 unsigned short used_slots[2][4]; /* actually used PCM slots */
469 unsigned short pcms_count; /* count of PCMs */ 460 unsigned short pcms_count; /* count of PCMs */
470 struct ac97_pcm *pcms; 461 struct ac97_pcm *pcms;
471 unsigned int shared_type; /* type of shared controller betwen audio and modem */
472 ac97_t *codec[4]; 462 ac97_t *codec[4];
473 snd_info_entry_t *proc; 463 snd_info_entry_t *proc;
474}; 464};
diff --git a/include/sound/core.h b/include/sound/core.h
index 6d971a4c4ca0..2be65ad2fd83 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -29,7 +29,6 @@
29#include <linux/pm.h> /* pm_message_t */ 29#include <linux/pm.h> /* pm_message_t */
30 30
31/* Typedef's */ 31/* Typedef's */
32typedef struct timespec snd_timestamp_t;
33typedef struct sndrv_interval snd_interval_t; 32typedef struct sndrv_interval snd_interval_t;
34typedef enum sndrv_card_type snd_card_type; 33typedef enum sndrv_card_type snd_card_type;
35typedef struct sndrv_xferi snd_xferi_t; 34typedef struct sndrv_xferi snd_xferi_t;
@@ -256,6 +255,7 @@ typedef struct _snd_minor snd_minor_t;
256 255
257/* sound.c */ 256/* sound.c */
258 257
258extern int snd_major;
259extern int snd_ecards_limit; 259extern int snd_ecards_limit;
260 260
261void snd_request_card(int card); 261void snd_request_card(int card);
@@ -285,39 +285,6 @@ int snd_oss_init_module(void);
285 285
286/* memory.c */ 286/* memory.c */
287 287
288#ifdef CONFIG_SND_DEBUG_MEMORY
289void snd_memory_init(void);
290void snd_memory_done(void);
291int snd_memory_info_init(void);
292int snd_memory_info_done(void);
293void *snd_hidden_kmalloc(size_t size, gfp_t flags);
294void *snd_hidden_kzalloc(size_t size, gfp_t flags);
295void *snd_hidden_kcalloc(size_t n, size_t size, gfp_t flags);
296void snd_hidden_kfree(const void *obj);
297void *snd_hidden_vmalloc(unsigned long size);
298void snd_hidden_vfree(void *obj);
299char *snd_hidden_kstrdup(const char *s, gfp_t flags);
300#define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
301#define kzalloc(size, flags) snd_hidden_kzalloc(size, flags)
302#define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
303#define kfree(obj) snd_hidden_kfree(obj)
304#define vmalloc(size) snd_hidden_vmalloc(size)
305#define vfree(obj) snd_hidden_vfree(obj)
306#define kmalloc_nocheck(size, flags) snd_wrapper_kmalloc(size, flags)
307#define vmalloc_nocheck(size) snd_wrapper_vmalloc(size)
308#define kfree_nocheck(obj) snd_wrapper_kfree(obj)
309#define vfree_nocheck(obj) snd_wrapper_vfree(obj)
310#define kstrdup(s, flags) snd_hidden_kstrdup(s, flags)
311#else
312#define snd_memory_init() /*NOP*/
313#define snd_memory_done() /*NOP*/
314#define snd_memory_info_init() /*NOP*/
315#define snd_memory_info_done() /*NOP*/
316#define kmalloc_nocheck(size, flags) kmalloc(size, flags)
317#define vmalloc_nocheck(size) vmalloc(size)
318#define kfree_nocheck(obj) kfree(obj)
319#define vfree_nocheck(obj) vfree(obj)
320#endif
321int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count); 288int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count);
322int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count); 289int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count);
323 290
@@ -373,8 +340,9 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size);
373#endif 340#endif
374 341
375/* misc.c */ 342/* misc.c */
343struct resource;
344void release_and_free_resource(struct resource *res);
376 345
377int snd_task_name(struct task_struct *task, char *name, size_t size);
378#ifdef CONFIG_SND_VERBOSE_PRINTK 346#ifdef CONFIG_SND_VERBOSE_PRINTK
379void snd_verbose_printk(const char *file, int line, const char *format, ...) 347void snd_verbose_printk(const char *file, int line, const char *format, ...)
380 __attribute__ ((format (printf, 3, 4))); 348 __attribute__ ((format (printf, 3, 4)));
@@ -429,34 +397,24 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
429 * When CONFIG_SND_DEBUG is not set, the expression is executed but 397 * When CONFIG_SND_DEBUG is not set, the expression is executed but
430 * not checked. 398 * not checked.
431 */ 399 */
432#define snd_assert(expr, args...) do {\ 400#define snd_assert(expr, args...) do { \
433 if (unlikely(!(expr))) { \ 401 if (unlikely(!(expr))) { \
434 snd_printk(KERN_ERR "BUG? (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\ 402 snd_printk(KERN_ERR "BUG? (%s)\n", __ASTRING__(expr)); \
435 args;\ 403 dump_stack(); \
436 }\ 404 args; \
405 } \
437} while (0) 406} while (0)
438/** 407
439 * snd_runtime_check - run-time assertion macro 408#define snd_BUG() do { \
440 * @expr: expression 409 snd_printk(KERN_ERR "BUG?\n"); \
441 * @args...: the action 410 dump_stack(); \
442 *
443 * This macro checks the expression in run-time and invokes the commands
444 * given in the rest arguments if the assertion is failed.
445 * Unlike snd_assert(), the action commands are executed even if
446 * CONFIG_SND_DEBUG is not set but without any error messages.
447 */
448#define snd_runtime_check(expr, args...) do {\
449 if (unlikely(!(expr))) { \
450 snd_printk(KERN_ERR "ERROR (%s) (called from %p)\n", __ASTRING__(expr), __builtin_return_address(0));\
451 args;\
452 }\
453} while (0) 411} while (0)
454 412
455#else /* !CONFIG_SND_DEBUG */ 413#else /* !CONFIG_SND_DEBUG */
456 414
457#define snd_printd(fmt, args...) /* nothing */ 415#define snd_printd(fmt, args...) /* nothing */
458#define snd_assert(expr, args...) (void)(expr) 416#define snd_assert(expr, args...) (void)(expr)
459#define snd_runtime_check(expr, args...) do { if (!(expr)) { args; } } while (0) 417#define snd_BUG() /* nothing */
460 418
461#endif /* CONFIG_SND_DEBUG */ 419#endif /* CONFIG_SND_DEBUG */
462 420
@@ -473,30 +431,6 @@ void snd_verbose_printd(const char *file, int line, const char *format, ...)
473#define snd_printdd(format, args...) /* nothing */ 431#define snd_printdd(format, args...) /* nothing */
474#endif 432#endif
475 433
476#define snd_BUG() snd_assert(0, )
477
478
479static inline void snd_timestamp_now(struct timespec *tstamp, int timespec)
480{
481 struct timeval val;
482 /* FIXME: use a linear time source */
483 do_gettimeofday(&val);
484 tstamp->tv_sec = val.tv_sec;
485 tstamp->tv_nsec = val.tv_usec;
486 if (timespec)
487 tstamp->tv_nsec *= 1000L;
488}
489
490static inline void snd_timestamp_zero(struct timespec *tstamp)
491{
492 tstamp->tv_sec = 0;
493 tstamp->tv_nsec = 0;
494}
495
496static inline int snd_timestamp_null(struct timespec *tstamp)
497{
498 return tstamp->tv_sec == 0 && tstamp->tv_nsec == 0;
499}
500 434
501#define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */ 435#define SNDRV_OSS_VERSION ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */
502 436
diff --git a/include/sound/driver.h b/include/sound/driver.h
index 1ec2fae050a6..3f0416ac24d9 100644
--- a/include/sound/driver.h
+++ b/include/sound/driver.h
@@ -44,21 +44,4 @@
44 44
45#include <linux/module.h> 45#include <linux/module.h>
46 46
47/*
48 * ==========================================================================
49 */
50
51#ifdef CONFIG_SND_DEBUG_MEMORY
52#include <linux/slab.h>
53#include <linux/vmalloc.h>
54void *snd_wrapper_kmalloc(size_t, gfp_t);
55#undef kmalloc
56void snd_wrapper_kfree(const void *);
57#undef kfree
58void *snd_wrapper_vmalloc(size_t);
59#undef vmalloc
60void snd_wrapper_vfree(void *);
61#undef vfree
62#endif
63
64#endif /* __SOUND_DRIVER_H */ 47#endif /* __SOUND_DRIVER_H */
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 46e3c0bf3c94..8411c7ef6f11 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -48,7 +48,8 @@
48 48
49/* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */ 49/* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */
50#define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */ 50#define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */
51#define AUDIGY_DMA_MASK 0xffffffffUL /* 32bit */ 51#define AUDIGY_DMA_MASK 0x7fffffffUL /* 31bit FIXME - 32 should work? */
52 /* See ALSA bug #1276 - rlrevell */
52 53
53#define TMEMSIZE 256*1024 54#define TMEMSIZE 256*1024
54#define TMEMSIZEREG 4 55#define TMEMSIZEREG 4
diff --git a/include/sound/minors.h b/include/sound/minors.h
index b7b0d8309449..a17b5c9961bb 100644
--- a/include/sound/minors.h
+++ b/include/sound/minors.h
@@ -27,8 +27,9 @@
27#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev)) 27#define SNDRV_MINOR(card, dev) (((card) << 5) | (dev))
28 28
29#define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */ 29#define SNDRV_MINOR_CONTROL 0 /* 0 - 0 */
30#define SNDRV_MINOR_SEQUENCER 1 30#define SNDRV_MINOR_GLOBAL 1 /* 1 */
31#define SNDRV_MINOR_TIMER (1+32) 31#define SNDRV_MINOR_SEQUENCER (SNDRV_MINOR_GLOBAL + 0 * 32)
32#define SNDRV_MINOR_TIMER (SNDRV_MINOR_GLOBAL + 1 * 32)
32#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ 33#define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */
33#define SNDRV_MINOR_HWDEPS 4 34#define SNDRV_MINOR_HWDEPS 4
34#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ 35#define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */
@@ -39,12 +40,9 @@
39 40
40#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL 41#define SNDRV_DEVICE_TYPE_CONTROL SNDRV_MINOR_CONTROL
41#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP 42#define SNDRV_DEVICE_TYPE_HWDEP SNDRV_MINOR_HWDEP
42#define SNDRV_DEVICE_TYPE_MIXER SNDRV_MINOR_MIXER
43#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI 43#define SNDRV_DEVICE_TYPE_RAWMIDI SNDRV_MINOR_RAWMIDI
44#define SNDRV_DEVICE_TYPE_PCM_PLAYBACK SNDRV_MINOR_PCM_PLAYBACK 44#define SNDRV_DEVICE_TYPE_PCM_PLAYBACK SNDRV_MINOR_PCM_PLAYBACK
45#define SNDRV_DEVICE_TYPE_PCM_PLOOP SNDRV_MINOR_PCM_PLOOP
46#define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE 45#define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE
47#define SNDRV_DEVICE_TYPE_PCM_CLOOP SNDRV_MINOR_PCM_CLOOP
48#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER 46#define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER
49#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER 47#define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER
50 48
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 2b23a5967071..acc4fa9d5abe 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -281,7 +281,7 @@ typedef struct {
281struct _snd_pcm_runtime { 281struct _snd_pcm_runtime {
282 /* -- Status -- */ 282 /* -- Status -- */
283 snd_pcm_substream_t *trigger_master; 283 snd_pcm_substream_t *trigger_master;
284 snd_timestamp_t trigger_tstamp; /* trigger timestamp */ 284 struct timespec trigger_tstamp; /* trigger timestamp */
285 int overrange; 285 int overrange;
286 snd_pcm_uframes_t avail_max; 286 snd_pcm_uframes_t avail_max;
287 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ 287 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
@@ -306,7 +306,6 @@ struct _snd_pcm_runtime {
306 unsigned int rate_den; 306 unsigned int rate_den;
307 307
308 /* -- SW params -- */ 308 /* -- SW params -- */
309 int tstamp_timespec; /* use timeval (0) or timespec (1) */
310 snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */ 309 snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */
311 unsigned int period_step; 310 unsigned int period_step;
312 unsigned int sleep_min; /* min ticks to sleep */ 311 unsigned int sleep_min; /* min ticks to sleep */
diff --git a/include/sound/timer.h b/include/sound/timer.h
index 1898511a0f38..b55f38ae56e1 100644
--- a/include/sound/timer.h
+++ b/include/sound/timer.h
@@ -88,6 +88,7 @@ struct _snd_timer_hardware {
88struct _snd_timer { 88struct _snd_timer {
89 snd_timer_class_t tmr_class; 89 snd_timer_class_t tmr_class;
90 snd_card_t *card; 90 snd_card_t *card;
91 struct module *module;
91 int tmr_device; 92 int tmr_device;
92 int tmr_subdevice; 93 int tmr_subdevice;
93 char id[64]; 94 char id[64];
diff --git a/include/sound/version.h b/include/sound/version.h
index ee32af20dba9..d1bd3b723967 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.10rc1" 2#define CONFIG_SND_VERSION "1.0.10rc3"
3#define CONFIG_SND_DATE " (Mon Sep 12 08:13:09 2005 UTC)" 3#define CONFIG_SND_DATE " (Mon Nov 07 13:30:21 2005 UTC)"