summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-10-09 00:00:47 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-10-09 00:00:47 +0000
commitd6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch)
treee2be02f33984c48ec019c654051d27964e42c441 /include
parent609d1e803baf519487233b765eb487f9ec227a18 (diff)
Merge with 2.3.19.
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/cache.h2
-rw-r--r--include/asm-alpha/compiler.h15
-rw-r--r--include/asm-alpha/core_apecs.h73
-rw-r--r--include/asm-alpha/core_cia.h303
-rw-r--r--include/asm-alpha/core_lca.h49
-rw-r--r--include/asm-alpha/core_mcpcia.h533
-rw-r--r--include/asm-alpha/core_polaris.h119
-rw-r--r--include/asm-alpha/core_pyxis.h466
-rw-r--r--include/asm-alpha/core_t2.h271
-rw-r--r--include/asm-alpha/core_tsunami.h160
-rw-r--r--include/asm-alpha/delay.h10
-rw-r--r--include/asm-alpha/dma.h5
-rw-r--r--include/asm-alpha/hardirq.h29
-rw-r--r--include/asm-alpha/ide.h6
-rw-r--r--include/asm-alpha/init.h20
-rw-r--r--include/asm-alpha/io.h99
-rw-r--r--include/asm-alpha/jensen.h13
-rw-r--r--include/asm-alpha/machvec.h49
-rw-r--r--include/asm-alpha/mmu_context.h157
-rw-r--r--include/asm-alpha/page.h9
-rw-r--r--include/asm-alpha/param.h12
-rw-r--r--include/asm-alpha/parport.h59
-rw-r--r--include/asm-alpha/pci.h55
-rw-r--r--include/asm-alpha/pgtable.h32
-rw-r--r--include/asm-alpha/processor.h34
-rw-r--r--include/asm-alpha/ptrace.h2
-rw-r--r--include/asm-alpha/resource.h6
-rw-r--r--include/asm-alpha/serial.h3
-rw-r--r--include/asm-alpha/smp.h40
-rw-r--r--include/asm-alpha/smplock.h2
-rw-r--r--include/asm-alpha/softirq.h15
-rw-r--r--include/asm-alpha/spinlock.h101
-rw-r--r--include/asm-alpha/string.h1
-rw-r--r--include/asm-alpha/system.h12
-rw-r--r--include/asm-alpha/uaccess.h4
-rw-r--r--include/asm-alpha/unistd.h49
-rw-r--r--include/asm-alpha/vga.h28
-rw-r--r--include/asm-arm/arch-arc/ide.h7
-rw-r--r--include/asm-arm/arch-arc/system.h2
-rw-r--r--include/asm-arm/arch-arc/time.h3
-rw-r--r--include/asm-arm/arch-ebsa110/hardware.h2
-rw-r--r--include/asm-arm/arch-ebsa285/io.h180
-rw-r--r--include/asm-arm/arch-ebsa285/irq.h8
-rw-r--r--include/asm-arm/arch-ebsa285/time.h30
-rw-r--r--include/asm-arm/arch-rpc/system.h2
-rw-r--r--include/asm-arm/arch-rpc/time.h5
-rw-r--r--include/asm-arm/atomic.h13
-rw-r--r--include/asm-arm/bugs.h2
-rw-r--r--include/asm-arm/cache.h8
-rw-r--r--include/asm-arm/cpu-multi26.h68
-rw-r--r--include/asm-arm/cpu-multi32.h117
-rw-r--r--include/asm-arm/cpu-single.h61
-rw-r--r--include/asm-arm/dec21285.h6
-rw-r--r--include/asm-arm/dma.h4
-rw-r--r--include/asm-arm/elf.h3
-rw-r--r--include/asm-arm/hardirq.h2
-rw-r--r--include/asm-arm/init.h4
-rw-r--r--include/asm-arm/io.h29
-rw-r--r--include/asm-arm/iomd.h46
-rw-r--r--include/asm-arm/mmu_context.h28
-rw-r--r--include/asm-arm/page.h13
-rw-r--r--include/asm-arm/parport.h59
-rw-r--r--include/asm-arm/pgtable.h2
-rw-r--r--include/asm-arm/proc-armo/processor.h6
-rw-r--r--include/asm-arm/proc-armo/system.h10
-rw-r--r--include/asm-arm/proc-armv/domain.h46
-rw-r--r--include/asm-arm/proc-armv/io.h12
-rw-r--r--include/asm-arm/proc-armv/pgtable.h204
-rw-r--r--include/asm-arm/proc-armv/processor.h20
-rw-r--r--include/asm-arm/proc-armv/system.h2
-rw-r--r--include/asm-arm/proc-armv/uaccess.h33
-rw-r--r--include/asm-arm/proc-fns.h160
-rw-r--r--include/asm-arm/processor.h37
-rw-r--r--include/asm-arm/procinfo.h47
-rw-r--r--include/asm-arm/resource.h4
-rw-r--r--include/asm-arm/semaphore.h7
-rw-r--r--include/asm-arm/smplock.h2
-rw-r--r--include/asm-arm/spinlock.h112
-rw-r--r--include/asm-arm/string.h1
-rw-r--r--include/asm-arm/system.h13
-rw-r--r--include/asm-arm/termios.h3
-rw-r--r--include/asm-arm/unistd.h49
-rw-r--r--include/asm-generic/smplock.h2
-rw-r--r--include/asm-i386/apic.h (renamed from include/asm-i386/i82489.h)18
-rw-r--r--include/asm-i386/atomic.h11
-rw-r--r--include/asm-i386/bigmem.h69
-rw-r--r--include/asm-i386/bugs.h43
-rw-r--r--include/asm-i386/cache.h8
-rw-r--r--include/asm-i386/desc.h104
-rw-r--r--include/asm-i386/dma.h5
-rw-r--r--include/asm-i386/e820.h39
-rw-r--r--include/asm-i386/fixmap.h14
-rw-r--r--include/asm-i386/hardirq.h4
-rw-r--r--include/asm-i386/hw_irq.h223
-rw-r--r--include/asm-i386/ide.h8
-rw-r--r--include/asm-i386/init.h18
-rw-r--r--include/asm-i386/io.h16
-rw-r--r--include/asm-i386/kmap_types.h10
-rw-r--r--include/asm-i386/ldt.h2
-rw-r--r--include/asm-i386/mmu_context.h30
-rw-r--r--include/asm-i386/page.h1
-rw-r--r--include/asm-i386/parport.h59
-rw-r--r--include/asm-i386/pci.h11
-rw-r--r--include/asm-i386/pgtable.h113
-rw-r--r--include/asm-i386/processor.h120
-rw-r--r--include/asm-i386/resource.h4
-rw-r--r--include/asm-i386/semaphore.h43
-rw-r--r--include/asm-i386/serial.h3
-rw-r--r--include/asm-i386/signal.h6
-rw-r--r--include/asm-i386/smp.h14
-rw-r--r--include/asm-i386/smplock.h2
-rw-r--r--include/asm-i386/softirq.h56
-rw-r--r--include/asm-i386/spinlock.h121
-rw-r--r--include/asm-i386/system.h28
-rw-r--r--include/asm-i386/uaccess.h2
-rw-r--r--include/asm-i386/unistd.h3
-rw-r--r--include/asm-m68k/cache.h8
-rw-r--r--include/asm-m68k/dvma.h19
-rw-r--r--include/asm-m68k/elf.h8
-rw-r--r--include/asm-m68k/entry.h5
-rw-r--r--include/asm-m68k/fpu.h2
-rw-r--r--include/asm-m68k/hardirq.h2
-rw-r--r--include/asm-m68k/hwtest.h2
-rw-r--r--include/asm-m68k/ide.h18
-rw-r--r--include/asm-m68k/init.h8
-rw-r--r--include/asm-m68k/intersil.h48
-rw-r--r--include/asm-m68k/io.h4
-rw-r--r--include/asm-m68k/irq.h9
-rw-r--r--include/asm-m68k/mac_iop.h162
-rw-r--r--include/asm-m68k/mac_oss.h94
-rw-r--r--include/asm-m68k/mac_psc.h242
-rw-r--r--include/asm-m68k/mac_via.h267
-rw-r--r--include/asm-m68k/machdep.h2
-rw-r--r--include/asm-m68k/machines.h87
-rw-r--r--include/asm-m68k/machw.h61
-rw-r--r--include/asm-m68k/macintosh.h6
-rw-r--r--include/asm-m68k/macints.h124
-rw-r--r--include/asm-m68k/math-emu.h300
-rw-r--r--include/asm-m68k/mmu_context.h164
-rw-r--r--include/asm-m68k/movs.h55
-rw-r--r--include/asm-m68k/openprom.h309
-rw-r--r--include/asm-m68k/oplib.h297
-rw-r--r--include/asm-m68k/page.h66
-rw-r--r--include/asm-m68k/param.h4
-rw-r--r--include/asm-m68k/pgtable.h69
-rw-r--r--include/asm-m68k/processor.h43
-rw-r--r--include/asm-m68k/resource.h4
-rw-r--r--include/asm-m68k/sbus.h20
-rw-r--r--include/asm-m68k/semaphore.h62
-rw-r--r--include/asm-m68k/setup.h36
-rw-r--r--include/asm-m68k/shm.h6
-rw-r--r--include/asm-m68k/shmparam.h5
-rw-r--r--include/asm-m68k/smplock.h2
-rw-r--r--include/asm-m68k/softirq.h3
-rw-r--r--include/asm-m68k/spinlock.h62
-rw-r--r--include/asm-m68k/sun3-head.h12
-rw-r--r--include/asm-m68k/sun3ints.h31
-rw-r--r--include/asm-m68k/sun3mmu.h167
-rw-r--r--include/asm-m68k/swim_iop.h221
-rw-r--r--include/asm-m68k/system.h11
-rw-r--r--include/asm-m68k/unistd.h3
-rw-r--r--include/asm-m68k/virtconvert.h12
-rw-r--r--include/asm-mips/cache.h24
-rw-r--r--include/asm-mips/dma.h4
-rw-r--r--include/asm-mips/hardirq.h13
-rw-r--r--include/asm-mips/ide.h8
-rw-r--r--include/asm-mips/init.h31
-rw-r--r--include/asm-mips/io.h22
-rw-r--r--include/asm-mips/mmu_context.h50
-rw-r--r--include/asm-mips/offset.h15
-rw-r--r--include/asm-mips/parport.h59
-rw-r--r--include/asm-mips/pci.h42
-rw-r--r--include/asm-mips/pgtable.h12
-rw-r--r--include/asm-mips/processor.h13
-rw-r--r--include/asm-mips/resource.h12
-rw-r--r--include/asm-mips/semaphore.h10
-rw-r--r--include/asm-mips/sgint23.h22
-rw-r--r--include/asm-mips/smplock.h4
-rw-r--r--include/asm-mips/spinlock.h77
-rw-r--r--include/asm-mips/system.h12
-rw-r--r--include/asm-mips/uaccess.h6
-rw-r--r--include/asm-mips/unistd.h3
-rw-r--r--include/asm-mips64/cache.h13
-rw-r--r--include/asm-mips64/io.h7
-rw-r--r--include/asm-mips64/parport.h59
-rw-r--r--include/asm-mips64/pgtable.h3
-rw-r--r--include/asm-mips64/resource.h5
-rw-r--r--include/asm-mips64/spinlock.h66
-rw-r--r--include/asm-mips64/system.h11
-rw-r--r--include/asm-mips64/unistd.h3
-rw-r--r--include/asm-ppc/cache.h8
-rw-r--r--include/asm-ppc/dma.h4
-rw-r--r--include/asm-ppc/gemini.h166
-rw-r--r--include/asm-ppc/gemini_serial.h39
-rw-r--r--include/asm-ppc/ide.h17
-rw-r--r--include/asm-ppc/init.h39
-rw-r--r--include/asm-ppc/io.h2
-rw-r--r--include/asm-ppc/irq.h4
-rw-r--r--include/asm-ppc/irq_control.h84
-rw-r--r--include/asm-ppc/keyboard.h70
-rw-r--r--include/asm-ppc/m48t35.h30
-rw-r--r--include/asm-ppc/machdep.h20
-rw-r--r--include/asm-ppc/md.h2
-rw-r--r--include/asm-ppc/mmu_context.h42
-rw-r--r--include/asm-ppc/namei.h2
-rw-r--r--include/asm-ppc/page.h39
-rw-r--r--include/asm-ppc/pci.h10
-rw-r--r--include/asm-ppc/pgtable.h48
-rw-r--r--include/asm-ppc/processor.h55
-rw-r--r--include/asm-ppc/ptrace.h2
-rw-r--r--include/asm-ppc/resource.h4
-rw-r--r--include/asm-ppc/semaphore.h6
-rw-r--r--include/asm-ppc/serial.h23
-rw-r--r--include/asm-ppc/smp.h1
-rw-r--r--include/asm-ppc/smplock.h2
-rw-r--r--include/asm-ppc/softirq.h16
-rw-r--r--include/asm-ppc/spinlock.h91
-rw-r--r--include/asm-ppc/system.h39
-rw-r--r--include/asm-ppc/uaccess.h4
-rw-r--r--include/asm-ppc/unistd.h1
-rw-r--r--include/asm-sh/a.out.h26
-rw-r--r--include/asm-sh/addrspace.h41
-rw-r--r--include/asm-sh/atomic.h113
-rw-r--r--include/asm-sh/bitops.h261
-rw-r--r--include/asm-sh/bugs.h20
-rw-r--r--include/asm-sh/byteorder.h43
-rw-r--r--include/asm-sh/cache.h23
-rw-r--r--include/asm-sh/checksum.h84
-rw-r--r--include/asm-sh/current.h24
-rw-r--r--include/asm-sh/delay.h44
-rw-r--r--include/asm-sh/dma.h12
-rw-r--r--include/asm-sh/elf.h76
-rw-r--r--include/asm-sh/errno.h132
-rw-r--r--include/asm-sh/fcntl.h66
-rw-r--r--include/asm-sh/hardirq.h24
-rw-r--r--include/asm-sh/hw_irq.h6
-rw-r--r--include/asm-sh/init.h1
-rw-r--r--include/asm-sh/io.h158
-rw-r--r--include/asm-sh/ioctl.h75
-rw-r--r--include/asm-sh/ioctls.h99
-rw-r--r--include/asm-sh/ipc.h31
-rw-r--r--include/asm-sh/irq.h35
-rw-r--r--include/asm-sh/mman.h32
-rw-r--r--include/asm-sh/mmu_context.h139
-rw-r--r--include/asm-sh/namei.h18
-rw-r--r--include/asm-sh/page.h104
-rw-r--r--include/asm-sh/param.h20
-rw-r--r--include/asm-sh/pgtable.h494
-rw-r--r--include/asm-sh/poll.h25
-rw-r--r--include/asm-sh/posix_types.h112
-rw-r--r--include/asm-sh/processor.h114
-rw-r--r--include/asm-sh/ptrace.h31
-rw-r--r--include/asm-sh/resource.h39
-rw-r--r--include/asm-sh/semaphore-helper.h (renamed from include/asm-i386/semaphore-helper.h)23
-rw-r--r--include/asm-sh/semaphore.h134
-rw-r--r--include/asm-sh/shmparam.h46
-rw-r--r--include/asm-sh/sigcontext.h17
-rw-r--r--include/asm-sh/siginfo.h197
-rw-r--r--include/asm-sh/signal.h183
-rw-r--r--include/asm-sh/smp.h4
-rw-r--r--include/asm-sh/smp_lock.h17
-rw-r--r--include/asm-sh/socket.h51
-rw-r--r--include/asm-sh/sockios.h13
-rw-r--r--include/asm-sh/softirq.h72
-rw-r--r--include/asm-sh/spinlock.h6
-rw-r--r--include/asm-sh/stat.h41
-rw-r--r--include/asm-sh/statfs.h25
-rw-r--r--include/asm-sh/string.h140
-rw-r--r--include/asm-sh/system.h185
-rw-r--r--include/asm-sh/termbits.h161
-rw-r--r--include/asm-sh/termios.h98
-rw-r--r--include/asm-sh/timex.h24
-rw-r--r--include/asm-sh/types.h46
-rw-r--r--include/asm-sh/uaccess.h439
-rw-r--r--include/asm-sh/ucontext.h12
-rw-r--r--include/asm-sh/unaligned.h19
-rw-r--r--include/asm-sh/unistd.h316
-rw-r--r--include/asm-sh/user.h50
-rw-r--r--include/asm-sparc/ap1000/apreg.h2
-rw-r--r--include/asm-sparc/asm_offsets.h334
-rw-r--r--include/asm-sparc/audioio.h164
-rw-r--r--include/asm-sparc/cache.h10
-rw-r--r--include/asm-sparc/dma.h10
-rw-r--r--include/asm-sparc/fbio.h1
-rw-r--r--include/asm-sparc/hardirq.h4
-rw-r--r--include/asm-sparc/init.h28
-rw-r--r--include/asm-sparc/io-unit.h2
-rw-r--r--include/asm-sparc/irq.h4
-rw-r--r--include/asm-sparc/mostek.h22
-rw-r--r--include/asm-sparc/page.h2
-rw-r--r--include/asm-sparc/pci.h10
-rw-r--r--include/asm-sparc/pgtable.h4
-rw-r--r--include/asm-sparc/processor.h17
-rw-r--r--include/asm-sparc/resource.h17
-rw-r--r--include/asm-sparc/sigcontext.h31
-rw-r--r--include/asm-sparc/siginfo.h17
-rw-r--r--include/asm-sparc/signal.h6
-rw-r--r--include/asm-sparc/smp.h2
-rw-r--r--include/asm-sparc/smplock.h2
-rw-r--r--include/asm-sparc/softirq.h2
-rw-r--r--include/asm-sparc/spinlock.h55
-rw-r--r--include/asm-sparc/sunbpp.h80
-rw-r--r--include/asm-sparc/system.h5
-rw-r--r--include/asm-sparc/turbosparc.h2
-rw-r--r--include/asm-sparc/uaccess.h6
-rw-r--r--include/asm-sparc/winmacro.h10
-rw-r--r--include/asm-sparc64/a.out.h4
-rw-r--r--include/asm-sparc64/asm_offsets.h678
-rw-r--r--include/asm-sparc64/audioio.h164
-rw-r--r--include/asm-sparc64/cache.h8
-rw-r--r--include/asm-sparc64/checksum.h4
-rw-r--r--include/asm-sparc64/dma.h13
-rw-r--r--include/asm-sparc64/ebus.h11
-rw-r--r--include/asm-sparc64/elf.h39
-rw-r--r--include/asm-sparc64/fbio.h2
-rw-r--r--include/asm-sparc64/floppy.h149
-rw-r--r--include/asm-sparc64/hardirq.h4
-rw-r--r--include/asm-sparc64/ide.h47
-rw-r--r--include/asm-sparc64/init.h17
-rw-r--r--include/asm-sparc64/io.h109
-rw-r--r--include/asm-sparc64/iommu.h5
-rw-r--r--include/asm-sparc64/irq.h17
-rw-r--r--include/asm-sparc64/mmu_context.h214
-rw-r--r--include/asm-sparc64/mostek.h107
-rw-r--r--include/asm-sparc64/oplib.h6
-rw-r--r--include/asm-sparc64/page.h9
-rw-r--r--include/asm-sparc64/parport.h182
-rw-r--r--include/asm-sparc64/pbm.h173
-rw-r--r--include/asm-sparc64/pci.h44
-rw-r--r--include/asm-sparc64/pgtable.h60
-rw-r--r--include/asm-sparc64/processor.h115
-rw-r--r--include/asm-sparc64/psycho.h400
-rw-r--r--include/asm-sparc64/reg.h6
-rw-r--r--include/asm-sparc64/resource.h16
-rw-r--r--include/asm-sparc64/scatterlist.h3
-rw-r--r--include/asm-sparc64/sigcontext.h82
-rw-r--r--include/asm-sparc64/siginfo.h18
-rw-r--r--include/asm-sparc64/signal.h20
-rw-r--r--include/asm-sparc64/smp.h2
-rw-r--r--include/asm-sparc64/smplock.h2
-rw-r--r--include/asm-sparc64/spinlock.h184
-rw-r--r--include/asm-sparc64/sunbpp.h80
-rw-r--r--include/asm-sparc64/sysio.h230
-rw-r--r--include/asm-sparc64/system.h62
-rw-r--r--include/asm-sparc64/timer.h2
-rw-r--r--include/asm-sparc64/ttable.h11
-rw-r--r--include/asm-sparc64/uaccess.h6
-rw-r--r--include/asm-sparc64/uctx.h2
-rw-r--r--include/asm-sparc64/unistd.h7
-rw-r--r--include/linux/acpi.h156
-rw-r--r--include/linux/apm_bios.h3
-rw-r--r--include/linux/arcdevice.h34
-rw-r--r--include/linux/atalk.h16
-rw-r--r--include/linux/atm.h253
-rw-r--r--include/linux/atm_eni.h15
-rw-r--r--include/linux/atm_nicstar.h52
-rw-r--r--include/linux/atm_suni.h19
-rw-r--r--include/linux/atm_tcp.h72
-rw-r--r--include/linux/atm_zatm.h54
-rw-r--r--include/linux/atmarp.h42
-rw-r--r--include/linux/atmclip.h25
-rw-r--r--include/linux/atmdev.h351
-rw-r--r--include/linux/atmioc.h39
-rw-r--r--include/linux/atmlec.h85
-rw-r--r--include/linux/atmmpc.h124
-rw-r--r--include/linux/atmsap.h161
-rw-r--r--include/linux/atmsvc.h53
-rw-r--r--include/linux/b1lli.h125
-rw-r--r--include/linux/b1pcmcia.h36
-rw-r--r--include/linux/bigmem.h48
-rw-r--r--include/linux/binfmts.h13
-rw-r--r--include/linux/bios32.h34
-rw-r--r--include/linux/blk.h57
-rw-r--r--include/linux/blkdev.h9
-rw-r--r--include/linux/capability.h9
-rw-r--r--include/linux/cd1400.h2
-rw-r--r--include/linux/cdk.h2
-rw-r--r--include/linux/cdrom.h540
-rw-r--r--include/linux/coda_linux.h6
-rw-r--r--include/linux/comstats.h2
-rw-r--r--include/linux/concap.h17
-rw-r--r--include/linux/cyclades.h71
-rw-r--r--include/linux/cyclomx.h15
-rw-r--r--include/linux/cycx_drv.h16
-rw-r--r--include/linux/elf.h169
-rw-r--r--include/linux/etherdevice.h8
-rw-r--r--include/linux/fat_cvf.h1
-rw-r--r--include/linux/fb.h49
-rw-r--r--include/linux/fcdevice.h40
-rw-r--r--include/linux/fd.h2
-rw-r--r--include/linux/fddidevice.h4
-rw-r--r--include/linux/file.h35
-rw-r--r--include/linux/firewall.h61
-rw-r--r--include/linux/fs.h48
-rw-r--r--include/linux/genhd.h14
-rw-r--r--include/linux/hdlcdrv.h18
-rw-r--r--include/linux/hfmodem.h256
-rw-r--r--include/linux/hippidevice.h14
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/i2o.h350
-rw-r--r--include/linux/icmpv6.h2
-rw-r--r--include/linux/ide.h11
-rw-r--r--include/linux/if_arp.h6
-rw-r--r--include/linux/if_cablemodem.h22
-rw-r--r--include/linux/if_eql.h4
-rw-r--r--include/linux/if_ether.h3
-rw-r--r--include/linux/if_fc.h50
-rw-r--r--include/linux/if_frad.h16
-rw-r--r--include/linux/if_ltalk.h2
-rw-r--r--include/linux/if_packet.h50
-rw-r--r--include/linux/if_ppp.h11
-rw-r--r--include/linux/if_pppvar.h9
-rw-r--r--include/linux/if_shaper.h13
-rw-r--r--include/linux/igmp.h4
-rw-r--r--include/linux/in.h4
-rw-r--r--include/linux/in6.h2
-rw-r--r--include/linux/inetdevice.h50
-rw-r--r--include/linux/init.h76
-rw-r--r--include/linux/iobuf.h80
-rw-r--r--include/linux/ioport.h130
-rw-r--r--include/linux/ip_fw.h193
-rw-r--r--include/linux/ip_masq.h140
-rw-r--r--include/linux/irda.h12
-rw-r--r--include/linux/irq.h79
-rw-r--r--include/linux/isapnp.h185
-rw-r--r--include/linux/isdn.h109
-rw-r--r--include/linux/isdn_budget.h62
-rw-r--r--include/linux/isdn_compat.h116
-rw-r--r--include/linux/isdn_divertif.h62
-rw-r--r--include/linux/isdn_ppp.h9
-rw-r--r--include/linux/isdnif.h242
-rw-r--r--include/linux/isicom.h22
-rw-r--r--include/linux/istallion.h8
-rw-r--r--include/linux/kernel.h8
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/kernelcapi.h50
-rw-r--r--include/linux/limits.h2
-rw-r--r--include/linux/linkage.h17
-rw-r--r--include/linux/list.h12
-rw-r--r--include/linux/logibusmouse.h (renamed from include/linux/busmouse.h)0
-rw-r--r--include/linux/lp_intern.h22
-rw-r--r--include/linux/lp_m68k.h135
-rw-r--r--include/linux/lp_mfc.h14
-rw-r--r--include/linux/major.h8
-rw-r--r--include/linux/mc6821.h51
-rw-r--r--include/linux/mca.h2
-rw-r--r--include/linux/minix_fs.h6
-rw-r--r--include/linux/miscdevice.h2
-rw-r--r--include/linux/mm.h41
-rw-r--r--include/linux/module.h8
-rw-r--r--include/linux/mroute.h40
-rw-r--r--include/linux/msdos_fs.h5
-rw-r--r--include/linux/msdos_fs_i.h4
-rw-r--r--include/linux/msdos_fs_sb.h2
-rw-r--r--include/linux/msg.h31
-rw-r--r--include/linux/mtio.h4
-rw-r--r--include/linux/n_r3964.h221
-rw-r--r--include/linux/net.h90
-rw-r--r--include/linux/netdevice.h190
-rw-r--r--include/linux/netfilter.h203
-rw-r--r--include/linux/netfilter_ddp.h14
-rw-r--r--include/linux/netfilter_decnet.h35
-rw-r--r--include/linux/netfilter_ipv4.h61
-rw-r--r--include/linux/netfilter_ipx.h14
-rw-r--r--include/linux/netfilter_x25.h15
-rw-r--r--include/linux/nubus.h364
-rw-r--r--include/linux/pagemap.h3
-rw-r--r--include/linux/parport.h18
-rw-r--r--include/linux/parport_pc.h11
-rw-r--r--include/linux/pci.h387
-rw-r--r--include/linux/personality.h6
-rw-r--r--include/linux/pipe_fs_i.h29
-rw-r--r--include/linux/pkt_sched.h14
-rw-r--r--include/linux/ppp-comp.h5
-rw-r--r--include/linux/ppp_channel.h62
-rw-r--r--include/linux/prctl.h5
-rw-r--r--include/linux/proc_fs.h93
-rw-r--r--include/linux/random.h1
-rw-r--r--include/linux/raw.h23
-rw-r--r--include/linux/rtnetlink.h19
-rw-r--r--include/linux/scc.h2
-rw-r--r--include/linux/sched.h193
-rw-r--r--include/linux/sem.h6
-rw-r--r--include/linux/serial.h9
-rw-r--r--include/linux/serialP.h68
-rw-r--r--include/linux/serial_reg.h89
-rw-r--r--include/linux/shm.h8
-rw-r--r--include/linux/skbuff.h42
-rw-r--r--include/linux/slab.h1
-rw-r--r--include/linux/socket.h19
-rw-r--r--include/linux/sonet.h52
-rw-r--r--include/linux/spinlock.h120
-rw-r--r--include/linux/stallion.h7
-rw-r--r--include/linux/swap.h32
-rw-r--r--include/linux/sysctl.h69
-rw-r--r--include/linux/sysrq.h2
-rw-r--r--include/linux/tasks.h25
-rw-r--r--include/linux/tcp.h23
-rw-r--r--include/linux/threads.h22
-rw-r--r--include/linux/tqueue.h2
-rw-r--r--include/linux/trdevice.h6
-rw-r--r--include/linux/tty.h1
-rw-r--r--include/linux/udf_167.h778
-rw-r--r--include/linux/udf_fs.h63
-rw-r--r--include/linux/udf_fs_i.h60
-rw-r--r--include/linux/udf_fs_sb.h108
-rw-r--r--include/linux/udf_udf.h228
-rw-r--r--include/linux/umsdos_fs.h4
-rw-r--r--include/linux/videodev.h3
-rw-r--r--include/linux/wait.h2
-rw-r--r--include/linux/wanpipe.h2
-rw-r--r--include/linux/wanrouter.h10
-rw-r--r--include/linux/wireless.h88
-rw-r--r--include/linux/yam.h82
-rw-r--r--include/math-emu/double.h197
-rw-r--r--include/math-emu/extended.h388
-rw-r--r--include/math-emu/op-1.h297
-rw-r--r--include/math-emu/op-2.h608
-rw-r--r--include/math-emu/op-4.h661
-rw-r--r--include/math-emu/op-8.h103
-rw-r--r--include/math-emu/op-common.h767
-rw-r--r--include/math-emu/quad.h201
-rw-r--r--include/math-emu/single.h110
-rw-r--r--include/math-emu/soft-fp.h176
-rw-r--r--include/net/addrconf.h73
-rw-r--r--include/net/af_unix.h12
-rw-r--r--include/net/arp.h8
-rw-r--r--include/net/atmclip.h63
-rw-r--r--include/net/ax25.h36
-rw-r--r--include/net/br.h4
-rw-r--r--include/net/datalink.h2
-rw-r--r--include/net/dn.h2
-rw-r--r--include/net/dn_dev.h22
-rw-r--r--include/net/dn_fib.h2
-rw-r--r--include/net/dn_neigh.h4
-rw-r--r--include/net/dn_route.h58
-rw-r--r--include/net/dst.h57
-rw-r--r--include/net/icmp.h3
-rw-r--r--include/net/if_inet6.h27
-rw-r--r--include/net/inet_common.h7
-rw-r--r--include/net/ip.h43
-rw-r--r--include/net/ip6_fib.h6
-rw-r--r--include/net/ip6_route.h30
-rw-r--r--include/net/ip_fib.h40
-rw-r--r--include/net/ip_masq.h340
-rw-r--r--include/net/ip_masq_mod.h86
-rw-r--r--include/net/ipip.h2
-rw-r--r--include/net/ipv6.h8
-rw-r--r--include/net/ipx.h2
-rw-r--r--include/net/irda/discovery.h14
-rw-r--r--include/net/irda/dongle.h5
-rw-r--r--include/net/irda/ircomm_common.h270
-rw-r--r--include/net/irda/ircomm_core.h110
-rw-r--r--include/net/irda/ircomm_event.h84
-rw-r--r--include/net/irda/ircomm_lmp.h65
-rw-r--r--include/net/irda/ircomm_param.h150
-rw-r--r--include/net/irda/ircomm_ttp.h70
-rw-r--r--include/net/irda/ircomm_tty.h116
-rw-r--r--include/net/irda/ircomm_tty_attach.h93
-rw-r--r--include/net/irda/irda.h30
-rw-r--r--include/net/irda/irda_device.h59
-rw-r--r--include/net/irda/iriap.h24
-rw-r--r--include/net/irda/irias_object.h31
-rw-r--r--include/net/irda/irlan_common.h2
-rw-r--r--include/net/irda/irlan_eth.h14
-rw-r--r--include/net/irda/irlap.h78
-rw-r--r--include/net/irda/irlap_event.h32
-rw-r--r--include/net/irda/irlap_frame.h76
-rw-r--r--include/net/irda/irlmp.h38
-rw-r--r--include/net/irda/irlmp_event.h31
-rw-r--r--include/net/irda/irlpt_cli.h49
-rw-r--r--include/net/irda/irlpt_cli_fsm.h36
-rw-r--r--include/net/irda/irlpt_common.h190
-rw-r--r--include/net/irda/irlpt_server.h42
-rw-r--r--include/net/irda/irlpt_server_fsm.h35
-rw-r--r--include/net/irda/irmod.h2
-rw-r--r--include/net/irda/irport.h6
-rw-r--r--include/net/irda/irqueue.h34
-rw-r--r--include/net/irda/irttp.h43
-rw-r--r--include/net/irda/irtty.h9
-rw-r--r--include/net/irda/irvtd.h95
-rw-r--r--include/net/irda/parameters.h108
-rw-r--r--include/net/irda/qos.h76
-rw-r--r--include/net/irda/timer.h30
-rw-r--r--include/net/irda/toshoboe.h8
-rw-r--r--include/net/llc.h2
-rw-r--r--include/net/ndisc.h18
-rw-r--r--include/net/neighbour.h38
-rw-r--r--include/net/netrom.h16
-rw-r--r--include/net/p8022.h2
-rw-r--r--include/net/pkt_sched.h60
-rw-r--r--include/net/protocol.h5
-rw-r--r--include/net/psnap.h2
-rw-r--r--include/net/rarp.h12
-rw-r--r--include/net/raw.h10
-rw-r--r--include/net/rawv6.h8
-rw-r--r--include/net/rose.h20
-rw-r--r--include/net/route.h8
-rw-r--r--include/net/sock.h328
-rw-r--r--include/net/tcp.h364
-rw-r--r--include/net/udp.h5
-rw-r--r--include/net/x25.h20
-rw-r--r--include/pcmcia/bulkmem.h195
-rw-r--r--include/pcmcia/bus_ops.h150
-rw-r--r--include/pcmcia/ciscode.h115
-rw-r--r--include/pcmcia/cisreg.h116
-rw-r--r--include/pcmcia/cistpl.h583
-rw-r--r--include/pcmcia/cs.h468
-rw-r--r--include/pcmcia/cs_types.h61
-rw-r--r--include/pcmcia/driver_ops.h82
-rw-r--r--include/pcmcia/ds.h163
-rw-r--r--include/pcmcia/ftl.h73
-rw-r--r--include/pcmcia/mem_op.h133
-rw-r--r--include/pcmcia/memory.h41
-rw-r--r--include/pcmcia/ss.h130
-rw-r--r--include/pcmcia/version.h4
-rw-r--r--include/video/fbcon.h22
-rw-r--r--include/video/sbusfb.h6
618 files changed, 29368 insertions, 9625 deletions
diff --git a/include/asm-alpha/cache.h b/include/asm-alpha/cache.h
index 5e46073a8..b7662d726 100644
--- a/include/asm-alpha/cache.h
+++ b/include/asm-alpha/cache.h
@@ -10,4 +10,6 @@
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+
#endif
diff --git a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h
index 5656ce953..d3b2808e8 100644
--- a/include/asm-alpha/compiler.h
+++ b/include/asm-alpha/compiler.h
@@ -13,11 +13,13 @@
* EGCS (of varying versions) does a good job of using insxl and extxl.
*/
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 91
+#if 0 && (__GNUC__ > 2 || __GNUC_MINOR__ >= 91)
#define __kernel_insbl(val, shift) \
(((unsigned long)(val) & 0xfful) << ((shift) * 8))
#define __kernel_inswl(val, shift) \
(((unsigned long)(val) & 0xfffful) << ((shift) * 8))
+#define __kernel_insql(val, shift) \
+ ((unsigned long)(val) << ((shift) * 8))
#else
#define __kernel_insbl(val, shift) \
({ unsigned long __kir; \
@@ -27,9 +29,13 @@
({ unsigned long __kir; \
__asm__("inswl %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
__kir; })
+#define __kernel_insql(val, shift) \
+ ({ unsigned long __kir; \
+ __asm__("insql %2,%1,%0" : "=r"(__kir) : "rI"(shift), "r"(val)); \
+ __kir; })
#endif
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 92
+#if 0 && (__GNUC__ > 2 || __GNUC_MINOR__ >= 92)
#define __kernel_extbl(val, shift) (((val) >> (((shift) & 7) * 8)) & 0xfful)
#define __kernel_extwl(val, shift) (((val) >> (((shift) & 7) * 8)) & 0xfffful)
#else
@@ -47,11 +53,10 @@
/*
* Beginning with EGCS 1.1, GCC defines __alpha_bwx__ when the BWX
* extension is enabled. Previous versions did not define anything
- * we could test during compilation, so allow users to tell us when
- * the compiler will DTRT.
+ * we could test during compilation -- too bad, so sad.
*/
-#if defined(HAVE_BWX) || defined(__alpha_bwx__)
+#if defined(__alpha_bwx__)
#define __kernel_ldbu(mem) (mem)
#define __kernel_ldwu(mem) (mem)
#define __kernel_stb(val,mem) ((mem) = (val))
diff --git a/include/asm-alpha/core_apecs.h b/include/asm-alpha/core_apecs.h
index 3346346f9..f9796c1d5 100644
--- a/include/asm-alpha/core_apecs.h
+++ b/include/asm-alpha/core_apecs.h
@@ -67,25 +67,17 @@
make the AVANTI support pay for the limitations of the XL. It is true,
however, that an XL kernel will run on an AVANTI without problems.
*/
-#define APECS_XL_DMA_WIN1_BASE (64*1024*1024)
-#define APECS_XL_DMA_WIN1_SIZE (64*1024*1024)
-#define APECS_XL_DMA_WIN1_SIZE_PARANOID (48*1024*1024)
-#define APECS_XL_DMA_WIN2_BASE (1024*1024*1024)
-#define APECS_XL_DMA_WIN2_SIZE (1024*1024*1024)
+#define APECS_XL_DMA_WIN1_BASE (64UL*1024*1024)
+#define APECS_XL_DMA_WIN1_SIZE (64UL*1024*1024)
+#define APECS_XL_DMA_WIN1_SIZE_PARANOID (48UL*1024*1024)
+#define APECS_XL_DMA_WIN2_BASE (1UL*1024*1024*1024)
+#define APECS_XL_DMA_WIN2_SIZE (1UL*1024*1024*1024)
/* These are for normal APECS family machines, AVANTI/MUSTANG/EB64/PC64. */
-#define APECS_DMA_WIN_BASE_DEFAULT (1024*1024*1024)
-#define APECS_DMA_WIN_SIZE_DEFAULT (1024*1024*1024)
-
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define APECS_DMA_WIN_BASE alpha_mv.dma_win_base
-#define APECS_DMA_WIN_SIZE alpha_mv.dma_win_size
-#else
-#define APECS_DMA_WIN_BASE APECS_DMA_WIN_BASE_DEFAULT
-#define APECS_DMA_WIN_SIZE APECS_DMA_WIN_SIZE_DEFAULT
-#endif
+#define APECS_DMA_WIN_BASE (1UL*1024*1024*1024)
+#define APECS_DMA_WIN_SIZE (1UL*1024*1024*1024)
/*
@@ -400,9 +392,9 @@ static inline unsigned long apecs_xl_virt_to_bus(void * address)
{
unsigned long paddr = virt_to_phys(address);
if (paddr < APECS_XL_DMA_WIN1_SIZE_PARANOID)
- return paddr + APECS_XL_DMA_WIN1_BASE;
+ return paddr + APECS_XL_DMA_WIN1_BASE;
else
- return paddr + APECS_XL_DMA_WIN2_BASE; /* win 2 xlates to 0 also */
+ return paddr + APECS_XL_DMA_WIN2_BASE;
}
__EXTERN_INLINE void * apecs_bus_to_virt(unsigned long address)
@@ -426,12 +418,12 @@ static inline void * apecs_xl_bus_to_virt(unsigned long address)
* detect null "pointers" (the NCR driver is much simpler if
* NULL pointers are preserved).
*/
- if (address < APECS_XL_DMA_WIN1_BASE)
- return 0;
- else if (address < (APECS_XL_DMA_WIN1_BASE + APECS_XL_DMA_WIN1_SIZE))
- address -= APECS_XL_DMA_WIN1_BASE;
+ if (address < APECS_XL_DMA_WIN1_BASE)
+ return 0;
+ else if (address < (APECS_XL_DMA_WIN1_BASE + APECS_XL_DMA_WIN1_SIZE))
+ address -= APECS_XL_DMA_WIN1_BASE;
else /* should be more checking here, maybe? */
- address -= APECS_XL_DMA_WIN2_BASE;
+ address -= APECS_XL_DMA_WIN2_BASE;
return phys_to_virt(address);
}
@@ -501,6 +493,7 @@ __EXTERN_INLINE unsigned long apecs_readb(unsigned long addr)
{
unsigned long result, msb;
+ addr -= APECS_DENSE_MEM;
if (addr >= (1UL << 24)) {
msb = addr & 0xf8000000;
addr -= msb;
@@ -514,6 +507,7 @@ __EXTERN_INLINE unsigned long apecs_readw(unsigned long addr)
{
unsigned long result, msb;
+ addr -= APECS_DENSE_MEM;
if (addr >= (1UL << 24)) {
msb = addr & 0xf8000000;
addr -= msb;
@@ -525,18 +519,19 @@ __EXTERN_INLINE unsigned long apecs_readw(unsigned long addr)
__EXTERN_INLINE unsigned long apecs_readl(unsigned long addr)
{
- return *(vuip) (addr + APECS_DENSE_MEM);
+ return *(vuip)addr;
}
__EXTERN_INLINE unsigned long apecs_readq(unsigned long addr)
{
- return *(vulp) (addr + APECS_DENSE_MEM);
+ return *(vulp)addr;
}
__EXTERN_INLINE void apecs_writeb(unsigned char b, unsigned long addr)
{
unsigned long msb;
+ addr -= APECS_DENSE_MEM;
if (addr >= (1UL << 24)) {
msb = addr & 0xf8000000;
addr -= msb;
@@ -549,6 +544,7 @@ __EXTERN_INLINE void apecs_writew(unsigned short b, unsigned long addr)
{
unsigned long msb;
+ addr -= APECS_DENSE_MEM;
if (addr >= (1UL << 24)) {
msb = addr & 0xf8000000;
addr -= msb;
@@ -559,19 +555,22 @@ __EXTERN_INLINE void apecs_writew(unsigned short b, unsigned long addr)
__EXTERN_INLINE void apecs_writel(unsigned int b, unsigned long addr)
{
- *(vuip) (addr + APECS_DENSE_MEM) = b;
+ *(vuip)addr = b;
}
__EXTERN_INLINE void apecs_writeq(unsigned long b, unsigned long addr)
{
- *(vulp) (addr + APECS_DENSE_MEM) = b;
+ *(vulp)addr = b;
}
-/* Find the DENSE memory area for a given bus address. */
+__EXTERN_INLINE unsigned long apecs_ioremap(unsigned long addr)
+{
+ return addr + APECS_DENSE_MEM;
+}
-__EXTERN_INLINE unsigned long apecs_dense_mem(unsigned long addr)
+__EXTERN_INLINE int apecs_is_ioaddr(unsigned long addr)
{
- return APECS_DENSE_MEM;
+ return addr >= IDENT_ADDR + 0x180000000UL;
}
#undef vip
@@ -602,18 +601,18 @@ __EXTERN_INLINE unsigned long apecs_dense_mem(unsigned long addr)
#define __writew apecs_writew
#define __writel apecs_writel
#define __writeq apecs_writeq
-#define dense_mem apecs_dense_mem
+#define __ioremap apecs_ioremap
+#define __is_ioaddr apecs_is_ioaddr
#define inb(port) \
-(__builtin_constant_p((port))?__inb(port):_inb(port))
-
+ (__builtin_constant_p((port))?__inb(port):_inb(port))
#define outb(x, port) \
-(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
+ (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-#define readl(a) __readl((unsigned long)(a))
-#define readq(a) __readq((unsigned long)(a))
-#define writel(v,a) __writel((v),(unsigned long)(a))
-#define writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __raw_readl(a) __readl((unsigned long)(a))
+#define __raw_readq(a) __readq((unsigned long)(a))
+#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
+#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_cia.h b/include/asm-alpha/core_cia.h
index 3407d0159..b549029d1 100644
--- a/include/asm-alpha/core_cia.h
+++ b/include/asm-alpha/core_cia.h
@@ -1,7 +1,9 @@
#ifndef __ALPHA_CIA__H__
#define __ALPHA_CIA__H__
-#include <linux/config.h>
+/* Define to experiment with fitting everything into one 512MB HAE window. */
+#define CIA_ONE_HAE_WINDOW 1
+
#include <linux/types.h>
#include <asm/compiler.h>
@@ -11,7 +13,7 @@
*
* This file is based on:
*
- * DECchip 21171 Core Logic Chipset
+ * DECchip 21171 Core Logic Chipset
* Technical Reference Manual
*
* EC-QE18B-TE
@@ -39,17 +41,15 @@
/* CIA ADDRESS BIT DEFINITIONS
*
- * 3 3 3 3|3 3 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1
- * 9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |1| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |0|0|0|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | \_/ \_/
- * | | |
- * +-- IO space, not cached. Byte Enable --+ |
- * Transfer Length --+
- *
- *
+ * 3333 3333 3322 2222 2222 1111 1111 11
+ * 9876 5432 1098 7654 3210 9876 5432 1098 7654 3210
+ * ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ * 1 000
+ * ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ * | |\|
+ * | Byte Enable --+ |
+ * | Transfer Length --+
+ * +-- IO space, not cached
*
* Byte Transfer
* Enable Length Transfer Byte Address
@@ -77,16 +77,19 @@
#define CIA_MEM_R2_MASK 0x07ffffff /* SPARSE Mem region 2 mask is 27 bits */
#define CIA_MEM_R3_MASK 0x03ffffff /* SPARSE Mem region 3 mask is 26 bits */
-#define CIA_DMA_WIN_BASE_DEFAULT (1024*1024*1024)
-#define CIA_DMA_WIN_SIZE_DEFAULT (1024*1024*1024)
+#define CIA_DMA_WIN_BASE (1UL*1024*1024*1024)
+#define CIA_DMA_WIN_SIZE (2UL*1024*1024*1024)
+
+/* Window 0 at 1GB size 1GB mapping to 0. */
+#define CIA_DMA_WIN0_BASE_DEFAULT (1UL*1024*1024*1024)
+#define CIA_DMA_WIN0_SIZE_DEFAULT (1UL*1024*1024*1024)
+#define CIA_DMA_WIN0_TRAN_DEFAULT (0UL)
+
+/* Window 1 at 2GB size 1GB mapping to 1GB. */
+#define CIA_DMA_WIN1_BASE_DEFAULT (2UL*1024*1024*1024)
+#define CIA_DMA_WIN1_SIZE_DEFAULT (1UL*1024*1024*1024)
+#define CIA_DMA_WIN1_TRAN_DEFAULT (1UL*1024*1024*1024)
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define CIA_DMA_WIN_BASE alpha_mv.dma_win_base
-#define CIA_DMA_WIN_SIZE alpha_mv.dma_win_size
-#else
-#define CIA_DMA_WIN_BASE CIA_DMA_WIN_SIZE_DEFAULT
-#define CIA_DMA_WIN_SIZE CIA_DMA_WIN_SIZE_DEFAULT
-#endif
/*
* 21171-CA Control and Status Registers (p4-1)
@@ -207,7 +210,9 @@
#define CIA_IOC_STAT0_P_NBR_SHIFT 13
#define CIA_IOC_STAT0_P_NBR_MASK 0x7ffff
+#if !CIA_ONE_HAE_WINDOW
#define CIA_HAE_ADDRESS CIA_IOC_HAE_MEM
+#endif
/*
* Data structure for handling CIA machine checks.
@@ -239,47 +244,47 @@ struct el_CIA_procdata {
/* System-specific info. */
struct el_CIA_sysdata_mcheck {
- unsigned long coma_gcr;
- unsigned long coma_edsr;
- unsigned long coma_ter;
- unsigned long coma_elar;
- unsigned long coma_ehar;
- unsigned long coma_ldlr;
- unsigned long coma_ldhr;
- unsigned long coma_base0;
- unsigned long coma_base1;
- unsigned long coma_base2;
- unsigned long coma_cnfg0;
- unsigned long coma_cnfg1;
- unsigned long coma_cnfg2;
- unsigned long epic_dcsr;
- unsigned long epic_pear;
- unsigned long epic_sear;
- unsigned long epic_tbr1;
- unsigned long epic_tbr2;
- unsigned long epic_pbr1;
- unsigned long epic_pbr2;
- unsigned long epic_pmr1;
- unsigned long epic_pmr2;
- unsigned long epic_harx1;
- unsigned long epic_harx2;
- unsigned long epic_pmlt;
- unsigned long epic_tag0;
- unsigned long epic_tag1;
- unsigned long epic_tag2;
- unsigned long epic_tag3;
- unsigned long epic_tag4;
- unsigned long epic_tag5;
- unsigned long epic_tag6;
- unsigned long epic_tag7;
- unsigned long epic_data0;
- unsigned long epic_data1;
- unsigned long epic_data2;
- unsigned long epic_data3;
- unsigned long epic_data4;
- unsigned long epic_data5;
- unsigned long epic_data6;
- unsigned long epic_data7;
+ unsigned long coma_gcr;
+ unsigned long coma_edsr;
+ unsigned long coma_ter;
+ unsigned long coma_elar;
+ unsigned long coma_ehar;
+ unsigned long coma_ldlr;
+ unsigned long coma_ldhr;
+ unsigned long coma_base0;
+ unsigned long coma_base1;
+ unsigned long coma_base2;
+ unsigned long coma_cnfg0;
+ unsigned long coma_cnfg1;
+ unsigned long coma_cnfg2;
+ unsigned long epic_dcsr;
+ unsigned long epic_pear;
+ unsigned long epic_sear;
+ unsigned long epic_tbr1;
+ unsigned long epic_tbr2;
+ unsigned long epic_pbr1;
+ unsigned long epic_pbr2;
+ unsigned long epic_pmr1;
+ unsigned long epic_pmr2;
+ unsigned long epic_harx1;
+ unsigned long epic_harx2;
+ unsigned long epic_pmlt;
+ unsigned long epic_tag0;
+ unsigned long epic_tag1;
+ unsigned long epic_tag2;
+ unsigned long epic_tag3;
+ unsigned long epic_tag4;
+ unsigned long epic_tag5;
+ unsigned long epic_tag6;
+ unsigned long epic_tag7;
+ unsigned long epic_data0;
+ unsigned long epic_data1;
+ unsigned long epic_data2;
+ unsigned long epic_data3;
+ unsigned long epic_data4;
+ unsigned long epic_data5;
+ unsigned long epic_data6;
+ unsigned long epic_data7;
};
@@ -360,8 +365,8 @@ __EXTERN_INLINE void cia_outl(unsigned int b, unsigned long addr)
/*
* Memory functions. 64-bit and 32-bit accesses are done through
* dense memory space, everything else through sparse space.
- *
- * For reading and writing 8 and 16 bit quantities we need to
+ *
+ * For reading and writing 8 and 16 bit quantities we need to
* go through one of the three sparse address mapping regions
* and use the HAE_MEM CSR to provide some bits of the address.
* The following few routines use only sparse address region 1
@@ -370,10 +375,10 @@ __EXTERN_INLINE void cia_outl(unsigned int b, unsigned long addr)
* See p 6-17 of the specification but it looks something like this:
*
* 21164 Address:
- *
- * 3 2 1
+ *
+ * 3 2 1
* 9876543210987654321098765432109876543210
- * 1ZZZZ0.PCI.QW.Address............BBLL
+ * 1ZZZZ0.PCI.QW.Address............BBLL
*
* ZZ = SBZ
* BB = Byte offset
@@ -381,95 +386,26 @@ __EXTERN_INLINE void cia_outl(unsigned int b, unsigned long addr)
*
* PCI Address:
*
- * 3 2 1
+ * 3 2 1
* 10987654321098765432109876543210
* HHH....PCI.QW.Address........ 00
*
* HHH = 31:29 HAE_MEM CSR
- *
+ *
*/
-__EXTERN_INLINE unsigned long cia_srm_base(unsigned long addr)
-{
- unsigned long mask, base;
-
- if (addr >= alpha_mv.sm_base_r1
- && addr <= alpha_mv.sm_base_r1 + CIA_MEM_R1_MASK) {
- mask = CIA_MEM_R1_MASK;
- base = CIA_SPARSE_MEM;
- }
- else if (addr >= alpha_mv.sm_base_r2
- && addr <= alpha_mv.sm_base_r2 + CIA_MEM_R2_MASK) {
- mask = CIA_MEM_R2_MASK;
- base = CIA_SPARSE_MEM_R2;
- }
- else if (addr >= alpha_mv.sm_base_r3
- && addr <= alpha_mv.sm_base_r3 + CIA_MEM_R3_MASK) {
- mask = CIA_MEM_R3_MASK;
- base = CIA_SPARSE_MEM_R3;
- }
- else
- {
-#if 0
- printk("cia: address 0x%lx not covered by HAE\n", addr);
-#endif
- return 0;
- }
-
- return ((addr & mask) << 5) + base;
-}
-
-__EXTERN_INLINE unsigned long cia_srm_readb(unsigned long addr)
-{
- unsigned long result, work;
-
- if ((work = cia_srm_base(addr)) == 0)
- return 0xff;
- work += 0x00; /* add transfer length */
-
- result = *(vip) work;
- return __kernel_extbl(result, addr & 3);
-}
-
-__EXTERN_INLINE unsigned long cia_srm_readw(unsigned long addr)
-{
- unsigned long result, work;
-
- if ((work = cia_srm_base(addr)) == 0)
- return 0xffff;
- work += 0x08; /* add transfer length */
-
- result = *(vip) work;
- return __kernel_extwl(result, addr & 3);
-}
-
-__EXTERN_INLINE void cia_srm_writeb(unsigned char b, unsigned long addr)
-{
- unsigned long work = cia_srm_base(addr), w;
- if (work) {
- work += 0x00; /* add transfer length */
- w = __kernel_insbl(b, addr & 3);
- *(vuip) work = w;
- }
-}
-
-__EXTERN_INLINE void cia_srm_writew(unsigned short b, unsigned long addr)
-{
- unsigned long work = cia_srm_base(addr), w;
- if (work) {
- work += 0x08; /* add transfer length */
- w = __kernel_inswl(b, addr & 3);
- *(vuip) work = w;
- }
-}
-
__EXTERN_INLINE unsigned long cia_readb(unsigned long addr)
{
- unsigned long result, msb;
+ unsigned long result;
+#if !CIA_ONE_HAE_WINDOW
+ unsigned long msb;
+ /* Note that CIA_DENSE_MEM has no bits not masked in these
+ operations, so we don't have to subtract it back out. */
msb = addr & 0xE0000000;
- addr &= CIA_MEM_R1_MASK;
set_hae(msb);
+#endif
+ addr &= CIA_MEM_R1_MASK;
result = *(vip) ((addr << 5) + CIA_SPARSE_MEM + 0x00);
return __kernel_extbl(result, addr & 3);
@@ -477,11 +413,16 @@ __EXTERN_INLINE unsigned long cia_readb(unsigned long addr)
__EXTERN_INLINE unsigned long cia_readw(unsigned long addr)
{
- unsigned long result, msb;
+ unsigned long result;
+#if !CIA_ONE_HAE_WINDOW
+ unsigned long msb;
+ /* Note that CIA_DENSE_MEM has no bits not masked in these
+ operations, so we don't have to subtract it back out. */
msb = addr & 0xE0000000;
- addr &= CIA_MEM_R1_MASK;
set_hae(msb);
+#endif
+ addr &= CIA_MEM_R1_MASK;
result = *(vip) ((addr << 5) + CIA_SPARSE_MEM + 0x08);
return __kernel_extwl(result, addr & 3);
@@ -489,11 +430,16 @@ __EXTERN_INLINE unsigned long cia_readw(unsigned long addr)
__EXTERN_INLINE void cia_writeb(unsigned char b, unsigned long addr)
{
- unsigned long msb, w;
+ unsigned long w;
+#if !CIA_ONE_HAE_WINDOW
+ unsigned long msb;
+ /* Note that CIA_DENSE_MEM has no bits not masked in these
+ operations, so we don't have to subtract it back out. */
msb = addr & 0xE0000000;
- addr &= CIA_MEM_R1_MASK;
set_hae(msb);
+#endif
+ addr &= CIA_MEM_R1_MASK;
w = __kernel_insbl(b, addr & 3);
*(vuip) ((addr << 5) + CIA_SPARSE_MEM + 0x00) = w;
@@ -501,11 +447,16 @@ __EXTERN_INLINE void cia_writeb(unsigned char b, unsigned long addr)
__EXTERN_INLINE void cia_writew(unsigned short b, unsigned long addr)
{
- unsigned long msb, w;
+ unsigned long w;
+#if !CIA_ONE_HAE_WINDOW
+ unsigned long msb;
+ /* Note that CIA_DENSE_MEM has no bits not masked in these
+ operations, so we don't have to subtract it back out. */
msb = addr & 0xE0000000;
- addr &= CIA_MEM_R1_MASK;
set_hae(msb);
+#endif
+ addr &= CIA_MEM_R1_MASK;
w = __kernel_inswl(b, addr & 3);
*(vuip) ((addr << 5) + CIA_SPARSE_MEM + 0x08) = w;
@@ -513,29 +464,32 @@ __EXTERN_INLINE void cia_writew(unsigned short b, unsigned long addr)
__EXTERN_INLINE unsigned long cia_readl(unsigned long addr)
{
- return *(vuip) (addr + CIA_DENSE_MEM);
+ return *(vuip)addr;
}
__EXTERN_INLINE unsigned long cia_readq(unsigned long addr)
{
- return *(vulp) (addr + CIA_DENSE_MEM);
+ return *(vulp)addr;
}
__EXTERN_INLINE void cia_writel(unsigned int b, unsigned long addr)
{
- *(vuip) (addr + CIA_DENSE_MEM) = b;
+ *(vuip)addr = b;
}
__EXTERN_INLINE void cia_writeq(unsigned long b, unsigned long addr)
{
- *(vulp) (addr + CIA_DENSE_MEM) = b;
+ *(vulp)addr = b;
}
-/* Find the DENSE memory area for a given bus address. */
+__EXTERN_INLINE unsigned long cia_ioremap(unsigned long addr)
+{
+ return addr + CIA_DENSE_MEM;
+}
-__EXTERN_INLINE unsigned long cia_dense_mem(unsigned long addr)
+__EXTERN_INLINE int cia_is_ioaddr(unsigned long addr)
{
- return CIA_DENSE_MEM;
+ return addr >= IDENT_ADDR + 0x8000000000UL;
}
#undef vip
@@ -553,41 +507,26 @@ __EXTERN_INLINE unsigned long cia_dense_mem(unsigned long addr)
#define __outw cia_outw
#define __outl cia_outl
-#ifdef CONFIG_ALPHA_SRM_SETUP
-#define __readb cia_srm_readb
-#define __readw cia_srm_readw
-#define __writeb cia_srm_writeb
-#define __writew cia_srm_writew
-#else
#define __readb cia_readb
#define __readw cia_readw
#define __writeb cia_writeb
#define __writew cia_writew
-#endif
-
#define __readl cia_readl
#define __readq cia_readq
#define __writel cia_writel
#define __writeq cia_writeq
-#define dense_mem cia_dense_mem
+#define __ioremap cia_ioremap
+#define __is_ioaddr cia_is_ioaddr
#define inb(port) \
-(__builtin_constant_p((port))?__inb(port):_inb(port))
+ (__builtin_constant_p((port))?__inb(port):_inb(port))
#define outb(x, port) \
-(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-
-#define inw(port) \
-(__builtin_constant_p((port))?__inw(port):_inw(port))
-#define outw(x, port) \
-(__builtin_constant_p((port))?__outw((x),(port)):_outw((x),(port)))
-
-#define inl(port) __inl(port)
-#define outl(x,port) __outl((x),(port))
+ (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-#define readl(a) __readl((unsigned long)(a))
-#define readq(a) __readq((unsigned long)(a))
-#define writel(v,a) __writel((v),(unsigned long)(a))
-#define writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __raw_readl(a) __readl((unsigned long)(a))
+#define __raw_readq(a) __readq((unsigned long)(a))
+#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
+#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_lca.h b/include/asm-alpha/core_lca.h
index 63f258924..644512cba 100644
--- a/include/asm-alpha/core_lca.h
+++ b/include/asm-alpha/core_lca.h
@@ -1,7 +1,6 @@
#ifndef __ALPHA_LCA__H__
#define __ALPHA_LCA__H__
-#include <linux/config.h>
#include <asm/system.h>
#include <asm/compiler.h>
@@ -56,16 +55,9 @@
* ugh).
*/
-#define LCA_DMA_WIN_BASE_DEFAULT (1024*1024*1024)
-#define LCA_DMA_WIN_SIZE_DEFAULT (1024*1024*1024)
+#define LCA_DMA_WIN_BASE (1UL*1024*1024*1024)
+#define LCA_DMA_WIN_SIZE (1UL*1024*1024*1024)
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define LCA_DMA_WIN_BASE alpha_mv.dma_win_base
-#define LCA_DMA_WIN_SIZE alpha_mv.dma_win_size
-#else
-#define LCA_DMA_WIN_BASE LCA_DMA_WIN_BASE_DEFAULT
-#define LCA_DMA_WIN_SIZE LCA_DMA_WIN_SIZE_DEFAULT
-#endif
/*
* Memory Controller registers:
@@ -305,6 +297,7 @@ __EXTERN_INLINE unsigned long lca_readb(unsigned long addr)
{
unsigned long result, msb;
+ addr -= LCA_DENSE_MEM;
if (addr >= (1UL << 24)) {
msb = addr & 0xf8000000;
addr -= msb;
@@ -318,6 +311,7 @@ __EXTERN_INLINE unsigned long lca_readw(unsigned long addr)
{
unsigned long result, msb;
+ addr -= LCA_DENSE_MEM;
if (addr >= (1UL << 24)) {
msb = addr & 0xf8000000;
addr -= msb;
@@ -329,12 +323,12 @@ __EXTERN_INLINE unsigned long lca_readw(unsigned long addr)
__EXTERN_INLINE unsigned long lca_readl(unsigned long addr)
{
- return *(vuip) (addr + LCA_DENSE_MEM);
+ return *(vuip)addr;
}
__EXTERN_INLINE unsigned long lca_readq(unsigned long addr)
{
- return *(vulp) (addr + LCA_DENSE_MEM);
+ return *(vulp)addr;
}
__EXTERN_INLINE void lca_writeb(unsigned char b, unsigned long addr)
@@ -342,6 +336,7 @@ __EXTERN_INLINE void lca_writeb(unsigned char b, unsigned long addr)
unsigned long msb;
unsigned long w;
+ addr -= LCA_DENSE_MEM;
if (addr >= (1UL << 24)) {
msb = addr & 0xf8000000;
addr -= msb;
@@ -356,6 +351,7 @@ __EXTERN_INLINE void lca_writew(unsigned short b, unsigned long addr)
unsigned long msb;
unsigned long w;
+ addr -= LCA_DENSE_MEM;
if (addr >= (1UL << 24)) {
msb = addr & 0xf8000000;
addr -= msb;
@@ -367,19 +363,22 @@ __EXTERN_INLINE void lca_writew(unsigned short b, unsigned long addr)
__EXTERN_INLINE void lca_writel(unsigned int b, unsigned long addr)
{
- *(vuip) (addr + LCA_DENSE_MEM) = b;
+ *(vuip)addr = b;
}
__EXTERN_INLINE void lca_writeq(unsigned long b, unsigned long addr)
{
- *(vulp) (addr + LCA_DENSE_MEM) = b;
+ *(vulp)addr = b;
}
-/* Find the DENSE memory area for a given bus address. */
+__EXTERN_INLINE unsigned long lca_ioremap(unsigned long addr)
+{
+ return addr + LCA_DENSE_MEM;
+}
-__EXTERN_INLINE unsigned long lca_dense_mem(unsigned long addr)
+__EXTERN_INLINE int lca_is_ioaddr(unsigned long addr)
{
- return LCA_DENSE_MEM;
+ return addr >= IDENT_ADDR + 0x120000000UL;
}
#undef vip
@@ -404,18 +403,18 @@ __EXTERN_INLINE unsigned long lca_dense_mem(unsigned long addr)
#define __readq lca_readq
#define __writel lca_writel
#define __writeq lca_writeq
-#define dense_mem lca_dense_mem
+#define __ioremap lca_ioremap
+#define __is_ioaddr lca_is_ioaddr
#define inb(port) \
-(__builtin_constant_p((port))?__inb(port):_inb(port))
-
+ (__builtin_constant_p((port))?__inb(port):_inb(port))
#define outb(x, port) \
-(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
+ (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-#define readl(a) __readl((unsigned long)(a))
-#define readq(a) __readq((unsigned long)(a))
-#define writel(v,a) __writel((v),(unsigned long)(a))
-#define writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __raw_readl(a) __readl((unsigned long)(a))
+#define __raw_readq(a) __readq((unsigned long)(a))
+#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
+#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_mcpcia.h b/include/asm-alpha/core_mcpcia.h
index 84eab12d8..577704129 100644
--- a/include/asm-alpha/core_mcpcia.h
+++ b/include/asm-alpha/core_mcpcia.h
@@ -1,7 +1,10 @@
#ifndef __ALPHA_MCPCIA__H__
#define __ALPHA_MCPCIA__H__
-#include <linux/config.h>
+/* Define to experiment with fitting everything into one 128MB HAE window.
+ One window per bus, that is. */
+#define MCPCIA_ONE_HAE_WINDOW 1
+
#include <linux/types.h>
#include <linux/pci.h>
#include <asm/compiler.h>
@@ -37,17 +40,15 @@
/* MCPCIA ADDRESS BIT DEFINITIONS
*
- * 3 3 3 3|3 3 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1
- * 9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |1| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |0|0|0|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | \_/ \_/
- * | | |
- * +-- IO space, not cached. Byte Enable --+ |
- * Transfer Length --+
- *
- *
+ * 3333 3333 3322 2222 2222 1111 1111 11
+ * 9876 5432 1098 7654 3210 9876 5432 1098 7654 3210
+ * ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ * 1 000
+ * ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ * | |\|
+ * | Byte Enable --+ |
+ * | Transfer Length --+
+ * +-- IO space, not cached
*
* Byte Transfer
* Enable Length Transfer Byte Address
@@ -73,106 +74,119 @@
#define MCPCIA_MEM_MASK 0x07ffffff /* SPARSE Mem region mask is 27 bits */
-#define MCPCIA_DMA_WIN_BASE_DEFAULT (2*1024*1024*1024U)
-#define MCPCIA_DMA_WIN_SIZE_DEFAULT (2*1024*1024*1024U)
+#define MCPCIA_DMA_WIN_BASE (2UL*1024*1024*1024)
+#define MCPCIA_DMA_WIN_SIZE (2UL*1024*1024*1024)
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define MCPCIA_DMA_WIN_BASE alpha_mv.dma_win_base
-#define MCPCIA_DMA_WIN_SIZE alpha_mv.dma_win_size
-#else
-#define MCPCIA_DMA_WIN_BASE MCPCIA_DMA_WIN_BASE_DEFAULT
-#define MCPCIA_DMA_WIN_SIZE MCPCIA_DMA_WIN_SIZE_DEFAULT
-#endif
+#define MCPCIA_MID(m) ((unsigned long)(m) << 33)
-#define HOSE(h) (((unsigned long)(h)) << 33)
+/*
+ * Memory spaces:
+ */
+#define MCPCIA_SPARSE(m) (IDENT_ADDR + 0xf000000000UL + MCPCIA_MID(m))
+#define MCPCIA_DENSE(m) (IDENT_ADDR + 0xf100000000UL + MCPCIA_MID(m))
+#define MCPCIA_IO(m) (IDENT_ADDR + 0xf180000000UL + MCPCIA_MID(m))
+#define MCPCIA_CONF(m) (IDENT_ADDR + 0xf1c0000000UL + MCPCIA_MID(m))
+#define MCPCIA_CSR(m) (IDENT_ADDR + 0xf1e0000000UL + MCPCIA_MID(m))
+#define MCPCIA_IO_IACK(m) (IDENT_ADDR + 0xf1f0000000UL + MCPCIA_MID(m))
+#define MCPCIA_DENSE_IO(m) (IDENT_ADDR + 0xe1fc000000UL + MCPCIA_MID(m))
+#define MCPCIA_DENSE_CONF(m) (IDENT_ADDR + 0xe1fe000000UL + MCPCIA_MID(m))
/*
* General Registers
*/
-#define MCPCIA_REV(h) (IDENT_ADDR + 0xf9e0000000UL + HOSE(h))
-#define MCPCIA_WHOAMI(h) (IDENT_ADDR + 0xf9e0000040UL + HOSE(h))
-#define MCPCIA_PCI_LAT(h) (IDENT_ADDR + 0xf9e0000080UL + HOSE(h))
-#define MCPCIA_CAP_CTRL(h) (IDENT_ADDR + 0xf9e0000100UL + HOSE(h))
-#define MCPCIA_HAE_MEM(h) (IDENT_ADDR + 0xf9e0000400UL + HOSE(h))
-#define MCPCIA_HAE_IO(h) (IDENT_ADDR + 0xf9e0000440UL + HOSE(h))
-#if 0
-#define MCPCIA_IACK_SC(h) (IDENT_ADDR + 0xf9e0000480UL + HOSE(h))
-#endif
-#define MCPCIA_HAE_DENSE(h) (IDENT_ADDR + 0xf9e00004c0UL + HOSE(h))
+#define MCPCIA_REV(m) (MCPCIA_CSR(m) + 0x000)
+#define MCPCIA_WHOAMI(m) (MCPCIA_CSR(m) + 0x040)
+#define MCPCIA_PCI_LAT(m) (MCPCIA_CSR(m) + 0x080)
+#define MCPCIA_CAP_CTRL(m) (MCPCIA_CSR(m) + 0x100)
+#define MCPCIA_HAE_MEM(m) (MCPCIA_CSR(m) + 0x400)
+#define MCPCIA_HAE_IO(m) (MCPCIA_CSR(m) + 0x440)
+#define _MCPCIA_IACK_SC(m) (MCPCIA_CSR(m) + 0x480)
+#define MCPCIA_HAE_DENSE(m) (MCPCIA_CSR(m) + 0x4C0)
/*
* Interrupt Control registers
*/
-#define MCPCIA_INT_CTL(h) (IDENT_ADDR + 0xf9e0000500UL + HOSE(h))
-#define MCPCIA_INT_REQ(h) (IDENT_ADDR + 0xf9e0000540UL + HOSE(h))
-#define MCPCIA_INT_TARG(h) (IDENT_ADDR + 0xf9e0000580UL + HOSE(h))
-#define MCPCIA_INT_ADR(h) (IDENT_ADDR + 0xf9e00005c0UL + HOSE(h))
-#define MCPCIA_INT_ADR_EXT(h) (IDENT_ADDR + 0xf9e0000600UL + HOSE(h))
-#define MCPCIA_INT_MASK0(h) (IDENT_ADDR + 0xf9e0000640UL + HOSE(h))
-#define MCPCIA_INT_MASK1(h) (IDENT_ADDR + 0xf9e0000680UL + HOSE(h))
-#define MCPCIA_INT_ACK0(h) (IDENT_ADDR + 0xf9f0003f00UL + HOSE(h))
-#define MCPCIA_INT_ACK1(h) (IDENT_ADDR + 0xf9e0003f40UL + HOSE(h))
+#define MCPCIA_INT_CTL(m) (MCPCIA_CSR(m) + 0x500)
+#define MCPCIA_INT_REQ(m) (MCPCIA_CSR(m) + 0x540)
+#define MCPCIA_INT_TARG(m) (MCPCIA_CSR(m) + 0x580)
+#define MCPCIA_INT_ADR(m) (MCPCIA_CSR(m) + 0x5C0)
+#define MCPCIA_INT_ADR_EXT(m) (MCPCIA_CSR(m) + 0x600)
+#define MCPCIA_INT_MASK0(m) (MCPCIA_CSR(m) + 0x640)
+#define MCPCIA_INT_MASK1(m) (MCPCIA_CSR(m) + 0x680)
+#define MCPCIA_INT_ACK0(m) (MCPCIA_CSR(m) + 0x10003f00)
+#define MCPCIA_INT_ACK1(m) (MCPCIA_CSR(m) + 0x10003f40)
/*
* Performance Monitor registers
*/
-#define MCPCIA_PERF_MONITOR(h) (IDENT_ADDR + 0xf9e0000300UL + HOSE(h))
-#define MCPCIA_PERF_CONTROL(h) (IDENT_ADDR + 0xf9e0000340UL + HOSE(h))
+#define MCPCIA_PERF_MON(m) (MCPCIA_CSR(m) + 0x300)
+#define MCPCIA_PERF_CONT(m) (MCPCIA_CSR(m) + 0x340)
/*
* Diagnostic Registers
*/
-#define MCPCIA_CAP_DIAG(h) (IDENT_ADDR + 0xf9e0000700UL + HOSE(h))
-#define MCPCIA_TOP_OF_MEM(h) (IDENT_ADDR + 0xf9e00007c0UL + HOSE(h))
+#define MCPCIA_CAP_DIAG(m) (MCPCIA_CSR(m) + 0x700)
+#define MCPCIA_TOP_OF_MEM(m) (MCPCIA_CSR(m) + 0x7C0)
/*
* Error registers
*/
-#define MCPCIA_MC_ERR0(h) (IDENT_ADDR + 0xf9e0000800UL + HOSE(h))
-#define MCPCIA_MC_ERR1(h) (IDENT_ADDR + 0xf9e0000840UL + HOSE(h))
-#define MCPCIA_CAP_ERR(h) (IDENT_ADDR + 0xf9e0000880UL + HOSE(h))
-#define MCPCIA_PCI_ERR1(h) (IDENT_ADDR + 0xf9e0001040UL + HOSE(h))
+#define MCPCIA_MC_ERR0(m) (MCPCIA_CSR(m) + 0x800)
+#define MCPCIA_MC_ERR1(m) (MCPCIA_CSR(m) + 0x840)
+#define MCPCIA_CAP_ERR(m) (MCPCIA_CSR(m) + 0x880)
+#define MCPCIA_PCI_ERR1(m) (MCPCIA_CSR(m) + 0x1040)
+#define MCPCIA_MDPA_STAT(m) (MCPCIA_CSR(m) + 0x4000)
+#define MCPCIA_MDPA_SYN(m) (MCPCIA_CSR(m) + 0x4040)
+#define MCPCIA_MDPA_DIAG(m) (MCPCIA_CSR(m) + 0x4080)
+#define MCPCIA_MDPB_STAT(m) (MCPCIA_CSR(m) + 0x8000)
+#define MCPCIA_MDPB_SYN(m) (MCPCIA_CSR(m) + 0x8040)
+#define MCPCIA_MDPB_DIAG(m) (MCPCIA_CSR(m) + 0x8080)
/*
* PCI Address Translation Registers.
*/
-#define MCPCIA_SG_TBIA(h) (IDENT_ADDR + 0xf9e0001300UL + HOSE(h))
-#define MCPCIA_HBASE(h) (IDENT_ADDR + 0xf9e0001340UL + HOSE(h))
+#define MCPCIA_SG_TBIA(m) (MCPCIA_CSR(m) + 0x1300)
+#define MCPCIA_HBASE(m) (MCPCIA_CSR(m) + 0x1340)
-#define MCPCIA_W0_BASE(h) (IDENT_ADDR + 0xf9e0001400UL + HOSE(h))
-#define MCPCIA_W0_MASK(h) (IDENT_ADDR + 0xf9e0001440UL + HOSE(h))
-#define MCPCIA_T0_BASE(h) (IDENT_ADDR + 0xf9e0001480UL + HOSE(h))
+#define MCPCIA_W0_BASE(m) (MCPCIA_CSR(m) + 0x1400)
+#define MCPCIA_W0_MASK(m) (MCPCIA_CSR(m) + 0x1440)
+#define MCPCIA_T0_BASE(m) (MCPCIA_CSR(m) + 0x1480)
-#define MCPCIA_W1_BASE(h) (IDENT_ADDR + 0xf9e0001500UL + HOSE(h))
-#define MCPCIA_W1_MASK(h) (IDENT_ADDR + 0xf9e0001540UL + HOSE(h))
-#define MCPCIA_T1_BASE(h) (IDENT_ADDR + 0xf9e0001580UL + HOSE(h))
+#define MCPCIA_W1_BASE(m) (MCPCIA_CSR(m) + 0x1500)
+#define MCPCIA_W1_MASK(m) (MCPCIA_CSR(m) + 0x1540)
+#define MCPCIA_T1_BASE(m) (MCPCIA_CSR(m) + 0x1580)
-#define MCPCIA_W2_BASE(h) (IDENT_ADDR + 0xf9e0001600UL + HOSE(h))
-#define MCPCIA_W2_MASK(h) (IDENT_ADDR + 0xf9e0001640UL + HOSE(h))
-#define MCPCIA_T2_BASE(h) (IDENT_ADDR + 0xf9e0001680UL + HOSE(h))
+#define MCPCIA_W2_BASE(m) (MCPCIA_CSR(m) + 0x1600)
+#define MCPCIA_W2_MASK(m) (MCPCIA_CSR(m) + 0x1640)
+#define MCPCIA_T2_BASE(m) (MCPCIA_CSR(m) + 0x1680)
-#define MCPCIA_W3_BASE(h) (IDENT_ADDR + 0xf9e0001700UL + HOSE(h))
-#define MCPCIA_W3_MASK(h) (IDENT_ADDR + 0xf9e0001740UL + HOSE(h))
-#define MCPCIA_T3_BASE(h) (IDENT_ADDR + 0xf9e0001780UL + HOSE(h))
+#define MCPCIA_W3_BASE(m) (MCPCIA_CSR(m) + 0x1700)
+#define MCPCIA_W3_MASK(m) (MCPCIA_CSR(m) + 0x1740)
+#define MCPCIA_T3_BASE(m) (MCPCIA_CSR(m) + 0x1780)
-/*
- * Memory spaces:
+/* Hack! Only words for bus 0. */
+
+#if !MCPCIA_ONE_HAE_WINDOW
+#define MCPCIA_HAE_ADDRESS MCPCIA_HAE_MEM(4)
+#endif
+#define MCPCIA_IACK_SC _MCPCIA_IACK_SC(4)
+
+/*
+ * The canonical non-remaped I/O and MEM addresses have these values
+ * subtracted out. This is arranged so that folks manipulating ISA
+ * devices can use their familiar numbers and have them map to bus 0.
*/
-#define MCPCIA_CONF(h) (IDENT_ADDR + 0xf9c0000000UL + HOSE(h))
-#define MCPCIA_IO(h) (IDENT_ADDR + 0xf980000000UL + HOSE(h))
-#define MCPCIA_SPARSE(h) (IDENT_ADDR + 0xf800000000UL + HOSE(h))
-#define MCPCIA_DENSE(h) (IDENT_ADDR + 0xf900000000UL + HOSE(h))
-#define _MCPCIA_IACK_SC(h) (IDENT_ADDR + 0xf9f0003f00UL + HOSE(h))
-#define MCPCIA_HAE_ADDRESS MCPCIA_HAE_MEM(0)
-#define MCPCIA_IACK_SC _MCPCIA_IACK_SC(0)
+#define MCPCIA_IO_BIAS MCPCIA_IO(4)
+#define MCPCIA_MEM_BIAS MCPCIA_DENSE(4)
+
/*
* Data structure for handling MCPCIA machine checks:
*/
struct el_MCPCIA_uncorrected_frame_mcheck {
- struct el_common header;
- struct el_common_EV5_uncorrectable_mcheck procdata;
+ struct el_common header;
+ struct el_common_EV5_uncorrectable_mcheck procdata;
};
@@ -215,91 +229,81 @@ __EXTERN_INLINE void * mcpcia_bus_to_virt(unsigned long address)
#define vuip volatile unsigned int *
#define vulp volatile unsigned long *
-#if 0 /* BWIO */
-__EXTERN_INLINE unsigned int mcpcia_bw_inb(unsigned long addr)
-{
- return __kernel_ldbu(*(vucp)(addr+MCPCIA_BW_IO));
-}
-
-__EXTERN_INLINE void mcpcia_bw_outb(unsigned char b, unsigned long addr)
+__EXTERN_INLINE unsigned int mcpcia_inb(unsigned long in_addr)
{
- __kernel_stb(b, *(vucp)(addr+MCPCIA_BW_IO));
- mb();
-}
+ unsigned long addr, hose, result;
-__EXTERN_INLINE unsigned int mcpcia_bw_inw(unsigned long addr)
-{
- return __kernel_ldwu(*(vusp)(addr+MCPCIA_BW_IO));
-}
+ addr = in_addr & 0xffffUL;
+ hose = in_addr & ~0xffffUL;
-__EXTERN_INLINE void mcpcia_bw_outw(unsigned short b, unsigned long addr)
-{
- __kernel_stw(b, *(vusp)(addr+MCPCIA_BW_IO));
- mb();
-}
+ /* ??? I wish I could get rid of this. But there's no ioremap
+ equivalent for I/O space. PCI I/O can be forced into the
+ correct hose's I/O region, but that doesn't take care of
+ legacy ISA crap. */
+ hose += MCPCIA_IO_BIAS;
-__EXTERN_INLINE unsigned int mcpcia_bw_inl(unsigned long addr)
-{
- return *(vuip)(addr+MCPCIA_BW_IO);
-}
-
-__EXTERN_INLINE void mcpcia_bw_outl(unsigned int b, unsigned long addr)
-{
- *(vuip)(addr+MCPCIA_BW_IO) = b;
- mb();
-}
-#endif
-
-__EXTERN_INLINE unsigned int mcpcia_inb(unsigned long in_addr)
-{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- long result = *(vip) ((addr << 5) + MCPCIA_IO(hose) + 0x00);
+ result = *(vip) ((addr << 5) + hose + 0x00);
return __kernel_extbl(result, addr & 3);
}
__EXTERN_INLINE void mcpcia_outb(unsigned char b, unsigned long in_addr)
{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- unsigned long w;
+ unsigned long addr, hose, w;
+
+ addr = in_addr & 0xffffUL;
+ hose = in_addr & ~0xffffUL;
+ hose += MCPCIA_IO_BIAS;
w = __kernel_insbl(b, addr & 3);
- *(vuip) ((addr << 5) + MCPCIA_IO(hose) + 0x00) = w;
+ *(vuip) ((addr << 5) + hose + 0x00) = w;
mb();
}
__EXTERN_INLINE unsigned int mcpcia_inw(unsigned long in_addr)
{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- long result = *(vip) ((addr << 5) + MCPCIA_IO(hose) + 0x08);
+ unsigned long addr, hose, result;
+
+ addr = in_addr & 0xffffUL;
+ hose = in_addr & ~0xffffUL;
+ hose += MCPCIA_IO_BIAS;
+
+ result = *(vip) ((addr << 5) + hose + 0x08);
return __kernel_extwl(result, addr & 3);
}
__EXTERN_INLINE void mcpcia_outw(unsigned short b, unsigned long in_addr)
{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- unsigned long w;
+ unsigned long addr, hose, w;
+
+ addr = in_addr & 0xffffUL;
+ hose = in_addr & ~0xffffUL;
+ hose += MCPCIA_IO_BIAS;
w = __kernel_inswl(b, addr & 3);
- *(vuip) ((addr << 5) + MCPCIA_IO(hose) + 0x08) = w;
+ *(vuip) ((addr << 5) + hose + 0x08) = w;
mb();
}
__EXTERN_INLINE unsigned int mcpcia_inl(unsigned long in_addr)
{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- return *(vuip) ((addr << 5) + MCPCIA_IO(hose) + 0x18);
+ unsigned long addr, hose;
+
+ addr = in_addr & 0xffffUL;
+ hose = in_addr & ~0xffffUL;
+ hose += MCPCIA_IO_BIAS;
+
+ return *(vuip) ((addr << 5) + hose + 0x18);
}
__EXTERN_INLINE void mcpcia_outl(unsigned int b, unsigned long in_addr)
{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- *(vuip) ((addr << 5) + MCPCIA_IO(hose) + 0x18) = b;
+ unsigned long addr, hose;
+
+ addr = in_addr & 0xffffUL;
+ hose = in_addr & ~0xffffUL;
+ hose += MCPCIA_IO_BIAS;
+
+ *(vuip) ((addr << 5) + hose + 0x18) = b;
mb();
}
@@ -307,8 +311,8 @@ __EXTERN_INLINE void mcpcia_outl(unsigned int b, unsigned long in_addr)
/*
* Memory functions. 64-bit and 32-bit accesses are done through
* dense memory space, everything else through sparse space.
- *
- * For reading and writing 8 and 16 bit quantities we need to
+ *
+ * For reading and writing 8 and 16 bit quantities we need to
* go through one of the three sparse address mapping regions
* and use the HAE_MEM CSR to provide some bits of the address.
* The following few routines use only sparse address region 1
@@ -317,10 +321,10 @@ __EXTERN_INLINE void mcpcia_outl(unsigned int b, unsigned long in_addr)
* See p 6-17 of the specification but it looks something like this:
*
* 21164 Address:
- *
+ *
* 3 2 1
* 9876543210987654321098765432109876543210
- * 1ZZZZ0.PCI.QW.Address............BBLL
+ * 1ZZZZ0.PCI.QW.Address............BBLL
*
* ZZ = SBZ
* BB = Byte offset
@@ -333,125 +337,34 @@ __EXTERN_INLINE void mcpcia_outl(unsigned int b, unsigned long in_addr)
* HHH....PCI.QW.Address........ 00
*
* HHH = 31:29 HAE_MEM CSR
- *
+ *
*/
-#if 0 /* BWIO */
-__EXTERN_INLINE unsigned long mcpcia_bw_readb(unsigned long addr)
-{
- return __kernel_ldbu(*(vucp)(addr+MCPCIA_BW_MEM));
-}
-
-__EXTERN_INLINE unsigned long mcpcia_bw_readw(unsigned long addr)
-{
- return __kernel_ldbw(*(vusp)(addr+MCPCIA_BW_MEM));
-}
-
-__EXTERN_INLINE unsigned long mcpcia_bw_readl(unsigned long addr)
-{
- return *(vuip)(addr + MCPCIA_BW_MEM);
-}
-
-__EXTERN_INLINE unsigned long mcpcia_bw_readq(unsigned long addr)
-{
- return *(vulp)(addr + MCPCIA_BW_MEM);
-}
-
-__EXTERN_INLINE void mcpcia_bw_writeb(unsigned char b, unsigned long addr)
-{
- __kernel_stb(b, *(vucp)(addr+MCPCIA_BW_MEM));
-}
-
-__EXTERN_INLINE void mcpcia_bw_writew(unsigned short b, unsigned long addr)
-{
- __kernel_stw(b, *(vusp)(addr+MCPCIA_BW_MEM));
-}
-
-__EXTERN_INLINE void mcpcia_bw_writel(unsigned int b, unsigned long addr)
-{
- *(vuip)(addr+MCPCIA_BW_MEM) = b;
-}
-
-__EXTERN_INLINE void mcpcia_bw_writeq(unsigned long b, unsigned long addr)
+__EXTERN_INLINE unsigned long mcpcia_ioremap(unsigned long addr)
{
- *(vulp)(addr+MCPCIA_BW_MEM) = b;
+ return addr + MCPCIA_MEM_BIAS;
}
-#endif
-__EXTERN_INLINE unsigned long mcpcia_srm_base(unsigned long addr)
+__EXTERN_INLINE int mcpcia_is_ioaddr(unsigned long addr)
{
- unsigned long mask, base;
- unsigned long hose = (addr >> 32) & 3;
-
- if (addr >= alpha_mv.sm_base_r1
- && addr <= alpha_mv.sm_base_r1 + MCPCIA_MEM_MASK) {
- mask = MCPCIA_MEM_MASK;
- base = MCPCIA_SPARSE(hose);
- }
- else
- {
-#if 0
- printk("mcpcia: address 0x%lx not covered by HAE\n", addr);
-#endif
- return 0;
- }
-
- return ((addr & mask) << 5) + base;
-}
-
-__EXTERN_INLINE unsigned long mcpcia_srm_readb(unsigned long addr)
-{
- unsigned long result, work;
-
- if ((work = mcpcia_srm_base(addr)) == 0)
- return 0xff;
- work += 0x00; /* add transfer length */
-
- result = *(vip) work;
- return __kernel_extbl(result, addr & 3);
-}
-
-__EXTERN_INLINE unsigned long mcpcia_srm_readw(unsigned long addr)
-{
- unsigned long result, work;
-
- if ((work = mcpcia_srm_base(addr)) == 0)
- return 0xffff;
- work += 0x08; /* add transfer length */
-
- result = *(vip) work;
- return __kernel_extwl(result, addr & 3);
-}
-
-__EXTERN_INLINE void mcpcia_srm_writeb(unsigned char b, unsigned long addr)
-{
- unsigned long work = mcpcia_srm_base(addr);
- if (work) {
- work += 0x00; /* add transfer length */
- *(vuip) work = b * 0x01010101;
- }
-}
-
-__EXTERN_INLINE void mcpcia_srm_writew(unsigned short b, unsigned long addr)
-{
- unsigned long work = mcpcia_srm_base(addr);
- if (work) {
- work += 0x08; /* add transfer length */
- *(vuip) work = b * 0x00010001;
- }
+ return addr >= MCPCIA_SPARSE(0);
}
__EXTERN_INLINE unsigned long mcpcia_readb(unsigned long in_addr)
{
unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- unsigned long result, msb, work, temp;
+ unsigned long hose = in_addr & ~0xffffffffUL;
+ unsigned long result, work;
+#if !MCPCIA_ONE_HAE_WINDOW
+ unsigned long msb;
msb = addr & ~MCPCIA_MEM_MASK;
- temp = addr & MCPCIA_MEM_MASK;
set_hae(msb);
+#endif
+ addr = addr & MCPCIA_MEM_MASK;
- work = ((temp << 5) + MCPCIA_SPARSE(hose) + 0x00);
+ hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4);
+ work = ((addr << 5) + hose + 0x00);
result = *(vip) work;
return __kernel_extbl(result, addr & 3);
}
@@ -459,14 +372,18 @@ __EXTERN_INLINE unsigned long mcpcia_readb(unsigned long in_addr)
__EXTERN_INLINE unsigned long mcpcia_readw(unsigned long in_addr)
{
unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- unsigned long result, msb, work, temp;
+ unsigned long hose = in_addr & ~0xffffffffUL;
+ unsigned long result, work;
+#if !MCPCIA_ONE_HAE_WINDOW
+ unsigned long msb;
msb = addr & ~MCPCIA_MEM_MASK;
- temp = addr & MCPCIA_MEM_MASK ;
set_hae(msb);
+#endif
+ addr = addr & MCPCIA_MEM_MASK;
- work = ((temp << 5) + MCPCIA_SPARSE(hose) + 0x08);
+ hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4);
+ work = ((addr << 5) + hose + 0x08);
result = *(vip) work;
return __kernel_extwl(result, addr & 3);
}
@@ -474,62 +391,57 @@ __EXTERN_INLINE unsigned long mcpcia_readw(unsigned long in_addr)
__EXTERN_INLINE void mcpcia_writeb(unsigned char b, unsigned long in_addr)
{
unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- unsigned long msb;
+ unsigned long hose = in_addr & ~0xffffffffUL;
+ unsigned long w;
+#if !MCPCIA_ONE_HAE_WINDOW
+ unsigned long msb;
msb = addr & ~MCPCIA_MEM_MASK;
- addr &= MCPCIA_MEM_MASK;
set_hae(msb);
+#endif
+ addr = addr & MCPCIA_MEM_MASK;
- *(vuip) ((addr << 5) + MCPCIA_SPARSE(hose) + 0x00) = b * 0x01010101;
+ w = __kernel_insbl(b, in_addr & 3);
+ hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4);
+ *(vuip) ((addr << 5) + hose + 0x00) = w;
}
__EXTERN_INLINE void mcpcia_writew(unsigned short b, unsigned long in_addr)
{
unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- unsigned long msb ;
+ unsigned long hose = in_addr & ~0xffffffffUL;
+ unsigned long w;
- msb = addr & ~MCPCIA_MEM_MASK ;
- addr &= MCPCIA_MEM_MASK ;
+#if !MCPCIA_ONE_HAE_WINDOW
+ unsigned long msb;
+ msb = addr & ~MCPCIA_MEM_MASK;
set_hae(msb);
+#endif
+ addr = addr & MCPCIA_MEM_MASK;
- *(vuip) ((addr << 5) + MCPCIA_SPARSE(hose) + 0x08) = b * 0x00010001;
-}
-
-__EXTERN_INLINE unsigned long mcpcia_readl(unsigned long in_addr)
-{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- return *(vuip) (addr + MCPCIA_DENSE(hose));
+ w = __kernel_inswl(b, in_addr & 3);
+ hose = hose - MCPCIA_DENSE(4) + MCPCIA_SPARSE(4);
+ *(vuip) ((addr << 5) + hose + 0x08) = w;
}
-__EXTERN_INLINE unsigned long mcpcia_readq(unsigned long in_addr)
+__EXTERN_INLINE unsigned long mcpcia_readl(unsigned long addr)
{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- return *(vulp) (addr + MCPCIA_DENSE(hose));
+ return *(vuip)addr;
}
-__EXTERN_INLINE void mcpcia_writel(unsigned int b, unsigned long in_addr)
+__EXTERN_INLINE unsigned long mcpcia_readq(unsigned long addr)
{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- *(vuip) (addr + MCPCIA_DENSE(hose)) = b;
+ return *(vulp)addr;
}
-__EXTERN_INLINE void mcpcia_writeq(unsigned long b, unsigned long in_addr)
+__EXTERN_INLINE void mcpcia_writel(unsigned int b, unsigned long addr)
{
- unsigned long addr = in_addr & 0xffffffffUL;
- unsigned long hose = (in_addr >> 32) & 3;
- *(vulp) (addr + MCPCIA_DENSE(hose)) = b;
+ *(vuip)addr = b;
}
-/* Find the DENSE memory area for a given bus address. */
-
-__EXTERN_INLINE unsigned long mcpcia_dense_mem(unsigned long addr)
+__EXTERN_INLINE void mcpcia_writeq(unsigned long b, unsigned long addr)
{
- return MCPCIA_DENSE((addr >> 32) & 3);
+ *(vulp)addr = b;
}
#undef vucp
@@ -543,69 +455,32 @@ __EXTERN_INLINE unsigned long mcpcia_dense_mem(unsigned long addr)
#define virt_to_bus mcpcia_virt_to_bus
#define bus_to_virt mcpcia_bus_to_virt
-#if 0 /* BWIO */
-# define __inb mcpcia_bw_inb
-# define __inw mcpcia_bw_inw
-# define __inl mcpcia_bw_inl
-# define __outb mcpcia_bw_outb
-# define __outw mcpcia_bw_outw
-# define __outl mcpcia_bw_outl
-# define __readb mcpcia_bw_readb
-# define __readw mcpcia_bw_readw
-# define __writeb mcpcia_bw_writeb
-# define __writew mcpcia_bw_writew
-# define __readl mcpcia_bw_readl
-# define __readq mcpcia_bw_readq
-# define __writel mcpcia_bw_writel
-# define __writeq mcpcia_bw_writeq
-#else
-# define __inb mcpcia_inb
-# define __inw mcpcia_inw
-# define __inl mcpcia_inl
-# define __outb mcpcia_outb
-# define __outw mcpcia_outw
-# define __outl mcpcia_outl
-# ifdef CONFIG_ALPHA_SRM_SETUP
-# define __readb mcpcia_srm_readb
-# define __readw mcpcia_srm_readw
-# define __writeb mcpcia_srm_writeb
-# define __writew mcpcia_srm_writew
-# else
-# define __readb mcpcia_readb
-# define __readw mcpcia_readw
-# define __writeb mcpcia_writeb
-# define __writew mcpcia_writew
-# endif
-# define __readl mcpcia_readl
-# define __readq mcpcia_readq
-# define __writel mcpcia_writel
-# define __writeq mcpcia_writeq
-#endif /* BWIO */
-
-#define dense_mem mcpcia_dense_mem
-
-#if 0 /* BWIO */
-# define inb(port) __inb((port))
-# define inw(port) __inw((port))
-# define inl(port) __inl((port))
-# define outb(x, port) __outb((x),(port))
-# define outw(x, port) __outw((x),(port))
-# define outl(x, port) __outl((x),(port))
-# define readb(addr) __readb((addr))
-# define readw(addr) __readw((addr))
-# define writeb(b, addr) __writeb((b),(addr))
-# define writew(b, addr) __writew((b),(addr))
-#else
+#define __inb mcpcia_inb
+#define __inw mcpcia_inw
+#define __inl mcpcia_inl
+#define __outb mcpcia_outb
+#define __outw mcpcia_outw
+#define __outl mcpcia_outl
+#define __readb mcpcia_readb
+#define __readw mcpcia_readw
+#define __writeb mcpcia_writeb
+#define __writew mcpcia_writew
+#define __readl mcpcia_readl
+#define __readq mcpcia_readq
+#define __writel mcpcia_writel
+#define __writeq mcpcia_writeq
+#define __ioremap mcpcia_ioremap
+#define __is_ioaddr mcpcia_is_ioaddr
+
# define inb(port) \
(__builtin_constant_p((port))?__inb(port):_inb(port))
# define outb(x, port) \
(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-#endif /* BWIO */
-#define readl(a) __readl((unsigned long)(a))
-#define readq(a) __readq((unsigned long)(a))
-#define writel(v,a) __writel((v),(unsigned long)(a))
-#define writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __raw_readl(a) __readl((unsigned long)(a))
+#define __raw_readq(a) __readq((unsigned long)(a))
+#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
+#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_polaris.h b/include/asm-alpha/core_polaris.h
index 8caf50622..da53edc22 100644
--- a/include/asm-alpha/core_polaris.h
+++ b/include/asm-alpha/core_polaris.h
@@ -1,7 +1,6 @@
#ifndef __ALPHA_POLARIS__H__
#define __ALPHA_POLARIS__H__
-#include <linux/config.h>
#include <linux/types.h>
#include <asm/compiler.h>
@@ -19,38 +18,31 @@
*/
/* Polaris memory regions */
-#define POLARIS_SPARSE_MEM_BASE (IDENT_ADDR + 0xf800000000)
-#define POLARIS_DENSE_MEM_BASE (IDENT_ADDR + 0xf900000000)
-#define POLARIS_SPARSE_IO_BASE (IDENT_ADDR + 0xf980000000)
-#define POLARIS_SPARSE_CONFIG_BASE (IDENT_ADDR + 0xf9c0000000)
-#define POLARIS_IACK_BASE (IDENT_ADDR + 0xf9f8000000)
-#define POLARIS_DENSE_IO_BASE (IDENT_ADDR + 0xf9fc000000)
-#define POLARIS_DENSE_CONFIG_BASE (IDENT_ADDR + 0xf9fe000000)
+#define POLARIS_SPARSE_MEM_BASE (IDENT_ADDR + 0xf800000000)
+#define POLARIS_DENSE_MEM_BASE (IDENT_ADDR + 0xf900000000)
+#define POLARIS_SPARSE_IO_BASE (IDENT_ADDR + 0xf980000000)
+#define POLARIS_SPARSE_CONFIG_BASE (IDENT_ADDR + 0xf9c0000000)
+#define POLARIS_IACK_BASE (IDENT_ADDR + 0xf9f8000000)
+#define POLARIS_DENSE_IO_BASE (IDENT_ADDR + 0xf9fc000000)
+#define POLARIS_DENSE_CONFIG_BASE (IDENT_ADDR + 0xf9fe000000)
-#define POLARIS_IACK_SC POLARIS_IACK_BASE
+#define POLARIS_IACK_SC POLARIS_IACK_BASE
/* The Polaris command/status registers live in PCI Config space for
* bus 0/device 0. As such, they may be bytes, words, or doublewords.
*/
-#define POLARIS_W_VENID (POLARIS_DENSE_CONFIG_BASE)
-#define POLARIS_W_DEVID (POLARIS_DENSE_CONFIG_BASE+2)
-#define POLARIS_W_CMD (POLARIS_DENSE_CONFIG_BASE+4)
-#define POLARIS_W_STATUS (POLARIS_DENSE_CONFIG_BASE+6)
+#define POLARIS_W_VENID (POLARIS_DENSE_CONFIG_BASE)
+#define POLARIS_W_DEVID (POLARIS_DENSE_CONFIG_BASE+2)
+#define POLARIS_W_CMD (POLARIS_DENSE_CONFIG_BASE+4)
+#define POLARIS_W_STATUS (POLARIS_DENSE_CONFIG_BASE+6)
/* No HAE address. Polaris has no concept of an HAE, since it
* supports transfers of all sizes in dense space.
*/
-#define POLARIS_DMA_WIN_BASE_DEFAULT 0x80000000 /* fixed, 2G @ 2G */
-#define POLARIS_DMA_WIN_SIZE_DEFAULT 0x80000000 /* fixed, 2G @ 2G */
+#define POLARIS_DMA_WIN_BASE 0x80000000UL /* fixed, 2G @ 2G */
+#define POLARIS_DMA_WIN_SIZE 0x80000000UL /* fixed, 2G @ 2G */
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define POLARIS_DMA_WIN_BASE alpha_mv.dma_win_base
-#define POLARIS_DMA_WIN_SIZE alpha_mv.dma_win_size
-#else
-#define POLARIS_DMA_WIN_BASE POLARIS_DMA_WIN_BASE_DEFAULT
-#define POLARIS_DMA_WIN_SIZE POLARIS_DMA_WIN_SIZE_DEFAULT
-#endif
/*
* Data structure for handling POLARIS machine checks:
@@ -62,7 +54,7 @@ struct el_POLARIS_sysdata_mcheck {
u_long psc_pcictl2;
};
- #ifdef __KERNEL__
+#ifdef __KERNEL__
#ifndef __EXTERN_INLINE
#define __EXTERN_INLINE extern inline
@@ -96,7 +88,12 @@ __EXTERN_INLINE void * polaris_bus_to_virt(unsigned long address)
__EXTERN_INLINE unsigned int polaris_inb(unsigned long addr)
{
- return __kernel_ldbu(*(vucp)(addr + POLARIS_DENSE_IO_BASE));
+ /* ??? I wish I could get rid of this. But there's no ioremap
+ equivalent for I/O space. PCI I/O can be forced into the
+ POLARIS I/O region, but that doesn't take care of legacy
+ ISA crap. */
+
+ return __kernel_ldbu(*(vucp)(addr + POLARIS_DENSE_IO_BASE));
}
__EXTERN_INLINE void polaris_outb(unsigned char b, unsigned long addr)
@@ -107,7 +104,7 @@ __EXTERN_INLINE void polaris_outb(unsigned char b, unsigned long addr)
__EXTERN_INLINE unsigned int polaris_inw(unsigned long addr)
{
- return __kernel_ldwu(*(vusp)(addr + POLARIS_DENSE_IO_BASE));
+ return __kernel_ldwu(*(vusp)(addr + POLARIS_DENSE_IO_BASE));
}
__EXTERN_INLINE void polaris_outw(unsigned short b, unsigned long addr)
@@ -118,13 +115,13 @@ __EXTERN_INLINE void polaris_outw(unsigned short b, unsigned long addr)
__EXTERN_INLINE unsigned int polaris_inl(unsigned long addr)
{
- return *(vuip)(addr + POLARIS_DENSE_IO_BASE);
+ return *(vuip)(addr + POLARIS_DENSE_IO_BASE);
}
__EXTERN_INLINE void polaris_outl(unsigned int b, unsigned long addr)
{
- *(vuip)(addr + POLARIS_DENSE_IO_BASE) = b;
- mb();
+ *(vuip)(addr + POLARIS_DENSE_IO_BASE) = b;
+ mb();
}
/*
@@ -136,53 +133,52 @@ __EXTERN_INLINE void polaris_outl(unsigned int b, unsigned long addr)
__EXTERN_INLINE unsigned long polaris_readb(unsigned long addr)
{
- return __kernel_ldbu(*(vucp)(addr + POLARIS_DENSE_MEM_BASE));
+ return __kernel_ldbu(*(vucp)addr);
}
__EXTERN_INLINE unsigned long polaris_readw(unsigned long addr)
{
- return __kernel_ldwu(*(vusp)(addr + POLARIS_DENSE_MEM_BASE));
+ return __kernel_ldwu(*(vusp)addr);
}
__EXTERN_INLINE unsigned long polaris_readl(unsigned long addr)
{
- return *(vuip)(addr + POLARIS_DENSE_MEM_BASE);
+ return *(vuip)addr;
}
__EXTERN_INLINE unsigned long polaris_readq(unsigned long addr)
{
- return *(vulp)(addr + POLARIS_DENSE_MEM_BASE);
+ return *(vulp)addr;
}
__EXTERN_INLINE void polaris_writeb(unsigned char b, unsigned long addr)
{
- __kernel_stb(b, *(vucp)(addr + POLARIS_DENSE_MEM_BASE));
- mb();
+ __kernel_stb(b, *(vucp)addr);
}
__EXTERN_INLINE void polaris_writew(unsigned short b, unsigned long addr)
{
- __kernel_stw(b, *(vusp)(addr + POLARIS_DENSE_MEM_BASE));
- mb();
+ __kernel_stw(b, *(vusp)addr);
}
__EXTERN_INLINE void polaris_writel(unsigned int b, unsigned long addr)
{
- *(vuip)(addr + POLARIS_DENSE_MEM_BASE) = b;
- mb();
+ *(vuip)addr = b;
}
__EXTERN_INLINE void polaris_writeq(unsigned long b, unsigned long addr)
{
- *(vulp)(addr + POLARIS_DENSE_MEM_BASE) = b;
- mb();
+ *(vulp)addr = b;
}
-/* Find the DENSE memory area for a given bus address. */
+__EXTERN_INLINE unsigned long polaris_ioremap(unsigned long addr)
+{
+ return addr + POLARIS_DENSE_MEM_BASE;
+}
-__EXTERN_INLINE unsigned long polaris_dense_mem(unsigned long addr)
+__EXTERN_INLINE int polaris_is_ioaddr(unsigned long addr)
{
- return POLARIS_DENSE_MEM_BASE;
+ return addr >= POLARIS_SPARSE_MEM_BASE;
}
#undef vucp
@@ -209,25 +205,24 @@ __EXTERN_INLINE unsigned long polaris_dense_mem(unsigned long addr)
#define __readq polaris_readq
#define __writel polaris_writel
#define __writeq polaris_writeq
-#define dense_mem polaris_dense_mem
-
-#define inb(port) __inb((port))
-#define inw(port) __inw((port))
-#define inl(port) __inl((port))
-
-#define outb(v, port) __outb((v),(port))
-#define outw(v, port) __outw((v),(port))
-#define outl(v, port) __outl((v),(port))
-
-#define readb(a) __readb((unsigned long)(a))
-#define readw(a) __readw((unsigned long)(a))
-#define readl(a) __readl((unsigned long)(a))
-#define readq(a) __readq((unsigned long)(a))
-
-#define writeb(v,a) __writeb((v),(unsigned long)(a))
-#define writew(v,a) __writew((v),(unsigned long)(a))
-#define writel(v,a) __writel((v),(unsigned long)(a))
-#define writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __ioremap polaris_ioremap
+#define __is_ioaddr polaris_is_ioaddr
+
+#define inb(port) __inb((port))
+#define inw(port) __inw((port))
+#define inl(port) __inl((port))
+#define outb(v, port) __outb((v),(port))
+#define outw(v, port) __outw((v),(port))
+#define outl(v, port) __outl((v),(port))
+
+#define __raw_readb(a) __readb((unsigned long)(a))
+#define __raw_readw(a) __readw((unsigned long)(a))
+#define __raw_readl(a) __readl((unsigned long)(a))
+#define __raw_readq(a) __readq((unsigned long)(a))
+#define __raw_writeb(v,a) __writeb((v),(unsigned long)(a))
+#define __raw_writew(v,a) __writew((v),(unsigned long)(a))
+#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
+#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_pyxis.h b/include/asm-alpha/core_pyxis.h
index 213adf4ba..efdcd7d43 100644
--- a/include/asm-alpha/core_pyxis.h
+++ b/include/asm-alpha/core_pyxis.h
@@ -1,7 +1,6 @@
#ifndef __ALPHA_PYXIS__H__
#define __ALPHA_PYXIS__H__
-#include <linux/config.h>
#include <linux/types.h>
#include <asm/compiler.h>
@@ -34,19 +33,17 @@
**------------------------------------------------------------------------*/
-/* CIA ADDRESS BIT DEFINITIONS
- *
- * 3 3 3 3|3 3 3 3|3 3 2 2|2 2 2 2|2 2 2 2|1 1 1 1|1 1 1 1|1 1
- * 9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0|9 8 7 6|5 4 3 2|1 0 9 8|7 6 5 4|3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |1| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |0|0|0|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | \_/ \_/
- * | | |
- * +-- IO space, not cached. Byte Enable --+ |
- * Transfer Length --+
- *
+/* PYXIS ADDRESS BIT DEFINITIONS
*
+ * 3333 3333 3322 2222 2222 1111 1111 11
+ * 9876 5432 1098 7654 3210 9876 5432 1098 7654 3210
+ * ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ * 1 000
+ * ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
+ * | |\|
+ * | Byte Enable --+ |
+ * | Transfer Length --+
+ * +-- IO space, not cached
*
* Byte Transfer
* Enable Length Transfer Byte Address
@@ -74,16 +71,19 @@
#define PYXIS_MEM_R2_MASK 0x07ffffff /* SPARSE Mem region 2 mask is 27 bits */
#define PYXIS_MEM_R3_MASK 0x03ffffff /* SPARSE Mem region 3 mask is 26 bits */
-#define PYXIS_DMA_WIN_BASE_DEFAULT (1024*1024*1024)
-#define PYXIS_DMA_WIN_SIZE_DEFAULT (1024*1024*1024)
+#define PYXIS_DMA_WIN_BASE (1UL*1024*1024*1024)
+#define PYXIS_DMA_WIN_SIZE (2UL*1024*1024*1024)
+
+/* Window 0 at 1GB size 1GB mapping 0 */
+#define PYXIS_DMA_WIN0_BASE_DEFAULT (1UL*1024*1024*1024)
+#define PYXIS_DMA_WIN0_SIZE_DEFAULT (1UL*1024*1024*1024)
+#define PYXIS_DMA_WIN0_TRAN_DEFAULT (0UL)
+
+/* Window 0 at 2GB size 1GB mapping 1GB */
+#define PYXIS_DMA_WIN1_BASE_DEFAULT (2UL*1024*1024*1024)
+#define PYXIS_DMA_WIN1_SIZE_DEFAULT (1UL*1024*1024*1024)
+#define PYXIS_DMA_WIN1_TRAN_DEFAULT (1UL*1024*1024*1024)
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define PYXIS_DMA_WIN_BASE alpha_mv.dma_win_base
-#define PYXIS_DMA_WIN_SIZE alpha_mv.dma_win_size
-#else
-#define PYXIS_DMA_WIN_BASE PYXIS_DMA_WIN_BASE_DEFAULT
-#define PYXIS_DMA_WIN_SIZE PYXIS_DMA_WIN_SIZE_DEFAULT
-#endif
/*
* General Registers
@@ -203,47 +203,47 @@
* Data structure for handling PYXIS machine checks:
*/
struct el_PYXIS_sysdata_mcheck {
- u_long coma_gcr;
- u_long coma_edsr;
- u_long coma_ter;
- u_long coma_elar;
- u_long coma_ehar;
- u_long coma_ldlr;
- u_long coma_ldhr;
- u_long coma_base0;
- u_long coma_base1;
- u_long coma_base2;
- u_long coma_cnfg0;
- u_long coma_cnfg1;
- u_long coma_cnfg2;
- u_long epic_dcsr;
- u_long epic_pear;
- u_long epic_sear;
- u_long epic_tbr1;
- u_long epic_tbr2;
- u_long epic_pbr1;
- u_long epic_pbr2;
- u_long epic_pmr1;
- u_long epic_pmr2;
- u_long epic_harx1;
- u_long epic_harx2;
- u_long epic_pmlt;
- u_long epic_tag0;
- u_long epic_tag1;
- u_long epic_tag2;
- u_long epic_tag3;
- u_long epic_tag4;
- u_long epic_tag5;
- u_long epic_tag6;
- u_long epic_tag7;
- u_long epic_data0;
- u_long epic_data1;
- u_long epic_data2;
- u_long epic_data3;
- u_long epic_data4;
- u_long epic_data5;
- u_long epic_data6;
- u_long epic_data7;
+ u_long coma_gcr;
+ u_long coma_edsr;
+ u_long coma_ter;
+ u_long coma_elar;
+ u_long coma_ehar;
+ u_long coma_ldlr;
+ u_long coma_ldhr;
+ u_long coma_base0;
+ u_long coma_base1;
+ u_long coma_base2;
+ u_long coma_cnfg0;
+ u_long coma_cnfg1;
+ u_long coma_cnfg2;
+ u_long epic_dcsr;
+ u_long epic_pear;
+ u_long epic_sear;
+ u_long epic_tbr1;
+ u_long epic_tbr2;
+ u_long epic_pbr1;
+ u_long epic_pbr2;
+ u_long epic_pmr1;
+ u_long epic_pmr2;
+ u_long epic_harx1;
+ u_long epic_harx2;
+ u_long epic_pmlt;
+ u_long epic_tag0;
+ u_long epic_tag1;
+ u_long epic_tag2;
+ u_long epic_tag3;
+ u_long epic_tag4;
+ u_long epic_tag5;
+ u_long epic_tag6;
+ u_long epic_tag7;
+ u_long epic_data0;
+ u_long epic_data1;
+ u_long epic_data2;
+ u_long epic_data3;
+ u_long epic_data4;
+ u_long epic_data5;
+ u_long epic_data6;
+ u_long epic_data7;
};
@@ -285,77 +285,40 @@ __EXTERN_INLINE void * pyxis_bus_to_virt(unsigned long address)
#define vuip volatile unsigned int *
#define vulp volatile unsigned long *
-__EXTERN_INLINE unsigned int pyxis_bw_inb(unsigned long addr)
-{
- return __kernel_ldbu(*(vucp)(addr+PYXIS_BW_IO));
-}
-
-__EXTERN_INLINE void pyxis_bw_outb(unsigned char b, unsigned long addr)
-{
- __kernel_stb(b, *(vucp)(addr+PYXIS_BW_IO));
- mb();
-}
-
-__EXTERN_INLINE unsigned int pyxis_bw_inw(unsigned long addr)
-{
- return __kernel_ldwu(*(vusp)(addr+PYXIS_BW_IO));
-}
-
-__EXTERN_INLINE void pyxis_bw_outw(unsigned short b, unsigned long addr)
-{
- __kernel_stw(b, *(vusp)(addr+PYXIS_BW_IO));
- mb();
-}
-
-__EXTERN_INLINE unsigned int pyxis_bw_inl(unsigned long addr)
-{
- return *(vuip)(addr+PYXIS_BW_IO);
-}
-
-__EXTERN_INLINE void pyxis_bw_outl(unsigned int b, unsigned long addr)
-{
- *(vuip)(addr+PYXIS_BW_IO) = b;
- mb();
-}
-
__EXTERN_INLINE unsigned int pyxis_inb(unsigned long addr)
{
- long result = *(vip) ((addr << 5) + PYXIS_IO + 0x00);
- return __kernel_extbl(result, addr & 3);
+ /* ??? I wish I could get rid of this. But there's no ioremap
+ equivalent for I/O space. PCI I/O can be forced into the
+ PYXIS I/O region, but that doesn't take care of legacy ISA crap. */
+
+ return __kernel_ldbu(*(vucp)(addr+PYXIS_BW_IO));
}
__EXTERN_INLINE void pyxis_outb(unsigned char b, unsigned long addr)
{
- unsigned long w;
-
- w = __kernel_insbl(b, addr & 3);
- *(vuip) ((addr << 5) + PYXIS_IO + 0x00) = w;
+ __kernel_stb(b, *(vucp)(addr+PYXIS_BW_IO));
mb();
}
__EXTERN_INLINE unsigned int pyxis_inw(unsigned long addr)
{
- long result = *(vip) ((addr << 5) + PYXIS_IO + 0x08);
- return __kernel_extwl(result, addr & 3);
+ return __kernel_ldwu(*(vusp)(addr+PYXIS_BW_IO));
}
__EXTERN_INLINE void pyxis_outw(unsigned short b, unsigned long addr)
{
- unsigned long w;
-
- w = __kernel_inswl(b, addr & 3);
- *(vuip) ((addr << 5) + PYXIS_IO + 0x08) = w;
+ __kernel_stw(b, *(vusp)(addr+PYXIS_BW_IO));
mb();
}
__EXTERN_INLINE unsigned int pyxis_inl(unsigned long addr)
{
- return *(vuip) ((addr << 5) + PYXIS_IO + 0x18);
+ return *(vuip)(addr+PYXIS_BW_IO);
}
__EXTERN_INLINE void pyxis_outl(unsigned int b, unsigned long addr)
{
- *(vuip) ((addr << 5) + PYXIS_IO + 0x18) = b;
+ *(vuip)(addr+PYXIS_BW_IO) = b;
mb();
}
@@ -363,8 +326,8 @@ __EXTERN_INLINE void pyxis_outl(unsigned int b, unsigned long addr)
/*
* Memory functions. 64-bit and 32-bit accesses are done through
* dense memory space, everything else through sparse space.
- *
- * For reading and writing 8 and 16 bit quantities we need to
+ *
+ * For reading and writing 8 and 16 bit quantities we need to
* go through one of the three sparse address mapping regions
* and use the HAE_MEM CSR to provide some bits of the address.
* The following few routines use only sparse address region 1
@@ -373,10 +336,10 @@ __EXTERN_INLINE void pyxis_outl(unsigned int b, unsigned long addr)
* See p 6-17 of the specification but it looks something like this:
*
* 21164 Address:
- *
- * 3 2 1
+ *
+ * 3 2 1
* 9876543210987654321098765432109876543210
- * 1ZZZZ0.PCI.QW.Address............BBLL
+ * 1ZZZZ0.PCI.QW.Address............BBLL
*
* ZZ = SBZ
* BB = Byte offset
@@ -384,201 +347,62 @@ __EXTERN_INLINE void pyxis_outl(unsigned int b, unsigned long addr)
*
* PCI Address:
*
- * 3 2 1
+ * 3 2 1
* 10987654321098765432109876543210
* HHH....PCI.QW.Address........ 00
*
* HHH = 31:29 HAE_MEM CSR
- *
+ *
*/
-__EXTERN_INLINE unsigned long pyxis_bw_readb(unsigned long addr)
-{
- return __kernel_ldbu(*(vucp)(addr+PYXIS_BW_MEM));
-}
-
-__EXTERN_INLINE unsigned long pyxis_bw_readw(unsigned long addr)
-{
- return __kernel_ldwu(*(vusp)(addr+PYXIS_BW_MEM));
-}
-
-__EXTERN_INLINE unsigned long pyxis_bw_readl(unsigned long addr)
-{
- return *(vuip)(addr+PYXIS_BW_MEM);
-}
-
-__EXTERN_INLINE unsigned long pyxis_bw_readq(unsigned long addr)
-{
- return *(vulp)(addr+PYXIS_BW_MEM);
-}
-
-__EXTERN_INLINE void pyxis_bw_writeb(unsigned char b, unsigned long addr)
-{
- __kernel_stb(b, *(vucp)(addr+PYXIS_BW_MEM));
- mb();
-}
-
-__EXTERN_INLINE void pyxis_bw_writew(unsigned short b, unsigned long addr)
-{
- __kernel_stw(b, *(vusp)(addr+PYXIS_BW_MEM));
- mb();
-}
-
-__EXTERN_INLINE void pyxis_bw_writel(unsigned int b, unsigned long addr)
-{
- *(vuip)(addr+PYXIS_BW_MEM) = b;
-}
-
-__EXTERN_INLINE void pyxis_bw_writeq(unsigned long b, unsigned long addr)
-{
- *(vulp)(addr+PYXIS_BW_MEM) = b;
-}
-
-__EXTERN_INLINE unsigned long pyxis_srm_base(unsigned long addr)
-{
- unsigned long mask, base;
-
- if (addr >= alpha_mv.sm_base_r1
- && addr <= alpha_mv.sm_base_r1 + PYXIS_MEM_R1_MASK) {
- mask = PYXIS_MEM_R1_MASK;
- base = PYXIS_SPARSE_MEM;
- }
- else if (addr >= alpha_mv.sm_base_r2
- && addr <= alpha_mv.sm_base_r2 + PYXIS_MEM_R2_MASK) {
- mask = PYXIS_MEM_R2_MASK;
- base = PYXIS_SPARSE_MEM_R2;
- }
- else if (addr >= alpha_mv.sm_base_r3
- && addr <= alpha_mv.sm_base_r3 + PYXIS_MEM_R3_MASK) {
- mask = PYXIS_MEM_R3_MASK;
- base = PYXIS_SPARSE_MEM_R3;
- }
- else
- {
-#if 0
- printk("pyxis: address 0x%lx not covered by HAE\n", addr);
-#endif
- return 0;
- }
-
- return ((addr & mask) << 5) + base;
-}
-
-__EXTERN_INLINE unsigned long pyxis_srm_readb(unsigned long addr)
-{
- unsigned long result, work;
-
- if ((work = pyxis_srm_base(addr)) == 0)
- return 0xff;
- work += 0x00; /* add transfer length */
-
- result = *(vip) work;
- return __kernel_extbl(result, addr & 3);
-}
-
-__EXTERN_INLINE unsigned long pyxis_srm_readw(unsigned long addr)
-{
- unsigned long result, work;
-
- if ((work = pyxis_srm_base(addr)) == 0)
- return 0xffff;
- work += 0x08; /* add transfer length */
-
- result = *(vip) work;
- return __kernel_extwl(result, addr & 3);
-}
-
-__EXTERN_INLINE void pyxis_srm_writeb(unsigned char b, unsigned long addr)
-{
- unsigned long work = pyxis_srm_base(addr);
- if (work) {
- work += 0x00; /* add transfer length */
- *(vuip) work = b * 0x01010101;
- }
-}
-
-__EXTERN_INLINE void pyxis_srm_writew(unsigned short b, unsigned long addr)
-{
- unsigned long work = pyxis_srm_base(addr);
- if (work) {
- work += 0x08; /* add transfer length */
- *(vuip) work = b * 0x00010001;
- }
-}
-
__EXTERN_INLINE unsigned long pyxis_readb(unsigned long addr)
{
- unsigned long result, msb, work, temp;
-
- msb = addr & 0xE0000000UL;
- temp = addr & PYXIS_MEM_R1_MASK ;
- set_hae(msb);
-
- work = ((temp << 5) + PYXIS_SPARSE_MEM + 0x00);
- result = *(vip) work;
- return __kernel_extbl(result, addr & 3);
+ return __kernel_ldbu(*(vucp)addr);
}
__EXTERN_INLINE unsigned long pyxis_readw(unsigned long addr)
{
- unsigned long result, msb, work, temp;
-
- msb = addr & 0xE0000000UL;
- temp = addr & PYXIS_MEM_R1_MASK ;
- set_hae(msb);
-
- work = ((temp << 5) + PYXIS_SPARSE_MEM + 0x08);
- result = *(vip) work;
- return __kernel_extwl(result, addr & 3);
+ return __kernel_ldwu(*(vusp)addr);
}
-__EXTERN_INLINE void pyxis_writeb(unsigned char b, unsigned long addr)
+__EXTERN_INLINE unsigned long pyxis_readl(unsigned long addr)
{
- unsigned long msb ;
-
- msb = addr & 0xE0000000 ;
- addr &= PYXIS_MEM_R1_MASK ;
- set_hae(msb);
-
- *(vuip) ((addr << 5) + PYXIS_SPARSE_MEM + 0x00) = b * 0x01010101;
+ return *(vuip)addr;
}
-__EXTERN_INLINE void pyxis_writew(unsigned short b, unsigned long addr)
+__EXTERN_INLINE unsigned long pyxis_readq(unsigned long addr)
{
- unsigned long msb ;
-
- msb = addr & 0xE0000000 ;
- addr &= PYXIS_MEM_R1_MASK ;
- set_hae(msb);
-
- *(vuip) ((addr << 5) + PYXIS_SPARSE_MEM + 0x08) = b * 0x00010001;
+ return *(vulp)addr;
}
-__EXTERN_INLINE unsigned long pyxis_readl(unsigned long addr)
+__EXTERN_INLINE void pyxis_writeb(unsigned char b, unsigned long addr)
{
- return *(vuip) (addr + PYXIS_DENSE_MEM);
+ __kernel_stb(b, *(vucp)addr);
}
-__EXTERN_INLINE unsigned long pyxis_readq(unsigned long addr)
+__EXTERN_INLINE void pyxis_writew(unsigned short b, unsigned long addr)
{
- return *(vulp) (addr + PYXIS_DENSE_MEM);
+ __kernel_stw(b, *(vusp)addr);
}
__EXTERN_INLINE void pyxis_writel(unsigned int b, unsigned long addr)
{
- *(vuip) (addr + PYXIS_DENSE_MEM) = b;
+ *(vuip)addr = b;
}
__EXTERN_INLINE void pyxis_writeq(unsigned long b, unsigned long addr)
{
- *(vulp) (addr + PYXIS_DENSE_MEM) = b;
+ *(vulp)addr = b;
}
-/* Find the DENSE memory area for a given bus address. */
+__EXTERN_INLINE unsigned long pyxis_ioremap(unsigned long addr)
+{
+ return addr + PYXIS_BW_MEM;
+}
-__EXTERN_INLINE unsigned long pyxis_dense_mem(unsigned long addr)
+__EXTERN_INLINE int pyxis_is_ioaddr(unsigned long addr)
{
- return PYXIS_DENSE_MEM;
+ return addr >= IDENT_ADDR + 0x8740000000UL;
}
#undef vucp
@@ -592,69 +416,37 @@ __EXTERN_INLINE unsigned long pyxis_dense_mem(unsigned long addr)
#define virt_to_bus pyxis_virt_to_bus
#define bus_to_virt pyxis_bus_to_virt
-#if defined(BWIO_ENABLED) && !defined(CONFIG_ALPHA_RUFFIAN)
-# define __inb pyxis_bw_inb
-# define __inw pyxis_bw_inw
-# define __inl pyxis_bw_inl
-# define __outb pyxis_bw_outb
-# define __outw pyxis_bw_outw
-# define __outl pyxis_bw_outl
-# define __readb pyxis_bw_readb
-# define __readw pyxis_bw_readw
-# define __writeb pyxis_bw_writeb
-# define __writew pyxis_bw_writew
-# define __readl pyxis_bw_readl
-# define __readq pyxis_bw_readq
-# define __writel pyxis_bw_writel
-# define __writeq pyxis_bw_writeq
-#else
-# define __inb pyxis_inb
-# define __inw pyxis_inw
-# define __inl pyxis_inl
-# define __outb pyxis_outb
-# define __outw pyxis_outw
-# define __outl pyxis_outl
-# ifdef CONFIG_ALPHA_SRM_SETUP
-# define __readb pyxis_srm_readb
-# define __readw pyxis_srm_readw
-# define __writeb pyxis_srm_writeb
-# define __writew pyxis_srm_writew
-# else
-# define __readb pyxis_readb
-# define __readw pyxis_readw
-# define __writeb pyxis_writeb
-# define __writew pyxis_writew
-# endif
-# define __readl pyxis_readl
-# define __readq pyxis_readq
-# define __writel pyxis_writel
-# define __writeq pyxis_writeq
-#endif /* BWIO */
-
-#define dense_mem pyxis_dense_mem
-
-#if defined(BWIO_ENABLED) && !defined(CONFIG_ALPHA_RUFFIAN)
-# define inb(port) __inb((port))
-# define inw(port) __inw((port))
-# define inl(port) __inl((port))
-# define outb(x, port) __outb((x),(port))
-# define outw(x, port) __outw((x),(port))
-# define outl(x, port) __outl((x),(port))
-# define readb(addr) __readb((addr))
-# define readw(addr) __readw((addr))
-# define writeb(b, addr) __writeb((b),(addr))
-# define writew(b, addr) __writew((b),(addr))
-#else
-# define inb(port) \
- (__builtin_constant_p((port))?__inb(port):_inb(port))
-# define outb(x, port) \
- (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
-#endif /* BWIO */
-
-#define readl(a) __readl((unsigned long)(a))
-#define readq(a) __readq((unsigned long)(a))
-#define writel(v,a) __writel((v),(unsigned long)(a))
-#define writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __inb pyxis_inb
+#define __inw pyxis_inw
+#define __inl pyxis_inl
+#define __outb pyxis_outb
+#define __outw pyxis_outw
+#define __outl pyxis_outl
+#define __readb pyxis_readb
+#define __readw pyxis_readw
+#define __writeb pyxis_writeb
+#define __writew pyxis_writew
+#define __readl pyxis_readl
+#define __readq pyxis_readq
+#define __writel pyxis_writel
+#define __writeq pyxis_writeq
+#define __ioremap pyxis_ioremap
+#define __is_ioaddr pyxis_is_ioaddr
+
+#define inb(port) __inb((port))
+#define inw(port) __inw((port))
+#define inl(port) __inl((port))
+#define outb(x, port) __outb((x),(port))
+#define outw(x, port) __outw((x),(port))
+#define outl(x, port) __outl((x),(port))
+#define __raw_readb(addr) __readb((addr))
+#define __raw_readw(addr) __readw((addr))
+#define __raw_writeb(b, addr) __writeb((b),(addr))
+#define __raw_writew(b, addr) __writew((b),(addr))
+#define __raw_readl(a) __readl((unsigned long)(a))
+#define __raw_readq(a) __readq((unsigned long)(a))
+#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
+#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_t2.h b/include/asm-alpha/core_t2.h
index fdb0f82fe..933be1714 100644
--- a/include/asm-alpha/core_t2.h
+++ b/include/asm-alpha/core_t2.h
@@ -21,16 +21,8 @@
#define T2_MEM_R1_MASK 0x03ffffff /* Mem sparse region 1 mask is 26 bits */
-#define T2_DMA_WIN_BASE_DEFAULT (1024*1024*1024)
-#define T2_DMA_WIN_SIZE_DEFAULT (1024*1024*1024)
-
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define T2_DMA_WIN_BASE alpha_mv.dma_win_base
-#define T2_DMA_WIN_SIZE alpha_mv.dma_win_size
-#else
-#define T2_DMA_WIN_BASE T2_DMA_WIN_BASE_DEFAULT
-#define T2_DMA_WIN_SIZE T2_DMA_WIN_SIZE_DEFAULT
-#endif
+#define T2_DMA_WIN_BASE (1UL*1024*1024*1024)
+#define T2_DMA_WIN_SIZE (1UL*1024*1024*1024)
/* GAMMA-SABLE is a SABLE with EV5-based CPUs */
#define _GAMMA_BIAS 0x8000000000UL
@@ -78,33 +70,33 @@
3.8fff.ffff
*
* +--------------+ 3 8000 0000
- * | CPU 0 CSRs |
+ * | CPU 0 CSRs |
* +--------------+ 3 8100 0000
- * | CPU 1 CSRs |
+ * | CPU 1 CSRs |
* +--------------+ 3 8200 0000
- * | CPU 2 CSRs |
+ * | CPU 2 CSRs |
* +--------------+ 3 8300 0000
- * | CPU 3 CSRs |
+ * | CPU 3 CSRs |
* +--------------+ 3 8400 0000
- * | CPU Reserved |
+ * | CPU Reserved |
* +--------------+ 3 8700 0000
- * | Mem Reserved |
+ * | Mem Reserved |
* +--------------+ 3 8800 0000
- * | Mem 0 CSRs |
+ * | Mem 0 CSRs |
* +--------------+ 3 8900 0000
- * | Mem 1 CSRs |
+ * | Mem 1 CSRs |
* +--------------+ 3 8a00 0000
- * | Mem 2 CSRs |
+ * | Mem 2 CSRs |
* +--------------+ 3 8b00 0000
- * | Mem 3 CSRs |
- * +--------------+ 3 8c00 0000
- * | Mem Reserved |
- * +--------------+ 3 8e00 0000
- * | PCI Bridge |
- * +--------------+ 3 8f00 0000
- * | Expansion IO |
- * +--------------+ 3 9000 0000
- *
+ * | Mem 3 CSRs |
+ * +--------------+ 3 8c00 0000
+ * | Mem Reserved |
+ * +--------------+ 3 8e00 0000
+ * | PCI Bridge |
+ * +--------------+ 3 8f00 0000
+ * | Expansion IO |
+ * +--------------+ 3 9000 0000
+ *
*
*/
#define T2_CPU0_BASE (IDENT_ADDR + GAMMA_BIAS + 0x380000000L)
@@ -176,7 +168,7 @@ struct el_t2_procdata_mcheck {
unsigned long elfmc_bc_tag; /* Backup Cache Tag Probe Results. */
};
-/*
+/*
* Sable processor specific Machine Check Data segment.
*/
@@ -184,7 +176,7 @@ struct el_t2_logout_header {
unsigned int elfl_size; /* size in bytes of logout area. */
int elfl_sbz1:31; /* Should be zero. */
char elfl_retry:1; /* Retry flag. */
- unsigned int elfl_procoffset; /* Processor-specific offset. */
+ unsigned int elfl_procoffset; /* Processor-specific offset. */
unsigned int elfl_sysoffset; /* Offset of system-specific. */
unsigned int elfl_error_type; /* PAL error type code. */
unsigned int elfl_frame_rev; /* PAL Frame revision. */
@@ -233,7 +225,7 @@ struct el_t2_data_memory {
*/
struct el_t2_data_other_cpu {
short elco_cpuid; /* CPU ID */
- short elco_res02[3];
+ short elco_res02[3];
unsigned long elco_bcc; /* CSR 0 */
unsigned long elco_bcce; /* CSR 1 */
unsigned long elco_bccea; /* CSR 2 */
@@ -256,7 +248,7 @@ struct el_t2_data_other_cpu {
* Sable other CPU error frame - sable pfms section 3.44
*/
struct el_t2_data_t2{
- struct el_t2_frame_header elct_hdr; /* ID$T2-FRAME */
+ struct el_t2_frame_header elct_hdr; /* ID$T2-FRAME */
unsigned long elct_iocsr; /* IO Control and Status Register */
unsigned long elct_cerr1; /* Cbus Error Register 1 */
unsigned long elct_cerr2; /* Cbus Error Register 2 */
@@ -294,31 +286,31 @@ struct el_t2_data_corrected {
unsigned long elcpb_bc_tag;
};
-/*
+/*
* Sable error log data structure
* Note there are 4 memory slots on sable (see t2.h)
*/
struct el_t2_frame_mcheck {
- struct el_t2_frame_header elfmc_header; /* ID$P-FRAME_MCHECK */
+ struct el_t2_frame_header elfmc_header; /* ID$P-FRAME_MCHECK */
struct el_t2_logout_header elfmc_hdr;
struct el_t2_procdata_mcheck elfmc_procdata;
struct el_t2_sysdata_mcheck elfmc_sysdata;
struct el_t2_data_t2 elfmc_t2data;
- struct el_t2_data_memory elfmc_memdata[4];
- struct el_t2_frame_header elfmc_footer; /* empty */
+ struct el_t2_data_memory elfmc_memdata[4];
+ struct el_t2_frame_header elfmc_footer; /* empty */
};
-/*
+/*
* Sable error log data structures on memory errors
*/
struct el_t2_frame_corrected {
- struct el_t2_frame_header elfcc_header; /* ID$P-BC-COR */
+ struct el_t2_frame_header elfcc_header; /* ID$P-BC-COR */
struct el_t2_logout_header elfcc_hdr;
- struct el_t2_data_corrected elfcc_procdata;
+ struct el_t2_data_corrected elfcc_procdata;
/* struct el_t2_data_t2 elfcc_t2data; */
/* struct el_t2_data_memory elfcc_memdata[4]; */
- struct el_t2_frame_header elfcc_footer; /* empty */
+ struct el_t2_frame_header elfcc_footer; /* empty */
};
@@ -398,10 +390,9 @@ __EXTERN_INLINE void t2_outl(unsigned int b, unsigned long addr)
/*
- * Memory functions. 64-bit and 32-bit accesses are done through
- * dense memory space, everything else through sparse space.
- *
- * For reading and writing 8 and 16 bit quantities we need to
+ * Memory functions.
+ *
+ * For reading and writing 8 and 16 bit quantities we need to
* go through one of the three sparse address mapping regions
* and use the HAE_MEM CSR to provide some bits of the address.
* The following few routines use only sparse address region 1
@@ -410,10 +401,10 @@ __EXTERN_INLINE void t2_outl(unsigned int b, unsigned long addr)
* See p 6-17 of the specification but it looks something like this:
*
* 21164 Address:
- *
- * 3 2 1
+ *
+ * 3 2 1
* 9876543210987654321098765432109876543210
- * 1ZZZZ0.PCI.QW.Address............BBLL
+ * 1ZZZZ0.PCI.QW.Address............BBLL
*
* ZZ = SBZ
* BB = Byte offset
@@ -421,127 +412,23 @@ __EXTERN_INLINE void t2_outl(unsigned int b, unsigned long addr)
*
* PCI Address:
*
- * 3 2 1
+ * 3 2 1
* 10987654321098765432109876543210
* HHH....PCI.QW.Address........ 00
*
* HHH = 31:29 HAE_MEM CSR
- *
+ *
*/
-__EXTERN_INLINE unsigned long t2_srm_base(unsigned long addr)
-{
- if ((addr >= alpha_mv.sm_base_r1
- && addr <= alpha_mv.sm_base_r1 + T2_MEM_R1_MASK)
- || (addr >= 512*1024 && addr < 1024*1024)) {
- return ((addr & T2_MEM_R1_MASK) << 5) + T2_SPARSE_MEM;
- }
-#if 0
- printk("T2: address 0x%lx not covered by HAE\n", addr);
-#endif
- return 0;
-}
-
-__EXTERN_INLINE unsigned long t2_srm_readb(unsigned long addr)
-{
- unsigned long result, work;
-
- if ((work = t2_srm_base(addr)) == 0)
- return 0xff;
- work += 0x00; /* add transfer length */
-
- result = *(vip) work;
- return __kernel_extbl(result, addr & 3);
-}
-
-__EXTERN_INLINE unsigned long t2_srm_readw(unsigned long addr)
-{
- unsigned long result, work;
-
- if ((work = t2_srm_base(addr)) == 0)
- return 0xffff;
- work += 0x08; /* add transfer length */
-
- result = *(vip) work;
- return __kernel_extwl(result, addr & 3);
-}
-
-/* On SABLE with T2, we must use SPARSE memory even for 32-bit access ... */
-__EXTERN_INLINE unsigned long t2_srm_readl(unsigned long addr)
-{
- unsigned long work;
-
- if ((work = t2_srm_base(addr)) == 0)
- return 0xffffffff;
- work += 0x18; /* add transfer length */
-
- return *(vuip) work;
-}
-
-/* ... which makes me wonder why we advertise we have DENSE memory at all.
- Anyway, guess that means we should emulate 64-bit access as two cycles. */
-__EXTERN_INLINE unsigned long t2_srm_readq(unsigned long addr)
-{
- unsigned long work, r0, r1;
-
- if ((work = t2_srm_base(addr)) == 0)
- return ~0UL;
- work += 0x18; /* add transfer length */
-
- r0 = *(vuip) work;
- r1 = *(vuip) (work + (4 << 5));
- return r1 << 32 | r0;
-}
-
-__EXTERN_INLINE void t2_srm_writeb(unsigned char b, unsigned long addr)
-{
- unsigned long work = t2_srm_base(addr);
- if (work) {
- work += 0x00; /* add transfer length */
- *(vuip) work = b * 0x01010101;
- }
-}
-
-__EXTERN_INLINE void t2_srm_writew(unsigned short b, unsigned long addr)
-{
- unsigned long work = t2_srm_base(addr);
- if (work) {
- work += 0x08; /* add transfer length */
- *(vuip) work = b * 0x00010001;
- }
-}
-
-/* On SABLE with T2, we must use SPARSE memory even for 32-bit access ... */
-__EXTERN_INLINE void t2_srm_writel(unsigned int b, unsigned long addr)
-{
- unsigned long work = t2_srm_base(addr);
- if (work) {
- work += 0x18; /* add transfer length */
- *(vuip) work = b;
- }
-}
-
-/* ... which makes me wonder why we advertise we have DENSE memory at all.
- Anyway, guess that means we should emulate 64-bit access as two cycles. */
-__EXTERN_INLINE void t2_srm_writeq(unsigned long b, unsigned long addr)
-{
- unsigned long work = t2_srm_base(addr);
- if (work) {
- work += 0x18; /* add transfer length */
- *(vuip) work = b;
- *(vuip) (work + (4 << 5)) = b >> 32;
- }
-}
-
__EXTERN_INLINE unsigned long t2_readb(unsigned long addr)
{
unsigned long result, msb;
- msb = addr & 0xE0000000 ;
- addr &= T2_MEM_R1_MASK ;
+ msb = addr & 0xE0000000;
+ addr &= T2_MEM_R1_MASK;
set_hae(msb);
- result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00) ;
+ result = *(vip) ((addr << 5) + T2_SPARSE_MEM + 0x00);
return __kernel_extbl(result, addr & 3);
}
@@ -549,8 +436,8 @@ __EXTERN_INLINE unsigned long t2_readw(unsigned long addr)
{
unsigned long result, msb;
- msb = addr & 0xE0000000 ;
- addr &= T2_MEM_R1_MASK ;
+ msb = addr & 0xE0000000;
+ addr &= T2_MEM_R1_MASK;
set_hae(msb);
result = *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08);
@@ -562,8 +449,8 @@ __EXTERN_INLINE unsigned long t2_readl(unsigned long addr)
{
unsigned long msb;
- msb = addr & 0xE0000000 ;
- addr &= T2_MEM_R1_MASK ;
+ msb = addr & 0xE0000000;
+ addr &= T2_MEM_R1_MASK;
set_hae(msb);
return *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18);
@@ -573,8 +460,8 @@ __EXTERN_INLINE unsigned long t2_readq(unsigned long addr)
{
unsigned long r0, r1, work, msb;
- msb = addr & 0xE0000000 ;
- addr &= T2_MEM_R1_MASK ;
+ msb = addr & 0xE0000000;
+ addr &= T2_MEM_R1_MASK;
set_hae(msb);
work = (addr << 5) + T2_SPARSE_MEM + 0x18;
@@ -585,33 +472,35 @@ __EXTERN_INLINE unsigned long t2_readq(unsigned long addr)
__EXTERN_INLINE void t2_writeb(unsigned char b, unsigned long addr)
{
- unsigned long msb ;
+ unsigned long msb, w;
- msb = addr & 0xE0000000 ;
- addr &= T2_MEM_R1_MASK ;
+ msb = addr & 0xE0000000;
+ addr &= T2_MEM_R1_MASK;
set_hae(msb);
- *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = b * 0x01010101;
+ w = __kernel_insbl(b, addr & 3);
+ *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x00) = w;
}
__EXTERN_INLINE void t2_writew(unsigned short b, unsigned long addr)
{
- unsigned long msb ;
+ unsigned long msb, w;
- msb = addr & 0xE0000000 ;
- addr &= T2_MEM_R1_MASK ;
+ msb = addr & 0xE0000000;
+ addr &= T2_MEM_R1_MASK;
set_hae(msb);
- *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = b * 0x00010001;
+ w = __kernel_inswl(b, addr & 3);
+ *(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x08) = w;
}
/* On SABLE with T2, we must use SPARSE memory even for 32-bit access. */
__EXTERN_INLINE void t2_writel(unsigned int b, unsigned long addr)
{
- unsigned long msb ;
+ unsigned long msb;
- msb = addr & 0xE0000000 ;
- addr &= T2_MEM_R1_MASK ;
+ msb = addr & 0xE0000000;
+ addr &= T2_MEM_R1_MASK;
set_hae(msb);
*(vuip) ((addr << 5) + T2_SPARSE_MEM + 0x18) = b;
@@ -619,10 +508,10 @@ __EXTERN_INLINE void t2_writel(unsigned int b, unsigned long addr)
__EXTERN_INLINE void t2_writeq(unsigned long b, unsigned long addr)
{
- unsigned long msb, work;
+ unsigned long msb, work;
- msb = addr & 0xE0000000 ;
- addr &= T2_MEM_R1_MASK ;
+ msb = addr & 0xE0000000;
+ addr &= T2_MEM_R1_MASK;
set_hae(msb);
work = (addr << 5) + T2_SPARSE_MEM + 0x18;
@@ -630,11 +519,14 @@ __EXTERN_INLINE void t2_writeq(unsigned long b, unsigned long addr)
*(vuip)(work + (4 << 5)) = b >> 32;
}
-/* Find the DENSE memory area for a given bus address. */
+__EXTERN_INLINE unsigned long t2_ioremap(unsigned long addr)
+{
+ return addr;
+}
-__EXTERN_INLINE unsigned long t2_dense_mem(unsigned long addr)
+__EXTERN_INLINE int t2_is_ioaddr(unsigned long addr)
{
- return T2_DENSE_MEM;
+ return (long)addr >= 0;
}
#undef vip
@@ -650,17 +542,6 @@ __EXTERN_INLINE unsigned long t2_dense_mem(unsigned long addr)
#define __outb t2_outb
#define __outw t2_outw
#define __outl t2_outl
-
-#ifdef CONFIG_ALPHA_SRM_SETUP
-#define __readb t2_srm_readb
-#define __readw t2_srm_readw
-#define __readl t2_srm_readl
-#define __readq t2_srm_readq
-#define __writeb t2_srm_writeb
-#define __writew t2_srm_writew
-#define __writel t2_srm_writel
-#define __writeq t2_srm_writeq
-#else
#define __readb t2_readb
#define __readw t2_readw
#define __readl t2_readl
@@ -669,15 +550,13 @@ __EXTERN_INLINE unsigned long t2_dense_mem(unsigned long addr)
#define __writew t2_writew
#define __writel t2_writel
#define __writeq t2_writeq
-#endif
-
-#define dense_mem t2_dense_mem
+#define __ioremap t2_ioremap
+#define __is_ioaddr t2_is_ioaddr
#define inb(port) \
-(__builtin_constant_p((port))?__inb(port):_inb(port))
-
+ (__builtin_constant_p((port))?__inb(port):_inb(port))
#define outb(x, port) \
-(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
+ (__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port)))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h
index 68d30cf86..14bc80e2d 100644
--- a/include/asm-alpha/core_tsunami.h
+++ b/include/asm-alpha/core_tsunami.h
@@ -1,7 +1,6 @@
#ifndef __ALPHA_TSUNAMI__H__
#define __ALPHA_TSUNAMI__H__
-#include <linux/config.h>
#include <linux/types.h>
#include <asm/compiler.h>
@@ -16,16 +15,25 @@
*
*/
-#define TSUNAMI_DMA_WIN_BASE_DEFAULT (1024*1024*1024U)
-#define TSUNAMI_DMA_WIN_SIZE_DEFAULT (1024*1024*1024U)
+/*
+ * We must actually use 2 windows to direct-map the 2GB space, because
+ * of an "idiot-syncracy" of the CYPRESS chip used on DS20 and others.
+ * It may respond to a PCI bus address in the last 1MB of the 4GB
+ * address range, and that is where real memory may appear.
+ *
+ * Sigh...
+ */
+#define TSUNAMI_DMA_WIN_BASE (1UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN_SIZE (2UL*1024*1024*1024)
+
+#define TSUNAMI_DMA_WIN0_BASE_DEFAULT (1UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN0_SIZE_DEFAULT (1UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN0_TRAN_DEFAULT (0UL)
+
+#define TSUNAMI_DMA_WIN1_BASE_DEFAULT (2UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN1_SIZE_DEFAULT (1UL*1024*1024*1024)
+#define TSUNAMI_DMA_WIN1_TRAN_DEFAULT (1UL*1024*1024*1024)
-#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM_SETUP)
-#define TSUNAMI_DMA_WIN_BASE alpha_mv.dma_win_base
-#define TSUNAMI_DMA_WIN_SIZE alpha_mv.dma_win_size
-#else
-#define TSUNAMI_DMA_WIN_BASE TSUNAMI_DMA_WIN_BASE_DEFAULT
-#define TSUNAMI_DMA_WIN_SIZE TSUNAMI_DMA_WIN_SIZE_DEFAULT
-#endif
/* XXX: Do we need to conditionalize on this? */
#ifdef USE_48_BIT_KSEG
@@ -142,7 +150,7 @@ union TPchipPERROR {
unsigned perror_v_rsvd2 : 1;
unsigned perror_v_cmd : 4;
unsigned perror_v_syn : 8;
- } perror_r_bits;
+ } perror_r_bits;
int perror_q_whole [2];
};
@@ -162,7 +170,7 @@ union TPchipWSBA {
unsigned wsba_v_rsvd1 : 17;
unsigned wsba_v_addr : 12;
unsigned wsba_v_rsvd2 : 32;
- } wsba_r_bits;
+ } wsba_r_bits;
int wsba_q_whole [2];
};
@@ -256,21 +264,32 @@ union TPchipPERRMASK {
unsigned perrmask_v_cre : 1;
unsigned perrmask_v_rsvd1 : 20;
unsigned perrmask_v_rsvd2 : 32;
- } perrmask_r_bits;
+ } perrmask_r_bits;
int perrmask_q_whole [2];
};
/*
* Memory spaces:
*/
-#define HOSE(h) (((unsigned long)(h)) << 33)
+#define TSUNAMI_HOSE(h) (((unsigned long)(h)) << 33)
+#define TSUNAMI_BASE (IDENT_ADDR + TS_BIAS)
+
+#define TSUNAMI_MEM(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x000000000UL)
+#define _TSUNAMI_IACK_SC(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1F8000000UL)
+#define TSUNAMI_IO(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1FC000000UL)
+#define TSUNAMI_CONF(h) (TSUNAMI_BASE+TSUNAMI_HOSE(h) + 0x1FE000000UL)
-#define TSUNAMI_MEM(h) (IDENT_ADDR + TS_BIAS + 0x000000000UL + HOSE(h))
-#define _TSUNAMI_IACK_SC(h) (IDENT_ADDR + TS_BIAS + 0x1F8000000UL + HOSE(h))
-#define TSUNAMI_IO(h) (IDENT_ADDR + TS_BIAS + 0x1FC000000UL + HOSE(h))
-#define TSUNAMI_CONF(h) (IDENT_ADDR + TS_BIAS + 0x1FE000000UL + HOSE(h))
+#define TSUNAMI_IACK_SC _TSUNAMI_IACK_SC(0) /* hack! */
-#define TSUNAMI_IACK_SC _TSUNAMI_IACK_SC(0) /* hack! */
+
+/*
+ * The canonical non-remaped I/O and MEM addresses have these values
+ * subtracted out. This is arranged so that folks manipulating ISA
+ * devices can use their familiar numbers and have them map to bus 0.
+ */
+
+#define TSUNAMI_IO_BIAS TSUNAMI_IO(0)
+#define TSUNAMI_MEM_BIAS TSUNAMI_MEM(0)
/*
@@ -313,39 +332,47 @@ __EXTERN_INLINE void * tsunami_bus_to_virt(unsigned long address)
#define vuip volatile unsigned int *
#define vulp volatile unsigned long *
-#define XADDR ((addr) & 0xffffffffUL)
-#define XHOSE (((addr) >> 32) & 3UL)
-
__EXTERN_INLINE unsigned int tsunami_inb(unsigned long addr)
{
- return __kernel_ldbu(*(vucp)(XADDR + TSUNAMI_IO(XHOSE)));
+ /* ??? I wish I could get rid of this. But there's no ioremap
+ equivalent for I/O space. PCI I/O can be forced into the
+ correct hose's I/O region, but that doesn't take care of
+ legacy ISA crap. */
+
+ addr += TSUNAMI_IO_BIAS;
+ return __kernel_ldbu(*(vucp)addr);
}
__EXTERN_INLINE void tsunami_outb(unsigned char b, unsigned long addr)
{
- __kernel_stb(b, *(vucp)(XADDR + TSUNAMI_IO(XHOSE)));
+ addr += TSUNAMI_IO_BIAS;
+ __kernel_stb(b, *(vucp)addr);
mb();
}
__EXTERN_INLINE unsigned int tsunami_inw(unsigned long addr)
{
- return __kernel_ldwu(*(vusp)(XADDR + TSUNAMI_IO(XHOSE)));
+ addr += TSUNAMI_IO_BIAS;
+ return __kernel_ldwu(*(vusp)addr);
}
__EXTERN_INLINE void tsunami_outw(unsigned short b, unsigned long addr)
{
- __kernel_stw(b, *(vusp)(XADDR + TSUNAMI_IO(XHOSE)));
+ addr += TSUNAMI_IO_BIAS;
+ __kernel_stw(b, *(vusp)addr);
mb();
}
__EXTERN_INLINE unsigned int tsunami_inl(unsigned long addr)
{
- return *(vuip)(XADDR + TSUNAMI_IO(XHOSE));
+ addr += TSUNAMI_IO_BIAS;
+ return *(vuip)addr;
}
__EXTERN_INLINE void tsunami_outl(unsigned int b, unsigned long addr)
{
- *(vuip)(XADDR + TSUNAMI_IO(XHOSE)) = b;
+ addr += TSUNAMI_IO_BIAS;
+ *(vuip)addr = b;
mb();
}
@@ -353,55 +380,54 @@ __EXTERN_INLINE void tsunami_outl(unsigned int b, unsigned long addr)
* Memory functions. all accesses are done through linear space.
*/
+__EXTERN_INLINE unsigned long tsunami_ioremap(unsigned long addr)
+{
+ return addr + TSUNAMI_MEM_BIAS;
+}
+
+__EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr)
+{
+ return addr >= TSUNAMI_BASE;
+}
+
__EXTERN_INLINE unsigned long tsunami_readb(unsigned long addr)
{
- return __kernel_ldbu(*(vucp)(XADDR + TSUNAMI_MEM(XHOSE)));
+ return __kernel_ldbu(*(vucp)addr);
}
__EXTERN_INLINE unsigned long tsunami_readw(unsigned long addr)
{
- return __kernel_ldwu(*(vusp)(XADDR + TSUNAMI_MEM(XHOSE)));
+ return __kernel_ldwu(*(vusp)addr);
}
__EXTERN_INLINE unsigned long tsunami_readl(unsigned long addr)
{
- return *(vuip)(XADDR + TSUNAMI_MEM(XHOSE));
+ return *(vuip)addr;
}
__EXTERN_INLINE unsigned long tsunami_readq(unsigned long addr)
{
- return *(vulp)(XADDR + TSUNAMI_MEM(XHOSE));
+ return *(vulp)addr;
}
__EXTERN_INLINE void tsunami_writeb(unsigned char b, unsigned long addr)
{
- __kernel_stb(b, *(vucp)(XADDR + TSUNAMI_MEM(XHOSE)));
- mb();
+ __kernel_stb(b, *(vucp)addr);
}
__EXTERN_INLINE void tsunami_writew(unsigned short b, unsigned long addr)
{
- __kernel_stw(b, *(vusp)(XADDR + TSUNAMI_MEM(XHOSE)));
- mb();
+ __kernel_stw(b, *(vusp)addr);
}
__EXTERN_INLINE void tsunami_writel(unsigned int b, unsigned long addr)
{
- *(vuip)(XADDR + TSUNAMI_MEM(XHOSE)) = b;
- mb();
+ *(vuip)addr = b;
}
__EXTERN_INLINE void tsunami_writeq(unsigned long b, unsigned long addr)
{
- *(vulp)(XADDR + TSUNAMI_MEM(XHOSE)) = b;
- mb();
-}
-
-/* Find the DENSE memory area for a given bus address. */
-
-__EXTERN_INLINE unsigned long tsunami_dense_mem(unsigned long addr)
-{
- return TSUNAMI_MEM(XHOSE);
+ *(vulp)addr = b;
}
#undef vucp
@@ -409,9 +435,6 @@ __EXTERN_INLINE unsigned long tsunami_dense_mem(unsigned long addr)
#undef vuip
#undef vulp
-#undef XADDR
-#undef XHOSE
-
#ifdef __WANT_IO_DEF
#define virt_to_bus tsunami_virt_to_bus
@@ -431,25 +454,24 @@ __EXTERN_INLINE unsigned long tsunami_dense_mem(unsigned long addr)
#define __readq tsunami_readq
#define __writel tsunami_writel
#define __writeq tsunami_writeq
-#define dense_mem tsunami_dense_mem
-
-#define inb(port) __inb((port))
-#define inw(port) __inw((port))
-#define inl(port) __inl((port))
-
-#define outb(v, port) __outb((v),(port))
-#define outw(v, port) __outw((v),(port))
-#define outl(v, port) __outl((v),(port))
-
-#define readb(a) __readb((unsigned long)(a))
-#define readw(a) __readw((unsigned long)(a))
-#define readl(a) __readl((unsigned long)(a))
-#define readq(a) __readq((unsigned long)(a))
-
-#define writeb(v,a) __writeb((v),(unsigned long)(a))
-#define writew(v,a) __writew((v),(unsigned long)(a))
-#define writel(v,a) __writel((v),(unsigned long)(a))
-#define writeq(v,a) __writeq((v),(unsigned long)(a))
+#define __ioremap tsunami_ioremap
+#define __is_ioaddr tsunami_is_ioaddr
+
+#define inb(port) __inb((port))
+#define inw(port) __inw((port))
+#define inl(port) __inl((port))
+#define outb(v, port) __outb((v),(port))
+#define outw(v, port) __outw((v),(port))
+#define outl(v, port) __outl((v),(port))
+
+#define __raw_readb(a) __readb((unsigned long)(a))
+#define __raw_readw(a) __readw((unsigned long)(a))
+#define __raw_readl(a) __readl((unsigned long)(a))
+#define __raw_readq(a) __readq((unsigned long)(a))
+#define __raw_writeb(v,a) __writeb((v),(unsigned long)(a))
+#define __raw_writew(v,a) __writew((v),(unsigned long)(a))
+#define __raw_writel(v,a) __writel((v),(unsigned long)(a))
+#define __raw_writeq(v,a) __writeq((v),(unsigned long)(a))
#endif /* __WANT_IO_DEF */
diff --git a/include/asm-alpha/delay.h b/include/asm-alpha/delay.h
index a55752abb..f60e9b5a7 100644
--- a/include/asm-alpha/delay.h
+++ b/include/asm-alpha/delay.h
@@ -12,9 +12,13 @@
extern __inline__ void
__delay(unsigned long loops)
{
- __asm__ __volatile__(".align 3\n"
- "1:\tsubq %0,1,%0\n\t"
- "bge %0,1b": "=r" (loops) : "0" (loops));
+ register unsigned long r0 __asm__("$0") = loops;
+#ifdef MODULE
+ __asm__ __volatile__("lda $28,___delay; jsr $28,($28),0"
+ : "=r"(r0) : "r"(r0) : "$28");
+#else
+ __asm__ __volatile__("bsr $28,___delay" : "=r"(r0) : "r"(r0) : "$28");
+#endif
}
/*
diff --git a/include/asm-alpha/dma.h b/include/asm-alpha/dma.h
index d415b2a7e..28762e674 100644
--- a/include/asm-alpha/dma.h
+++ b/include/asm-alpha/dma.h
@@ -19,8 +19,8 @@
#define _ASM_DMA_H
#include <linux/config.h>
+#include <linux/spinlock.h>
#include <asm/io.h>
-#include <asm/spinlock.h>
#define dma_outb outb
#define dma_inb inb
@@ -346,10 +346,11 @@ extern int check_dma(unsigned int dmanr);
/* From PCI */
-#ifdef CONFIG_PCI_QUIRKS
+#ifdef CONFIG_PCI
extern int isa_dma_bridge_buggy;
#else
#define isa_dma_bridge_buggy (0)
#endif
+
#endif /* _ASM_DMA_H */
diff --git a/include/asm-alpha/hardirq.h b/include/asm-alpha/hardirq.h
index 1468b28e3..31cdbac06 100644
--- a/include/asm-alpha/hardirq.h
+++ b/include/asm-alpha/hardirq.h
@@ -3,10 +3,14 @@
/* Initially just a straight copy of the i386 code. */
-#include <linux/tasks.h>
+#include <linux/threads.h>
-extern unsigned int local_irq_count[NR_CPUS];
-extern unsigned long hardirq_no[NR_CPUS];
+#ifndef __SMP__
+extern int __local_irq_count;
+#define local_irq_count(cpu) ((void)(cpu), __local_irq_count)
+#else
+#define local_irq_count(cpu) (cpu_data[cpu].irq_count)
+#endif
/*
* Are we in an interrupt context? Either doing bottom half
@@ -16,23 +20,23 @@ extern unsigned long hardirq_no[NR_CPUS];
#define in_interrupt() \
({ \
int __cpu = smp_processor_id(); \
- (local_irq_count[__cpu] + local_bh_count[__cpu]) != 0; \
+ (local_irq_count(__cpu) + local_bh_count(__cpu)) != 0; \
})
#ifndef __SMP__
-#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0)
+#define hardirq_trylock(cpu) (local_irq_count(cpu) == 0)
#define hardirq_endlock(cpu) ((void) 0)
-#define hardirq_enter(cpu, irq) (local_irq_count[cpu]++)
-#define hardirq_exit(cpu, irq) (local_irq_count[cpu]--)
+#define hardirq_enter(cpu, irq) (local_irq_count(cpu)++)
+#define hardirq_exit(cpu, irq) (local_irq_count(cpu)--)
#define synchronize_irq() barrier()
#else
#include <asm/atomic.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#include <asm/smp.h>
extern int global_irq_holder;
@@ -50,21 +54,20 @@ static inline void release_irqlock(int cpu)
static inline void hardirq_enter(int cpu, int irq)
{
- ++local_irq_count[cpu];
+ ++local_irq_count(cpu);
atomic_inc(&global_irq_count);
- hardirq_no[cpu] |= 1L << irq; /* debugging only */
}
static inline void hardirq_exit(int cpu, int irq)
{
- hardirq_no[cpu] &= ~(1L << irq); /* debugging only */
atomic_dec(&global_irq_count);
- --local_irq_count[cpu];
+ --local_irq_count(cpu);
}
static inline int hardirq_trylock(int cpu)
{
- return !atomic_read(&global_irq_count) && !global_irq_lock.lock;
+ return (!atomic_read(&global_irq_count)
+ && !spin_is_locked(&global_irq_lock));
}
#define hardirq_endlock(cpu) ((void)0)
diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h
index 2ef5de935..ecb696099 100644
--- a/include/asm-alpha/ide.h
+++ b/include/asm-alpha/ide.h
@@ -13,6 +13,8 @@
#ifdef __KERNEL__
+#include <linux/config.h>
+
#ifndef MAX_HWIFS
#define MAX_HWIFS 4
#endif
@@ -67,7 +69,7 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
*/
static __inline__ void ide_init_default_hwifs(void)
{
-#ifdef __DO_I_NEED_THIS
+#ifndef CONFIG_BLK_DEV_IDEPCI
hw_regs_t hw;
int index;
@@ -76,7 +78,7 @@ static __inline__ void ide_init_default_hwifs(void)
hw.irq = ide_default_irq(ide_default_io_base(index));
ide_register_hw(&hw, NULL);
}
-#endif /* __DO_I_NEED_THIS */
+#endif /* CONFIG_BLK_DEV_IDEPCI */
}
typedef union {
diff --git a/include/asm-alpha/init.h b/include/asm-alpha/init.h
index f343aecd3..17d215574 100644
--- a/include/asm-alpha/init.h
+++ b/include/asm-alpha/init.h
@@ -1,19 +1 @@
-#ifndef _ALPHA_INIT_H
-#define _ALPHA_INIT_H
-
-#ifndef MODULE
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
-
-/* For assembly routines */
-#define __INIT .section .text.init,"ax"
-#define __FINIT .previous
-#define __INITDATA .section .data.init,"a"
-#endif
-
-#define __cacheline_aligned __attribute__((__aligned__(32)))
-
-#endif
+#error "<asm/init.h> should never be used - use <linux/init.h> instead"
diff --git a/include/asm-alpha/io.h b/include/asm-alpha/io.h
index 5ba356f61..8505e47c8 100644
--- a/include/asm-alpha/io.h
+++ b/include/asm-alpha/io.h
@@ -2,6 +2,7 @@
#define __ALPHA_IO_H
#include <linux/config.h>
+#include <linux/kernel.h>
#include <asm/system.h>
/* We don't use IO slowdowns on the Alpha, but.. */
@@ -103,6 +104,9 @@ extern void _sethae (unsigned long addr); /* cached version */
# define __writel(v,a) alpha_mv.mv_writel((v),(unsigned long)(a))
# define __writeq(v,a) alpha_mv.mv_writeq((v),(unsigned long)(a))
+# define __ioremap(a) alpha_mv.mv_ioremap(a)
+# define __is_ioaddr(a) alpha_mv.mv_is_ioaddr(a)
+
# define inb __inb
# define inw __inw
# define inl __inl
@@ -110,16 +114,14 @@ extern void _sethae (unsigned long addr); /* cached version */
# define outw __outw
# define outl __outl
-# define readb __readb
-# define readw __readw
-# define readl __readl
-# define readq __readq
-# define writeb __writeb
-# define writew __writew
-# define writel __writel
-# define writeq __writeq
-
-# define dense_mem(a) alpha_mv.mv_dense_mem(a)
+# define __raw_readb __readb
+# define __raw_readw __readw
+# define __raw_readl __readl
+# define __raw_readq __readq
+# define __raw_writeb __writeb
+# define __raw_writew __writew
+# define __raw_writel __writel
+# define __raw_writeq __writeq
#else
@@ -142,7 +144,7 @@ extern void _sethae (unsigned long addr); /* cached version */
# include <asm/core_tsunami.h>
#elif defined(CONFIG_ALPHA_JENSEN)
# include <asm/jensen.h>
-#elif defined(CONFIG_ALPHA_RX164)
+#elif defined(CONFIG_ALPHA_POLARIS)
# include <asm/core_polaris.h>
#else
#error "What system is this?"
@@ -244,21 +246,85 @@ extern void writel(unsigned int b, unsigned long addr);
#ifdef __KERNEL__
/*
- * The "address" in IO memory space is not clearly either an integer or a
- * pointer. We will accept both, thus the casts.
+ * On Alpha, we have the whole of I/O space mapped at all times, but
+ * at odd and sometimes discontinuous addresses. Note that the
+ * discontinuities are all across busses, so we need not care for that
+ * for any one device.
*
- * On the alpha, we have the whole physical address space mapped at all
- * times, so "ioremap()" and "iounmap()" do not need to do anything.
+ * Map the I/O space address into the kernel's virtual address space.
*/
static inline void * ioremap(unsigned long offset, unsigned long size)
{
- return (void *) offset;
+ return (void *) __ioremap(offset);
}
static inline void iounmap(void *addr)
{
}
+/* Indirect back to the macros provided. */
+
+extern unsigned long ___raw_readb(unsigned long addr);
+extern unsigned long ___raw_readw(unsigned long addr);
+extern unsigned long ___raw_readl(unsigned long addr);
+extern unsigned long ___raw_readq(unsigned long addr);
+extern void ___raw_writeb(unsigned char b, unsigned long addr);
+extern void ___raw_writew(unsigned short b, unsigned long addr);
+extern void ___raw_writel(unsigned int b, unsigned long addr);
+extern void ___raw_writeq(unsigned long b, unsigned long addr);
+
+#ifdef __raw_readb
+# define readb(a) ({ unsigned long r_ = __raw_readb(a); mb(); r_; })
+#endif
+#ifdef __raw_readw
+# define readw(a) ({ unsigned long r_ = __raw_readw(a); mb(); r_; })
+#endif
+#ifdef __raw_readl
+# define readl(a) ({ unsigned long r_ = __raw_readl(a); mb(); r_; })
+#endif
+#ifdef __raw_readq
+# define readq(a) ({ unsigned long r_ = __raw_readq(a); mb(); r_; })
+#endif
+
+#ifdef __raw_writeb
+# define writeb(v,a) ({ __raw_writeb((v),(a)); mb(); })
+#endif
+#ifdef __raw_writew
+# define writew(v,a) ({ __raw_writew((v),(a)); mb(); })
+#endif
+#ifdef __raw_writel
+# define writel(v,a) ({ __raw_writel((v),(a)); mb(); })
+#endif
+#ifdef __raw_writeq
+# define writeq(v,a) ({ __raw_writeq((v),(a)); mb(); })
+#endif
+
+#ifndef __raw_readb
+# define __raw_readb(a) ___raw_readb((unsigned long)(a))
+#endif
+#ifndef __raw_readw
+# define __raw_readw(a) ___raw_readw((unsigned long)(a))
+#endif
+#ifndef __raw_readl
+# define __raw_readl(a) ___raw_readl((unsigned long)(a))
+#endif
+#ifndef __raw_readq
+# define __raw_readq(a) ___raw_readq((unsigned long)(a))
+#endif
+
+#ifndef __raw_writeb
+# define __raw_writeb(v,a) ___raw_writeb((v),(unsigned long)(a))
+#endif
+#ifndef __raw_writew
+# define __raw_writew(v,a) ___raw_writew((v),(unsigned long)(a))
+#endif
+#ifndef __raw_writel
+# define __raw_writel(v,a) ___raw_writel((v),(unsigned long)(a))
+#endif
+#ifndef __raw_writeq
+# define __raw_writeq(v,a) ___raw_writeq((v),(unsigned long)(a))
+#endif
+
#ifndef readb
# define readb(a) _readb((unsigned long)(a))
#endif
@@ -271,6 +337,7 @@ static inline void iounmap(void *addr)
#ifndef readq
# define readq(a) _readq((unsigned long)(a))
#endif
+
#ifndef writeb
# define writeb(v,a) _writeb((v),(unsigned long)(a))
#endif
diff --git a/include/asm-alpha/jensen.h b/include/asm-alpha/jensen.h
index 874511e94..826dfc54d 100644
--- a/include/asm-alpha/jensen.h
+++ b/include/asm-alpha/jensen.h
@@ -292,12 +292,14 @@ __EXTERN_INLINE void jensen_writeq(unsigned long b, unsigned long addr)
*(vuip) (addr + (4 << 7)) = b >> 32;
}
-/* Find the DENSE memory area for a given bus address.
- Whee, there is none. */
+__EXTERN_INLINE unsigned long jensen_ioremap(unsigned long addr)
+{
+ return addr;
+}
-__EXTERN_INLINE unsigned long jensen_dense_mem(unsigned long addr)
+__EXTERN_INLINE int jensen_is_ioaddr(unsigned long addr)
{
- return 0;
+ return (long)addr >= 0;
}
#undef vuip
@@ -320,7 +322,8 @@ __EXTERN_INLINE unsigned long jensen_dense_mem(unsigned long addr)
#define __readq jensen_readq
#define __writel jensen_writel
#define __writeq jensen_writeq
-#define dense_mem jensen_dense_mem
+#define __ioremap jensen_ioremap
+#define __is_ioaddr jensen_is_ioaddr
/*
* The above have so much overhead that it probably doesn't make
diff --git a/include/asm-alpha/machvec.h b/include/asm-alpha/machvec.h
index 587fa8a3e..14be8d58b 100644
--- a/include/asm-alpha/machvec.h
+++ b/include/asm-alpha/machvec.h
@@ -19,6 +19,8 @@ struct mm_struct;
struct pt_regs;
struct vm_area_struct;
struct linux_hose_info;
+struct pci_dev;
+struct pci_ops;
struct alpha_machine_vector
{
@@ -34,6 +36,8 @@ struct alpha_machine_vector
unsigned long max_dma_address;
unsigned long irq_probe_mask;
unsigned long iack_sc;
+ unsigned long min_io_address;
+ unsigned long min_mem_address;
unsigned long (*mv_virt_to_bus)(void *);
void * (*mv_bus_to_virt)(unsigned long);
@@ -56,23 +60,13 @@ struct alpha_machine_vector
void (*mv_writel)(unsigned int, unsigned long);
void (*mv_writeq)(unsigned long, unsigned long);
- unsigned long (*mv_dense_mem)(unsigned long);
-
- int (*hose_read_config_byte)(u8, u8, u8, u8 *value,
- struct linux_hose_info *);
- int (*hose_read_config_word)(u8, u8, u8, u16 *value,
- struct linux_hose_info *);
- int (*hose_read_config_dword)(u8, u8, u8, u32 *value,
- struct linux_hose_info *);
-
- int (*hose_write_config_byte)(u8, u8, u8, u8 value,
- struct linux_hose_info *);
- int (*hose_write_config_word)(u8, u8, u8, u16 value,
- struct linux_hose_info *);
- int (*hose_write_config_dword)(u8, u8, u8, u32 value,
- struct linux_hose_info *);
-
- void (*mv_get_mmu_context)(struct task_struct *);
+ unsigned long (*mv_ioremap)(unsigned long);
+ int (*mv_is_ioaddr)(unsigned long);
+
+ void (*mv_switch_mm)(struct mm_struct *, struct mm_struct *,
+ struct task_struct *, long);
+ void (*mv_activate_mm)(struct mm_struct *, struct mm_struct *, long);
+
void (*mv_flush_tlb_current)(struct mm_struct *);
void (*mv_flush_tlb_other)(struct mm_struct *);
void (*mv_flush_tlb_current_page)(struct mm_struct * mm,
@@ -87,9 +81,13 @@ struct alpha_machine_vector
void (*init_arch)(unsigned long *, unsigned long *);
void (*init_irq)(void);
void (*init_pit)(void);
- void (*pci_fixup)(void);
+ void (*init_pci)(void);
void (*kill_arch)(int, char *);
+ u8 (*pci_swizzle)(struct pci_dev *, u8 *);
+ int (*pci_map_irq)(struct pci_dev *, u8, u8);
+ struct pci_ops *pci_ops;
+
const char *vector_name;
/* System specific parameters. */
@@ -101,30 +99,23 @@ struct alpha_machine_vector
struct {
unsigned long gamma_bias;
} t2;
- } sys;
- /* Runtime variables it is handy to keep close. */
- unsigned long dma_win_base;
- unsigned long dma_win_size;
- unsigned long sm_base_r1, sm_base_r2, sm_base_r3;
+ struct {
+ unsigned int route_tab;
+ } sio;
+ } sys;
};
extern struct alpha_machine_vector alpha_mv;
#ifdef CONFIG_ALPHA_GENERIC
extern int alpha_using_srm;
-extern int alpha_use_srm_setup;
#else
#ifdef CONFIG_ALPHA_SRM
#define alpha_using_srm 1
#else
#define alpha_using_srm 0
#endif
-#if defined(CONFIG_ALPHA_SRM_SETUP)
-#define alpha_use_srm_setup 1
-#else
-#define alpha_use_srm_setup 0
-#endif
#endif /* GENERIC */
#endif
diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h
index 7b800d156..64d550938 100644
--- a/include/asm-alpha/mmu_context.h
+++ b/include/asm-alpha/mmu_context.h
@@ -11,6 +11,34 @@
#include <asm/system.h>
#include <asm/machvec.h>
+
+/*
+ * Force a context reload. This is needed when we change the page
+ * table pointer or when we update the ASN of the current process.
+ */
+
+/* Don't get into trouble with dueling __EXTERN_INLINEs. */
+#ifndef __EXTERN_INLINE
+#include <asm/io.h>
+#endif
+
+extern inline unsigned long
+__reload_thread(struct thread_struct *pcb)
+{
+ register unsigned long a0 __asm__("$16");
+ register unsigned long v0 __asm__("$0");
+
+ a0 = virt_to_phys(pcb);
+ __asm__ __volatile__(
+ "call_pal %2 #__reload_thread"
+ : "=r"(v0), "=r"(a0)
+ : "i"(PAL_swpctx), "r"(a0)
+ : "$1", "$16", "$22", "$23", "$24", "$25");
+
+ return v0;
+}
+
+
/*
* The maximum ASN's the processor supports. On the EV4 this is 63
* but the PAL-code doesn't actually use this information. On the
@@ -66,7 +94,11 @@ extern unsigned long last_asn;
#endif /* __SMP__ */
#define WIDTH_HARDWARE_ASN 8
+#ifdef __SMP__
#define WIDTH_THIS_PROCESSOR 5
+#else
+#define WIDTH_THIS_PROCESSOR 0
+#endif
#define ASN_FIRST_VERSION (1UL << (WIDTH_THIS_PROCESSOR + WIDTH_HARDWARE_ASN))
#define HARDWARE_ASN_MASK ((1UL << WIDTH_HARDWARE_ASN) - 1)
@@ -87,65 +119,104 @@ extern unsigned long last_asn;
#define __MMU_EXTERN_INLINE
#endif
-extern void get_new_mmu_context(struct task_struct *p, struct mm_struct *mm);
+extern void get_new_mm_context(struct task_struct *p, struct mm_struct *mm);
static inline unsigned long
-__get_new_mmu_context(struct task_struct *p, struct mm_struct *mm)
+__get_new_mm_context(struct mm_struct *mm, long cpu)
{
- unsigned long asn = cpu_last_asn(smp_processor_id());
+ unsigned long asn = cpu_last_asn(cpu);
unsigned long next = asn + 1;
- if ((next ^ asn) & ~MAX_ASN) {
+ if ((asn & HARDWARE_ASN_MASK) >= MAX_ASN) {
tbiap();
next = (asn & ~HARDWARE_ASN_MASK) + ASN_FIRST_VERSION;
}
- cpu_last_asn(smp_processor_id()) = next;
- mm->context = next; /* full version + asn */
+ cpu_last_asn(cpu) = next;
return next;
}
__EXTERN_INLINE void
-ev4_get_mmu_context(struct task_struct *p)
+ev4_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
+ struct task_struct *next, long cpu)
{
/* As described, ASN's are broken. But we can optimize for
switching between threads -- if the mm is unchanged from
current we needn't flush. */
- if (current->mm != p->mm)
+ /* ??? May not be needed because EV4 PALcode recognizes that
+ ASN's are broken and does a tbiap itself on swpctx, under
+ the "Must set ASN or flush" rule. At least this is true
+ for a 1992 SRM, reports Joseph Martin (jmartin@hlo.dec.com).
+ I'm going to leave this here anyway, just to Be Sure. -- r~ */
+
+ if (prev_mm != next_mm)
tbiap();
}
__EXTERN_INLINE void
-ev5_get_mmu_context(struct task_struct *p)
+ev4_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, long cpu)
+{
+ /* This is only called after changing mm on current. */
+ tbiap();
+
+ current->thread.ptbr
+ = ((unsigned long) next_mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
+}
+
+__EXTERN_INLINE void
+ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
+ struct task_struct *next, long cpu)
{
/* Check if our ASN is of an older version, or on a different CPU,
and thus invalid. */
+ /* ??? If we have two threads on different cpus, we'll continually
+ fight over the context. Find a way to record a per-mm, per-cpu
+ value for the asn. */
- long asn = cpu_last_asn(smp_processor_id());
- struct mm_struct *mm = p->mm;
- long mmc = mm->context;
+ unsigned long asn = cpu_last_asn(cpu);
+ unsigned long mmc = next_mm->context;
- if ((p->tss.mm_context ^ asn) & ~HARDWARE_ASN_MASK) {
- if ((mmc ^ asn) & ~HARDWARE_ASN_MASK)
- mmc = __get_new_mmu_context(p, mm);
- p->tss.mm_context = mmc;
- p->tss.asn = mmc & HARDWARE_ASN_MASK;
+ if ((mmc ^ asn) & ~HARDWARE_ASN_MASK) {
+ mmc = __get_new_mm_context(next_mm, cpu);
+ next_mm->context = mmc;
}
+
+ /* Always update the PCB ASN. Another thread may have allocated
+ a new mm->context (via flush_tlb_mm) without the ASN serial
+ number wrapping. We have no way to detect when this is needed. */
+ next->thread.asn = mmc & HARDWARE_ASN_MASK;
}
+__EXTERN_INLINE void
+ev5_activate_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, long cpu)
+{
+ unsigned long mmc = __get_new_mm_context(next_mm, cpu);
+ next_mm->context = mmc;
+ current->thread.asn = mmc & HARDWARE_ASN_MASK;
+ current->thread.ptbr
+ = ((unsigned long) next_mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
+
+ __reload_thread(&current->thread);
+}
+
+
#ifdef CONFIG_ALPHA_GENERIC
-# define get_mmu_context (alpha_mv.mv_get_mmu_context)
+# define switch_mm alpha_mv.mv_switch_mm
+# define activate_mm(x,y) alpha_mv.mv_activate_mm((x),(y),smp_processor_id())
#else
# ifdef CONFIG_ALPHA_EV4
-# define get_mmu_context ev4_get_mmu_context
+# define switch_mm ev4_switch_mm
+# define activate_mm(x,y) ev4_activate_mm((x),(y),smp_processor_id())
# else
-# define get_mmu_context ev5_get_mmu_context
+# define switch_mm ev5_switch_mm
+# define activate_mm(x,y) ev5_activate_mm((x),(y),smp_processor_id())
# endif
#endif
extern inline void
-init_new_context(struct mm_struct *mm)
+init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
mm->context = 0;
+ tsk->thread.ptbr = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
}
extern inline void
@@ -159,48 +230,4 @@ destroy_context(struct mm_struct *mm)
#undef __MMU_EXTERN_INLINE
#endif
-/*
- * Force a context reload. This is needed when we change the page
- * table pointer or when we update the ASN of the current process.
- */
-
-/* Don't get into trouble with dueling __EXTERN_INLINEs. */
-#ifndef __EXTERN_INLINE
-#include <asm/io.h>
-#endif
-
-extern inline unsigned long
-__reload_tss(struct thread_struct *tss)
-{
- register unsigned long a0 __asm__("$16");
- register unsigned long v0 __asm__("$0");
-
- a0 = virt_to_phys(tss);
- __asm__ __volatile__(
- "call_pal %2 #__reload_tss"
- : "=r"(v0), "=r"(a0)
- : "i"(PAL_swpctx), "r"(a0)
- : "$1", "$16", "$22", "$23", "$24", "$25");
-
- return v0;
-}
-
-extern inline void
-reload_context(struct task_struct *task)
-{
- __reload_tss(&task->tss);
-}
-
-/*
- * After setting current->mm to a new value, activate the context for the
- * new mm so we see the new mappings.
- */
-
-extern inline void
-activate_context(struct task_struct *task)
-{
- get_new_mmu_context(task, task->mm);
- reload_context(task);
-}
-
#endif /* __ALPHA_MMU_CONTEXT_H */
diff --git a/include/asm-alpha/page.h b/include/asm-alpha/page.h
index 816219ce9..8011c5859 100644
--- a/include/asm-alpha/page.h
+++ b/include/asm-alpha/page.h
@@ -106,13 +106,8 @@ typedef unsigned long pgprot_t;
#endif /* STRICT_MM_TYPECHECKS */
-#define BUG() \
-do { \
- printk("Kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
- __asm__ __volatile__("call_pal 129 # bugchk"); \
-} while (1)
-
-#define PAGE_BUG(page) BUG()
+#define BUG() __asm__ __volatile__("call_pal 129 # bugchk")
+#define PAGE_BUG(page) BUG()
#endif /* !ASSEMBLY */
diff --git a/include/asm-alpha/param.h b/include/asm-alpha/param.h
index 3b586974f..987879760 100644
--- a/include/asm-alpha/param.h
+++ b/include/asm-alpha/param.h
@@ -1,8 +1,18 @@
#ifndef _ASM_ALPHA_PARAM_H
#define _ASM_ALPHA_PARAM_H
+/* ??? Gross. I don't want to parameterize this, and supposedly the
+ hardware ignores reprogramming. We also need userland buy-in to the
+ change in HZ, since this is visible in the wait4 resources etc. */
+
+#include <linux/config.h>
+
#ifndef HZ
-# define HZ 1024
+# ifndef CONFIG_ALPHA_RAWHIDE
+# define HZ 1024
+# else
+# define HZ 1200
+# endif
# define HZ_TO_STD(a) (a)
#endif
diff --git a/include/asm-alpha/parport.h b/include/asm-alpha/parport.h
new file mode 100644
index 000000000..e9b590ee1
--- /dev/null
+++ b/include/asm-alpha/parport.h
@@ -0,0 +1,59 @@
+/*
+ * parport.h: platform-specific PC-style parport initialisation
+ *
+ * Copyright (C) 1999 Tim Waugh <tim@cyberelk.demon.co.uk>
+ *
+ * This file should only be included by drivers/parport/parport_pc.c.
+ */
+
+#ifndef _ASM_AXP_PARPORT_H
+#define _ASM_AXP_PARPORT_H 1
+
+#include <linux/config.h>
+
+/* Maximum number of ports to support. It is useless to set this greater
+ than PARPORT_MAX (in <linux/parport.h>). */
+#define PARPORT_PC_MAX_PORTS 8
+
+/* If parport_cs (PCMCIA) is managing ports for us, we'll need the
+ * probing routines forever; otherwise we can lose them at boot time. */
+#ifdef CONFIG_PARPORT_PC_PCMCIA
+#define __maybe_initdata
+#define __maybe_init
+#else
+#define __maybe_initdata __initdata
+#define __maybe_init __init
+#endif
+
+static int __maybe_init parport_pc_init_pci(int irq, int dma);
+
+static int user_specified __maybe_initdata = 0;
+int __init
+parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
+{
+ int count = 0, i = 0;
+
+ if (io && *io) {
+ /* Only probe the ports we were given. */
+ user_specified = 1;
+ do {
+ if (!*io_hi) *io_hi = 0x400 + *io;
+ if (parport_pc_probe_port(*(io++), *(io_hi++),
+ *(irq++), *(dma++)))
+ count++;
+ } while (*io && (++i < PARPORT_PC_MAX_PORTS));
+ } else {
+ /* Probe all the likely ports. */
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ count++;
+ count += parport_pc_init_pci (irq[0], dma[0]);
+ }
+
+ return count;
+}
+
+#endif /* !(_ASM_AXP_PARPORT_H) */
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index fa6bd17e1..f78c9b975 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -1,48 +1,31 @@
#ifndef __ALPHA_PCI_H
#define __ALPHA_PCI_H
-#include <linux/config.h>
-#include <linux/pci.h>
-
-
/*
* The following structure is used to manage multiple PCI busses.
- *
- * XXX: We should solve this problem in an architecture independent
- * way, rather than hacking something up here.
*/
-struct linux_hose_info {
- struct pci_bus pci_bus;
- struct linux_hose_info *next;
- unsigned long pci_io_space;
- unsigned long pci_mem_space;
- unsigned long pci_config_space;
- unsigned long pci_sparse_space;
- unsigned int pci_first_busno;
- unsigned int pci_last_busno;
- unsigned int pci_hose_index;
+struct pci_bus;
+struct resource;
+
+struct pci_controler {
+ /* Mandated. */
+ struct pci_controler *next;
+ struct pci_bus *bus;
+ struct resource *io_space;
+ struct resource *mem_space;
+
+ /* Alpha specific. */
+ unsigned long config_space;
+ unsigned int index;
+ unsigned int first_busno;
+ unsigned int last_busno;
};
-/* This is indexed by a pseudo- PCI bus number to obtain the real deal. */
-extern struct linux_hose_info *bus2hose[256];
-
-/* Create a handle that is OR-ed into the reported I/O space address
- for a device. We use this later to find the bus a device lives on. */
-
-#if defined(CONFIG_ALPHA_GENERIC) \
- || defined(CONFIG_ALPHA_MCPCIA) \
- || defined(CONFIG_ALPHA_TSUNAMI)
+/* Override the logic in pci_scan_bus for skipping already-configured
+ bus numbers. */
-#define PCI_HANDLE(bus) ((bus2hose[bus]->pci_hose_index & 3UL) << 32)
-#define DEV_IS_ON_PRIMARY(dev) \
- (bus2hose[(dev)->bus->number]->pci_first_busno == (dev)->bus->number)
-
-#else
-
-#define PCI_HANDLE(bus) 0
-#define DEV_IS_ON_PRIMARY(dev) ((dev)->bus->number == 0)
-
-#endif /* Multiple busses */
+#define pcibios_assign_all_busses() 1
#endif /* __ALPHA_PCI_H */
+
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
index a11a02920..004924b93 100644
--- a/include/asm-alpha/pgtable.h
+++ b/include/asm-alpha/pgtable.h
@@ -9,12 +9,12 @@
* in <asm/page.h> (currently 8192).
*/
#include <linux/config.h>
+#include <linux/spinlock.h> /* For the task lock */
#include <asm/system.h>
#include <asm/processor.h> /* For TASK_SIZE */
#include <asm/mmu_context.h>
#include <asm/machvec.h>
-#include <asm/spinlock.h> /* For the task lock */
/* Caches aren't brain-dead on the Alpha. */
@@ -46,13 +46,7 @@ ev4_flush_tlb_other(struct mm_struct *mm)
{
}
-__EXTERN_INLINE void
-ev5_flush_tlb_current(struct mm_struct *mm)
-{
- mm->context = 0;
- get_new_mmu_context(current, mm);
- reload_context(current);
-}
+extern void ev5_flush_tlb_current(struct mm_struct *mm);
__EXTERN_INLINE void
ev5_flush_tlb_other(struct mm_struct *mm)
@@ -395,22 +389,6 @@ extern inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) &= ~_PAGE_FOE; return p
extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; }
extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; }
-/*
- * To set the page-dir. Note the self-mapping in the last entry
- *
- * Also note that if we update the current process ptbr, we need to
- * update the PAL-cached ptbr value as well.. There doesn't seem to
- * be any "wrptbr" PAL-insn, but we can do a dummy swpctx to ourself
- * instead.
- */
-extern inline void SET_PAGE_DIR(struct task_struct * tsk, pgd_t * pgdir)
-{
- pgd_val(pgdir[PTRS_PER_PGD]) = pte_val(mk_pte((unsigned long) pgdir, PAGE_KERNEL));
- tsk->tss.ptbr = ((unsigned long) pgdir - PAGE_OFFSET) >> PAGE_SHIFT;
- if (tsk == current)
- reload_context(tsk);
-}
-
#define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address))
/* to find an entry in a kernel page-table-directory */
@@ -463,6 +441,9 @@ extern __inline__ pgd_t *get_pgd_slow(void)
memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+
+ pgd_val(ret[PTRS_PER_PGD])
+ = pte_val(mk_pte((unsigned long)ret, PAGE_KERNEL));
}
return ret;
}
@@ -640,4 +621,7 @@ extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
#define PageSkip(page) (0)
#define kern_addr_valid(addr) (1)
+#define io_remap_page_range(start, busaddr, size, prot) \
+ remap_page_range(start, virt_to_phys(ioremap(busaddr)), size, prot)
+
#endif /* _ALPHA_PGTABLE_H */
diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h
index fa6c47b63..0c5163433 100644
--- a/include/asm-alpha/processor.h
+++ b/include/asm-alpha/processor.h
@@ -61,15 +61,6 @@ struct thread_struct {
*/
unsigned long flags;
- /* The full version of the ASN including serial number.
-
- Two threads running on two different processors must of necessity
- have different serial numbers. Having this duplicated from
- mm->context allows them to be slightly out of sync preventing
- the asn from incrementing each and every time the two threads
- are scheduled. */
- unsigned long mm_context;
-
/* Perform syscall argument validation (get/set_fs). */
mm_segment_t fs;
@@ -82,14 +73,16 @@ struct thread_struct {
#define INIT_MMAP { &init_mm, PAGE_OFFSET, PAGE_OFFSET+0x10000000, \
NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-#define INIT_TSS { \
+#define INIT_THREAD { \
0, 0, 0, \
0, 0, 0, \
0, 0, 0, \
- 0, 0, \
+ 0, \
KERNEL_DS \
}
+#define THREAD_SIZE (2*PAGE_SIZE)
+
#include <asm/ptrace.h>
/*
@@ -118,15 +111,16 @@ extern inline unsigned long thread_saved_pc(struct thread_struct *t)
return 0;
}
-/*
- * Do necessary setup to start up a newly executed thread.
- */
+/* Do necessary setup to start up a newly executed thread. */
extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
-#define copy_segments(nr, tsk, mm) do { } while (0)
+/* Create a kernel thread without removing it from tasklists. */
+extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
+
+#define copy_segments(tsk, mm) do { } while (0)
#define release_segments(mm) do { } while (0)
#define forget_segments() do { } while (0)
@@ -138,14 +132,4 @@ extern void release_thread(struct task_struct *);
#define init_task (init_task_union.task)
#define init_stack (init_task_union.stack)
-/*
- * Return_address is a replacement for __builtin_return_address(count)
- * which on certain architectures cannot reasonably be implemented in GCC
- * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
- * Note that __builtin_return_address(x>=1) is forbidden because the GCC
- * aborts compilation on some CPUs. It's simply not possible to unwind
- * some CPU's stackframes.
- */
-#define return_address() __builtin_return_address(0)
-
#endif /* __ASM_ALPHA_PROCESSOR_H */
diff --git a/include/asm-alpha/ptrace.h b/include/asm-alpha/ptrace.h
index 4079385ec..268ebfced 100644
--- a/include/asm-alpha/ptrace.h
+++ b/include/asm-alpha/ptrace.h
@@ -67,7 +67,7 @@ struct switch_stack {
};
#ifdef __KERNEL__
-#define user_mode(regs) ((regs)->ps & 8)
+#define user_mode(regs) (((regs)->ps & 8) != 0)
#define instruction_pointer(regs) ((regs)->pc)
extern void show_regs(struct pt_regs *);
#endif
diff --git a/include/asm-alpha/resource.h b/include/asm-alpha/resource.h
index 96b338fc4..234cbfa2f 100644
--- a/include/asm-alpha/resource.h
+++ b/include/asm-alpha/resource.h
@@ -25,12 +25,12 @@
{LONG_MAX, LONG_MAX}, /* RLIMIT_CPU */ \
{LONG_MAX, LONG_MAX}, /* RLIMIT_FSIZE */ \
{LONG_MAX, LONG_MAX}, /* RLIMIT_DATA */ \
- {_STK_LIM, _STK_LIM}, /* RLIMIT_STACK */ \
+ {_STK_LIM, LONG_MAX}, /* RLIMIT_STACK */ \
{ 0, LONG_MAX}, /* RLIMIT_CORE */ \
{LONG_MAX, LONG_MAX}, /* RLIMIT_RSS */ \
- { NR_OPEN, NR_OPEN}, /* RLIMIT_NOFILE */ \
+ {INR_OPEN, INR_OPEN}, /* RLIMIT_NOFILE */ \
{LONG_MAX, LONG_MAX}, /* RLIMIT_AS */ \
- {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, /* RLIMIT_NPROC */ \
+ {LONG_MAX, LONG_MAX}, /* RLIMIT_NPROC */ \
{LONG_MAX, LONG_MAX}, /* RLIMIT_MEMLOCK */ \
}
diff --git a/include/asm-alpha/serial.h b/include/asm-alpha/serial.h
index 7b2d9ee95..0b339a0c1 100644
--- a/include/asm-alpha/serial.h
+++ b/include/asm-alpha/serial.h
@@ -26,6 +26,9 @@
#define FOURPORT_FLAGS ASYNC_FOURPORT
#define ACCENT_FLAGS 0
#define BOCA_FLAGS 0
+#define RS_TABLE_SIZE 64
+#else
+#define RS_TABLE_SIZE 4
#endif
#define STD_SERIAL_PORT_DEFNS \
diff --git a/include/asm-alpha/smp.h b/include/asm-alpha/smp.h
index 785194f81..e85061736 100644
--- a/include/asm-alpha/smp.h
+++ b/include/asm-alpha/smp.h
@@ -1,11 +1,25 @@
#ifndef __ASM_SMP_H
#define __ASM_SMP_H
+#include <asm/pal.h>
+
+/* HACK: Cabrio WHAMI return value is bogus if more than 8 bits used.. :-( */
+
+static __inline__ unsigned char
+__hard_smp_processor_id(void)
+{
+ register unsigned char __r0 __asm__("$0");
+ __asm__ __volatile__(
+ "call_pal %1 #whami"
+ : "=r"(__r0)
+ :"i" (PAL_whami)
+ : "$1", "$22", "$23", "$24", "$25");
+ return __r0;
+}
+
#ifdef __SMP__
-#include <linux/tasks.h>
-#include <asm/init.h>
-#include <asm/pal.h>
+#include <linux/threads.h>
struct cpuinfo_alpha {
unsigned long loops_per_sec;
@@ -16,7 +30,11 @@ struct cpuinfo_alpha {
unsigned long ipi_count;
unsigned long prof_multiplier;
unsigned long prof_counter;
-} __cacheline_aligned;
+ int irq_count, bh_count;
+ unsigned char mcheck_expected;
+ unsigned char mcheck_taken;
+ unsigned char mcheck_extra;
+} __attribute__((aligned(64)));
extern struct cpuinfo_alpha cpu_data[NR_CPUS];
@@ -30,19 +48,7 @@ extern int cpu_number_map[NR_CPUS];
extern int __cpu_logical_map[NR_CPUS];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
-/* HACK: Cabrio WHAMI return value is bogus if more than 8 bits used.. :-( */
-
-static __inline__ unsigned char hard_smp_processor_id(void)
-{
- register unsigned char __r0 __asm__("$0");
- __asm__ __volatile__(
- "call_pal %1 #whami"
- : "=r"(__r0)
- :"i" (PAL_whami)
- : "$1", "$22", "$23", "$24", "$25");
- return __r0;
-}
-
+#define hard_smp_processor_id() __hard_smp_processor_id()
#define smp_processor_id() (current->processor)
#endif /* __SMP__ */
diff --git a/include/asm-alpha/smplock.h b/include/asm-alpha/smplock.h
index a33fd546a..2a5c62700 100644
--- a/include/asm-alpha/smplock.h
+++ b/include/asm-alpha/smplock.h
@@ -6,7 +6,7 @@
#include <linux/sched.h>
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-alpha/softirq.h b/include/asm-alpha/softirq.h
index dad9c4905..d49064790 100644
--- a/include/asm-alpha/softirq.h
+++ b/include/asm-alpha/softirq.h
@@ -5,28 +5,33 @@
#include <asm/atomic.h>
#include <asm/hardirq.h>
-extern unsigned int local_bh_count[NR_CPUS];
+#ifndef __SMP__
+extern int __local_bh_count;
+#define local_bh_count(cpu) ((void)(cpu), __local_bh_count)
+#else
+#define local_bh_count(cpu) (cpu_data[cpu].bh_count)
+#endif
extern inline void cpu_bh_disable(int cpu)
{
- local_bh_count[cpu]++;
+ local_bh_count(cpu)++;
mb();
}
extern inline void cpu_bh_enable(int cpu)
{
mb();
- local_bh_count[cpu]--;
+ local_bh_count(cpu)--;
}
extern inline int cpu_bh_trylock(int cpu)
{
- return local_bh_count[cpu] ? 0 : (local_bh_count[cpu] = 1);
+ return local_bh_count(cpu) ? 0 : (local_bh_count(cpu) = 1);
}
extern inline void cpu_bh_endlock(int cpu)
{
- local_bh_count[cpu] = 0;
+ local_bh_count(cpu) = 0;
}
#define local_bh_enable() cpu_bh_enable(smp_processor_id())
diff --git a/include/asm-alpha/spinlock.h b/include/asm-alpha/spinlock.h
index 454a56582..6153b2a86 100644
--- a/include/asm-alpha/spinlock.h
+++ b/include/asm-alpha/spinlock.h
@@ -2,102 +2,6 @@
#define _ALPHA_SPINLOCK_H
#include <asm/system.h>
-
-/*
- * These are the generic versions of the spinlocks
- * and read-write locks.. We should actually do a
- * <linux/spinlock.h> with all of this. Oh, well.
- */
-#define spin_lock_irqsave(lock, flags) \
- do { local_irq_save(flags); spin_lock(lock); } while (0)
-#define spin_lock_irq(lock) \
- do { local_irq_disable(); spin_lock(lock); } while (0)
-#define spin_lock_bh(lock) \
- do { local_bh_disable(); spin_lock(lock); } while (0)
-
-#define read_lock_irqsave(lock, flags) \
- do { local_irq_save(flags); read_lock(lock); } while (0)
-#define read_lock_irq(lock) \
- do { local_irq_disable(); read_lock(lock); } while (0)
-#define read_lock_bh(lock) \
- do { local_bh_disable(); read_lock(lock); } while (0)
-
-#define write_lock_irqsave(lock, flags) \
- do { local_irq_save(flags); write_lock(lock); } while (0)
-#define write_lock_irq(lock) \
- do { local_irq_disable(); write_lock(lock); } while (0)
-#define write_lock_bh(lock) \
- do { local_bh_disable(); write_lock(lock); } while (0)
-
-#define spin_unlock_irqrestore(lock, flags) \
- do { spin_unlock(lock); local_irq_restore(flags); } while (0)
-#define spin_unlock_irq(lock) \
- do { spin_unlock(lock); local_irq_enable(); } while (0)
-#define spin_unlock_bh(lock) \
- do { spin_unlock(lock); local_bh_enable(); } while (0)
-
-#define read_unlock_irqrestore(lock, flags) \
- do { read_unlock(lock); local_irq_restore(flags); } while (0)
-#define read_unlock_irq(lock) \
- do { read_unlock(lock); local_irq_enable(); } while (0)
-#define read_unlock_bh(lock) \
- do { read_unlock(lock); local_bh_enable(); } while (0)
-
-#define write_unlock_irqrestore(lock, flags) \
- do { write_unlock(lock); local_irq_restore(flags); } while (0)
-#define write_unlock_irq(lock) \
- do { write_unlock(lock); local_irq_enable(); } while (0)
-#define write_unlock_bh(lock) \
- do { write_unlock(lock); local_bh_enable(); } while (0)
-
-#ifndef __SMP__
-
-/*
- * Your basic spinlocks, allowing only a single CPU anywhere
- *
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
- typedef struct { } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
-#else
- typedef struct { int gcc_is_buggy; } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-#endif
-
-#define spin_lock_init(lock) ((void) 0)
-#define spin_lock(lock) ((void) 0)
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) ((void) 0)
-#define spin_unlock(lock) ((void) 0)
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- *
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
- typedef struct { } rwlock_t;
- #define RW_LOCK_UNLOCKED (rwlock_t) { }
-#else
- typedef struct { int gcc_is_buggy; } rwlock_t;
- #define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
-#endif
-
-#define read_lock(lock) ((void) 0)
-#define read_unlock(lock) ((void) 0)
-#define write_lock(lock) ((void) 0)
-#define write_unlock(lock) ((void) 0)
-
-#else /* __SMP__ */
-
#include <linux/kernel.h>
#include <asm/current.h>
@@ -131,8 +35,8 @@ typedef struct {
#define spin_lock_init(x) ((x)->lock = 0)
#endif
-#define spin_unlock_wait(x) \
- ({ do { barrier(); } while(((volatile spinlock_t *)x)->lock); })
+#define spin_is_locked(x) ((x)->lock != 0)
+#define spin_unlock_wait(x) ({ do { barrier(); } while ((x)->lock); })
typedef struct { unsigned long a[100]; } __dummy_lock_t;
#define __dummy_lock(lock) (*(__dummy_lock_t *)(lock))
@@ -263,5 +167,4 @@ static inline void read_unlock(rwlock_t * lock)
: "m" (__dummy_lock(lock)));
}
-#endif /* SMP */
#endif /* _ALPHA_SPINLOCK_H */
diff --git a/include/asm-alpha/string.h b/include/asm-alpha/string.h
index f53d2ff74..8f87ba2cb 100644
--- a/include/asm-alpha/string.h
+++ b/include/asm-alpha/string.h
@@ -44,6 +44,7 @@ extern void * __memset(void *, int, size_t);
#define __HAVE_ARCH_STRCHR
#define __HAVE_ARCH_STRRCHR
#define __HAVE_ARCH_STRLEN
+#define __HAVE_ARCH_MEMCHR
/* The following routine is like memset except that it writes 16-bit
aligned values. The DEST and COUNT parameters must be even for
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h
index 6939d37ab..880f0f4bb 100644
--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -88,11 +88,12 @@ struct el_common_EV5_uncorrectable_mcheck {
extern void halt(void) __attribute__((noreturn));
+#define prepare_to_switch() do { } while(0)
#define switch_to(prev,next,last) \
do { \
unsigned long pcbb; \
current = (next); \
- pcbb = virt_to_phys(&current->tss); \
+ pcbb = virt_to_phys(&current->thread); \
(last) = alpha_switch_to(pcbb, (prev)); \
} while (0)
@@ -107,6 +108,15 @@ __asm__ __volatile__("mb": : :"memory")
#define wmb() \
__asm__ __volatile__("wmb": : :"memory")
+#define set_mb(var, value) \
+do { var = value; mb(); } while (0)
+
+#define set_rmb(var, value) \
+do { var = value; rmb(); } while (0)
+
+#define set_wmb(var, value) \
+do { var = value; wmb(); } while (0)
+
#define imb() \
__asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
diff --git a/include/asm-alpha/uaccess.h b/include/asm-alpha/uaccess.h
index f615339f8..e08947135 100644
--- a/include/asm-alpha/uaccess.h
+++ b/include/asm-alpha/uaccess.h
@@ -23,9 +23,9 @@
#define VERIFY_READ 0
#define VERIFY_WRITE 1
-#define get_fs() (current->tss.fs)
+#define get_fs() (current->thread.fs)
#define get_ds() (KERNEL_DS)
-#define set_fs(x) (current->tss.fs = (x))
+#define set_fs(x) (current->thread.fs = (x))
#define segment_eq(a,b) ((a).seg == (b).seg)
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index df20edc7f..c2fe527c1 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -257,7 +257,7 @@
#define __NR_munlockall 317
#define __NR_sysinfo 318
#define __NR__sysctl 319
-#define __NR_idle 320
+/* 320 was sys_idle. */
#define __NR_oldumount 321
#define __NR_swapon 322
#define __NR_times 323
@@ -308,6 +308,8 @@
#define __NR_capget 368
#define __NR_capset 369
#define __NR_sendfile 370
+#define __NR_setresgid 371
+#define __NR_getresgid 372
#if defined(__LIBRARY__) && defined(__GNUC__)
@@ -496,32 +498,25 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, type6 arg6)\
#include <linux/string.h>
#include <linux/signal.h>
-extern long __kernel_thread(unsigned long, int (*)(void *), void *);
-
-static inline long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
-{
- return __kernel_thread(flags | CLONE_VM, fn, arg);
-}
-
extern void sys_idle(void);
static inline void idle(void)
{
sys_idle();
}
-extern int sys_open(const char *, int, int);
-static inline int open(const char * name, int mode, int flags)
+extern long sys_open(const char *, int, int);
+static inline long open(const char * name, int mode, int flags)
{
return sys_open(name, mode, flags);
}
-extern int sys_dup(int);
-static inline int dup(int fd)
+extern long sys_dup(int);
+static inline long dup(int fd)
{
return sys_dup(fd);
}
-static inline int close(int fd)
+static inline long close(int fd)
{
return sys_close(fd);
}
@@ -532,47 +527,47 @@ static inline off_t lseek(int fd, off_t off, int whense)
return sys_lseek(fd, off, whense);
}
-extern int sys_exit(int);
-static inline int _exit(int value)
+extern long sys_exit(int);
+static inline long _exit(int value)
{
return sys_exit(value);
}
#define exit(x) _exit(x)
-extern int sys_write(int, const char *, int);
-static inline int write(int fd, const char * buf, int nr)
+extern long sys_write(int, const char *, int);
+static inline long write(int fd, const char * buf, int nr)
{
return sys_write(fd, buf, nr);
}
-extern int sys_read(int, char *, int);
-static inline int read(int fd, char * buf, int nr)
+extern long sys_read(int, char *, int);
+static inline long read(int fd, char * buf, int nr)
{
return sys_read(fd, buf, nr);
}
extern int __kernel_execve(char *, char **, char **, struct pt_regs *);
-static inline int execve(char * file, char ** argvp, char ** envp)
+static inline long execve(char * file, char ** argvp, char ** envp)
{
struct pt_regs regs;
memset(&regs, 0, sizeof(regs));
return __kernel_execve(file, argvp, envp, &regs);
}
-extern int sys_setsid(void);
-static inline int setsid(void)
+extern long sys_setsid(void);
+static inline long setsid(void)
{
return sys_setsid();
}
-extern int sys_sync(void);
-static inline int sync(void)
+extern long sys_sync(void);
+static inline long sync(void)
{
return sys_sync();
}
-extern int sys_wait4(int, int *, int, struct rusage *);
+extern long sys_wait4(int, int *, int, struct rusage *);
static inline pid_t waitpid(int pid, int * wait_stat, int flags)
{
return sys_wait4(pid, wait_stat, flags, NULL);
@@ -583,8 +578,8 @@ static inline pid_t wait(int * wait_stat)
return waitpid(-1,wait_stat,0);
}
-extern int sys_delete_module(const char *name);
-static inline int delete_module(const char *name)
+extern long sys_delete_module(const char *name);
+static inline long delete_module(const char *name)
{
return sys_delete_module(name);
}
diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h
index 7e66f50d3..17e164742 100644
--- a/include/asm-alpha/vga.h
+++ b/include/asm-alpha/vga.h
@@ -15,26 +15,26 @@
extern inline void scr_writew(u16 val, u16 *addr)
{
- if ((long) addr < 0)
- *addr = val;
+ if (__is_ioaddr((unsigned long) addr))
+ __raw_writew(val, (unsigned long) addr);
else
- writew(val, (unsigned long) addr);
+ *addr = val;
}
extern inline u16 scr_readw(const u16 *addr)
{
- if ((long) addr < 0)
- return *addr;
+ if (__is_ioaddr((unsigned long) addr))
+ return __raw_readw((unsigned long) addr);
else
- return readw((unsigned long) addr);
+ return *addr;
}
extern inline void scr_memsetw(u16 *s, u16 c, unsigned int count)
{
- if ((long)s < 0)
- memsetw(s, c, count);
- else
+ if (__is_ioaddr((unsigned long) s))
memsetw_io(s, c, count);
+ else
+ memsetw(s, c, count);
}
extern inline void scr_memcpyw_from(u16 *d, const u16 *s, unsigned int count)
@@ -47,10 +47,12 @@ extern inline void scr_memcpyw_to(u16 *d, const u16 *s, unsigned int count)
memcpy_toio(d, s, count);
}
+/* ??? These are currently only used for downloading character sets. As
+ such, they don't need memory barriers. Is this all they are intended
+ to be used for? */
+#define vga_readb readb
+#define vga_writeb writeb
-#define vga_readb readb
-#define vga_writeb writeb
-
-#define VGA_MAP_MEM(x) (x)
+#define VGA_MAP_MEM(x) ((unsigned long) ioremap((x), 0))
#endif
diff --git a/include/asm-arm/arch-arc/ide.h b/include/asm-arm/arch-arc/ide.h
index 5729b956d..35c28427f 100644
--- a/include/asm-arm/arch-arc/ide.h
+++ b/include/asm-arm/arch-arc/ide.h
@@ -20,7 +20,7 @@
* This should follow whatever the default interface uses.
*/
static __inline__ void
-ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq)
+ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int irq)
{
ide_ioreg_t reg = (ide_ioreg_t) data_port;
int i;
@@ -30,7 +30,7 @@ ide_init_hwif_ports(hw_regs_t *hw, int data_port, int ctrl_port, int *irq)
reg += 1;
}
hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;
- hw->irq = *irq;
+ hw->irq = irq;
}
/*
@@ -44,8 +44,7 @@ static __inline__ void ide_init_default_hwifs(void)
memset(hw, 0, sizeof(*hw));
- ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, NULL);
- hw.irq = IRQ_HARDDISK;
+ ide_init_hwif_ports(&hw, 0x1f0, 0x3f6, IRQ_HARDDISK);
ide_register_hw(&hw, NULL);
#endif
}
diff --git a/include/asm-arm/arch-arc/system.h b/include/asm-arm/arch-arc/system.h
index 9e2e99cfd..068c968cc 100644
--- a/include/asm-arm/arch-arc/system.h
+++ b/include/asm-arm/arch-arc/system.h
@@ -30,7 +30,7 @@ extern __inline__ void arch_reset(char mode)
/*
* Do any cleanups that the processor may require
*/
- processor._proc_fin();
+ cpu_proc_fin();
/*
* Reset all expansion cards.
diff --git a/include/asm-arm/arch-arc/time.h b/include/asm-arm/arch-arc/time.h
index c02ac8df5..5e7f3c863 100644
--- a/include/asm-arm/arch-arc/time.h
+++ b/include/asm-arm/arch-arc/time.h
@@ -167,6 +167,9 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
+
+ if (!user_mode(regs))
+ do_profile(instruction_pointer(regs));
}
static struct irqaction timerirq = {
diff --git a/include/asm-arm/arch-ebsa110/hardware.h b/include/asm-arm/arch-ebsa110/hardware.h
index 5cad83502..afa7275b0 100644
--- a/include/asm-arm/arch-ebsa110/hardware.h
+++ b/include/asm-arm/arch-ebsa110/hardware.h
@@ -40,5 +40,7 @@
#define FLUSH_BASE 0xdf000000
#define PCIO_BASE 0xf0000000
+#define PARAMS_BASE (PAGE_OFFSET + 0x400)
+
#endif
diff --git a/include/asm-arm/arch-ebsa285/io.h b/include/asm-arm/arch-ebsa285/io.h
index b23ee6863..462d6ba72 100644
--- a/include/asm-arm/arch-ebsa285/io.h
+++ b/include/asm-arm/arch-ebsa285/io.h
@@ -1,10 +1,11 @@
/*
* linux/include/asm-arm/arch-ebsa285/io.h
*
- * Copyright (C) 1997,1998 Russell King
+ * Copyright (C) 1997-1999 Russell King
*
* Modifications:
- * 06-Dec-1997 RMK Created.
+ * 06-12-1997 RMK Created.
+ * 07-04-1999 RMK Major cleanup
*/
#ifndef __ASM_ARM_ARCH_IO_H
#define __ASM_ARM_ARCH_IO_H
@@ -18,132 +19,33 @@
#undef ARCH_IO_DELAY
#define ARCH_READWRITE
-/*
- * Dynamic IO functions - let the compiler
- * optimize the expressions
- */
-#define DECLARE_DYN_OUT(fnsuffix,instr,typ) \
-extern __inline__ void \
-__out##fnsuffix (unsigned int value, unsigned int port) \
-{ \
- __asm__ __volatile__( \
- "str%?" ##instr## " %0, [%1, %2] @ out"###fnsuffix \
- : \
- : "r" (value), "r" (PCIO_BASE), typ (port)); \
-}
+#define __pci_io_addr(x) (PCIO_BASE + (unsigned int)(x))
-#define DECLARE_DYN_IN(sz,fnsuffix,instr,typ) \
-extern __inline__ unsigned sz \
-__in##fnsuffix (unsigned int port) \
-{ \
- unsigned long value; \
- __asm__ __volatile__( \
- "ldr%?" ##instr## " %0, [%1, %2] @ in"###fnsuffix \
- : "=&r" (value) \
- : "r" (PCIO_BASE), typ (port)); \
- return (unsigned sz)value; \
-}
+#define __inb(p) (*(volatile unsigned char *)__pci_io_addr(p))
+#define __inl(p) (*(volatile unsigned long *)__pci_io_addr(p))
-extern __inline__ unsigned int __ioaddr (unsigned int port) \
-{ \
- return (unsigned int)(PCIO_BASE + port); \
+extern __inline__ unsigned int __inw(unsigned int port)
+{
+ unsigned int value;
+ __asm__ __volatile__(
+ "ldr%?h %0, [%1, %2] @ inw"
+ : "=&r" (value)
+ : "r" (PCIO_BASE), "r" (port));
+ return value;
}
-#define DECLARE_IO(sz,fnsuffix,instr,typ) \
- DECLARE_DYN_OUT(fnsuffix,instr,typ) \
- DECLARE_DYN_IN(sz,fnsuffix,instr,typ)
-DECLARE_IO(char,b,"b","Jr")
-DECLARE_IO(short,w,"h","r")
-DECLARE_IO(long,l,"","Jr")
+#define __outb(v,p) (*(volatile unsigned char *)__pci_io_addr(p) = (v))
+#define __outl(v,p) (*(volatile unsigned long *)__pci_io_addr(p) = (v))
-#undef DECLARE_IO
-#undef DECLARE_DYN_OUT
-#undef DECLARE_DYN_IN
-
-/*
- * Constant address IO functions
- *
- * These have to be macros for the 'J' constraint to work -
- * +/-4096 immediate operand.
- */
-#define __outbc(value,port) \
-({ \
- __asm__ __volatile__( \
- "str%?b %0, [%1, %2] @ outbc" \
- : \
- : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \
-})
-
-#define __inbc(port) \
-({ \
- unsigned char result; \
- __asm__ __volatile__( \
- "ldr%?b %0, [%1, %2] @ inbc" \
- : "=r" (result) \
- : "r" (PCIO_BASE), "Jr" (port)); \
- result; \
-})
-
-#define __outwc(value,port) \
-({ \
- __asm__ __volatile__( \
- "str%?h %0, [%1, %2] @ outwc" \
- : \
- : "r" (value), "r" (PCIO_BASE), "r" (port)); \
-})
-
-#define __inwc(port) \
-({ \
- unsigned short result; \
- __asm__ __volatile__( \
- "ldr%?h %0, [%1, %2] @ inwc" \
- : "=r" (result) \
- : "r" (PCIO_BASE), "r" (port)); \
- result & 0xffff; \
-})
-
-#define __outlc(value,port) \
-({ \
- __asm__ __volatile__( \
- "str%? %0, [%1, %2] @ outlc" \
- : \
- : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \
-})
-
-#define __inlc(port) \
-({ \
- unsigned long result; \
- __asm__ __volatile__( \
- "ldr%? %0, [%1, %2] @ inlc" \
- : "=r" (result) \
- : "r" (PCIO_BASE), "Jr" (port)); \
- result; \
-})
-
-#define __ioaddrc(port) \
-({ \
- unsigned long addr; \
- addr = PCIO_BASE + port; \
- addr; \
-})
-
-/*
- * Translated address IO functions
- *
- * IO address has already been translated to a virtual address
- */
-#define outb_t(v,p) \
- (*(volatile unsigned char *)(p) = (v))
-
-#define inb_t(p) \
- (*(volatile unsigned char *)(p))
-
-#define outl_t(v,p) \
- (*(volatile unsigned long *)(p) = (v))
+extern __inline__ void __outw(unsigned int value, unsigned int port)
+{
+ __asm__ __volatile__(
+ "str%?h %0, [%1, %2] @ outw"
+ : : "r" (value), "r" (PCIO_BASE), "r" (port));
+}
-#define inl_t(p) \
- (*(volatile unsigned long *)(p))
+#define __ioaddr(p) __pci_io_addr(p)
/*
* ioremap support - validate a PCI memory address,
@@ -151,7 +53,7 @@ DECLARE_IO(long,l,"","Jr")
* address for the page tables.
*/
#define valid_ioaddr(iomem,size) ((iomem) < 0x80000000 && (iomem) + (size) <= 0x80000000)
-#define io_to_phys(iomem) ((iomem) + DC21285_PCI_MEM)
+#define io_to_phys(iomem) ((iomem) + DC21285_PCI_MEM)
/*
* Fudge up IO addresses by this much. Once we're confident that nobody
@@ -160,6 +62,8 @@ DECLARE_IO(long,l,"","Jr")
*/
#define IO_FUDGE_FACTOR PCIMEM_BASE
+#define __pci_mem_addr(x) ((void *)(IO_FUDGE_FACTOR + (unsigned long)(x)))
+
/*
* ioremap takes a PCI memory address, as specified in
* linux/Documentation/IO-mapping.txt
@@ -176,30 +80,20 @@ DECLARE_IO(long,l,"","Jr")
#define ioremap_nocache(iomem_addr,size) ioremap((iomem_addr),(size))
-extern void iounmap(void *addr);
+#define iounmap(_addr) do { __iounmap(__pci_mem_addr((_addr))); } while (0)
-#define DECLARE_PCI_WRITE(typ,fnsuffix) \
-static inline void write##fnsuffix(unsigned typ val, unsigned int addr) \
-{ \
- *(volatile unsigned typ *)(IO_FUDGE_FACTOR + addr) = val; \
-}
-
-#define DECLARE_PCI_READ(typ,fnsuffix) \
-static inline unsigned typ read##fnsuffix (unsigned int addr) \
-{ \
- return *(volatile unsigned typ *)(IO_FUDGE_FACTOR + addr); \
-}
+#define readb(addr) (*(volatile unsigned char *)__pci_mem_addr(addr))
+#define readw(addr) (*(volatile unsigned short *)__pci_mem_addr(addr))
+#define readl(addr) (*(volatile unsigned long *)__pci_mem_addr(addr))
-#define DECLARE_PCI(typ,fnsuffix) \
- DECLARE_PCI_WRITE(typ,fnsuffix) \
- DECLARE_PCI_READ(typ,fnsuffix)
+#define writeb(b,addr) (*(volatile unsigned char *)__pci_mem_addr(addr) = (b))
+#define writew(b,addr) (*(volatile unsigned short *)__pci_mem_addr(addr) = (b))
+#define writel(b,addr) (*(volatile unsigned long *)__pci_mem_addr(addr) = (b))
-DECLARE_PCI(char,b)
-DECLARE_PCI(short,w)
-DECLARE_PCI(long,l)
+#define memset_io(a,b,c) memset(__pci_mem_addr(a),(b),(c))
+#define memcpy_fromio(a,b,c) memcpy((a),__pci_mem_addr(b),(c))
+#define memcpy_toio(a,b,c) memcpy(__pci_mem_addr(a),(b),(c))
-#undef DECLARE_PCI
-#undef DECLARE_PCI_READ
-#undef DECLARE_PCI_WRITE
+#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),__pci_mem_addr(b),(c),(d))
#endif
diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h
index ca1a55cdb..1c4bc42be 100644
--- a/include/asm-arm/arch-ebsa285/irq.h
+++ b/include/asm-arm/arch-ebsa285/irq.h
@@ -110,6 +110,8 @@ static void no_action(int cpl, void *dev_id, struct pt_regs *regs)
}
static struct irqaction irq_cascade = { no_action, 0, 0, "cascade", NULL, NULL };
+static struct resource pic1_resource = { "pic1", 0x20, 0x3f };
+static struct resource pic2_resource = { "pic2", 0xa0, 0xbf };
static __inline__ void irq_init_irq(void)
{
@@ -159,6 +161,8 @@ static __inline__ void irq_init_irq(void)
if (isa_irq != -1) {
/*
* Setup, and then probe for an ISA PIC
+ * If the PIC is not there, then we
+ * ignore the PIC.
*/
outb(0x11, PIC_LO);
outb(_ISA_IRQ(0), PIC_MASK_LO); /* IRQ number */
@@ -201,8 +205,8 @@ static __inline__ void irq_init_irq(void)
irq_desc[irq].unmask = isa_unmask_pic_hi_irq;
}
- request_region(PIC_LO, 2, "pic1");
- request_region(PIC_HI, 2, "pic2");
+ request_resource(&ioport_resource, &pic1_resource);
+ request_resource(&ioport_resource, &pic2_resource);
setup_arm_irq(IRQ_ISA_CASCADE, &irq_cascade);
setup_arm_irq(isa_irq, &irq_cascade);
}
diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h
index 7c5cd89c4..91e3ae284 100644
--- a/include/asm-arm/arch-ebsa285/time.h
+++ b/include/asm-arm/arch-ebsa285/time.h
@@ -115,6 +115,9 @@ static void isa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
+
+ if (!user_mode(regs))
+ do_profile(instruction_pointer(regs));
}
static struct irqaction isa_timer_irq = {
@@ -126,8 +129,7 @@ static struct irqaction isa_timer_irq = {
NULL
};
-__initfunc(static unsigned long
-get_isa_cmos_time(void))
+static unsigned long __init get_isa_cmos_time(void)
{
unsigned int year, mon, day, hour, min, sec;
int i;
@@ -237,10 +239,8 @@ static void __ebsa285_text timer1_interrupt(int irq, void *dev_id, struct pt_reg
{
*CSR_TIMER1_CLR = 0;
- /* Do the LEDs things on non-CATS hardware.
- */
- if (!machine_is_cats())
- do_leds();
+ /* Do the LEDs things */
+ do_leds();
do_timer(regs);
@@ -257,6 +257,9 @@ static void __ebsa285_text timer1_interrupt(int irq, void *dev_id, struct pt_reg
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
+
+ if (!user_mode(regs))
+ do_profile(instruction_pointer(regs));
}
static struct irqaction __ebsa285_data timer1_irq = {
@@ -279,22 +282,20 @@ set_dummy_time(unsigned long secs)
*/
extern __inline__ void setup_timer(void)
{
- switch(machine_arch_type) {
- case MACH_TYPE_CO285:
+ if (machine_arch_type == MACH_TYPE_CO285)
/*
* Add-in 21285s shouldn't access the RTC
*/
rtc_base = 0;
- break;
-
- default:
+ else
rtc_base = 0x70;
- break;
- }
if (rtc_base) {
int reg_d, reg_b;
+ /*
+ * Probe for the RTC.
+ */
reg_d = CMOS_READ(RTC_REG_D);
/*
@@ -314,7 +315,7 @@ extern __inline__ void setup_timer(void)
CMOS_READ(RTC_REG_B) == reg_b) {
/*
- * Check the battery
+ * We have a RTC. Check the battery
*/
if ((reg_d & 0x80) == 0)
printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n");
@@ -332,7 +333,6 @@ extern __inline__ void setup_timer(void)
xtime.tv_sec = mktime(1970, 1, 1, 0, 0, 0);
set_rtc_mmss = set_dummy_time;
}
-
if (machine_is_ebsa285() || machine_is_co285()) {
gettimeoffset = timer1_gettimeoffset;
diff --git a/include/asm-arm/arch-rpc/system.h b/include/asm-arm/arch-rpc/system.h
index bb220ced4..a4b92939e 100644
--- a/include/asm-arm/arch-rpc/system.h
+++ b/include/asm-arm/arch-rpc/system.h
@@ -17,7 +17,7 @@
"mcr p15, 0, %0, c1, c0, 0;" \
"movs pc, #0" \
: \
- : "r" (processor.u.armv3v4.reset())); \
+ : "r" (cpu_reset())); \
}
#endif
diff --git a/include/asm-arm/arch-rpc/time.h b/include/asm-arm/arch-rpc/time.h
index b28666b37..0ac40356a 100644
--- a/include/asm-arm/arch-rpc/time.h
+++ b/include/asm-arm/arch-rpc/time.h
@@ -151,7 +151,7 @@ extern __inline__ unsigned long get_rtc_time(void)
*/
buf[4] &= 0x1f;
buf[3] &= 0x3f;
-printk("Year %4d mon %02X day %02X hour %02X min %02X sec %02X\n", year, buf[4], buf[3], buf[2], buf[1], buf[0]);
+
for (i = 0; i < 5; i++)
BCD_TO_BIN(buf[i]);
@@ -175,6 +175,9 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
+
+ if (!user_mode(regs))
+ do_profile(instruction_pointer(regs));
}
static struct irqaction timerirq = {
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index 431194234..92bcf6f8e 100644
--- a/include/asm-arm/atomic.h
+++ b/include/asm-arm/atomic.h
@@ -81,6 +81,19 @@ static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
return result;
}
+extern __inline__ int atomic_add_negative(int i, volatile atomic_t *v)
+{
+ unsigned long flags;
+ int result;
+
+ save_flags_cli(flags);
+ v->counter += i;
+ result = (v->counter < 0);
+ restore_flags(flags);
+
+ return result;
+}
+
static __inline__ void atomic_clear_mask(unsigned long mask, unsigned long *addr)
{
unsigned long flags;
diff --git a/include/asm-arm/bugs.h b/include/asm-arm/bugs.h
index b9fc82775..637d89c1b 100644
--- a/include/asm-arm/bugs.h
+++ b/include/asm-arm/bugs.h
@@ -8,6 +8,6 @@
#include <asm/proc-fns.h>
-#define check_bugs() processor._check_bugs()
+#define check_bugs() cpu_check_bugs()
#endif
diff --git a/include/asm-arm/cache.h b/include/asm-arm/cache.h
index 48a830351..d8f057be1 100644
--- a/include/asm-arm/cache.h
+++ b/include/asm-arm/cache.h
@@ -8,4 +8,12 @@
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
#endif
diff --git a/include/asm-arm/cpu-multi26.h b/include/asm-arm/cpu-multi26.h
new file mode 100644
index 000000000..5f02bfc9c
--- /dev/null
+++ b/include/asm-arm/cpu-multi26.h
@@ -0,0 +1,68 @@
+#ifndef __ASSEMBLY__
+
+#include <asm/page.h>
+
+/* forward-declare task_struct */
+struct task_struct;
+
+/*
+ * Don't change this structure - ASM code
+ * relies on it.
+ */
+extern struct processor {
+ /* MISC
+ * get data abort address/flags
+ */
+ void (*_data_abort)(unsigned long pc);
+ /*
+ * check for any bugs
+ */
+ void (*_check_bugs)(void);
+ /*
+ * Set up any processor specifics
+ */
+ void (*_proc_init)(void);
+ /*
+ * Disable any processor specifics
+ */
+ void (*_proc_fin)(void);
+ /*
+ * Processor architecture specific
+ */
+ /* MEMC
+ *
+ * remap memc tables
+ */
+ void (*_remap_memc)(void *tsk);
+ /*
+ * update task's idea of mmap
+ */
+ void (*_update_map)(void *tsk);
+ /*
+ * update task's idea after abort
+ */
+ void (*_update_mmu_cache)(void *vma, unsigned long addr, pte_t pte);
+ /* XCHG
+ */
+ unsigned long (*_xchg_1)(unsigned long x, volatile void *ptr);
+ unsigned long (*_xchg_2)(unsigned long x, volatile void *ptr);
+ unsigned long (*_xchg_4)(unsigned long x, volatile void *ptr);
+} processor;
+
+extern const struct processor arm2_processor_functions;
+extern const struct processor arm250_processor_functions;
+extern const struct processor arm3_processor_functions;
+
+#define cpu_data_abort(pc) processor._data_abort(pc)
+#define cpu_check_bugs() processor._check_bugs()
+#define cpu_proc_init() processor._proc_init()
+#define cpu_proc_fin() processor._proc_fin()
+
+#define cpu_remap_memc(tsk) processor._remap_memc(tsk)
+#define cpu_update_map(tsk) processor._update_map(tsk)
+#define cpu_update_mmu_cache(vma,addr,pte) processor._update_mmu_cache(vma,addr,pte)
+#define cpu_xchg_1(x,ptr) processor._xchg_1(x,ptr)
+#define cpu_xchg_2(x,ptr) processor._xchg_2(x,ptr)
+#define cpu_xchg_4(x,ptr) processor._xchg_4(x,ptr)
+
+#endif
diff --git a/include/asm-arm/cpu-multi32.h b/include/asm-arm/cpu-multi32.h
new file mode 100644
index 000000000..ed80e894e
--- /dev/null
+++ b/include/asm-arm/cpu-multi32.h
@@ -0,0 +1,117 @@
+#ifndef __ASSEMBLY__
+
+#include <asm/page.h>
+
+/* forward-declare task_struct */
+struct task_struct;
+
+/*
+ * Don't change this structure - ASM code
+ * relies on it.
+ */
+extern struct processor {
+ /* MISC
+ * get data abort address/flags
+ */
+ void (*_data_abort)(unsigned long pc);
+ /*
+ * check for any bugs
+ */
+ void (*_check_bugs)(void);
+ /*
+ * Set up any processor specifics
+ */
+ void (*_proc_init)(void);
+ /*
+ * Disable any processor specifics
+ */
+ void (*_proc_fin)(void);
+ /*
+ * Processor architecture specific
+ */
+ /* CACHE
+ *
+ * flush all caches
+ */
+ void (*_flush_cache_all)(void);
+ /*
+ * flush a specific page or pages
+ */
+ void (*_flush_cache_area)(unsigned long address, unsigned long end, int flags);
+ /*
+ * flush cache entry for an address
+ */
+ void (*_flush_cache_entry)(unsigned long address);
+ /*
+ * clean a virtual address range from the
+ * D-cache without flushing the cache.
+ */
+ void (*_clean_cache_area)(unsigned long start, unsigned long size);
+ /*
+ * flush a page to RAM
+ */
+ void (*_flush_ram_page)(unsigned long page);
+ /* TLB
+ *
+ * flush all TLBs
+ */
+ void (*_flush_tlb_all)(void);
+ /*
+ * flush a specific TLB
+ */
+ void (*_flush_tlb_area)(unsigned long address, unsigned long end, int flags);
+ /*
+ * Set the page table
+ */
+ void (*_set_pgd)(unsigned long pgd_phys);
+ /*
+ * Set a PMD (handling IMP bit 4)
+ */
+ void (*_set_pmd)(pmd_t *pmdp, pmd_t pmd);
+ /*
+ * Set a PTE
+ */
+ void (*_set_pte)(pte_t *ptep, pte_t pte);
+ /*
+ * Special stuff for a reset
+ */
+ unsigned long (*reset)(void);
+ /*
+ * flush an icached page
+ */
+ void (*_flush_icache_area)(unsigned long start, unsigned long size);
+ /*
+ * write back dirty cached data
+ */
+ void (*_cache_wback_area)(unsigned long start, unsigned long end);
+ /*
+ * purge cached data without (necessarily) writing it back
+ */
+ void (*_cache_purge_area)(unsigned long start, unsigned long end);
+} processor;
+
+extern const struct processor arm6_processor_functions;
+extern const struct processor arm7_processor_functions;
+extern const struct processor sa110_processor_functions;
+
+#define cpu_data_abort(pc) processor._data_abort(pc)
+#define cpu_check_bugs() processor._check_bugs()
+#define cpu_proc_init() processor._proc_init()
+#define cpu_proc_fin() processor._proc_fin()
+
+#define cpu_flush_cache_all() processor._flush_cache_all()
+#define cpu_flush_cache_area(start,end,flags) processor._flush_cache_area(start,end,flags)
+#define cpu_flush_cache_entry(addr) processor._flush_cache_entry(addr)
+#define cpu_clean_cache_area(start,size) processor._clean_cache_area(start,size)
+#define cpu_flush_ram_page(page) processor._flush_ram_page(page)
+#define cpu_flush_tlb_all() processor._flush_tlb_all()
+#define cpu_flush_tlb_area(start,end,flags) processor._flush_tlb_area(start,end,flags)
+#define cpu_switch_mm(pgd,tsk) processor._set_pgd(pgd)
+#define cpu_set_pmd(pmdp, pmd) processor._set_pmd(pmdp, pmd)
+#define cpu_set_pte(ptep, pte) processor._set_pte(ptep, pte)
+#define cpu_reset() processor.reset()
+#define cpu_flush_icache_area(start,end) processor._flush_icache_area(start,end)
+#define cpu_cache_wback_area(start,end) processor._cache_wback_area(start,end)
+#define cpu_cache_purge_area(start,end) processor._cache_purge_area(start,end)
+
+#endif
diff --git a/include/asm-arm/cpu-single.h b/include/asm-arm/cpu-single.h
new file mode 100644
index 000000000..009dffb15
--- /dev/null
+++ b/include/asm-arm/cpu-single.h
@@ -0,0 +1,61 @@
+/*
+ * Single CPU
+ */
+#define __cpu_fn(name,x) cpu_##name##x
+#define cpu_fn(name,x) __cpu_fn(name,x)
+
+/*
+ * If we are supporting multiple CPUs, then
+ * we must use a table of function pointers
+ * for this lot. Otherwise, we can optimise
+ * the table away.
+ */
+#define cpu_data_abort cpu_fn(CPU_NAME,_data_abort)
+#define cpu_check_bugs cpu_fn(CPU_NAME,_check_bugs)
+#define cpu_proc_init cpu_fn(CPU_NAME,_proc_init)
+#define cpu_proc_fin cpu_fn(CPU_NAME,_proc_fin)
+
+#define cpu_flush_cache_all cpu_fn(CPU_NAME,_flush_cache_all)
+#define cpu_flush_cache_area cpu_fn(CPU_NAME,_flush_cache_area)
+#define cpu_flush_cache_entry cpu_fn(CPU_NAME,_flush_cache_entry)
+#define cpu_clean_cache_area cpu_fn(CPU_NAME,_clean_cache_area)
+#define cpu_flush_ram_page cpu_fn(CPU_NAME,_flush_ram_page)
+#define cpu_flush_tlb_all cpu_fn(CPU_NAME,_flush_tlb_all)
+#define cpu_flush_tlb_area cpu_fn(CPU_NAME,_flush_tlb_area)
+#define cpu_switch_mm cpu_fn(CPU_NAME,_set_pgd)
+#define cpu_set_pmd cpu_fn(CPU_NAME,_set_pmd)
+#define cpu_set_pte cpu_fn(CPU_NAME,_set_pte)
+#define cpu_reset cpu_fn(CPU_NAME,reset)
+#define cpu_flush_icache_area cpu_fn(CPU_NAME,_flush_icache_area)
+#define cpu_cache_wback_area cpu_fn(CPU_NAME,_cache_wback_area)
+#define cpu_cache_purge_area cpu_fn(CPU_NAME,_cache_purge_area)
+
+#ifndef __ASSEMBLY__
+
+#include <asm/page.h>
+
+/* forward declare task_struct */
+struct task_struct;
+
+/* declare all the functions as extern */
+extern void cpu_data_abort(unsigned long pc);
+extern void cpu_check_bugs(void);
+extern void cpu_proc_init(void);
+extern void cpu_proc_fin(void);
+
+extern void cpu_flush_cache_all(void);
+extern void cpu_flush_cache_area(unsigned long address, unsigned long end, int flags);
+extern void cpu_flush_cache_entry(unsigned long address);
+extern void cpu_clean_cache_area(unsigned long start, unsigned long size);
+extern void cpu_flush_ram_page(unsigned long page);
+extern void cpu_flush_tlb_all(void);
+extern void cpu_flush_tlb_area(unsigned long address, unsigned long end, int flags);
+extern void cpu_switch_mm(unsigned long pgd_phys, struct task_struct *tsk);
+extern void cpu_set_pmd(pmd_t *pmdp, pmd_t pmd);
+extern void cpu_set_pte(pte_t *ptep, pte_t pte);
+extern unsigned long cpu_reset(void);
+extern void cpu_flush_icache_area(unsigned long start, unsigned long size);
+extern void cpu_cache_wback_area(unsigned long start, unsigned long end);
+extern void cpu_cache_purge_area(unsigned long start, unsigned long end);
+
+#endif
diff --git a/include/asm-arm/dec21285.h b/include/asm-arm/dec21285.h
index e7bfa21c4..c86e2c851 100644
--- a/include/asm-arm/dec21285.h
+++ b/include/asm-arm/dec21285.h
@@ -28,6 +28,12 @@
#define CSR_PCICSRIOBASE DC21285_IO(0x0014)
#define CSR_PCISDRAMBASE DC21285_IO(0x0018)
#define CSR_PCIROMBASE DC21285_IO(0x0030)
+#define CSR_MBOX0 DC21285_IO(0x0050)
+#define CSR_MBOX1 DC21285_IO(0x0054)
+#define CSR_MBOX2 DC21285_IO(0x0058)
+#define CSR_MBOX3 DC21285_IO(0x005c)
+#define CSR_DOORBELL DC21285_IO(0x0060)
+#define CSR_DOORBELL_SETUP DC21285_IO(0x0064)
#define CSR_ROMWRITEREG DC21285_IO(0x0068)
#define CSR_CSRBASEMASK DC21285_IO(0x00f8)
#define CSR_CSRBASEOFFSET DC21285_IO(0x00fc)
diff --git a/include/asm-arm/dma.h b/include/asm-arm/dma.h
index bc7d03ddd..b67e33a9d 100644
--- a/include/asm-arm/dma.h
+++ b/include/asm-arm/dma.h
@@ -5,8 +5,8 @@ typedef unsigned int dmach_t;
#include <linux/config.h>
#include <linux/kernel.h>
+#include <linux/spinlock.h>
#include <asm/irq.h>
-#include <asm/spinlock.h>
#include <asm/arch/dma.h>
/*
@@ -135,7 +135,7 @@ extern int get_dma_residue(dmach_t channel);
#define NO_DMA 255
#endif
-#ifdef CONFIG_PCI_QUIRKS
+#ifdef CONFIG_PCI
extern int isa_dma_bridge_buggy;
#else
#define isa_dma_bridge_buggy (0)
diff --git a/include/asm-arm/elf.h b/include/asm-arm/elf.h
index 8b0980053..c25a02479 100644
--- a/include/asm-arm/elf.h
+++ b/include/asm-arm/elf.h
@@ -47,7 +47,8 @@ typedef struct { void *null; } elf_fpregset_t;
/* This yields a mask that user programs can use to figure out what
instruction set this cpu supports. */
-#define ELF_HWCAP (armidlist[armidindex].hwcap)
+extern unsigned int elf_hwcap;
+#define ELF_HWCAP (elf_hwcap)
/* This yields a string that ld.so will use to load implementation
specific libraries for optimization. This is more specific in
diff --git a/include/asm-arm/hardirq.h b/include/asm-arm/hardirq.h
index 588c85894..79aec2cf6 100644
--- a/include/asm-arm/hardirq.h
+++ b/include/asm-arm/hardirq.h
@@ -1,7 +1,7 @@
#ifndef __ASM_HARDIRQ_H
#define __ASM_HARDIRQ_H
-#include <linux/tasks.h>
+#include <linux/threads.h>
extern unsigned int local_irq_count[NR_CPUS];
diff --git a/include/asm-arm/init.h b/include/asm-arm/init.h
index 66ccbecd3..e364b5173 100644
--- a/include/asm-arm/init.h
+++ b/include/asm-arm/init.h
@@ -8,14 +8,10 @@
#ifdef CONFIG_TEXT_SECTIONS
#define __init __attribute__ ((__section__ (".text.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
#else
#define __init
-#define __initfunc(__arginit) __arginit
#endif
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index 35db8e667..5ee6dc4df 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -21,17 +21,7 @@
#endif
extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
-
-/*
- * String version of IO memory access ops:
- */
-extern void _memcpy_fromio(void *, unsigned long, unsigned long);
-extern void _memcpy_toio(unsigned long, const void *, unsigned long);
-extern void _memset_io(unsigned long, int, unsigned long);
-
-#define memcpy_fromio(to,from,len) _memcpy_fromio((to),(unsigned long)(from),(len))
-#define memcpy_toio(to,from,len) _memcpy_toio((unsigned long)(to),(from),(len))
-#define memset_io(addr,c,len) _memset_io((unsigned long)(addr),(c),(len))
+extern void __iounmap(void *addr);
#endif
@@ -121,8 +111,12 @@ __IO(l,"",long)
* This macro will give you the translated IO address for this particular
* architecture, which can be used with the out_t... functions.
*/
+#ifdef __ioaddrc
#define ioaddr(port) \
(__builtin_constant_p((port)) ? __ioaddrc((port)) : __ioaddr((port)))
+#else
+#define ioaddr(port) __ioaddr((port))
+#endif
#ifndef ARCH_IO_DELAY
/*
@@ -205,6 +199,19 @@ __IO(l,"",long)
#endif
+#ifndef memcpy_fromio
+/*
+ * String version of IO memory access ops:
+ */
+extern void _memcpy_fromio(void *, unsigned long, unsigned long);
+extern void _memcpy_toio(unsigned long, const void *, unsigned long);
+extern void _memset_io(unsigned long, int, unsigned long);
+
+#define memcpy_fromio(to,from,len) _memcpy_fromio((to),(unsigned long)(from),(len))
+#define memcpy_toio(to,from,len) _memcpy_toio((unsigned long)(to),(from),(len))
+#define memset_io(addr,c,len) _memset_io((unsigned long)(addr),(c),(len))
+#endif
+
/*
* This isn't especially architecture dependent so it seems like it
* might as well go here as anywhere.
diff --git a/include/asm-arm/iomd.h b/include/asm-arm/iomd.h
index 31be445da..87299be50 100644
--- a/include/asm-arm/iomd.h
+++ b/include/asm-arm/iomd.h
@@ -1,3 +1,4 @@
+#include <linux/config.h>
#ifndef __ASSEMBLER__
#define __IOMD(offset) (IO_IOMD_BASE + (offset >> 2))
@@ -10,6 +11,10 @@
#define IOMD_KARTRX __IOMD(0x004)
#define IOMD_KCTRL __IOMD(0x008)
+#ifdef CONFIG_ARCH_CL7500
+#define IOMD_IOLINES __IOMD(0x00C)
+#endif
+
#define IOMD_IRQSTATA __IOMD(0x010)
#define IOMD_IRQREQA __IOMD(0x014)
#define IOMD_IRQCLRA __IOMD(0x014)
@@ -37,9 +42,23 @@
#define IOMD_T1GO __IOMD(0x058)
#define IOMD_T1LATCH __IOMD(0x05c)
+#ifdef CONFIG_ARCH_CL7500
+#define IOMD_IRQSTATC __IOMD(0x060)
+#define IOMD_IRQREQC __IOMD(0x064)
+#define IOMD_IRQMASKC __IOMD(0x068)
+
+#define IOMD_VIDMUX __IOMD(0x06c)
+
+#define IOMD_IRQSTATD __IOMD(0x070)
+#define IOMD_IRQREQD __IOMD(0x074)
+#define IOMD_IRQMASKD __IOMD(0x078)
+#endif
+
#define IOMD_ROMCR0 __IOMD(0x080)
#define IOMD_ROMCR1 __IOMD(0x084)
+#ifdef CONFIG_ARCH_RPC
#define IOMD_DRAMCR __IOMD(0x088)
+#endif
#define IOMD_VREFCR __IOMD(0x08C)
#define IOMD_FSIZE __IOMD(0x090)
@@ -47,14 +66,38 @@
#define IOMD_ID1 __IOMD(0x098)
#define IOMD_VERSION __IOMD(0x09C)
+#ifdef CONFIG_ARCH_RPC
#define IOMD_MOUSEX __IOMD(0x0A0)
#define IOMD_MOUSEY __IOMD(0x0A4)
+#endif
+#ifdef CONFIG_ARCH_CL7500
+#define IOMD_MSEDAT __IOMD(0x0A8)
+#define IOMD_MSECTL __IOMD(0x0Ac)
+#endif
+
+#ifdef CONFIG_ARCH_RPC
#define IOMD_DMATCR __IOMD(0x0C0)
+#endif
#define IOMD_IOTCR __IOMD(0x0C4)
#define IOMD_ECTCR __IOMD(0x0C8)
+#ifdef CONFIG_ARCH_RPC
#define IOMD_DMAEXT __IOMD(0x0CC)
+#endif
+#ifdef CONFIG_ARCH_CL7500
+#define IOMD_ASTCR __IOMD(0x0CC)
+#define IOMD_DRAMCR __IOMD(0x0D0)
+#define IOMD_SELFREF __IOMD(0x0D4)
+#define IOMD_ATODICR __IOMD(0x0E0)
+#define IOMD_ATODSR __IOMD(0x0E4)
+#define IOMD_ATODCC __IOMD(0x0E8)
+#define IOMD_ATODCNT1 __IOMD(0x0EC)
+#define IOMD_ATODCNT2 __IOMD(0x0F0)
+#define IOMD_ATODCNT3 __IOMD(0x0F4)
+#define IOMD_ATODCNT4 __IOMD(0x0F8)
+#endif
+#ifdef CONFIG_ARCH_RPC
#define DMA_EXT_IO0 1
#define DMA_EXT_IO1 2
#define DMA_EXT_IO2 4
@@ -87,6 +130,7 @@
#define IOMD_IO3ENDB __IOMD(0x16C)
#define IOMD_IO3CR __IOMD(0x170)
#define IOMD_IO3ST __IOMD(0x174)
+#endif
#define IOMD_SD0CURA __IOMD(0x180)
#define IOMD_SD0ENDA __IOMD(0x184)
@@ -95,12 +139,14 @@
#define IOMD_SD0CR __IOMD(0x190)
#define IOMD_SD0ST __IOMD(0x194)
+#ifdef CONFIG_ARCH_RPC
#define IOMD_SD1CURA __IOMD(0x1A0)
#define IOMD_SD1ENDA __IOMD(0x1A4)
#define IOMD_SD1CURB __IOMD(0x1A8)
#define IOMD_SD1ENDB __IOMD(0x1AC)
#define IOMD_SD1CR __IOMD(0x1B0)
#define IOMD_SD1ST __IOMD(0x1B4)
+#endif
#define IOMD_CURSCUR __IOMD(0x1C0)
#define IOMD_CURSINIT __IOMD(0x1C4)
diff --git a/include/asm-arm/mmu_context.h b/include/asm-arm/mmu_context.h
index f6e4c3e33..460d7b966 100644
--- a/include/asm-arm/mmu_context.h
+++ b/include/asm-arm/mmu_context.h
@@ -9,10 +9,30 @@
#ifndef __ASM_ARM_MMU_CONTEXT_H
#define __ASM_ARM_MMU_CONTEXT_H
-#define get_mmu_context(x) do { } while (0)
+#include <asm/bitops.h>
+#include <asm/pgtable.h>
+#include <asm/arch/memory.h>
+#include <asm/proc-fns.h>
-#define init_new_context(mm) do { } while(0)
-#define destroy_context(mm) do { } while(0)
-#define activate_context(tsk) do { } while(0)
+#define destroy_context(mm) do { } while(0)
+#define init_new_context(tsk,mm) do { } while(0)
+
+/*
+ * This is the actual mm switch as far as the scheduler
+ * is concerned. No registers are touched.
+ */
+static inline void
+switch_mm(struct mm_struct *prev, struct mm_struct *next,
+ struct task_struct *tsk, unsigned int cpu)
+{
+ if (prev != next) {
+ cpu_switch_mm(__virt_to_phys((unsigned long)next->pgd), tsk);
+ clear_bit(cpu, &prev->cpu_vm_mask);
+ }
+ set_bit(cpu, &next->cpu_vm_mask);
+}
+
+#define activate_mm(prev, next) \
+ switch_mm((prev),(next),NULL,smp_processor_id())
#endif
diff --git a/include/asm-arm/page.h b/include/asm-arm/page.h
index 704b99b05..b047806fa 100644
--- a/include/asm-arm/page.h
+++ b/include/asm-arm/page.h
@@ -6,6 +6,19 @@
#ifdef __KERNEL__
+#ifndef __ASSEMBLY__
+
+#define BUG() do { \
+ printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+ *(int *)0 = 0; \
+} while (0)
+
+#define PAGE_BUG(page) do { \
+ BUG(); \
+} while (0)
+
+#endif /* __ASSEMBLY__ */
+
#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
#define free_user_page(page, addr) free_page(addr)
#define clear_page(page) memzero((void *)(page), PAGE_SIZE)
diff --git a/include/asm-arm/parport.h b/include/asm-arm/parport.h
new file mode 100644
index 000000000..c08ee4686
--- /dev/null
+++ b/include/asm-arm/parport.h
@@ -0,0 +1,59 @@
+/*
+ * parport.h: ia32-specific parport initialisation
+ *
+ * Copyright (C) 1999 Tim Waugh <tim@cyberelk.demon.co.uk>
+ *
+ * This file should only be included by drivers/parport/parport_pc.c.
+ */
+
+#ifndef _ASM_I386_PARPORT_H
+#define _ASM_I386_PARPORT_H 1
+
+#include <linux/config.h>
+
+/* Maximum number of ports to support. It is useless to set this greater
+ than PARPORT_MAX (in <linux/parport.h>). */
+#define PARPORT_PC_MAX_PORTS 8
+
+/* If parport_cs (PCMCIA) is managing ports for us, we'll need the
+ * probing routines forever; otherwise we can lose them at boot time. */
+#ifdef CONFIG_PARPORT_PC_PCMCIA
+#define __maybe_initdata
+#define __maybe_init
+#else
+#define __maybe_initdata __initdata
+#define __maybe_init __init
+#endif
+
+static int __maybe_init parport_pc_init_pci(int irq, int dma);
+
+static int user_specified __maybe_initdata = 0;
+int __init
+parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
+{
+ int count = 0, i = 0;
+
+ if (io && *io) {
+ /* Only probe the ports we were given. */
+ user_specified = 1;
+ do {
+ if (!*io_hi) *io_hi = 0x400 + *io;
+ if (parport_pc_probe_port(*(io++), *(io_hi++),
+ *(irq++), *(dma++)))
+ count++;
+ } while (*io && (++i < PARPORT_PC_MAX_PORTS));
+ } else {
+ /* Probe all the likely ports. */
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ count++;
+ count += parport_pc_init_pci (irq[0], dma[0]);
+ }
+
+ return count;
+}
+
+#endif /* !(_ASM_I386_PARPORT_H) */
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index 084999561..993598dcb 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -13,4 +13,6 @@ extern int do_check_pgt_cache(int, int);
#define PageSkip(page) (0)
#define kern_addr_valid(addr) (1)
+#define io_remap_page_range remap_page_range
+
#endif /* _ASMARM_PGTABLE_H */
diff --git a/include/asm-arm/proc-armo/processor.h b/include/asm-arm/proc-armo/processor.h
index 4cfd77955..087dcbcd0 100644
--- a/include/asm-arm/proc-armo/processor.h
+++ b/include/asm-arm/proc-armo/processor.h
@@ -10,6 +10,7 @@
* 28-09-1996 RMK Moved start_thread into the processor dependencies
* 11-01-1998 RMK Added new uaccess_t
* 09-09-1998 PJB Delete redundant `wp_works_ok'
+ * 30-05-1999 PJB Save sl across context switches
*/
#ifndef __ASM_PROC_PROCESSOR_H
#define __ASM_PROC_PROCESSOR_H
@@ -26,11 +27,12 @@ struct context_save_struct {
unsigned long r7;
unsigned long r8;
unsigned long r9;
+ unsigned long sl;
unsigned long fp;
unsigned long pc;
};
-#define INIT_CSS (struct context_save_struct){ 0, 0, 0, 0, 0, 0, 0, SVC26_MODE }
+#define INIT_CSS (struct context_save_struct){ 0, 0, 0, 0, 0, 0, 0, 0, SVC26_MODE }
typedef struct {
void (*put_byte)(void); /* Special calling convention */
@@ -77,6 +79,8 @@ extern uaccess_t uaccess_user, uaccess_kernel;
extern unsigned long get_page_8k(int priority);
extern void free_page_8k(unsigned long page);
+#define THREAD_SIZE (8192)
+
#define ll_alloc_task_struct() ((struct task_struct *)get_page_8k(GFP_KERNEL))
#define ll_free_task_struct(p) free_page_8k((unsigned long)(p))
diff --git a/include/asm-arm/proc-armo/system.h b/include/asm-arm/proc-armo/system.h
index 733a6cdff..3d6ba7554 100644
--- a/include/asm-arm/proc-armo/system.h
+++ b/include/asm-arm/proc-armo/system.h
@@ -14,9 +14,9 @@ extern const char xchg_str[];
extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
{
switch (size) {
- case 1: return processor.u.armv2._xchg_1(x, ptr);
- case 2: return processor.u.armv2._xchg_2(x, ptr);
- case 4: return processor.u.armv2._xchg_4(x, ptr);
+ case 1: return cpu_xchg_1(x, ptr);
+ case 2: return cpu_xchg_2(x, ptr);
+ case 4: return cpu_xchg_4(x, ptr);
default: arm_invalidptr(xchg_str, size);
}
return 0;
@@ -26,7 +26,7 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int
* We need to turn the caches off before calling the reset vector - RiscOS
* messes up if we don't
*/
-#define proc_hard_reset() processor._proc_fin()
+#define proc_hard_reset() cpu_proc_fin()
/*
* This processor does not idle
@@ -105,7 +105,7 @@ extern __inline__ unsigned long __xchg(unsigned long x, volatile void *ptr, int
" bic %0, %0, #0x0c000000\n" \
" orr %0, %0, %1\n" \
" teqp %0, #0\n" \
- : "=r" (temp) \
+ : "=&r" (temp) \
: "r" (x) \
: "memory"); \
} while (0)
diff --git a/include/asm-arm/proc-armv/domain.h b/include/asm-arm/proc-armv/domain.h
new file mode 100644
index 000000000..398fdce5c
--- /dev/null
+++ b/include/asm-arm/proc-armv/domain.h
@@ -0,0 +1,46 @@
+/*
+ * linux/include/asm-arm/proc-armv/domain.h
+ *
+ * Copyright (C) 1999 Russell King.
+ */
+#ifndef __ASM_PROC_DOMAIN_H
+#define __ASM_PROC_DOMAIN_H
+
+/*
+ * Domain numbers
+ *
+ * DOMAIN_IO - domain 2 includes all IO only
+ * DOMAIN_KERNEL - domain 1 includes all kernel memory only
+ * DOMAIN_USER - domain 0 includes all user memory only
+ */
+#define DOMAIN_USER 0
+#define DOMAIN_KERNEL 1
+#define DOMAIN_TABLE 1
+#define DOMAIN_IO 2
+
+/*
+ * Domain types
+ */
+#define DOMAIN_NOACCESS 0
+#define DOMAIN_CLIENT 1
+#define DOMAIN_MANAGER 3
+
+#define domain_val(dom,type) ((type) << 2*(dom))
+
+#define set_domain(x) \
+ do { \
+ __asm__ __volatile__( \
+ "mcr p15, 0, %0, c3, c0 @ set domain" \
+ : : "r" (x)); \
+ } while (0)
+
+#define modify_domain(dom,type) \
+ do { \
+ unsigned int domain = current->thread.domain; \
+ domain &= ~domain_val(dom, DOMAIN_MANAGER); \
+ domain |= domain_val(dom, type); \
+ current->thread.domain = domain; \
+ set_domain(current->thread.domain); \
+ } while (0)
+
+#endif
diff --git a/include/asm-arm/proc-armv/io.h b/include/asm-arm/proc-armv/io.h
index 8afecd2a5..72f0593ef 100644
--- a/include/asm-arm/proc-armv/io.h
+++ b/include/asm-arm/proc-armv/io.h
@@ -22,14 +22,14 @@
#include <asm/proc-fns.h>
-#define dma_cache_inv(start, size) \
- do { processor.u.armv3v4._cache_purge_area((unsigned long)(start), \
+#define dma_cache_inv(start, size) \
+ do { cpu_cache_purge_area((unsigned long)(start), \
((unsigned long)(start)+(size))); } while (0)
-#define dma_cache_wback(start, size) \
- do { processor.u.armv3v4._cache_wback_area((unsigned long)(start), \
+#define dma_cache_wback(start, size) \
+ do { cpu_cache_wback_area((unsigned long)(start), \
((unsigned long)(start)+(size))); } while (0)
-#define dma_cache_wback_inv(start, size) \
- do { processor.u.armv3v4._flush_cache_area((unsigned long)(start), \
+#define dma_cache_wback_inv(start, size) \
+ do { cpu_flush_cache_area((unsigned long)(start), \
((unsigned long)(start)+(size)), 0); } while (0)
diff --git a/include/asm-arm/proc-armv/pgtable.h b/include/asm-arm/proc-armv/pgtable.h
index 8447519c9..f6bf55889 100644
--- a/include/asm-arm/proc-armv/pgtable.h
+++ b/include/asm-arm/proc-armv/pgtable.h
@@ -19,27 +19,26 @@
* Cache flushing...
*/
#define flush_cache_all() \
- processor.u.armv3v4._flush_cache_all()
+ cpu_flush_cache_all()
#define flush_cache_mm(_mm) \
do { \
if ((_mm) == current->mm) \
- processor.u.armv3v4._flush_cache_all(); \
+ cpu_flush_cache_all(); \
} while (0)
#define flush_cache_range(_mm,_start,_end) \
do { \
if ((_mm) == current->mm) \
- processor.u.armv3v4._flush_cache_area \
- ((_start), (_end), 1); \
+ cpu_flush_cache_area((_start), (_end), 1); \
} while (0)
#define flush_cache_page(_vma,_vmaddr) \
do { \
if ((_vma)->vm_mm == current->mm) \
- processor.u.armv3v4._flush_cache_area \
- ((_vmaddr), (_vmaddr) + PAGE_SIZE, \
- ((_vma)->vm_flags & VM_EXEC) ? 1 : 0); \
+ cpu_flush_cache_area((_vmaddr), \
+ (_vmaddr) + PAGE_SIZE, \
+ ((_vma)->vm_flags & VM_EXEC) ? 1 : 0); \
} while (0)
#define clean_cache_range(_start,_end) \
@@ -47,18 +46,18 @@
unsigned long _s, _sz; \
_s = (unsigned long)_start; \
_sz = (unsigned long)_end - _s; \
- processor.u.armv3v4._clean_cache_area(_s, _sz); \
+ cpu_clean_cache_area(_s, _sz); \
} while (0)
#define clean_cache_area(_start,_size) \
do { \
unsigned long _s; \
_s = (unsigned long)_start; \
- processor.u.armv3v4._clean_cache_area(_s, _size); \
+ cpu_clean_cache_area(_s, _size); \
} while (0)
#define flush_icache_range(_start,_end) \
- processor.u.armv3v4._flush_icache_area((_start), (_end) - (_start))
+ cpu_flush_icache_area((_start), (_end) - (_start))
/*
* We don't have a MEMC chip...
@@ -73,7 +72,7 @@
* in the cache for this page. Is it necessary to invalidate the I-cache?
*/
#define flush_page_to_ram(_page) \
- processor.u.armv3v4._flush_ram_page ((_page) & PAGE_MASK);
+ cpu_flush_ram_page((_page) & PAGE_MASK);
/*
* TLB flushing:
@@ -92,26 +91,24 @@
#define flush_tlb() flush_tlb_all()
#define flush_tlb_all() \
- processor.u.armv3v4._flush_tlb_all()
+ cpu_flush_tlb_all()
#define flush_tlb_mm(_mm) \
do { \
if ((_mm) == current->mm) \
- processor.u.armv3v4._flush_tlb_all(); \
+ cpu_flush_tlb_all(); \
} while (0)
#define flush_tlb_range(_mm,_start,_end) \
do { \
if ((_mm) == current->mm) \
- processor.u.armv3v4._flush_tlb_area \
- ((_start), (_end), 1); \
+ cpu_flush_tlb_area((_start), (_end), 1); \
} while (0)
#define flush_tlb_page(_vma,_vmaddr) \
do { \
if ((_vma)->vm_mm == current->mm) \
- processor.u.armv3v4._flush_tlb_area \
- ((_vmaddr), (_vmaddr) + PAGE_SIZE, \
+ cpu_flush_tlb_area((_vmaddr), (_vmaddr) + PAGE_SIZE, \
((_vma)->vm_flags & VM_EXEC) ? 1 : 0); \
} while (0)
@@ -220,25 +217,6 @@ do { \
} while (0)
-/*
- * The "pgd_xxx()" functions here are trivial for a folded two-level
- * setup: the pgd is never bad, and a pmd always exists (as it's folded
- * into the pgd entry)
- */
-#define pgd_none(pgd) (0)
-#define pgd_bad(pgd) (0)
-#define pgd_present(pgd) (1)
-#define pgd_clear(pgdp)
-
-/* to find an entry in a kernel page-table-directory */
-#define pgd_offset_k(address) pgd_offset(&init_mm, address)
-
-/* to find an entry in a page-table-directory */
-extern __inline__ pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
-{
- return mm->pgd + (address >> PGDIR_SHIFT);
-}
-
extern unsigned long get_page_2k(int priority);
extern void free_page_2k(unsigned long page);
@@ -263,55 +241,6 @@ extern struct pgtable_cache_struct {
#error Pgtable caches have to be per-CPU, so that no locking is needed.
#endif
-extern pgd_t *get_pgd_slow(void);
-
-extern __inline__ pgd_t *get_pgd_fast(void)
-{
- unsigned long *ret;
-
- if((ret = pgd_quicklist) != NULL) {
- pgd_quicklist = (unsigned long *)(*ret);
- ret[0] = ret[1];
- clean_cache_area(ret, 4);
- pgtable_cache_size--;
- } else
- ret = (unsigned long *)get_pgd_slow();
- return (pgd_t *)ret;
-}
-
-extern __inline__ void free_pgd_fast(pgd_t *pgd)
-{
- *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
- pgd_quicklist = (unsigned long *) pgd;
- pgtable_cache_size++;
-}
-
-extern __inline__ void free_pgd_slow(pgd_t *pgd)
-{
- free_pages((unsigned long) pgd, 2);
-}
-
-#define pgd_free(pgd) free_pgd_fast(pgd)
-#define pgd_alloc() get_pgd_fast()
-
-extern __inline__ void set_pgdir(unsigned long address, pgd_t entry)
-{
- struct task_struct * p;
- pgd_t *pgd;
-
- read_lock(&tasklist_lock);
- for_each_task(p) {
- if (!p->mm)
- continue;
- *pgd_offset(p->mm,address) = entry;
- }
- read_unlock(&tasklist_lock);
- for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd)
- pgd[address >> PGDIR_SHIFT] = entry;
-}
-
-extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
-
/****************
* PMD functions *
****************/
@@ -336,7 +265,7 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
#define pmd_bad(pmd) (pmd_val(pmd) & 2)
#define mk_user_pmd(ptep) __mk_pmd(ptep, _PAGE_USER_TABLE)
#define mk_kernel_pmd(ptep) __mk_pmd(ptep, _PAGE_KERNEL_TABLE)
-#define set_pmd(pmdp,pmd) processor.u.armv3v4._set_pmd(pmdp,pmd)
+#define set_pmd(pmdp,pmd) cpu_set_pmd(pmdp,pmd)
/* Find an entry in the second-level page table.. */
#define pmd_offset(dir, address) ((pmd_t *)(dir))
@@ -406,7 +335,6 @@ extern __inline__ unsigned long pmd_page(pmd_t pmd)
return __phys_to_virt(ptr);
}
-
/****************
* PTE functions *
****************/
@@ -443,7 +371,7 @@ extern __inline__ pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
return pte;
}
-#define set_pte(ptep, pte) processor.u.armv3v4._set_pte(ptep,pte)
+#define set_pte(ptep, pte) cpu_set_pte(ptep,pte)
extern __inline__ unsigned long pte_page(pte_t pte)
{
@@ -552,8 +480,6 @@ extern __inline__ void free_pte_slow(pte_t *pte)
#define __S110 PAGE_SHARED
#define __S111 PAGE_SHARED
-
-
#define pte_present(pte) (pte_val(pte) & L_PTE_PRESENT)
/*
@@ -569,12 +495,12 @@ extern __inline__ void free_pte_slow(pte_t *pte)
#define PTE_BIT_FUNC(fn,op) \
extern inline pte_t fn##(pte_t pte) { pte_val(pte) op##; return pte; }
-//PTE_BIT_FUNC(pte_rdprotect, &= ~L_PTE_USER);
+/*PTE_BIT_FUNC(pte_rdprotect, &= ~L_PTE_USER);*/
PTE_BIT_FUNC(pte_wrprotect, &= ~L_PTE_WRITE);
PTE_BIT_FUNC(pte_exprotect, &= ~L_PTE_EXEC);
PTE_BIT_FUNC(pte_mkclean, &= ~L_PTE_DIRTY);
PTE_BIT_FUNC(pte_mkold, &= ~L_PTE_YOUNG);
-//PTE_BIT_FUNC(pte_mkread, |= L_PTE_USER);
+/*PTE_BIT_FUNC(pte_mkread, |= L_PTE_USER);*/
PTE_BIT_FUNC(pte_mkwrite, |= L_PTE_WRITE);
PTE_BIT_FUNC(pte_mkexec, |= L_PTE_EXEC);
PTE_BIT_FUNC(pte_mkdirty, |= L_PTE_DIRTY);
@@ -630,6 +556,100 @@ extern __inline__ pte_t * pte_alloc(pmd_t * pmd, unsigned long address)
return (pte_t *) pmd_page(*pmd) + address;
}
+/*
+ * The "pgd_xxx()" functions here are trivial for a folded two-level
+ * setup: the pgd is never bad, and a pmd always exists (as it's folded
+ * into the pgd entry)
+ */
+#define pgd_none(pgd) (0)
+#define pgd_bad(pgd) (0)
+#define pgd_present(pgd) (1)
+#define pgd_clear(pgdp)
+
+/* to find an entry in a kernel page-table-directory */
+#define pgd_offset_k(address) pgd_offset(&init_mm, address)
+
+/* used for quicklists */
+#define __pgd_next(pgd) (((unsigned long *)pgd)[1])
+
+/* to find an entry in a page-table-directory */
+extern __inline__ pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address)
+{
+ return mm->pgd + (address >> PGDIR_SHIFT);
+}
+
+extern pgd_t *get_pgd_slow(void);
+
+extern __inline__ pgd_t *get_pgd_fast(void)
+{
+ unsigned long *ret;
+
+ if((ret = pgd_quicklist) != NULL) {
+ pgd_quicklist = (unsigned long *)__pgd_next(ret);
+ ret[1] = ret[2];
+ clean_cache_area(ret + 1, 4);
+ pgtable_cache_size--;
+ } else
+ ret = (unsigned long *)get_pgd_slow();
+ return (pgd_t *)ret;
+}
+
+extern __inline__ void free_pgd_fast(pgd_t *pgd)
+{
+ __pgd_next(pgd) = (unsigned long) pgd_quicklist;
+ pgd_quicklist = (unsigned long *) pgd;
+ pgtable_cache_size++;
+}
+
+extern __inline__ void free_pgd_slow(pgd_t *pgd)
+{
+ do {
+ if (pgd) { /* can pgd be NULL? */
+ pmd_t *pmd;
+ pte_t *pte;
+
+ /* pgd is never none and bad - it is
+ * detected in the pmd macros.
+ */
+ pmd = pmd_offset(pgd, 0);
+ if (pmd_none(*pmd))
+ break;
+ if (pmd_bad(*pmd)) {
+ printk("free_pgd_slow: bad directory entry %08lx\n", pmd_val(*pmd));
+ pmd_clear(pmd);
+ break;
+ }
+
+ pte = pte_offset(pmd, 0);
+ pmd_clear(pmd);
+ pte_free(pte);
+ pmd_free(pmd);
+ }
+ } while (0);
+ free_pages((unsigned long) pgd, 2);
+}
+
+#define pgd_free(pgd) free_pgd_fast(pgd)
+#define pgd_alloc() get_pgd_fast()
+
+extern __inline__ void set_pgdir(unsigned long address, pgd_t entry)
+{
+ struct task_struct * p;
+ pgd_t *pgd;
+
+ read_lock(&tasklist_lock);
+ for_each_task(p) {
+ if (!p->mm)
+ continue;
+ *pgd_offset(p->mm,address) = entry;
+ }
+ read_unlock(&tasklist_lock);
+ for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)__pgd_next(pgd))
+ pgd[address >> PGDIR_SHIFT] = entry;
+}
+
+extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
+
#define SWP_TYPE(entry) (((entry) >> 2) & 0x7f)
#define SWP_OFFSET(entry) ((entry) >> 9)
#define SWP_ENTRY(type,offset) (((type) << 2) | ((offset) << 9))
diff --git a/include/asm-arm/proc-armv/processor.h b/include/asm-arm/proc-armv/processor.h
index 7186039f9..45af61ea7 100644
--- a/include/asm-arm/proc-armv/processor.h
+++ b/include/asm-arm/proc-armv/processor.h
@@ -1,17 +1,21 @@
/*
* linux/include/asm-arm/proc-armv/processor.h
*
- * Copyright (c) 1996 Russell King.
+ * Copyright (c) 1996-1999 Russell King.
*
* Changelog:
* 20-09-1996 RMK Created
* 26-09-1996 RMK Added 'EXTRA_THREAD_STRUCT*'
* 28-09-1996 RMK Moved start_thread into the processor dependencies
* 09-09-1998 PJB Delete redundant `wp_works_ok'
+ * 30-05-1999 PJB Save sl across context switches
+ * 31-07-1999 RMK Added 'domain' stuff
*/
#ifndef __ASM_PROC_PROCESSOR_H
#define __ASM_PROC_PROCESSOR_H
+#include <asm/proc/domain.h>
+
#define KERNEL_STACK_SIZE PAGE_SIZE
struct context_save_struct {
@@ -22,14 +26,21 @@ struct context_save_struct {
unsigned long r7;
unsigned long r8;
unsigned long r9;
+ unsigned long sl;
unsigned long fp;
unsigned long pc;
};
-#define INIT_CSS (struct context_save_struct){ SVC_MODE, 0, 0, 0, 0, 0, 0, 0, 0 }
+#define INIT_CSS (struct context_save_struct){ SVC_MODE, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+
+#define EXTRA_THREAD_STRUCT \
+ unsigned int domain;
+
+#define EXTRA_THREAD_STRUCT_INIT \
+ , domain_val(DOMAIN_USER, DOMAIN_CLIENT) | \
+ domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \
+ domain_val(DOMAIN_IO, DOMAIN_CLIENT)
-#define EXTRA_THREAD_STRUCT
-#define EXTRA_THREAD_STRUCT_INIT
#define SWAPPER_PG_DIR (((unsigned long)swapper_pg_dir) - PAGE_OFFSET)
#define start_thread(regs,pc,sp) \
@@ -52,6 +63,7 @@ struct context_save_struct {
/*
* NOTE! The task struct and the stack go together
*/
+#define THREAD_SIZE (PAGE_SIZE * 2)
#define ll_alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
#define ll_free_task_struct(p) free_pages((unsigned long)(p),1)
diff --git a/include/asm-arm/proc-armv/system.h b/include/asm-arm/proc-armv/system.h
index 2aa59a26e..20250f659 100644
--- a/include/asm-arm/proc-armv/system.h
+++ b/include/asm-arm/proc-armv/system.h
@@ -116,7 +116,7 @@ extern unsigned long cr_alignment; /* defined in entry-armv.S */
" bic %0, %0, #192\n" \
" orr %0, %0, %1\n" \
" msr cpsr, %0" \
- : "=r" (temp) \
+ : "=&r" (temp) \
: "r" (x) \
: "memory"); \
} while (0)
diff --git a/include/asm-arm/proc-armv/uaccess.h b/include/asm-arm/proc-armv/uaccess.h
index a015a0738..7bef26d38 100644
--- a/include/asm-arm/proc-armv/uaccess.h
+++ b/include/asm-arm/proc-armv/uaccess.h
@@ -2,36 +2,8 @@
* linux/include/asm-arm/proc-armv/uaccess.h
*/
-/*
- * The fs functions are implemented on the ARMV3 and V4 architectures
- * using the domain register.
- *
- * DOMAIN_IO - domain 2 includes all IO only
- * DOMAIN_KERNEL - domain 1 includes all kernel memory only
- * DOMAIN_USER - domain 0 includes all user memory only
- */
-
#include <asm/hardware.h>
-
-#define DOMAIN_CLIENT 1
-#define DOMAIN_MANAGER 3
-
-#define DOMAIN_USER_CLIENT ((DOMAIN_CLIENT) << 0)
-#define DOMAIN_USER_MANAGER ((DOMAIN_MANAGER) << 0)
-
-#define DOMAIN_KERNEL_CLIENT ((DOMAIN_CLIENT) << 2)
-#define DOMAIN_KERNEL_MANAGER ((DOMAIN_MANAGER) << 2)
-
-#define DOMAIN_IO_CLIENT ((DOMAIN_CLIENT) << 4)
-#define DOMAIN_IO_MANAGER ((DOMAIN_MANAGER) << 4)
-
-/*
- * When we want to access kernel memory in the *_user functions,
- * we change the domain register to KERNEL_DS, thus allowing
- * unrestricted access
- */
-#define KERNEL_DOMAIN (DOMAIN_USER_CLIENT | DOMAIN_KERNEL_MANAGER | DOMAIN_IO_CLIENT)
-#define USER_DOMAIN (DOMAIN_USER_CLIENT | DOMAIN_KERNEL_CLIENT | DOMAIN_IO_CLIENT)
+#include <asm/proc/domain.h>
/*
* Note that this is actually 0x1,0000,0000
@@ -48,8 +20,7 @@ extern __inline__ void set_fs (mm_segment_t fs)
{
current->addr_limit = fs;
- __asm__ __volatile__("mcr p15, 0, %0, c3, c0" :
- : "r" (fs ? USER_DOMAIN : KERNEL_DOMAIN));
+ modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER);
}
/* We use 33-bit arithmetic here... */
diff --git a/include/asm-arm/proc-fns.h b/include/asm-arm/proc-fns.h
index 75e976244..8970cf137 100644
--- a/include/asm-arm/proc-fns.h
+++ b/include/asm-arm/proc-fns.h
@@ -1,127 +1,61 @@
/*
* linux/include/asm-arm/proc-fns.h
*
- * Copyright (C) 1997 Russell King
+ * Copyright (C) 1997-1999 Russell King
*/
#ifndef __ASM_PROCFNS_H
#define __ASM_PROCFNS_H
-#include <asm/page.h>
-
#ifdef __KERNEL__
-/* forward-declare task_struct */
-struct task_struct;
+#include <linux/config.h>
/*
- * Don't change this structure
+ * Work out if we need multiple CPU support
*/
-extern struct processor {
- const char *name;
- /* MISC
- *
- * flush caches for task switch
- */
- struct task_struct *(*_switch_to)(struct task_struct *prev, struct task_struct *next);
- /*
- * get data abort address/flags
- */
- void (*_data_abort)(unsigned long pc);
- /*
- * check for any bugs
- */
- void (*_check_bugs)(void);
- /*
- * Set up any processor specifics
- */
- void (*_proc_init)(void);
- /*
- * Disable any processor specifics
- */
- void (*_proc_fin)(void);
- /*
- * Processor architecture specific
- */
- union {
- struct {
- /* CACHE
- *
- * flush all caches
- */
- void (*_flush_cache_all)(void);
- /*
- * flush a specific page or pages
- */
- void (*_flush_cache_area)(unsigned long address, unsigned long end, int flags);
- /*
- * flush cache entry for an address
- */
- void (*_flush_cache_entry)(unsigned long address);
- /*
- * clean a virtual address range from the
- * D-cache without flushing the cache.
- */
- void (*_clean_cache_area)(unsigned long start, unsigned long size);
- /*
- * flush a page to RAM
- */
- void (*_flush_ram_page)(unsigned long page);
- /* TLB
- *
- * flush all TLBs
- */
- void (*_flush_tlb_all)(void);
- /*
- * flush a specific TLB
- */
- void (*_flush_tlb_area)(unsigned long address, unsigned long end, int flags);
- /*
- * Set a PMD (handling IMP bit 4)
- */
- void (*_set_pmd)(pmd_t *pmdp, pmd_t pmd);
- /*
- * Set a PTE
- */
- void (*_set_pte)(pte_t *ptep, pte_t pte);
- /*
- * Special stuff for a reset
- */
- unsigned long (*reset)(void);
- /*
- * flush an icached page
- */
- void (*_flush_icache_area)(unsigned long start, unsigned long size);
- /*
- * write back dirty cached data
- */
- void (*_cache_wback_area)(unsigned long start, unsigned long end);
- /*
- * purge cached data without (necessarily) writing it back
- */
- void (*_cache_purge_area)(unsigned long start, unsigned long end);
- } armv3v4;
- struct {
- /* MEMC
- *
- * remap memc tables
- */
- void (*_remap_memc)(void *tsk);
- /*
- * update task's idea of mmap
- */
- void (*_update_map)(void *tsk);
- /*
- * update task's idea after abort
- */
- void (*_update_mmu_cache)(void *vma, unsigned long addr, pte_t pte);
- /* XCHG
- */
- unsigned long (*_xchg_1)(unsigned long x, volatile void *ptr);
- unsigned long (*_xchg_2)(unsigned long x, volatile void *ptr);
- unsigned long (*_xchg_4)(unsigned long x, volatile void *ptr);
- } armv2;
- } u;
-} processor;
-#endif
+#undef MULTI_CPU
+#undef CPU_NAME
+
+#ifdef CONFIG_CPU_26
+# define CPU_INCLUDE_NAME "asm/cpu-multi26.h"
+# define MULTI_CPU
+#endif
+
+#ifdef CONFIG_CPU_32
+# define CPU_INCLUDE_NAME "asm/cpu-multi32.h"
+# ifdef CONFIG_CPU_ARM6
+# ifdef CPU_NAME
+# undef MULTI_CPU
+# define MULTI_CPU
+# else
+# define CPU_NAME arm6
+# endif
+# endif
+# ifdef CONFIG_CPU_ARM7
+# ifdef CPU_NAME
+# undef MULTI_CPU
+# define MULTI_CPU
+# else
+# define CPU_NAME arm7
+# endif
+# endif
+# ifdef CONFIG_CPU_SA110
+# ifdef CPU_NAME
+# undef MULTI_CPU
+# define MULTI_CPU
+# else
+# define CPU_NAME sa110
+# endif
+# endif
#endif
+#ifndef MULTI_CPU
+#undef CPU_INCLUDE_NAME
+#define CPU_INCLUDE_NAME "asm/cpu-single.h"
+#endif
+
+#include CPU_INCLUDE_NAME
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_PROCFNS_H */
diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h
index 97141aa25..c0903f5e8 100644
--- a/include/asm-arm/processor.h
+++ b/include/asm-arm/processor.h
@@ -40,28 +40,38 @@ typedef unsigned long mm_segment_t; /* domain register */
#include <asm/arch/processor.h>
#include <asm/proc/processor.h>
+struct debug_info {
+ int nsaved;
+ struct {
+ unsigned long address;
+ unsigned long insn;
+ } bp[2];
+};
+
struct thread_struct {
- unsigned long address; /* Address of fault */
- unsigned long trap_no; /* Trap number */
- unsigned long error_code; /* Error code of trap */
- union fp_state fpstate; /* FPE save state */
- unsigned long debug[NR_DEBUGS]; /* Debug/ptrace */
- struct context_save_struct *save; /* context save */
- unsigned long memmap; /* page tables */
+ /* fault info */
+ unsigned long address;
+ unsigned long trap_no;
+ unsigned long error_code;
+ /* floating point */
+ union fp_state fpstate;
+ /* debugging */
+ struct debug_info debug;
+ /* context info */
+ struct context_save_struct *save;
EXTRA_THREAD_STRUCT
};
#define INIT_MMAP \
{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-#define INIT_TSS { \
+#define INIT_THREAD { \
0, \
0, \
0, \
{ { { 0, }, }, }, \
{ 0, }, \
- (struct context_save_struct *)0, \
- SWAPPER_PG_DIR \
+ (struct context_save_struct *)0 \
EXTRA_THREAD_STRUCT_INIT \
}
@@ -94,7 +104,7 @@ struct mm_struct;
extern void release_thread(struct task_struct *);
/* Copy and release all segment info associated with a VM */
-#define copy_segments(nr, tsk, mm) do { } while (0)
+#define copy_segments(tsk, mm) do { } while (0)
#define release_segments(mm) do { } while (0)
#define forget_segments() do { } while (0)
@@ -104,6 +114,11 @@ extern void free_task_struct(struct task_struct *);
#define init_task (init_task_union.task)
#define init_stack (init_task_union.stack)
+/*
+ * Create a new kernel thread
+ */
+extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
+
#endif
#endif /* __ASM_ARM_PROCESSOR_H */
diff --git a/include/asm-arm/procinfo.h b/include/asm-arm/procinfo.h
index a89b7509f..8c11dfd80 100644
--- a/include/asm-arm/procinfo.h
+++ b/include/asm-arm/procinfo.h
@@ -1,34 +1,45 @@
/*
* linux/include/asm-arm/procinfo.h
*
- * Copyright (C) 1996 Russell King
+ * Copyright (C) 1996-1999 Russell King
*/
-
#ifndef __ASM_PROCINFO_H
#define __ASM_PROCINFO_H
-#include <asm/proc-fns.h>
-
#ifndef __ASSEMBLER__
-#define HWCAP_SWP (1 << 0)
-#define HWCAP_HALF (1 << 1)
-
-struct armversions {
- const unsigned long id; /* Processor ID */
- const unsigned long mask; /* Processor ID mask */
- const char *manu; /* Manufacturer */
- const char *name; /* Processor name */
- const char *arch_vsn; /* Architecture version */
- const char *elf_vsn; /* ELF library version */
- const int hwcap; /* ELF HWCAP */
- const struct processor *proc; /* Processor-specific ASM */
+#include <asm/proc-fns.h>
+
+struct proc_info_item {
+ const char *manufacturer;
+ const char *cpu_name;
};
-extern const struct armversions armidlist[];
-extern int armidindex;
+/*
+ * Note! struct processor is always defined if we're
+ * using MULTI_CPU, otherwise this entry is unused,
+ * but still exists.
+ */
+struct proc_info_list {
+ unsigned int cpu_val;
+ unsigned int cpu_mask;
+ const char *arch_name;
+ const char *elf_name;
+ unsigned int elf_hwcap;
+ struct proc_info_item *info;
+#ifdef MULTI_CPU
+ struct processor *proc;
+#else
+ void *unused;
+#endif
+};
#endif
+#define HWCAP_SWP 1
+#define HWCAP_HALF 2
+#define HWCAP_THUMB 4
+#define HWCAP_26BIT 8 /* Play it safe */
+
#endif
diff --git a/include/asm-arm/resource.h b/include/asm-arm/resource.h
index 85d281157..b5c6ccc6f 100644
--- a/include/asm-arm/resource.h
+++ b/include/asm-arm/resource.h
@@ -28,8 +28,8 @@
{ _STK_LIM, _STK_LIM }, \
{ 0, LONG_MAX }, \
{ LONG_MAX, LONG_MAX }, \
- { MAX_TASKS_PER_USER, MAX_TASKS_PER_USER }, \
- { NR_OPEN, NR_OPEN }, \
+ { 0, 0 }, \
+ { INR_OPEN, INR_OPEN }, \
{ LONG_MAX, LONG_MAX }, \
{ LONG_MAX, LONG_MAX }, \
}
diff --git a/include/asm-arm/semaphore.h b/include/asm-arm/semaphore.h
index 111e24f96..71509e9e8 100644
--- a/include/asm-arm/semaphore.h
+++ b/include/asm-arm/semaphore.h
@@ -6,11 +6,12 @@
#include <linux/linkage.h>
#include <asm/atomic.h>
+#include <linux/spinlock.h>
#include <linux/wait.h>
struct semaphore {
atomic_t count;
- int waking;
+ int sleepers;
wait_queue_head_t wait;
};
@@ -30,7 +31,7 @@ struct semaphore {
#define sema_init(sem, val) \
do { \
atomic_set(&((sem)->count), (val)); \
- (sem)->waking = 0; \
+ (sem)->sleepers = 0; \
init_waitqueue_head(&(sem)->wait); \
} while (0)
@@ -46,7 +47,7 @@ static inline void init_MUTEX_LOCKED(struct semaphore *sem)
asmlinkage void __down_failed (void /* special register calling convention */);
asmlinkage int __down_interruptible_failed (void /* special register calling convention */);
-asmlinkage int __down_failed_trylock(void /* params in registers */);
+asmlinkage int __down_trylock_failed(void /* params in registers */);
asmlinkage void __up_wakeup (void /* special register calling convention */);
extern void __down(struct semaphore * sem);
diff --git a/include/asm-arm/smplock.h b/include/asm-arm/smplock.h
index e62326a10..1590fafe9 100644
--- a/include/asm-arm/smplock.h
+++ b/include/asm-arm/smplock.h
@@ -4,7 +4,7 @@
* Default SMP lock implementation
*/
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
index 74022ebae..e92e81deb 100644
--- a/include/asm-arm/spinlock.h
+++ b/include/asm-arm/spinlock.h
@@ -1,116 +1,6 @@
#ifndef __ASM_SPINLOCK_H
#define __ASM_SPINLOCK_H
-/*
- * To be safe, we assume the only compiler that can cope with
- * empty initialisers is EGCS.
- */
-#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 90))
-#define EMPTY_STRUCT struct { }
-#define EMPTY_STRUCT_INIT(t) (t) { }
-#else
-#define EMPTY_STRUCT unsigned char
-#define EMPTY_STRUCT_INIT(t) (t) 0
-#endif
+#error ARM architecture does not support SMP spin locks
-/*
- * These are the generic versions of the spinlocks
- * and read-write locks.. We should actually do a
- * <linux/spinlock.h> with all of this. Oh, well.
- */
-#define spin_lock_irqsave(lock, flags) do { local_irq_save(flags); spin_lock(lock); } while (0)
-#define spin_lock_irq(lock) do { local_irq_disable(); spin_lock(lock); } while (0)
-#define spin_lock_bh(lock) do { local_bh_disable(); spin_lock(lock); } while (0)
-
-#define read_lock_irqsave(lock, flags) do { local_irq_save(flags); read_lock(lock); } while (0)
-#define read_lock_irq(lock) do { local_irq_disable(); read_lock(lock); } while (0)
-#define read_lock_bh(lock) do { local_bh_disable(); read_lock(lock); } while (0)
-
-#define write_lock_irqsave(lock, flags) do { local_irq_save(flags); write_lock(lock); } while (0)
-#define write_lock_irq(lock) do { local_irq_disable(); write_lock(lock); } while (0)
-#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while (0)
-
-#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); local_irq_restore(flags); } while (0)
-#define spin_unlock_irq(lock) do { spin_unlock(lock); local_irq_enable(); } while (0)
-#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0)
-
-#define read_unlock_irqrestore(lock, flags) do { read_unlock(lock); local_irq_restore(flags); } while (0)
-#define read_unlock_irq(lock) do { read_unlock(lock); local_irq_enable(); } while (0)
-#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0)
-
-#define write_unlock_irqrestore(lock, flags) do { write_unlock(lock); local_irq_restore(flags); } while (0)
-#define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0)
-#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0)
-
-#ifndef __SMP__
-
-#define DEBUG_SPINLOCKS 0 /* 0 == no debugging, 1 == maintain lock state, 2 == full debugging */
-
-#if (DEBUG_SPINLOCKS < 1)
-/*
- * Your basic spinlocks, allowing only a single CPU anywhere
- */
-typedef EMPTY_STRUCT spinlock_t;
-#define SPIN_LOCK_UNLOCKED EMPTY_STRUCT_INIT(spinlock_t)
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) do { } while(0)
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) do { } while(0)
-
-#elif (DEBUG_SPINLOCKS < 2)
-
-typedef struct {
- volatile unsigned int lock;
-} spinlock_t;
-#define SPIN_LOCK_UNLOCKED (pinlock_t) { 0 }
-
-#define spin_lock_init(x) do { (x)->lock = 0; } while (0)
-#define spin_lock(x) do { (x)->lock = 1; } while (0)
-#define spin_trylock(lock) (!test_and_set_bit(0,(lock)))
-#define spin_unlock_wait(x) do { } while (0)
-#define spin_unlock(x) do { (x)->lock = 0; } while (0)
-
-#else /* (DEBUG_SPINLOCKS >= 2) */
-
-typedef struct {
- volatule unsigned int lock;
- volatile unsigned int babble;
- const char *module;
-} spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 25, __BASE_FILE__ }
-
-#include <linux/kernel.h>
-
-#define spin_lock_init(x) do { (x)->lock = 0; } while (0)
-#define spin_trylock(lock) (!test_and_set_bit(0,(lock)))
-
-#define spin_lock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_lock(%s:%p) already locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 1; restore_flags(__spinflags);} while (0)
-#define spin_unlock_wait(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock_wait(%s:%p) deadlock\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} restore_flags(__spinflags);} while (0)
-#define spin_unlock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if (!(x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock(%s:%p) not locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 0; restore_flags(__spinflags);} while (0)
-
-#endif
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- */
-typedef EMPTY_STRUCT rwlock_t;
-#define RW_LOCK_UNLOCKED EMPTY_STRUCT_INIT(rwlock_t)
-
-#define read_lock(lock) do { } while(0)
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) do { } while(0)
-#define write_unlock(lock) do { } while(0)
-
-#else
-#error ARM architecture does not support spin locks
-#endif /* SMP */
#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-arm/string.h b/include/asm-arm/string.h
index d185c87bb..9c72b0173 100644
--- a/include/asm-arm/string.h
+++ b/include/asm-arm/string.h
@@ -14,6 +14,7 @@ extern char * strchr(const char * s, int c);
#define __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMSET
+#define __HAVE_ARCH_MEMCHR
#define __HAVE_ARCH_MEMZERO
extern void memzero(void *ptr, int n);
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h
index 80252899d..b4f4d4136 100644
--- a/include/asm-arm/system.h
+++ b/include/asm-arm/system.h
@@ -32,6 +32,7 @@ extern unsigned int __machine_arch_type;
#define MACH_TYPE_CLPS7110 9
#define MACH_TYPE_ARCHIMEDES 10
#define MACH_TYPE_A5K 11
+#define MACH_TYPE_SA1100 12 /* not allocated!!! */
/*
* Sort out a definition for machine_arch_type
@@ -140,15 +141,19 @@ extern asmlinkage void __backtrace(void);
#define wmb() mb()
#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
+#define prepare_to_switch() do { } while(0)
+
/*
* switch_to(prev, next) should switch from task `prev' to `next'
* `prev' will never be the same as `next'.
* The `mb' is to tell GCC not to cache `current' across this call.
*/
-#define switch_to(prev,next,last) \
- do { \
- last = processor._switch_to(prev,next); \
- mb(); \
+extern struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next);
+
+#define switch_to(prev,next,last) \
+ do { \
+ last = __switch_to(prev,next); \
+ mb(); \
} while (0)
#endif
diff --git a/include/asm-arm/termios.h b/include/asm-arm/termios.h
index 5e05c1754..df8a343b0 100644
--- a/include/asm-arm/termios.h
+++ b/include/asm-arm/termios.h
@@ -43,6 +43,8 @@ struct termio {
#define TIOCM_DSR 0x100
#define TIOCM_CD TIOCM_CAR
#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
@@ -60,6 +62,7 @@ struct termio {
#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */
#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
+#define N_HDLC 13 /* synchronous HDLC */
#ifdef __KERNEL__
diff --git a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
index f4a7ed33a..9a436259d 100644
--- a/include/asm-arm/unistd.h
+++ b/include/asm-arm/unistd.h
@@ -306,39 +306,39 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \
#ifdef __KERNEL_SYSCALLS__
-static inline int idle(void)
+static inline long idle(void)
{
- extern int sys_idle(void);
+ extern long sys_idle(void);
return sys_idle();
}
-static inline int pause(void)
+static inline long pause(void)
{
- extern int sys_pause(void);
+ extern long sys_pause(void);
return sys_pause();
}
-static inline int sync(void)
+static inline long sync(void)
{
- extern int sys_sync(void);
+ extern long sys_sync(void);
return sys_sync();
}
static inline pid_t setsid(void)
{
- extern int sys_setsid(void);
+ extern long sys_setsid(void);
return sys_setsid();
}
-static inline int write(int fd, const char *buf, off_t count)
+static inline long write(int fd, const char *buf, off_t count)
{
- extern int sys_write(int, const char *, int);
+ extern long sys_write(int, const char *, int);
return sys_write(fd, buf, count);
}
-static inline int read(int fd, char *buf, off_t count)
+static inline long read(int fd, char *buf, off_t count)
{
- extern int sys_read(int, char *, int);
+ extern long sys_read(int, char *, int);
return sys_read(fd, buf, count);
}
@@ -348,44 +348,44 @@ static inline off_t lseek(int fd, off_t offset, int count)
return sys_lseek(fd, offset, count);
}
-static inline int dup(int fd)
+static inline long dup(int fd)
{
- extern int sys_dup(int);
+ extern long sys_dup(int);
return sys_dup(fd);
}
-static inline int open(const char *file, int flag, int mode)
+static inline long open(const char *file, int flag, int mode)
{
- extern int sys_open(const char *, int, int);
+ extern long sys_open(const char *, int, int);
return sys_open(file, flag, mode);
}
-static inline int close(int fd)
+static inline long close(int fd)
{
return sys_close(fd);
}
-static inline int _exit(int exitcode)
+static inline long _exit(int exitcode)
{
- extern int sys_exit(int) __attribute__((noreturn));
+ extern long sys_exit(int) __attribute__((noreturn));
return sys_exit(exitcode);
}
static inline pid_t waitpid(pid_t pid, int *wait_stat, int options)
{
- extern int sys_wait4(int, int *, int, struct rusage *);
+ extern long sys_wait4(int, int *, int, struct rusage *);
return sys_wait4((int)pid, wait_stat, options, NULL);
}
-static inline int delete_module(const char *name)
+static inline long delete_module(const char *name)
{
- extern int sys_delete_module(const char *name);
+ extern long sys_delete_module(const char *name);
return sys_delete_module(name);
}
static inline pid_t wait(int * wait_stat)
{
- extern int sys_wait4(int, int *, int, struct rusage *);
+ extern long sys_wait4(int, int *, int, struct rusage *);
return sys_wait4(-1, wait_stat, 0, NULL);
}
@@ -395,11 +395,6 @@ static inline pid_t wait(int * wait_stat)
*/
static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp);
-/*
- * Create a new kernel thread
- */
-extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
-
#endif
#endif /* __ASM_ARM_UNISTD_H */
diff --git a/include/asm-generic/smplock.h b/include/asm-generic/smplock.h
index e62326a10..1590fafe9 100644
--- a/include/asm-generic/smplock.h
+++ b/include/asm-generic/smplock.h
@@ -4,7 +4,7 @@
* Default SMP lock implementation
*/
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-i386/i82489.h b/include/asm-i386/apic.h
index 76f580bde..7b035d9a3 100644
--- a/include/asm-i386/i82489.h
+++ b/include/asm-i386/apic.h
@@ -1,10 +1,10 @@
-#ifndef __ASM_I82489_H
-#define __ASM_I82489_H
+#ifndef __ASM_APIC_H
+#define __ASM_APIC_H
/*
- * Offsets for programming the 82489 and Pentium integrated APIC
+ * Constants for various Intel APICs. (local APIC, IOAPIC, etc.)
*
- * Alan Cox <Alan.Cox@linux.org>, 1995.
+ * Alan Cox <Alan.Cox@linux.org>, 1995.
*/
#define APIC_PHYS_BASE 0xfee00000 /* IA s/w dev Vol 3, Section 7.4 */
@@ -90,14 +90,6 @@
#define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
-extern __inline void apic_write(unsigned long reg, unsigned long v)
-{
- *((volatile unsigned long *)(APIC_BASE+reg))=v;
-}
-
-extern __inline unsigned long apic_read(unsigned long reg)
-{
- return *((volatile unsigned long *)(APIC_BASE+reg));
-}
+#define MAX_IO_APICS 8
#endif
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h
index fd1d75beb..6346f91d1 100644
--- a/include/asm-i386/atomic.h
+++ b/include/asm-i386/atomic.h
@@ -73,6 +73,17 @@ static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
return c != 0;
}
+extern __inline__ int atomic_add_negative(int i, volatile atomic_t *v)
+{
+ unsigned char c;
+
+ __asm__ __volatile__(
+ LOCK "addl %2,%0; sets %1"
+ :"=m" (__atomic_fool_gcc(v)), "=qm" (c)
+ :"ir" (i), "m" (__atomic_fool_gcc(v)));
+ return c;
+}
+
/* These are x86-specific, used by some header files */
#define atomic_clear_mask(mask, addr) \
__asm__ __volatile__(LOCK "andl %0,%1" \
diff --git a/include/asm-i386/bigmem.h b/include/asm-i386/bigmem.h
new file mode 100644
index 000000000..1c5c4cf4b
--- /dev/null
+++ b/include/asm-i386/bigmem.h
@@ -0,0 +1,69 @@
+/*
+ * bigmem.h: virtual kernel memory mappings for big memory
+ *
+ * Used in CONFIG_BIGMEM systems for memory pages which are not
+ * addressable by direct kernel virtual adresses.
+ *
+ * Copyright (C) 1999 Gerhard Wichert, Siemens AG
+ * Gerhard.Wichert@pdb.siemens.de
+ */
+
+#ifndef _ASM_BIGMEM_H
+#define _ASM_BIGMEM_H
+
+#include <linux/init.h>
+
+#define BIGMEM_DEBUG /* undef for production */
+
+/* declarations for bigmem.c */
+extern unsigned long bigmem_start, bigmem_end;
+extern int nr_free_bigpages;
+
+extern pte_t *kmap_pte;
+extern pgprot_t kmap_prot;
+
+extern void kmap_init(void) __init;
+
+/* kmap helper functions necessary to access the bigmem pages in kernel */
+#include <asm/pgtable.h>
+#include <asm/kmap_types.h>
+
+extern inline unsigned long kmap(unsigned long kaddr, enum km_type type)
+{
+ if (__pa(kaddr) < bigmem_start)
+ return kaddr;
+ {
+ enum fixed_addresses idx = type+KM_TYPE_NR*smp_processor_id();
+ unsigned long vaddr = __fix_to_virt(FIX_KMAP_BEGIN+idx);
+
+#ifdef BIGMEM_DEBUG
+ if (!pte_none(*(kmap_pte-idx)))
+ {
+ __label__ here;
+ here:
+ printk(KERN_ERR "not null pte on CPU %d from %p\n",
+ smp_processor_id(), &&here);
+ }
+#endif
+ set_pte(kmap_pte-idx, mk_pte(kaddr & PAGE_MASK, kmap_prot));
+ __flush_tlb_one(vaddr);
+
+ return vaddr | (kaddr & ~PAGE_MASK);
+ }
+}
+
+extern inline void kunmap(unsigned long vaddr, enum km_type type)
+{
+#ifdef BIGMEM_DEBUG
+ enum fixed_addresses idx = type+KM_TYPE_NR*smp_processor_id();
+ if ((vaddr & PAGE_MASK) == __fix_to_virt(FIX_KMAP_BEGIN+idx))
+ {
+ /* force other mappings to Oops if they'll try to access
+ this pte without first remap it */
+ pte_clear(kmap_pte-idx);
+ __flush_tlb_one(vaddr);
+ }
+#endif
+}
+
+#endif /* _ASM_BIGMEM_H */
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h
index 046fd5278..1914385eb 100644
--- a/include/asm-i386/bugs.h
+++ b/include/asm-i386/bugs.h
@@ -23,28 +23,37 @@
#define CONFIG_BUGi386
-__initfunc(static void no_halt(char *s, int *ints))
+static int __init no_halt(char *s)
{
boot_cpu_data.hlt_works_ok = 0;
+ return 1;
}
-__initfunc(static void mca_pentium(char *s, int *ints))
+__setup("no-hlt", no_halt);
+
+static int __init mca_pentium(char *s)
{
mca_pentium_flag = 1;
+ return 1;
}
-__initfunc(static void no_387(char *s, int *ints))
+__setup("mca-pentium", mca_pentium);
+
+static int __init no_387(char *s)
{
boot_cpu_data.hard_math = 0;
write_cr0(0xE | read_cr0());
+ return 1;
}
+__setup("no387", no_387);
+
static char __initdata fpu_error = 0;
-__initfunc(static void copro_timeout(void))
+static void __init copro_timeout(void)
{
fpu_error = 1;
- timer_table[COPRO_TIMER].expires = jiffies+100;
+ timer_table[COPRO_TIMER].expires = jiffies+HZ;
timer_active |= 1<<COPRO_TIMER;
printk(KERN_ERR "387 failed: trying to reset\n");
send_sig(SIGFPE, current, 1);
@@ -55,7 +64,7 @@ __initfunc(static void copro_timeout(void))
static double __initdata x = 4195835.0;
static double __initdata y = 3145727.0;
-__initfunc(static void check_fpu(void))
+static void __init check_fpu(void)
{
unsigned short control_word;
@@ -102,7 +111,7 @@ __initfunc(static void check_fpu(void))
* should get there first..
*/
printk(KERN_INFO "Checking 386/387 coupling... ");
- timer_table[COPRO_TIMER].expires = jiffies+50;
+ timer_table[COPRO_TIMER].expires = jiffies+HZ/2;
timer_table[COPRO_TIMER].fn = copro_timeout;
timer_active |= 1<<COPRO_TIMER;
__asm__("clts ; fninit ; fnstcw %0 ; fwait":"=m" (*&control_word));
@@ -134,7 +143,7 @@ __initfunc(static void check_fpu(void))
printk("Hmm, FPU using exception 16 error reporting with FDIV bug.\n");
}
-__initfunc(static void check_hlt(void))
+static void __init check_hlt(void)
{
printk(KERN_INFO "Checking 'hlt' instruction... ");
if (!boot_cpu_data.hlt_works_ok) {
@@ -150,7 +159,7 @@ __initfunc(static void check_hlt(void))
* machine even from user space.
*/
-__initfunc(static void check_popad(void))
+static void __init check_popad(void)
{
#ifndef CONFIG_X86_POPAD_OK
int res, inp = (int) &res;
@@ -183,7 +192,7 @@ __initfunc(static void check_popad(void))
extern void vide(void);
__asm__(".align 4\nvide: ret");
-__initfunc(static void check_amd_k6(void))
+static void __init check_amd_k6(void)
{
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
boot_cpu_data.x86_model == 6 &&
@@ -229,7 +238,7 @@ __initfunc(static void check_amd_k6(void))
extern void trap_init_f00f_bug(void);
-__initfunc(static void check_pentium_f00f(void))
+static void __init check_pentium_f00f(void)
{
/*
* Pentium and Pentium MMX
@@ -271,7 +280,7 @@ static inline int test_cyrix_52div(void)
extern unsigned char Cx86_dir0_msb; /* exported HACK from cyrix_model() */
-__initfunc(static void check_cx686_cpuid(void))
+static void __init check_cx686_cpuid(void)
{
if (boot_cpu_data.cpuid_level == -1 &&
((Cx86_dir0_msb == 5) || (Cx86_dir0_msb == 3))) {
@@ -311,7 +320,7 @@ __initfunc(static void check_cx686_cpuid(void))
extern void calibrate_delay(void) __init;
-__initfunc(static void check_cx686_slop(void))
+static void __init check_cx686_slop(void)
{
if (Cx86_dir0_msb == 3) {
unsigned char ccr3, ccr5;
@@ -339,7 +348,7 @@ __initfunc(static void check_cx686_slop(void))
* PII and PPro exhibit this behavior too, but they have cpuid available.
*/
-__initfunc(static void check_cyrix_cpu(void))
+static void __init check_cyrix_cpu(void)
{
if ((boot_cpu_data.cpuid_level == -1) && (boot_cpu_data.x86 == 4)
&& test_cyrix_52div()) {
@@ -354,7 +363,7 @@ __initfunc(static void check_cyrix_cpu(void))
* enable the workaround for it.
*/
-__initfunc(static void check_cyrix_coma(void))
+static void __init check_cyrix_coma(void)
{
}
@@ -371,7 +380,7 @@ __initfunc(static void check_cyrix_coma(void))
* reads from the APIC.
*/
-__initfunc(static void check_config(void))
+static void __init check_config(void)
{
/*
* We'd better not be a i386 if we're configured to use some
@@ -400,7 +409,7 @@ __initfunc(static void check_config(void))
#endif
}
-__initfunc(static void check_bugs(void))
+static void __init check_bugs(void)
{
check_cyrix_cpu();
identify_cpu(&boot_cpu_data);
diff --git a/include/asm-i386/cache.h b/include/asm-i386/cache.h
index cea6c8540..379568491 100644
--- a/include/asm-i386/cache.h
+++ b/include/asm-i386/cache.h
@@ -15,4 +15,12 @@
#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
#endif
diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h
index e91580e04..667ad58f3 100644
--- a/include/asm-i386/desc.h
+++ b/include/asm-i386/desc.h
@@ -1,6 +1,46 @@
#ifndef __ARCH_DESC_H
#define __ARCH_DESC_H
+#include <asm/ldt.h>
+
+/*
+ * The layout of the GDT under Linux:
+ *
+ * 0 - null
+ * 1 - not used
+ * 2 - kernel code segment
+ * 3 - kernel data segment
+ * 4 - user code segment <-- new cacheline
+ * 5 - user data segment
+ * 6 - not used
+ * 7 - not used
+ * 8 - APM BIOS support <-- new cacheline
+ * 9 - APM BIOS support
+ * 10 - APM BIOS support
+ * 11 - APM BIOS support
+ *
+ * The TSS+LDT descriptors are spread out a bit so that every CPU
+ * has an exclusive cacheline for the per-CPU TSS and LDT:
+ *
+ * 12 - CPU#0 TSS <-- new cacheline
+ * 13 - CPU#0 LDT
+ * 14 - not used
+ * 15 - not used
+ * 16 - CPU#1 TSS <-- new cacheline
+ * 17 - CPU#1 LDT
+ * 18 - not used
+ * 19 - not used
+ * ... NR_CPUS per-CPU TSS+LDT's if on SMP
+ *
+ * Entry into gdt where to find first TSS.
+ */
+#define __FIRST_TSS_ENTRY 12
+#define __FIRST_LDT_ENTRY (__FIRST_TSS_ENTRY+1)
+
+#define __TSS(n) (((n)<<2) + __FIRST_TSS_ENTRY)
+#define __LDT(n) (((n)<<2) + __FIRST_LDT_ENTRY)
+
+#ifndef __ASSEMBLY__
struct desc_struct {
unsigned long a,b;
};
@@ -16,46 +56,44 @@ struct Xgt_desc_struct {
#define idt_descr (*(struct Xgt_desc_struct *)((char *)&idt - 2))
#define gdt_descr (*(struct Xgt_desc_struct *)((char *)&gdt - 2))
+#define load_TR(n) __asm__ __volatile__("ltr %%ax"::"a" (__TSS(n)<<3))
+
+#define __load_LDT(n) __asm__ __volatile__("lldt %%ax"::"a" (__LDT(n)<<3))
+
/*
- * Entry into gdt where to find first TSS. GDT layout:
- * 0 - null
- * 1 - not used
- * 2 - kernel code segment
- * 3 - kernel data segment
- * 4 - user code segment
- * 5 - user data segment
- * 6 - not used
- * 7 - not used
- * 8 - APM BIOS support
- * 9 - APM BIOS support
- * 10 - APM BIOS support
- * 11 - APM BIOS support
- * 12 - TSS #0
- * 13 - LDT #0
- * 14 - TSS #1
- * 15 - LDT #1
+ * This is the ldt that every process will get unless we need
+ * something other than this.
*/
-#define FIRST_TSS_ENTRY 12
-#define FIRST_LDT_ENTRY (FIRST_TSS_ENTRY+1)
-#define _TSS(n) ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3))
-#define _LDT(n) ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3))
-#define load_TR(n) __asm__ __volatile__("ltr %%ax": /* no output */ :"a" (_TSS(n)))
-#define load_ldt(n) __asm__ __volatile__("lldt %%ax": /* no output */ :"a" (_LDT(n)))
-#define store_TR(n) \
-__asm__("str %%ax\n\t" \
- "subl %2,%%eax\n\t" \
- "shrl $4,%%eax" \
- :"=a" (n) \
- :"0" (0),"i" (FIRST_TSS_ENTRY<<3))
-
+extern struct desc_struct default_ldt[];
extern void set_intr_gate(unsigned int irq, void * addr);
extern void set_ldt_desc(unsigned int n, void *addr, unsigned int size);
extern void set_tss_desc(unsigned int n, void *addr);
+extern inline void clear_LDT(void)
+{
+ int cpu = smp_processor_id();
+ set_ldt_desc(cpu, &default_ldt[0], 5);
+ __load_LDT(cpu);
+}
+
/*
- * This is the ldt that every process will get unless we need
- * something other than this.
+ * load one particular LDT into the current CPU
*/
-extern struct desc_struct default_ldt;
+extern inline void load_LDT (struct mm_struct *mm)
+{
+ int cpu = smp_processor_id();
+ void *segments = mm->segments;
+ int count = LDT_ENTRIES;
+
+ if (!segments) {
+ segments = &default_ldt[0];
+ count = 5;
+ }
+
+ set_ldt_desc(cpu, segments, count);
+ __load_LDT(cpu);
+}
+
+#endif /* !__ASSEMBLY__ */
#endif
diff --git a/include/asm-i386/dma.h b/include/asm-i386/dma.h
index 12e02b1d0..1bc9899b2 100644
--- a/include/asm-i386/dma.h
+++ b/include/asm-i386/dma.h
@@ -9,8 +9,8 @@
#define _ASM_DMA_H
#include <linux/config.h>
+#include <linux/spinlock.h> /* And spinlocks */
#include <asm/io.h> /* need byte IO */
-#include <asm/spinlock.h> /* And spinlocks */
#include <linux/delay.h>
@@ -289,9 +289,10 @@ extern void free_dma(unsigned int dmanr); /* release it again */
/* From PCI */
-#ifdef CONFIG_PCI_QUIRKS
+#ifdef CONFIG_PCI
extern int isa_dma_bridge_buggy;
#else
#define isa_dma_bridge_buggy (0)
#endif
+
#endif /* _ASM_DMA_H */
diff --git a/include/asm-i386/e820.h b/include/asm-i386/e820.h
new file mode 100644
index 000000000..50b708d91
--- /dev/null
+++ b/include/asm-i386/e820.h
@@ -0,0 +1,39 @@
+/*
+ * structures and definitions for the int 15, ax=e820 memory map
+ * scheme.
+ *
+ * In a nutshell, arch/i386/boot/setup.S populates a scratch table
+ * in the empty_zero_block that contains a list of usable address/size
+ * duples. In arch/i386/kernel/setup.c, this information is
+ * transferred into the e820map, and in arch/i386/mm/init.c, that
+ * new information is used to mark pages reserved or not.
+ *
+ */
+#ifndef __E820_HEADER
+#define __E820_HEADER
+
+#define E820MAP 0x2d0 /* our map */
+#define E820MAX 32 /* number of entries in E820MAP */
+#define E820NR 0x1e8 /* # entries in E820MAP */
+
+#define E820_RAM 1
+#define E820_RESERVED 2
+#define E820_ACPI 3
+
+#define HIGH_MEMORY (1024*1024)
+
+#ifndef __ASSEMBLY__
+
+struct e820map {
+ int nr_map;
+ struct {
+ long long addr; /* start of memory segment */
+ long long size; /* size of memory segment */
+ long type; /* type of memory segment */
+ } map[E820MAX];
+};
+
+extern struct e820map e820;
+#endif/*!__ASSEMBLY__*/
+
+#endif/*__E820_HEADER*/
diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h
index c259a45ee..34c82dbe0 100644
--- a/include/asm-i386/fixmap.h
+++ b/include/asm-i386/fixmap.h
@@ -6,6 +6,8 @@
* for more details.
*
* Copyright (C) 1998 Ingo Molnar
+ *
+ * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
*/
#ifndef _ASM_FIXMAP_H
@@ -13,7 +15,12 @@
#include <linux/config.h>
#include <linux/kernel.h>
+#include <asm/apic.h>
#include <asm/page.h>
+#ifdef CONFIG_BIGMEM
+#include <linux/threads.h>
+#include <asm/kmap_types.h>
+#endif
/*
* Here we define all the compile-time 'special' virtual
@@ -45,7 +52,8 @@ enum fixed_addresses {
FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */
#endif
#ifdef CONFIG_X86_IO_APIC
- FIX_IO_APIC_BASE,
+ FIX_IO_APIC_BASE_0,
+ FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
#endif
#ifdef CONFIG_X86_VISWS_APIC
FIX_CO_CPU, /* Cobalt timer */
@@ -53,6 +61,10 @@ enum fixed_addresses {
FIX_LI_PCIA, /* Lithium PCI Bridge A */
FIX_LI_PCIB, /* Lithium PCI Bridge B */
#endif
+#ifdef CONFIG_BIGMEM
+ FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
+ FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
+#endif
__end_of_fixed_addresses
};
diff --git a/include/asm-i386/hardirq.h b/include/asm-i386/hardirq.h
index 533961343..f96faa806 100644
--- a/include/asm-i386/hardirq.h
+++ b/include/asm-i386/hardirq.h
@@ -1,7 +1,7 @@
#ifndef __ASM_HARDIRQ_H
#define __ASM_HARDIRQ_H
-#include <linux/tasks.h>
+#include <linux/threads.h>
extern unsigned int local_irq_count[NR_CPUS];
@@ -53,7 +53,7 @@ static inline void hardirq_exit(int cpu)
static inline int hardirq_trylock(int cpu)
{
- return !atomic_read(&global_irq_count) && !test_bit(0,&global_irq_lock);
+ return !local_irq_count[cpu] && !test_bit(0,&global_irq_lock);
}
#define hardirq_endlock(cpu) do { } while (0)
diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
new file mode 100644
index 000000000..8cce40151
--- /dev/null
+++ b/include/asm-i386/hw_irq.h
@@ -0,0 +1,223 @@
+#ifndef _ASM_HW_IRQ_H
+#define _ASM_HW_IRQ_H
+
+/*
+ * linux/include/asm/hw_irq.h
+ *
+ * (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar
+ *
+ * moved some of the old arch/i386/kernel/irq.h to here. VY
+ *
+ * IRQ/IPI changes taken from work by Thomas Radke
+ * <tomsoft@informatik.tu-chemnitz.de>
+ */
+
+#include <asm/irq.h>
+
+/*
+ * IDT vectors usable for external interrupt sources start
+ * at 0x20:
+ */
+#define FIRST_EXTERNAL_VECTOR 0x20
+
+#define SYSCALL_VECTOR 0x80
+
+/*
+ * Vectors 0x20-0x2f are used for ISA interrupts.
+ */
+
+/*
+ * Special IRQ vectors used by the SMP architecture:
+ *
+ * (some of the following vectors are 'rare', they are merged
+ * into a single vector (FUNCTION_VECTOR) to save vector space.
+ * TLB, reschedule and local APIC vectors are performance-critical.)
+ */
+#define RESCHEDULE_VECTOR 0x30
+#define INVALIDATE_TLB_VECTOR 0x31
+#define STOP_CPU_VECTOR 0x40
+#define LOCAL_TIMER_VECTOR 0x41
+#define CALL_FUNCTION_VECTOR 0x50
+
+/*
+ * First APIC vector available to drivers: (vectors 0x51-0xfe)
+ */
+#define IRQ0_TRAP_VECTOR 0x51
+
+/*
+ * This IRQ should never happen, but we print a message nevertheless.
+ */
+#define SPURIOUS_APIC_VECTOR 0xff
+
+extern int irq_vector[NR_IRQS];
+#define IO_APIC_VECTOR(irq) irq_vector[irq]
+
+extern void init_IRQ_SMP(void);
+
+/*
+ * Various low-level irq details needed by irq.c, process.c,
+ * time.c, io_apic.c and smp.c
+ *
+ * Interrupt entry/exit code at both C and assembly level
+ */
+
+extern void no_action(int cpl, void *dev_id, struct pt_regs *regs);
+extern void mask_irq(unsigned int irq);
+extern void unmask_irq(unsigned int irq);
+extern void disable_8259A_irq(unsigned int irq);
+extern int i8259A_irq_pending(unsigned int irq);
+extern void ack_APIC_irq(void);
+extern void FASTCALL(send_IPI_self(int vector));
+extern void init_VISWS_APIC_irqs(void);
+extern void setup_IO_APIC(void);
+extern int IO_APIC_get_PCI_irq_vector(int bus, int slot, int fn);
+extern void make_8259A_irq(unsigned int irq);
+extern void send_IPI(int dest, int vector);
+extern void init_pic_mode(void);
+extern void print_IO_APIC(void);
+
+extern unsigned long io_apic_irqs;
+
+extern char _stext, _etext;
+
+#define MAX_IRQ_SOURCES 128
+#define MAX_MP_BUSSES 32
+enum mp_bustype {
+ MP_BUS_ISA,
+ MP_BUS_EISA,
+ MP_BUS_PCI
+};
+extern int mp_bus_id_to_type [MAX_MP_BUSSES];
+extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
+
+
+#ifdef __SMP__
+#define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
+
+#else
+
+#define IO_APIC_IRQ(x) (0)
+
+#endif
+
+#define __STR(x) #x
+#define STR(x) __STR(x)
+
+#define SAVE_ALL \
+ "cld\n\t" \
+ "pushl %es\n\t" \
+ "pushl %ds\n\t" \
+ "pushl %eax\n\t" \
+ "pushl %ebp\n\t" \
+ "pushl %edi\n\t" \
+ "pushl %esi\n\t" \
+ "pushl %edx\n\t" \
+ "pushl %ecx\n\t" \
+ "pushl %ebx\n\t" \
+ "movl $" STR(__KERNEL_DS) ",%edx\n\t" \
+ "movl %dx,%ds\n\t" \
+ "movl %dx,%es\n\t"
+
+#define IRQ_NAME2(nr) nr##_interrupt(void)
+#define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
+
+#define GET_CURRENT \
+ "movl %esp, %ebx\n\t" \
+ "andl $-8192, %ebx\n\t"
+
+#ifdef __SMP__
+
+/*
+ * SMP has a few special interrupts for IPI messages
+ */
+
+ /* there is a second layer of macro just to get the symbolic
+ name for the vector evaluated. This change is for RTLinux */
+#define BUILD_SMP_INTERRUPT(x,v) XBUILD_SMP_INTERRUPT(x,v)
+#define XBUILD_SMP_INTERRUPT(x,v)\
+asmlinkage void x(void); \
+asmlinkage void call_##x(void); \
+__asm__( \
+"\n"__ALIGN_STR"\n" \
+SYMBOL_NAME_STR(x) ":\n\t" \
+ "pushl $"#v"\n\t" \
+ SAVE_ALL \
+ SYMBOL_NAME_STR(call_##x)":\n\t" \
+ "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
+ "jmp ret_from_intr\n");
+
+#define BUILD_SMP_TIMER_INTERRUPT(x,v) XBUILD_SMP_TIMER_INTERRUPT(x,v)
+#define XBUILD_SMP_TIMER_INTERRUPT(x,v) \
+asmlinkage void x(struct pt_regs * regs); \
+asmlinkage void call_##x(void); \
+__asm__( \
+"\n"__ALIGN_STR"\n" \
+SYMBOL_NAME_STR(x) ":\n\t" \
+ "pushl $"#v"\n\t" \
+ SAVE_ALL \
+ "movl %esp,%eax\n\t" \
+ "pushl %eax\n\t" \
+ SYMBOL_NAME_STR(call_##x)":\n\t" \
+ "call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
+ "addl $4,%esp\n\t" \
+ "jmp ret_from_intr\n");
+
+#endif /* __SMP__ */
+
+#define BUILD_COMMON_IRQ() \
+asmlinkage void call_do_IRQ(void); \
+__asm__( \
+ "\n" __ALIGN_STR"\n" \
+ "common_interrupt:\n\t" \
+ SAVE_ALL \
+ "pushl $ret_from_intr\n\t" \
+ SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \
+ "jmp "SYMBOL_NAME_STR(do_IRQ));
+
+/*
+ * subtle. orig_eax is used by the signal code to distinct between
+ * system calls and interrupted 'random user-space'. Thus we have
+ * to put a negative value into orig_eax here. (the problem is that
+ * both system calls and IRQs want to have small integer numbers in
+ * orig_eax, and the syscall code has won the optimization conflict ;)
+ *
+ * Subtle as a pigs ear. VY
+ */
+
+#define BUILD_IRQ(nr) \
+asmlinkage void IRQ_NAME(nr); \
+__asm__( \
+"\n"__ALIGN_STR"\n" \
+SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \
+ "pushl $"#nr"-256\n\t" \
+ "jmp common_interrupt");
+
+/*
+ * x86 profiling function, SMP safe. We might want to do this in
+ * assembly totally?
+ */
+static inline void x86_do_profile (unsigned long eip)
+{
+ if (prof_buffer && current->pid) {
+ eip -= (unsigned long) &_stext;
+ eip >>= prof_shift;
+ /*
+ * Don't ignore out-of-bounds EIP values silently,
+ * put them into the last histogram slot, so if
+ * present, they will show up as a sharp peak.
+ */
+ if (eip > prof_len-1)
+ eip = prof_len-1;
+ atomic_inc((atomic_t *)&prof_buffer[eip]);
+ }
+}
+
+#ifdef __SMP__ /*more of this file should probably be ifdefed SMP */
+static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {
+ send_IPI_self(IO_APIC_VECTOR(i));
+}
+#else
+static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {}
+#endif
+
+#endif /* _ASM_HW_IRQ_H */
diff --git a/include/asm-i386/ide.h b/include/asm-i386/ide.h
index 6876f9f60..1947b62c0 100644
--- a/include/asm-i386/ide.h
+++ b/include/asm-i386/ide.h
@@ -13,8 +13,10 @@
#ifdef __KERNEL__
+#include <linux/config.h>
+
#ifndef MAX_HWIFS
-#define MAX_HWIFS 8
+#define MAX_HWIFS 10
#endif
#define ide__sti() __sti()
@@ -67,7 +69,7 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
static __inline__ void ide_init_default_hwifs(void)
{
-#ifdef __DO_I_NEED_THIS
+#ifndef CONFIG_BLK_DEV_IDEPCI
hw_regs_t hw;
int index;
@@ -76,7 +78,7 @@ static __inline__ void ide_init_default_hwifs(void)
hw.irq = ide_default_irq(ide_default_io_base(index));
ide_register_hw(&hw, NULL);
}
-#endif /* __DO_I_NEED_THIS */
+#endif /* CONFIG_BLK_DEV_IDEPCI */
}
typedef union {
diff --git a/include/asm-i386/init.h b/include/asm-i386/init.h
index 7618c0054..17d215574 100644
--- a/include/asm-i386/init.h
+++ b/include/asm-i386/init.h
@@ -1,17 +1 @@
-#ifndef _I386_INIT_H
-#define _I386_INIT_H
-
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
-/* For assembly routines */
-#define __INIT .section ".text.init",#alloc,#execinstr
-#define __FINIT .previous
-#define __INITDATA .section ".data.init",#alloc,#write
-
-#define __cacheline_aligned __attribute__ \
- ((__section__ (".data.cacheline_aligned")))
-
-#endif
+#error "<asm/init.h> should never be used - use <linux/init.h> instead"
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 93fd0c1b5..906fca475 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -27,6 +27,7 @@
/*
* Bit simplified and optimized by Jan Hubicka
+ * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999.
*/
#ifdef SLOW_IO_BY_JUMPING
@@ -98,6 +99,7 @@ __OUTS(l)
#ifdef __KERNEL__
+#include <linux/config.h>
#include <linux/vmalloc.h>
#include <asm/page.h>
@@ -109,12 +111,20 @@ __OUTS(l)
*/
extern inline unsigned long virt_to_phys(volatile void * address)
{
+#ifdef CONFIG_BIGMEM
+ return __pa(address);
+#else
return __io_phys(address);
+#endif
}
extern inline void * phys_to_virt(unsigned long address)
{
+#ifdef CONFIG_BIGMEM
+ return __va(address);
+#else
return __io_virt(address);
+#endif
}
extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
@@ -152,10 +162,16 @@ extern void iounmap(void *addr);
#define readb(addr) (*(volatile unsigned char *) __io_virt(addr))
#define readw(addr) (*(volatile unsigned short *) __io_virt(addr))
#define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
+#define __raw_readb readb
+#define __raw_readw readw
+#define __raw_readl readl
#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b))
#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))
#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
+#define __raw_writeb writeb
+#define __raw_writew writew
+#define __raw_writel writel
#define memset_io(a,b,c) memset(__io_virt(a),(b),(c))
#define memcpy_fromio(a,b,c) memcpy((a),__io_virt(b),(c))
diff --git a/include/asm-i386/kmap_types.h b/include/asm-i386/kmap_types.h
new file mode 100644
index 000000000..b3f16e29b
--- /dev/null
+++ b/include/asm-i386/kmap_types.h
@@ -0,0 +1,10 @@
+#ifndef _ASM_KMAP_TYPES_H
+#define _ASM_KMAP_TYPES_H
+
+enum km_type {
+ KM_READ,
+ KM_WRITE,
+ KM_TYPE_NR,
+};
+
+#endif
diff --git a/include/asm-i386/ldt.h b/include/asm-i386/ldt.h
index 55b75ca39..9d1110f98 100644
--- a/include/asm-i386/ldt.h
+++ b/include/asm-i386/ldt.h
@@ -11,6 +11,7 @@
/* The size of each LDT entry. */
#define LDT_ENTRY_SIZE 8
+#ifndef __ASSEMBLY__
struct modify_ldt_ldt_s {
unsigned int entry_number;
unsigned long base_addr;
@@ -27,4 +28,5 @@ struct modify_ldt_ldt_s {
#define MODIFY_LDT_CONTENTS_STACK 1
#define MODIFY_LDT_CONTENTS_CODE 2
+#endif /* !__ASSEMBLY__ */
#endif
diff --git a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
index e8b812e2f..cd142e995 100644
--- a/include/asm-i386/mmu_context.h
+++ b/include/asm-i386/mmu_context.h
@@ -1,13 +1,33 @@
#ifndef __I386_MMU_CONTEXT_H
#define __I386_MMU_CONTEXT_H
+#include <asm/desc.h>
+#include <asm/atomic.h>
+
/*
- * get a new mmu context.. x86's don't know about contexts.
+ * possibly do the LDT unload here?
*/
-#define get_mmu_context(x) do { } while (0)
+#define destroy_context(mm) do { } while(0)
+#define init_new_context(tsk,mm) do { } while (0)
+
+static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
+{
+
+ if (prev != next) {
+ /*
+ * Re-load LDT if necessary
+ */
+ if (prev->segments != next->segments)
+ load_LDT(next);
+
+ /* Re-load page tables */
+ asm volatile("movl %0,%%cr3": :"r" (__pa(next->pgd)));
+ clear_bit(cpu, &prev->cpu_vm_mask);
+ }
+ set_bit(cpu, &next->cpu_vm_mask);
+}
-#define init_new_context(mm) do { } while(0)
-#define destroy_context(mm) do { } while(0)
-#define activate_context(tsk) do { } while(0)
+#define activate_mm(prev, next) \
+ switch_mm((prev),(next),NULL,smp_processor_id())
#endif
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index 847dffbd0..2e5006f4a 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -101,6 +101,7 @@ typedef unsigned long pgprot_t;
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
+#define PHYSMAP_NR(addr) ((unsigned long)(addr) >> PAGE_SHIFT)
#endif /* __KERNEL__ */
diff --git a/include/asm-i386/parport.h b/include/asm-i386/parport.h
new file mode 100644
index 000000000..c08ee4686
--- /dev/null
+++ b/include/asm-i386/parport.h
@@ -0,0 +1,59 @@
+/*
+ * parport.h: ia32-specific parport initialisation
+ *
+ * Copyright (C) 1999 Tim Waugh <tim@cyberelk.demon.co.uk>
+ *
+ * This file should only be included by drivers/parport/parport_pc.c.
+ */
+
+#ifndef _ASM_I386_PARPORT_H
+#define _ASM_I386_PARPORT_H 1
+
+#include <linux/config.h>
+
+/* Maximum number of ports to support. It is useless to set this greater
+ than PARPORT_MAX (in <linux/parport.h>). */
+#define PARPORT_PC_MAX_PORTS 8
+
+/* If parport_cs (PCMCIA) is managing ports for us, we'll need the
+ * probing routines forever; otherwise we can lose them at boot time. */
+#ifdef CONFIG_PARPORT_PC_PCMCIA
+#define __maybe_initdata
+#define __maybe_init
+#else
+#define __maybe_initdata __initdata
+#define __maybe_init __init
+#endif
+
+static int __maybe_init parport_pc_init_pci(int irq, int dma);
+
+static int user_specified __maybe_initdata = 0;
+int __init
+parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
+{
+ int count = 0, i = 0;
+
+ if (io && *io) {
+ /* Only probe the ports we were given. */
+ user_specified = 1;
+ do {
+ if (!*io_hi) *io_hi = 0x400 + *io;
+ if (parport_pc_probe_port(*(io++), *(io_hi++),
+ *(irq++), *(dma++)))
+ count++;
+ } while (*io && (++i < PARPORT_PC_MAX_PORTS));
+ } else {
+ /* Probe all the likely ports. */
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ count++;
+ count += parport_pc_init_pci (irq[0], dma[0]);
+ }
+
+ return count;
+}
+
+#endif /* !(_ASM_I386_PARPORT_H) */
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
new file mode 100644
index 000000000..d7c59f21b
--- /dev/null
+++ b/include/asm-i386/pci.h
@@ -0,0 +1,11 @@
+#ifndef __i386_PCI_H
+#define __i386_PCI_H
+
+/* Can be used to override the logic in pci_scan_bus for skipping
+ already-configured bus numbers - to be used for buggy BIOSes
+ or architectures with incomplete PCI setup by the loader */
+
+#define pcibios_assign_all_busses() 0
+
+#endif /* __i386_PCI_H */
+
diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
index b4c8d0e99..36303437b 100644
--- a/include/asm-i386/pgtable.h
+++ b/include/asm-i386/pgtable.h
@@ -15,7 +15,9 @@
#ifndef __ASSEMBLY__
#include <asm/processor.h>
#include <asm/fixmap.h>
-#include <linux/tasks.h>
+#include <linux/threads.h>
+
+extern pgd_t swapper_pg_dir[1024];
/* Caches aren't brain-dead on the intel. */
#define flush_cache_all() do { } while (0)
@@ -56,21 +58,21 @@ __asm__ __volatile__("invlpg %0": :"m" (*(char *) addr))
static inline void flush_tlb_mm(struct mm_struct *mm)
{
- if (mm == current->mm)
+ if (mm == current->active_mm)
__flush_tlb();
}
static inline void flush_tlb_page(struct vm_area_struct *vma,
unsigned long addr)
{
- if (vma->vm_mm == current->mm)
+ if (vma->vm_mm == current->active_mm)
__flush_tlb_one(addr);
}
static inline void flush_tlb_range(struct mm_struct *mm,
unsigned long start, unsigned long end)
{
- if (mm == current->mm)
+ if (mm == current->active_mm)
__flush_tlb();
}
@@ -86,79 +88,19 @@ static inline void flush_tlb_range(struct mm_struct *mm,
#define local_flush_tlb() \
__flush_tlb()
+extern void flush_tlb_all(void);
+extern void flush_tlb_current_task(void);
+extern void flush_tlb_mm(struct mm_struct *);
+extern void flush_tlb_page(struct vm_area_struct *, unsigned long);
-#define CLEVER_SMP_INVALIDATE
-#ifdef CLEVER_SMP_INVALIDATE
-
-/*
- * Smarter SMP flushing macros.
- * c/o Linus Torvalds.
- *
- * These mean you can really definitely utterly forget about
- * writing to user space from interrupts. (Its not allowed anyway).
- */
-
-static inline void flush_tlb_current_task(void)
-{
- /* just one copy of this mm? */
- if (atomic_read(&current->mm->count) == 1)
- local_flush_tlb(); /* and that's us, so.. */
- else
- smp_flush_tlb();
-}
-
-#define flush_tlb() flush_tlb_current_task()
-
-#define flush_tlb_all() smp_flush_tlb()
+#define flush_tlb() flush_tlb_current_task()
-static inline void flush_tlb_mm(struct mm_struct * mm)
-{
- if (mm == current->mm && atomic_read(&mm->count) == 1)
- local_flush_tlb();
- else
- smp_flush_tlb();
-}
-
-static inline void flush_tlb_page(struct vm_area_struct * vma,
- unsigned long va)
-{
- if (vma->vm_mm == current->mm && atomic_read(&current->mm->count) == 1)
- __flush_tlb_one(va);
- else
- smp_flush_tlb();
-}
-
-static inline void flush_tlb_range(struct mm_struct * mm,
- unsigned long start, unsigned long end)
+static inline void flush_tlb_range(struct mm_struct * mm, unsigned long start, unsigned long end)
{
flush_tlb_mm(mm);
}
-#else
-
-#define flush_tlb() \
- smp_flush_tlb()
-
-#define flush_tlb_all() flush_tlb()
-
-static inline void flush_tlb_mm(struct mm_struct *mm)
-{
- flush_tlb();
-}
-
-static inline void flush_tlb_page(struct vm_area_struct *vma,
- unsigned long addr)
-{
- flush_tlb();
-}
-
-static inline void flush_tlb_range(struct mm_struct *mm,
- unsigned long start, unsigned long end)
-{
- flush_tlb();
-}
-#endif
#endif
#endif /* !__ASSEMBLY__ */
@@ -302,15 +244,6 @@ extern pte_t * __bad_pagetable(void);
#define PAGE_PTR(address) \
((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
-/* to set the page-dir */
-#define SET_PAGE_DIR(tsk,pgdir) \
-do { \
- unsigned long __pgdir = __pa(pgdir); \
- (tsk)->tss.cr3 = __pgdir; \
- if ((tsk) == current) \
- __asm__ __volatile__("movl %0,%%cr3": :"r" (__pgdir)); \
-} while (0)
-
#define pte_none(x) (!pte_val(x))
#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
#define pte_clear(xp) do { pte_val(*(xp)) = 0; } while (0)
@@ -401,13 +334,11 @@ extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
extern __inline__ pgd_t *get_pgd_slow(void)
{
- pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL), *init;
+ pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL);
if (ret) {
- init = pgd_offset(&init_mm, 0);
- memset (ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
- memcpy (ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,
- (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+ memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
+ memcpy(ret + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
}
return ret;
}
@@ -416,9 +347,9 @@ extern __inline__ pgd_t *get_pgd_fast(void)
{
unsigned long *ret;
- if((ret = pgd_quicklist) != NULL) {
+ if ((ret = pgd_quicklist) != NULL) {
pgd_quicklist = (unsigned long *)(*ret);
- ret[0] = ret[1];
+ ret[0] = 0;
pgtable_cache_size--;
} else
ret = (unsigned long *)get_pgd_slow();
@@ -481,9 +412,9 @@ extern __inline__ void free_pmd_slow(pmd_t *pmd)
extern void __bad_pte(pmd_t *pmd);
extern void __bad_pte_kernel(pmd_t *pmd);
-#define pte_free_kernel(pte) free_pte_fast(pte)
-#define pte_free(pte) free_pte_fast(pte)
-#define pgd_free(pgd) free_pgd_fast(pgd)
+#define pte_free_kernel(pte) free_pte_slow(pte)
+#define pte_free(pte) free_pte_slow(pte)
+#define pgd_free(pgd) free_pgd_slow(pgd)
#define pgd_alloc() get_pgd_fast()
extern inline pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address)
@@ -572,8 +503,6 @@ extern inline void set_pgdir(unsigned long address, pgd_t entry)
#endif
}
-extern pgd_t swapper_pg_dir[1024];
-
/*
* The i386 doesn't have any external MMU info: the kernel page
* tables contain all the necessary information.
@@ -596,4 +525,6 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma,
#define PageSkip(page) (0)
#define kern_addr_valid(addr) (1)
+#define io_remap_page_range remap_page_range
+
#endif /* _I386_PAGE_H */
diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h
index dde35a87c..99b291d40 100644
--- a/include/asm-i386/processor.h
+++ b/include/asm-i386/processor.h
@@ -12,6 +12,7 @@
#include <asm/segment.h>
#include <asm/page.h>
#include <asm/types.h>
+#include <linux/threads.h>
/*
* Default implementation of macro that returns current
@@ -95,6 +96,7 @@ struct cpuinfo_x86 {
#define X86_FEATURE_AMD3D 0x80000000
extern struct cpuinfo_x86 boot_cpu_data;
+extern struct tss_struct init_tss[NR_CPUS];
#ifdef __SMP__
extern struct cpuinfo_x86 cpu_data[];
@@ -124,6 +126,48 @@ extern inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
: "cc");
}
+
+/*
+ * Intel CPU features in CR4
+ */
+#define X86_CR4_VME 0x0001 /* enable vm86 extensions */
+#define X86_CR4_PVI 0x0002 /* virtual interrupts flag enable */
+#define X86_CR4_TSD 0x0004 /* disable time stamp at ipl 3 */
+#define X86_CR4_DE 0x0008 /* enable debugging extensions */
+#define X86_CR4_PSE 0x0010 /* enable page size extensions */
+#define X86_CR4_PAE 0x0020 /* enable physical address extensions */
+#define X86_CR4_MCE 0x0040 /* Machine check enable */
+#define X86_CR4_PGE 0x0080 /* enable global pages */
+#define X86_CR4_PCE 0x0100 /* enable performance counters at ipl 3 */
+
+/*
+ * Save the cr4 feature set we're using (ie
+ * Pentium 4MB enable and PPro Global page
+ * enable), so that any CPU's that boot up
+ * after us can get the correct flags.
+ */
+extern unsigned long mmu_cr4_features;
+
+static inline void set_in_cr4 (unsigned long mask)
+{
+ mmu_cr4_features |= mask;
+ __asm__("movl %%cr4,%%eax\n\t"
+ "orl %0,%%eax\n\t"
+ "movl %%eax,%%cr4\n"
+ : : "irg" (mask)
+ :"ax");
+}
+
+static inline void clear_in_cr4 (unsigned long mask)
+{
+ mmu_cr4_features &= ~mask;
+ __asm__("movl %%cr4,%%eax\n\t"
+ "andl %0,%%eax\n\t"
+ "movl %%eax,%%cr4\n"
+ : : "irg" (~mask)
+ :"ax");
+}
+
/*
* Cyrix CPU configuration register indexes
*/
@@ -177,6 +221,8 @@ extern unsigned int mca_pentium_flag;
* Size of io_bitmap in longwords: 32 is ports 0-0x3ff.
*/
#define IO_BITMAP_SIZE 32
+#define IO_BITMAP_OFFSET offsetof(struct tss_struct,io_bitmap)
+#define INVALID_IO_BITMAP_OFFSET 0x8000
struct i387_hard_struct {
long cwd;
@@ -213,7 +259,7 @@ typedef struct {
unsigned long seg;
} mm_segment_t;
-struct thread_struct {
+struct tss_struct {
unsigned short back_link,__blh;
unsigned long esp0;
unsigned short ss0,__ss0h;
@@ -221,7 +267,7 @@ struct thread_struct {
unsigned short ss1,__ss1h;
unsigned long esp2;
unsigned short ss2,__ss2h;
- unsigned long cr3;
+ unsigned long __cr3;
unsigned long eip;
unsigned long eflags;
unsigned long eax,ecx,edx,ebx;
@@ -238,19 +284,43 @@ struct thread_struct {
unsigned short ldt, __ldth;
unsigned short trace, bitmap;
unsigned long io_bitmap[IO_BITMAP_SIZE+1];
- unsigned long tr;
+ /*
+ * pads the TSS to be cacheline-aligned (size is 0x100)
+ */
+ unsigned long __cacheline_filler[5];
+};
+
+struct thread_struct {
+ unsigned long esp0;
+ unsigned long eip;
+ unsigned long esp;
+ unsigned long fs;
+ unsigned long gs;
+/* Hardware debugging registers */
+ unsigned long debugreg[8]; /* %%db0-7 debug registers */
+/* fault info */
unsigned long cr2, trap_no, error_code;
- mm_segment_t segment;
-/* debug registers */
- long debugreg[8]; /* Hardware debugging registers */
/* floating point info */
- union i387_union i387;
+ union i387_union i387;
/* virtual 86 mode info */
- struct vm86_struct * vm86_info;
- unsigned long screen_bitmap;
- unsigned long v86flags, v86mask, v86mode, saved_esp0;
+ struct vm86_struct * vm86_info;
+ unsigned long screen_bitmap;
+ unsigned long v86flags, v86mask, v86mode, saved_esp0;
+/* IO permissions */
+ int ioperm;
+ unsigned long io_bitmap[IO_BITMAP_SIZE+1];
};
+#define INIT_THREAD { \
+ 0, \
+ 0, 0, 0, 0, \
+ { [0 ... 7] = 0 }, /* debugging registers */ \
+ 0, 0, 0, \
+ { { 0, }, }, /* 387 state */ \
+ 0,0,0,0,0,0, \
+ 0,{~0,} /* io permissions */ \
+}
+
#define INIT_MMAP \
{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
@@ -259,19 +329,15 @@ struct thread_struct {
sizeof(init_stack) + (long) &init_stack, /* esp0 */ \
__KERNEL_DS, 0, /* ss0 */ \
0,0,0,0,0,0, /* stack1, stack2 */ \
- (long) &swapper_pg_dir - PAGE_OFFSET, /* cr3 */ \
+ 0, /* cr3 */ \
0,0, /* eip,eflags */ \
0,0,0,0, /* eax,ecx,edx,ebx */ \
0,0,0,0, /* esp,ebp,esi,edi */ \
0,0,0,0,0,0, /* es,cs,ss */ \
0,0,0,0,0,0, /* ds,fs,gs */ \
- _LDT(0),0, /* ldt */ \
- 0, 0x8000, /* tace, bitmap */ \
- {~0, }, /* ioperm */ \
- _TSS(0), 0, 0, 0, (mm_segment_t) { 0 }, /* obsolete */ \
- { 0, }, \
- { { 0, }, }, /* 387 state */ \
- NULL, 0, 0, 0, 0, 0, /* vm86_info */ \
+ __LDT(0),0, /* ldt */ \
+ 0, INVALID_IO_BITMAP_OFFSET, /* tace, bitmap */ \
+ {~0, } /* ioperm */ \
}
#define start_thread(regs, new_eip, new_esp) do { \
@@ -291,10 +357,13 @@ struct mm_struct;
/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
+/*
+ * create a kernel thread without removing it from tasklists
+ */
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
/* Copy and release all segment info associated with a VM */
-extern void copy_segments(int nr, struct task_struct *p, struct mm_struct * mm);
+extern void copy_segments(struct task_struct *p, struct mm_struct * mm);
extern void release_segments(struct mm_struct * mm);
extern void forget_segments(void);
@@ -302,7 +371,7 @@ extern void forget_segments(void);
* FPU lazy state save handling..
*/
#define save_fpu(tsk) do { \
- asm volatile("fnsave %0\n\tfwait":"=m" (tsk->tss.i387)); \
+ asm volatile("fnsave %0\n\tfwait":"=m" (tsk->thread.i387)); \
tsk->flags &= ~PF_USEDFPU; \
stts(); \
} while (0)
@@ -327,20 +396,11 @@ extern inline unsigned long thread_saved_pc(struct thread_struct *t)
return ((unsigned long *)t->esp)[3];
}
+#define THREAD_SIZE (2*PAGE_SIZE)
extern struct task_struct * alloc_task_struct(void);
extern void free_task_struct(struct task_struct *);
#define init_task (init_task_union.task)
#define init_stack (init_task_union.stack)
-/*
- * Return_address is a replacement for __builtin_return_address(count)
- * which on certain architectures cannot reasonably be implemented in GCC
- * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
- * Note that __builtin_return_address(x>=1) is forbidden because the GCC
- * aborts compilation on some CPUs. It's simply not possible to unwind
- * some CPU's stackframes.
- */
-#define return_address() __builtin_return_address(0)
-
#endif /* __ASM_I386_PROCESSOR_H */
diff --git a/include/asm-i386/resource.h b/include/asm-i386/resource.h
index e7e2d1159..0f4089694 100644
--- a/include/asm-i386/resource.h
+++ b/include/asm-i386/resource.h
@@ -28,8 +28,8 @@
{ _STK_LIM, LONG_MAX }, \
{ 0, LONG_MAX }, \
{ LONG_MAX, LONG_MAX }, \
- { MAX_TASKS_PER_USER, MAX_TASKS_PER_USER }, \
- { NR_OPEN, NR_OPEN }, \
+ { 0, 0 }, \
+ { INR_OPEN, INR_OPEN }, \
{ LONG_MAX, LONG_MAX }, \
{ LONG_MAX, LONG_MAX }, \
}
diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h
index 3298aeb13..3997b2aae 100644
--- a/include/asm-i386/semaphore.h
+++ b/include/asm-i386/semaphore.h
@@ -17,6 +17,10 @@
* potential and subtle race discovered by Ulrich Schmid
* in down_interruptible(). Since I started to play here I
* also implemented the `trylock' semaphore operation.
+ * 1999-07-02 Artur Skawina <skawina@geocities.com>
+ * Optimized "0(ecx)" -> "(ecx)" (the assembler does not
+ * do this). Changed calling sequences from push/jmp to
+ * traditional call/ret.
*
* If you would like to see an analysis of this implementation, please
* ftp to gcom.com and download the file
@@ -26,12 +30,12 @@
#include <asm/system.h>
#include <asm/atomic.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#include <linux/wait.h>
struct semaphore {
atomic_t count;
- int waking;
+ int sleepers;
wait_queue_head_t wait;
#if WAITQUEUE_DEBUG
long __magic;
@@ -58,7 +62,7 @@ struct semaphore {
#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
-extern inline void __sema_init (struct semaphore *sem, int val)
+extern inline void sema_init (struct semaphore *sem, int val)
{
/*
* *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val);
@@ -67,19 +71,12 @@ extern inline void __sema_init (struct semaphore *sem, int val)
* GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well.
*/
atomic_set(&sem->count, val);
- sem->waking = 0;
+ sem->sleepers = 0;
init_waitqueue_head(&sem->wait);
#if WAITQUEUE_DEBUG
sem->__magic = (int)&sem->__magic;
#endif
}
-#define sema_init(sem,val) \
- do { \
- struct semaphore *__sem = (sem); \
- printk("sema_init called at %s, %d for semaphore 0x%08lx\n", \
- __FILE__, __LINE__, (unsigned long) __sem); \
- __sema_init(__sem, (val)); \
- while(1);
static inline void init_MUTEX (struct semaphore *sem)
{
@@ -119,12 +116,12 @@ extern inline void down(struct semaphore * sem)
#ifdef __SMP__
"lock ; "
#endif
- "decl 0(%0)\n\t"
+ "decl (%0)\n\t" /* --sem->count */
"js 2f\n"
"1:\n"
".section .text.lock,\"ax\"\n"
- "2:\tpushl $1b\n\t"
- "jmp __down_failed\n"
+ "2:\tcall __down_failed\n\t"
+ "jmp 1b\n"
".previous"
:/* no outputs */
:"c" (sem)
@@ -144,13 +141,13 @@ extern inline int down_interruptible(struct semaphore * sem)
#ifdef __SMP__
"lock ; "
#endif
- "decl 0(%1)\n\t"
+ "decl (%1)\n\t" /* --sem->count */
"js 2f\n\t"
"xorl %0,%0\n"
"1:\n"
".section .text.lock,\"ax\"\n"
- "2:\tpushl $1b\n\t"
- "jmp __down_failed_interruptible\n"
+ "2:\tcall __down_failed_interruptible\n\t"
+ "jmp 1b\n"
".previous"
:"=a" (result)
:"c" (sem)
@@ -171,13 +168,13 @@ extern inline int down_trylock(struct semaphore * sem)
#ifdef __SMP__
"lock ; "
#endif
- "decl 0(%1)\n\t"
+ "decl (%1)\n\t" /* --sem->count */
"js 2f\n\t"
"xorl %0,%0\n"
"1:\n"
".section .text.lock,\"ax\"\n"
- "2:\tpushl $1b\n\t"
- "jmp __down_failed_trylock\n"
+ "2:\tcall __down_failed_trylock\n\t"
+ "jmp 1b\n"
".previous"
:"=a" (result)
:"c" (sem)
@@ -201,12 +198,12 @@ extern inline void up(struct semaphore * sem)
#ifdef __SMP__
"lock ; "
#endif
- "incl 0(%0)\n\t"
+ "incl (%0)\n\t" /* ++sem->count */
"jle 2f\n"
"1:\n"
".section .text.lock,\"ax\"\n"
- "2:\tpushl $1b\n\t"
- "jmp __up_wakeup\n"
+ "2:\tcall __up_wakeup\n\t"
+ "jmp 1b\n"
".previous"
:/* no outputs */
:"c" (sem)
diff --git a/include/asm-i386/serial.h b/include/asm-i386/serial.h
index f61901120..33cd30fc9 100644
--- a/include/asm-i386/serial.h
+++ b/include/asm-i386/serial.h
@@ -27,6 +27,9 @@
#define ACCENT_FLAGS 0
#define BOCA_FLAGS 0
#define HUB6_FLAGS 0
+#define RS_TABLE_SIZE 64
+#else
+#define RS_TABLE_SIZE
#endif
/*
diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h
index 030a19b7b..b6823738b 100644
--- a/include/asm-i386/signal.h
+++ b/include/asm-i386/signal.h
@@ -180,12 +180,12 @@ typedef struct sigaltstack {
extern __inline__ void sigaddset(sigset_t *set, int _sig)
{
- __asm__("btsl %1,%0" : "=m"(*set) : "ir"(_sig - 1) : "cc");
+ __asm__("btsl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
}
extern __inline__ void sigdelset(sigset_t *set, int _sig)
{
- __asm__("btrl %1,%0" : "=m"(*set) : "ir"(_sig - 1) : "cc");
+ __asm__("btrl %1,%0" : "=m"(*set) : "Ir"(_sig - 1) : "cc");
}
extern __inline__ int __const_sigismember(sigset_t *set, int _sig)
@@ -198,7 +198,7 @@ extern __inline__ int __gen_sigismember(sigset_t *set, int _sig)
{
int ret;
__asm__("btl %2,%1\n\tsbbl %0,%0"
- : "=r"(ret) : "m"(*set), "ir"(_sig-1) : "cc");
+ : "=r"(ret) : "m"(*set), "Ir"(_sig-1) : "cc");
return ret;
}
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index ec24476ae..91199de7f 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -8,7 +8,7 @@
#ifdef CONFIG_X86_LOCAL_APIC
#ifndef ASSEMBLY
#include <asm/fixmap.h>
-#include <asm/i82489.h>
+#include <asm/apic.h>
#include <asm/bitops.h>
#endif
#endif
@@ -16,7 +16,7 @@
#ifdef __SMP__
#ifndef ASSEMBLY
-#include <linux/tasks.h>
+#include <linux/threads.h>
#include <linux/ptrace.h>
/*
@@ -186,6 +186,16 @@ extern inline int cpu_logical_map(int cpu)
return __cpu_logical_map[cpu];
}
+extern __inline void apic_write(unsigned long reg, unsigned long v)
+{
+ *((volatile unsigned long *)(APIC_BASE+reg))=v;
+}
+
+extern __inline unsigned long apic_read(unsigned long reg)
+{
+ return *((volatile unsigned long *)(APIC_BASE+reg));
+}
+
/*
* General functions that each host system must provide.
diff --git a/include/asm-i386/smplock.h b/include/asm-i386/smplock.h
index 4d44a2919..152c1a9fa 100644
--- a/include/asm-i386/smplock.h
+++ b/include/asm-i386/smplock.h
@@ -4,7 +4,7 @@
* i386 SMP lock implementation
*/
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-i386/softirq.h b/include/asm-i386/softirq.h
index b8f33d7af..6eb68524a 100644
--- a/include/asm-i386/softirq.h
+++ b/include/asm-i386/softirq.h
@@ -18,24 +18,7 @@ extern unsigned int local_bh_count[NR_CPUS];
#define get_active_bhs() (bh_mask & bh_active)
#define clear_active_bhs(x) atomic_clear_mask((x),&bh_active)
-extern inline void init_bh(int nr, void (*routine)(void))
-{
- bh_base[nr] = routine;
- atomic_set(&bh_mask_count[nr], 0);
- bh_mask |= 1 << nr;
-}
-
-extern inline void remove_bh(int nr)
-{
- bh_mask &= ~(1 << nr);
- mb();
- bh_base[nr] = NULL;
-}
-
-extern inline void mark_bh(int nr)
-{
- set_bit(nr, &bh_active);
-}
+extern spinlock_t i386_bh_lock;
#ifdef __SMP__
@@ -101,21 +84,58 @@ extern inline void end_bh_atomic(void)
#endif /* SMP */
+extern inline void init_bh(int nr, void (*routine)(void))
+{
+ unsigned long flags;
+
+ bh_base[nr] = routine;
+ atomic_set(&bh_mask_count[nr], 0);
+
+ spin_lock_irqsave(&i386_bh_lock, flags);
+ bh_mask |= 1 << nr;
+ spin_unlock_irqrestore(&i386_bh_lock, flags);
+}
+
+extern inline void remove_bh(int nr)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&i386_bh_lock, flags);
+ bh_mask &= ~(1 << nr);
+ spin_unlock_irqrestore(&i386_bh_lock, flags);
+
+ synchronize_bh();
+ bh_base[nr] = NULL;
+}
+
+extern inline void mark_bh(int nr)
+{
+ set_bit(nr, &bh_active);
+}
+
/*
* These use a mask count to correctly handle
* nested disable/enable calls
*/
extern inline void disable_bh(int nr)
{
+ unsigned long flags;
+
+ spin_lock_irqsave(&i386_bh_lock, flags);
bh_mask &= ~(1 << nr);
atomic_inc(&bh_mask_count[nr]);
+ spin_unlock_irqrestore(&i386_bh_lock, flags);
synchronize_bh();
}
extern inline void enable_bh(int nr)
{
+ unsigned long flags;
+
+ spin_lock_irqsave(&i386_bh_lock, flags);
if (atomic_dec_and_test(&bh_mask_count[nr]))
bh_mask |= 1 << nr;
+ spin_unlock_irqrestore(&i386_bh_lock, flags);
}
#endif /* __ASM_SOFTIRQ_H */
diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h
index d3e9fc744..a10ed9c5c 100644
--- a/include/asm-i386/spinlock.h
+++ b/include/asm-i386/spinlock.h
@@ -2,122 +2,7 @@
#define __ASM_SPINLOCK_H
/*
- * These are the generic versions of the spinlocks
- * and read-write locks.. We should actually do a
- * <linux/spinlock.h> with all of this. Oh, well.
- */
-#define spin_lock_irqsave(lock, flags) do { local_irq_save(flags); spin_lock(lock); } while (0)
-#define spin_lock_irq(lock) do { local_irq_disable(); spin_lock(lock); } while (0)
-#define spin_lock_bh(lock) do { local_bh_disable(); spin_lock(lock); } while (0)
-
-#define read_lock_irqsave(lock, flags) do { local_irq_save(flags); read_lock(lock); } while (0)
-#define read_lock_irq(lock) do { local_irq_disable(); read_lock(lock); } while (0)
-#define read_lock_bh(lock) do { local_bh_disable(); read_lock(lock); } while (0)
-
-#define write_lock_irqsave(lock, flags) do { local_irq_save(flags); write_lock(lock); } while (0)
-#define write_lock_irq(lock) do { local_irq_disable(); write_lock(lock); } while (0)
-#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while (0)
-
-#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); local_irq_restore(flags); } while (0)
-#define spin_unlock_irq(lock) do { spin_unlock(lock); local_irq_enable(); } while (0)
-#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0)
-
-#define read_unlock_irqrestore(lock, flags) do { read_unlock(lock); local_irq_restore(flags); } while (0)
-#define read_unlock_irq(lock) do { read_unlock(lock); local_irq_enable(); } while (0)
-#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0)
-
-#define write_unlock_irqrestore(lock, flags) do { write_unlock(lock); local_irq_restore(flags); } while (0)
-#define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0)
-#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0)
-
-#ifndef __SMP__
-
-#define DEBUG_SPINLOCKS 0 /* 0 == no debugging, 1 == maintain lock state, 2 == full debug */
-
-#if (DEBUG_SPINLOCKS < 1)
-
-/*
- * Your basic spinlocks, allowing only a single CPU anywhere
- *
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
- typedef struct { } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
-#else
- typedef struct { int gcc_is_buggy; } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-#endif
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) (void)(lock) /* Not "unused variable". */
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) do { } while(0)
-
-#elif (DEBUG_SPINLOCKS < 2)
-
-typedef struct {
- volatile unsigned int lock;
-} spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-
-#define spin_lock_init(x) do { (x)->lock = 0; } while (0)
-#define spin_trylock(lock) (!test_and_set_bit(0,(lock)))
-
-#define spin_lock(x) do { (x)->lock = 1; } while (0)
-#define spin_unlock_wait(x) do { } while (0)
-#define spin_unlock(x) do { (x)->lock = 0; } while (0)
-
-#else /* (DEBUG_SPINLOCKS >= 2) */
-
-typedef struct {
- volatile unsigned int lock;
- volatile unsigned int babble;
- const char *module;
-} spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 25, __BASE_FILE__ }
-
-#include <linux/kernel.h>
-
-#define spin_lock_init(x) do { (x)->lock = 0; } while (0)
-#define spin_trylock(lock) (!test_and_set_bit(0,(lock)))
-
-#define spin_lock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_lock(%s:%p) already locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 1; restore_flags(__spinflags);} while (0)
-#define spin_unlock_wait(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock_wait(%s:%p) deadlock\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} restore_flags(__spinflags);} while (0)
-#define spin_unlock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if (!(x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock(%s:%p) not locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 0; restore_flags(__spinflags);} while (0)
-
-#endif /* DEBUG_SPINLOCKS */
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- *
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
- typedef struct { } rwlock_t;
- #define RW_LOCK_UNLOCKED (rwlock_t) { }
-#else
- typedef struct { int gcc_is_buggy; } rwlock_t;
- #define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
-#endif
-
-#define read_lock(lock) (void)(lock) /* Not "unused variable". */
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) (void)(lock) /* Not "unused variable". */
-#define write_unlock(lock) do { } while(0)
-
-#else /* __SMP__ */
-
-/*
- * Your basic spinlocks, allowing only a single CPU anywhere
+ * Your basic SMP spinlocks, allowing only a single CPU anywhere
*/
typedef struct {
@@ -177,10 +62,9 @@ __asm__ __volatile__( \
*/
typedef struct {
volatile unsigned int lock;
- unsigned long previous;
} rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
+#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
/*
* On x86, we implement read-write locks as a 32-bit counter
@@ -221,5 +105,4 @@ typedef struct {
#define write_unlock(rw) \
asm volatile("lock ; btrl $31,%0":"=m" (__dummy_lock(&(rw)->lock)))
-#endif /* __SMP__ */
#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h
index 147ad6da4..f2ccae723 100644
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -9,6 +9,7 @@
struct task_struct; /* one of the stranger aspects of C forward declarations.. */
extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
+#define prepare_to_switch() do { } while(0)
#define switch_to(prev,next,last) do { \
asm volatile("pushl %%esi\n\t" \
"pushl %%edi\n\t" \
@@ -22,9 +23,9 @@ extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *n
"popl %%ebp\n\t" \
"popl %%edi\n\t" \
"popl %%esi\n\t" \
- :"=m" (prev->tss.esp),"=m" (prev->tss.eip), \
+ :"=m" (prev->thread.esp),"=m" (prev->thread.eip), \
"=b" (last) \
- :"m" (next->tss.esp),"m" (next->tss.eip), \
+ :"m" (next->thread.esp),"m" (next->thread.eip), \
"a" (prev), "d" (next), \
"b" (prev)); \
} while (0)
@@ -129,24 +130,26 @@ struct __xchg_dummy { unsigned long a[100]; };
/*
* Note: no "lock" prefix even on SMP: xchg always implies lock anyway
+ * Note 2: xchg has side effect, so that attribute volatile is necessary,
+ * but generally the primitive is invalid, *ptr is output argument. --ANK
*/
-static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
+static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
{
switch (size) {
case 1:
- __asm__("xchgb %b0,%1"
+ __asm__ __volatile__("xchgb %b0,%1"
:"=q" (x)
:"m" (*__xg(ptr)), "0" (x)
:"memory");
break;
case 2:
- __asm__("xchgw %w0,%1"
+ __asm__ __volatile__("xchgw %w0,%1"
:"=r" (x)
:"m" (*__xg(ptr)), "0" (x)
:"memory");
break;
case 4:
- __asm__("xchgl %0,%1"
+ __asm__ __volatile__("xchgl %0,%1"
:"=r" (x)
:"m" (*__xg(ptr)), "0" (x)
:"memory");
@@ -172,14 +175,15 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
#define mb() __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
#define rmb() mb()
#define wmb() __asm__ __volatile__ ("": : :"memory")
+#define set_rmb(var, value) do { xchg(&var, value); } while (0)
+#define set_mb(var, value) set_rmb(var, value)
+#define set_wmb(var, value) do { var = value; wmb(); } while (0)
/* interrupt control.. */
-#define __sti() __asm__ __volatile__ ("sti": : :"memory")
-#define __cli() __asm__ __volatile__ ("cli": : :"memory")
-#define __save_flags(x) \
-__asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory")
-#define __restore_flags(x) \
-__asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
+#define __save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */ :"memory")
+#define __restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory")
+#define __cli() __asm__ __volatile__("cli": : :"memory")
+#define __sti() __asm__ __volatile__("sti": : :"memory")
/* For spinlocks etc */
#define local_irq_save(x) __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (x): /* no input */ :"memory")
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index a44ca6c78..2b1b3d7f4 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -42,7 +42,7 @@ extern int __verify_write(const void *, unsigned long);
unsigned long flag,sum; \
asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \
:"=&r" (flag), "=r" (sum) \
- :"1" (addr),"g" (size),"g" (current->addr_limit.seg)); \
+ :"1" (addr),"g" ((int)(size)),"g" (current->addr_limit.seg)); \
flag; })
#ifdef CONFIG_X86_WP_WORKS_OK
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index c961fdd2e..9cfc401fa 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -196,7 +196,7 @@
#define __NR_putpmsg 189 /* some people actually want streams */
#define __NR_vfork 190
-/* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */
+/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
#define __syscall_return(type, res) \
do { \
@@ -287,7 +287,6 @@ __syscall_return(type,__res); \
* some others too.
*/
#define __NR__exit __NR_exit
-static inline _syscall0(int,idle)
static inline _syscall0(int,pause)
static inline _syscall0(int,sync)
static inline _syscall0(pid_t,setsid)
diff --git a/include/asm-m68k/cache.h b/include/asm-m68k/cache.h
index b3a873938..9e009ce18 100644
--- a/include/asm-m68k/cache.h
+++ b/include/asm-m68k/cache.h
@@ -11,4 +11,12 @@
#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
#endif
diff --git a/include/asm-m68k/dvma.h b/include/asm-m68k/dvma.h
index f6976b43c..4f7875def 100644
--- a/include/asm-m68k/dvma.h
+++ b/include/asm-m68k/dvma.h
@@ -9,6 +9,23 @@
#ifndef __M68K_DVMA_H
#define __M68K_DVMA_H
+#ifdef CONFIG_SUN3
+/* sun3 dvma page support */
+
+/* memory and pmegs reserved for dvma */
+#define DVMA_PMEG_START 10
+#define DVMA_PMEG_END 16
+#define DVMA_START 0xff00000
+#define DVMA_END 0xffe0000
+#define DVMA_SIZE (DVMA_END-DVMA_START)
+
+/* virt <-> phys conversions */
+#define sun3_dvma_vtop(x) ((unsigned long)(x) & 0xffffff)
+#define sun3_dvma_ptov(x) ((unsigned long)(x) | 0xf000000)
+
+void *sun3_dvma_malloc(int len);
+#else /* Sun3x */
+
/* Structure to describe the current status of DMA registers on the Sparc */
struct sparc_dma_registers {
__volatile__ unsigned long cond_reg; /* DMA condition register */
@@ -161,5 +178,5 @@ extern struct Linux_SBus_DMA *dma_chain;
extern unsigned long dvma_alloc (unsigned long, unsigned long);
extern void dvma_free (unsigned long, unsigned long);
-
+#endif /* !CONFIG_SUN3 */
#endif /* !(__M68K_DVMA_H) */
diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h
index 70a0c8087..8799724e6 100644
--- a/include/asm-m68k/elf.h
+++ b/include/asm-m68k/elf.h
@@ -33,14 +33,22 @@ typedef struct user_m68kfp_struct elf_fpregset_t;
#define ELF_PLAT_INIT(_r) _r->a1 = 0
#define USE_ELF_CORE_DUMP
+#ifndef CONFIG_SUN3
#define ELF_EXEC_PAGESIZE 4096
+#else
+#define ELF_EXEC_PAGESIZE 8192
+#endif
/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
use of this is to invoke "./ld.so someprog" to test out a new version of
the loader. We need to make sure that it is out of the way of the program
that it will "exec", and that there is sufficient room for the brk. */
+#ifndef CONFIG_SUN3
#define ELF_ET_DYN_BASE 0xD0000000UL
+#else
+#define ELF_ET_DYN_BASE 0x0D800000UL
+#endif
#define ELF_CORE_COPY_REGS(pr_reg, regs) \
/* Bleech. */ \
diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h
index 647764bd1..56ab0dcf8 100644
--- a/include/asm-m68k/entry.h
+++ b/include/asm-m68k/entry.h
@@ -3,6 +3,7 @@
#include <linux/config.h>
#include <asm/setup.h>
+#include <asm/page.h>
#ifdef CONFIG_KGDB
#include <asm/kgdb.h>
#endif
@@ -132,7 +133,7 @@ PF_DTRACE_BIT = 5
.macro get_current reg=%d0
movel %sp,\reg
- andw #-8192,\reg
+ andw #-KTHREAD_SIZE,\reg
movel \reg,%curptr
.endm
@@ -161,7 +162,7 @@ PF_DTRACE_BIT = 5
#endif
#define GET_CURRENT(tmp) \
"movel %%sp,"#tmp"\n\t" \
- "andw #-8192,"#tmp"\n\t" \
+ "andw #-KTHREAD_SIZE,"#tmp"\n\t" \
"movel "#tmp",%%a2"
#endif
diff --git a/include/asm-m68k/fpu.h b/include/asm-m68k/fpu.h
index 717ecfa7f..3bcf85065 100644
--- a/include/asm-m68k/fpu.h
+++ b/include/asm-m68k/fpu.h
@@ -11,6 +11,8 @@
#define FPSTATESIZE (216/sizeof(unsigned char))
#elif defined(CONFIG_M68040)
#define FPSTATESIZE (96/sizeof(unsigned char))
+#elif defined(CONFIG_M68KFPU_EMU)
+#define FPSTATESIZE (28/sizeof(unsigned char))
#elif defined(CONFIG_M68060)
#define FPSTATESIZE (12/sizeof(unsigned char))
#else
diff --git a/include/asm-m68k/hardirq.h b/include/asm-m68k/hardirq.h
index acae65fc6..6e8e0d4ac 100644
--- a/include/asm-m68k/hardirq.h
+++ b/include/asm-m68k/hardirq.h
@@ -1,7 +1,7 @@
#ifndef __M68K_HARDIRQ_H
#define __M68K_HARDIRQ_H
-#include <linux/tasks.h>
+#include <linux/threads.h>
extern unsigned int local_irq_count[NR_CPUS];
diff --git a/include/asm-m68k/hwtest.h b/include/asm-m68k/hwtest.h
index 17d3f0ad7..ec7f96a08 100644
--- a/include/asm-m68k/hwtest.h
+++ b/include/asm-m68k/hwtest.h
@@ -2,7 +2,7 @@
* see arch/m68k/mm/hwtest.c.
* -- PMM <pmaydell@chiark.greenend.org.uk> 05/1998
*
- * Removed initfunc from decls. We might want them in modules, and
+ * Removed __init from decls. We might want them in modules, and
* the code is tiny anyway. 16/5/98 pb
*/
diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h
index e4a83371d..5ef14f29e 100644
--- a/include/asm-m68k/ide.h
+++ b/include/asm-m68k/ide.h
@@ -38,6 +38,7 @@
#include <asm/irq.h>
#ifdef CONFIG_ATARI
+#include <linux/interrupt.h>
#include <asm/atari_stdma.h>
#endif
@@ -63,7 +64,7 @@ int q40ide_default_io_base(int);
static __inline__ ide_ioreg_t ide_default_io_base(int index)
{
if (MACH_IS_Q40)
- return q40ide_default_io_base(index);
+ return (ide_ioreg_t)q40ide_default_io_base(index);
else return 0;
}
@@ -82,7 +83,8 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
if (MACH_IS_Q40)
return q40_ide_init_hwif_ports(hw, (q40ide_ioreg_t) data_port, (q40ide_ioreg_t) ctrl_port, irq);
#endif
- printk("ide_init_hwif_ports: must not be called\n");
+ if (data_port || ctrl_port)
+ printk("ide_init_hwif_ports: must not be called\n");
}
/*
@@ -104,10 +106,6 @@ typedef union {
} b;
} select_t;
-#ifdef CONFIG_MAC /* MSch: Hack; wrapper for ide_intr */
-void mac_ide_intr(int irq, void *dev_id, struct pt_regs *regs);
-#endif
-
static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
unsigned long flags, const char *device, void *dev_id)
{
@@ -121,11 +119,7 @@ static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int, voi
#endif /* CONFIG_Q40*/
#ifdef CONFIG_MAC
if (MACH_IS_MAC)
-#if 0 /* MSch Hack: maybe later we'll call ide_intr without a wrapper */
- return nubus_request_irq(12, dev_id, handler);
-#else
- return nubus_request_irq(12, dev_id, mac_ide_intr);
-#endif
+ return request_irq(irq, handler, 0, device, dev_id);
#endif /* CONFIG_MAC */
return 0;
}
@@ -142,7 +136,7 @@ static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
#endif /* CONFIG_Q40*/
#ifdef CONFIG_MAC
if (MACH_IS_MAC)
- nubus_free_irq(12);
+ free_irq(irq, dev_id);
#endif /* CONFIG_MAC */
}
diff --git a/include/asm-m68k/init.h b/include/asm-m68k/init.h
index 022300376..dc73aed8a 100644
--- a/include/asm-m68k/init.h
+++ b/include/asm-m68k/init.h
@@ -7,17 +7,11 @@
#define __init __attribute__ ((__section__ (".text.init")))
#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
/* For assembly routines */
#define __INIT .section ".text.init",#alloc,#execinstr
#define __FINIT .previous
#define __INITDATA .section ".data.init",#alloc,#write
-#define __cacheline_aligned __attribute__ \
- ((__aligned__(16), __section__ (".data.cacheline_aligned")))
-
#else
/* gdb doesn't like it all if the code for one source file isn't together in
@@ -25,12 +19,10 @@
#define __init
#define __initdata
-#define __initfunc(__arginit) __arginit
/* For assembly routines */
#define __INIT
#define __FINIT
#define __INITDATA
-#define __cacheline_aligned __attribute__ ((__aligned__(16)))
#endif /* CONFIG_KGDB */
diff --git a/include/asm-m68k/intersil.h b/include/asm-m68k/intersil.h
new file mode 100644
index 000000000..e039ea320
--- /dev/null
+++ b/include/asm-m68k/intersil.h
@@ -0,0 +1,48 @@
+#ifndef _SUN3_INTERSIL_H
+#define _SUN3_INTERSIL_H
+/* bits 0 and 1 */
+#define INTERSIL_FREQ_32K 0x00
+#define INTERSIL_FREQ_1M 0x01
+#define INTERSIL_FREQ_2M 0x02
+#define INTERSIL_FREQ_4M 0x03
+
+/* bit 2 */
+#define INTERSIL_12H_MODE 0x00
+#define INTERSIL_24H_MODE 0x04
+
+/* bit 3 */
+#define INTESIL_STOP 0x00
+#define INTERSIL_RUN 0x08
+
+/* bit 4 */
+#define INTERSIL_INT_ENABLE 0x10
+#define INTERSIL_INT_DISABLE 0x00
+
+/* bit 5 */
+#define INTERSIL_MODE_NORMAL 0x00
+#define INTERSIL_MODE_TEST 0x20
+
+#define INTERSIL_HZ_100_MASK 0x02
+
+struct intersil_dt {
+ u_char csec;
+ u_char hour;
+ u_char minute;
+ u_char second;
+ u_char month;
+ u_char day;
+ u_char year;
+ u_char weekday;
+};
+
+struct intersil_7170 {
+ struct intersil_dt counter;
+ struct intersil_dt alarm;
+ u_char int_reg;
+ u_char cmd_reg;
+};
+
+extern volatile char* clock_va;
+#define intersil_clock ((volatile struct intersil_7170 *) clock_va)
+#define intersil_clear() (void)intersil_clock->int_reg
+#endif
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 7843b8f09..9257711dc 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -14,6 +14,10 @@
#include <asm/virtconvert.h>
/*
+ * These are for ISA/PCI shared memory _only_ and should never be used
+ * on any other type of memory, including Zorro memory. They are meant to
+ * access the bus in the bus byte order which is little-endian!.
+ *
* readX/writeX() are used to access memory mapped devices. On some
* architectures the memory mapped IO stuff needs to be accessed
* differently. On the m68k architecture, we just read/write the
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
index 169fa381c..0a62d30ef 100644
--- a/include/asm-m68k/irq.h
+++ b/include/asm-m68k/irq.h
@@ -70,19 +70,26 @@ static __inline__ int irq_cannonicalize(int irq)
extern void (*enable_irq)(unsigned int);
extern void (*disable_irq)(unsigned int);
+#define disable_irq_nosync disable_irq
+#define enable_irq_nosync enable_irq
+
extern int sys_request_irq(unsigned int,
void (*)(int, void *, struct pt_regs *),
unsigned long, const char *, void *);
extern void sys_free_irq(unsigned int, void *);
/*
- * various flags for request_irq()
+ * various flags for request_irq() - the Amiga now uses the standard
+ * mechanism like all other architectures - SA_INTERRUPT and SA_SHIRQ
+ * are your friends.
*/
+#ifndef CONFIG_AMIGA
#define IRQ_FLG_LOCK (0x0001) /* handler is not replaceable */
#define IRQ_FLG_REPLACE (0x0002) /* replace existing handler */
#define IRQ_FLG_FAST (0x0004)
#define IRQ_FLG_SLOW (0x0008)
#define IRQ_FLG_STD (0x8000) /* internally used */
+#endif
/*
* This structure is used to chain together the ISRs for a particular
diff --git a/include/asm-m68k/mac_iop.h b/include/asm-m68k/mac_iop.h
new file mode 100644
index 000000000..e04a9b58e
--- /dev/null
+++ b/include/asm-m68k/mac_iop.h
@@ -0,0 +1,162 @@
+/*
+ * I/O Processor (IOP) defines and structures, mostly snagged from A/UX
+ * header files.
+ *
+ * The original header from which this was taken is copyrighted. I've done some
+ * rewriting (in fact my changes make this a bit more readable, IMHO) but some
+ * more should be done.
+ */
+
+/*
+ * This is the base address of the IOPs. Use this as the address of
+ * a "struct iop" (see below) to see where the actual registers fall.
+ */
+
+#define SCC_IOP_BASE_IIFX (0x50F04000)
+#define ISM_IOP_BASE_IIFX (0x50F12000)
+
+#define SCC_IOP_BASE_QUADRA (0x50F0C000)
+#define ISM_IOP_BASE_QUADRA (0x50F1E000)
+
+/* IOP status/control register bits: */
+
+#define IOP_BYPASS 0x01 /* bypass-mode hardware access */
+#define IOP_AUTOINC 0x02 /* allow autoincrement of ramhi/lo */
+#define IOP_RUN 0x04 /* set to 0 to reset IOP chip */
+#define IOP_IRQ 0x08 /* generate IRQ to IOP if 1 */
+#define IOP_INT0 0x10 /* intr priority from IOP to host */
+#define IOP_INT1 0x20 /* intr priority from IOP to host */
+#define IOP_HWINT 0x40 /* IRQ from hardware; bypass mode only */
+#define IOP_DMAINACTIVE 0x80 /* no DMA request active; bypass mode only */
+
+#define NUM_IOPS 2
+#define NUM_IOP_CHAN 7
+#define NUM_IOP_MSGS NUM_IOP_CHAN*8
+#define IOP_MSG_LEN 32
+
+/* IOP reference numbers, used by the globally-visible iop_xxx functions */
+
+#define IOP_NUM_SCC 0
+#define IOP_NUM_ISM 1
+
+/* IOP channel states */
+
+#define IOP_MSG_IDLE 0 /* idle */
+#define IOP_MSG_NEW 1 /* new message sent */
+#define IOP_MSG_RCVD 2 /* message received; processing */
+#define IOP_MSG_COMPLETE 3 /* message processing complete */
+
+/* IOP message status codes */
+
+#define IOP_MSGSTATUS_UNUSED 0 /* Unusued message structure */
+#define IOP_MSGSTATUS_WAITING 1 /* waiting for channel */
+#define IOP_MSGSTATUS_SENT 2 /* message sent, awaiting reply */
+#define IOP_MSGSTATUS_COMPLETE 3 /* message complete and reply rcvd */
+#define IOP_MSGSTATUS_UNSOL 6 /* message is unsolicited */
+
+/* IOP memory addresses of the members of the the mac_iop_kernel structure. */
+
+#define IOP_ADDR_MAX_SEND_CHAN 0x0200
+#define IOP_ADDR_SEND_STATE 0x0201
+#define IOP_ADDR_PATCH_CTRL 0x021F
+#define IOP_ADDR_SEND_MSG 0x0220
+#define IOP_ADDR_MAX_RECV_CHAN 0x0300
+#define IOP_ADDR_RECV_STATE 0x0301
+#define IOP_ADDR_ALIVE 0x031F
+#define IOP_ADDR_RECV_MSG 0x0320
+
+#ifndef __ASSEMBLY__
+
+/*
+ * IOP Control registers, staggered because in usual Apple style they were
+ * too lazy to decode the A0 bit. This structure is assumed to begin at
+ * one of the xxx_IOP_BASE addresses given above.
+ */
+
+struct mac_iop {
+ __u8 ram_addr_hi; /* shared RAM address hi byte */
+ __u8 pad0;
+ __u8 ram_addr_lo; /* shared RAM address lo byte */
+ __u8 pad1;
+ __u8 status_ctrl; /* status/control register */
+ __u8 pad2[3];
+ __u8 ram_data; /* RAM data byte at ramhi/lo */
+
+ __u8 pad3[23];
+
+ /* Bypass-mode hardware access registers */
+
+ union {
+ struct { /* SCC registers */
+ __u8 sccb_cmd; /* SCC B command reg */
+ __u8 pad4;
+ __u8 scca_cmd; /* SCC A command reg */
+ __u8 pad5;
+ __u8 sccb_data; /* SCC B data */
+ __u8 pad6;
+ __u8 scca_data; /* SCC A data */
+ } scc_regs;
+
+ struct { /* ISM registers */
+ __u8 wdata; /* write a data byte */
+ __u8 pad7;
+ __u8 wmark; /* write a mark byte */
+ __u8 pad8;
+ __u8 wcrc; /* write 2-byte crc to disk */
+ __u8 pad9;
+ __u8 wparams; /* write the param regs */
+ __u8 pad10;
+ __u8 wphase; /* write the phase states & dirs */
+ __u8 pad11;
+ __u8 wsetup; /* write the setup register */
+ __u8 pad12;
+ __u8 wzeroes; /* mode reg: 1's clr bits, 0's are x */
+ __u8 pad13;
+ __u8 wones; /* mode reg: 1's set bits, 0's are x */
+ __u8 pad14;
+ __u8 rdata; /* read a data byte */
+ __u8 pad15;
+ __u8 rmark; /* read a mark byte */
+ __u8 pad16;
+ __u8 rerror; /* read the error register */
+ __u8 pad17;
+ __u8 rparams; /* read the param regs */
+ __u8 pad18;
+ __u8 rphase; /* read the phase states & dirs */
+ __u8 pad19;
+ __u8 rsetup; /* read the setup register */
+ __u8 pad20;
+ __u8 rmode; /* read the mode register */
+ __u8 pad21;
+ __u8 rhandshake; /* read the handshake register */
+ } ism_regs;
+ } b;
+};
+
+/* This structure is used to track IOP messages in the Linux kernel */
+
+struct iop_msg {
+ struct iop_msg *next; /* next message in queue or NULL */
+ uint iop_num; /* IOP number */
+ uint channel; /* channel number */
+ void *caller_priv; /* caller private data */
+ int status; /* status of this message */
+ __u8 message[IOP_MSG_LEN]; /* the message being sent/received */
+ __u8 reply[IOP_MSG_LEN]; /* the reply to the message */
+ void (*handler)(struct iop_msg *, struct pt_regs *);
+ /* function to call when reply recvd */
+};
+
+extern int iop_scc_present,iop_ism_present;
+
+extern int iop_listen(uint, uint,
+ void (*handler)(struct iop_msg *, struct pt_regs *),
+ const char *);
+extern int iop_send_message(uint, uint, void *, uint, __u8 *,
+ void (*)(struct iop_msg *, struct pt_regs *));
+extern void iop_complete_message(struct iop_msg *);
+extern void iop_upload_code(uint, __u8 *, uint, __u16);
+extern void iop_download_code(uint, __u8 *, uint, __u16);
+extern __u8 *iop_compare_code(uint, __u8 *, uint, __u16);
+
+#endif /* __ASSEMBLY__ */
diff --git a/include/asm-m68k/mac_oss.h b/include/asm-m68k/mac_oss.h
new file mode 100644
index 000000000..c48d8b840
--- /dev/null
+++ b/include/asm-m68k/mac_oss.h
@@ -0,0 +1,94 @@
+/*
+ * OSS
+ *
+ * This is used in place of VIA2 on the IIfx.
+ */
+
+#define OSS_BASE (0x50f1a000)
+
+/*
+ * Interrupt level offsets for mac_oss->irq_level
+ */
+
+#define OSS_NUBUS0 0
+#define OSS_NUBUS1 1
+#define OSS_NUBUS2 2
+#define OSS_NUBUS3 3
+#define OSS_NUBUS4 4
+#define OSS_NUBUS5 5
+#define OSS_IOPISM 6
+#define OSS_IOPSCC 7
+#define OSS_SOUND 8
+#define OSS_SCSI 9
+#define OSS_60HZ 10
+#define OSS_VIA1 11
+#define OSS_UNUSED1 12
+#define OSS_UNUSED2 13
+#define OSS_PARITY 14
+#define OSS_UNUSED3 15
+
+#define OSS_NUM_SOURCES 16
+
+/*
+ * Pending interrupt bits in mac_oss->irq_pending
+ */
+
+#define OSS_IP_NUBUS0 0x0001
+#define OSS_IP_NUBUS1 0x0002
+#define OSS_IP_NUBUS2 0x0004
+#define OSS_IP_NUBUS3 0x0008
+#define OSS_IP_NUBUS4 0x0010
+#define OSS_IP_NUBUS5 0x0020
+#define OSS_IP_IOPISM 0x0040
+#define OSS_IP_IOPSCC 0x0080
+#define OSS_IP_SOUND 0x0100
+#define OSS_IP_SCSI 0x0200
+#define OSS_IP_60HZ 0x0400
+#define OSS_IP_VIA1 0x0800
+#define OSS_IP_UNUSED1 0x1000
+#define OSS_IP_UNUSED2 0x2000
+#define OSS_IP_PARITY 0x4000
+#define OSS_IP_UNUSED3 0x8000
+
+#define OSS_IP_NUBUS (OSS_IP_NUBUS0|OSS_IP_NUBUS1|OSS_IP_NUBUS2|OSS_IP_NUBUS3|OSS_IP_NUBUS4|OSS_IP_NUBUS5)
+
+/*
+ * Rom Control Register
+ */
+
+#define OSS_POWEROFF 0x80
+
+/*
+ * OSS Interrupt levels for various sub-systems
+ *
+ * This mapping is layed out with two things in mind: first, we try to keep
+ * things on their own levels to avoid having to do double-dispatches. Second,
+ * the levels match as closely as possible the alternate IRQ mapping mode (aka
+ * "A/UX mode") available on some VIA machines.
+ */
+
+#define OSS_IRQLEV_DISABLED 0
+#define OSS_IRQLEV_IOPISM 1 /* ADB? */
+#define OSS_IRQLEV_SCSI 2
+#define OSS_IRQLEV_NUBUS 3 /* keep this on its own level */
+#define OSS_IRQLEV_IOPSCC 4 /* matches VIA alternate mapping */
+#define OSS_IRQLEV_SOUND 5 /* matches VIA alternate mapping */
+#define OSS_IRQLEV_60HZ 6 /* matches VIA alternate mapping */
+#define OSS_IRQLEV_VIA1 6 /* matches VIA alternate mapping */
+#define OSS_IRQLEV_PARITY 7 /* matches VIA alternate mapping */
+
+#ifndef __ASSEMBLY__
+
+struct mac_oss {
+ __u8 irq_level[0x10]; /* [0x000-0x00f] Interrupt levels */
+ __u8 padding0[0x1F2]; /* [0x010-0x201] IO space filler */
+ __u16 irq_pending; /* [0x202-0x203] pending interrupts bits */
+ __u8 rom_ctrl; /* [0x204-0x204] ROM cntl reg (for poweroff) */
+ __u8 padding1[0x2]; /* [0x205-0x206] currently unused by A/UX */
+ __u8 ack_60hz; /* [0x207-0x207] 60 Hz ack. */
+};
+
+extern volatile struct mac_oss *oss;
+extern int oss_present;
+
+#endif /* __ASSEMBLY__ */
diff --git a/include/asm-m68k/mac_psc.h b/include/asm-m68k/mac_psc.h
index de22bbefe..75463aafc 100644
--- a/include/asm-m68k/mac_psc.h
+++ b/include/asm-m68k/mac_psc.h
@@ -1,73 +1,243 @@
/*
- * Apple Peripheral System Controller (PSC)
+ * Apple Peripheral System Controller (PSC)
*
- * The PSC is used on the AV Macs to control IO functions not handled
- * by the VIAs (Ethernet, DSP, SCC).
+ * The PSC is used on the AV Macs to control IO functions not handled
+ * by the VIAs (Ethernet, DSP, SCC, Sound). This includes nine DMA
+ * channels.
+ *
+ * The first seven DMA channels appear to be "one-shot" and are actually
+ * sets of two channels; one member is active while the other is being
+ * configured, and then you flip the active member and start all over again.
+ * The one-shot channels are grouped together and are:
+ *
+ * 1. SCSI
+ * 2. Ethernet Read
+ * 3. Ethernet Write
+ * 4. Floppy Disk Controller
+ * 5. SCC Channel A Receive
+ * 6. SCC Channel B Receive
+ * 7. SCC Channel A Transmit
+ *
+ * The remaining two channels are handled somewhat differently. They appear
+ * to be closely tied and share one set of registers. They also seem to run
+ * continuously, although how you keep the buffer filled in this scenario is
+ * not understood as there seems to be only one input and one output buffer
+ * pointer.
+ *
+ * Much of this was extrapolated from what was known about the Ethernet
+ * registers and subsequently confirmed using MacsBug (ie by pinging the
+ * machine with easy-to-find patterns and looking for them in the DMA
+ * buffers, or by sending a file over the serial ports and finding the
+ * file in the buffers.)
+ *
+ * 1999-05-25 (jmt)
*/
-
-#define PSCBASE 0x50F31000
+
+#define PSC_BASE (0x50F31000)
/*
- * The IER/IFR registers work like the VIA, except that it has 4
- * of them each on different interrupt levels.
+ * The IER/IFR registers work like the VIA, except that it has 4
+ * of them each on different interrupt levels, and each register
+ * set only seems to handle four interrupts instead of seven.
+ *
+ * To access a particular set of registers, add 0xn0 to the base
+ * where n = 3,4,5 or 6.
*/
-#define pIFR3 0x130
-#define pIFR4 0x140
-#define pIFR5 0x150
-#define pIFR6 0x160
+#define pIFRbase 0x100
+#define pIERbase 0x104
-#define pIER3 0x134
-#define pIER4 0x144
-#define pIER5 0x154
-#define pIER6 0x164
+/*
+ * One-shot DMA control registers
+ */
+
+#define PSC_CTL_BASE 0xC00
+
+#define PSC_SCSI_CTL 0xC00
+#define PSC_ENETRD_CTL 0xC10
+#define PSC_ENETWR_CTL 0xC20
+#define PSC_FDC_CTL 0xC30
+#define PSC_SCCA_CTL 0xC40
+#define PSC_SCCB_CTL 0xC50
+#define PSC_SCCATX_CTL 0xC60
/*
- * Ethernet Control Registers
+ * DMA channels. Add +0x10 for the second channel in the set.
+ * You're supposed to use one channel while the other runs and
+ * then flip channels and do the whole thing again.
*/
-
-#define PSC_ENETRD_CTL 0xc10
-#define PSC_ENETWR_CTL 0xc20
+
+#define PSC_ADDR_BASE 0x1000
+#define PSC_LEN_BASE 0x1004
+#define PSC_CMD_BASE 0x1008
+
+#define PSC_SCSI_ADDR 0x1000 /* confirmed */
+#define PSC_SCSI_LEN 0x1004 /* confirmed */
+#define PSC_SCSI_CMD 0x1008 /* confirmed */
+#define PSC_ENETRD_ADDR 0x1020 /* confirmed */
+#define PSC_ENETRD_LEN 0x1024 /* confirmed */
+#define PSC_ENETRD_CMD 0x1028 /* confirmed */
+#define PSC_ENETWR_ADDR 0x1040 /* confirmed */
+#define PSC_ENETWR_LEN 0x1044 /* confirmed */
+#define PSC_ENETWR_CMD 0x1048 /* confirmed */
+#define PSC_FDC_ADDR 0x1060 /* strongly suspected */
+#define PSC_FDC_LEN 0x1064 /* strongly suspected */
+#define PSC_FDC_CMD 0x1068 /* strongly suspected */
+#define PSC_SCCA_ADDR 0x1080 /* confirmed */
+#define PSC_SCCA_LEN 0x1084 /* confirmed */
+#define PSC_SCCA_CMD 0x1088 /* confirmed */
+#define PSC_SCCB_ADDR 0x10A0 /* confirmed */
+#define PSC_SCCB_LEN 0x10A4 /* confirmed */
+#define PSC_SCCB_CMD 0x10A8 /* confirmed */
+#define PSC_SCCATX_ADDR 0x10C0 /* confirmed */
+#define PSC_SCCATX_LEN 0x10C4 /* confirmed */
+#define PSC_SCCATX_CMD 0x10C8 /* confirmed */
/*
- * Receive DMA channel (add +0x10 for 2nd channel)
+ * Free-running DMA registers. The only part known for sure are the bits in
+ * the control register, the buffer addresses and the buffer length. Everything
+ * else is anybody's guess.
+ *
+ * These registers seem to be mirrored every thirty-two bytes up until offset
+ * 0x300. It's safe to assume then that a new set of registers starts there.
*/
-
-#define PSC_ENETRD_ADDR 0x1020
-#define PSC_ENETRD_LEN 0x1024
-#define PSC_ENETRD_CMD 0x1028
+
+#define PSC_SND_CTL 0x200 /*
+ * [ 16-bit ]
+ * Sound (Singer?) control register.
+ *
+ * bit 0 : ????
+ * bit 1 : ????
+ * bit 2 : Set to one to enable sound
+ * output. Possibly a mute flag.
+ * bit 3 : ????
+ * bit 4 : ????
+ * bit 5 : ????
+ * bit 6 : Set to one to enable pass-thru
+ * audio. In this mode the audio data
+ * seems to appear in both the input
+ * buffer and the output buffer.
+ * bit 7 : Set to one to activate the
+ * sound input DMA or zero to
+ * disable it.
+ * bit 8 : Set to one to activate the
+ * sound output DMA or zero to
+ * disable it.
+ * bit 9 : \
+ * bit 11 : |
+ * These two bits control the sample
+ * rate. Usually set to binary 10 and
+ * MacOS 8.0 says I'm at 48 KHz. Using
+ * a binary value of 01 makes things
+ * sound about 1/2 speed (24 KHz?) and
+ * binary 00 is slower still (22 KHz?)
+ *
+ * Setting this to 0x0000 is a good way to
+ * kill all DMA at boot time so that the
+ * PSC won't overwrite the kernel image
+ * with sound data.
+ */
/*
- * Transmit DMA channel (add +0x10 for 2nd channel)
+ * 0x0202 - 0x0203 is unused. Writing there
+ * seems to clobber the control register.
*/
-
-#define PSC_ENETWR_ADDR 0x1040
-#define PSC_ENETWR_LEN 0x1044
-#define PSC_ENETWR_CMD 0x1048
+
+#define PSC_SND_SOURCE 0x204 /*
+ * [ 32-bit ]
+ * Controls input source and volume:
+ *
+ * bits 12-15 : input source volume, 0 - F
+ * bits 16-19 : unknown, always 0x5
+ * bits 20-23 : input source selection:
+ * 0x3 = CD Audio
+ * 0x4 = External Audio
+ *
+ * The volume is definately not the general
+ * output volume as it doesn't affect the
+ * alert sound volume.
+ */
+#define PSC_SND_STATUS1 0x208 /*
+ * [ 32-bit ]
+ * Appears to be a read-only status register.
+ * The usual value is 0x00400002.
+ */
+#define PSC_SND_HUH3 0x20C /*
+ * [ 16-bit ]
+ * Unknown 16-bit value, always 0x0000.
+ */
+#define PSC_SND_BITS2GO 0x20E /*
+ * [ 16-bit ]
+ * Counts down to zero from some constant
+ * value. The value appears to be the
+ * number of _bits_ remaining before the
+ * buffer is full, which would make sense
+ * since Apple's docs say the sound DMA
+ * channels are 1 bit wide.
+ */
+#define PSC_SND_INADDR 0x210 /*
+ * [ 32-bit ]
+ * Address of the sound input DMA buffer
+ */
+#define PSC_SND_OUTADDR 0x214 /*
+ * [ 32-bit ]
+ * Address of the sound output DMA buffer
+ */
+#define PSC_SND_LEN 0x218 /*
+ * [ 16-bit ]
+ * Length of both buffers in eight-byte units.
+ */
+#define PSC_SND_HUH4 0x21A /*
+ * [ 16-bit ]
+ * Unknown, always 0x0000.
+ */
+#define PSC_SND_STATUS2 0x21C /*
+ * [ 16-bit ]
+ * Appears to e a read-only status register.
+ * The usual value is 0x0200.
+ */
+#define PSC_SND_HUH5 0x21E /*
+ * [ 16-bit ]
+ * Unknown, always 0x0000.
+ */
+
+#ifndef __ASSEMBLY__
+
+extern volatile __u8 *psc;
+extern int psc_present;
/*
* Access functions
*/
-extern volatile unsigned char *psc;
+extern inline void psc_write_byte(int offset, __u8 data)
+{
+ *((volatile __u8 *)(psc + offset)) = data;
+}
+
+extern inline void psc_write_word(int offset, __u16 data)
+{
+ *((volatile __u16 *)(psc + offset)) = data;
+}
-extern inline void psc_write_word(int offset, u16 data)
+extern inline void psc_write_long(int offset, __u32 data)
{
- *((volatile u16 *)(psc+offset)) = data;
+ *((volatile __u32 *)(psc + offset)) = data;
}
-extern inline void psc_write_long(int offset, u32 data)
+extern inline u8 psc_read_byte(int offset)
{
- *((volatile u32 *)(psc+offset)) = data;
+ return *((volatile __u8 *)(psc + offset));
}
extern inline u16 psc_read_word(int offset)
{
- return *((volatile u16 *)(psc+offset));
+ return *((volatile __u16 *)(psc + offset));
}
extern inline u32 psc_read_long(int offset)
{
- return *((volatile u32 *)(psc+offset));
+ return *((volatile __u32 *)(psc + offset));
}
+#endif /* __ASSEMBLY__ */
diff --git a/include/asm-m68k/mac_via.h b/include/asm-m68k/mac_via.h
new file mode 100644
index 000000000..ab8e23d9e
--- /dev/null
+++ b/include/asm-m68k/mac_via.h
@@ -0,0 +1,267 @@
+/*
+ * 6522 Versatile Interface Adapter (VIA)
+ *
+ * There are two of these on the Mac II. Some IRQ's are vectored
+ * via them as are assorted bits and bobs - eg rtc, adb. The picture
+ * is a bit incomplete as the Mac documentation doesnt cover this well
+ */
+
+#ifndef _ASM_MAC_VIA_H_
+#define _ASM_MAC_VIA_H_
+
+/*
+ * Base addresses for the VIAs. There are two in every machine,
+ * although on some machines the second is an RBV or an OSS.
+ * The OSS is different enough that it's handled separately.
+ *
+ * Do not use these values directly; use the via1 and via2 variables
+ * instead (and don't forget to check rbv_present when using via2!)
+ */
+
+#define VIA1_BASE (0x50F00000)
+#define VIA2_BASE (0x50F02000)
+#define RBV_BASE (0x50F26000)
+
+/*
+ * Not all of these are true post MacII I think.
+ * CSA: probably the ones CHRP marks as 'unused' change purposes
+ * when the IWM becomes the SWIM.
+ * http://www.rs6000.ibm.com/resource/technology/chrpio/via5.mak.html
+ * ftp://ftp.austin.ibm.com/pub/technology/spec/chrp/inwork/CHRP_IORef_1.0.pdf
+ *
+ * also, http://developer.apple.com/technotes/hw/hw_09.html claims the
+ * following changes for IIfx:
+ * VIA1A_vSccWrReq not available and that VIA1A_vSync has moved to an IOP.
+ * Also, "All of the functionality of VIA2 has been moved to other chips".
+ */
+
+#define VIA1A_vSccWrReq 0x80 /* SCC write. (input)
+ * [CHRP] SCC WREQ: Reflects the state of the
+ * Wait/Request pins from the SCC.
+ * [Macintosh Family Hardware]
+ * as CHRP on SE/30,II,IIx,IIcx,IIci.
+ * on IIfx, "0 means an active request"
+ */
+#define VIA1A_vRev8 0x40 /* Revision 8 board ???
+ * [CHRP] En WaitReqB: Lets the WaitReq_L
+ * signal from port B of the SCC appear on
+ * the PA7 input pin. Output.
+ * [Macintosh Family] On the SE/30, this
+ * is the bit to flip screen buffers.
+ * 0=alternate, 1=main.
+ * on II,IIx,IIcx,IIci,IIfx this is a bit
+ * for Rev ID. 0=II,IIx, 1=IIcx,IIci,IIfx
+ */
+#define VIA1A_vHeadSel 0x20 /* Head select for IWM.
+ * [CHRP] unused.
+ * [Macintosh Family] "Floppy disk
+ * state-control line SEL" on all but IIfx
+ */
+#define VIA1A_vOverlay 0x10 /* [Macintosh Family] On SE/30,II,IIx,IIcx
+ * this bit enables the "Overlay" address
+ * map in the address decoders as it is on
+ * reset for mapping the ROM over the reset
+ * vector. 1=use overlay map.
+ * On the IIci,IIfx it is another bit of the
+ * CPU ID: 0=normal IIci, 1=IIci with parity
+ * feature or IIfx.
+ * [CHRP] En WaitReqA: Lets the WaitReq_L
+ * signal from port A of the SCC appear
+ * on the PA7 input pin (CHRP). Output.
+ * [MkLinux] "Drive Select"
+ * (with 0x20 being 'disk head select')
+ */
+#define VIA1A_vSync 0x08 /* [CHRP] Sync Modem: modem clock select:
+ * 1: select the external serial clock to
+ * drive the SCC's /RTxCA pin.
+ * 0: Select the 3.6864MHz clock to drive
+ * the SCC cell.
+ * [Macintosh Family] Correct on all but IIfx
+ */
+
+/* Macintosh Family Hardware sez: bits 0-2 of VIA1A are volume control
+ * on Macs which had the PWM sound hardware. Reserved on newer models.
+ * On IIci,IIfx, bits 1-2 are the rest of the CPU ID:
+ * bit 2: 1=IIci, 0=IIfx
+ * bit 1: 1 on both IIci and IIfx.
+ * MkLinux sez bit 0 is 'burnin flag' in this case.
+ * CHRP sez: VIA1A bits 0-2 and 5 are 'unused': if programmed as
+ * inputs, these bits will read 0.
+ */
+#define VIA1A_vVolume 0x07 /* Audio volume mask for PWM */
+#define VIA1A_CPUID0 0x02 /* CPU id bit 0 on RBV, others */
+#define VIA1A_CPUID1 0x04 /* CPU id bit 0 on RBV, others */
+#define VIA1A_CPUID2 0x10 /* CPU id bit 0 on RBV, others */
+#define VIA1A_CPUID3 0x40 /* CPU id bit 0 on RBV, others */
+
+/* Info on VIA1B is from Macintosh Family Hardware & MkLinux.
+ * CHRP offers no info. */
+#define VIA1B_vSound 0x80 /* Sound enable (for compatibility with
+ * PWM hardware) 0=enabled.
+ * Also, on IIci w/parity, shows parity error
+ * 0=error, 1=OK. */
+#define VIA1B_vMystery 0x40 /* On IIci, parity enable. 0=enabled,1=disabled
+ * On SE/30, vertical sync interrupt enable.
+ * 0=enabled. This vSync interrupt shows up
+ * as a slot $E interrupt. */
+#define VIA1B_vADBS2 0x20 /* ADB state input bit 1 (unused on IIfx) */
+#define VIA1B_vADBS1 0x10 /* ADB state input bit 0 (unused on IIfx) */
+#define VIA1B_vADBInt 0x08 /* ADB interrupt 0=interrupt (unused on IIfx)*/
+#define VIA1B_vRTCEnb 0x04 /* Enable Real time clock. 0=enabled. */
+#define VIA1B_vRTCClk 0x02 /* Real time clock serial-clock line. */
+#define VIA1B_vRTCData 0x01 /* Real time clock serial-data line. */
+
+/* MkLinux defines the following "VIA1 Register B contents where they
+ * differ from standard VIA1". From the naming scheme, we assume they
+ * correspond to a VIA work-alike named 'EVR'. */
+#define EVRB_XCVR 0x08 /* XCVR_SESSION* */
+#define EVRB_FULL 0x10 /* VIA_FULL */
+#define EVRB_SYSES 0x20 /* SYS_SESSION */
+#define EVRB_AUXIE 0x00 /* Enable A/UX Interrupt Scheme */
+#define EVRB_AUXID 0x40 /* Disable A/UX Interrupt Scheme */
+#define EVRB_SFTWRIE 0x00 /* Software Interrupt ReQuest */
+#define EVRB_SFTWRID 0x80 /* Software Interrupt ReQuest */
+
+/*
+ * VIA2 A register is the interrupt lines raised off the nubus
+ * slots.
+ * The below info is from 'Macintosh Family Hardware.'
+ * MkLinux calls the 'IIci internal video IRQ' below the 'RBV slot 0 irq.'
+ * It also notes that the slot $9 IRQ is the 'Ethernet IRQ' and
+ * defines the 'Video IRQ' as 0x40 for the 'EVR' VIA work-alike.
+ * Perhaps OSS uses vRAM1 and vRAM2 for ADB.
+ */
+
+#define VIA2A_vRAM1 0x80 /* RAM size bit 1 (IIci: reserved) */
+#define VIA2A_vRAM0 0x40 /* RAM size bit 0 (IIci: internal video IRQ) */
+#define VIA2A_vIRQE 0x20 /* IRQ from slot $E */
+#define VIA2A_vIRQD 0x10 /* IRQ from slot $D */
+#define VIA2A_vIRQC 0x08 /* IRQ from slot $C */
+#define VIA2A_vIRQB 0x04 /* IRQ from slot $B */
+#define VIA2A_vIRQA 0x02 /* IRQ from slot $A */
+#define VIA2A_vIRQ9 0x01 /* IRQ from slot $9 */
+
+/* RAM size bits decoded as follows:
+ * bit1 bit0 size of ICs in bank A
+ * 0 0 256 kbit
+ * 0 1 1 Mbit
+ * 1 0 4 Mbit
+ * 1 1 16 Mbit
+ */
+
+/*
+ * Register B has the fun stuff in it
+ */
+
+#define VIA2B_vVBL 0x80 /* VBL output to VIA1 (60.15Hz) driven by
+ * timer T1.
+ * on IIci, parity test: 0=test mode.
+ * [MkLinux] RBV_PARODD: 1=odd,0=even. */
+#define VIA2B_vSndJck 0x40 /* External sound jack status.
+ * 0=plug is inserted. On SE/30, always 0 */
+#define VIA2B_vTfr0 0x20 /* Transfer mode bit 0 ack from NuBus */
+#define VIA2B_vTfr1 0x10 /* Transfer mode bit 1 ack from NuBus */
+#define VIA2B_vMode32 0x08 /* 24/32bit switch - doubles as cache flush
+ * on II, AMU/PMMU control.
+ * if AMU, 0=24bit to 32bit translation
+ * if PMMU, 1=PMMU is accessing page table.
+ * on SE/30 tied low.
+ * on IIx,IIcx,IIfx, unused.
+ * on IIci/RBV, cache control. 0=flush cache.
+ */
+#define VIA2B_vPower 0x04 /* Power off, 0=shut off power.
+ * on SE/30 this signal sent to PDS card. */
+#define VIA2B_vBusLk 0x02 /* Lock NuBus transactions, 0=locked.
+ * on SE/30 sent to PDS card. */
+#define VIA2B_vCDis 0x01 /* Cache control. On IIci, 1=disable cache card
+ * on others, 0=disable processor's instruction
+ * and data caches. */
+
+/* Apple sez: http://developer.apple.com/technotes/ov/ov_04.html
+ * Another example of a valid function that has no ROM support is the use
+ * of the alternate video page for page-flipping animation. Since there
+ * is no ROM call to flip pages, it is necessary to go play with the
+ * right bit in the VIA chip (6522 Versatile Interface Adapter).
+ * [CSA: don't know which one this is, but it's one of 'em!]
+ */
+
+/*
+ * 6522 registers - see databook.
+ * CSA: Assignments for VIA1 confirmed from CHRP spec.
+ */
+
+/* partial address decode. 0xYYXX : XX part for RBV, YY part for VIA */
+/* Note: 15 VIA regs, 8 RBV regs */
+
+#define vBufB 0x0000 /* [VIA/RBV] Register B */
+#define vBufAH 0x0200 /* [VIA only] Buffer A, with handshake. DON'T USE! */
+#define vDirB 0x0400 /* [VIA only] Data Direction Register B. */
+#define vDirA 0x0600 /* [VIA only] Data Direction Register A. */
+#define vT1CL 0x0800 /* [VIA only] Timer one counter low. */
+#define vT1CH 0x0a00 /* [VIA only] Timer one counter high. */
+#define vT1LL 0x0c00 /* [VIA only] Timer one latches low. */
+#define vT1LH 0x0e00 /* [VIA only] Timer one latches high. */
+#define vT2CL 0x1000 /* [VIA only] Timer two counter low. */
+#define vT2CH 0x1200 /* [VIA only] Timer two counter high. */
+#define vSR 0x1400 /* [VIA only] Shift register. */
+#define vACR 0x1600 /* [VIA only] Auxilary control register. */
+#define vPCR 0x1800 /* [VIA only] Peripheral control register. */
+ /* CHRP sez never ever to *write* this.
+ * Mac family says never to *change* this.
+ * In fact we need to initialize it once at start. */
+#define vIFR 0x1a00 /* [VIA/RBV] Interrupt flag register. */
+#define vIER 0x1c00 /* [VIA/RBV] Interrupt enable register. */
+#define vBufA 0x1e00 /* [VIA/RBV] register A (no handshake) */
+
+/* The RBV only decodes the bottom eight address lines; the VIA doesn't
+ * decode the bottom eight -- so vBufB | rBufB will always get you BufB */
+/* CSA: in fact, only bits 0,1, and 4 seem to be decoded.
+ * BUT note the values for rIER and rIFR, where the top 8 bits *do* seem
+ * to matter. In fact *all* of the top 8 bits seem to matter;
+ * setting rIER=0x1813 and rIFR=0x1803 doesn't work, either.
+ * Perhaps some sort of 'compatibility mode' is built-in? [21-May-1999]
+ */
+
+#define rBufB 0x0000 /* [VIA/RBV] Register B */
+#define rExp 0x0001 /* [RBV only] RBV future expansion (always 0) */
+#define rSIFR 0x0002 /* [RBV only] RBV slot interrupts register. */
+#define rIFR 0x1a03 /* [VIA/RBV] RBV interrupt flag register. */
+#define rMonP 0x0010 /* [RBV only] RBV video monitor type. */
+#define rChpT 0x0011 /* [RBV only] RBV test mode register (reads as 0). */
+#define rSIER 0x0012 /* [RBV only] RBV slot interrupt enables. */
+#define rIER 0x1c13 /* [VIA/RBV] RBV interrupt flag enable register. */
+#define rBufA rSIFR /* the 'slot interrupts register' is BufA on a VIA */
+
+/*
+ * Video monitor parameters, for rMonP:
+ */
+#define RBV_DEPTH 0x07 /* bits per pixel: 000=1,001=2,010=4,011=8 */
+#define RBV_MONID 0x38 /* monitor type, as below. */
+#define RBV_VIDOFF 0x40 /* 1 turns off onboard video */
+/* Supported monitor types: */
+#define MON_15BW (1<<3) /* 15" BW portrait. */
+#define MON_IIGS (2<<3) /* 12" color (modified IIGS monitor). */
+#define MON_15RGB (5<<3) /* 15" RGB portrait. */
+#define MON_12OR13 (6<<3) /* 12" BW or 13" RGB. */
+#define MON_NONE (7<<3) /* No monitor attached. */
+
+/* To clarify IER manipulations */
+#define IER_SET_BIT(b) (0x80 | (1<<(b)) )
+#define IER_CLR_BIT(b) (0x7F & (1<<(b)) )
+
+#ifndef __ASSEMBLY__
+
+extern volatile __u8 *via1,*via2;
+extern int rbv_present,via_alt_mapping;
+extern __u8 rbv_clear;
+
+extern __inline__ int rbv_set_video_bpp(int bpp) {
+ char val = (bpp==1)?0:(bpp==2)?1:(bpp==4)?2:(bpp==8)?3:-1;
+ if (!rbv_present || val<0) return -1;
+ via2[rMonP] = (via2[rMonP] & ~RBV_DEPTH) | val;
+ return 0;
+}
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_MAC_VIA_H_ */
diff --git a/include/asm-m68k/machdep.h b/include/asm-m68k/machdep.h
index ff785fb6e..864f09ecd 100644
--- a/include/asm-m68k/machdep.h
+++ b/include/asm-m68k/machdep.h
@@ -30,6 +30,8 @@ extern void (*mach_gettod)(int *year, int *mon, int *day, int *hour,
extern int (*mach_hwclk)(int, struct hwclk_time*);
extern int (*mach_set_clock_mmss)(unsigned long);
extern void (*mach_reset)( void );
+extern void (*mach_halt)( void );
+extern void (*mach_power_off)( void );
extern unsigned long (*mach_hd_init) (unsigned long, unsigned long);
extern void (*mach_hd_setup)(char *, int *);
extern long mach_max_dma_address;
diff --git a/include/asm-m68k/machines.h b/include/asm-m68k/machines.h
new file mode 100644
index 000000000..da6015a90
--- /dev/null
+++ b/include/asm-m68k/machines.h
@@ -0,0 +1,87 @@
+/* $Id: machines.h,v 1.4 1995/11/25 02:31:58 davem Exp $
+ * machines.h: Defines for taking apart the machine type value in the
+ * idprom and determining the kind of machine we are on.
+ *
+ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ * Sun3/3x models added by David Monro (davidm@psrg.cs.usyd.edu.au)
+ */
+#ifndef _SPARC_MACHINES_H
+#define _SPARC_MACHINES_H
+
+struct Sun_Machine_Models {
+ char *name;
+ unsigned char id_machtype;
+};
+
+/* Current number of machines we know about that has an IDPROM
+ * machtype entry including one entry for the 0x80 OBP machines.
+ */
+// reduced along with table in arch/m68k/sun3/idprom.c
+// sun3 port doesn't need to know about sparc machines.
+//#define NUM_SUN_MACHINES 23
+#define NUM_SUN_MACHINES 8
+
+extern struct Sun_Machine_Models Sun_Machines[NUM_SUN_MACHINES];
+
+/* The machine type in the idprom area looks like this:
+ *
+ * ---------------
+ * | ARCH | MACH |
+ * ---------------
+ * 7 4 3 0
+ *
+ * The ARCH field determines the architecture line (sun4, sun4c, etc).
+ * The MACH field determines the machine make within that architecture.
+ */
+
+#define SM_ARCH_MASK 0xf0
+#define SM_SUN3 0x10
+#define SM_SUN4 0x20
+#define SM_SUN3X 0x40
+#define SM_SUN4C 0x50
+#define SM_SUN4M 0x70
+#define SM_SUN4M_OBP 0x80
+
+#define SM_TYP_MASK 0x0f
+/* Sun3 machines */
+#define SM_3_160 0x01 /* Sun 3/160 series */
+#define SM_3_50 0x02 /* Sun 3/50 series */
+#define SM_3_260 0x03 /* Sun 3/260 series */
+#define SM_3_110 0x04 /* Sun 3/110 series */
+#define SM_3_60 0x07 /* Sun 3/60 series */
+#define SM_3_E 0x08 /* Sun 3/E series */
+
+/* Sun3x machines */
+#define SM_3_460 0x01 /* Sun 3/460 (460,470,480) series */
+#define SM_3_80 0x02 /* Sun 3/80 series */
+
+/* Sun4 machines */
+#define SM_4_260 0x01 /* Sun 4/200 series */
+#define SM_4_110 0x02 /* Sun 4/100 series */
+#define SM_4_330 0x03 /* Sun 4/300 series */
+#define SM_4_470 0x04 /* Sun 4/400 series */
+
+/* Sun4c machines Full Name - PROM NAME */
+#define SM_4C_SS1 0x01 /* Sun4c SparcStation 1 - Sun 4/60 */
+#define SM_4C_IPC 0x02 /* Sun4c SparcStation IPC - Sun 4/40 */
+#define SM_4C_SS1PLUS 0x03 /* Sun4c SparcStation 1+ - Sun 4/65 */
+#define SM_4C_SLC 0x04 /* Sun4c SparcStation SLC - Sun 4/20 */
+#define SM_4C_SS2 0x05 /* Sun4c SparcStation 2 - Sun 4/75 */
+#define SM_4C_ELC 0x06 /* Sun4c SparcStation ELC - Sun 4/25 */
+#define SM_4C_IPX 0x07 /* Sun4c SparcStation IPX - Sun 4/50 */
+
+/* Sun4m machines, these predate the OpenBoot. These values only mean
+ * something if the value in the ARCH field is SM_SUN4M, if it is
+ * SM_SUN4M_OBP then you have the following situation:
+ * 1) You either have a sun4d, a sun4e, or a recently made sun4m.
+ * 2) You have to consult OpenBoot to determine which machine this is.
+ */
+#define SM_4M_SS60 0x01 /* Sun4m SparcSystem 600 */
+#define SM_4M_SS50 0x02 /* Sun4m SparcStation 10 */
+#define SM_4M_SS40 0x03 /* Sun4m SparcStation 5 */
+
+/* Sun4d machines -- N/A */
+/* Sun4e machines -- N/A */
+/* Sun4u machines -- N/A */
+
+#endif /* !(_SPARC_MACHINES_H) */
diff --git a/include/asm-m68k/machw.h b/include/asm-m68k/machw.h
index 56da64f3b..e84641840 100644
--- a/include/asm-m68k/machw.h
+++ b/include/asm-m68k/machw.h
@@ -25,6 +25,7 @@
#include <linux/types.h>
+#if 0
/* Mac SCSI Controller 5380 */
#define MAC_5380_BAS (0x50F10000) /* This is definitely wrong!! */
@@ -63,65 +64,7 @@ struct MAC_SCC
u_char cha_b_data;
};
# define mac_scc ((*(volatile struct SCC*)MAC_SCC_BAS))
-
-/*
-** VIA 6522
-*/
-
-#define VIA1_BAS (0x50F00000)
-#define VIA2_BAS (0x50F02000)
-#define VIA2_BAS_IIci (0x50F26000)
-struct VIA
- {
- u_char buf_b;
- u_char dummy1[0x199];
- u_char buf_a;
- u_char dummy2[0x199];
- u_char dir_b;
- u_char dummy3[0x199];
- u_char dir_a;
- u_char dummy4[0x199];
- u_char timer1_cl;
- u_char dummy5[0x199];
- u_char timer1_ch;
- u_char dummy6[0x199];
- u_char timer1_ll;
- u_char dummy7[0x199];
- u_char timer1_lh;
- u_char dummy8[0x199];
- u_char timer2_cl;
- u_char dummy9[0x199];
- u_char timer2_ch;
- u_char dummy10[0x199];
- u_char sr;
- u_char dummy11[0x199];
- u_char acr;
- u_char dummy12[0x199];
- u_char pcr;
- u_char dummy13[0x199];
- u_char int_fl;
- u_char dummy14[0x199];
- u_char int_en;
- u_char dummy15[0x199];
- u_char anr;
- u_char dummy16[0x199];
- };
-
-# define via_1 ((*(volatile struct VIA *)VIA1_BAS))
-# define via_2 ((*(volatile struct VIA *)VIA2_BAS))
-# define via1_regp ((volatile unsigned char *)VIA1_BAS)
-
-/*
- * OSS/RBV base address
- */
-
-#define OSS_BAS 0x50f1a000
-#define PSC_BAS 0x50f31000
-
-/* move to oss.h?? */
-#define nIFR 0x203
-#define oIFR 0x202
-
+#endif
/* hardware stuff */
diff --git a/include/asm-m68k/macintosh.h b/include/asm-m68k/macintosh.h
index 28dad71ca..40905e74d 100644
--- a/include/asm-m68k/macintosh.h
+++ b/include/asm-m68k/macintosh.h
@@ -6,6 +6,7 @@
*/
extern void mac_reset(void);
+extern void mac_poweroff(void);
extern void mac_init_IRQ(void);
extern int mac_request_irq (unsigned int, void (*)(int, void *,
struct pt_regs *),
@@ -13,6 +14,7 @@ extern int mac_request_irq (unsigned int, void (*)(int, void *,
extern void mac_free_irq(unsigned int, void *);
extern void mac_enable_irq(unsigned int);
extern void mac_disable_irq(unsigned int);
+extern int mac_irq_pending(unsigned int);
extern int mac_get_irq_list(char *);
#if 0
extern void mac_default_handler(int irq);
@@ -21,7 +23,6 @@ extern void mac_identify(void);
extern void mac_report_hardware(void);
extern void mac_debugging_penguin(int);
extern void mac_boom(int);
-extern void mac_video_setup(char *,int *);
/*
* Floppy driver magic hook - probably shouldnt be here
@@ -58,6 +59,7 @@ struct mac_model
#define MAC_ADB_CUDA 3
#define MAC_ADB_PB1 4
#define MAC_ADB_PB2 5
+#define MAC_ADB_IOP 6
#define MAC_VIA_II 1
#define MAC_VIA_IIci 2
@@ -131,6 +133,7 @@ struct mac_model
#define MAC_MODEL_P550 80 /* aka: LC550, P560 */
#define MAC_MODEL_CCLII 83 /* aka: P275 */
#define MAC_MODEL_PB165 84
+#define MAC_MODEL_PB190 85 /* aka: PB190CS */
#define MAC_MODEL_TV 88
#define MAC_MODEL_P475 89 /* aka: LC475, P476 */
#define MAC_MODEL_P475F 90 /* aka: P475 w/ FPU (no LC040) */
@@ -141,7 +144,6 @@ struct mac_model
#define MAC_MODEL_PB280 102
#define MAC_MODEL_PB280C 103
#define MAC_MODEL_PB150 115
-#define MAC_MODEL_PB190 122 /* aka: PB190CS */
extern struct mac_model *macintosh_config;
diff --git a/include/asm-m68k/macints.h b/include/asm-m68k/macints.h
index e731c0e7f..1014df89d 100644
--- a/include/asm-m68k/macints.h
+++ b/include/asm-m68k/macints.h
@@ -14,38 +14,49 @@
#include <asm/irq.h>
-/*
-** Macintosh Interrupt sources.
-**
-** Note: these are all routed via the generic VIA interrupt routine!
-**
-*/
+/* Setting this prints debugging info for unclaimed interrupts */
+
+#define DEBUG_SPURIOUS
+
+/* Setting this prints debugging info on each autovector interrupt */
-#define SRC_VIA1 0
-#define SRC_VIA2 1
+/* #define DEBUG_IRQS */
+
+/* Setting this prints debugging info on each Nubus interrupt */
+
+/* #define DEBUG_NUBUS_INT */
+
+/* Setting this prints debugging info on irqs as they enabled and disabled. */
+
+/* #define DEBUG_IRQUSE */
+
+/*
+ * Base IRQ number for all Mac68K interrupt sources. Each source
+ * has eight indexes (base -> base+7).
+ */
#define VIA1_SOURCE_BASE 8
#define VIA2_SOURCE_BASE 16
-#define RBV_SOURCE_BASE 24
-#define MAC_SCC_SOURCE_BASE 32
+#define MAC_SCC_SOURCE_BASE 24
+#define PSC3_SOURCE_BASE 24
+#define PSC4_SOURCE_BASE 32
+#define PSC5_SOURCE_BASE 40
+#define PSC6_SOURCE_BASE 48
#define NUBUS_SOURCE_BASE 56
-#define NUBUS_MAX_SOURCES 8
-/* FIXME: sources not contigous ... */
-#define NUM_MAC_SOURCES (NUBUS_SOURCE_BASE+NUBUS_MAX_SOURCES-VIA1_SOURCE_BASE)
+/*
+ * Maximum IRQ number is NUBUS_SOURCE_BASE + 7,
+ * giving us IRQs up through 63.
+ */
-#define IRQ_SRC_MASK (VIA1_SOURCE_BASE|VIA2_SOURCE_BASE|MAC_SCC_SOURCE_BASE)
-#define IRQ_IDX_MASK 7
+#define NUM_MAC_SOURCES 64
/*
- * quick hack to adapt old MACHSPEC-aware source
+ * clean way to separate IRQ into its source and index
*/
-#define IRQ_IDX(irq) (irq)
-/* interrupt service types */
-#define IRQ_TYPE_SLOW 0
-#define IRQ_TYPE_FAST 1
-#define IRQ_TYPE_PRIO 2
+#define IRQ_SRC(irq) (irq >> 3)
+#define IRQ_IDX(irq) (irq & 7)
#define IRQ_SPURIOUS (0)
@@ -59,15 +70,15 @@
#define IRQ_AUTO_7 (7)
/* VIA1 interrupts */
-#define IRQ_VIA1_0 (8) /* one second int. */
-#define IRQ_VIA1_1 (9) /* VBlank int. */
+#define IRQ_VIA1_0 (8) /* one second int. */
+#define IRQ_VIA1_1 (9) /* VBlank int. */
#define IRQ_MAC_VBL IRQ_VIA1_1
-#define IRQ_VIA1_2 (10) /* ADB SR shifts complete */
+#define IRQ_VIA1_2 (10) /* ADB SR shifts complete */
#define IRQ_MAC_ADB IRQ_VIA1_2
#define IRQ_MAC_ADB_SR IRQ_VIA1_2
-#define IRQ_VIA1_3 (11) /* ADB SR CB2 ?? */
+#define IRQ_VIA1_3 (11) /* ADB SR CB2 ?? */
#define IRQ_MAC_ADB_SD IRQ_VIA1_3
-#define IRQ_VIA1_4 (12) /* ADB SR ext. clock pulse */
+#define IRQ_VIA1_4 (12) /* ADB SR ext. clock pulse */
#define IRQ_MAC_ADB_CL IRQ_VIA1_4
#define IRQ_VIA1_5 (13)
#define IRQ_MAC_TIMER_2 IRQ_VIA1_5
@@ -75,7 +86,7 @@
#define IRQ_MAC_TIMER_1 IRQ_VIA1_6
#define IRQ_VIA1_7 (15)
-/* VIA2 interrupts */
+/* VIA2/RBV interrupts */
#define IRQ_VIA2_0 (16)
#define IRQ_MAC_SCSIDRQ IRQ_VIA2_0
#define IRQ_VIA2_1 (17)
@@ -88,18 +99,6 @@
#define IRQ_VIA2_6 (22)
#define IRQ_VIA2_7 (23)
-#if 0
-/* RBV interrupts */
-#define IRQ_RBV_0 (24)
-#define IRQ_RBV_1 (25)
-#define IRQ_RBV_2 (26)
-#define IRQ_RBV_3 (27)
-#define IRQ_RBV_4 (28)
-#define IRQ_RBV_5 (29)
-#define IRQ_RBV_6 (30)
-#define IRQ_RBV_7 (31)
-#endif
-
/* Level 3 (PSC, AV Macs only) interrupts */
#define IRQ_PSC3_0 (24)
#define IRQ_MAC_MACE IRQ_PSC3_0
@@ -109,8 +108,8 @@
/* Level 4 (SCC) interrupts */
#define IRQ_SCC (32)
-#define IRQ_SCCB (33)
-#define IRQ_SCCA (34)
+#define IRQ_SCCA (33)
+#define IRQ_SCCB (34)
#if 0 /* FIXME: are there multiple interrupt conditions on the SCC ?? */
/* SCC interrupts */
#define IRQ_SCCB_TX (32)
@@ -143,40 +142,21 @@
#define IRQ_PSC6_3 (51)
/* Nubus interrupts (cascaded to VIA2) */
-#define IRQ_NUBUS_1 (56)
+#define IRQ_NUBUS_9 (56)
+#define IRQ_NUBUS_A (57)
+#define IRQ_NUBUS_B (58)
+#define IRQ_NUBUS_C (59)
+#define IRQ_NUBUS_D (60)
+#define IRQ_NUBUS_E (61)
+#define IRQ_NUBUS_F (62)
+
+#define SLOT2IRQ(x) (x + 47)
+#define IRQ2SLOT(x) (x - 47)
#define INT_CLK 24576 /* CLK while int_clk =2.456MHz and divide = 100 */
#define INT_TICKS 246 /* to make sched_time = 99.902... HZ */
-
-#define VIA_ENABLE 0
-#define VIA_PENDING 1
-#define VIA_SERVICE 2
-#define VIA_MASK 3
-
-/*
- * Utility functions for setting/clearing bits in the interrupt registers of
- * the VIA.
- */
-
-void mac_enable_irq( unsigned irq );
-void mac_disable_irq( unsigned irq );
-void mac_turnon_irq( unsigned irq );
-void mac_turnoff_irq( unsigned irq );
-void mac_clear_pending_irq( unsigned irq );
-int mac_irq_pending( unsigned irq );
-int nubus_request_irq(int slot, void *dev_id, void (*handler)(int,void *,struct pt_regs *));
-int nubus_free_irq(int slot);
-
-unsigned long mac_register_nubus_int( void );
-void mac_unregister_nubus_int( unsigned long );
-
-extern void mac_default_handler(int irq, void *dev_id, struct pt_regs *regs);
-extern void via1_irq(int irq, void *dev_id, struct pt_regs *regs);
-extern void via2_irq(int irq, void *dev_id, struct pt_regs *regs);
-extern void rbv_irq(int irq, void *dev_id, struct pt_regs *regs);
-extern void mac_bang(int irq, void *dev_id, struct pt_regs *regs);
-
-extern void mac_SCC_handler(int irq, void *dev_id, struct pt_regs *regs);
+extern irq_node_t *mac_irq_list[NUM_MAC_SOURCES];
+extern void mac_do_irq_list(int irq, struct pt_regs *);
#endif /* asm/macints.h */
diff --git a/include/asm-m68k/math-emu.h b/include/asm-m68k/math-emu.h
new file mode 100644
index 000000000..a09dc54f2
--- /dev/null
+++ b/include/asm-m68k/math-emu.h
@@ -0,0 +1,300 @@
+#ifndef _ASM_M68K_SETUP_H
+#define _ASM_M68K_SETUP_H
+
+#include <asm/setup.h>
+#include <linux/linkage.h>
+
+/* Status Register bits */
+
+/* accrued exception bits */
+#define FPSR_AEXC_INEX 3
+#define FPSR_AEXC_DZ 4
+#define FPSR_AEXC_UNFL 5
+#define FPSR_AEXC_OVFL 6
+#define FPSR_AEXC_IOP 7
+
+/* exception status bits */
+#define FPSR_EXC_INEX1 8
+#define FPSR_EXC_INEX2 9
+#define FPSR_EXC_DZ 10
+#define FPSR_EXC_UNFL 11
+#define FPSR_EXC_OVFL 12
+#define FPSR_EXC_OPERR 13
+#define FPSR_EXC_SNAN 14
+#define FPSR_EXC_BSUN 15
+
+/* quotient byte, assumes big-endian, of course */
+#define FPSR_QUOTIENT(fpsr) (*((signed char *) &(fpsr) + 1))
+
+/* condition code bits */
+#define FPSR_CC_NAN 24
+#define FPSR_CC_INF 25
+#define FPSR_CC_Z 26
+#define FPSR_CC_NEG 27
+
+
+/* Control register bits */
+
+/* rounding mode */
+#define FPCR_ROUND_RN 0 /* round to nearest/even */
+#define FPCR_ROUND_RZ 1 /* round to zero */
+#define FPCR_ROUND_RM 2 /* minus infinity */
+#define FPCR_ROUND_RP 3 /* plus infinity */
+
+/* rounding precision */
+#define FPCR_PRECISION_X 0 /* long double */
+#define FPCR_PRECISION_S 1 /* double */
+#define FPCR_PRECISION_D 2 /* float */
+
+
+/* Flags to select the debugging output */
+#define PDECODE 0
+#define PEXECUTE 1
+#define PCONV 2
+#define PNORM 3
+#define PREGISTER 4
+#define PINSTR 5
+#define PUNIMPL 6
+#define PMOVEM 7
+
+#define PMDECODE (1<<PDECODE)
+#define PMEXECUTE (1<<PEXECUTE)
+#define PMCONV (1<<PCONV)
+#define PMNORM (1<<PNORM)
+#define PMREGISTER (1<<PREGISTER)
+#define PMINSTR (1<<PINSTR)
+#define PMUNIMPL (1<<PUNIMPL)
+#define PMMOVEM (1<<PMOVEM)
+
+#ifndef __ASSEMBLY__
+
+#include <linux/kernel.h>
+#include <linux/sched.h>
+
+union fp_mant64 {
+ unsigned long long m64;
+ unsigned long m32[2];
+};
+
+union fp_mant128 {
+ unsigned long long m64[2];
+ unsigned long m32[4];
+};
+
+/* internal representation of extended fp numbers */
+struct fp_ext {
+ unsigned char lowmant;
+ unsigned char sign;
+ unsigned short exp;
+ union fp_mant64 mant;
+};
+
+/* C representation of FPU registers */
+/* NOTE: if you change this, you have to change the assembler offsets
+ below and the size in <asm/fpu.h>, too */
+struct fp_data {
+ struct fp_ext fpreg[8];
+ unsigned int fpcr;
+ unsigned int fpsr;
+ unsigned int fpiar;
+ unsigned short prec;
+ unsigned short rnd;
+ struct fp_ext temp[2];
+};
+
+#if FPU_EMU_DEBUG
+extern unsigned int fp_debugprint;
+
+#define dprint(bit, fmt, args...) ({ \
+ if (fp_debugprint & (1 << (bit))) \
+ printk(fmt, ## args); \
+})
+#else
+#define dprint(bit, fmt, args...)
+#endif
+
+#define uprint(str) ({ \
+ static int __count = 3; \
+ \
+ if (__count > 0) { \
+ printk("You just hit an unimplemented " \
+ "fpu instruction (%s)\n", str); \
+ printk("Please report this to ....\n"); \
+ __count--; \
+ } \
+})
+
+#define FPDATA ((struct fp_data *)current->thread.fp)
+
+#else /* __ASSEMBLY__ */
+
+#define FPDATA %a2
+
+/* offsets from the base register to the floating point data in the task struct */
+#define FPD_FPREG (TASK_THREAD+THREAD_FPREG+0)
+#define FPD_FPCR (TASK_THREAD+THREAD_FPREG+96)
+#define FPD_FPSR (TASK_THREAD+THREAD_FPREG+100)
+#define FPD_FPIAR (TASK_THREAD+THREAD_FPREG+104)
+#define FPD_PREC (TASK_THREAD+THREAD_FPREG+108)
+#define FPD_RND (TASK_THREAD+THREAD_FPREG+110)
+#define FPD_TEMPFP1 (TASK_THREAD+THREAD_FPREG+112)
+#define FPD_TEMPFP2 (TASK_THREAD+THREAD_FPREG+124)
+#define FPD_SIZEOF (TASK_THREAD+THREAD_FPREG+136)
+
+/* offsets on the stack to access saved registers,
+ * these are only used during instruction decoding
+ * where we always know how deep we're on the stack.
+ */
+#define FPS_DO (PT_D0)
+#define FPS_D1 (PT_D1)
+#define FPS_D2 (PT_D2)
+#define FPS_A0 (PT_A0)
+#define FPS_A1 (PT_A1)
+#define FPS_A2 (PT_A2)
+#define FPS_SR (PT_SR)
+#define FPS_PC (PT_PC)
+#define FPS_EA (PT_PC+6)
+#define FPS_PC2 (PT_PC+10)
+
+.macro fp_get_fp_reg
+ lea (FPD_FPREG,FPDATA,%d0.w*4),%a0
+ lea (%a0,%d0.w*8),%a0
+.endm
+
+/* Macros used to get/put the current program counter.
+ * 020/030 use a different stack frame then 040/060, for the
+ * 040/060 the return pc points already to the next location,
+ * so this only needs to be modified for jump instructions.
+ */
+.macro fp_get_pc dest
+ move.l (FPS_PC+4,%sp),\dest
+.endm
+
+.macro fp_put_pc src,jump=0
+ move.l \src,(FPS_PC+4,%sp)
+.endm
+
+.macro fp_get_instr_data f,s,dest,label
+ getuser \f,%sp@(FPS_PC+4)@(0),\dest,\label,%sp@(FPS_PC+4)
+ addq.l #\s,%sp@(FPS_PC+4)
+.endm
+
+.macro fp_get_instr_word dest,label,addr
+ fp_get_instr_data w,2,\dest,\label,\addr
+.endm
+
+.macro fp_get_instr_long dest,label,addr
+ fp_get_instr_data l,4,\dest,\label,\addr
+.endm
+
+/* These macros are used to read from/write to user space
+ * on error we jump to the fixup section, load the fault
+ * address into %a0 and jump to the exit.
+ * (derived from <asm/uaccess.h>)
+ */
+.macro getuser size,src,dest,label,addr
+| printf ,"[\size<%08x]",1,\addr
+.Lu1\@: moves\size \src,\dest
+
+ .section .fixup,"ax"
+ .even
+.Lu2\@: move.l \addr,%a0
+ jra \label
+ .previous
+
+ .section __ex_table,"a"
+ .align 4
+ .long .Lu1\@,.Lu2\@
+ .previous
+.endm
+
+.macro putuser size,src,dest,label,addr
+| printf ,"[\size>%08x]",1,\addr
+.Lu1\@: moves\size \src,\dest
+.Lu2\@:
+
+ .section .fixup,"ax"
+ .even
+.Lu3\@: move.l \addr,%a0
+ jra \label
+ .previous
+
+ .section __ex_table,"a"
+ .align 4
+ .long .Lu1\@,.Lu3\@
+ .long .Lu2\@,.Lu3\@
+ .previous
+.endm
+
+
+.macro movestack nr,arg1,arg2,arg3,arg4,arg5
+ .if \nr
+ movestack (\nr-1),\arg2,\arg3,\arg4,\arg5
+ move.l \arg1,-(%sp)
+ .endif
+.endm
+
+.macro printf bit=-1,string,nr=0,arg1,arg2,arg3,arg4,arg5
+#ifdef FPU_EMU_DEBUG
+ .data
+.Lpdata\@:
+ .string "\string"
+ .previous
+
+ movem.l %d0/%d1/%a0/%a1,-(%sp)
+ .if \bit+1
+#if 0
+ moveq #\bit,%d0
+ andw #7,%d0
+ btst %d0,fp_debugprint+((31-\bit)/8)
+#else
+ btst #\bit,fp_debugprint+((31-\bit)/8)
+#endif
+ jeq .Lpskip\@
+ .endif
+ movestack \nr,\arg1,\arg2,\arg3,\arg4,\arg5
+ pea .Lpdata\@
+ jsr printk
+ lea ((\nr+1)*4,%sp),%sp
+.Lpskip\@:
+ movem.l (%sp)+,%d0/%d1/%a0/%a1
+#endif
+.endm
+
+.macro printx bit,fp
+#ifdef FPU_EMU_DEBUG
+ movem.l %d0/%a0,-(%sp)
+ lea \fp,%a0
+#if 0
+ moveq #'+',%d0
+ tst.w (%a0)
+ jeq .Lx1\@
+ moveq #'-',%d0
+.Lx1\@: printf \bit," %c",1,%d0
+ move.l (4,%a0),%d0
+ bclr #31,%d0
+ jne .Lx2\@
+ printf \bit,"0."
+ jra .Lx3\@
+.Lx2\@: printf \bit,"1."
+.Lx3\@: printf \bit,"%08x%08x",2,%d0,%a0@(8)
+ move.w (2,%a0),%d0
+ ext.l %d0
+ printf \bit,"E%04x",1,%d0
+#else
+ printf \bit," %08x%08x%08x",3,%a0@,%a0@(4),%a0@(8)
+#endif
+ movem.l (%sp)+,%d0/%a0
+#endif
+.endm
+
+.macro debug instr,args
+#ifdef FPU_EMU_DEBUG
+ \instr \args
+#endif
+.endm
+
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_M68K_SETUP_H */
diff --git a/include/asm-m68k/mmu_context.h b/include/asm-m68k/mmu_context.h
index 4850dd404..6a41f82e7 100644
--- a/include/asm-m68k/mmu_context.h
+++ b/include/asm-m68k/mmu_context.h
@@ -1,13 +1,159 @@
-#ifndef __68K_MMU_CONTEXT_H
-#define __68K_MMU_CONTEXT_H
+#ifndef __M68K_MMU_CONTEXT_H
+#define __M68K_MMU_CONTEXT_H
-/*
- * get a new mmu context.. do we need this on the m68k?
- */
-#define get_mmu_context(x) do { } while (0)
+#ifndef CONFIG_SUN3
-#define init_new_context(mm) do { } while(0)
-#define destroy_context(mm) do { } while(0)
-#define activate_context(tsk) do { } while(0)
+#include <asm/setup.h>
+#include <asm/page.h>
+extern inline void
+init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+{
+ mm->context = virt_to_phys(mm->pgd);
+}
+
+#define destroy_context(mm) do { } while(0)
+
+extern inline void switch_mm_0230(struct mm_struct *mm)
+{
+ unsigned long crp[2] = {
+ 0x80000000 | _PAGE_TABLE, mm->context
+ };
+ unsigned long tmp;
+
+ asm volatile (".chip 68030");
+
+ /* flush MC68030/MC68020 caches (they are virtually addressed) */
+ asm volatile (
+ "movec %%cacr,%0;"
+ "orw %1,%0; "
+ "movec %0,%%cacr"
+ : "=d" (tmp) : "di" (FLUSH_I_AND_D));
+
+ /* Switch the root pointer. For a 030-only kernel,
+ * avoid flushing the whole ATC, we only need to
+ * flush the user entries. The 68851 does this by
+ * itself. Avoid a runtime check here.
+ */
+ asm volatile (
+#ifdef CPU_M68030_ONLY
+ "pmovefd %0,%%crp; "
+ "pflush #0,#4"
+#else
+ "pmove %0,%%crp"
+#endif
+ : : "m" (crp[0]));
+
+ asm volatile (".chip 68k");
+}
+
+extern inline void switch_mm_0460(struct mm_struct *mm)
+{
+ asm volatile (".chip 68040");
+
+ /* flush address translation cache (user entries) */
+ asm volatile ("pflushan");
+
+ /* switch the root pointer */
+ asm volatile ("movec %0,%%urp" : : "r" (mm->context));
+
+ if (CPU_IS_060) {
+ unsigned long tmp;
+
+ /* clear user entries in the branch cache */
+ asm volatile (
+ "movec %%cacr,%0; "
+ "orl %1,%0; "
+ "movec %0,%%cacr"
+ : "=d" (tmp): "di" (0x00200000));
+ }
+
+ asm volatile (".chip 68k");
+}
+
+static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
+{
+ if (prev != next) {
+ if (CPU_IS_020_OR_030)
+ switch_mm_0230(next);
+ else
+ switch_mm_0460(next);
+ }
+}
+
+extern inline void activate_mm(struct mm_struct *prev_mm,
+ struct mm_struct *next_mm)
+{
+ next_mm->context = virt_to_phys(next_mm->pgd);
+
+ if (CPU_IS_020_OR_030)
+ switch_mm_0230(next_mm);
+ else
+ switch_mm_0460(next_mm);
+}
+
+#else /* CONFIG_SUN3 */
+#include <asm/sun3mmu.h>
+#include <linux/sched.h>
+
+extern unsigned long get_free_context(struct mm_struct *mm);
+extern void clear_context(unsigned long context);
+extern unsigned char ctx_next_to_die;
+extern unsigned char ctx_live[SUN3_CONTEXTS_NUM];
+
+/* set the context for a new task to unmapped */
+static inline void init_new_context(struct task_struct *tsk, struct mm_struct *mm)
+{
+ mm->context = SUN3_INVALID_CONTEXT;
+}
+
+/* find the context given to this process, and if it hasn't already
+ got one, go get one for it. */
+static inline void get_mmu_context(struct mm_struct *mm)
+{
+ if(mm->context == SUN3_INVALID_CONTEXT)
+ mm->context = get_free_context(mm);
+}
+
+#if 0
+/* we used to clear the context after the process exited. we still
+ should, things are faster that way... but very unstable. so just
+ clear out a context next time we need a new one.. consider this a
+ FIXME. */
+
+/* flush context if allocated... */
+static inline void destroy_context(struct mm_struct *mm)
+{
+ if(mm->context != SUN3_INVALID_CONTEXT)
+ clear_context(mm->context);
+}
+#else
+/* mark this context as dropped and set it for next death */
+static inline void destroy_context(struct mm_struct *mm)
+{
+ if(mm->context != SUN3_INVALID_CONTEXT) {
+ ctx_next_to_die = mm->context;
+ ctx_live[mm->context] = 0;
+ }
+}
+#endif
+
+static inline void activate_context(struct mm_struct *mm)
+{
+ get_mmu_context(mm);
+ sun3_put_context(mm->context);
+}
+
+static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
+{
+ activate_context(tsk->mm);
+}
+
+extern inline void activate_mm(struct mm_struct *prev_mm,
+ struct mm_struct *next_mm)
+{
+ activate_context(next_mm);
+}
+
+#endif
#endif
diff --git a/include/asm-m68k/movs.h b/include/asm-m68k/movs.h
new file mode 100644
index 000000000..67dbea369
--- /dev/null
+++ b/include/asm-m68k/movs.h
@@ -0,0 +1,55 @@
+#ifndef __MOVS_H__
+#define __MOVS_H__
+
+/*
+** movs.h
+**
+** Inline assembly macros to generate movs & related instructions
+*/
+
+/* Set DFC register value */
+
+#define SET_DFC(x) \
+ __asm__ __volatile__ (" movec %0,%/dfc" : : "d" (x));
+
+/* Get DFC register value */
+
+#define GET_DFC(x) \
+ __asm__ __volatile__ (" movec %/dfc, %0" : "=d" (x) : );
+
+/* Set SFC register value */
+
+#define SET_SFC(x) \
+ __asm__ __volatile__ (" movec %0,%/sfc" : : "d" (x));
+
+/* Get SFC register value */
+
+#define GET_SFC(x) \
+ __asm__ __volatile__ (" movec %/sfc, %0" : "=d" (x) : );
+
+#define SET_VBR(x) \
+ __asm__ __volatile__ (" movec %0,%/vbr" : : "r" (x));
+
+#define GET_VBR(x) \
+ __asm__ __volatile__ (" movec %/vbr, %0" : "=g" (x) : );
+
+/* Set a byte using the "movs" instruction */
+
+#define SET_CONTROL_BYTE(addr,value) \
+ __asm__ __volatile__ (" movsb %0, %1@" : : "d" (value), "a" (addr));
+
+/* Get a byte using the "movs" instruction */
+
+#define GET_CONTROL_BYTE(addr,value) \
+ __asm__ __volatile__ (" movsb %1@, %0" : "=d" (value) : "a" (addr));
+
+/* Set a (long)word using the "movs" instruction */
+
+#define SET_CONTROL_WORD(addr,value) \
+ __asm__ __volatile__ (" movsl %0, %1@" : : "d" (value), "a" (addr));
+
+/* Get a (long)word using the "movs" instruction */
+
+#define GET_CONTROL_WORD(addr,value) \
+ __asm__ __volatile__ (" movsl %1@, %0" : "=d" (value) : "a" (addr));
+#endif
diff --git a/include/asm-m68k/openprom.h b/include/asm-m68k/openprom.h
new file mode 100644
index 000000000..f855a5f09
--- /dev/null
+++ b/include/asm-m68k/openprom.h
@@ -0,0 +1,309 @@
+/* $Id: openprom.h,v 1.19 1996/09/25 03:51:08 davem Exp $ */
+#ifndef __SPARC_OPENPROM_H
+#define __SPARC_OPENPROM_H
+
+/* openprom.h: Prom structures and defines for access to the OPENBOOT
+ * prom routines and data areas.
+ *
+ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ */
+
+/* Empirical constants... */
+#ifdef CONFIG_SUN3
+#define KADB_DEBUGGER_BEGVM 0x0fee0000 /* There is no kadb yet but...*/
+#define LINUX_OPPROM_BEGVM 0x0fef0000
+#define LINUX_OPPROM_ENDVM 0x0ff10000 /* I think this is right - tm */
+#else
+#define KADB_DEBUGGER_BEGVM 0xffc00000 /* Where kern debugger is in virt-mem */
+#define LINUX_OPPROM_BEGVM 0xffd00000
+#define LINUX_OPPROM_ENDVM 0xfff00000
+#define LINUX_OPPROM_MAGIC 0x10010407
+#endif
+
+#ifndef __ASSEMBLY__
+/* V0 prom device operations. */
+struct linux_dev_v0_funcs {
+ int (*v0_devopen)(char *device_str);
+ int (*v0_devclose)(int dev_desc);
+ int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
+ int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
+ int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
+ int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
+ int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
+ int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
+ int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
+};
+
+/* V2 and later prom device operations. */
+struct linux_dev_v2_funcs {
+ int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
+ char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
+ void (*v2_dumb_mem_free)(char *va, unsigned sz);
+
+ /* To map devices into virtual I/O space. */
+ char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
+ void (*v2_dumb_munmap)(char *virta, unsigned size);
+
+ int (*v2_dev_open)(char *devpath);
+ void (*v2_dev_close)(int d);
+ int (*v2_dev_read)(int d, char *buf, int nbytes);
+ int (*v2_dev_write)(int d, char *buf, int nbytes);
+ int (*v2_dev_seek)(int d, int hi, int lo);
+
+ /* Never issued (multistage load support) */
+ void (*v2_wheee2)(void);
+ void (*v2_wheee3)(void);
+};
+
+struct linux_mlist_v0 {
+ struct linux_mlist_v0 *theres_more;
+ char *start_adr;
+ unsigned num_bytes;
+};
+
+struct linux_mem_v0 {
+ struct linux_mlist_v0 **v0_totphys;
+ struct linux_mlist_v0 **v0_prommap;
+ struct linux_mlist_v0 **v0_available; /* What we can use */
+};
+
+/* Arguments sent to the kernel from the boot prompt. */
+struct linux_arguments_v0 {
+ char *argv[8];
+ char args[100];
+ char boot_dev[2];
+ int boot_dev_ctrl;
+ int boot_dev_unit;
+ int dev_partition;
+ char *kernel_file_name;
+ void *aieee1; /* XXX */
+};
+
+/* V2 and up boot things. */
+struct linux_bootargs_v2 {
+ char **bootpath;
+ char **bootargs;
+ int *fd_stdin;
+ int *fd_stdout;
+};
+
+#ifdef CONFIG_SUN3
+struct linux_romvec {
+ char *pv_initsp;
+ int (*pv_startmon)(void);
+
+ int *diagberr;
+
+ struct linux_arguments_v0 **pv_v0bootargs;
+ unsigned *pv_sun3mem;
+
+ unsigned char (*pv_getchar)(void);
+ int (*pv_putchar)(int ch);
+ int (*pv_nbgetchar)(void);
+ int (*pv_nbputchar)(int ch);
+ unsigned char *pv_echo;
+ unsigned char *pv_insource;
+ unsigned char *pv_outsink;
+
+ int (*pv_getkey)(void);
+ int (*pv_initgetkey)(void);
+ unsigned int *pv_translation;
+ unsigned char *pv_keybid;
+ int *pv_screen_x;
+ int *pv_screen_y;
+ struct keybuf *pv_keybuf;
+
+ char *pv_monid;
+
+ /*
+ * Frame buffer output and terminal emulation
+ */
+
+ int (*pv_fbwritechar)(char);
+ int *pv_fbaddr;
+ char **pv_font;
+ int (*pv_fbwritestr)(char);
+
+ void (*pv_reboot)(char *bootstr);
+
+ /*
+ * Line input and parsing
+ */
+
+ unsigned char *pv_linebuf;
+ unsigned char **pv_lineptr;
+ int *pv_linesize;
+ int (*pv_getline)(void);
+ unsigned char (*pv_getnextchar)(void);
+ unsigned char (*pv_peeknextchar)(void);
+ int *pv_fbthere;
+ int (*pv_getnum)(void);
+
+ void (*pv_printf)(const char *fmt, ...);
+ int (*pv_printhex)(void);
+
+ unsigned char *pv_leds;
+ int (*pv_setleds)(void);
+
+ /*
+ * Non-maskable interrupt (nmi) information
+ */
+
+ int (*pv_nmiaddr)(void);
+ int (*pv_abortentry)(void);
+ int *pv_nmiclock;
+
+ int *pv_fbtype;
+
+ /*
+ * Assorted other things
+ */
+
+ unsigned pv_romvers;
+ struct globram *pv_globram;
+ char *pv_kbdzscc;
+
+ int *pv_keyrinit;
+ unsigned char *pv_keyrtick;
+ unsigned *pv_memoryavail;
+ long *pv_resetaddr;
+ long *pv_resetmap;
+
+ void (*pv_halt)(void);
+ unsigned char *pv_memorybitmap;
+ void (*pv_setctxt)(int ctxt, char *va, int pmeg);
+ void (*pv_vector_cmd)(void);
+ int dummy1z;
+ int dummy2z;
+ int dummy3z;
+ int dummy4z;
+};
+#else
+/* The top level PROM vector. */
+struct linux_romvec {
+ /* Version numbers. */
+ unsigned int pv_magic_cookie;
+ unsigned int pv_romvers;
+ unsigned int pv_plugin_revision;
+ unsigned int pv_printrev;
+
+ /* Version 0 memory descriptors. */
+ struct linux_mem_v0 pv_v0mem;
+
+ /* Node operations. */
+ struct linux_nodeops *pv_nodeops;
+
+ char **pv_bootstr;
+ struct linux_dev_v0_funcs pv_v0devops;
+
+ char *pv_stdin;
+ char *pv_stdout;
+#define PROMDEV_KBD 0 /* input from keyboard */
+#define PROMDEV_SCREEN 0 /* output to screen */
+#define PROMDEV_TTYA 1 /* in/out to ttya */
+#define PROMDEV_TTYB 2 /* in/out to ttyb */
+
+ /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
+ int (*pv_getchar)(void);
+ void (*pv_putchar)(int ch);
+
+ /* Non-blocking variants. */
+ int (*pv_nbgetchar)(void);
+ int (*pv_nbputchar)(int ch);
+
+ void (*pv_putstr)(char *str, int len);
+
+ /* Miscellany. */
+ void (*pv_reboot)(char *bootstr);
+ void (*pv_printf)(__const__ char *fmt, ...);
+ void (*pv_abort)(void);
+ __volatile__ int *pv_ticks;
+ void (*pv_halt)(void);
+ void (**pv_synchook)(void);
+
+ /* Evaluate a forth string, not different proto for V0 and V2->up. */
+ union {
+ void (*v0_eval)(int len, char *str);
+ void (*v2_eval)(char *str);
+ } pv_fortheval;
+
+ struct linux_arguments_v0 **pv_v0bootargs;
+
+ /* Get ether address. */
+ unsigned int (*pv_enaddr)(int d, char *enaddr);
+
+ struct linux_bootargs_v2 pv_v2bootargs;
+ struct linux_dev_v2_funcs pv_v2devops;
+
+ int filler[15];
+
+ /* This one is sun4c/sun4 only. */
+ void (*pv_setctxt)(int ctxt, char *va, int pmeg);
+
+ /* Prom version 3 Multiprocessor routines. This stuff is crazy.
+ * No joke. Calling these when there is only one cpu probably
+ * crashes the machine, have to test this. :-)
+ */
+
+ /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
+ * 'thiscontext' executing at address 'prog_counter'
+ */
+ int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
+ int thiscontext, char *prog_counter);
+
+ /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
+ * until a resume cpu call is made.
+ */
+ int (*v3_cpustop)(unsigned int whichcpu);
+
+ /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
+ * resume cpu call is made.
+ */
+ int (*v3_cpuidle)(unsigned int whichcpu);
+
+ /* v3_cpuresume() will resume processor 'whichcpu' executing
+ * starting with whatever 'pc' and 'npc' were left at the
+ * last 'idle' or 'stop' call.
+ */
+ int (*v3_cpuresume)(unsigned int whichcpu);
+};
+#endif
+
+/* Routines for traversing the prom device tree. */
+struct linux_nodeops {
+ int (*no_nextnode)(int node);
+ int (*no_child)(int node);
+ int (*no_proplen)(int node, char *name);
+ int (*no_getprop)(int node, char *name, char *val);
+ int (*no_setprop)(int node, char *name, char *val, int len);
+ char * (*no_nextprop)(int node, char *name);
+};
+
+/* More fun PROM structures for device probing. */
+#define PROMREG_MAX 16
+#define PROMVADDR_MAX 16
+#define PROMINTR_MAX 15
+
+struct linux_prom_registers {
+ int which_io; /* is this in OBIO space? */
+ char *phys_addr; /* The physical address of this register */
+ int reg_size; /* How many bytes does this register take up? */
+};
+
+struct linux_prom_irqs {
+ int pri; /* IRQ priority */
+ int vector; /* This is foobar, what does it do? */
+};
+
+/* Element of the "ranges" vector */
+struct linux_prom_ranges {
+ unsigned int ot_child_space;
+ unsigned int ot_child_base; /* Bus feels this */
+ unsigned int ot_parent_space;
+ unsigned int ot_parent_base; /* CPU looks from here */
+ unsigned int or_size;
+};
+
+#endif /* !(__ASSEMBLY__) */
+
+#endif /* !(__SPARC_OPENPROM_H) */
diff --git a/include/asm-m68k/oplib.h b/include/asm-m68k/oplib.h
index 4ef5f0317..84248e0eb 100644
--- a/include/asm-m68k/oplib.h
+++ b/include/asm-m68k/oplib.h
@@ -1,8 +1,297 @@
-/*
- * prototypes for dummy prom_* routines
+/* $Id: oplib.h,v 1.12 1996/10/31 06:29:13 davem Exp $
+ * oplib.h: Describes the interface and available routines in the
+ * Linux Prom library.
+ *
+ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*/
+#ifndef __SPARC_OPLIB_H
+#define __SPARC_OPLIB_H
+
+#include <asm/openprom.h>
+
+/* The master romvec pointer... */
+extern struct linux_romvec *romvec;
+
+/* Enumeration to describe the prom major version we have detected. */
+enum prom_major_version {
+ PROM_V0, /* Original sun4c V0 prom */
+ PROM_V2, /* sun4c and early sun4m V2 prom */
+ PROM_V3, /* sun4m and later, up to sun4d/sun4e machines V3 */
+ PROM_P1275, /* IEEE compliant ISA based Sun PROM, only sun4u */
+ PROM_AP1000, /* actually no prom at all */
+};
+
+extern enum prom_major_version prom_vers;
+/* Revision, and firmware revision. */
+extern unsigned int prom_rev, prom_prev;
+
+/* Root node of the prom device tree, this stays constant after
+ * initialization is complete.
+ */
+extern int prom_root_node;
+
+/* Pointer to prom structure containing the device tree traversal
+ * and usage utility functions. Only prom-lib should use these,
+ * users use the interface defined by the library only!
+ */
+extern struct linux_nodeops *prom_nodeops;
+
+/* The functions... */
+
+/* You must call prom_init() before using any of the library services,
+ * preferably as early as possible. Pass it the romvec pointer.
+ */
+extern void prom_init(struct linux_romvec *rom_ptr);
+
+/* Boot argument acquisition, returns the boot command line string. */
+extern char *prom_getbootargs(void);
+
+/* Device utilities. */
+
+/* Map and unmap devices in IO space at virtual addresses. Note that the
+ * virtual address you pass is a request and the prom may put your mappings
+ * somewhere else, so check your return value as that is where your new
+ * mappings really are!
+ *
+ * Another note, these are only available on V2 or higher proms!
+ */
+extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes);
+extern void prom_unmapio(char *virt_addr, unsigned int num_bytes);
+
+/* Device operations. */
+
+/* Open the device described by the passed string. Note, that the format
+ * of the string is different on V0 vs. V2->higher proms. The caller must
+ * know what he/she is doing! Returns the device descriptor, an int.
+ */
+extern int prom_devopen(char *device_string);
+
+/* Close a previously opened device described by the passed integer
+ * descriptor.
+ */
+extern int prom_devclose(int device_handle);
+
+/* Do a seek operation on the device described by the passed integer
+ * descriptor.
+ */
+extern void prom_seek(int device_handle, unsigned int seek_hival,
+ unsigned int seek_lowval);
+
+/* Machine memory configuration routine. */
+
+/* This function returns a V0 format memory descriptor table, it has three
+ * entries. One for the total amount of physical ram on the machine, one
+ * for the amount of physical ram available, and one describing the virtual
+ * areas which are allocated by the prom. So, in a sense the physical
+ * available is a calculation of the total physical minus the physical mapped
+ * by the prom with virtual mappings.
+ *
+ * These lists are returned pre-sorted, this should make your life easier
+ * since the prom itself is way too lazy to do such nice things.
+ */
+extern struct linux_mem_v0 *prom_meminfo(void);
+
+/* Miscellaneous routines, don't really fit in any category per se. */
+
+/* Reboot the machine with the command line passed. */
+extern void prom_reboot(char *boot_command);
+
+/* Evaluate the forth string passed. */
+extern void prom_feval(char *forth_string);
+
+/* Enter the prom, with possibility of continuation with the 'go'
+ * command in newer proms.
+ */
+extern void prom_cmdline(void);
+
+/* Enter the prom, with no chance of continuation for the stand-alone
+ * which calls this.
+ */
+extern void prom_halt(void);
+
+/* Set the PROM 'sync' callback function to the passed function pointer.
+ * When the user gives the 'sync' command at the prom prompt while the
+ * kernel is still active, the prom will call this routine.
+ *
+ * XXX The arguments are different on V0 vs. V2->higher proms, grrr! XXX
+ */
+typedef void (*sync_func_t)(void);
+extern void prom_setsync(sync_func_t func_ptr);
+
+/* Acquire the IDPROM of the root node in the prom device tree. This
+ * gets passed a buffer where you would like it stuffed. The return value
+ * is the format type of this idprom or 0xff on error.
+ */
+extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);
+
+/* Get the prom major version. */
+extern int prom_version(void);
+
+/* Get the prom plugin revision. */
+extern int prom_getrev(void);
+
+/* Get the prom firmware revision. */
+extern int prom_getprev(void);
+
+/* Character operations to/from the console.... */
+
+/* Non-blocking get character from console. */
+extern int prom_nbgetchar(void);
+
+/* Non-blocking put character to console. */
+extern int prom_nbputchar(char character);
+
+/* Blocking get character from console. */
+extern char prom_getchar(void);
+
+/* Blocking put character to console. */
+extern void prom_putchar(char character);
+
+/* Prom's internal printf routine, don't use in kernel/boot code. */
+void prom_printf(char *fmt, ...);
+
+/* Query for input device type */
+
+enum prom_input_device {
+ PROMDEV_IKBD, /* input from keyboard */
+ PROMDEV_ITTYA, /* input from ttya */
+ PROMDEV_ITTYB, /* input from ttyb */
+ PROMDEV_I_UNK,
+};
+
+extern enum prom_input_device prom_query_input_device(void);
+
+/* Query for output device type */
+
+enum prom_output_device {
+ PROMDEV_OSCREEN, /* to screen */
+ PROMDEV_OTTYA, /* to ttya */
+ PROMDEV_OTTYB, /* to ttyb */
+ PROMDEV_O_UNK,
+};
+
+extern enum prom_output_device prom_query_output_device(void);
+
+/* Multiprocessor operations... */
+
+/* Start the CPU with the given device tree node, context table, and context
+ * at the passed program counter.
+ */
+extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table,
+ int context, char *program_counter);
+
+/* Stop the CPU with the passed device tree node. */
+extern int prom_stopcpu(int cpunode);
+
+/* Idle the CPU with the passed device tree node. */
+extern int prom_idlecpu(int cpunode);
+
+/* Re-Start the CPU with the passed device tree node. */
+extern int prom_restartcpu(int cpunode);
+
+/* PROM memory allocation facilities... */
+
+/* Allocated at possibly the given virtual address a chunk of the
+ * indicated size.
+ */
+extern char *prom_alloc(char *virt_hint, unsigned int size);
+
+/* Free a previously allocated chunk. */
+extern void prom_free(char *virt_addr, unsigned int size);
+
+/* Sun4/sun4c specific memory-management startup hook. */
+
+/* Map the passed segment in the given context at the passed
+ * virtual address.
+ */
+extern void prom_putsegment(int context, unsigned long virt_addr,
+ int physical_segment);
+
+/* PROM device tree traversal functions... */
+
+/* Get the child node of the given node, or zero if no child exists. */
+extern int prom_getchild(int parent_node);
+
+/* Get the next sibling node of the given node, or zero if no further
+ * siblings exist.
+ */
+extern int prom_getsibling(int node);
+
+/* Get the length, at the passed node, of the given property type.
+ * Returns -1 on error (ie. no such property at this node).
+ */
+extern int prom_getproplen(int thisnode, char *property);
+
+/* Fetch the requested property using the given buffer. Returns
+ * the number of bytes the prom put into your buffer or -1 on error.
+ */
+extern int prom_getproperty(int thisnode, char *property,
+ char *prop_buffer, int propbuf_size);
+
+/* Acquire an integer property. */
+extern int prom_getint(int node, char *property);
+
+/* Acquire an integer property, with a default value. */
extern int prom_getintdefault(int node, char *property, int defval);
+
+/* Acquire a boolean property, 0=FALSE 1=TRUE. */
extern int prom_getbool(int node, char *prop);
-extern void prom_printf(char *fmt, ...);
-extern void prom_halt(void) __attribute__ ((noreturn));
+
+/* Acquire a string property, null string on error. */
+extern void prom_getstring(int node, char *prop, char *buf, int bufsize);
+
+/* Does the passed node have the given "name"? YES=1 NO=0 */
+extern int prom_nodematch(int thisnode, char *name);
+
+/* Puts in buffer a prom name in the form name@x,y or name (x for which_io
+ * and y for first regs phys address
+ */
+extern int prom_getname(int node, char *buf, int buflen);
+
+/* Search all siblings starting at the passed node for "name" matching
+ * the given string. Returns the node on success, zero on failure.
+ */
+extern int prom_searchsiblings(int node_start, char *name);
+
+/* Return the first property type, as a string, for the given node.
+ * Returns a null string on error.
+ */
+extern char *prom_firstprop(int node);
+
+/* Returns the next property after the passed property for the given
+ * node. Returns null string on failure.
+ */
+extern char *prom_nextprop(int node, char *prev_property);
+
+/* Returns 1 if the specified node has given property. */
+extern int prom_node_has_property(int node, char *property);
+
+/* Set the indicated property at the given node with the passed value.
+ * Returns the number of bytes of your value that the prom took.
+ */
+extern int prom_setprop(int node, char *prop_name, char *prop_value,
+ int value_size);
+
+extern int prom_pathtoinode(char *path);
+extern int prom_inst2pkg(int);
+
+/* Dorking with Bus ranges... */
+
+/* Adjust reg values with the passed ranges. */
+extern void prom_adjust_regs(struct linux_prom_registers *regp, int nregs,
+ struct linux_prom_ranges *rangep, int nranges);
+
+/* Adjust child ranges with the passed parent ranges. */
+extern void prom_adjust_ranges(struct linux_prom_ranges *cranges, int ncranges,
+ struct linux_prom_ranges *pranges, int npranges);
+
+/* Apply promlib probed OBIO ranges to registers. */
+extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);
+
+/* Apply ranges of any prom node (and optionally parent node as well) to registers. */
+extern void prom_apply_generic_ranges(int node, int parent,
+ struct linux_prom_registers *sbusregs, int nregs);
+
+
+#endif /* !(__SPARC_OPLIB_H) */
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 8cc546aac..6a3d9df66 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -4,14 +4,27 @@
#include <linux/config.h>
/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT 12
-#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#ifndef CONFIG_SUN3
+#define PAGE_SHIFT (12)
+#define PAGE_SIZE (4096)
+#else
+#define PAGE_SHIFT (13)
+#define PAGE_SIZE (8192)
+#endif
#define PAGE_MASK (~(PAGE_SIZE-1))
#ifdef __KERNEL__
#include <asm/setup.h>
+#if PAGE_SHIFT < 13
+#define KTHREAD_SIZE (8192)
+#else
+#define KTHREAD_SIZE PAGE_SIZE
+#endif
+
+#ifndef __ASSEMBLY__
+
#define STRICT_MM_TYPECHECKS
#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
@@ -110,7 +123,13 @@ typedef unsigned long pgprot_t;
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
/* This handles the memory map.. */
+#ifndef CONFIG_SUN3
#define PAGE_OFFSET 0
+#else
+#define PAGE_OFFSET 0x0E000000
+#endif
+
+#ifndef CONFIG_SUN3
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
/*
* A hacky workaround for the problems with mmap() of frame buffer
@@ -128,8 +147,51 @@ extern inline void *__va(unsigned long physaddr)
#endif
return (void *)(physaddr+PAGE_OFFSET);
}
+#else /* !CONFIG_SUN3 */
+/* This #define is a horrible hack to suppress lots of warnings. --m */
+#define __pa(x) ___pa((unsigned long)x)
+static inline unsigned long ___pa(unsigned long x)
+{
+ if(x == 0)
+ return 0;
+ if(x > PAGE_OFFSET)
+ return (x-PAGE_OFFSET);
+ else
+ return (x+0x2000000);
+}
+
+static inline void *__va(unsigned long x)
+{
+ if(x == 0)
+ return (void *)0;
+
+ if(x < 0x2000000)
+ return (void *)(x+PAGE_OFFSET);
+ else
+ return (void *)(x-0x2000000);
+}
+#endif /* CONFIG_SUN3 */
+
#define MAP_NR(addr) (__pa(addr) >> PAGE_SHIFT)
+#endif /* !__ASSEMBLY__ */
+
+#ifndef CONFIG_SUN3
+#define BUG() do { \
+ printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+ asm volatile("illegal"); \
+} while (0)
+#else
+#define BUG() do { \
+ printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+ panic("BUG!"); \
+} while (0)
+#endif
+
+#define PAGE_BUG(page) do { \
+ BUG(); \
+} while (0)
+
#endif /* __KERNEL__ */
#endif /* _M68K_PAGE_H */
diff --git a/include/asm-m68k/param.h b/include/asm-m68k/param.h
index 27c9834e9..af023b547 100644
--- a/include/asm-m68k/param.h
+++ b/include/asm-m68k/param.h
@@ -6,7 +6,11 @@
#define HZ_TO_STD(a) (a)
#endif
+#ifndef CONFIG_SUN3
#define EXEC_PAGESIZE 4096
+#else
+#define EXEC_PAGESIZE 8192
+#endif
#ifndef NGROUPS
#define NGROUPS 32
diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h
index e00ff1aed..c94acfc38 100644
--- a/include/asm-m68k/pgtable.h
+++ b/include/asm-m68k/pgtable.h
@@ -6,7 +6,7 @@
#ifndef __ASSEMBLY__
#include <asm/processor.h>
-#include <linux/tasks.h>
+#include <linux/threads.h>
/*
* This file contains the functions and defines necessary to modify and use
@@ -264,21 +264,6 @@ extern inline void flush_tlb_kernel_page(unsigned long addr)
#define PTRS_PER_PGD 128
#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
-/* the no. of pointers that fit on a page: this will go away */
-#define PTRS_PER_PAGE (PAGE_SIZE/sizeof(void*))
-
-typedef pgd_t pgd_table[PTRS_PER_PGD];
-typedef pmd_t pmd_table[PTRS_PER_PMD];
-typedef pte_t pte_table[PTRS_PER_PTE];
-
-#define PGD_TABLES_PER_PAGE (PAGE_SIZE/sizeof(pgd_table))
-#define PMD_TABLES_PER_PAGE (PAGE_SIZE/sizeof(pmd_table))
-#define PTE_TABLES_PER_PAGE (PAGE_SIZE/sizeof(pte_table))
-
-typedef pgd_table pgd_tablepage[PGD_TABLES_PER_PAGE];
-typedef pmd_table pmd_tablepage[PMD_TABLES_PER_PAGE];
-typedef pte_table pte_tablepage[PTE_TABLES_PER_PAGE];
-
/* Virtual address region for use by kernel_map() */
#define KMAP_START 0xd0000000
#define KMAP_END 0xf0000000
@@ -315,6 +300,14 @@ typedef pte_table pte_tablepage[PTE_TABLES_PER_PAGE];
#define _PAGE_CACHE040 0x020 /* 68040 cache mode, cachable, copyback */
#define _PAGE_CACHE040W 0x000 /* 68040 cache mode, cachable, write-through */
+/* Page protection values within PTE. */
+#define SUN3_PAGE_VALID (0x80000000)
+#define SUN3_PAGE_WRITEABLE (0x40000000)
+#define SUN3_PAGE_SYSTEM (0x20000000)
+#define SUN3_PAGE_NOCACHE (0x10000000)
+#define SUN3_PAGE_ACCESSED (0x02000000)
+#define SUN3_PAGE_MODIFIED (0x01000000)
+
#define _DESCTYPE_MASK 0x003
#define _CACHEMASK040 (~0x060)
@@ -430,9 +423,9 @@ extern inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
{
int i;
unsigned long ptbl;
- ptbl = virt_to_phys(ptep);
- for (i = 0; i < 16; i++, ptbl += sizeof(pte_table)/16)
- pmdp->pmd[i] = _PAGE_TABLE | _PAGE_ACCESSED | ptbl;
+ ptbl = virt_to_phys(ptep) | _PAGE_TABLE | _PAGE_ACCESSED;
+ for (i = 0; i < 16; i++, ptbl += (sizeof(pte_t)*PTRS_PER_PTE/16))
+ pmdp->pmd[i] = ptbl;
}
extern inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
@@ -499,42 +492,6 @@ extern inline pte_t pte_mknocache(pte_t pte)
}
extern inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_supervisor_cachemode; return pte; }
-/* to set the page-dir */
-extern inline void SET_PAGE_DIR(struct task_struct * tsk, pgd_t * pgdir)
-{
- tsk->tss.crp[0] = 0x80000000 | _PAGE_TABLE;
- tsk->tss.crp[1] = virt_to_phys(pgdir);
- if (tsk == current) {
- if (CPU_IS_040_OR_060)
- __asm__ __volatile__ (".chip 68040\n\t"
- "pflushan\n\t"
- "movec %0,%%urp\n\t"
- ".chip 68k"
- : : "r" (tsk->tss.crp[1]));
- else {
- unsigned long tmp;
- __asm__ __volatile__ ("movec %%cacr,%0\n\t"
- "orw #0x0808,%0\n\t"
- "movec %0,%%cacr"
- : "=d" (tmp));
- /* For a 030-only kernel, avoid flushing the whole
- ATC, we only need to flush the user entries.
- The 68851 does this by itself. Avoid a runtime
- check here. */
- __asm__ __volatile__ (
-#ifdef CPU_M68030_ONLY
- ".chip 68030\n\t"
- "pmovefd %0,%%crp\n\t"
- ".chip 68k\n\t"
- "pflush #0,#4"
-#else
- "pmove %0,%%crp"
-#endif
- : : "m" (tsk->tss.crp[0]));
- }
- }
-}
-
#define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address))
/* to find an entry in a page-table-directory */
@@ -828,4 +785,6 @@ extern inline void update_mmu_cache(struct vm_area_struct * vma,
#define PageSkip(page) (0)
#define kern_addr_valid(addr) (1)
+#define io_remap_page_range remap_page_range
+
#endif /* _M68K_PGTABLE_H */
diff --git a/include/asm-m68k/processor.h b/include/asm-m68k/processor.h
index b399e9703..7b6564813 100644
--- a/include/asm-m68k/processor.h
+++ b/include/asm-m68k/processor.h
@@ -15,17 +15,41 @@
#include <asm/segment.h>
#include <asm/fpu.h>
+#include <asm/ptrace.h>
+
+extern inline unsigned long rdusp(void) {
+ unsigned long usp;
+
+ __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
+ return usp;
+}
+
+extern inline void wrusp(unsigned long usp) {
+ __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
+}
/*
* User space process size: 3.75GB. This is hardcoded into a few places,
* so don't change it unless you know what you are doing.
*/
+#ifndef CONFIG_SUN3
#define TASK_SIZE (0xF0000000UL)
+#else
+#ifdef __ASSEMBLY__
+#define TASK_SIZE (0x0E000000)
+#else
+#define TASK_SIZE (0x0E000000UL)
+#endif
+#endif
/* This decides where the kernel will search for a free chunk of vm
* space during mmap's.
*/
+#ifndef CONFIG_SUN3
#define TASK_UNMAPPED_BASE 0xC0000000UL
+#else
+#define TASK_UNMAPPED_BASE 0x0A000000UL
+#endif
#define TASK_UNMAPPED_ALIGN(addr, off) PAGE_ALIGN(addr)
/*
@@ -53,7 +77,7 @@ struct thread_struct {
#define INIT_MMAP { &init_mm, 0, 0x40000000, NULL, __pgprot(_PAGE_PRESENT|_PAGE_ACCESSED), VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-#define INIT_TSS { \
+#define INIT_THREAD { \
sizeof(init_stack) + (unsigned long) init_stack, 0, \
PS_S, __KERNEL_DS, \
{0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \
@@ -73,6 +97,9 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
wrusp(usp);
}
+/* Forward declaration, a strange C thing */
+struct task_struct;
+
/* Free all resources held by a thread. */
static inline void release_thread(struct task_struct *dead_task)
{
@@ -80,7 +107,7 @@ static inline void release_thread(struct task_struct *dead_task)
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
-#define copy_segments(nr, tsk, mm) do { } while (0)
+#define copy_segments(tsk, mm) do { } while (0)
#define release_segments(mm) do { } while (0)
#define forget_segments() do { } while (0)
@@ -107,6 +134,8 @@ extern inline unsigned long thread_saved_pc(struct thread_struct *t)
return sw->retpc;
}
+#define THREAD_SIZE (2*PAGE_SIZE)
+
/* Allocation and freeing of basic task resources. */
#define alloc_task_struct() \
((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
@@ -115,14 +144,4 @@ extern inline unsigned long thread_saved_pc(struct thread_struct *t)
#define init_task (init_task_union.task)
#define init_stack (init_task_union.stack)
-/*
- * Return_address is a replacement for __builtin_return_address(count)
- * which on certain architectures cannot reasonably be implemented in GCC
- * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
- * Note that __builtin_return_address(x>=1) is forbidden because the GCC
- * aborts compilation on some CPUs. It's simply not possible to unwind
- * some CPU's stackframes.
- */
-#define return_address() __builtin_return_address(0)
-
#endif
diff --git a/include/asm-m68k/resource.h b/include/asm-m68k/resource.h
index 09ae4cfd2..11376a494 100644
--- a/include/asm-m68k/resource.h
+++ b/include/asm-m68k/resource.h
@@ -28,8 +28,8 @@
{_STK_LIM, LONG_MAX}, \
{ 0, LONG_MAX}, \
{LONG_MAX, LONG_MAX}, \
- {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, \
- {NR_OPEN, NR_OPEN}, \
+ {0, 0}, \
+ {INR_OPEN, INR_OPEN}, \
{LONG_MAX, LONG_MAX}, \
{LONG_MAX, LONG_MAX} \
}
diff --git a/include/asm-m68k/sbus.h b/include/asm-m68k/sbus.h
new file mode 100644
index 000000000..160d76c6b
--- /dev/null
+++ b/include/asm-m68k/sbus.h
@@ -0,0 +1,20 @@
+/*
+ * some sbus structures and macros to make usage of sbus drivers possible
+ */
+
+#ifndef __M68K_SBUS_H
+#define __M68K_SBUS_H
+
+struct linux_sbus_device {
+ struct {
+ unsigned int which_io;
+ unsigned int phys_addr;
+ } reg_addrs[1];
+};
+
+extern void *sparc_alloc_io (u32, void *, int, char *, u32, int);
+#define sparc_alloc_io(a,b,c,d,e,f) (a)
+
+#define ARCH_SUN4 0
+
+#endif
diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h
index e1bdb10f4..cb4f38230 100644
--- a/include/asm-m68k/semaphore.h
+++ b/include/asm-m68k/semaphore.h
@@ -2,10 +2,11 @@
#define _M68K_SEMAPHORE_H
#include <linux/linkage.h>
+#include <linux/wait.h>
+#include <linux/spinlock.h>
#include <asm/system.h>
#include <asm/atomic.h>
-#include <asm/spinlock.h>
/*
* SMP- and interrupt-safe semaphores..
@@ -19,10 +20,45 @@ struct semaphore {
atomic_t count;
atomic_t waking;
wait_queue_head_t wait;
+#if WAITQUEUE_DEBUG
+ long __magic;
+#endif
};
-#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL })
-#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL })
+#if WAITQUEUE_DEBUG
+# define __SEM_DEBUG_INIT(name) \
+ , (long)&(name).__magic
+#else
+# define __SEM_DEBUG_INIT(name)
+#endif
+
+#define __SEMAPHORE_INITIALIZER(name,count) \
+{ ATOMIC_INIT(count), ATOMIC_INIT(0), __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
+ __SEM_DEBUG_INIT(name) }
+
+#define __MUTEX_INITIALIZER(name) \
+ __SEMAPHORE_INITIALIZER(name,1)
+
+#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
+ struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
+
+#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
+#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
+
+extern inline void sema_init (struct semaphore *sem, int val)
+{
+ *sem = (struct semaphore)__SEMAPHORE_INITIALIZER(*sem, val);
+}
+
+static inline void init_MUTEX (struct semaphore *sem)
+{
+ sema_init(sem, 1);
+}
+
+static inline void init_MUTEX_LOCKED (struct semaphore *sem)
+{
+ sema_init(sem, 0);
+}
asmlinkage void __down_failed(void /* special register calling convention */);
asmlinkage int __down_failed_interruptible(void /* params in registers */);
@@ -34,8 +70,6 @@ asmlinkage int __down_interruptible(struct semaphore * sem);
asmlinkage int __down_trylock(struct semaphore * sem);
asmlinkage void __up(struct semaphore * sem);
-#define sema_init(sem, val) atomic_set(&((sem)->count), val)
-
/*
* This is ugly, but we want the default case to fall through.
* "down_failed" is a special asm handler that calls the C
@@ -44,6 +78,11 @@ asmlinkage void __up(struct semaphore * sem);
extern inline void down(struct semaphore * sem)
{
register struct semaphore *sem1 __asm__ ("%a1") = sem;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
__asm__ __volatile__(
"| atomic down operation\n\t"
"subql #1,%0@\n\t"
@@ -64,6 +103,10 @@ extern inline int down_interruptible(struct semaphore * sem)
register struct semaphore *sem1 __asm__ ("%a1") = sem;
register int result __asm__ ("%d0");
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
__asm__ __volatile__(
"| atomic interruptible down operation\n\t"
"subql #1,%1@\n\t"
@@ -86,6 +129,10 @@ extern inline int down_trylock(struct semaphore * sem)
register struct semaphore *sem1 __asm__ ("%a1") = sem;
register int result __asm__ ("%d0");
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
__asm__ __volatile__(
"| atomic down trylock operation\n\t"
"subql #1,%1@\n\t"
@@ -112,6 +159,11 @@ extern inline int down_trylock(struct semaphore * sem)
extern inline void up(struct semaphore * sem)
{
register struct semaphore *sem1 __asm__ ("%a1") = sem;
+
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
__asm__ __volatile__(
"| atomic up operation\n\t"
"addql #1,%0@\n\t"
diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h
index d857208fe..b2b11ed76 100644
--- a/include/asm-m68k/setup.h
+++ b/include/asm-m68k/setup.h
@@ -88,7 +88,9 @@ extern unsigned long m68k_machtype;
#endif
#if defined(CONFIG_SUN3)
-# error Currently no Sun-3 support!
+#define MACH_IS_SUN3 (1)
+#define MACH_SUN3_ONLY (1)
+#define MACH_TYPE (MACH_SUN3)
#else
#define MACH_IS_SUN3 (0)
#endif
@@ -243,7 +245,7 @@ extern unsigned long m68k_machtype;
#ifndef __ASSEMBLY__
extern unsigned long m68k_cputype;
extern unsigned long m68k_fputype;
-extern unsigned long m68k_mmutype; /* Not really used yet */
+extern unsigned long m68k_mmutype; /* Not really used yet */
/*
* m68k_is040or060 is != 0 for a '040 or higher;
@@ -255,38 +257,58 @@ extern int m68k_is040or060;
#if !defined(CONFIG_M68020)
# define CPU_IS_020 (0)
+# define MMU_IS_851 (0)
+# define MMU_IS_SUN3 (0)
#elif defined(CONFIG_M68030) || defined(CONFIG_M68040) || defined(CONFIG_M68060)
# define CPU_IS_020 (m68k_cputype & CPU_68020)
+# define MMU_IS_851 (m68k_cputype & MMU_68851)
+# define MMU_IS_SUN3 (0) /* Sun3 not supported with other CPU enabled */
#else
# define CPU_M68020_ONLY
# define CPU_IS_020 (1)
+#ifdef MACH_SUN3_ONLY
+# define MMU_IS_SUN3 (1)
+# define MMU_IS_851 (0)
+#else
+# define MMU_IS_SUN3 (0)
+# define MMU_IS_851 (1)
+#endif
#endif
#if !defined(CONFIG_M68030)
# define CPU_IS_030 (0)
+# define MMU_IS_030 (0)
#elif defined(CONFIG_M68020) || defined(CONFIG_M68040) || defined(CONFIG_M68060)
# define CPU_IS_030 (m68k_cputype & CPU_68030)
+# define MMU_IS_030 (m68k_mmutype & MMU_68030)
#else
# define CPU_M68030_ONLY
# define CPU_IS_030 (1)
+# define MMU_IS_030 (1)
#endif
#if !defined(CONFIG_M68040)
# define CPU_IS_040 (0)
+# define MMU_IS_040 (0)
#elif defined(CONFIG_M68020) || defined(CONFIG_M68030) || defined(CONFIG_M68060)
# define CPU_IS_040 (m68k_cputype & CPU_68040)
+# define MMU_IS_040 (m68k_mmutype & MMU_68040)
#else
# define CPU_M68040_ONLY
# define CPU_IS_040 (1)
+# define MMU_IS_040 (1)
#endif
#if !defined(CONFIG_M68060)
# define CPU_IS_060 (0)
+# define MMU_IS_060 (0)
#elif defined(CONFIG_M68020) || defined(CONFIG_M68030) || defined(CONFIG_M68040)
# define CPU_IS_060 (m68k_cputype & CPU_68060)
+# define MMU_IS_060 (m68k_mmutype & MMU_68060)
#else
# define CPU_M68060_ONLY
# define CPU_IS_060 (1)
+# define MMU_IS_060 (1)
#endif
#if !defined(CONFIG_M68020) && !defined(CONFIG_M68030)
@@ -315,6 +337,16 @@ extern int m68k_is040or060;
#define CPU_TYPE (m68k_cputype)
+#ifdef CONFIG_M68KFPU_EMU
+# ifdef CONFIG_M68KFPU_EMU_ONLY
+# define FPU_IS_EMU (1)
+# else
+# define FPU_IS_EMU (!m68k_fputype)
+# endif
+#else
+# define FPU_IS_EMU (0)
+#endif
+
/*
* Miscellaneous
diff --git a/include/asm-m68k/shm.h b/include/asm-m68k/shm.h
index f59bbc39f..6e5bdf131 100644
--- a/include/asm-m68k/shm.h
+++ b/include/asm-m68k/shm.h
@@ -12,8 +12,14 @@
bit 31 (SHM_READ_ONLY) flag whether the page belongs to a read-only attach
*/
/* on the m68k both bits 0 and 1 must be zero */
+/* format on the sun3 is similar, but bits 30, 31 are set to zero and all
+ others are reduced by 2. --m */
+#ifndef CONFIG_SUN3
#define SHM_ID_SHIFT 9
+#else
+#define SHM_ID_SHIFT 7
+#endif
#define _SHM_ID_BITS 7
#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1)
diff --git a/include/asm-m68k/shmparam.h b/include/asm-m68k/shmparam.h
index d9e6a9e05..2b8640c17 100644
--- a/include/asm-m68k/shmparam.h
+++ b/include/asm-m68k/shmparam.h
@@ -2,8 +2,13 @@
#define _M68K_SHMPARAM_H
/* address range for shared memory attaches if no address passed to shmat() */
+#ifndef CONFIG_SUN3
#define SHM_RANGE_START 0xC0000000
#define SHM_RANGE_END 0xD0000000
+#else
+#define SHM_RANGE_START 0x0C000000
+#define SHM_RANGE_END 0x0D000000
+#endif
/*
* Format of a swap-entry for shared memory pages currently out in
diff --git a/include/asm-m68k/smplock.h b/include/asm-m68k/smplock.h
index e62326a10..1590fafe9 100644
--- a/include/asm-m68k/smplock.h
+++ b/include/asm-m68k/smplock.h
@@ -4,7 +4,7 @@
* Default SMP lock implementation
*/
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-m68k/softirq.h b/include/asm-m68k/softirq.h
index dc5f56728..f27b11256 100644
--- a/include/asm-m68k/softirq.h
+++ b/include/asm-m68k/softirq.h
@@ -46,6 +46,9 @@ extern inline void remove_bh(int nr)
extern unsigned int local_bh_count[NR_CPUS];
+#define local_bh_disable() (local_bh_count[smp_processor_id()]++)
+#define local_bh_enable() (local_bh_count[smp_processor_id()]--)
+
extern inline void start_bh_atomic(void)
{
local_bh_count[smp_processor_id()]++;
diff --git a/include/asm-m68k/spinlock.h b/include/asm-m68k/spinlock.h
index 1c3ace986..fec148175 100644
--- a/include/asm-m68k/spinlock.h
+++ b/include/asm-m68k/spinlock.h
@@ -1,66 +1,6 @@
#ifndef __M68K_SPINLOCK_H
#define __M68K_SPINLOCK_H
-/*
- * We don't do SMP on the m68k .... at least not yet.
- */
-
-/*
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
-typedef struct { } spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
-#else
-typedef struct { int gcc_is_buggy; } spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-#endif
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) do { } while(0)
-#define spin_trylock(lock) do { } while(0)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) do { } while(0)
-#define spin_lock_irq(lock) cli()
-#define spin_unlock_irq(lock) sti()
-
-#define spin_lock_irqsave(lock, flags) \
- do { save_flags(flags); cli(); } while (0)
-#define spin_unlock_irqrestore(lock, flags) \
- restore_flags(flags)
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- *
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
-typedef struct { } rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { }
-#else
-typedef struct { int gcc_is_buggy; } rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
-#endif
-
-#define read_lock(lock) do { } while(0)
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) do { } while(0)
-#define write_unlock(lock) do { } while(0)
-#define read_lock_irq(lock) cli()
-#define read_unlock_irq(lock) sti()
-#define write_lock_irq(lock) cli()
-#define write_unlock_irq(lock) sti()
-
-#define read_lock_irqsave(lock, flags) save_and_cli(flags)
-#define read_unlock_irqrestore(lock, flags) restore_flags(flags)
-#define write_lock_irqsave(lock, flags) save_and_cli(flags)
-#define write_unlock_irqrestore(lock, flags) restore_flags(flags)
+#error "m68k doesn't do SMP"
#endif
diff --git a/include/asm-m68k/sun3-head.h b/include/asm-m68k/sun3-head.h
new file mode 100644
index 000000000..d2c9f39da
--- /dev/null
+++ b/include/asm-m68k/sun3-head.h
@@ -0,0 +1,12 @@
+/* $Id: head.h,v 1.32 1996/12/04 00:12:48 ecd Exp $ */
+#ifndef __SUN3_HEAD_H
+#define __SUN3_HEAD_H
+
+#define KERNBASE 0xE000000 /* First address the kernel will eventually be */
+#define LOAD_ADDR 0x4000 /* prom jumps to us here unless this is elf /boot */
+#define BI_START (KERNBASE + 0x3000) /* beginning of the bootinfo records */
+#define FC_CONTROL 3
+#define FC_SUPERD 5
+#define FC_CPU 7
+
+#endif __SUN3_HEAD_H
diff --git a/include/asm-m68k/sun3ints.h b/include/asm-m68k/sun3ints.h
new file mode 100644
index 000000000..2ea17900d
--- /dev/null
+++ b/include/asm-m68k/sun3ints.h
@@ -0,0 +1,31 @@
+/*
+ * sun3ints.h -- Linux/Sun3 interrupt handling code definitions
+ *
+ * Erik Verbruggen (erik@bigmama.xtdnet.nl)
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+
+#ifndef SUN3INTS_H
+#define SUN3INTS_H
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/kernel_stat.h>
+#include <linux/interrupt.h>
+#include <asm/segment.h>
+#include <asm/intersil.h>
+#include <asm/oplib.h>
+
+void sun3_enable_irq(unsigned int irq);
+void sun3_disable_irq(unsigned int irq);
+int sun3_request_irq(unsigned int irq,
+ void (*handler)(int, void *, struct pt_regs *),
+ unsigned long flags, const char *devname, void *dev_id
+ );
+
+#endif /* SUN3INTS_H */
diff --git a/include/asm-m68k/sun3mmu.h b/include/asm-m68k/sun3mmu.h
new file mode 100644
index 000000000..7277c2b77
--- /dev/null
+++ b/include/asm-m68k/sun3mmu.h
@@ -0,0 +1,167 @@
+/*
+ * Definitions for Sun3 custom MMU.
+ */
+#include <asm/movs.h>
+
+#ifndef __SUN3_MMU_H__
+#define __SUN3_MMU_H__
+
+#define FC_CONTROL 3
+
+/* MMU characteristics. */
+#define SUN3_SEGMAPS_PER_CONTEXT 2048
+#define SUN3_PMEGS_NUM 256
+#define SUN3_CONTEXTS_NUM 8
+
+#define SUN3_PMEG_SIZE_BITS 17
+#define SUN3_PMEG_SIZE (1 << SUN3_PMEG_SIZE_BITS)
+#define SUN3_PMEG_MASK (SUN3_PMEG_SIZE - 1)
+
+#define SUN3_PTE_SIZE_BITS 13
+#define SUN3_PTE_SIZE (1 << SUN3_PTE_SIZE_BITS)
+#define SUN3_PTE_MASK (SUN3_PTE_SIZE - 1)
+
+#define SUN3_CONTROL_MASK (0x0FFFFFFC)
+#define SUN3_INVALID_PMEG 255
+#define SUN3_INVALID_CONTEXT 255
+
+#define AC_IDPROM 0x00000000 /* 34 ID PROM, R/O, byte, 32 bytes */
+#define AC_PAGEMAP 0x10000000 /* 3 Pagemap R/W, long */
+#define AC_SEGMAP 0x20000000 /* 3 Segment map, byte */
+#define AC_CONTEXT 0x30000000 /* 34c current mmu-context */
+#define AC_SENABLE 0x40000000 /* 34c system dvma/cache/reset enable reg*/
+#define AC_UDVMA_ENB 0x50000000 /* 34 Not used on Sun boards, byte */
+#define AC_BUS_ERROR 0x60000000 /* 34 Cleared on read, byte. */
+#define AC_SYNC_ERR 0x60000000 /* c fault type */
+#define AC_SYNC_VA 0x60000004 /* c fault virtual address */
+#define AC_ASYNC_ERR 0x60000008 /* c asynchronous fault type */
+#define AC_ASYNC_VA 0x6000000c /* c async fault virtual address */
+#define AC_LEDS 0x70000000 /* 34 Zero turns on LEDs, byte */
+#define AC_CACHETAGS 0x80000000 /* 34c direct access to the VAC tags */
+#define AC_CACHEDDATA 0x90000000 /* 3 c direct access to the VAC data */
+#define AC_UDVMA_MAP 0xD0000000 /* 4 Not used on Sun boards, byte */
+#define AC_VME_VECTOR 0xE0000000 /* 4 For non-Autovector VME, byte */
+#define AC_BOOT_SCC 0xF0000000 /* 34 bypass to access Zilog 8530. byte.*/
+
+#define SUN3_PAGE_CHG_MASK (SUN3_PAGE_PGNUM_MASK \
+ | SUN3_PAGE_ACCESSED | SUN3_PAGE_MODIFIED)
+
+/* Bus access type within PTE. */
+#define SUN3_PAGE_TYPE_MASK (0x0c000000)
+#define SUN3_PAGE_TYPE_MEMORY (0x00000000)
+#define SUN3_PAGE_TYPE_IO (0x04000000)
+#define SUN3_PAGE_TYPE_VME16 (0x08000000)
+#define SUN3_PAGE_TYPE_VME32 (0x0c000000)
+
+/* Mask for page number within PTE. */
+#define SUN3_PAGE_PGNUM_MASK (0x0007FFFF)
+
+/* Bits within bus-error register. */
+#define SUN3_BUSERR_WATCHDOG (0x01)
+#define SUN3_BUSERR_unused (0x02)
+#define SUN3_BUSERR_FPAENERR (0x04)
+#define SUN3_BUSERR_FPABERR (0x08)
+#define SUN3_BUSERR_VMEBERR (0x10)
+#define SUN3_BUSERR_TIMEOUT (0x20)
+#define SUN3_BUSERR_PROTERR (0x40)
+#define SUN3_BUSERR_INVALID (0x80)
+
+#ifndef __ASSEMBLY__
+
+/* Read bus error status register (implicitly clearing it). */
+extern __inline__ unsigned char sun3_get_buserr (void)
+{
+ unsigned char sfc, c;
+
+ GET_SFC (sfc);
+ SET_SFC (FC_CONTROL);
+ GET_CONTROL_BYTE (AC_BUS_ERROR, c);
+ SET_SFC (sfc);
+
+ return c;
+}
+
+/* Read segmap from hardware MMU. */
+extern __inline__ unsigned long sun3_get_segmap (unsigned long addr)
+{
+ register unsigned long entry;
+ unsigned char c, sfc;
+
+ GET_SFC (sfc);
+ SET_SFC (FC_CONTROL);
+ GET_CONTROL_BYTE (AC_SEGMAP | (addr & SUN3_CONTROL_MASK), c);
+ SET_SFC (sfc);
+ entry = c;
+
+ return entry;
+}
+
+/* Write segmap to hardware MMU. */
+extern __inline__ void sun3_put_segmap (unsigned long addr, unsigned long entry)
+{
+ unsigned char sfc;
+
+ GET_DFC (sfc);
+ SET_DFC (FC_CONTROL);
+ SET_CONTROL_BYTE (AC_SEGMAP | (addr & SUN3_CONTROL_MASK), entry);
+ SET_DFC (sfc);
+
+ return;
+}
+
+/* Read PTE from hardware MMU. */
+extern __inline__ unsigned long sun3_get_pte (unsigned long addr)
+{
+ register unsigned long entry;
+ unsigned char sfc;
+
+ GET_SFC (sfc);
+ SET_SFC (FC_CONTROL);
+ GET_CONTROL_WORD (AC_PAGEMAP | (addr & SUN3_CONTROL_MASK), entry);
+ SET_SFC (sfc);
+
+ return entry;
+}
+
+/* Write PTE to hardware MMU. */
+extern __inline__ void sun3_put_pte (unsigned long addr, unsigned long entry)
+{
+ unsigned char sfc;
+
+ GET_DFC (sfc);
+ SET_DFC (FC_CONTROL);
+ SET_CONTROL_WORD (AC_PAGEMAP | (addr & SUN3_CONTROL_MASK), entry);
+ SET_DFC (sfc);
+
+ return;
+}
+
+/* get current context */
+extern __inline__ unsigned char sun3_get_context(void)
+{
+ unsigned char sfc, c;
+
+ GET_SFC(sfc);
+ SET_SFC(FC_CONTROL);
+ GET_CONTROL_BYTE(AC_CONTEXT, c);
+ SET_SFC(sfc);
+
+ return c;
+}
+
+/* set alternate context */
+extern __inline__ void sun3_put_context(unsigned char c)
+{
+ unsigned char dfc;
+ GET_DFC(dfc);
+ SET_DFC(FC_CONTROL);
+ SET_CONTROL_BYTE(AC_CONTEXT, c);
+ SET_DFC(dfc);
+
+ return;
+}
+
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* !__SUN3_MMU_H__ */
diff --git a/include/asm-m68k/swim_iop.h b/include/asm-m68k/swim_iop.h
new file mode 100644
index 000000000..12df2635f
--- /dev/null
+++ b/include/asm-m68k/swim_iop.h
@@ -0,0 +1,221 @@
+/*
+ * SWIM access through the IOP
+ * Written by Joshua M. Thompson
+ */
+
+/* IOP number and channel number for the SWIM */
+
+#define SWIM_IOP IOP_NUM_ISM
+#define SWIM_CHAN 1
+
+/* Command code: */
+
+#define CMD_INIT 0x01 /* Initialize */
+#define CMD_SHUTDOWN 0x02 /* Shutdown */
+#define CMD_START_POLL 0x03 /* Start insert/eject polling */
+#define CMD_STOP_POLL 0x04 /* Stop insert/eject polling */
+#define CMD_SETHFSTAG 0x05 /* Set HFS tag buffer address */
+#define CMD_STATUS 0x06 /* Status */
+#define CMD_EJECT 0x07 /* Eject */
+#define CMD_FORMAT 0x08 /* Format */
+#define CMD_FORMAT_VERIFY 0x09 /* Format and Verify */
+#define CMD_WRITE 0x0A /* Write */
+#define CMD_READ 0x0B /* Read */
+#define CMD_READ_VERIFY 0x0C /* Read and Verify */
+#define CMD_CACHE_CTRL 0x0D /* Cache control */
+#define CMD_TAGBUFF_CTRL 0x0E /* Tag buffer control */
+#define CMD_GET_ICON 0x0F /* Get Icon */
+
+/* Drive types: */
+
+/* note: apple sez DRV_FDHD is 4, but I get back a type */
+/* of 5 when I do a drive status check on my FDHD */
+
+#define DRV_NONE 0 /* No drive */
+#define DRV_UNKNOWN 1 /* Unspecified drive */
+#define DRV_400K 2 /* 400K */
+#define DRV_800K 3 /* 400K/800K */
+#define DRV_FDHD 5 /* 400K/800K/720K/1440K */
+#define DRV_HD20 7 /* Apple HD20 */
+
+/* Format types: */
+
+#define FMT_HD20 0x0001 /* Apple HD20 */
+#define FMT_400K 0x0002 /* 400K (GCR) */
+#define FMT_800K 0x0004 /* 800K (GCR) */
+#define FMT_720K 0x0008 /* 720K (MFM) */
+#define FMT_1440K 0x0010 /* 1.44M (MFM) */
+
+#define FMD_KIND_400K 1
+#define FMD_KIND_800K 2
+#define FMD_KIND_720K 3
+#define FMD_KIND_1440K 1
+
+/* Icon Flags: */
+
+#define ICON_MEDIA 0x01 /* Have IOP supply media icon */
+#define ICON_DRIVE 0x01 /* Have IOP supply drive icon */
+
+/* Error codes: */
+
+#define gcrOnMFMErr -400 /* GCR (400/800K) on HD media */
+#define verErr -84 /* verify failed */
+#define fmt2Err -83 /* cant get enough sync during format */
+#define fmt1Err -82 /* can't find sector 0 after track format */
+#define sectNFErr -81 /* can't find sector */
+#define seekErr -80 /* drive error during seek */
+#define spdAdjErr -79 /* can't set drive speed */
+#define twoSideErr -78 /* drive is single-sided */
+#define initIWMErr -77 /* error during initialization */
+#define tk0badErr -76 /* track zero is bad */
+#define cantStepErr -75 /* drive error during step */
+#define wrUnderrun -74 /* write underrun occurred */
+#define badDBtSlp -73 /* bad data bitslip marks */
+#define badDCksum -72 /* bad data checksum */
+#define noDtaMkErr -71 /* can't find data mark */
+#define badBtSlpErr -70 /* bad address bitslip marks */
+#define badCksmErr -69 /* bad address-mark checksum */
+#define dataVerErr -68 /* read-verify failed */
+#define noAdrMkErr -67 /* can't find an address mark */
+#define noNybErr -66 /* no nybbles? disk is probably degaussed */
+#define offLinErr -65 /* no disk in drive */
+#define noDriveErr -64 /* drive isn't connected */
+#define nsDrvErr -56 /* no such drive */
+#define paramErr -50 /* bad positioning information */
+#define wPrErr -44 /* write protected */
+#define openErr -23 /* already initialized */
+
+#ifndef __ASSEMBLY__
+
+struct swim_drvstatus {
+ __u16 curr_track; /* Current track number */
+ __u8 write_prot; /* 0x80 if disk is write protected */
+ __u8 disk_in_drive; /* 0x01 or 0x02 if a disk is in the drive */
+ __u8 installed; /* 0x01 if drive installed, 0xFF if not */
+ __u8 num_sides; /* 0x80 if two-sided format supported */
+ __u8 two_sided; /* 0xff if two-sided format diskette */
+ __u8 new_interface; /* 0x00 if old 400K drive, 0xFF if newer */
+ __u16 errors; /* Disk error count */
+ struct { /* 32 bits */
+ __u16 reserved;
+ __u16 :4;
+ __u16 external:1; /* Drive is external */
+ __u16 scsi:1; /* Drive is a SCSI drive */
+ __u16 fixed:1; /* Drive has fixed media */
+ __u16 secondary:1; /* Drive is secondary drive */
+ __u8 type; /* Drive type */
+ } info;
+ __u8 mfm_drive; /* 0xFF if this is an FDHD drive */
+ __u8 mfm_disk; /* 0xFF if 720K/1440K (MFM) disk */
+ __u8 mfm_format; /* 0x00 if 720K, 0xFF if 1440K */
+ __u8 ctlr_type; /* 0x00 if IWM, 0xFF if SWIM */
+ __u16 curr_format; /* Current format type */
+ __u16 allowed_fmt; /* Allowed format types */
+ __u32 num_blocks; /* Number of blocks on disk */
+ __u8 icon_flags; /* Icon flags */
+ __u8 unusued;
+};
+
+/* Commands issued from the host to the IOP: */
+
+struct swimcmd_init {
+ __u8 code; /* CMD_INIT */
+ __u8 unusued;
+ __u16 error;
+ __u8 drives[28]; /* drive type list */
+};
+
+struct swimcmd_startpoll {
+ __u8 code; /* CMD_START_POLL */
+ __u8 unusued;
+ __u16 error;
+};
+
+struct swimcmd_sethfstag {
+ __u8 code; /* CMD_SETHFSTAG */
+ __u8 unusued;
+ __u16 error;
+ caddr_t tagbuf; /* HFS tag buffer address */
+};
+
+struct swimcmd_status {
+ __u8 code; /* CMD_STATUS */
+ __u8 drive_num;
+ __u16 error;
+ struct swim_drvstatus status;
+};
+
+struct swimcmd_eject {
+ __u8 code; /* CMD_EJECT */
+ __u8 drive_num;
+ __u16 error;
+ struct swim_drvstatus status;
+};
+
+struct swimcmd_format {
+ __u8 code; /* CMD_FORMAT */
+ __u8 drive_num;
+ __u16 error;
+ union {
+ struct {
+ __u16 fmt; /* format kind */
+ __u8 hdrbyte; /* fmt byte for hdr (0=default) */
+ __u8 interleave; /* interleave (0 = default) */
+ caddr_t databuf; /* sector data buff (0=default */
+ caddr_t tagbuf; /* tag data buffer (0=default) */
+ } f;
+ struct swim_drvstatus status;
+ } p;
+};
+
+struct swimcmd_fmtverify {
+ __u8 code; /* CMD_FORMAT_VERIFY */
+ __u8 drive_num;
+ __u16 error;
+};
+
+struct swimcmd_rw {
+ __u8 code; /* CMD_READ, CMD_WRITE or CMD_READ_VERIFY */
+ __u8 drive_num;
+ __u16 error;
+ caddr_t buffer; /* R/W buffer address */
+ __u32 first_block; /* Starting block */
+ __u32 num_blocks; /* Number of blocks */
+ __u8 tag[12]; /* tag data */
+};
+
+struct swimcmd_cachectl {
+ __u8 code; /* CMD_CACHE_CTRL */
+ __u8 unused;
+ __u16 error;
+ __u8 enable; /* Nonzero to enable cache */
+ __u8 install; /* +1 = install, -1 = remove, 0 = neither */
+};
+
+struct swimcmd_tagbufctl {
+ __u8 code; /* CMD_TAGBUFF_CTRL */
+ __u8 unused;
+ __u16 error;
+ caddr_t buf; /* buffer address or 0 to disable */
+};
+
+struct swimcmd_geticon {
+ __u8 code; /* CMD_GET_ICON */
+ __u8 drive_num;
+ __u16 error;
+ caddr_t buffer; /* Nuffer address */
+ __u16 kind; /* 0 = media icon, 1 = drive icon */
+ __u16 unused;
+ __u16 max_bytes; /* maximum byte count */
+};
+
+/* Messages from the SWIM IOP to the host CPU: */
+
+struct swimmsg_status {
+ __u8 code; /* 1 = insert, 2 = eject, 3 = status changed */
+ __u8 drive_num;
+ __u16 error;
+ struct swim_drvstatus status;
+};
+
+#endif /* __ASSEMBLY__ */
diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h
index 03353e44c..7d1afa286 100644
--- a/include/asm-m68k/system.h
+++ b/include/asm-m68k/system.h
@@ -5,16 +5,7 @@
#include <linux/linkage.h>
#include <asm/segment.h>
-extern inline unsigned long rdusp(void) {
- unsigned long usp;
-
- __asm__ __volatile__("move %/usp,%0" : "=a" (usp));
- return usp;
-}
-
-extern inline void wrusp(unsigned long usp) {
- __asm__ __volatile__("move %0,%/usp" : : "a" (usp));
-}
+#define prepare_to_switch() do { } while(0)
/*
* switch_to(n) should switch tasks to task ptr, first checking that
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index 4180f3df7..2f6d5c3f4 100644
--- a/include/asm-m68k/unistd.h
+++ b/include/asm-m68k/unistd.h
@@ -116,7 +116,7 @@
#define __NR_olduname 109
#define __NR_iopl /* 110 */ not supported
#define __NR_vhangup 111
-#define __NR_idle 112
+#define __NR_idle /* 112 */ Obsolete
#define __NR_vm86 /* 113 */ not supported
#define __NR_wait4 114
#define __NR_swapoff 115
@@ -309,7 +309,6 @@ __syscall_return(type,__res); \
* some others too.
*/
#define __NR__exit __NR_exit
-static inline _syscall0(int,idle)
static inline _syscall0(int,pause)
static inline _syscall0(int,sync)
static inline _syscall0(pid_t,setsid)
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
index 8162a4979..302308d88 100644
--- a/include/asm-m68k/virtconvert.h
+++ b/include/asm-m68k/virtconvert.h
@@ -17,9 +17,21 @@
/*
* Change virtual addresses to physical addresses and vv.
*/
+#ifndef CONFIG_SUN3
extern unsigned long mm_vtop(unsigned long addr) __attribute__ ((const));
extern unsigned long mm_vtop_fallback (unsigned long) __attribute__ ((const));
extern unsigned long mm_ptov(unsigned long addr) __attribute__ ((const));
+#else
+extern inline unsigned long mm_vtop(unsigned long vaddr)
+{
+ return __pa(vaddr);
+}
+
+extern inline unsigned long mm_ptov(unsigned long paddr)
+{
+ return (unsigned long)__va(paddr);
+}
+#endif
#ifdef CONFIG_SINGLE_MEMORY_CHUNK
extern inline unsigned long virt_to_phys(volatile void * address)
diff --git a/include/asm-mips/cache.h b/include/asm-mips/cache.h
index 1ed0b0833..6cf5ce00b 100644
--- a/include/asm-mips/cache.h
+++ b/include/asm-mips/cache.h
@@ -1,8 +1,14 @@
-/*
- * include/asm-mips/cache.h
+/* $Id$
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1997, 1998, 1999 Ralf Baechle
+ * Copyright (C) 1999 Silicon Graphics, Inc.
*/
-#ifndef __ASM_MIPS_CACHE_H
-#define __ASM_MIPS_CACHE_H
+#ifndef _ASM_CACHE_H
+#define _ASM_CACHE_H
/* bytes per L1 cache line */
#define L1_CACHE_BYTES 32 /* a guess */
@@ -11,4 +17,12 @@
#define SMP_CACHE_BYTES L1_CACHE_BYTES
-#endif /* __ASM_MIPS_CACHE_H */
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
+#endif /* _ASM_CACHE_H */
diff --git a/include/asm-mips/dma.h b/include/asm-mips/dma.h
index 81868496a..493e0ec3d 100644
--- a/include/asm-mips/dma.h
+++ b/include/asm-mips/dma.h
@@ -1,4 +1,4 @@
-/* $Id: dma.h,v 1.2 1999/01/04 16:09:21 ralf Exp $
+/* $Id: dma.h,v 1.3 1999/08/20 21:59:08 ralf Exp $
* linux/include/asm/dma.h: Defines for using and allocating dma channels.
* Written by Hennus Bergman, 1992.
* High DMA channel support & info by Hannu Savolainen
@@ -14,7 +14,7 @@
#include <linux/config.h>
#include <asm/io.h> /* need byte IO */
-#include <asm/spinlock.h> /* And spinlocks */
+#include <linux/spinlock.h> /* And spinlocks */
#include <linux/delay.h>
#include <asm/system.h>
diff --git a/include/asm-mips/hardirq.h b/include/asm-mips/hardirq.h
index 1c282b6e6..2ab5b95ba 100644
--- a/include/asm-mips/hardirq.h
+++ b/include/asm-mips/hardirq.h
@@ -1,15 +1,16 @@
-/* $Id: hardirq.h,v 1.3 1998/08/25 09:21:56 ralf Exp $
+/* $Id: hardirq.h,v 1.4 1998/09/19 19:19:37 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 1997, 1998 by Ralf Baechle
+ * Copyright (C) 1997, 1998, 1999 by Ralf Baechle
+ * Copyright (C) 1999 Silicon Graphics, Inc.
*/
-#ifndef __ASM_MIPS_HARDIRQ_H
-#define __ASM_MIPS_HARDIRQ_H
+#ifndef _ASM_HARDIRQ_H
+#define _ASM_HARDIRQ_H
-#include <linux/tasks.h>
+#include <linux/threads.h>
extern unsigned int local_irq_count[NR_CPUS];
@@ -35,4 +36,4 @@ extern unsigned int local_irq_count[NR_CPUS];
#error No habla MIPS SMP
#endif /* __SMP__ */
-#endif /* __ASM_MIPS_HARDIRQ_H */
+#endif /* _ASM_HARDIRQ_H */
diff --git a/include/asm-mips/ide.h b/include/asm-mips/ide.h
index f81529537..43f33e4a2 100644
--- a/include/asm-mips/ide.h
+++ b/include/asm-mips/ide.h
@@ -1,4 +1,4 @@
-/* $Id: ide.h,v 1.4 1998/06/30 00:23:09 ralf Exp $
+/* $Id: ide.h,v 1.5 1999/06/17 13:30:36 ralf Exp $
*
* linux/include/asm-mips/ide.h
*
@@ -14,6 +14,8 @@
#ifdef __KERNEL__
+#include <linux/config.h>
+
#ifndef MAX_HWIFS
#define MAX_HWIFS 6
#endif
@@ -62,7 +64,7 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw,
*/
static __inline__ void ide_init_default_hwifs(void)
{
-#ifdef __DO_I_NEED_THIS
+#ifndef CONFIG_BLK_DEV_IDEPCI
hw_regs_t hw;
int index;
@@ -71,7 +73,7 @@ static __inline__ void ide_init_default_hwifs(void)
hw.irq = ide_default_irq(ide_default_io_base(index));
ide_register_hw(&hw, NULL);
}
-#endif /* __DO_I_NEED_THIS */
+#endif /* CONFIG_BLK_DEV_IDEPCI */
}
typedef union {
diff --git a/include/asm-mips/init.h b/include/asm-mips/init.h
index 0f99681b7..17d215574 100644
--- a/include/asm-mips/init.h
+++ b/include/asm-mips/init.h
@@ -1,30 +1 @@
-/* $Id: init.h,v 1.2 1998/04/05 11:25:06 ralf Exp $
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright 1998, 1999 Ralf Baechle
- */
-#ifndef __MIPS_INIT_H
-#define __MIPS_INIT_H
-
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
-
-#if __GNUC__ >= 2 && __GNUC_MINOR__ >= 8
-#define __initlocaldata __initdata
-#else
-#define __initlocaldata
-#endif
-
-/* For assembly routines */
-#define __INIT .section .text.init,"ax"
-#define __FINIT .previous
-#define __INITDATA .section .data.init,"a"
-#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
-
-#endif /* __MIPS_INIT_H */
+#error "<asm/init.h> should never be used - use <linux/init.h> instead"
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index d13fe3f48..20bdbeb34 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -1,5 +1,15 @@
-#ifndef __ASM_MIPS_IO_H
-#define __ASM_MIPS_IO_H
+/* $Id$
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1994, 1995 Waldorf GmbH
+ * Copyright (C) 1994 - 1999 Ralf Baechle
+ * Copyright (C) 1999 Silicon Graphics, Inc.
+ */
+#ifndef _ASM_IO_H
+#define _ASM_IO_H
/*
* Slowdown I/O port space accesses for antique hardware.
@@ -146,10 +156,16 @@ extern inline void iounmap(void *addr)
#define readb(addr) (*(volatile unsigned char *) (0xa0000000 + (unsigned long)(addr)))
#define readw(addr) (*(volatile unsigned short *) (0xa0000000 + (unsigned long)(addr)))
#define readl(addr) (*(volatile unsigned int *) (0xa0000000 + (unsigned long)(addr)))
+#define __raw_readb readb
+#define __raw_readw readw
+#define __raw_readl readl
#define writeb(b,addr) (*(volatile unsigned char *) (0xa0000000 + (unsigned long)(addr)) = (b))
#define writew(b,addr) (*(volatile unsigned short *) (0xa0000000 + (unsigned long)(addr)) = (b))
#define writel(b,addr) (*(volatile unsigned int *) (0xa0000000 + (unsigned long)(addr)) = (b))
+#define __raw_writeb writeb
+#define __raw_writew writew
+#define __raw_writel writel
#define memset_io(a,b,c) memset((void *)(0xa0000000 + (unsigned long)a),(b),(c))
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(0xa0000000 + (unsigned long)(b)),(c))
@@ -398,4 +414,4 @@ extern void (*dma_cache_wback_inv)(unsigned long start, unsigned long size);
extern void (*dma_cache_wback)(unsigned long start, unsigned long size);
extern void (*dma_cache_inv)(unsigned long start, unsigned long size);
-#endif /* __ASM_MIPS_IO_H */
+#endif /* _ASM_IO_H */
diff --git a/include/asm-mips/mmu_context.h b/include/asm-mips/mmu_context.h
index 473e9e2a3..1149bc03f 100644
--- a/include/asm-mips/mmu_context.h
+++ b/include/asm-mips/mmu_context.h
@@ -1,4 +1,4 @@
-/* $Id: mmu_context.h,v 1.3 1999/01/04 16:09:23 ralf Exp $
+/* $Id: mmu_context.h,v 1.4 1999/08/09 19:43:17 harald Exp $
*
* Switch a MMU context.
*
@@ -6,10 +6,11 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
+ * Copyright (C) 1996, 1997, 1998, 1999 by Ralf Baechle
+ * Copyright (C) 1999 Silicon Graphics, Inc.
*/
-#ifndef __ASM_MIPS_MMU_CONTEXT_H
-#define __ASM_MIPS_MMU_CONTEXT_H
+#ifndef _ASM_MMU_CONTEXT_H
+#define _ASM_MMU_CONTEXT_H
#include <linux/config.h>
@@ -28,17 +29,17 @@ extern unsigned long asid_cache;
#endif
-/*
- * All unused by hardware upper bits will be considered
+/*
+ * All unused by hardware upper bits will be considered
* as a software asid extension.
*/
-#define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1)))
+#define ASID_VERSION_MASK ((unsigned long)~(ASID_MASK|(ASID_MASK-1)))
#define ASID_FIRST_VERSION ((unsigned long)(~ASID_VERSION_MASK) + 1)
-extern inline void get_new_mmu_context(struct mm_struct *mm, unsigned
-long asid)
+extern inline void
+get_new_mmu_context(struct mm_struct *mm, unsigned long asid)
{
- if (! ((asid += ASID_INC) & ASID_MASK) ) {
+ if (! ((asid += ASID_INC) & ASID_MASK) ) {
flush_tlb_all(); /* start new asid cycle */
if (!asid) /* fix version if needed */
asid = ASID_FIRST_VERSION;
@@ -63,28 +64,45 @@ get_mmu_context(struct task_struct *p)
* Initialize the context related info for a new mm_struct
* instance.
*/
-extern inline void init_new_context(struct mm_struct *mm)
+extern inline void
+init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{
mm->context = 0;
}
+extern inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+ struct task_struct *tsk, unsigned cpu)
+{
+ if (next) {
+ unsigned long asid = asid_cache;
+ /* Check if our ASID is of an older version and thus invalid */
+ if ((next->context ^ asid) & ASID_VERSION_MASK)
+ get_new_mmu_context(next, asid);
+ }
+
+ set_entryhi(next->context);
+}
+
/*
* Destroy context related info for an mm_struct that is about
* to be put to rest.
*/
extern inline void destroy_context(struct mm_struct *mm)
{
- mm->context = 0;
+ /* Nothing to do. */
}
/*
* After we have set current->mm to a new value, this activates
* the context for the new mm so we see the new mappings.
*/
-extern inline void activate_context(struct task_struct *tsk)
+extern inline void
+activate_mm(struct mm_struct *prev, struct mm_struct *next)
{
- get_mmu_context(tsk);
- set_entryhi(tsk->mm->context);
+ /* Unconditionally get an new ASID. */
+ get_new_mmu_context(next, asid_cache);
+
+ set_entryhi(next->context);
}
-#endif /* __ASM_MIPS_MMU_CONTEXT_H */
+#endif /* _ASM_MMU_CONTEXT_H */
diff --git a/include/asm-mips/offset.h b/include/asm-mips/offset.h
index c07690bd7..69a32238a 100644
--- a/include/asm-mips/offset.h
+++ b/include/asm-mips/offset.h
@@ -51,7 +51,7 @@
#define TASK_NEED_RESCHED 20
#define TASK_COUNTER 24
#define TASK_PRIORITY 28
-#define TASK_MM 800
+#define TASK_MM 792
#define TASK_STRUCT_SIZE 856
/* MIPS specific thread_struct offsets. */
@@ -72,16 +72,15 @@
#define THREAD_BUADDR 756
#define THREAD_ECODE 760
#define THREAD_TRAPNO 764
-#define THREAD_PGDIR 768
-#define THREAD_MFLAGS 772
-#define THREAD_CURDS 776
-#define THREAD_TRAMP 780
-#define THREAD_OLDCTX 784
+#define THREAD_MFLAGS 768
+#define THREAD_CURDS 772
+#define THREAD_TRAMP 776
+#define THREAD_OLDCTX 780
/* Linux mm_struct offsets. */
-#define MM_COUNT 16
+#define MM_USERS 16
#define MM_PGD 12
-#define MM_CONTEXT 52
+#define MM_CONTEXT 56
/* Linux sigcontext offsets. */
#define SC_REGS 16
diff --git a/include/asm-mips/parport.h b/include/asm-mips/parport.h
new file mode 100644
index 000000000..dcf0ff69d
--- /dev/null
+++ b/include/asm-mips/parport.h
@@ -0,0 +1,59 @@
+/* $Id$
+ *
+ * parport.h: ia32-specific parport initialisation
+ *
+ * Copyright (C) 1999 Tim Waugh <tim@cyberelk.demon.co.uk>
+ *
+ * This file should only be included by drivers/parport/parport_pc.c.
+ */
+#ifndef _ASM_PARPORT_H
+#define _ASM_PARPORT_H 1
+
+#include <linux/config.h>
+
+/* Maximum number of ports to support. It is useless to set this greater
+ than PARPORT_MAX (in <linux/parport.h>). */
+#define PARPORT_PC_MAX_PORTS 8
+
+/* If parport_cs (PCMCIA) is managing ports for us, we'll need the
+ * probing routines forever; otherwise we can lose them at boot time. */
+#ifdef CONFIG_PARPORT_PC_PCMCIA
+#define __maybe_initdata
+#define __maybe_init
+#else
+#define __maybe_initdata __initdata
+#define __maybe_init __init
+#endif
+
+static int __maybe_init parport_pc_init_pci(int irq, int dma);
+
+static int user_specified __maybe_initdata = 0;
+int __init
+parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
+{
+ int count = 0, i = 0;
+
+ if (io && *io) {
+ /* Only probe the ports we were given. */
+ user_specified = 1;
+ do {
+ if (!*io_hi) *io_hi = 0x400 + *io;
+ if (parport_pc_probe_port(*(io++), *(io_hi++),
+ *(irq++), *(dma++)))
+ count++;
+ } while (*io && (++i < PARPORT_PC_MAX_PORTS));
+ } else {
+ /* Probe all the likely ports. */
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ count++;
+ count += parport_pc_init_pci (irq[0], dma[0]);
+ }
+
+ return count;
+}
+
+#endif /* !(_ASM_PARPORT_H) */
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index a8b7318fd..853e19b32 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -1,42 +1,16 @@
-/* $Id: pci.h,v 1.4 1998/08/25 09:21:59 ralf Exp $
+/* $Id: pci.h,v 1.5 1999/01/04 16:09:24 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
- *
- * Declarations for the MIPS specific implementation of the PCI BIOS32 services.
*/
-#ifndef __ASM_MIPS_PCI_H
-#define __ASM_MIPS_PCI_H
+#ifndef _ASM_PCI_H
+#define _ASM_PCI_H
-struct pci_ops {
- void (*pcibios_fixup) (void);
- int (*pcibios_read_config_byte) (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned char *val);
- int (*pcibios_read_config_word) (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned short *val);
- int (*pcibios_read_config_dword) (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned int *val);
- int (*pcibios_write_config_byte) (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned char val);
- int (*pcibios_write_config_word) (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned short val);
- int (*pcibios_write_config_dword) (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned int val);
-};
+/* Can be used to override the logic in pci_scan_bus for skipping
+ already-configured bus numbers - to be used for buggy BIOSes
+ or architectures with incomplete PCI setup by the loader */
-extern struct pci_ops *pci_ops;
+#define pcibios_assign_all_busses() 0
-#endif /* __ASM_MIPS_PCI_H */
+#endif /* _ASM_PCI_H */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 2a724ddde..1dc438914 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -1,10 +1,11 @@
-/* $Id: pgtable.h,v 1.23 1999/08/13 17:07:27 harald Exp $
+/* $Id: pgtable.h,v 1.24 1999/08/18 23:37:49 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 1994 - 1998 by Ralf Baechle at alii
+ * Copyright (C) 1994 - 1999 by Ralf Baechle at alii
+ * Copyright (C) 1999 Silicon Graphics, Inc.
*/
#ifndef _ASM_PGTABLE_H
#define _ASM_PGTABLE_H
@@ -221,9 +222,6 @@ extern unsigned long zero_page_mask;
extern void load_pgd(unsigned long pg_dir);
-/* to set the page-dir */
-#define SET_PAGE_DIR(tsk,pgdir) (tsk)->tss.pg_dir = ((unsigned long) (pgdir))
-
extern pmd_t invalid_pte_table[PAGE_SIZE/sizeof(pmd_t)];
/*
@@ -568,7 +566,7 @@ extern inline void set_pgdir(unsigned long address, pgd_t entry)
#ifdef __SMP__
int i;
#endif
-
+
read_lock(&tasklist_lock);
for_each_task(p) {
if (!p->mm)
@@ -864,4 +862,6 @@ extern inline void set_context(unsigned long val)
#endif /* !defined (_LANGUAGE_ASSEMBLY) */
+#define io_remap_page_range remap_page_range
+
#endif /* _ASM_PGTABLE_H */
diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h
index 080f30c33..1df7cb200 100644
--- a/include/asm-mips/processor.h
+++ b/include/asm-mips/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.18 1999/08/18 23:37:49 ralf Exp $
+/* $Id: processor.h,v 1.19 1999/09/28 22:27:17 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -19,6 +19,7 @@
#define current_text_addr() ({ __label__ _l; _l: &&_l;})
#if !defined (_LANGUAGE_ASSEMBLY)
+#include <linux/threads.h>
#include <asm/cachectl.h>
#include <asm/mipsregs.h>
#include <asm/reg.h>
@@ -135,7 +136,6 @@ struct thread_struct {
unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
unsigned long error_code;
unsigned long trap_no;
- unsigned long pg_dir; /* used in tlb refill */
#define MF_FIXADE 1 /* Fix address errors in software */
#define MF_LOGADE 2 /* Log address errors to syslog */
unsigned long mflags;
@@ -149,7 +149,7 @@ struct thread_struct {
#define INIT_MMAP { &init_mm, KSEG0, KSEG1, NULL, PAGE_SHARED, \
VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-#define INIT_TSS { \
+#define INIT_THREAD { \
/* \
* saved main processor registers \
*/ \
@@ -166,7 +166,7 @@ struct thread_struct {
/* \
* Other stuff associated with the process \
*/ \
- 0, 0, 0, 0, (unsigned long) swapper_pg_dir, \
+ 0, 0, 0, 0, \
/* \
* For now the default is to fix address errors \
*/ \
@@ -185,7 +185,7 @@ struct thread_struct {
extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
/* Copy and release all segment info associated with a VM */
-#define copy_segments(nr, p, mm) do { } while(0)
+#define copy_segments(p, mm) do { } while(0)
#define release_segments(mm) do { } while(0)
#define forget_segments() do { } while (0)
@@ -211,13 +211,14 @@ extern inline unsigned long thread_saved_pc(struct thread_struct *t)
regs->cp0_status = (regs->cp0_status & ~(ST0_CU0|ST0_KSU)) | KSU_USER;\
regs->cp0_epc = new_pc; \
regs->regs[29] = new_sp; \
- current->tss.current_ds = USER_DS; \
+ current->thread.current_ds = USER_DS; \
} while (0)
/* Allocation and freeing of basic task resources. */
/*
* NOTE! The task struct and the stack go together
*/
+#define THREAD_SIZE (2*PAGE_SIZE)
#define alloc_task_struct() \
((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
#define free_task_struct(p) free_pages((unsigned long)(p),1)
diff --git a/include/asm-mips/resource.h b/include/asm-mips/resource.h
index 42eb9e66e..d02021e0d 100644
--- a/include/asm-mips/resource.h
+++ b/include/asm-mips/resource.h
@@ -1,4 +1,4 @@
-/* $Id: resource.h,v 1.2 1998/12/08 20:51:59 ralf Exp $
+/* $Id: resource.h,v 1.2 1999/01/04 16:09:25 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -6,8 +6,8 @@
*
* Copyright (C) 1995, 1996, 1998 by Ralf Baechle
*/
-#ifndef __ASM_MIPS_RESOURCE_H
-#define __ASM_MIPS_RESOURCE_H
+#ifndef _ASM_RESOURCE_H
+#define _ASM_RESOURCE_H
/*
* Resource limits
@@ -34,13 +34,13 @@
{ LONG_MAX, LONG_MAX }, \
{ _STK_LIM, LONG_MAX }, \
{ 0, LONG_MAX }, \
- { NR_OPEN, NR_OPEN }, \
+ { INR_OPEN, INR_OPEN }, \
{ LONG_MAX, LONG_MAX }, \
{ LONG_MAX, LONG_MAX }, \
- { MAX_TASKS_PER_USER, MAX_TASKS_PER_USER }, \
+ { 0, 0 }, \
{ LONG_MAX, LONG_MAX }, \
}
#endif /* __KERNEL__ */
-#endif /* __ASM_MIPS_RESOURCE_H */
+#endif /* _ASM_RESOURCE_H */
diff --git a/include/asm-mips/semaphore.h b/include/asm-mips/semaphore.h
index 789c797f0..0b283f4f4 100644
--- a/include/asm-mips/semaphore.h
+++ b/include/asm-mips/semaphore.h
@@ -1,4 +1,4 @@
-/* $Id: semaphore.h,v 1.8 1999/07/26 19:42:44 harald Exp $
+/* $Id: semaphore.h,v 1.9 1999/08/13 17:07:27 harald Exp $
*
* SMP- and interrupt-safe semaphores..
*
@@ -9,12 +9,12 @@
* (C) Copyright 1996 Linus Torvalds
* (C) Copyright 1998, 1999 Ralf Baechle
*/
-#ifndef __ASM_MIPS_SEMAPHORE_H
-#define __ASM_MIPS_SEMAPHORE_H
+#ifndef _ASM_SEMAPHORE_H
+#define _ASM_SEMAPHORE_H
#include <asm/system.h>
#include <asm/atomic.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/config.h>
@@ -190,4 +190,4 @@ extern inline void up(struct semaphore * sem)
__up(sem);
}
-#endif /* __ASM_MIPS_SEMAPHORE_H */
+#endif /* _ASM_SEMAPHORE_H */
diff --git a/include/asm-mips/sgint23.h b/include/asm-mips/sgint23.h
index d9a093861..ba889aee0 100644
--- a/include/asm-mips/sgint23.h
+++ b/include/asm-mips/sgint23.h
@@ -1,11 +1,12 @@
-/* $Id: sgint23.h,v 1.3 1999/05/07 22:35:37 ulfc Exp $
+/* $Id: sgint23.h,v 1.4 1999/08/11 20:26:49 andrewb Exp $
+ *
* sgint23.h: Defines for the SGI INT2 and INT3 chipsets.
*
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
* Copyright (C) 1999 Andrew R. Baker (andrewb@uab.edu) - INT2 corrections
*/
-#ifndef _MIPS_SGINT23_H
-#define _MIPS_SGINT23_H
+#ifndef _ASM_SGINT23_H
+#define _ASM_SGINT23_H
/* These are the virtual IRQ numbers, we divide all IRQ's into
* 'spaces', the 'space' determines where and how to enable/disable
@@ -33,6 +34,19 @@
#define SGI_KEYBOARD_IRQ SGINT_LOCAL2 + 4 /* keyboard */
#define SGI_SERIAL_IRQ SGINT_LOCAL2 + 5 /* onboard serial */
+/* Individual interrupt definitions for the INDY and Indigo2
+ */
+
+#define SGI_WD93_0_IRQ SGINT_LOCAL0 + 1 /* 1st onboard WD93 */
+#define SGI_WD93_1_IRQ SGINT_LOCAL0 + 2 /* 2nd onboard WD93 */
+#define SGI_ENET_IRQ SGINT_LOCAL0 + 3 /* onboard ethernet */
+
+#define SGI_PANEL_IRQ SGINT_LOCAL1 + 1 /* front panel */
+
+#define SGI_EISA_IRQ SGINT_LOCAL2 + 3 /* EISA interrupts */
+#define SGI_KEYBOARD_IRQ SGINT_LOCAL2 + 4 /* keyboard */
+#define SGI_SERIAL_IRQ SGINT_LOCAL2 + 5 /* onboard serial */
+
/* INT2 occupies HPC PBUS slot 4, INT3 uses slot 6. */
#define SGI_INT2_BASE 0x1fbd9000 /* physical */
#define SGI_INT3_BASE 0x1fbd9880 /* physical */
@@ -197,4 +211,4 @@ extern volatile unsigned char *ioc_tclear;
extern void sgint_init(void);
extern void indy_timer_init(void);
-#endif /* !(_MIPS_SGINT23_H) */
+#endif /* !(_ASM_SGINT23_H) */
diff --git a/include/asm-mips/smplock.h b/include/asm-mips/smplock.h
index 61bf3ff9c..67a4bb617 100644
--- a/include/asm-mips/smplock.h
+++ b/include/asm-mips/smplock.h
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: smplock.h,v 1.1 1998/08/25 09:22:02 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -7,7 +7,7 @@
* Default SMP lock implementation
*/
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index 63811c615..ece1f7ddd 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -1,77 +1,8 @@
-/* $Id: spinlock.h,v 1.5 1999/06/17 13:30:39 ralf Exp $
+/* $Id: spinlock.h,v 1.6 1999/06/22 23:49:12 ralf Exp $
*/
-#ifndef __ASM_MIPS_SPINLOCK_H
-#define __ASM_MIPS_SPINLOCK_H
-
-/*
- * These are the generic versions of the spinlocks
- * and read-write locks.. We should actually do a
- * <linux/spinlock.h> with all of this. Oh, well.
- */
-#define spin_lock_irqsave(lock, flags) do { local_irq_save(flags); spin_lock(lock); } while (0)
-#define spin_lock_irq(lock) do { local_irq_disable(); spin_lock(lock); } while (0)
-#define spin_lock_bh(lock) do { local_bh_disable(); spin_lock(lock); } while (0)
-
-#define read_lock_irqsave(lock, flags) do { local_irq_save(flags); read_lock(lock); } while (0)
-#define read_lock_irq(lock) do { local_irq_disable(); read_lock(lock); } while (0)
-#define read_lock_bh(lock) do { local_bh_disable(); read_lock(lock); } while (0)
-
-#define write_lock_irqsave(lock, flags) do { local_irq_save(flags); write_lock(lock); } while (0)
-#define write_lock_irq(lock) do { local_irq_disable(); write_lock(lock); } while (0)
-#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while (0)
-
-#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); local_irq_restore(flags); } while (0)
-#define spin_unlock_irq(lock) do { spin_unlock(lock); local_irq_enable(); } while (0)
-#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0)
-
-#define read_unlock_irqrestore(lock, flags) do { read_unlock(lock); local_irq_restore(flags); } while (0)
-#define read_unlock_irq(lock) do { read_unlock(lock); local_irq_enable(); } while (0)
-#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0)
-
-#define write_unlock_irqrestore(lock, flags) do { write_unlock(lock); local_irq_restore(flags); } while (0)
-#define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0)
-#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0)
-
-#ifndef __SMP__
-
-/*
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
- typedef struct { } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
-#else
- typedef struct { int gcc_is_buggy; } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-#endif
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) (void)(lock) /* Not "unused variable". */
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) (void)(lock) /* Not "unused variable". */
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- */
-typedef struct { } rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { }
-
-#define read_lock(lock) (void)(lock) /* Not "unused variable". */
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) (void)(lock) /* Not "unused variable". */
-#define write_unlock(lock) do { } while(0)
-
-#else
+#ifndef _ASM_SPINLOCK_H
+#define _ASM_SPINLOCK_H
#error "Nix SMP on MIPS"
-#endif /* SMP */
-#endif /* __ASM_MIPS_SPINLOCK_H */
+#endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index 5dff91cd7..80cbd08fc 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -1,4 +1,4 @@
-/* $Id: system.h,v 1.14 1999/08/09 19:43:18 harald Exp $
+/* $Id: system.h,v 1.15 1999/08/13 17:07:28 harald Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -140,6 +140,15 @@ __asm__ __volatile__( \
#define rmb() mb()
#define wmb() mb()
+#define set_mb(var, value) \
+do { var = value; mb(); } while (0)
+
+#define set_rmb(var, value) \
+do { var = value; rmb(); } while (0)
+
+#define set_wmb(var, value) \
+do { var = value; wmb(); } while (0)
+
#if !defined (_LANGUAGE_ASSEMBLY)
/*
* switch_to(n) should switch tasks to task nr n, first
@@ -148,6 +157,7 @@ __asm__ __volatile__( \
extern asmlinkage void *resume(void *last, void *next);
#endif /* !defined (_LANGUAGE_ASSEMBLY) */
+#define prepare_to_switch() do { } while(0)
#define switch_to(prev,next,last) \
do { \
(last) = resume(prev, next); \
diff --git a/include/asm-mips/uaccess.h b/include/asm-mips/uaccess.h
index e6750b4e5..a9b759313 100644
--- a/include/asm-mips/uaccess.h
+++ b/include/asm-mips/uaccess.h
@@ -7,7 +7,7 @@
*
* Copyright (C) 1996, 1997, 1998 by Ralf Baechle
*
- * $Id: uaccess.h,v 1.7 1998/05/04 09:13:02 ralf Exp $
+ * $Id: uaccess.h,v 1.8 1999/01/04 16:09:27 ralf Exp $
*/
#ifndef __ASM_MIPS_UACCESS_H
#define __ASM_MIPS_UACCESS_H
@@ -31,9 +31,9 @@
#define VERIFY_READ 0
#define VERIFY_WRITE 1
-#define get_fs() (current->tss.current_ds)
+#define get_fs() (current->thread.current_ds)
#define get_ds() (KERNEL_DS)
-#define set_fs(x) (current->tss.current_ds=(x))
+#define set_fs(x) (current->thread.current_ds=(x))
#define segment_eq(a,b) ((a).seg == (b).seg)
diff --git a/include/asm-mips/unistd.h b/include/asm-mips/unistd.h
index e003fa7b4..e25140af3 100644
--- a/include/asm-mips/unistd.h
+++ b/include/asm-mips/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.14 1999/04/01 23:24:00 ulfc Exp $
+/* $Id: unistd.h,v 1.15 1999/09/28 22:27:18 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -1419,7 +1419,6 @@ return -1; \
* some others too.
*/
#define __NR__exit __NR_exit
-static inline _syscall0(int,idle)
static inline _syscall0(int,sync)
static inline _syscall0(pid_t,setsid)
static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
diff --git a/include/asm-mips64/cache.h b/include/asm-mips64/cache.h
index 8271a4356..3317887ea 100644
--- a/include/asm-mips64/cache.h
+++ b/include/asm-mips64/cache.h
@@ -1,10 +1,11 @@
-/* $Id$
+/* $Id: cache.h,v 1.1 1999/08/18 23:37:50 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 1998, 1999 by Ralf Baechle
+ * Copyright (C) 1997, 1998, 1999 Ralf Baechle
+ * Copyright (C) 1999 Silicon Graphics, Inc.
*/
#ifndef _ASM_CACHE_H
#define _ASM_CACHE_H
@@ -16,4 +17,12 @@
#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
#endif /* _ASM_CACHE_H */
diff --git a/include/asm-mips64/io.h b/include/asm-mips64/io.h
index 92ace527e..edcd71b0e 100644
--- a/include/asm-mips64/io.h
+++ b/include/asm-mips64/io.h
@@ -1,11 +1,12 @@
-/* $Id$
+/* $Id: io.h,v 1.1 1999/08/18 23:37:51 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
- * Copyright (C) 1994, 1995, 1996, 1999 by Ralf Baechle
- * Copyright (C) 1999 by Silicon Graphics
+ * Copyright (C) 1994, 1995 Waldorf GmbH
+ * Copyright (C) 1994 - 1999 Ralf Baechle
+ * Copyright (C) 1999 Silicon Graphics, Inc.
*/
#ifndef _ASM_IO_H
#define _ASM_IO_H
diff --git a/include/asm-mips64/parport.h b/include/asm-mips64/parport.h
new file mode 100644
index 000000000..dcf0ff69d
--- /dev/null
+++ b/include/asm-mips64/parport.h
@@ -0,0 +1,59 @@
+/* $Id$
+ *
+ * parport.h: ia32-specific parport initialisation
+ *
+ * Copyright (C) 1999 Tim Waugh <tim@cyberelk.demon.co.uk>
+ *
+ * This file should only be included by drivers/parport/parport_pc.c.
+ */
+#ifndef _ASM_PARPORT_H
+#define _ASM_PARPORT_H 1
+
+#include <linux/config.h>
+
+/* Maximum number of ports to support. It is useless to set this greater
+ than PARPORT_MAX (in <linux/parport.h>). */
+#define PARPORT_PC_MAX_PORTS 8
+
+/* If parport_cs (PCMCIA) is managing ports for us, we'll need the
+ * probing routines forever; otherwise we can lose them at boot time. */
+#ifdef CONFIG_PARPORT_PC_PCMCIA
+#define __maybe_initdata
+#define __maybe_init
+#else
+#define __maybe_initdata __initdata
+#define __maybe_init __init
+#endif
+
+static int __maybe_init parport_pc_init_pci(int irq, int dma);
+
+static int user_specified __maybe_initdata = 0;
+int __init
+parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
+{
+ int count = 0, i = 0;
+
+ if (io && *io) {
+ /* Only probe the ports we were given. */
+ user_specified = 1;
+ do {
+ if (!*io_hi) *io_hi = 0x400 + *io;
+ if (parport_pc_probe_port(*(io++), *(io_hi++),
+ *(irq++), *(dma++)))
+ count++;
+ } while (*io && (++i < PARPORT_PC_MAX_PORTS));
+ } else {
+ /* Probe all the likely ports. */
+ if (parport_pc_probe_port(0x3bc, 0x7bc, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x378, 0x778, irq[0], dma[0]))
+ count++;
+ if (parport_pc_probe_port(0x278, 0x678, irq[0], dma[0]))
+ count++;
+ count += parport_pc_init_pci (irq[0], dma[0]);
+ }
+
+ return count;
+}
+
+#endif /* !(_ASM_PARPORT_H) */
diff --git a/include/asm-mips64/pgtable.h b/include/asm-mips64/pgtable.h
index 492ecc1f1..fd1e5c063 100644
--- a/include/asm-mips64/pgtable.h
+++ b/include/asm-mips64/pgtable.h
@@ -199,9 +199,6 @@ extern unsigned long zero_page_mask;
extern void (*load_pgd)(unsigned long pg_dir);
-/* to set the page-dir */
-#define SET_PAGE_DIR(tsk,pgdir) (tsk)->tss.pg_dir = ((unsigned long) (pgdir))
-
extern pmd_t invalid_pte_table[PAGE_SIZE/sizeof(pmd_t)];
/*
diff --git a/include/asm-mips64/resource.h b/include/asm-mips64/resource.h
index 5ff4948c7..771cb260d 100644
--- a/include/asm-mips64/resource.h
+++ b/include/asm-mips64/resource.h
@@ -1,10 +1,11 @@
-/* $Id$
+/* $Id: resource.h,v 1.1 1999/08/18 23:37:52 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1995, 1996, 1998, 1999 by Ralf Baechle
+ * Copyright (C) 1999 Silicon Graphics, Inc.
*/
#ifndef _ASM_RESOURCE_H
#define _ASM_RESOURCE_H
@@ -37,7 +38,7 @@
{ NR_OPEN, NR_OPEN }, \
{ LONG_MAX, LONG_MAX }, \
{ LONG_MAX, LONG_MAX }, \
- { MAX_TASKS_PER_USER, MAX_TASKS_PER_USER }, \
+ { 0, 0 }, \
{ LONG_MAX, LONG_MAX }, \
}
diff --git a/include/asm-mips64/spinlock.h b/include/asm-mips64/spinlock.h
index 1dc5fff6a..2bde33805 100644
--- a/include/asm-mips64/spinlock.h
+++ b/include/asm-mips64/spinlock.h
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: spinlock.h,v 1.1 1999/08/18 23:37:52 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -7,70 +7,6 @@
#ifndef _ASM_SPINLOCK_H
#define _ASM_SPINLOCK_H
-/*
- * These are the generic versions of the spinlocks
- * and read-write locks.. We should actually do a
- * <linux/spinlock.h> with all of this. Oh, well.
- */
-#define spin_lock_irqsave(lock, flags) do { local_irq_save(flags); spin_lock(lock); } while (0)
-#define spin_lock_irq(lock) do { local_irq_disable(); spin_lock(lock); } while (0)
-#define spin_lock_bh(lock) do { local_bh_disable(); spin_lock(lock); } while (0)
-
-#define read_lock_irqsave(lock, flags) do { local_irq_save(flags); read_lock(lock); } while (0)
-#define read_lock_irq(lock) do { local_irq_disable(); read_lock(lock); } while (0)
-#define read_lock_bh(lock) do { local_bh_disable(); read_lock(lock); } while (0)
-
-#define write_lock_irqsave(lock, flags) do { local_irq_save(flags); write_lock(lock); } while (0)
-#define write_lock_irq(lock) do { local_irq_disable(); write_lock(lock); } while (0)
-#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while (0)
-
-#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); local_irq_restore(flags); } while (0)
-#define spin_unlock_irq(lock) do { spin_unlock(lock); local_irq_enable(); } while (0)
-#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0)
-
-#define read_unlock_irqrestore(lock, flags) do { read_unlock(lock); local_irq_restore(flags); } while (0)
-#define read_unlock_irq(lock) do { read_unlock(lock); local_irq_enable(); } while (0)
-#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0)
-
-#define write_unlock_irqrestore(lock, flags) do { write_unlock(lock); local_irq_restore(flags); } while (0)
-#define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0)
-#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0)
-
-#ifndef __SMP__
-
-/*
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-typedef struct { } spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) (void)(lock) /* Not "unused variable". */
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) (void)(lock) /* Not "unused variable". */
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- */
-typedef struct { } rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { }
-
-#define read_lock(lock) (void)(lock) /* Not "unused variable". */
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) (void)(lock) /* Not "unused variable". */
-#define write_unlock(lock) do { } while(0)
-
-#else
-
#error "Nix SMP on MIPS"
-#endif /* SMP */
#endif /* _ASM_SPINLOCK_H */
diff --git a/include/asm-mips64/system.h b/include/asm-mips64/system.h
index 320b9ceeb..54b1a3cfd 100644
--- a/include/asm-mips64/system.h
+++ b/include/asm-mips64/system.h
@@ -1,4 +1,4 @@
-/* $Id$
+/* $Id: system.h,v 1.1 1999/08/18 23:37:52 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -136,6 +136,15 @@ __asm__ __volatile__( \
#define rmb() mb()
#define wmb() mb()
+#define set_mb(var, value) \
+do { var = value; mb(); } while (0)
+
+#define set_rmb(var, value) \
+do { var = value; rmb(); } while (0)
+
+#define set_wmb(var, value) \
+do { var = value; wmb(); } while (0)
+
#if !defined (_LANGUAGE_ASSEMBLY)
/*
* switch_to(n) should switch tasks to task nr n, first
diff --git a/include/asm-mips64/unistd.h b/include/asm-mips64/unistd.h
index 0441ffc51..c6e295e4c 100644
--- a/include/asm-mips64/unistd.h
+++ b/include/asm-mips64/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.3 1999/09/27 16:01:41 ralf Exp $
+/* $Id: unistd.h,v 1.3 1999/09/28 22:27:20 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -1514,7 +1514,6 @@ return -1; \
* some others too.
*/
#define __NR__exit __NR_exit
-static inline _syscall0(int,idle)
static inline _syscall0(int,sync)
static inline _syscall0(pid_t,setsid)
static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
diff --git a/include/asm-ppc/cache.h b/include/asm-ppc/cache.h
index 0d54430d2..bc8e8c805 100644
--- a/include/asm-ppc/cache.h
+++ b/include/asm-ppc/cache.h
@@ -15,6 +15,14 @@
#define SMP_CACHE_BYTES L1_CACHE_BYTES
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
extern void flush_dcache_range(unsigned long start, unsigned long stop);
diff --git a/include/asm-ppc/dma.h b/include/asm-ppc/dma.h
index 3e980e353..dfd6a240b 100644
--- a/include/asm-ppc/dma.h
+++ b/include/asm-ppc/dma.h
@@ -8,7 +8,7 @@
#include <linux/config.h>
#include <asm/io.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#include <asm/system.h>
/*
@@ -399,7 +399,7 @@ static __inline__ int get_dma_residue(unsigned int dmanr)
extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
extern void free_dma(unsigned int dmanr); /* release it again */
-#ifdef CONFIG_PCI_QUIRKS
+#ifdef CONFIG_PCI
extern int isa_dma_bridge_buggy;
#else
#define isa_dma_bridge_buggy (0)
diff --git a/include/asm-ppc/gemini.h b/include/asm-ppc/gemini.h
new file mode 100644
index 000000000..7e681e043
--- /dev/null
+++ b/include/asm-ppc/gemini.h
@@ -0,0 +1,166 @@
+/*
+ * include/asm-ppc/gemini.h
+ *
+ *
+ * Onboard registers and descriptions for Synergy Microsystems'
+ * "Gemini" boards.
+ *
+ */
+#ifndef __PPC_GEMINI_H
+#define __PPC_GEMINI_H
+
+/* Registers */
+
+#define GEMINI_SERIAL_B (0xffeffb00)
+#define GEMINI_SERIAL_A (0xffeffb08)
+#define GEMINI_USWITCH (0xffeffd00)
+#define GEMINI_BREV (0xffeffe00)
+#define GEMINI_BECO (0xffeffe08)
+#define GEMINI_FEAT (0xffeffe10)
+#define GEMINI_BSTAT (0xffeffe18)
+#define GEMINI_CPUSTAT (0xffeffe20)
+#define GEMINI_L2CFG (0xffeffe30)
+#define GEMINI_MEMCFG (0xffeffe38)
+#define GEMINI_FLROM (0xffeffe40)
+#define GEMINI_P0PCI (0xffeffe48)
+#define GEMINI_FLWIN (0xffeffe50)
+#define GEMINI_P0INTMASK (0xffeffe60)
+#define GEMINI_P0INTAP (0xffeffe68)
+#define GEMINI_PCIERR (0xffeffe70)
+#define GEMINI_LEDBASE (0xffeffe80)
+#define GEMINI_RTC (0xffe9fff8)
+#define GEMINI_LEDS 8
+#define GEMINI_SWITCHES 8
+
+
+/* Flash ROM bit definitions */
+#define GEMINI_FLS_WEN (1<<0)
+#define GEMINI_FLS_JMP (1<<6)
+#define GEMINI_FLS_BOOT (1<<7)
+
+/* Memory bit definitions */
+#define GEMINI_MEM_TYPE_MASK 0xc0
+#define GEMINI_MEM_SIZE_MASK 0x38
+#define GEMINI_MEM_BANK_MASK 0x07
+
+/* L2 cache bit definitions */
+#define GEMINI_L2_SIZE_MASK 0xc0
+#define GEMINI_L2_RATIO_MASK 0x03
+
+/* Timebase register bit definitons */
+#define GEMINI_TIMEB0_EN (1<<0)
+#define GEMINI_TIMEB1_EN (1<<1)
+#define GEMINI_TIMEB2_EN (1<<2)
+#define GEMINI_TIMEB3_EN (1<<3)
+
+/* CPU status bit definitions */
+#define GEMINI_CPU_ID_MASK 0x03
+#define GEMINI_CPU_COUNT_MASK 0x0c
+#define GEMINI_CPU0_HALTED (1<<4)
+#define GEMINI_CPU1_HALTED (1<<5)
+#define GEMINI_CPU2_HALTED (1<<6)
+#define GEMINI_CPU3_HALTED (1<<7)
+
+/* Board status bit definitions */
+#define GEMINI_BRD_FAIL (1<<0) /* FAIL led is lit */
+#define GEMINI_BRD_BUS_MASK 0x0c /* PowerPC bus speed */
+
+/* Board family/feature bit descriptions */
+#define GEMINI_FEAT_HAS_FLASH (1<<0)
+#define GEMINI_FEAT_HAS_ETH (1<<1)
+#define GEMINI_FEAT_HAS_SCSI (1<<2)
+#define GEMINI_FEAT_HAS_P0 (1<<3)
+#define GEMINI_FEAT_FAM_MASK 0xf0
+
+/* Mod/ECO bit definitions */
+#define GEMINI_ECO_LEVEL_MASK 0x0f
+#define GEMINI_MOD_MASK 0xf0
+
+/* Type/revision bit definitions */
+#define GEMINI_REV_MASK 0x0f
+#define GEMINI_TYPE_MASK 0xf0
+
+/* User switch definitions */
+#define GEMINI_SWITCH_VERBOSE 1 /* adds "debug" to boot cmd line */
+#define GEMINI_SWITCH_SINGLE_USER 7 /* boots into "single-user" mode */
+
+#define SGS_RTC_CONTROL 0
+#define SGS_RTC_SECONDS 1
+#define SGS_RTC_MINUTES 2
+#define SGS_RTC_HOURS 3
+#define SGS_RTC_DAY 4
+#define SGS_RTC_DAY_OF_MONTH 5
+#define SGS_RTC_MONTH 6
+#define SGS_RTC_YEAR 7
+
+#define SGS_RTC_SET 0x80
+#define SGS_RTC_IS_STOPPED 0x80
+
+#define GRACKLE_CONFIG_ADDR_ADDR (0xfec00000)
+#define GRACKLE_CONFIG_DATA_ADDR (0xfee00000)
+
+#define GEMINI_BOOT_INIT (0xfff00100)
+
+#ifndef __ASSEMBLY__
+
+static inline void grackle_write( unsigned long addr, unsigned long data )
+{
+ __asm__ __volatile__(
+ " stwbrx %1, 0, %0\n \
+ sync\n \
+ stwbrx %3, 0, %2\n \
+ sync "
+ : /* no output */
+ : "r" (GRACKLE_CONFIG_ADDR_ADDR), "r" (addr),
+ "r" (GRACKLE_CONFIG_DATA_ADDR), "r" (data));
+}
+
+static inline unsigned long grackle_read( unsigned long addr )
+{
+ unsigned long val;
+
+ __asm__ __volatile__(
+ " stwbrx %1, 0, %2\n \
+ sync\n \
+ lwbrx %0, 0, %3\n \
+ sync "
+ : "=r" (val)
+ : "r" (addr), "r" (GRACKLE_CONFIG_ADDR_ADDR),
+ "r" (GRACKLE_CONFIG_DATA_ADDR));
+
+ return val;
+}
+
+static inline void gemini_led_on( int led )
+{
+ if (led >= 0 && led < GEMINI_LEDS)
+ *(unsigned char *)(GEMINI_LEDBASE + (led<<3)) = 1;
+}
+
+static inline void gemini_led_off(int led)
+{
+ if (led >= 0 && led < GEMINI_LEDS)
+ *(unsigned char *)(GEMINI_LEDBASE + (led<<3)) = 0;
+}
+
+static inline int gemini_led_val(int led)
+{
+ int val = 0;
+ if (led >= 0 && led < GEMINI_LEDS)
+ val = *(unsigned char *)(GEMINI_LEDBASE + (led<<3));
+ return (val & 0x1);
+}
+
+/* returns processor id from the board */
+static inline int gemini_processor(void)
+{
+ unsigned char cpu = *(unsigned char *)(GEMINI_CPUSTAT);
+ return (int) ((cpu == 0) ? 4 : (cpu & GEMINI_CPU_ID_MASK));
+}
+
+
+extern void _gemini_reboot(void);
+extern void gemini_prom_init(void);
+extern void gemini_init_l2(void);
+#endif /* __ASSEMBLY__ */
+#endif
diff --git a/include/asm-ppc/gemini_serial.h b/include/asm-ppc/gemini_serial.h
new file mode 100644
index 000000000..745c24a39
--- /dev/null
+++ b/include/asm-ppc/gemini_serial.h
@@ -0,0 +1,39 @@
+#ifndef __ASMPPC_GEMINI_SERIAL_H
+#define __ASMPPC_GEMINI_SERIAL_H
+
+#include <linux/config.h>
+#include <asm/gemini.h>
+
+#ifdef CONFIG_SERIAL_MANY_PORTS
+#define RS_TABLE_SIZE 64
+#else
+#define RS_TABLE_SIZE 4
+#endif
+
+/* Rate for the 24.576 Mhz clock for the onboard serial chip */
+#define BASE_BAUD (24576000 / 16)
+
+#ifdef CONFIG_SERIAL_DETECT_IRQ
+#define STD_COM_FLAGS (/*ASYNC_BOOT_AUTOCONF|*/ASYNC_SKIP_TEST|ASYNC_AUTO_IRQ)
+#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
+#else
+#define STD_COM_FLAGS (/*ASYNC_BOOT_AUTOCONF|*/ASYNC_SKIP_TEST)
+#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF)
+#endif
+
+#define STD_SERIAL_PORT_DEFNS \
+ { 0, BASE_BAUD, GEMINI_SERIAL_A, 15, STD_COM_FLAGS }, /* ttyS0 */ \
+ { 0, BASE_BAUD, GEMINI_SERIAL_B, 14, STD_COM_FLAGS }, /* ttyS1 */ \
+
+#ifdef CONFIG_GEMINI_PU32
+#define PU32_SERIAL_PORT_DEFNS \
+ { 0, BASE_BAUD, NULL, 0, STD_COM_FLAGS },
+#else
+#define PU32_SERIAL_PORT_DEFNS
+#endif
+
+#define SERIAL_PORT_DFNS \
+ STD_SERIAL_PORT_DEFNS \
+ PU32_SERIAL_PORT_DEFNS
+
+#endif
diff --git a/include/asm-ppc/ide.h b/include/asm-ppc/ide.h
index 4bca472e1..fffe270cb 100644
--- a/include/asm-ppc/ide.h
+++ b/include/asm-ppc/ide.h
@@ -21,6 +21,7 @@
#ifdef __KERNEL__
+#include <linux/config.h>
#include <linux/hdreg.h>
#include <linux/ioport.h>
#include <asm/io.h>
@@ -105,16 +106,20 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw,
static __inline__ void ide_init_default_hwifs(void)
{
-#ifdef __DO_I_NEED_THIS
+#ifndef CONFIG_BLK_DEV_IDEPCI
hw_regs_t hw;
int index;
-
- for(index = 0; index < MAX_HWIFS; index++) {
- ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
- hw.irq = ide_default_irq(ide_default_io_base(index));
+ ide_ioreg_t base;
+
+ for (index = 0; index < MAX_HWIFS; index++) {
+ base = ide_default_io_base(index);
+ if (base == 0)
+ continue;
+ ide_init_hwif_ports(&hw, base, 0, NULL);
+ hw.irq = ide_default_irq(base);
ide_register_hw(&hw, NULL);
}
-#endif /* __DO_I_NEED_THIS */
+#endif /* CONFIG_BLK_DEV_IDEPCI */
}
static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
diff --git a/include/asm-ppc/init.h b/include/asm-ppc/init.h
index 5ee43593c..beeb4baf9 100644
--- a/include/asm-ppc/init.h
+++ b/include/asm-ppc/init.h
@@ -1,13 +1,9 @@
#ifndef _PPC_INIT_H
#define _PPC_INIT_H
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 90 /* egcs */
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
+#include <linux/init.h>
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 90 /* egcs */
#define __pmac __attribute__ ((__section__ (".text.pmac")))
#define __pmacdata __attribute__ ((__section__ (".data.pmac")))
#define __pmacfunc(__argpmac) \
@@ -15,11 +11,17 @@
__argpmac
#define __prep __attribute__ ((__section__ (".text.prep")))
-#define __prepdata __attribute__ ((__section__ (".data.prep")))
+#define __prepdata /* __attribute__ ((__section__ (".data.prep")))*/
#define __prepfunc(__argprep) \
__argprep __prep; \
__argprep
+#define __apus __attribute__ ((__section__ (".text.apus")))
+#define __apusdata __attribute__ ((__section__ (".data.apus")))
+#define __apusfunc(__argapus) \
+ __argapus __apus; \
+ __argapus
+
/* this is actually just common chrp/pmac code, not OF code -- Cort */
#define __openfirmware __attribute__ ((__section__ (".text.openfirmware")))
#define __openfirmwaredata __attribute__ ((__section__ (".data.openfirmware")))
@@ -27,23 +29,8 @@
__argopenfirmware __openfirmware; \
__argopenfirmware
-#define __INIT .section ".text.init",#alloc,#execinstr
-#define __FINIT .previous
-#define __INITDATA .section ".data.init",#alloc,#write
-
-#define __cacheline_aligned __attribute__ \
- ((__section__ (".data.cacheline_aligned")))
-
#else /* not egcs */
-#define __init
-#define __initdata
-#define __initfunc(x) x
-
-#define __INIT
-#define __FINIT
-#define __INITDATA
-
#define __pmac
#define __pmacdata
#define __pmacfunc(x) x
@@ -52,10 +39,14 @@
#define __prepdata
#define __prepfunc(x) x
+#define __apus
+#define __apusdata
+#define __apusfunc(x) x
+
#define __openfirmware
#define __openfirmwaredata
#define __openfirmwarefunc(x) x
-#define __cacheline_aligned
#endif /* egcs */
-#endif
+
+#endif /* _PPC_INIT_H */
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index bd8a7d16c..53455fe2f 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -77,7 +77,7 @@ extern unsigned long pci_dram_offset;
#define outb_p(val, port) out_8((unsigned char *)((port)+_IO_BASE), (val))
#define inw_p(port) in_le16((unsigned short *)((port)+_IO_BASE))
#define outw_p(val, port) out_le16((unsigned short *)((port)+_IO_BASE), (val))
-#define inl_p(port) in_le32(((unsigned *)(port)+_IO_BASE))
+#define inl_p(port) in_le32((unsigned *)((port)+_IO_BASE))
#define outl_p(val, port) out_le32((unsigned *)((port)+_IO_BASE), (val))
extern void _insb(volatile unsigned char *port, void *buf, int ns);
diff --git a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h
index 537f402f8..088468abe 100644
--- a/include/asm-ppc/irq.h
+++ b/include/asm-ppc/irq.h
@@ -29,11 +29,9 @@ extern void enable_irq(unsigned int);
#endif /* CONFIG_APUS */
#define NUM_8259_INTERRUPTS 16
-#define NUM_OPENPIC_INTERRUPTS 20
-#define is_8259_irq(n) ((n) < NUM_8259_INTERRUPTS)
+#define IRQ_8259_CASCADE 16
#define openpic_to_irq(n) ((n)+NUM_8259_INTERRUPTS)
#define irq_to_openpic(n) ((n)-NUM_8259_INTERRUPTS)
-#define IRQ_8259_CASCADE NUM_8259_INTERRUPTS
#ifndef CONFIG_APUS
/*
diff --git a/include/asm-ppc/irq_control.h b/include/asm-ppc/irq_control.h
new file mode 100644
index 000000000..022cee7cc
--- /dev/null
+++ b/include/asm-ppc/irq_control.h
@@ -0,0 +1,84 @@
+/*
+ * $Id: irq_control.h,v 1.2 1999/07/17 20:23:58 cort Exp $
+ *
+ * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
+ */
+#ifndef _PPC_IRQ_CONTROL_H
+#define _PPC_IRQ_CONTROL_H
+
+#include <linux/config.h>
+
+#include <asm/irq.h>
+#include <asm/atomic.h>
+
+extern void do_lost_interrupts(unsigned long);
+extern atomic_t ppc_n_lost_interrupts;
+
+#define __no_use_save_flags(flags) \
+ ({__asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory"); })
+
+extern __inline__ void __no_use_restore_flags(unsigned long flags)
+{
+ if ((flags & MSR_EE) && atomic_read(&ppc_n_lost_interrupts) != 0) {
+ do_lost_interrupts(flags);
+ } else {
+ __asm__ __volatile__ ("sync; mtmsr %0; isync"
+ : : "r" (flags) : "memory");
+ }
+}
+
+extern __inline__ void __no_use_sti(void)
+{
+ unsigned long flags;
+
+ __asm__ __volatile__ ("mfmsr %0": "=r" (flags));
+ flags |= MSR_EE;
+ if ( atomic_read(&ppc_n_lost_interrupts) )
+ do_lost_interrupts(flags);
+ __asm__ __volatile__ ("sync; mtmsr %0; isync":: "r" (flags));
+}
+
+extern __inline__ void __no_use_cli(void)
+{
+ unsigned long flags;
+ __asm__ __volatile__ ("mfmsr %0": "=r" (flags));
+ flags &= ~MSR_EE;
+ __asm__ __volatile__ ("sync; mtmsr %0; isync":: "r" (flags));
+}
+
+#define __no_use_mask_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->disable) irq_desc[irq].ctl->disable(irq);})
+#define __no_use_unmask_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->enable) irq_desc[irq].ctl->enable(irq);})
+#define __no_use_mask_and_ack_irq(irq) ({if (irq_desc[irq].ctl && irq_desc[irq].ctl->mask_and_ack) irq_desc[irq].ctl->mask_and_ack(irq);})
+
+#ifdef CONFIG_RTL
+
+/* the rtl system provides these -- Cort */
+extern void __sti(void);
+extern void __cli(void);
+extern void __restore_flags(unsigned int);
+extern unsigned int __return_flags(void);
+#define __save_flags(flags) (flags = __return_flags())
+
+#define rtl_hard_cli __no_use_cli
+#define rtl_hard_sti __no_use_sti
+#define rtl_hard_save_flags(flags) __no_use_save_flags(flags)
+#define rtl_hard_restore_flags(flags) __no_use_restore_flags(flags)
+
+#define rtl_hard_mask_irq(irq) __no_use_mask_irq(irq)
+#define rtl_hard_unmask_irq(irq) __no_use_unmask_irq(irq)
+#define rtl_hard_mask_and_ack_irq(irq) __no_use_mask_and_ack_irq(irq)
+
+#else /* CONFIG_RTL */
+
+#define __cli __no_use_cli
+#define __sti __no_use_sti
+#define __save_flags(flags) __no_use_save_flags(flags)
+#define __restore_flags(flags) __no_use_restore_flags(flags)
+
+#define mask_irq(irq) __no_use_mask_irq(irq)
+#define unmask_irq(irq) __no_use_unmask_irq(irq)
+#define mask_and_ack_irq(irq) __no_use_mask_and_ack_irq(irq)
+
+#endif /* CONFIG_RTL */
+
+#endif /* _PPC_IRQ_CONTROL_H */
diff --git a/include/asm-ppc/keyboard.h b/include/asm-ppc/keyboard.h
index 8629dc527..b868fe20b 100644
--- a/include/asm-ppc/keyboard.h
+++ b/include/asm-ppc/keyboard.h
@@ -2,9 +2,7 @@
* linux/include/asm-ppc/keyboard.h
*
* Created 3 Nov 1996 by Geert Uytterhoeven
- *
- * $Id: keyboard.h,v 1.9 1999/06/10 10:08:56 ralf Exp $
- * Modified for Power Macintosh by Paul Mackerras
+ * Modified for Power Macintosh by Paul Mackerras
*/
/*
@@ -17,8 +15,6 @@
#ifdef __KERNEL__
-#include <asm/io.h>
-
#include <linux/config.h>
#include <asm/adb.h>
#include <asm/machdep.h>
@@ -32,33 +28,47 @@
static inline int kbd_setkeycode(unsigned int scancode, unsigned int keycode)
{
- return ppc_md.kbd_setkeycode(scancode, keycode);
+ if ( ppc_md.kbd_setkeycode )
+ return ppc_md.kbd_setkeycode(scancode, keycode);
+ else
+ return 0;
}
-
+
static inline int kbd_getkeycode(unsigned int scancode)
{
- return ppc_md.kbd_getkeycode(scancode);
+ if ( ppc_md.kbd_getkeycode )
+ return ppc_md.kbd_getkeycode(scancode);
+ else
+ return 0;
}
-
+
static inline int kbd_translate(unsigned char keycode, unsigned char *keycodep,
char raw_mode)
{
- return ppc_md.kbd_translate(keycode, keycodep, raw_mode);
+ if ( ppc_md.kbd_translate )
+ return ppc_md.kbd_translate(keycode, keycodep, raw_mode);
+ else
+ return 0;
}
-
+
static inline int kbd_unexpected_up(unsigned char keycode)
{
- return ppc_md.kbd_unexpected_up(keycode);
+ if ( ppc_md.kbd_unexpected_up )
+ return ppc_md.kbd_unexpected_up(keycode);
+ else
+ return 0;
}
-
+
static inline void kbd_leds(unsigned char leds)
{
- ppc_md.kbd_leds(leds);
+ if ( ppc_md.kbd_leds )
+ ppc_md.kbd_leds(leds);
}
-
+
static inline void kbd_init_hw(void)
{
- ppc_md.kbd_init_hw();
+ if ( ppc_md.kbd_init_hw )
+ ppc_md.kbd_init_hw();
}
#define kbd_sysrq_xlate (ppc_md.ppc_kbd_sysrq_xlate)
@@ -67,34 +77,6 @@ extern unsigned long SYSRQ_KEY;
#endif /* CONFIG_APUS */
-/* How to access the keyboard macros on this platform. */
-#define kbd_read_input() inb(KBD_DATA_REG)
-#define kbd_read_status() inb(KBD_STATUS_REG)
-#define kbd_write_output(val) outb(val, KBD_DATA_REG)
-#define kbd_write_command(val) outb(val, KBD_CNTL_REG)
-
-/* Some stoneage hardware needs delays after some operations. */
-#define kbd_pause() do { } while(0)
-
-#endif /* CONFIG_MAC_KEYBOARD */
-
-#define keyboard_setup() \
- request_region(0x60, 16, "keyboard")
-
-/*
- * Machine specific bits for the PS/2 driver
- *
- * FIXME: does any PPC machine use the PS/2 driver at all? If so,
- * this should work, if not it's dead code ...
- */
-
-#define AUX_IRQ 12
-
-#define ps2_request_irq() \
- request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL)
-
-#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL)
-
#endif /* __KERNEL__ */
#endif /* __ASMPPC_KEYBOARD_H */
diff --git a/include/asm-ppc/m48t35.h b/include/asm-ppc/m48t35.h
new file mode 100644
index 000000000..2e45f4f0b
--- /dev/null
+++ b/include/asm-ppc/m48t35.h
@@ -0,0 +1,30 @@
+/*
+ * Registers for the SGS-Thomson M48T35 Timekeeper RAM chip
+ */
+
+#ifndef __PPC_M48T35_H
+#define __PPC_M48T35_H
+
+/* RTC offsets */
+#define M48T35_RTC_CONTROL 0
+#define M48T35_RTC_SECONDS 1
+#define M48T35_RTC_MINUTES 2
+#define M48T35_RTC_HOURS 3
+#define M48T35_RTC_DAY 4
+#define M48T35_RTC_DOM 5
+#define M48T35_RTC_MONTH 6
+#define M48T35_RTC_YEAR 7
+
+#define M48T35_RTC_SET 0x80
+#define M48T35_RTC_STOPPED 0x80
+#define M48T35_RTC_READ 0x40
+
+#ifndef BCD_TO_BIN
+#define BCD_TO_BIN(x) ((x)=((x)&15) + ((x)>>4)*10)
+#endif
+
+#ifndef BIN_TO_BCD
+#define BIN_TO_BCD(x) ((x)=(((x)/10)<<4) + (x)%10)
+#endif
+
+#endif
diff --git a/include/asm-ppc/machdep.h b/include/asm-ppc/machdep.h
index b47f36983..cd1dbe294 100644
--- a/include/asm-ppc/machdep.h
+++ b/include/asm-ppc/machdep.h
@@ -39,6 +39,8 @@ struct machdep_calls {
unsigned long heartbeat_reset;
unsigned long heartbeat_count;
+ void (*progress)(char *, unsigned short);
+
unsigned char (*nvram_read_val)(int addr);
void (*nvram_write_val)(int addr, unsigned char val);
@@ -70,6 +72,8 @@ struct machdep_calls {
int (*pcibios_write_config_dword)(unsigned char bus,
unsigned char dev_fn, unsigned char offset, unsigned int val);
void (*pcibios_fixup)(void);
+struct pci_bus;
+ void (*pcibios_fixup_bus)(struct pci_bus *);
};
extern struct machdep_calls ppc_md;
@@ -77,4 +81,20 @@ extern char cmd_line[512];
extern void setup_pci_ptrs(void);
+#define BOOT_INFO_VER 0x1
+#define BOOT_INFO_MAGIC 0x05027800
+
+struct boot_info
+{
+ unsigned long magic_start;
+ char cmd_line[256];
+ char boot_loader[128];
+ int _machine;
+ unsigned long initrd_start, initrd_size;
+ unsigned long systemmap_start, systemmap_size;
+ unsigned long prom_entry;
+ char reserved[3680]; /* pad to 1 page */
+ unsigned long magic_end;
+};
+struct boot_info *binfo;
#endif /* _PPC_MACHDEP_H */
diff --git a/include/asm-ppc/md.h b/include/asm-ppc/md.h
index d404b2906..0ff3e7e92 100644
--- a/include/asm-ppc/md.h
+++ b/include/asm-ppc/md.h
@@ -1,4 +1,4 @@
-/* $Id: md.h,v 1.1 1998/03/16 08:43:38 ralf Exp $
+/* $Id: md.h,v 1.1 1997/12/15 15:12:15 jj Exp $
* md.h: High speed xor_block operation for RAID4/5
*
*/
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
index 50fa27081..a7e0a5246 100644
--- a/include/asm-ppc/mmu_context.h
+++ b/include/asm-ppc/mmu_context.h
@@ -20,15 +20,15 @@
*/
#ifdef CONFIG_8xx
-#define NO_CONTEXT 16
-#define LAST_CONTEXT 15
+#define NO_CONTEXT 16
+#define LAST_CONTEXT 15
#define MUNGE_CONTEXT(n) (n)
#else
/* PPC 6xx, 7xx CPUs */
-#define NO_CONTEXT 0
-#define LAST_CONTEXT 0xfffff
+#define NO_CONTEXT 0
+#define LAST_CONTEXT 0xfffff
/*
* Allocating context numbers this way tends to spread out
@@ -41,18 +41,25 @@
extern atomic_t next_mmu_context;
extern void mmu_context_overflow(void);
-#ifndef CONFIG_8xx
+/*
+ * Set the current MMU context.
+ * On 32-bit PowerPCs (other than the 8xx embedded chips), this is done by
+ * loading up the segment registers for the user part of the address space.
+ */
extern void set_context(int context);
-#else
-#define set_context(context) do { } while (0)
+
+#ifdef CONFIG_8xx
+extern inline void mmu_context_overflow(void)
+{
+ atomic_set(&next_mmu_context, -1);
+}
#endif
/*
* Get a new mmu context for task tsk if necessary.
*/
-#define get_mmu_context(tsk) \
+#define get_mmu_context(mm) \
do { \
- struct mm_struct *mm = (tsk)->mm; \
if (mm->context == NO_CONTEXT) { \
if (atomic_read(&next_mmu_context) == LAST_CONTEXT) \
mmu_context_overflow(); \
@@ -63,21 +70,30 @@ do { \
/*
* Set up the context for a new address space.
*/
-#define init_new_context(mm) ((mm)->context = NO_CONTEXT)
+#define init_new_context(tsk,mm) ((mm)->context = NO_CONTEXT)
/*
* We're finished using the context for an address space.
*/
#define destroy_context(mm) do { } while (0)
+static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+ struct task_struct *tsk, int cpu)
+{
+ tsk->thread.pgdir = next->pgd;
+ get_mmu_context(next);
+ set_context(next->context);
+}
+
/*
* After we have set current->mm to a new value, this activates
* the context for the new mm so we see the new mappings.
*/
-extern inline void activate_context(struct task_struct *tsk)
+static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm)
{
- get_mmu_context(tsk);
- set_context(tsk->mm->context);
+ current->thread.pgdir = mm->pgd;
+ get_mmu_context(mm);
+ set_context(mm->context);
}
/*
diff --git a/include/asm-ppc/namei.h b/include/asm-ppc/namei.h
index a4b277b40..9e0268b03 100644
--- a/include/asm-ppc/namei.h
+++ b/include/asm-ppc/namei.h
@@ -1,4 +1,4 @@
-/* $Id: namei.h,v 1.4 1998/12/08 20:52:03 ralf Exp $
+/* $Id: namei.h,v 1.4 1998/10/28 08:13:33 jj Exp $
* linux/include/asm-ppc/namei.h
* Adapted from linux/include/asm-alpha/namei.h
*
diff --git a/include/asm-ppc/page.h b/include/asm-ppc/page.h
index 70b710d77..b67ca5cc0 100644
--- a/include/asm-ppc/page.h
+++ b/include/asm-ppc/page.h
@@ -23,7 +23,7 @@
#define BUG() do { \
printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
__asm__ __volatile__(".long 0x0"); \
-}
+} while (0)
#endif
#define PAGE_BUG(page) do { BUG(); } while (0)
@@ -80,15 +80,34 @@ extern void clear_page(unsigned long page);
#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
/* map phys->virtual and virtual->phys for RAM pages */
-#ifdef CONFIG_APUS
-#include <asm/amigappc.h>
-/* Word at CYBERBASEp has the value (-KERNELBASE+CYBERBASE). */
-#define __pa(x) ((unsigned long)(x)+(*(unsigned long*)CYBERBASEp))
-#define __va(x) ((void *)((unsigned long)(x)-(*(unsigned long*)CYBERBASEp)))
-#else
-#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
-#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
-#endif
+static inline unsigned long ___pa(unsigned long v)
+{
+ unsigned long p;
+ asm volatile ("1: addis %0, %1, %2;"
+ ".section \".vtop_fixup\",\"aw\";"
+ ".align 1;"
+ ".long 1b;"
+ ".previous;"
+ : "=r" (p)
+ : "b" (v), "K" (((-PAGE_OFFSET) >> 16) & 0xffff));
+
+ return p;
+}
+static inline void* ___va(unsigned long p)
+{
+ unsigned long v;
+ asm volatile ("1: addis %0, %1, %2;"
+ ".section \".ptov_fixup\",\"aw\";"
+ ".align 1;"
+ ".long 1b;"
+ ".previous;"
+ : "=r" (v)
+ : "b" (p), "K" (((PAGE_OFFSET) >> 16) & 0xffff));
+
+ return (void*) v;
+}
+#define __pa(x) ___pa ((unsigned long)(x))
+#define __va(x) ___va ((unsigned long)(x))
#define MAP_NR(addr) (((unsigned long)addr-PAGE_OFFSET) >> PAGE_SHIFT)
#define MAP_PAGE_RESERVED (1<<15)
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
new file mode 100644
index 000000000..d1f8eb158
--- /dev/null
+++ b/include/asm-ppc/pci.h
@@ -0,0 +1,10 @@
+#ifndef __PPC_PCI_H
+#define __PPC_PCI_H
+
+/* Can be used to override the logic in pci_scan_bus for skipping
+ * already-configured bus numbers - to be used for buggy BIOSes
+ * or architectures with incomplete PCI setup by the loader.
+ */
+#define pcibios_assign_all_busses() 0
+
+#endif /* __PPC_PCI_H */
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index 235e1f762..ebb5fd934 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -20,11 +20,6 @@ extern void local_flush_tlb_range(struct mm_struct *mm, unsigned long start,
#define flush_tlb_page local_flush_tlb_page
#define flush_tlb_range local_flush_tlb_range
-extern __inline__ void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end)
-{
- /* PPC has hw page tables. */
-}
-
/*
* No cache flushing is required when address mappings are
* changed, because the caches on PowerPCs are physically
@@ -44,6 +39,7 @@ extern unsigned long va_to_phys(unsigned long address);
extern pte_t *va_to_pte(struct task_struct *tsk, unsigned long address);
extern unsigned long ioremap_bot, ioremap_base;
#endif /* __ASSEMBLY__ */
+
/*
* The PowerPC MMU uses a hash table containing PTEs, together with
* a set of 16 segment registers (on 32-bit implementations), to define
@@ -56,7 +52,9 @@ extern unsigned long ioremap_bot, ioremap_base;
* for extracting ptes from the tree and putting them into the hash table
* when necessary, and updating the accessed and modified bits in the
* page table tree.
- *
+ */
+
+/*
* The PowerPC MPC8xx uses a TLB with hardware assisted, software tablewalk.
* We also use the two level tables, but we can put the real bits in them
* needed for the TLB and tablewalk. These definitions require Mx_CTR.PPM = 0,
@@ -94,7 +92,8 @@ extern unsigned long ioremap_bot, ioremap_base;
#define PTRS_PER_PGD 1024
#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
-/* Just any arbitrary offset to the start of the vmalloc VM area: the
+/*
+ * Just any arbitrary offset to the start of the vmalloc VM area: the
* current 64MB value just means that there will be a 64MB "hole" after the
* physical memory until the kernel virtual memory starts. That means that
* any out-of-bounds memory accesses will hopefully be caught.
@@ -120,6 +119,7 @@ extern unsigned long ioremap_bot, ioremap_base;
* (hardware-defined) PowerPC PTE as closely as possible.
*/
#ifndef CONFIG_8xx
+/* Definitions for 60x, 740/750, etc. */
#define _PAGE_PRESENT 0x001 /* software: pte contains a translation */
#define _PAGE_USER 0x002 /* matches one of the PP bits */
#define _PAGE_RW 0x004 /* software: user write access allowed */
@@ -133,6 +133,7 @@ extern unsigned long ioremap_bot, ioremap_base;
#define _PAGE_SHARED 0
#else
+/* Definitions for 8xx embedded chips. */
#define _PAGE_PRESENT 0x0001 /* Page is valid */
#define _PAGE_NO_CACHE 0x0002 /* I: cache inhibit */
#define _PAGE_SHARED 0x0004 /* No ASID (context) compare */
@@ -225,20 +226,6 @@ extern unsigned long empty_zero_page[1024];
/* 64-bit machines, beware! SRB. */
#define SIZEOF_PTR_LOG2 2
-/* to set the page-dir */
-/* tsk is a task_struct and pgdir is a pte_t */
-#ifndef CONFIG_8xx
-#define SET_PAGE_DIR(tsk,pgdir) \
- ((tsk)->tss.pg_tables = (unsigned long *)(pgdir))
-#else /* CONFIG_8xx */
-#define SET_PAGE_DIR(tsk,pgdir) \
- do { \
- unsigned long __pgdir = (unsigned long)pgdir; \
- ((tsk)->tss.pg_tables = (unsigned long *)(__pgdir)); \
- asm("mtspr %0,%1 \n\t" : : "i"(M_TWB), "r"(__pa(__pgdir))); \
- } while (0)
-#endif /* CONFIG_8xx */
-
#ifndef __ASSEMBLY__
extern inline int pte_none(pte_t pte) { return !pte_val(pte); }
extern inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; }
@@ -647,5 +634,24 @@ extern void kernel_set_cachemode (unsigned long address, unsigned long size,
#define PageSkip(page) (0)
#define kern_addr_valid(addr) (1)
+#define io_remap_page_range remap_page_range
+
+#ifdef CONFIG_8xx
+#define __tlbia() asm volatile ("tlbia" : : )
+
+extern inline void local_flush_tlb_all(void)
+ { __tlbia(); }
+extern inline void local_flush_tlb_mm(struct mm_struct *mm)
+ { __tlbia(); }
+extern inline void local_flush_tlb_page(struct vm_area_struct *vma,
+ unsigned long vmaddr)
+ { __tlbia(); }
+extern inline void local_flush_tlb_range(struct mm_struct *mm,
+ unsigned long start, unsigned long end)
+ { __tlbia(); }
+extern inline void flush_hash_page(unsigned context, unsigned long va)
+ { }
+#endif
+
#endif __ASSEMBLY__
#endif /* _PPC_PGTABLE_H */
diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h
index 22f3e39f1..53096182c 100644
--- a/include/asm-ppc/processor.h
+++ b/include/asm-ppc/processor.h
@@ -66,8 +66,33 @@
#define HID0_BTCD (1<<1) /* Branch target cache disable */
/* fpscr settings */
-#define FPSCR_FX (1<<31)
-#define FPSCR_FEX (1<<30)
+#define FPSCR_FX 0x80000000 /* FPU exception summary */
+#define FPSCR_FEX 0x40000000 /* FPU enabled exception summary */
+#define FPSCR_VX 0x20000000 /* Invalid operation summary */
+#define FPSCR_OX 0x10000000 /* Overflow exception summary */
+#define FPSCR_UX 0x08000000 /* Underflow exception summary */
+#define FPSCR_ZX 0x04000000 /* Zero-devide exception summary */
+#define FPSCR_XX 0x02000000 /* Inexact exception summary */
+#define FPSCR_VXSNAN 0x01000000 /* Invalid op for SNaN */
+#define FPSCR_VXISI 0x00800000 /* Invalid op for Inv - Inv */
+#define FPSCR_VXIDI 0x00400000 /* Invalid op for Inv / Inv */
+#define FPSCR_VXZDZ 0x00200000 /* Invalid op for Zero / Zero */
+#define FPSCR_VXIMZ 0x00100000 /* Invalid op for Inv * Zero */
+#define FPSCR_VXVC 0x00080000 /* Invalid op for Compare */
+#define FPSCR_FR 0x00040000 /* Fraction rounded */
+#define FPSCR_FI 0x00020000 /* Fraction inexact */
+#define FPSCR_FPRF 0x0001f000 /* FPU Result Flags */
+#define FPSCR_FPCC 0x0000f000 /* FPU Condition Codes */
+#define FPSCR_VXSOFT 0x00000400 /* Invalid op for software request */
+#define FPSCR_VXSQRT 0x00000200 /* Invalid op for square root */
+#define FPSCR_VXCVI 0x00000100 /* Invalid op for integer convert */
+#define FPSCR_VE 0x00000080 /* Invalid op exception enable */
+#define FPSCR_OE 0x00000040 /* IEEE overflow exception enable */
+#define FPSCR_UE 0x00000020 /* IEEE underflow exception enable */
+#define FPSCR_ZE 0x00000010 /* IEEE zero divide exception enable */
+#define FPSCR_XE 0x00000008 /* FP inexact exception enable */
+#define FPSCR_NI 0x00000004 /* FPU non IEEE-Mode */
+#define FPSCR_RN 0x00000003 /* FPU rounding control */
#define _MACH_prep 1
#define _MACH_Pmac 2 /* pmac or pmac clone (non-chrp) */
@@ -78,6 +103,7 @@
#define _MACH_rpxlite 64 /* RPCG RPX-Lite 8xx board */
#define _MACH_bseip 128 /* Bright Star Engineering ip-Engine */
#define _MACH_yk 256 /* Motorola Yellowknife */
+#define _MACH_gemini 512 /* Synergy Microsystems gemini board */
/* see residual.h for these */
#define _PREP_Motorola 0x01 /* motorola prep */
@@ -154,6 +180,7 @@ n:
#define DEC 22 /* Decrementer */
#define EAR 282 /* External Address Register */
#define L2CR 1017 /* PPC 750 L2 control register */
+#define IMMR 638 /* PPC 860/821 Internal Memory Map Register */
#define THRM1 1020
#define THRM2 1021
@@ -242,10 +269,10 @@ typedef struct {
struct thread_struct {
unsigned long ksp; /* Kernel stack pointer */
- unsigned long *pg_tables; /* Base of page-table tree */
unsigned long wchan; /* Event task is sleeping on */
struct pt_regs *regs; /* Pointer to saved register state */
mm_segment_t fs; /* for get_fs() validation */
+ void *pgdir; /* root of page-table tree */
signed long last_syscall;
double fpr[32]; /* Complete floating point set */
unsigned long fpscr_pad; /* fpr ... fpscr must be contiguous */
@@ -254,12 +281,12 @@ struct thread_struct {
#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack)
-#define INIT_TSS { \
+#define INIT_THREAD { \
INIT_SP, /* ksp */ \
- (unsigned long *) swapper_pg_dir, /* pg_tables */ \
0, /* wchan */ \
(struct pt_regs *)INIT_SP - 1, /* regs */ \
KERNEL_DS, /*fs*/ \
+ swapper_pg_dir, /* pgdir */ \
0, /* last_syscall */ \
{0}, 0, 0 \
}
@@ -280,13 +307,14 @@ static inline unsigned long thread_saved_pc(struct thread_struct *t)
return (t->regs) ? t->regs->nip : 0;
}
-#define copy_segments(nr, tsk, mm) do { } while (0)
+#define copy_segments(tsk, mm) do { } while (0)
#define release_segments(mm) do { } while (0)
#define forget_segments() do { } while (0)
/*
* NOTE! The task struct and the stack go together
*/
+#define THREAD_SIZE (2*PAGE_SIZE)
#define alloc_task_struct() \
((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
#define free_task_struct(p) free_pages((unsigned long)(p),1)
@@ -295,22 +323,13 @@ static inline unsigned long thread_saved_pc(struct thread_struct *t)
int ll_printk(const char *, ...);
void ll_puts(const char *);
-#endif /* ndef ASSEMBLY*/
-
#define init_task (init_task_union.task)
#define init_stack (init_task_union.stack)
-
+
/* In misc.c */
void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
-/*
- * Return_address is a replacement for __builtin_return_address(count)
- * which on certain architectures cannot reasonably be implemented in GCC
- * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
- * Note that __builtin_return_address(x>=1) is forbidden because the GCC
- * aborts compilation on some CPUs. It's simply not possible to unwind
- * some CPU's stackframes.
- */
-#define return_address() __builtin_return_address(0)
+#endif /* ndef ASSEMBLY*/
+
#endif /* __ASM_PPC_PROCESSOR_H */
diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h
index a37b96a0c..52a4953ac 100644
--- a/include/asm-ppc/ptrace.h
+++ b/include/asm-ppc/ptrace.h
@@ -6,7 +6,7 @@
* kernel stack during a system call or other kernel entry.
*
* this should only contain volatile regs
- * since we can keep non-volatile in the tss
+ * since we can keep non-volatile in the thread_struct
* should set this up when only volatiles are saved
* by intr code.
*
diff --git a/include/asm-ppc/resource.h b/include/asm-ppc/resource.h
index 674e6d6f1..c8ced55c5 100644
--- a/include/asm-ppc/resource.h
+++ b/include/asm-ppc/resource.h
@@ -24,8 +24,8 @@
{_STK_LIM, LONG_MAX}, /* RLIMIT_STACK */ \
{ 0, LONG_MAX}, /* RLIMIT_CORE */ \
{LONG_MAX, LONG_MAX}, /* RLIMIT_RSS */ \
- {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, /* RLIMIT_NPROC */ \
- { NR_OPEN, NR_OPEN}, /* RLIMIT_NOFILE */ \
+ {0, 0}, \
+ {INR_OPEN, INR_OPEN}, /* RLIMIT_NOFILE */ \
{LONG_MAX, LONG_MAX}, /* RLIMIT_MEMLOCK */ \
{LONG_MAX, LONG_MAX}, /* RLIMIT_AS */ \
}
diff --git a/include/asm-ppc/semaphore.h b/include/asm-ppc/semaphore.h
index f7b87ff0d..b73bd5961 100644
--- a/include/asm-ppc/semaphore.h
+++ b/include/asm-ppc/semaphore.h
@@ -1,5 +1,5 @@
-#ifndef _SPARC_SEMAPHORE_H
-#define _SPARC_SEMAPHORE_H
+#ifndef _PPC_SEMAPHORE_H
+#define _PPC_SEMAPHORE_H
/*
* Swiped from asm-sparc/semaphore.h and modified
@@ -104,4 +104,4 @@ extern inline void up(struct semaphore * sem)
#endif /* __KERNEL__ */
-#endif /* !(_SPARC_SEMAPHORE_H) */
+#endif /* !(_PPC_SEMAPHORE_H) */
diff --git a/include/asm-ppc/serial.h b/include/asm-ppc/serial.h
index ff42aa817..edef8a7da 100644
--- a/include/asm-ppc/serial.h
+++ b/include/asm-ppc/serial.h
@@ -7,6 +7,9 @@
#ifdef CONFIG_APUS
#include <asm-m68k/serial.h>
#else
+#ifdef CONFIG_GEMINI
+#include <asm/gemini_serial.h>
+#else
/*
* This assumes you have a 1.8432 MHz clock for your UART.
@@ -17,6 +20,24 @@
*/
#define BASE_BAUD ( 1843200 / 16 )
+#ifdef CONFIG_PMAC
+/*
+ * Auto-probing will cause machine checks on powermacs.
+ */
+#define SERIAL_PORT_DFNS
+
+#ifdef CONFIG_SERIAL_MANY_PORTS
+#define RS_TABLE_SIZE 64
+#else
+#define RS_TABLE_SIZE 4
+#endif
+
+#else
+#define SERIAL_PORT_DFNS
+/*
+ * PReP, CHRP, etc.
+ */
+
/* Standard COM flags (except for COM4, because of the 8514 problem) */
#ifdef CONFIG_SERIAL_DETECT_IRQ
#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
@@ -120,4 +141,6 @@
HUB6_SERIAL_PORT_DFNS \
MCA_SERIAL_PORT_DFNS
+#endif /* CONFIG_PMAC */
+#endif /* CONFIG_GEMINI */
#endif /* CONFIG_APUS */
diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h
index 9186b39e5..eab97eea9 100644
--- a/include/asm-ppc/smp.h
+++ b/include/asm-ppc/smp.h
@@ -7,7 +7,6 @@
#define _PPC_SMP_H
#include <linux/kernel.h>
-#include <linux/tasks.h>
#ifdef __SMP__
diff --git a/include/asm-ppc/smplock.h b/include/asm-ppc/smplock.h
index e62326a10..1590fafe9 100644
--- a/include/asm-ppc/smplock.h
+++ b/include/asm-ppc/smplock.h
@@ -4,7 +4,7 @@
* Default SMP lock implementation
*/
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-ppc/softirq.h b/include/asm-ppc/softirq.h
index 73946f206..1188809e9 100644
--- a/include/asm-ppc/softirq.h
+++ b/include/asm-ppc/softirq.h
@@ -54,19 +54,23 @@ static inline void end_bh_atomic(void)
/* These are for the IRQs testing the lock */
static inline int softirq_trylock(int cpu)
{
- if (!test_and_set_bit(0,&global_bh_count)) {
- if (atomic_read(&global_bh_lock) &&
- ppc_local_bh_count[cpu] == 0) {
- ++ppc_local_bh_count[cpu];
- return 1;
+ if (ppc_local_bh_count[cpu] == 0) {
+ ppc_local_bh_count[cpu] = 1;
+ if (!test_and_set_bit(0,&global_bh_count)) {
+ mb();
+ if (atomic_read(&global_bh_lock) == 0)
+ return 1;
+ clear_bit(0,&global_bh_count);
}
- clear_bit(0,&global_bh_count);
+ ppc_local_bh_count[cpu] = 0;
+ mb();
}
return 0;
}
static inline void softirq_endlock(int cpu)
{
+ mb();
ppc_local_bh_count[cpu]--;
clear_bit(0,&global_bh_count);
}
diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h
index 8332d34a7..327b4927a 100644
--- a/include/asm-ppc/spinlock.h
+++ b/include/asm-ppc/spinlock.h
@@ -1,79 +1,6 @@
#ifndef __ASM_SPINLOCK_H
#define __ASM_SPINLOCK_H
-#ifndef __SMP__
-/*
- * Your basic spinlocks, allowing only a single CPU anywhere
- *
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
- typedef struct { } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
-#else
- typedef struct { int gcc_is_buggy; } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-#endif
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) do { } while(0)
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) do { } while(0)
-#define spin_lock_irq(lock) cli()
-#define spin_unlock_irq(lock) sti()
-#define spin_lock_bh(lock) local_bh_disable()
-#define spin_unlock_bh(lock) local_bh_enable()
-#define spin_lock_irqsave(lock, flags) \
- do { save_flags(flags); cli(); } while (0)
-
-#define spin_unlock_irqrestore(lock, flags) \
- restore_flags(flags)
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- *
- * Gcc-2.7.x has a nasty bug with empty initializers.
- */
-#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
- typedef struct { } rwlock_t;
- #define RW_LOCK_UNLOCKED (rwlock_t) { }
-#else
- typedef struct { int gcc_is_buggy; } rwlock_t;
- #define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
-#endif
-
-#define read_lock(lock) do { } while(0)
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) do { } while(0)
-#define write_unlock(lock) do { } while(0)
-#define read_lock_irq(lock) cli()
-#define read_unlock_irq(lock) sti()
-#define write_lock_irq(lock) cli()
-#define write_unlock_irq(lock) sti()
-#define read_lock_bh(lock) local_bh_disable()
-#define read_unlock_bh(lock) local_bh_enable()
-#define write_lock_bh(lock) local_bh_disable()
-#define write_unlock_bh(lock) local_bh_enable()
-
-#define read_lock_irqsave(lock, flags) \
- do { save_flags(flags); cli(); } while (0)
-#define read_unlock_irqrestore(lock, flags) \
- restore_flags(flags)
-#define write_lock_irqsave(lock, flags) \
- do { save_flags(flags); cli(); } while (0)
-#define write_unlock_irqrestore(lock, flags) \
- restore_flags(flags)
-
-#else /* __SMP__ */
-
/* Simple spin lock operations. There are two variants, one clears IRQ's
* on the local processor, one does not.
*
@@ -139,22 +66,4 @@ extern void _write_unlock(rwlock_t *rw);
#define write_unlock(rw) _write_unlock(rw)
#define read_unlock(rw) _read_unlock(rw)
-#define read_lock_irq(lock) do { __cli(); read_lock(lock); } while (0)
-#define read_lock_bh(lock) do { local_bh_disable(); read_lock(lock); } while (0)
-#define read_unlock_irq(lock) do { read_unlock(lock); __sti(); } while (0)
-#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0)
-#define write_lock_irq(lock) do { __cli(); write_lock(lock); } while (0)
-#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while(0)
-#define write_unlock_irq(lock) do { write_unlock(lock); __sti(); } while (0)
-#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while(0)
-#define read_lock_irqsave(lock, flags) \
- do { __save_flags(flags); __cli(); read_lock(lock); } while (0)
-#define read_unlock_irqrestore(lock, flags) \
- do { read_unlock(lock); __restore_flags(flags); } while (0)
-#define write_lock_irqsave(lock, flags) \
- do { __save_flags(flags); __cli(); write_lock(lock); } while (0)
-#define write_unlock_irqrestore(lock, flags) \
- do { write_unlock(lock); __restore_flags(flags); } while (0)
-
-#endif /* SMP */
#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-ppc/system.h b/include/asm-ppc/system.h
index 09790d0cd..9984267dd 100644
--- a/include/asm-ppc/system.h
+++ b/include/asm-ppc/system.h
@@ -1,9 +1,16 @@
+/*
+ * $Id: system.h,v 1.48 1999/09/05 11:56:40 paulus Exp $
+ *
+ * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
+ */
#ifndef __PPC_SYSTEM_H
#define __PPC_SYSTEM_H
#include <linux/kdev_t.h>
+
#include <asm/processor.h>
#include <asm/atomic.h>
+#include <asm/irq_control.h>
/*
* Memory barrier.
@@ -25,12 +32,13 @@
#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
#define wmb() __asm__ __volatile__ ("eieio" : : : "memory")
+#define set_mb(var, value) do { var = value; mb(); } while (0)
+#define set_rmb(var, value) do { var = value; rmb(); } while (0)
+#define set_wmb(var, value) do { var = value; wmb(); } while (0)
+
extern void xmon_irq(int, void *, struct pt_regs *);
extern void xmon(struct pt_regs *excp);
-#define __save_flags(flags) ({\
- __asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory"); })
-#define __save_and_cli(flags) ({__save_flags(flags);__cli();})
/* Data cache block flush - write out the cache line containing the
specified address and then invalidate it in the cache. */
@@ -39,25 +47,6 @@ extern __inline__ void dcbf(void *line)
asm("dcbf %0,%1; sync" : : "r" (line), "r" (0));
}
-extern __inline__ void __restore_flags(unsigned long flags)
-{
- extern atomic_t ppc_n_lost_interrupts;
- extern void do_lost_interrupts(unsigned long);
-
- if ((flags & MSR_EE) && atomic_read(&ppc_n_lost_interrupts) != 0) {
- do_lost_interrupts(flags);
- } else {
- __asm__ __volatile__ ("sync; mtmsr %0; isync"
- : : "r" (flags) : "memory");
- }
-}
-
-
-extern void __sti(void);
-extern void __cli(void);
-extern int _disable_interrupts(void);
-extern void _enable_interrupts(int);
-
extern void print_backtrace(unsigned long *);
extern void show_regs(struct pt_regs * regs);
extern void flush_instruction_cache(void);
@@ -75,21 +64,19 @@ extern void enable_kernel_fp(void);
extern void cvt_fd(float *from, double *to, unsigned long *fpscr);
extern void cvt_df(double *from, float *to, unsigned long *fpscr);
extern int call_rtas(const char *, int, int, unsigned long *, ...);
-extern void chrp_progress(char *);
-void chrp_event_scan(void);
struct device_node;
extern void note_scsi_host(struct device_node *, void *);
struct task_struct;
+#define prepare_to_switch() do { } while(0)
#define switch_to(prev,next,last) _switch_to((prev),(next),&(last))
extern void _switch_to(struct task_struct *, struct task_struct *,
struct task_struct **);
struct thread_struct;
extern struct task_struct *_switch(struct thread_struct *prev,
- struct thread_struct *next,
- unsigned long context);
+ struct thread_struct *next);
extern unsigned int rtas_data;
diff --git a/include/asm-ppc/uaccess.h b/include/asm-ppc/uaccess.h
index 59956966a..b8afd599b 100644
--- a/include/asm-ppc/uaccess.h
+++ b/include/asm-ppc/uaccess.h
@@ -21,8 +21,8 @@
#define USER_DS ((mm_segment_t) { 1 })
#define get_ds() (KERNEL_DS)
-#define get_fs() (current->tss.fs)
-#define set_fs(val) (current->tss.fs = (val))
+#define get_fs() (current->thread.fs)
+#define set_fs(val) (current->thread.fs = (val))
#define segment_eq(a,b) ((a).seg == (b).seg)
diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
index 38372df08..35641aff0 100644
--- a/include/asm-ppc/unistd.h
+++ b/include/asm-ppc/unistd.h
@@ -381,7 +381,6 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
* System call prototypes.
*/
#define __NR__exit __NR_exit
-static inline _syscall0(int,idle)
static inline _syscall0(int,pause)
static inline _syscall0(int,sync)
static inline _syscall0(pid_t,setsid)
diff --git a/include/asm-sh/a.out.h b/include/asm-sh/a.out.h
new file mode 100644
index 000000000..6e9fca9ee
--- /dev/null
+++ b/include/asm-sh/a.out.h
@@ -0,0 +1,26 @@
+#ifndef __ASM_SH_A_OUT_H
+#define __ASM_SH_A_OUT_H
+
+struct exec
+{
+ unsigned long a_info; /* Use macros N_MAGIC, etc for access */
+ unsigned a_text; /* length of text, in bytes */
+ unsigned a_data; /* length of data, in bytes */
+ unsigned a_bss; /* length of uninitialized data area for file, in bytes */
+ unsigned a_syms; /* length of symbol table data in file, in bytes */
+ unsigned a_entry; /* start address */
+ unsigned a_trsize; /* length of relocation info for text, in bytes */
+ unsigned a_drsize; /* length of relocation info for data, in bytes */
+};
+
+#define N_TRSIZE(a) ((a).a_trsize)
+#define N_DRSIZE(a) ((a).a_drsize)
+#define N_SYMSIZE(a) ((a).a_syms)
+
+#ifdef __KERNEL__
+
+#define STACK_TOP TASK_SIZE
+
+#endif
+
+#endif /* __ASM_SH_A_OUT_H */
diff --git a/include/asm-sh/addrspace.h b/include/asm-sh/addrspace.h
new file mode 100644
index 000000000..152708837
--- /dev/null
+++ b/include/asm-sh/addrspace.h
@@ -0,0 +1,41 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 1996 by Ralf Baechle
+ * Copyright (C) 1999 by Niibe Yutaka
+ *
+ * Defitions for the address spaces of the SH CPUs.
+ */
+#ifndef __ASM_SH_ADDRSPACE_H
+#define __ASM_SH_ADDRSPACE_H
+
+/*
+ * Memory segments (32bit kernel mode addresses)
+ */
+#define KUSEG 0x00000000
+#define KSEG0 0x80000000
+#define KSEG1 0xa0000000
+#define KSEG2 0xc0000000
+#define KSEG3 0xe0000000
+
+/*
+ * Returns the kernel segment base of a given address
+ */
+#define KSEGX(a) (((unsigned long)(a)) & 0xe0000000)
+
+/*
+ * Returns the physical address of a KSEG0/KSEG1 address
+ */
+#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
+
+/*
+ * Map an address to a certain kernel segment
+ */
+#define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0))
+#define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1))
+#define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2))
+#define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3))
+
+#endif /* __ASM_SH_ADDRSPACE_H */
diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h
new file mode 100644
index 000000000..d2af3d769
--- /dev/null
+++ b/include/asm-sh/atomic.h
@@ -0,0 +1,113 @@
+#ifndef __ASM_SH_ATOMIC_H
+#define __ASM_SH_ATOMIC_H
+
+/*
+ * Atomic operations that C can't guarantee us. Useful for
+ * resource counting etc..
+ *
+ */
+
+#ifdef __SMP__
+typedef struct { volatile int counter; } atomic_t;
+#else
+typedef struct { int counter; } atomic_t;
+#endif
+
+#define ATOMIC_INIT(i) ( (atomic_t) { (i) } )
+
+#define atomic_read(v) ((v)->counter)
+#define atomic_set(v,i) ((v)->counter = (i))
+
+#include <asm/system.h>
+
+/*
+ * Make sure gcc doesn't try to be clever and move things around
+ * on us. We need to use _exactly_ the address the user gave us,
+ * not some alias that contains the same information.
+ */
+#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x)
+
+/*
+ * To get proper branch prediction for the main line, we must branch
+ * forward to code at the end of this object's .text section, then
+ * branch back to restart the operation.
+ */
+
+extern __inline__ void atomic_add(int i, atomic_t * v)
+{
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+ *(long *)v += i;
+ restore_flags(flags);
+}
+
+extern __inline__ void atomic_sub(int i, atomic_t *v)
+{
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+ *(long *)v -= i;
+ restore_flags(flags);
+}
+
+extern __inline__ int atomic_add_return(int i, atomic_t * v)
+{
+ unsigned long temp, flags;
+
+ save_flags(flags);
+ cli();
+ temp = *(long *)v;
+ temp += i;
+ *(long *)v = temp;
+ restore_flags(flags);
+
+ return temp;
+}
+
+extern __inline__ int atomic_sub_return(int i, atomic_t * v)
+{
+ unsigned long temp, flags;
+
+ save_flags(flags);
+ cli();
+ temp = *(long *)v;
+ temp -= i;
+ *(long *)v = temp;
+ restore_flags(flags);
+
+ return temp;
+}
+
+#define atomic_dec_return(v) atomic_sub_return(1,(v))
+#define atomic_inc_return(v) atomic_add_return(1,(v))
+
+#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
+#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
+
+#define atomic_inc(v) atomic_add(1,(v))
+#define atomic_dec(v) atomic_sub(1,(v))
+
+extern __inline__ void atomic_clear_mask(int mask, atomic_t *v)
+{
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+ *(long *)v &= ~mask;
+ restore_flags(flags);
+}
+
+extern __inline__ void atomic_set_mask(int mask, atomic_t *v)
+{
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+ *(long *)v |= mask;
+ restore_flags(flags);
+}
+
+#endif /* __ASM_SH_ATOMIC_H */
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
new file mode 100644
index 000000000..9808789c7
--- /dev/null
+++ b/include/asm-sh/bitops.h
@@ -0,0 +1,261 @@
+#ifndef __ASM_SH_BITOPS_H
+#define __ASM_SH_BITOPS_H
+
+#ifdef __KERNEL__
+#include <asm/system.h>
+/* For __swab32 */
+#include <asm/byteorder.h>
+
+extern __inline__ void set_bit(int nr, void * addr)
+{
+ int mask;
+ unsigned int *a = addr;
+ unsigned long flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ save_flags(flags);
+ cli();
+ *a |= mask;
+ restore_flags(flags);
+}
+
+extern __inline__ void clear_bit(int nr, void * addr)
+{
+ int mask;
+ unsigned int *a = addr;
+ unsigned long flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ save_flags(flags);
+ cli();
+ *a &= ~mask;
+ restore_flags(flags);
+}
+
+extern __inline__ void change_bit(int nr, void * addr)
+{
+ int mask;
+ unsigned int *a = addr;
+ unsigned long flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ save_flags(flags);
+ cli();
+ *a ^= mask;
+ restore_flags(flags);
+}
+
+extern __inline__ int test_and_set_bit(int nr, void * addr)
+{
+ int mask, retval;
+ unsigned int *a = addr;
+ unsigned long flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ save_flags(flags);
+ cli();
+ retval = (mask & *a) != 0;
+ *a |= mask;
+ restore_flags(flags);
+
+ return retval;
+}
+
+extern __inline__ int test_and_clear_bit(int nr, void * addr)
+{
+ int mask, retval;
+ unsigned int *a = addr;
+ unsigned long flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ save_flags(flags);
+ cli();
+ retval = (mask & *a) != 0;
+ *a &= ~mask;
+ restore_flags(flags);
+
+ return retval;
+}
+
+extern __inline__ int test_and_change_bit(int nr, void * addr)
+{
+ int mask, retval;
+ unsigned int *a = addr;
+ unsigned long flags;
+
+ a += nr >> 5;
+ mask = 1 << (nr & 0x1f);
+ save_flags(flags);
+ cli();
+ retval = (mask & *a) != 0;
+ *a ^= mask;
+ restore_flags(flags);
+
+ return retval;
+}
+
+
+extern __inline__ int test_bit(int nr, const void *addr)
+{
+ return 1UL & (((const int *) addr)[nr >> 5] >> (nr & 31));
+}
+
+extern __inline__ unsigned long ffz(unsigned long word)
+{
+ unsigned long result;
+
+ __asm__("1:\n"
+ "shlr %1\n\t"
+ "bt/s 1b\n\t"
+ "add #1, %0"
+ : "=r" (result)
+ : "r" (word), "0" (~0L));
+ return result;
+}
+
+extern __inline__ int find_next_zero_bit(void *addr, int size, int offset)
+{
+ unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
+ unsigned long result = offset & ~31UL;
+ unsigned long tmp;
+
+ if (offset >= size)
+ return size;
+ size -= result;
+ offset &= 31UL;
+ if (offset) {
+ tmp = *(p++);
+ tmp |= ~0UL >> (32-offset);
+ if (size < 32)
+ goto found_first;
+ if (~tmp)
+ goto found_middle;
+ size -= 32;
+ result += 32;
+ }
+ while (size & ~31UL) {
+ if (~(tmp = *(p++)))
+ goto found_middle;
+ result += 32;
+ size -= 32;
+ }
+ if (!size)
+ return result;
+ tmp = *p;
+
+found_first:
+ tmp |= ~0UL << size;
+found_middle:
+ return result + ffz(tmp);
+}
+
+#define find_first_zero_bit(addr, size) \
+ find_next_zero_bit((addr), (size), 0)
+
+extern __inline__ int ext2_set_bit(int nr,void * addr)
+{
+ int mask, retval;
+ unsigned long flags;
+ unsigned char *ADDR = (unsigned char *) addr;
+
+ ADDR += nr >> 3;
+ mask = 1 << (nr & 0x07);
+ save_flags(flags); cli();
+ retval = (mask & *ADDR) != 0;
+ *ADDR |= mask;
+ restore_flags(flags);
+ return retval;
+}
+
+extern __inline__ int ext2_clear_bit(int nr, void * addr)
+{
+ int mask, retval;
+ unsigned long flags;
+ unsigned char *ADDR = (unsigned char *) addr;
+
+ ADDR += nr >> 3;
+ mask = 1 << (nr & 0x07);
+ save_flags(flags); cli();
+ retval = (mask & *ADDR) != 0;
+ *ADDR &= ~mask;
+ restore_flags(flags);
+ return retval;
+}
+
+extern __inline__ int ext2_test_bit(int nr, const void * addr)
+{
+ int mask;
+ const unsigned char *ADDR = (const unsigned char *) addr;
+
+ ADDR += nr >> 3;
+ mask = 1 << (nr & 0x07);
+ return ((mask & *ADDR) != 0);
+}
+
+#define ext2_find_first_zero_bit(addr, size) \
+ ext2_find_next_zero_bit((addr), (size), 0)
+
+extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
+{
+ unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
+ unsigned long result = offset & ~31UL;
+ unsigned long tmp;
+
+ if (offset >= size)
+ return size;
+ size -= result;
+ offset &= 31UL;
+ if(offset) {
+ /* We hold the little endian value in tmp, but then the
+ * shift is illegal. So we could keep a big endian value
+ * in tmp, like this:
+ *
+ * tmp = __swab32(*(p++));
+ * tmp |= ~0UL >> (32-offset);
+ *
+ * but this would decrease preformance, so we change the
+ * shift:
+ */
+ tmp = *(p++);
+ tmp |= __swab32(~0UL >> (32-offset));
+ if(size < 32)
+ goto found_first;
+ if(~tmp)
+ goto found_middle;
+ size -= 32;
+ result += 32;
+ }
+ while(size & ~31UL) {
+ if(~(tmp = *(p++)))
+ goto found_middle;
+ result += 32;
+ size -= 32;
+ }
+ if(!size)
+ return result;
+ tmp = *p;
+
+found_first:
+ /* tmp is little endian, so we would have to swab the shift,
+ * see above. But then we have to swab tmp below for ffz, so
+ * we might as well do this here.
+ */
+ return result + ffz(__swab32(tmp) | (~0UL << size));
+found_middle:
+ return result + ffz(__swab32(tmp));
+}
+
+/* Bitmap functions for the minix filesystem. */
+#define minix_set_bit(nr,addr) test_and_set_bit(nr,addr)
+#define minix_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
+#define minix_test_bit(nr,addr) test_bit(nr,addr)
+#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_SH_BITOPS_H */
diff --git a/include/asm-sh/bugs.h b/include/asm-sh/bugs.h
new file mode 100644
index 000000000..4c20b768d
--- /dev/null
+++ b/include/asm-sh/bugs.h
@@ -0,0 +1,20 @@
+#ifndef __ASM_SH_BUGS_H
+#define __ASM_SH_BUGS_H
+
+/*
+ * This is included by init/main.c to check for architecture-dependent bugs.
+ *
+ * Needs:
+ * void check_bugs(void);
+ */
+
+/*
+ * I don't know of any Super-H bugs yet.
+ */
+
+#include <asm/processor.h>
+
+static void __init check_bugs(void)
+{
+}
+#endif /* __ASM_SH_BUGS_H */
diff --git a/include/asm-sh/byteorder.h b/include/asm-sh/byteorder.h
new file mode 100644
index 000000000..5a6863485
--- /dev/null
+++ b/include/asm-sh/byteorder.h
@@ -0,0 +1,43 @@
+#ifndef __ASM_SH_BYTEORDER_H
+#define __ASM_SH_BYTEORDER_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ */
+
+#include <linux/config.h>
+#include <asm/types.h>
+
+static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
+{
+ __asm__("swap.b %0, %0\n\t"
+ "swap.w %0, %0\n\t"
+ "swap.b %0, %0"
+ : "=r" (x)
+ : "0" (x));
+ return x;
+}
+
+static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
+{
+ __asm__("swap.b %0,%0"
+ : "=r" (x)
+ : "0" (x));
+ return x;
+}
+
+#define __arch__swab32(x) ___arch__swab32(x)
+#define __arch__swab16(x) ___arch__swab16(x)
+
+#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
+# define __BYTEORDER_HAS_U64__
+# define __SWAB_64_THRU_32__
+#endif
+
+#ifdef CONFIG_LITTLE_ENDIAN
+#include <linux/byteorder/little_endian.h>
+#else
+#include <linux/byteorder/big_endian.h>
+#endif
+
+#endif /* __ASM_SH_BYTEORDER_H */
diff --git a/include/asm-sh/cache.h b/include/asm-sh/cache.h
new file mode 100644
index 000000000..d22ab4e24
--- /dev/null
+++ b/include/asm-sh/cache.h
@@ -0,0 +1,23 @@
+/*
+ * include/asm-sh/cache.h
+ * Copyright 1999 (C) Niibe Yutaka
+ */
+#ifndef __ASM_SH_CACHE_H
+#define __ASM_SH_CACHE_H
+
+/* bytes per L1 cache line */
+#define L1_CACHE_BYTES 16
+
+#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
+
+#define SMP_CACHE_BYTES L1_CACHE_BYTES
+
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
+#endif /* __ASM_SH_CACHE_H */
diff --git a/include/asm-sh/checksum.h b/include/asm-sh/checksum.h
new file mode 100644
index 000000000..b2bbd8afb
--- /dev/null
+++ b/include/asm-sh/checksum.h
@@ -0,0 +1,84 @@
+#ifndef __ASM_SH_CHECKSUM_H
+#define __ASM_SH_CHECKSUM_H
+
+
+/*
+ * This is a version of ip_compute_csum() optimized for IP headers,
+ * which always checksum on 4 octet boundaries.
+ */
+extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl);
+
+/*
+ * computes the checksum of the TCP/UDP pseudo-header
+ * returns a 16-bit checksum, already complemented
+ */
+extern unsigned short int csum_tcpudp_magic(unsigned long saddr,
+ unsigned long daddr,
+ unsigned short len,
+ unsigned short proto,
+ unsigned int sum);
+
+/*
+ * computes the checksum of a memory block at buff, length len,
+ * and adds in "sum" (32-bit)
+ *
+ * returns a 32-bit number suitable for feeding into itself
+ * or csum_tcpudp_magic
+ *
+ * this function must be called with even lengths, except
+ * for the last fragment, which may be odd
+ *
+ * it's best to have buff aligned on a 32-bit boundary
+ */
+extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
+
+/*
+ * the same as csum_partial, but copies from src while it
+ * checksums
+ *
+ * here even more important to align src and dst on a 32-bit (or even
+ * better 64-bit) boundary
+ */
+unsigned int csum_partial_copy(const char *src, char *dst, int len, unsigned int sum);
+
+/*
+ * the same as csum_partial, but copies from user space (but on the alpha
+ * we have just one address space, so this is identical to the above)
+ *
+ * this is obsolete and will go away.
+ */
+#define csum_partial_copy_fromuser csum_partial_copy
+
+/*
+ * this is a new version of the above that records errors it finds in *errp,
+ * but continues and zeros the rest of the buffer.
+ */
+unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int sum, int *errp);
+
+/*
+ * this routine is used for miscellaneous IP-like checksums, mainly
+ * in icmp.c
+ */
+
+extern unsigned short ip_compute_csum(unsigned char * buff, int len);
+
+/*
+ * Fold a partial checksum without adding pseudo headers
+ */
+
+static inline unsigned short csum_fold(unsigned int sum)
+{
+ sum = (sum & 0xffff) + (sum >> 16);
+ sum = (sum & 0xffff) + (sum >> 16);
+ return ~sum;
+}
+
+#define _HAVE_ARCH_IPV6_CSUM
+/*
+extern unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
+ struct in6_addr *daddr,
+ __u16 len,
+ unsigned short proto,
+ unsigned int sum);
+*/
+#endif /* __ASM_SH_CHECKSUM_H */
diff --git a/include/asm-sh/current.h b/include/asm-sh/current.h
new file mode 100644
index 000000000..fe65bfcc9
--- /dev/null
+++ b/include/asm-sh/current.h
@@ -0,0 +1,24 @@
+#ifndef __ASM_SH_CURRENT_H
+#define __ASM_SH_CURRENT_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ */
+
+struct task_struct;
+
+static __inline__ struct task_struct * get_current(void)
+{
+ struct task_struct *current;
+
+ __asm__("stc r4_bank,%0\n\t"
+ "add %1,%0"
+ :"=&r" (current)
+ :"r" (-8192));
+ return current;
+}
+
+#define current get_current()
+
+#endif /* __ASM_SH_CURRENT_H */
diff --git a/include/asm-sh/delay.h b/include/asm-sh/delay.h
new file mode 100644
index 000000000..9eb03f65d
--- /dev/null
+++ b/include/asm-sh/delay.h
@@ -0,0 +1,44 @@
+#ifndef __ASM_SH_DELAY_H
+#define __ASM_SH_DELAY_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ */
+
+extern __inline__ void __delay(unsigned long loops)
+{
+ unsigned long __dummy;
+ __asm__ __volatile__(
+ "1:\t"
+ "dt %0\n\t"
+ "bf 1b"
+ :"=r" (__dummy)
+ :"0" (loops));
+}
+
+extern __inline__ void __udelay(unsigned long usecs, unsigned long lps)
+{
+ usecs *= 0x000010c6; /* 2**32 / 1000000 */
+ __asm__("mul.l %0,%2\n\t"
+ "sts macl,%0"
+ : "=&r" (usecs)
+ : "0" (usecs), "r" (lps)
+ : "macl", "mach");
+ __delay(usecs);
+}
+
+
+#ifdef __SMP__
+#define __udelay_val cpu_data[smp_processor_id()].udelay_val
+#else
+#define __udelay_val loops_per_sec
+#endif
+
+#define udelay(usecs) __udelay((usecs),__udelay_val)
+
+extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
+{
+ return (a*b)/c;
+}
+
+#endif /* __ASM_SH_DELAY_H */
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
new file mode 100644
index 000000000..4561b3d05
--- /dev/null
+++ b/include/asm-sh/dma.h
@@ -0,0 +1,12 @@
+#ifndef __ASM_SH_DMA_H
+#define __ASM_SH_DMA_H
+
+/* Don't define MAX_DMA_ADDRESS; it's useless on the SuperH and any
+ occurrence should be flagged as an error. */
+
+#define MAX_DMA_CHANNELS 8
+
+extern int request_dma(unsigned int dmanr, const char * device_id); /* reserve a DMA channel */
+extern void free_dma(unsigned int dmanr); /* release it again */
+
+#endif /* __ASM_SH_DMA_H */
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h
new file mode 100644
index 000000000..de5512ce3
--- /dev/null
+++ b/include/asm-sh/elf.h
@@ -0,0 +1,76 @@
+#ifndef __ASM_SH_ELF_H
+#define __ASM_SH_ELF_H
+
+/*
+ * ELF register definitions..
+ */
+
+#include <linux/config.h>
+#include <asm/ptrace.h>
+#include <asm/user.h>
+#include <asm/byteorder.h>
+
+typedef unsigned long elf_greg_t;
+
+#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+#ifdef CONFIG_CPU_SH4
+typedef double elf_fpreg_t;
+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+#else /* SH 3 has no floating point regs */
+typedef struct { void *null; } elf_fpregset_t;
+#endif
+
+/*
+ * This is used to ensure we don't load something for the wrong architecture.
+ */
+#define elf_check_arch(x) ( (x) == EM_SH )
+
+/*
+ * These are used to set parameters in the core dumps.
+ */
+#define ELF_CLASS ELFCLASS32
+#ifdef __LITTLE_ENDIAN
+#define ELF_DATA ELFDATA2LSB
+#else
+#define ELF_DATA ELFDATA2MSB
+#endif
+#define ELF_ARCH EM_SH
+
+#define USE_ELF_CORE_DUMP
+#define ELF_EXEC_PAGESIZE 4096
+
+/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
+ use of this is to invoke "./ld.so someprog" to test out a new version of
+ the loader. We need to make sure that it is out of the way of the program
+ that it will "exec", and that there is sufficient room for the brk. */
+
+#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
+
+
+#define ELF_CORE_COPY_REGS(_dest,_regs) \
+ memcpy((char *) &_dest, (char *) _regs, \
+ sizeof(struct pt_regs));
+
+/* This yields a mask that user programs can use to figure out what
+ instruction set this CPU supports. This could be done in user space,
+ but it's not easy, and we've already done it here. */
+
+#define ELF_HWCAP (0)
+
+/* This yields a string that ld.so will use to load implementation
+ specific libraries for optimization. This is more specific in
+ intent than poking at uname or /proc/cpuinfo.
+
+ For the moment, we have only optimizations for the Intel generations,
+ but that could change... */
+
+#define ELF_PLATFORM (NULL)
+
+#ifdef __KERNEL__
+#define SET_PERSONALITY(ex, ibcs2) \
+ current->personality = PER_LINUX_32BIT
+#endif
+
+#endif /* __ASM_SH_ELF_H */
diff --git a/include/asm-sh/errno.h b/include/asm-sh/errno.h
new file mode 100644
index 000000000..d6826231b
--- /dev/null
+++ b/include/asm-sh/errno.h
@@ -0,0 +1,132 @@
+#ifndef __ASM_SH_ERRNO_H
+#define __ASM_SH_ERRNO_H
+
+#define EPERM 1 /* Operation not permitted */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Try again */
+#define ENOMEM 12 /* Out of memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Device or resource busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* File table overflow */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math argument out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define EDEADLK 35 /* Resource deadlock would occur */
+#define ENAMETOOLONG 36 /* File name too long */
+#define ENOLCK 37 /* No record locks available */
+#define ENOSYS 38 /* Function not implemented */
+#define ENOTEMPTY 39 /* Directory not empty */
+#define ELOOP 40 /* Too many symbolic links encountered */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+#define ENOMSG 42 /* No message of desired type */
+#define EIDRM 43 /* Identifier removed */
+#define ECHRNG 44 /* Channel number out of range */
+#define EL2NSYNC 45 /* Level 2 not synchronized */
+#define EL3HLT 46 /* Level 3 halted */
+#define EL3RST 47 /* Level 3 reset */
+#define ELNRNG 48 /* Link number out of range */
+#define EUNATCH 49 /* Protocol driver not attached */
+#define ENOCSI 50 /* No CSI structure available */
+#define EL2HLT 51 /* Level 2 halted */
+#define EBADE 52 /* Invalid exchange */
+#define EBADR 53 /* Invalid request descriptor */
+#define EXFULL 54 /* Exchange full */
+#define ENOANO 55 /* No anode */
+#define EBADRQC 56 /* Invalid request code */
+#define EBADSLT 57 /* Invalid slot */
+
+#define EDEADLOCK EDEADLK
+
+#define EBFONT 59 /* Bad font file format */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data available */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* Object is remote */
+#define ENOLINK 67 /* Link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EMULTIHOP 72 /* Multihop attempted */
+#define EDOTDOT 73 /* RFS specific error */
+#define EBADMSG 74 /* Not a data message */
+#define EOVERFLOW 75 /* Value too large for defined data type */
+#define ENOTUNIQ 76 /* Name not unique on network */
+#define EBADFD 77 /* File descriptor in bad state */
+#define EREMCHG 78 /* Remote address changed */
+#define ELIBACC 79 /* Can not access a needed shared library */
+#define ELIBBAD 80 /* Accessing a corrupted shared library */
+#define ELIBSCN 81 /* .lib section in a.out corrupted */
+#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
+#define ELIBEXEC 83 /* Cannot exec a shared library directly */
+#define EILSEQ 84 /* Illegal byte sequence */
+#define ERESTART 85 /* Interrupted system call should be restarted */
+#define ESTRPIPE 86 /* Streams pipe error */
+#define EUSERS 87 /* Too many users */
+#define ENOTSOCK 88 /* Socket operation on non-socket */
+#define EDESTADDRREQ 89 /* Destination address required */
+#define EMSGSIZE 90 /* Message too long */
+#define EPROTOTYPE 91 /* Protocol wrong type for socket */
+#define ENOPROTOOPT 92 /* Protocol not available */
+#define EPROTONOSUPPORT 93 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
+#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
+#define EADDRINUSE 98 /* Address already in use */
+#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
+#define ENETDOWN 100 /* Network is down */
+#define ENETUNREACH 101 /* Network is unreachable */
+#define ENETRESET 102 /* Network dropped connection because of reset */
+#define ECONNABORTED 103 /* Software caused connection abort */
+#define ECONNRESET 104 /* Connection reset by peer */
+#define ENOBUFS 105 /* No buffer space available */
+#define EISCONN 106 /* Transport endpoint is already connected */
+#define ENOTCONN 107 /* Transport endpoint is not connected */
+#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
+#define ETOOMANYREFS 109 /* Too many references: cannot splice */
+#define ETIMEDOUT 110 /* Connection timed out */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EHOSTDOWN 112 /* Host is down */
+#define EHOSTUNREACH 113 /* No route to host */
+#define EALREADY 114 /* Operation already in progress */
+#define EINPROGRESS 115 /* Operation now in progress */
+#define ESTALE 116 /* Stale NFS file handle */
+#define EUCLEAN 117 /* Structure needs cleaning */
+#define ENOTNAM 118 /* Not a XENIX named type file */
+#define ENAVAIL 119 /* No XENIX semaphores available */
+#define EISNAM 120 /* Is a named type file */
+#define EREMOTEIO 121 /* Remote I/O error */
+#define EDQUOT 122 /* Quota exceeded */
+
+#define ENOMEDIUM 123 /* No medium found */
+#define EMEDIUMTYPE 124 /* Wrong medium type */
+
+#endif /* __ASM_SH_ERRNO_H */
diff --git a/include/asm-sh/fcntl.h b/include/asm-sh/fcntl.h
new file mode 100644
index 000000000..5ecc358e9
--- /dev/null
+++ b/include/asm-sh/fcntl.h
@@ -0,0 +1,66 @@
+#ifndef __ASM_SH_FCNTL_H
+#define __ASM_SH_FCNTL_H
+
+/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+#define O_ACCMODE 0003
+#define O_RDONLY 00
+#define O_WRONLY 01
+#define O_RDWR 02
+#define O_CREAT 0100 /* not fcntl */
+#define O_EXCL 0200 /* not fcntl */
+#define O_NOCTTY 0400 /* not fcntl */
+#define O_TRUNC 01000 /* not fcntl */
+#define O_APPEND 02000
+#define O_NONBLOCK 04000
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 010000
+#define FASYNC 020000 /* fcntl, for BSD compatibility */
+#define O_DIRECT 040000 /* direct disk access hint - currently ignored */
+#define O_LARGEFILE 0100000
+#define O_DIRECTORY 0200000 /* must be a directory */
+#define O_NOFOLLOW 0400000 /* don't follow links */
+
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get f_flags */
+#define F_SETFD 2 /* set f_flags */
+#define F_GETFL 3 /* more flags (cloexec) */
+#define F_SETFL 4
+#define F_GETLK 5
+#define F_SETLK 6
+#define F_SETLKW 7
+
+#define F_SETOWN 8 /* for sockets. */
+#define F_GETOWN 9 /* for sockets. */
+#define F_SETSIG 10 /* for sockets. */
+#define F_GETSIG 11 /* for sockets. */
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
+
+/* operations for bsd flock(), also used by the kernel implementation */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+#endif /* __ASM_SH_FCNTL_H */
+
diff --git a/include/asm-sh/hardirq.h b/include/asm-sh/hardirq.h
new file mode 100644
index 000000000..1957bb7b0
--- /dev/null
+++ b/include/asm-sh/hardirq.h
@@ -0,0 +1,24 @@
+#ifndef __ASM_SH_HARDIRQ_H
+#define __ASM_SH_HARDIRQ_H
+
+#include <linux/threads.h>
+
+extern unsigned int local_irq_count[NR_CPUS];
+#define in_interrupt() (local_irq_count[smp_processor_id()] != 0)
+
+#ifndef __SMP__
+
+#define hardirq_trylock(cpu) (local_irq_count[cpu] == 0)
+#define hardirq_endlock(cpu) do { } while (0)
+
+#define hardirq_enter(cpu) (local_irq_count[cpu]++)
+#define hardirq_exit(cpu) (local_irq_count[cpu]--)
+
+#define synchronize_irq() do { } while (0)
+
+#else
+
+#error Super-H SMP is not available
+
+#endif /* __SMP__ */
+#endif /* __ASM_SH_HARDIRQ_H */
diff --git a/include/asm-sh/hw_irq.h b/include/asm-sh/hw_irq.h
new file mode 100644
index 000000000..65695952b
--- /dev/null
+++ b/include/asm-sh/hw_irq.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_SH_HW_IRQ_H
+#define __ASM_SH_HW_IRQ_H
+static __inline__ void sh_do_profile (unsigned long pc) {/*Not implemented yet*/}
+
+static __inline__ void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) { /* Nothing to do */ }
+#endif /* __ASM_SH_HW_IRQ_H */
diff --git a/include/asm-sh/init.h b/include/asm-sh/init.h
new file mode 100644
index 000000000..17d215574
--- /dev/null
+++ b/include/asm-sh/init.h
@@ -0,0 +1 @@
+#error "<asm/init.h> should never be used - use <linux/init.h> instead"
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
new file mode 100644
index 000000000..e13c80dbe
--- /dev/null
+++ b/include/asm-sh/io.h
@@ -0,0 +1,158 @@
+#ifndef __ASM_SH_IO_H
+#define __ASM_SH_IO_H
+/* XXXXXXXXXXXXXXXXX */
+
+#define virt_to_bus virt_to_phys
+#define bus_to_virt phys_to_virt
+
+extern __inline__ unsigned long readb(unsigned long addr)
+{
+ return *(volatile unsigned char*)addr;
+}
+
+extern __inline__ unsigned long readw(unsigned long addr)
+{
+ return *(volatile unsigned short*)addr;
+}
+
+extern __inline__ unsigned long readl(unsigned long addr)
+{
+ return *(volatile unsigned long*)addr;
+}
+
+extern __inline__ void writeb(unsigned short b, unsigned long addr)
+{
+ *(volatile unsigned char*)addr = b;
+}
+
+extern __inline__ void writew(unsigned short b, unsigned long addr)
+{
+ *(volatile unsigned short*)addr = b;
+}
+
+extern __inline__ void writel(unsigned int b, unsigned long addr)
+{
+ *(volatile unsigned long*)addr = b;
+}
+
+extern __inline__ unsigned long inb_local(unsigned long addr)
+{
+ return readb(addr);
+}
+
+extern __inline__ void outb_local(unsigned char b, unsigned long addr)
+{
+ return writeb(b,addr);
+}
+
+extern __inline__ unsigned long inb(unsigned long addr)
+{
+ return readb(addr);
+}
+
+extern __inline__ unsigned long inw(unsigned long addr)
+{
+ return readw(addr);
+}
+
+extern __inline__ unsigned long inl(unsigned long addr)
+{
+ return readl(addr);
+}
+
+extern __inline__ void outb(unsigned char b, unsigned long addr)
+{
+ return writeb(b,addr);
+}
+
+extern __inline__ void outw(unsigned short b, unsigned long addr)
+{
+ return writew(b,addr);
+}
+
+extern __inline__ void outl(unsigned int b, unsigned long addr)
+{
+ return writel(b,addr);
+}
+
+#define inb_p inb
+#define outb_p outb
+
+#ifdef __KERNEL__
+
+#include <asm/addrspace.h>
+
+/*
+ * Change virtual addresses to physical addresses and vv.
+ * These are trivial on the 1:1 Linux/SuperH mapping
+ */
+extern __inline__ unsigned long virt_to_phys(volatile void * address)
+{
+ return PHYSADDR(address);
+}
+
+extern __inline__ void * phys_to_virt(unsigned long address)
+{
+ return (void *)KSEG0ADDR(address);
+}
+
+extern void * ioremap(unsigned long phys_addr, unsigned long size);
+extern void iounmap(void *addr);
+
+/*
+ * readX/writeX() are used to access memory mapped devices. On some
+ * architectures the memory mapped IO stuff needs to be accessed
+ * differently. On the x86 architecture, we just read/write the
+ * memory location directly.
+ *
+ * On SH, we have the whole physical address space mapped at all times
+ * (as MIPS does), so "ioremap()" and "iounmap()" do not need to do
+ * anything. (This isn't true for all machines but we still handle
+ * these cases with wired TLB entries anyway ...)
+ *
+ * We cheat a bit and always return uncachable areas until we've fixed
+ * the drivers to handle caching properly.
+ */
+extern __inline__ void * ioremap(unsigned long offset, unsigned long size)
+{
+ return (void *) KSEG1ADDR(offset);
+}
+
+/*
+ * This one maps high address device memory and turns off caching for that area.
+ * it's useful if some control registers are in such an area and write combining
+ * or read caching is not desirable:
+ */
+extern __inline__ void * ioremap_nocache (unsigned long offset, unsigned long size)
+{
+ return (void *) KSEG1ADDR(offset);
+}
+
+extern __inline__ void iounmap(void *addr)
+{
+}
+
+static __inline__ int check_signature(unsigned long io_addr,
+ const unsigned char *signature, int length)
+{
+ int retval = 0;
+ do {
+ if (readb(io_addr) != *signature)
+ goto out;
+ io_addr++;
+ signature++;
+ length--;
+ } while (length);
+ retval = 1;
+out:
+ return retval;
+}
+
+/* Nothing to do */
+
+#define dma_cache_inv(_start,_size) do { } while (0)
+#define dma_cache_wback(_start,_size) do { } while (0)
+#define dma_cache_wback_inv(_start,_size) do { } while (0)
+
+#endif /* __KERNEL__ */
+#endif /* __ASM_SH_IO_H */
diff --git a/include/asm-sh/ioctl.h b/include/asm-sh/ioctl.h
new file mode 100644
index 000000000..11b8153ac
--- /dev/null
+++ b/include/asm-sh/ioctl.h
@@ -0,0 +1,75 @@
+/* $Id: ioctl.h,v 1.5 1993/07/19 21:53:50 root Exp root $
+ *
+ * linux/ioctl.h for Linux by H.H. Bergman.
+ */
+
+#ifndef __ASM_SH_IOCTL_H
+#define __ASM_SH_IOCTL_H
+
+/* ioctl command encoding: 32 bits total, command in lower 16 bits,
+ * size of the parameter structure in the lower 14 bits of the
+ * upper 16 bits.
+ * Encoding the size of the parameter structure in the ioctl request
+ * is useful for catching programs compiled with old versions
+ * and to avoid overwriting user space outside the user buffer area.
+ * The highest 2 bits are reserved for indicating the ``access mode''.
+ * NOTE: This limits the max parameter size to 16kB -1 !
+ */
+
+/*
+ * The following is for compatibility across the various Linux
+ * platforms. The i386 ioctl numbering scheme doesn't really enforce
+ * a type field. De facto, however, the top 8 bits of the lower 16
+ * bits are indeed used as a type field, so we might just as well make
+ * this explicit here. Please be sure to use the decoding macros
+ * below from now on.
+ */
+#define _IOC_NRBITS 8
+#define _IOC_TYPEBITS 8
+#define _IOC_SIZEBITS 14
+#define _IOC_DIRBITS 2
+
+#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
+#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
+#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
+#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
+
+#define _IOC_NRSHIFT 0
+#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
+#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
+#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
+
+/*
+ * Direction bits.
+ */
+#define _IOC_NONE 0U
+#define _IOC_WRITE 1U
+#define _IOC_READ 2U
+
+#define _IOC(dir,type,nr,size) \
+ (((dir) << _IOC_DIRSHIFT) | \
+ ((type) << _IOC_TYPESHIFT) | \
+ ((nr) << _IOC_NRSHIFT) | \
+ ((size) << _IOC_SIZESHIFT))
+
+/* used to create numbers */
+#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+
+/* used to decode ioctl numbers.. */
+#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
+#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
+#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
+#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
+
+/* ...and for the drivers/sound files... */
+
+#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
+#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
+#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
+#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
+#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
+
+#endif /* __ASM_SH_IOCTL_H */
diff --git a/include/asm-sh/ioctls.h b/include/asm-sh/ioctls.h
new file mode 100644
index 000000000..56b5bff70
--- /dev/null
+++ b/include/asm-sh/ioctls.h
@@ -0,0 +1,99 @@
+#ifndef __ASM_SH_IOCTLS_H
+#define __ASM_SH_IOCTLS_H
+
+#include <asm/ioctl.h>
+
+#define FIOCLEX _IO('f', 1)
+#define FIONCLEX _IO('f', 2)
+#define FIOASYNC _IOW('f', 125, int)
+#define FIONBIO _IOW('f', 126, int)
+#define FIONREAD _IOR('f', 127, int)
+#define TIOCINQ FIONREAD
+
+#define TCGETS _IOR('t', 19, struct termios)
+#define TCSETS _IOW('t', 20, struct termios)
+#define TCSETSW _IOW('t', 21, struct termios)
+#define TCSETSF _IOW('t', 22, struct termios)
+
+#define TCGETA _IOR('t', 23, struct termio)
+#define TCSETA _IOW('t', 24, struct termio)
+#define TCSETAW _IOW('t', 25, struct termio)
+#define TCSETAF _IOW('t', 28, struct termio)
+
+#define TCSBRK _IO('t', 29)
+#define TCXONC _IO('t', 30)
+#define TCFLSH _IO('t', 31)
+
+#define TIOCSWINSZ _IOW('t', 103, struct winsize)
+#define TIOCGWINSZ _IOR('t', 104, struct winsize)
+#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
+#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
+#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
+
+#define TIOCSPGRP _IOW('t', 118, int)
+#define TIOCGPGRP _IOR('t', 119, int)
+
+#define TIOCEXCL _IO('T', 12) /* 0x540C */
+#define TIOCNXCL _IO('T', 13) /* 0x540D */
+#define TIOCSCTTY _IO('T', 14) /* 0x540E */
+
+#define TIOCSTI _IOW('T', 18, char) /* 0x5412 */
+#define TIOCMGET _IOR('T', 21, unsigned int) /* 0x5415 */
+#define TIOCMBIS _IOW('T', 22, unsigne int) /* 0x5416 */
+#define TIOCMBIC _IOW('T', 23, unsigne int) /* 0x5417 */
+#define TIOCMSET _IOW('T', 24, unsigne int) /* 0x5418 */
+# define TIOCM_LE 0x001
+# define TIOCM_DTR 0x002
+# define TIOCM_RTS 0x004
+# define TIOCM_ST 0x008
+# define TIOCM_SR 0x010
+# define TIOCM_CTS 0x020
+# define TIOCM_CAR 0x040
+# define TIOCM_RNG 0x080
+# define TIOCM_DSR 0x100
+# define TIOCM_CD TIOCM_CAR
+# define TIOCM_RI TIOCM_RNG
+
+#define TIOCGSOFTCAR _IOR('T', 25, unsigned int) /* 0x5419 */
+#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) /* 0x541A */
+#define TIOCLINUX _IOW('T', 28, char) /* 0x541C */
+#define TIOCCONS _IO('T', 29) /* 0x541D */
+#define TIOCGSERIAL _IOR('T', 30, struct serial_struct) /* 0x541E */
+#define TIOCSSERIAL _IOW('T', 31, struct serial_struct) /* 0x541F */
+#define TIOCPKT _IOW('T', 32, int) /* 0x5420 */
+# define TIOCPKT_DATA 0
+# define TIOCPKT_FLUSHREAD 1
+# define TIOCPKT_FLUSHWRITE 2
+# define TIOCPKT_STOP 4
+# define TIOCPKT_START 8
+# define TIOCPKT_NOSTOP 16
+# define TIOCPKT_DOSTOP 32
+
+
+#define TIOCNOTTY _IO('T', 34) /* 0x5422 */
+#define TIOCSETD _IOW('T', 35, int) /* 0x5423 */
+#define TIOCGETD _IOR('T', 36, int) /* 0x5424 */
+#define TCSBRKP _IOW('T', 37, int) /* 0x5425 */ /* Needed for POSIX tcsendbreak() */
+#define TIOCTTYGSTRUCT _IOR('T', 38, struct tty_struct) /* 0x5426 */ /* For debugging only */
+#define TIOCSBRK _IO('T', 39) /* 0x5427 */ /* BSD compatibility */
+#define TIOCCBRK _IO('T', 40) /* 0x5428 */ /* BSD compatibility */
+#define TIOCGSID _IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */
+#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
+#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */
+
+#define TIOCSERCONFIG _IO('T', 83) /* 0x5453 */
+#define TIOCSERGWILD _IOR('T', 84, int) /* 0x5454 */
+#define TIOCSERSWILD _IOW('T', 85, int) /* 0x5455 */
+#define TIOCGLCKTRMIOS _IOR('T', 86, struct termios) /* 0x5456 */
+#define TIOCSLCKTRMIOS _IOW('T', 87, struct termios) /* 0x5457 */
+#define TIOCSERGSTRUCT _IOR('T', 88, struct async_struct) /* 0x5458 */ /* For debugging only */
+#define TIOCSERGETLSR _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */
+ /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
+#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* 0x545A */ /* Get multiport config */
+#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* 0x545B */ /* Set multiport config */
+
+#define TIOCMIWAIT _IO('T', 92) /* 0x545C */ /* wait for a change on serial input line(s) */
+#define TIOCGICOUNT _IOR('T', 93, struct async_icount) /* 0x545D */ /* read serial port inline interrupt counts */
+
+#endif /* __ASM_SH_IOCTLS_H */
diff --git a/include/asm-sh/ipc.h b/include/asm-sh/ipc.h
new file mode 100644
index 000000000..f214d910b
--- /dev/null
+++ b/include/asm-sh/ipc.h
@@ -0,0 +1,31 @@
+#ifndef __ASM_SH_IPC_H
+#define __ASM_SH_IPC_H
+
+/*
+ * These are used to wrap system calls on x86.
+ *
+ * See arch/i386/kernel/sys_i386.c for ugly details..
+ */
+struct ipc_kludge {
+ struct msgbuf *msgp;
+ long msgtyp;
+};
+
+#define SEMOP 1
+#define SEMGET 2
+#define SEMCTL 3
+#define MSGSND 11
+#define MSGRCV 12
+#define MSGGET 13
+#define MSGCTL 14
+#define SHMAT 21
+#define SHMDT 22
+#define SHMGET 23
+#define SHMCTL 24
+
+/* Used by the DIPC package, try and avoid reusing it */
+#define DIPC 25
+
+#define IPCCALL(version,op) ((version)<<16 | (op))
+
+#endif /* __ASM_SH_IPC_H */
diff --git a/include/asm-sh/irq.h b/include/asm-sh/irq.h
new file mode 100644
index 000000000..1a5cf7727
--- /dev/null
+++ b/include/asm-sh/irq.h
@@ -0,0 +1,35 @@
+#ifndef __ASM_SH_IRQ_H
+#define __ASM_SH_IRQ_H
+
+/*
+ *
+ * linux/include/asm-sh/irq.h
+ *
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ */
+
+#define TIMER_IRQ 16 /* Hard-wired */
+#define TIMER_IRP_OFFSET 12
+#define TIMER_PRIORITY 1
+
+/*
+ * 40 = 24+16
+ *
+ * 24 for on chip support modules.
+ * 16 for external interrupts.
+ *
+ */
+#define NR_IRQS 40
+
+extern void disable_irq(unsigned int);
+extern void disable_irq_nosync(unsigned int);
+extern void enable_irq(unsigned int);
+
+/*
+ * Function for "on chip support modules".
+ */
+extern void set_ipr_data(unsigned int irq, int offset, int priority);
+extern void make_onChip_irq(unsigned int irq);
+
+#endif /* __ASM_SH_IRQ_H */
diff --git a/include/asm-sh/mman.h b/include/asm-sh/mman.h
new file mode 100644
index 000000000..19b02f6da
--- /dev/null
+++ b/include/asm-sh/mman.h
@@ -0,0 +1,32 @@
+#ifndef __ASM_SH_MMAN_H
+#define __ASM_SH_MMAN_H
+
+#define PROT_READ 0x1 /* page can be read */
+#define PROT_WRITE 0x2 /* page can be written */
+#define PROT_EXEC 0x4 /* page can be executed */
+#define PROT_NONE 0x0 /* page can not be accessed */
+
+#define MAP_SHARED 0x01 /* Share changes */
+#define MAP_PRIVATE 0x02 /* Changes are private */
+#define MAP_TYPE 0x0f /* Mask for type of mapping */
+#define MAP_FIXED 0x10 /* Interpret addr exactly */
+#define MAP_ANONYMOUS 0x20 /* don't use a file */
+
+#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
+#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
+#define MAP_LOCKED 0x2000 /* pages are locked */
+#define MAP_NORESERVE 0x4000 /* don't check for reservations */
+
+#define MS_ASYNC 1 /* sync memory asynchronously */
+#define MS_INVALIDATE 2 /* invalidate the caches */
+#define MS_SYNC 4 /* synchronous memory sync */
+
+#define MCL_CURRENT 1 /* lock all current mappings */
+#define MCL_FUTURE 2 /* lock all future mappings */
+
+/* compatibility flags */
+#define MAP_ANON MAP_ANONYMOUS
+#define MAP_FILE 0
+
+#endif /* __ASM_SH_MMAN_H */
diff --git a/include/asm-sh/mmu_context.h b/include/asm-sh/mmu_context.h
new file mode 100644
index 000000000..7bdb2bd5f
--- /dev/null
+++ b/include/asm-sh/mmu_context.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ * ASID handling idea taken from MIPS implementation.
+ */
+#ifndef __ASM_SH_MMU_CONTEXT_H
+#define __ASM_SH_MMU_CONTEXT_H
+
+/* The MMU "context" consists of two things:
+ (a) TLB cache version (or round, cycle whatever expression you like)
+ (b) ASID (Address Space IDentifier)
+ */
+
+/*
+ * Cache of MMU context last used.
+ */
+extern unsigned long mmu_context_cache;
+
+#define MMU_CONTEXT_ASID_MASK 0xff
+#define MMU_CONTEXT_VERSION_MASK 0xffffff00
+#define MMU_CONTEXT_FIRST_VERSION 0x100
+#define NO_CONTEXT 0
+
+extern __inline__ void
+get_new_mmu_context(struct mm_struct *mm)
+{
+ unsigned long mc = ++mmu_context_cache;
+
+ if (!(mc & MMU_CONTEXT_ASID_MASK)) {
+ /* We exhaust ASID of this version.
+ Flush all TLB and start new cycle. */
+ flush_tlb_all();
+ /* Fix version if needed.
+ Note that we avoid version #0 to distingush NO_CONTEXT. */
+ if (!mc)
+ mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION;
+ }
+ mm->context = mc;
+}
+
+/*P
+ * Get MMU context if needed.
+ */
+extern __inline__ void
+get_mmu_context(struct mm_struct *mm)
+{
+ if (mm) {
+ unsigned long mc = mmu_context_cache;
+ /* Check if we have old version of context.
+ If it's old, we need to get new context with new version. */
+ if ((mm->context ^ mc) & MMU_CONTEXT_VERSION_MASK)
+ get_new_mmu_context(mm);
+ }
+}
+
+/*P
+ * Initialize the context related info for a new mm_struct
+ * instance.
+ */
+extern __inline__ void init_new_context(struct task_struct *tsk,
+ struct mm_struct *mm)
+{
+ mm->context = NO_CONTEXT;
+}
+
+/*P
+ * Destroy context related info for an mm_struct that is about
+ * to be put to rest.
+ */
+extern __inline__ void destroy_context(struct mm_struct *mm)
+{
+ mm->context = NO_CONTEXT;
+}
+
+/* Other MMU related constants. */
+
+#define MMU_PTEH 0xFFFFFFF0 /* Page table entry register HIGH */
+#define MMU_PTEL 0xFFFFFFF4 /* Page table entry register LOW */
+#define MMUCR 0xFFFFFFE0 /* MMU Control Register */
+
+#define MMU_TLB_ADDRESS_ARRAY 0xF2000000
+#define MMU_PAGE_ASSOC_BIT 0x80
+
+#define MMU_NTLB_ENTRIES 128 /* for 7708 */
+
+#define MMU_CONTROL_INIT 0x007 /* SV=0, TF=1, IX=1, AT=1 */
+
+#include <asm/uaccess.h> /* to get the definition of __m */
+
+extern __inline__ void set_asid (unsigned long asid)
+{
+ __asm__ __volatile__ ("mov.l %0,%1"
+ : /* no output */
+ : "r" (asid), "m" (__m(MMU_PTEH)));
+}
+
+extern __inline__ unsigned long get_asid (void)
+{
+ unsigned long asid;
+
+ __asm__ __volatile__ ("mov.l %1,%0"
+ : "=r" (asid)
+ : "m" (__m(MMU_PTEH)));
+ asid &= MMU_CONTEXT_ASID_MASK;
+ return asid;
+}
+
+/*P
+ * After we have set current->mm to a new value, this activates
+ * the context for the new mm so we see the new mappings.
+ */
+extern __inline__ void activate_context(struct mm_struct *mm)
+{
+ get_mmu_context(mm);
+ set_asid(mm->context & MMU_CONTEXT_ASID_MASK);
+}
+
+/* MMU_TTB can be used for optimizing the fault handling.
+ (Currently not used) */
+#define MMU_TTB 0xFFFFFFF8 /* Translation table base register */
+extern __inline__ void switch_mm(struct mm_struct *prev,
+ struct mm_struct *next,
+ struct task_struct *tsk, unsigned int cpu)
+{
+ if (prev != next) {
+ unsigned long __pgdir = __pa(next->pgd);
+
+ __asm__ __volatile__("mov.l %0,%1": \
+ :"r" (__pgdir), "m" (__m(MMU_TTB)));
+ activate_context(next);
+ clear_bit(cpu, &prev->cpu_vm_mask);
+ }
+ set_bit(cpu, &next->cpu_vm_mask);
+}
+
+#define activate_mm(prev, next) \
+ switch_mm((prev),(next),NULL,smp_processor_id())
+
+#endif /* __ASM_SH_MMU_CONTEXT_H */
diff --git a/include/asm-sh/namei.h b/include/asm-sh/namei.h
new file mode 100644
index 000000000..47043e64e
--- /dev/null
+++ b/include/asm-sh/namei.h
@@ -0,0 +1,18 @@
+/* $Id: namei.h,v 1.1 1996/12/13 14:48:21 jj Exp $
+ * linux/include/asm-sh/namei.h
+ *
+ * Included from linux/fs/namei.c
+ */
+
+#ifndef __ASM_SH_NAMEI_H
+#define __ASM_SH_NAMEI_H
+
+/* This dummy routine maybe changed to something useful
+ * for /usr/gnemul/ emulation stuff.
+ * Look at asm-sparc/namei.h for details.
+ */
+
+#define __prefix_lookup_dentry(name, lookup_flags) \
+ do {} while (0)
+
+#endif /* __ASM_SH_NAMEI_H */
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
new file mode 100644
index 000000000..ce6a737f7
--- /dev/null
+++ b/include/asm-sh/page.h
@@ -0,0 +1,104 @@
+#ifndef __ASM_SH_PAGE_H
+#define __ASM_SH_PAGE_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ */
+
+/* XXX
+ [ P0 (virtual) ] 0x00000000 <------ User space
+ [ P1 (fixed) write-through] 0x80000000 <------ Kernel space
+ [ P2 (fixed) non-cachable] 0xA0000000 <------ Physical access
+ [ P3 (virtual) write-back] 0xC0000000 <------ not used
+ [ P4 control ] 0xE0000000
+ */
+
+#include <linux/config.h>
+
+/* PAGE_SHIFT determines the page size */
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+#ifdef __KERNEL__
+#ifndef __ASSEMBLY__
+
+#define STRICT_MM_TYPECHECKS
+
+#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
+#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
+
+#ifdef STRICT_MM_TYPECHECKS
+/*
+ * These are used to make use of C type-checking..
+ */
+typedef struct { unsigned long pte; } pte_t;
+typedef struct { unsigned long pmd; } pmd_t;
+typedef struct { unsigned long pgd; } pgd_t;
+typedef struct { unsigned long pgprot; } pgprot_t;
+
+#define pte_val(x) ((x).pte)
+#define pmd_val(x) ((x).pmd)
+#define pgd_val(x) ((x).pgd)
+#define pgprot_val(x) ((x).pgprot)
+
+#define __pte(x) ((pte_t) { (x) } )
+#define __pmd(x) ((pmd_t) { (x) } )
+#define __pgd(x) ((pgd_t) { (x) } )
+#define __pgprot(x) ((pgprot_t) { (x) } )
+
+#else
+/*
+ * .. while these make it easier on the compiler
+ */
+typedef unsigned long pte_t;
+typedef unsigned long pmd_t;
+typedef unsigned long pgd_t;
+typedef unsigned long pgprot_t;
+
+#define pte_val(x) (x)
+#define pmd_val(x) (x)
+#define pgd_val(x) (x)
+#define pgprot_val(x) (x)
+
+#define __pte(x) (x)
+#define __pmd(x) (x)
+#define __pgd(x) (x)
+#define __pgprot(x) (x)
+
+#endif
+#endif /* !__ASSEMBLY__ */
+
+/* to align the pointer to the (next) page boundary */
+#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
+
+/*
+ * IF YOU CHANGE THIS, PLEASE ALSO CHANGE
+ *
+ * arch/sh/vmlinux.lds
+ *
+ * which has the same constant encoded..
+ */
+#define __PAGE_OFFSET (0x80000000)
+
+#define __MEMORY_START CONFIG_MEMORY_START
+
+#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET+__MEMORY_START)
+#define __pa(x) ((unsigned long)(x)-__PAGE_OFFSET)
+#define __va(x) ((void *)((unsigned long)(x)+__PAGE_OFFSET))
+#define MAP_NR(addr) ((__pa(addr)-__MEMORY_START) >> PAGE_SHIFT)
+
+#ifndef __ASSEMBLY__
+#define BUG() do { \
+ printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+ asm volatile("nop"); \
+} while (0)
+
+#define PAGE_BUG(page) do { \
+ BUG(); \
+} while (0)
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/param.h b/include/asm-sh/param.h
new file mode 100644
index 000000000..5ff8b6fdf
--- /dev/null
+++ b/include/asm-sh/param.h
@@ -0,0 +1,20 @@
+#ifndef __ASM_SH_PARAM_H
+#define __ASM_SH_PARAM_H
+
+#ifndef HZ
+#define HZ 100
+#endif
+
+#define EXEC_PAGESIZE 4096
+
+#ifndef NGROUPS
+#define NGROUPS 32
+#endif
+
+#ifndef NOGROUP
+#define NOGROUP (-1)
+#endif
+
+#define MAXHOSTNAMELEN 64 /* max length of hostname */
+
+#endif /* __ASM_SH_PARAM_H */
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
new file mode 100644
index 000000000..1520ea690
--- /dev/null
+++ b/include/asm-sh/pgtable.h
@@ -0,0 +1,494 @@
+#ifndef __ASM_SH_PGTABLE_H
+#define __ASM_SH_PGTABLE_H
+
+/* Copyright (C) 1999 Niibe Yutaka */
+
+#include <linux/config.h>
+
+/*
+ * This file contains the functions and defines necessary to modify and use
+ * the SuperH page table tree.
+ */
+#ifndef __ASSEMBLY__
+#include <asm/processor.h>
+#include <linux/threads.h>
+
+extern pgd_t swapper_pg_dir[1024];
+
+#ifdef CONFIG_CPU_SH3
+/* Cache flushing:
+ *
+ * - flush_cache_all() flushes entire cache
+ * - flush_cache_mm(mm) flushes the specified mm context's cache lines
+ * - flush_cache_page(mm, vmaddr) flushes a single page
+ * - flush_cache_range(mm, start, end) flushes a range of pages
+ * - flush_page_to_ram(page) write back kernel page to ram
+ *
+ * Caches are indexed (effectively) by physical address on SH-3, so
+ * we don't need them.
+ */
+#define flush_cache_all() do { } while (0)
+#define flush_cache_mm(mm) do { } while (0)
+#define flush_cache_range(mm, start, end) do { } while (0)
+#define flush_cache_page(vma, vmaddr) do { } while (0)
+#define flush_page_to_ram(page) do { } while (0)
+#define flush_icache_range(start, end) do { } while (0)
+#elif CONFIG_CPU_SH4
+/*
+ * Caches are broken on SH-4, so we need them.
+ * You do bad job!
+ */
+flush_cache_all()
+flush_cache_mm(mm)
+flush_cache_range(mm, start, end)
+flush_cache_page(vma, vmaddr)
+flush_page_to_ram(page)
+flush_icache_range(start, end)
+#endif
+
+/* TLB flushing:
+ *
+ * - flush_tlb_all() flushes all processes TLB entries
+ * - flush_tlb_mm(mm) flushes the specified mm context TLB entries
+ * - flush_tlb_page(mm, vmaddr) flushes a single page
+ * - flush_tlb_range(mm, start, end) flushes a range of pages
+ */
+extern void flush_tlb_all(void);
+extern void flush_tlb_mm(struct mm_struct *mm);
+extern void flush_tlb_range(struct mm_struct *mm, unsigned long start,
+ unsigned long end);
+extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
+
+/*
+ * Basically we have the same two-level (which is the logical three level
+ * Linux page table layout folded) page tables as the i386.
+ */
+
+#endif /* !__ASSEMBLY__ */
+
+/* PMD_SHIFT determines the size of the area a second-level page table can map */
+#define PMD_SHIFT 22
+#define PMD_SIZE (1UL << PMD_SHIFT)
+#define PMD_MASK (~(PMD_SIZE-1))
+
+/* PGDIR_SHIFT determines what a third-level page table entry can map */
+#define PGDIR_SHIFT 22
+#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
+#define PGDIR_MASK (~(PGDIR_SIZE-1))
+
+/*
+ * Entries per page directory level: we use two-level, so
+ * we don't really have any PMD directory physically.
+ */
+#define PTRS_PER_PTE 1024
+#define PTRS_PER_PMD 1
+#define PTRS_PER_PGD 1024
+#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
+
+#ifndef __ASSEMBLY__
+#define VMALLOC_START 0xc0000000
+#define VMALLOC_VMADDR(x) ((unsigned long)(x))
+#define VMALLOC_END 0xe0000000
+
+#define _PAGE_READ 0x001 /* software: read access alowed */
+#define _PAGE_ACCESSED 0x002 /* software: page referenced */
+#define _PAGE_DIRTY 0x004 /* D-bit : page changed */
+/* 0x008 */
+/* 0x010 */
+#define _PAGE_RW 0x020 /* PR0-bit : write access allowed */
+#define _PAGE_USER 0x040 /* PR1-bit : user space access allowed */
+/* 0x080 */
+#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */
+
+/* Mask which drop software flags */
+#define _PAGE_FLAGS_HARDWARE_MASK 0xfffff164
+/* Flags defalult: SZ=1 (4k-byte), C=1 (cachable), SH=0 (not shared) */
+#define _PAGE_FLAGS_HARDWARE_DEFAULT 0x00000018
+
+
+#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
+#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
+#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
+
+#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
+#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED)
+#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
+#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
+#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
+#define PAGE_KERNEL_RO __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED)
+
+/*
+ * As i386 and MIPS, SuperH can't do page protection for execute, and
+ * considers that the same are read. Also, write permissions imply
+ * read permissions. This is the closest we can get..
+ */
+
+#define __P000 PAGE_NONE
+#define __P001 PAGE_READONLY
+#define __P010 PAGE_COPY
+#define __P011 PAGE_COPY
+#define __P100 PAGE_READONLY
+#define __P101 PAGE_READONLY
+#define __P110 PAGE_COPY
+#define __P111 PAGE_COPY
+
+#define __S000 PAGE_NONE
+#define __S001 PAGE_READONLY
+#define __S010 PAGE_SHARED
+#define __S011 PAGE_SHARED
+#define __S100 PAGE_READONLY
+#define __S101 PAGE_READONLY
+#define __S110 PAGE_SHARED
+#define __S111 PAGE_SHARED
+
+/*
+ * BAD_PAGETABLE is used when we need a bogus page-table, while
+ * BAD_PAGE is used for a bogus page.
+ *
+ * ZERO_PAGE is a global shared page that is always zero: used
+ * for zero-mapped memory areas etc..
+ */
+extern pte_t __bad_page(void);
+extern pte_t * __bad_pagetable(void);
+
+extern unsigned long empty_zero_page[1024];
+
+#define BAD_PAGETABLE __bad_pagetable()
+#define BAD_PAGE __bad_page()
+#define ZERO_PAGE(vaddr) ((unsigned long) empty_zero_page)
+
+/* number of bits that fit into a memory pointer */
+#define BITS_PER_PTR (8*sizeof(unsigned long))
+
+/* to align the pointer to a pointer address */
+#define PTR_MASK (~(sizeof(void*)-1))
+
+/* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
+/* 64-bit machines, beware! SRB. */
+#define SIZEOF_PTR_LOG2 2
+
+/* to find an entry in a page-table */
+#define PAGE_PTR(address) \
+((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
+
+/* Certain architectures need to do special things when pte's
+ * within a page table are directly modified. Thus, the following
+ * hook is made available.
+ */
+extern __inline__ void set_pte(pte_t *ptep, pte_t pteval)
+{
+ *ptep = pteval;
+}
+
+extern __inline__ int pte_none(pte_t pte)
+{
+ return !pte_val(pte);
+}
+
+extern __inline__ int pte_present(pte_t pte)
+{
+ return pte_val(pte) & _PAGE_PRESENT;
+}
+
+extern __inline__ void pte_clear(pte_t *ptep)
+{
+ pte_val(*ptep) = 0;
+}
+
+extern __inline__ int pmd_none(pmd_t pmd)
+{
+ return !pmd_val(pmd);
+}
+
+#define pmd_bad(x) ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
+
+extern __inline__ int pmd_present(pmd_t pmd)
+{
+ return pmd_val(pmd) & _PAGE_PRESENT;
+}
+
+extern __inline__ void pmd_clear(pmd_t *pmdp)
+{
+ pmd_val(*pmdp) = 0;
+}
+
+/*
+ * The "pgd_xxx()" functions here are trivial for a folded two-level
+ * setup: the pgd is never bad, and a pmd always exists (as it's folded
+ * into the pgd entry)
+ */
+extern __inline__ int pgd_none(pgd_t pgd) { return 0; }
+extern __inline__ int pgd_bad(pgd_t pgd) { return 0; }
+extern __inline__ int pgd_present(pgd_t pgd) { return 1; }
+extern __inline__ void pgd_clear(pgd_t * pgdp) { }
+
+/*
+ * The following only work if pte_present() is true.
+ * Undefined behaviour if not..
+ */
+extern __inline__ int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
+extern __inline__ int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
+extern __inline__ int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; }
+extern __inline__ int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; }
+extern __inline__ int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_RW; }
+
+extern __inline__ pte_t pte_rdprotect(pte_t pte){ pte_val(pte) &= ~_PAGE_USER; return pte; }
+extern __inline__ pte_t pte_exprotect(pte_t pte){ pte_val(pte) &= ~_PAGE_USER; return pte; }
+extern __inline__ pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
+extern __inline__ pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
+extern __inline__ pte_t pte_wrprotect(pte_t pte){ pte_val(pte) &= ~_PAGE_RW; return pte; }
+extern __inline__ pte_t pte_mkread(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; }
+extern __inline__ pte_t pte_mkexec(pte_t pte) { pte_val(pte) |= _PAGE_USER; return pte; }
+extern __inline__ pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
+extern __inline__ pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
+extern __inline__ pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_RW; return pte; }
+
+/*
+ * Conversion functions: convert a page and protection to a page entry,
+ * and a page entry and page directory to the page they refer to.
+ */
+extern __inline__ pte_t mk_pte(unsigned long page, pgprot_t pgprot)
+{
+ return __pte(__pa(page) | pgprot_val(pgprot));
+}
+
+/* This takes a physical page address that is used by the remapping functions */
+extern __inline__ pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
+{
+ return __pte(physpage | pgprot_val(pgprot));
+}
+
+extern __inline__ pte_t pte_modify(pte_t pte, pgprot_t newprot)
+{
+ return __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot));
+}
+
+extern __inline__ unsigned long pte_page(pte_t pte)
+{
+ return (unsigned long)__va(pte_val(pte) & PAGE_MASK);
+}
+
+extern __inline__ unsigned long pmd_page(pmd_t pmd)
+{
+ return (unsigned long)__va(pmd_val(pmd) & PAGE_MASK);
+}
+
+extern __inline__ void pmd_set(pmd_t * pmdp, pte_t * ptep)
+{
+ pmd_val(*pmdp) = __pa(((unsigned long) ptep) & PAGE_MASK) | _PAGE_TABLE;
+}
+
+/* to find an entry in a kernel page-table-directory */
+#define pgd_offset_k(address) pgd_offset(&init_mm, address)
+
+/* to find an entry in a page-table-directory */
+extern __inline__ pgd_t *pgd_offset(struct mm_struct *mm, unsigned long addr)
+{
+ return mm->pgd + (addr >> PGDIR_SHIFT);
+}
+
+/* Find an entry in the second-level page table.. */
+extern __inline__ pmd_t * pmd_offset(pgd_t * dir, unsigned long addr)
+{
+ return (pmd_t *) dir;
+}
+
+/* Find an entry in the third-level page table.. */
+extern __inline__ pte_t *pte_offset(pmd_t * dir, unsigned long addr)
+{
+ return (pte_t *) (pmd_page(*dir)) +
+ ((addr >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
+}
+
+/*
+ * Allocate and free page tables. The xxx_kernel() versions are
+ * used to allocate a kernel page table - this turns on ASN bits
+ * if any.
+ */
+
+#define pgd_quicklist (current_cpu_data.pgd_quick)
+#define pmd_quicklist ((unsigned long *)0)
+#define pte_quicklist (current_cpu_data.pte_quick)
+#define pgtable_cache_size (current_cpu_data.pgtable_cache_sz)
+
+extern __inline__ pgd_t *get_pgd_slow(void)
+{
+ pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL);
+
+ if (ret) {
+ memset(ret, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
+ memcpy(ret + USER_PTRS_PER_PGD, swapper_pg_dir + USER_PTRS_PER_PGD, (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
+ }
+ return ret;
+}
+
+extern __inline__ pgd_t *get_pgd_fast(void)
+{
+ unsigned long *ret;
+
+ if ((ret = pgd_quicklist) != NULL) {
+ pgd_quicklist = (unsigned long *)(*ret);
+ ret[0] = 0;
+ pgtable_cache_size--;
+ } else
+ ret = (unsigned long *)get_pgd_slow();
+ return (pgd_t *)ret;
+}
+
+extern __inline__ void free_pgd_fast(pgd_t *pgd)
+{
+ *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
+ pgd_quicklist = (unsigned long *) pgd;
+ pgtable_cache_size++;
+}
+
+extern __inline__ void free_pgd_slow(pgd_t *pgd)
+{
+ free_page((unsigned long)pgd);
+}
+
+extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted);
+extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted);
+
+extern __inline__ pte_t *get_pte_fast(void)
+{
+ unsigned long *ret;
+
+ if((ret = (unsigned long *)pte_quicklist) != NULL) {
+ pte_quicklist = (unsigned long *)(*ret);
+ ret[0] = ret[1];
+ pgtable_cache_size--;
+ }
+ return (pte_t *)ret;
+}
+
+extern __inline__ void free_pte_fast(pte_t *pte)
+{
+ *(unsigned long *)pte = (unsigned long) pte_quicklist;
+ pte_quicklist = (unsigned long *) pte;
+ pgtable_cache_size++;
+}
+
+extern __inline__ void free_pte_slow(pte_t *pte)
+{
+ free_page((unsigned long)pte);
+}
+
+/* We don't use pmd cache, so these are dummy routines */
+extern __inline__ pmd_t *get_pmd_fast(void)
+{
+ return (pmd_t *)0;
+}
+
+extern __inline__ void free_pmd_fast(pmd_t *pmd)
+{
+}
+
+extern __inline__ void free_pmd_slow(pmd_t *pmd)
+{
+}
+
+extern void __bad_pte(pmd_t *pmd);
+extern void __bad_pte_kernel(pmd_t *pmd);
+
+#define pte_free_kernel(pte) free_pte_slow(pte)
+#define pte_free(pte) free_pte_slow(pte)
+#define pgd_free(pgd) free_pgd_slow(pgd)
+#define pgd_alloc() get_pgd_fast()
+
+extern __inline__ pte_t * pte_alloc_kernel(pmd_t * pmd, unsigned long address)
+{
+ address = (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1);
+ if (pmd_none(*pmd)) {
+ pte_t *page = get_pte_fast();
+
+ if (!page)
+ return get_pte_kernel_slow(pmd, address);
+ pmd_set(pmd, page);
+ return page + address;
+ }
+ if (pmd_bad(*pmd)) {
+ __bad_pte_kernel(pmd);
+ return NULL;
+ }
+ return (pte_t *) pmd_page(*pmd) + address;
+}
+
+extern __inline__ pte_t * pte_alloc(pmd_t * pmd, unsigned long address)
+{
+ address = (address >> (PAGE_SHIFT-2)) & 4*(PTRS_PER_PTE - 1);
+
+ if (pmd_none(*pmd))
+ goto getnew;
+ if (pmd_bad(*pmd))
+ goto fix;
+ return (pte_t *) (pmd_page(*pmd) + address);
+getnew:
+{
+ unsigned long page = (unsigned long) get_pte_fast();
+
+ if (!page)
+ return get_pte_slow(pmd, address);
+ pmd_val(*pmd) = _PAGE_TABLE + __pa(page);
+ return (pte_t *) (page + address);
+}
+fix:
+ __bad_pte(pmd);
+ return NULL;
+}
+
+/*
+ * allocating and freeing a pmd is trivial: the 1-entry pmd is
+ * inside the pgd, so has no extra memory associated with it.
+ */
+extern inline void pmd_free(pmd_t * pmd)
+{
+}
+
+extern inline pmd_t * pmd_alloc(pgd_t * pgd, unsigned long address)
+{
+ return (pmd_t *) pgd;
+}
+
+#define pmd_free_kernel pmd_free
+#define pmd_alloc_kernel pmd_alloc
+
+extern int do_check_pgt_cache(int, int);
+
+extern inline void set_pgdir(unsigned long address, pgd_t entry)
+{
+ struct task_struct * p;
+ pgd_t *pgd;
+
+ read_lock(&tasklist_lock);
+ for_each_task(p) {
+ if (!p->mm)
+ continue;
+ *pgd_offset(p->mm,address) = entry;
+ }
+ read_unlock(&tasklist_lock);
+ for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd)
+ pgd[address >> PGDIR_SHIFT] = entry;
+}
+
+extern pgd_t swapper_pg_dir[1024];
+
+extern void update_mmu_cache(struct vm_area_struct * vma,
+ unsigned long address, pte_t pte);
+
+#define SWP_TYPE(entry) (((entry) >> 1) & 0x3f)
+#define SWP_OFFSET(entry) ((entry) >> 8)
+#define SWP_ENTRY(type,offset) (((type) << 1) | ((offset) << 8))
+
+#define module_map vmalloc
+#define module_unmap vfree
+
+#endif /* !__ASSEMBLY__ */
+
+/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
+#define PageSkip(page) (0)
+#define kern_addr_valid(addr) (1)
+
+#define io_remap_page_range remap_page_range
+
+#endif /* __ASM_SH_PAGE_H */
diff --git a/include/asm-sh/poll.h b/include/asm-sh/poll.h
new file mode 100644
index 000000000..e87aa2d73
--- /dev/null
+++ b/include/asm-sh/poll.h
@@ -0,0 +1,25 @@
+#ifndef __ASM_SH_POLL_H
+#define __ASM_SH_POLL_H
+
+/* These are specified by iBCS2 */
+#define POLLIN 0x0001
+#define POLLPRI 0x0002
+#define POLLOUT 0x0004
+#define POLLERR 0x0008
+#define POLLHUP 0x0010
+#define POLLNVAL 0x0020
+
+/* The rest seem to be more-or-less nonstandard. Check them! */
+#define POLLRDNORM 0x0040
+#define POLLRDBAND 0x0080
+#define POLLWRNORM 0x0100
+#define POLLWRBAND 0x0200
+#define POLLMSG 0x0400
+
+struct pollfd {
+ int fd;
+ short events;
+ short revents;
+};
+
+#endif /* __ASM_SH_POLL_H */
diff --git a/include/asm-sh/posix_types.h b/include/asm-sh/posix_types.h
new file mode 100644
index 000000000..dbf6dce6d
--- /dev/null
+++ b/include/asm-sh/posix_types.h
@@ -0,0 +1,112 @@
+#ifndef __ASM_SH_POSIX_TYPES_H
+#define __ASM_SH_POSIX_TYPES_H
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc. Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned short __kernel_dev_t;
+typedef unsigned long __kernel_ino_t;
+typedef unsigned short __kernel_mode_t;
+typedef unsigned short __kernel_nlink_t;
+typedef long __kernel_off_t;
+typedef int __kernel_pid_t;
+typedef unsigned short __kernel_ipc_pid_t;
+typedef unsigned short __kernel_uid_t;
+typedef unsigned short __kernel_gid_t;
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_daddr_t;
+typedef char * __kernel_caddr_t;
+
+#ifdef __GNUC__
+typedef long long __kernel_loff_t;
+#endif
+
+typedef struct {
+#if defined(__KERNEL__) || defined(__USE_ALL)
+ int val[2];
+#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+ int __val[2];
+#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+} __kernel_fsid_t;
+
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+#undef __FD_SET
+static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
+{
+ unsigned long __tmp = __fd / __NFDBITS;
+ unsigned long __rem = __fd % __NFDBITS;
+ __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
+}
+
+#undef __FD_CLR
+static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
+{
+ unsigned long __tmp = __fd / __NFDBITS;
+ unsigned long __rem = __fd % __NFDBITS;
+ __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
+}
+
+
+#undef __FD_ISSET
+static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
+{
+ unsigned long __tmp = __fd / __NFDBITS;
+ unsigned long __rem = __fd % __NFDBITS;
+ return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
+}
+
+/*
+ * This will unroll the loop for the normal constant case (8 ints,
+ * for a 256-bit fd_set)
+ */
+#undef __FD_ZERO
+static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
+{
+ unsigned long *__tmp = __p->fds_bits;
+ int __i;
+
+ if (__builtin_constant_p(__FDSET_LONGS)) {
+ switch (__FDSET_LONGS) {
+ case 16:
+ __tmp[ 0] = 0; __tmp[ 1] = 0;
+ __tmp[ 2] = 0; __tmp[ 3] = 0;
+ __tmp[ 4] = 0; __tmp[ 5] = 0;
+ __tmp[ 6] = 0; __tmp[ 7] = 0;
+ __tmp[ 8] = 0; __tmp[ 9] = 0;
+ __tmp[10] = 0; __tmp[11] = 0;
+ __tmp[12] = 0; __tmp[13] = 0;
+ __tmp[14] = 0; __tmp[15] = 0;
+ return;
+
+ case 8:
+ __tmp[ 0] = 0; __tmp[ 1] = 0;
+ __tmp[ 2] = 0; __tmp[ 3] = 0;
+ __tmp[ 4] = 0; __tmp[ 5] = 0;
+ __tmp[ 6] = 0; __tmp[ 7] = 0;
+ return;
+
+ case 4:
+ __tmp[ 0] = 0; __tmp[ 1] = 0;
+ __tmp[ 2] = 0; __tmp[ 3] = 0;
+ return;
+ }
+ }
+ __i = __FDSET_LONGS;
+ while (__i) {
+ __i--;
+ *__tmp = 0;
+ __tmp++;
+ }
+}
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
+
+#endif /* __ASM_SH_POSIX_TYPES_H */
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
new file mode 100644
index 000000000..3087af5d0
--- /dev/null
+++ b/include/asm-sh/processor.h
@@ -0,0 +1,114 @@
+/*
+ * include/asm-sh/processor.h
+ *
+ * Copyright (C) 1999 Niibe Yutaka
+ */
+
+#ifndef __ASM_SH_PROCESSOR_H
+#define __ASM_SH_PROCESSOR_H
+
+#include <asm/page.h>
+#include <asm/types.h>
+#include <linux/threads.h>
+
+/*
+ * Default implementation of macro that returns current
+ * instruction pointer ("program counter").
+ */
+#define current_text_addr() ({ void *pc; __asm__("mova 1f,%0\n1:":"=z" (pc)); pc; })
+
+/*
+ * CPU type and hardware bug flags. Kept separately for each CPU.
+ */
+
+struct sh_cpuinfo {
+ unsigned long loops_per_sec;
+ unsigned long *pgd_quick;
+ unsigned long *pte_quick;
+ unsigned long pgtable_cache_sz;
+};
+
+extern struct sh_cpuinfo boot_cpu_data;
+
+#define cpu_data &boot_cpu_data
+#define current_cpu_data boot_cpu_data
+
+/*
+ * User space process size: 2GB.
+ */
+#define TASK_SIZE 0x80000000
+
+/* This decides where the kernel will search for a free chunk of vm
+ * space during mmap's.
+ */
+#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
+
+struct thread_struct {
+ unsigned long sp;
+ unsigned long pc;
+
+ unsigned long trap_no, error_code;
+ unsigned long address;
+ /* Hardware debugging registers may come here */
+};
+
+#define INIT_MMAP \
+{ &init_mm, 0x80000000, 0xa0000000, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
+
+#define INIT_THREAD { \
+ sizeof(init_stack) + (long) &init_stack, /* sp */ \
+ 0, /* pc */ \
+ 0, 0, \
+}
+
+/*
+ * Do necessary setup to start up a newly executed thread.
+ */
+#define start_thread(regs, new_pc, new_sp) \
+ set_fs(USER_DS); \
+ regs->pr = 0; \
+ regs->sr = 0; /* User mode. */ \
+ regs->pc = new_pc; \
+ regs->u_regs[UREG_SP] = new_sp
+
+/* Forward declaration, a strange C thing */
+struct task_struct;
+struct mm_struct;
+
+/* Free all resources held by a thread. */
+extern void release_thread(struct task_struct *);
+/*
+ * create a kernel thread without removing it from tasklists
+ */
+extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
+
+/*
+ * Bus types
+ */
+#define EISA_bus 0
+#define EISA_bus__is_a_macro /* for versions in ksyms.c */
+#define MCA_bus 0
+#define MCA_bus__is_a_macro /* for versions in ksyms.c */
+
+
+/* Copy and release all segment info associated with a VM */
+#define copy_segments(p, mm) do { } while(0)
+#define release_segments(mm) do { } while(0)
+#define forget_segments() do { } while (0)
+
+/*
+ * Return saved PC of a blocked thread.
+ */
+extern __inline__ unsigned long thread_saved_pc(struct thread_struct *t)
+{
+ return t->pc;
+}
+
+#define THREAD_SIZE (2*PAGE_SIZE)
+extern struct task_struct * alloc_task_struct(void);
+extern void free_task_struct(struct task_struct *);
+
+#define init_task (init_task_union.task)
+#define init_stack (init_task_union.stack)
+
+#endif /* __ASM_SH_PROCESSOR_H */
diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h
new file mode 100644
index 000000000..3f2da6d2d
--- /dev/null
+++ b/include/asm-sh/ptrace.h
@@ -0,0 +1,31 @@
+#ifndef __ASM_SH_PTRACE_H
+#define __ASM_SH_PTRACE_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ */
+
+/*
+ * This struct defines the way the registers are stored on the
+ * kernel stack during a system call or other kernel entry.
+ */
+struct pt_regs {
+ long syscall_nr;
+ unsigned long u_regs[16];
+ unsigned long gbr;
+ unsigned long mach;
+ unsigned long macl;
+ unsigned long pr;
+ unsigned long sr;
+ unsigned long pc;
+};
+
+#ifdef __KERNEL__
+#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
+#define instruction_pointer(regs) ((regs)->pc)
+extern void show_regs(struct pt_regs *);
+#endif
+
+#define UREG_SP 15
+#endif /* __ASM_SH_PTRACE_H */
diff --git a/include/asm-sh/resource.h b/include/asm-sh/resource.h
new file mode 100644
index 000000000..5f536d5f8
--- /dev/null
+++ b/include/asm-sh/resource.h
@@ -0,0 +1,39 @@
+#ifndef __ASM_SH_RESOURCE_H
+#define __ASM_SH_RESOURCE_H
+
+/*
+ * Resource limits
+ */
+
+#define RLIMIT_CPU 0 /* CPU time in ms */
+#define RLIMIT_FSIZE 1 /* Maximum filesize */
+#define RLIMIT_DATA 2 /* max data size */
+#define RLIMIT_STACK 3 /* max stack size */
+#define RLIMIT_CORE 4 /* max core file size */
+#define RLIMIT_RSS 5 /* max resident set size */
+#define RLIMIT_NPROC 6 /* max number of processes */
+#define RLIMIT_NOFILE 7 /* max number of open files */
+#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
+#define RLIMIT_AS 9 /* address space limit */
+
+#define RLIM_NLIMITS 10
+
+#ifdef __KERNEL__
+
+#define INIT_RLIMITS \
+{ \
+ { LONG_MAX, LONG_MAX }, \
+ { LONG_MAX, LONG_MAX }, \
+ { LONG_MAX, LONG_MAX }, \
+ { _STK_LIM, LONG_MAX }, \
+ { 0, LONG_MAX }, \
+ { LONG_MAX, LONG_MAX }, \
+ { 0, 0 }, \
+ { INR_OPEN, INR_OPEN }, \
+ { LONG_MAX, LONG_MAX }, \
+ { LONG_MAX, LONG_MAX }, \
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_SH_RESOURCE_H */
diff --git a/include/asm-i386/semaphore-helper.h b/include/asm-sh/semaphore-helper.h
index c8636da0c..fbd6c95c0 100644
--- a/include/asm-i386/semaphore-helper.h
+++ b/include/asm-sh/semaphore-helper.h
@@ -1,5 +1,5 @@
-#ifndef _I386_SEMAPHORE_HELPER_H
-#define _I386_SEMAPHORE_HELPER_H
+#ifndef __ASM_SH_SEMAPHORE_HELPER_H
+#define __ASM_SH_SEMAPHORE_HELPER_H
/*
* SMP- and interrupt-safe semaphores helper functions.
@@ -12,19 +12,14 @@
* These two _must_ execute atomically wrt each other.
*
* This is trivially done with load_locked/store_cond,
- * but on the x86 we need an external synchronizer.
+ * which we have. Let the rest of the losers suck eggs.
*/
-static inline void wake_one_more(struct semaphore * sem)
+static __inline__ void wake_one_more(struct semaphore * sem)
{
- unsigned long flags;
-
- spin_lock_irqsave(&semaphore_wake_lock, flags);
- if (atomic_read(&sem->count) <= 0)
- sem->waking++;
- spin_unlock_irqrestore(&semaphore_wake_lock, flags);
+ atomic_inc((atomic_t *)&sem->waking);
}
-static inline int waking_non_zero(struct semaphore *sem)
+static __inline__ int waking_non_zero(struct semaphore *sem)
{
unsigned long flags;
int ret = 0;
@@ -48,7 +43,7 @@ static inline int waking_non_zero(struct semaphore *sem)
* protected by the spinlock in order to make atomic this atomic_inc() with the
* atomic_read() in wake_one_more(), otherwise we can race. -arca
*/
-static inline int waking_non_zero_interruptible(struct semaphore *sem,
+static __inline__ int waking_non_zero_interruptible(struct semaphore *sem,
struct task_struct *tsk)
{
unsigned long flags;
@@ -75,7 +70,7 @@ static inline int waking_non_zero_interruptible(struct semaphore *sem,
* protected by the spinlock in order to make atomic this atomic_inc() with the
* atomic_read() in wake_one_more(), otherwise we can race. -arca
*/
-static inline int waking_non_zero_trylock(struct semaphore *sem)
+static __inline__ int waking_non_zero_trylock(struct semaphore *sem)
{
unsigned long flags;
int ret = 1;
@@ -91,4 +86,4 @@ static inline int waking_non_zero_trylock(struct semaphore *sem)
return ret;
}
-#endif
+#endif /* __ASM_SH_SEMAPHORE_HELPER_H */
diff --git a/include/asm-sh/semaphore.h b/include/asm-sh/semaphore.h
new file mode 100644
index 000000000..4164b7805
--- /dev/null
+++ b/include/asm-sh/semaphore.h
@@ -0,0 +1,134 @@
+#ifndef __ASM_SH_SEMAPHORE_H
+#define __ASM_SH_SEMAPHORE_H
+
+#include <linux/linkage.h>
+
+/*
+ * SMP- and interrupt-safe semaphores.
+ *
+ * (C) Copyright 1996 Linus Torvalds
+ *
+ * SuperH verison by Niibe Yutaka
+ *
+ */
+
+#include <linux/spinlock.h>
+
+#include <asm/system.h>
+#include <asm/atomic.h>
+
+struct semaphore {
+ atomic_t count;
+ int waking;
+ wait_queue_head_t wait;
+#if WAITQUEUE_DEBUG
+ long __magic;
+#endif
+};
+
+#if WAITQUEUE_DEBUG
+# define __SEM_DEBUG_INIT(name) \
+ , (int)&(name).__magic
+#else
+# define __SEM_DEBUG_INIT(name)
+#endif
+
+#define __SEMAPHORE_INITIALIZER(name,count) \
+{ ATOMIC_INIT(count), 0, __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
+ __SEM_DEBUG_INIT(name) }
+
+#define __MUTEX_INITIALIZER(name) \
+ __SEMAPHORE_INITIALIZER(name,1)
+
+#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
+ struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
+
+#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
+#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
+
+extern inline void sema_init (struct semaphore *sem, int val)
+{
+/*
+ * *sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val);
+ *
+ * i'd rather use the more flexible initialization above, but sadly
+ * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well.
+ */
+ atomic_set(&sem->count, val);
+ sem->waking = 0;
+ init_waitqueue_head(&sem->wait);
+#if WAITQUEUE_DEBUG
+ sem->__magic = (int)&sem->__magic;
+#endif
+}
+
+static inline void init_MUTEX (struct semaphore *sem)
+{
+ sema_init(sem, 1);
+}
+
+static inline void init_MUTEX_LOCKED (struct semaphore *sem)
+{
+ sema_init(sem, 0);
+}
+
+asmlinkage void __down_failed(void /* special register calling convention */);
+asmlinkage int __down_failed_interruptible(void /* params in registers */);
+asmlinkage int __down_failed_trylock(void /* params in registers */);
+asmlinkage void __up_wakeup(void /* special register calling convention */);
+
+asmlinkage void __down(struct semaphore * sem);
+asmlinkage int __down_interruptible(struct semaphore * sem);
+asmlinkage int __down_trylock(struct semaphore * sem);
+asmlinkage void __up(struct semaphore * sem);
+
+extern spinlock_t semaphore_wake_lock;
+
+extern __inline__ void down(struct semaphore * sem)
+{
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
+ if (atomic_dec_return(&sem->count) < 0)
+ __down(sem);
+}
+
+extern __inline__ int down_interruptible(struct semaphore * sem)
+{
+ int ret = 0;
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
+ if (atomic_dec_return(&sem->count) < 0)
+ ret = __down_interruptible(sem);
+ return ret;
+}
+
+extern __inline__ int down_trylock(struct semaphore * sem)
+{
+ int ret = 0;
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+
+ if (atomic_dec_return(&sem->count) < 0)
+ ret = __down_trylock(sem);
+ return ret;
+}
+
+/*
+ * Note! This is subtle. We jump to wake people up only if
+ * the semaphore was negative (== somebody was waiting on it).
+ */
+extern __inline__ void up(struct semaphore * sem)
+{
+#if WAITQUEUE_DEBUG
+ CHECK_MAGIC(sem->__magic);
+#endif
+ if (atomic_inc_return(&sem->count) <= 0)
+ __up(sem);
+}
+
+#endif /* __ASM_SH_SEMAPHORE_H */
diff --git a/include/asm-sh/shmparam.h b/include/asm-sh/shmparam.h
new file mode 100644
index 000000000..cf58a95e8
--- /dev/null
+++ b/include/asm-sh/shmparam.h
@@ -0,0 +1,46 @@
+#ifndef __ASM_SH_SHMPARAM_H
+#define __ASM_SH_SHMPARAM_H
+
+/* address range for shared memory attaches if no address passed to shmat() */
+#define SHM_RANGE_START 0x50000000
+#define SHM_RANGE_END 0x60000000
+
+/*
+ * Format of a swap-entry for shared memory pages currently out in
+ * swap space (see also mm/swap.c).
+ *
+ * SWP_TYPE = SHM_SWP_TYPE
+ * SWP_OFFSET is used as follows:
+ *
+ * bits 0..6 : id of shared memory segment page belongs to (SHM_ID)
+ * bits 7..21: index of page within shared memory segment (SHM_IDX)
+ * (actually fewer bits get used since SHMMAX is so low)
+ */
+
+/*
+ * Keep _SHM_ID_BITS as low as possible since SHMMNI depends on it and
+ * there is a static array of size SHMMNI.
+ */
+#define _SHM_ID_BITS 7
+#define SHM_ID_MASK ((1<<_SHM_ID_BITS)-1)
+
+#define SHM_IDX_SHIFT (_SHM_ID_BITS)
+#define _SHM_IDX_BITS 15
+#define SHM_IDX_MASK ((1<<_SHM_IDX_BITS)-1)
+
+/*
+ * _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and
+ * SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS).
+ */
+
+#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
+/* Try not to change the default shipped SHMMAX - people rely on it */
+
+#define SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */
+#define SHMMNI (1<<_SHM_ID_BITS) /* max num of segs system wide */
+#define SHMALL /* max shm system wide (pages) */ \
+ (1<<(_SHM_IDX_BITS+_SHM_ID_BITS))
+#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
+#define SHMSEG SHMMNI /* max shared segs per process */
+
+#endif /* __ASM_SH_SHMPARAM_H */
diff --git a/include/asm-sh/sigcontext.h b/include/asm-sh/sigcontext.h
new file mode 100644
index 000000000..de712bcca
--- /dev/null
+++ b/include/asm-sh/sigcontext.h
@@ -0,0 +1,17 @@
+#ifndef __ASM_SH_SIGCONTEXT_H
+#define __ASM_SH_SIGCONTEXT_H
+
+struct sigcontext {
+ unsigned long oldmask;
+
+ /* CPU registers */
+ unsigned long u_regs[16];
+ unsigned long gbr;
+ unsigned long mach;
+ unsigned long macl;
+ unsigned long pr;
+ unsigned long sr;
+ unsigned long pc;
+};
+
+#endif /* __ASM_SH_SIGCONTEXT_H */
diff --git a/include/asm-sh/siginfo.h b/include/asm-sh/siginfo.h
new file mode 100644
index 000000000..ca0b5a157
--- /dev/null
+++ b/include/asm-sh/siginfo.h
@@ -0,0 +1,197 @@
+#ifndef __ASM_SH_SIGINFO_H
+#define __ASM_SH_SIGINFO_H
+
+#include <linux/types.h>
+
+/* XXX: This structure was copied from the Alpha; is there an iBCS version? */
+
+typedef union sigval {
+ int sival_int;
+ void *sival_ptr;
+} sigval_t;
+
+#define SI_MAX_SIZE 128
+#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3)
+
+typedef struct siginfo {
+ int si_signo;
+ int si_errno;
+ int si_code;
+
+ union {
+ int _pad[SI_PAD_SIZE];
+
+ /* kill() */
+ struct {
+ pid_t _pid; /* sender's pid */
+ uid_t _uid; /* sender's uid */
+ } _kill;
+
+ /* POSIX.1b timers */
+ struct {
+ unsigned int _timer1;
+ unsigned int _timer2;
+ } _timer;
+
+ /* POSIX.1b signals */
+ struct {
+ pid_t _pid; /* sender's pid */
+ uid_t _uid; /* sender's uid */
+ sigval_t _sigval;
+ } _rt;
+
+ /* SIGCHLD */
+ struct {
+ pid_t _pid; /* which child */
+ uid_t _uid; /* sender's uid */
+ int _status; /* exit code */
+ clock_t _utime;
+ clock_t _stime;
+ } _sigchld;
+
+ /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
+ struct {
+ void *_addr; /* faulting insn/memory ref. */
+ } _sigfault;
+
+ /* SIGPOLL */
+ struct {
+ int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
+ int _fd;
+ } _sigpoll;
+ } _sifields;
+} siginfo_t;
+
+/*
+ * How these fields are to be accessed.
+ */
+#define si_pid _sifields._kill._pid
+#define si_uid _sifields._kill._uid
+#define si_status _sifields._sigchld._status
+#define si_utime _sifields._sigchld._utime
+#define si_stime _sifields._sigchld._stime
+#define si_value _sifields._rt._sigval
+#define si_int _sifields._rt._sigval.sival_int
+#define si_ptr _sifields._rt._sigval.sival_ptr
+#define si_addr _sifields._sigfault._addr
+#define si_band _sifields._sigpoll._band
+#define si_fd _sifields._sigpoll._fd
+
+/*
+ * si_code values
+ * Digital reserves positive values for kernel-generated signals.
+ */
+#define SI_USER 0 /* sent by kill, sigsend, raise */
+#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
+#define SI_QUEUE -1 /* sent by sigqueue */
+#define SI_TIMER -2 /* sent by timer expiration */
+#define SI_MESGQ -3 /* sent by real time mesq state change */
+#define SI_ASYNCIO -4 /* sent by AIO completion */
+#define SI_SIGIO -5 /* sent by queued SIGIO */
+
+#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
+#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
+
+/*
+ * SIGILL si_codes
+ */
+#define ILL_ILLOPC 1 /* illegal opcode */
+#define ILL_ILLOPN 2 /* illegal operand */
+#define ILL_ILLADR 3 /* illegal addressing mode */
+#define ILL_ILLTRP 4 /* illegal trap */
+#define ILL_PRVOPC 5 /* privileged opcode */
+#define ILL_PRVREG 6 /* privileged register */
+#define ILL_COPROC 7 /* coprocessor error */
+#define ILL_BADSTK 8 /* internal stack error */
+#define NSIGILL 8
+
+/*
+ * SIGFPE si_codes
+ */
+#define FPE_INTDIV 1 /* integer divide by zero */
+#define FPE_INTOVF 2 /* integer overflow */
+#define FPE_FLTDIV 3 /* floating point divide by zero */
+#define FPE_FLTOVF 4 /* floating point overflow */
+#define FPE_FLTUND 5 /* floating point underflow */
+#define FPE_FLTRES 6 /* floating point inexact result */
+#define FPE_FLTINV 7 /* floating point invalid operation */
+#define FPE_FLTSUB 8 /* subscript out of range */
+#define NSIGFPE 8
+
+/*
+ * SIGSEGV si_codes
+ */
+#define SEGV_MAPERR 1 /* address not mapped to object */
+#define SEGV_ACCERR 2 /* invalid permissions for mapped object */
+#define NSIGSEGV 2
+
+/*
+ * SIGBUS si_codes
+ */
+#define BUS_ADRALN 1 /* invalid address alignment */
+#define BUS_ADRERR 2 /* non-existant physical address */
+#define BUS_OBJERR 3 /* object specific hardware error */
+#define NSIGBUS 3
+
+/*
+ * SIGTRAP si_codes
+ */
+#define TRAP_BRKPT 1 /* process breakpoint */
+#define TRAP_TRACE 2 /* process trace trap */
+#define NSIGTRAP 2
+
+/*
+ * SIGCHLD si_codes
+ */
+#define CLD_EXITED 1 /* child has exited */
+#define CLD_KILLED 2 /* child was killed */
+#define CLD_DUMPED 3 /* child terminated abnormally */
+#define CLD_TRAPPED 4 /* traced child has trapped */
+#define CLD_STOPPED 5 /* child has stopped */
+#define CLD_CONTINUED 6 /* stopped child has continued */
+#define NSIGCHLD
+
+/*
+ * SIGPOLL si_codes
+ */
+#define POLL_IN 1 /* data input available */
+#define POLL_OUT 2 /* output buffers available */
+#define POLL_MSG 3 /* input message available */
+#define POLL_ERR 4 /* i/o error */
+#define POLL_PRI 5 /* high priority input available */
+#define POLL_HUP 6 /* device disconnected */
+#define NSIGPOLL 6
+
+/*
+ * sigevent definitions
+ *
+ * It seems likely that SIGEV_THREAD will have to be handled from
+ * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
+ * thread manager then catches and does the appropriate nonsense.
+ * However, everything is written out here so as to not get lost.
+ */
+#define SIGEV_SIGNAL 0 /* notify via signal */
+#define SIGEV_NONE 1 /* other notification: meaningless */
+#define SIGEV_THREAD 2 /* deliver via thread creation */
+
+#define SIGEV_MAX_SIZE 64
+#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
+
+typedef struct sigevent {
+ sigval_t sigev_value;
+ int sigev_signo;
+ int sigev_notify;
+ union {
+ int _pad[SIGEV_PAD_SIZE];
+
+ struct {
+ void (*_function)(sigval_t);
+ void *_attribute; /* really pthread_attr_t */
+ } _sigev_thread;
+ } _sigev_un;
+} sigevent_t;
+
+#define sigev_notify_function _sigev_un._sigev_thread._function
+#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
+
+#endif /* __ASM_SH_SIGINFO_H */
diff --git a/include/asm-sh/signal.h b/include/asm-sh/signal.h
new file mode 100644
index 000000000..d76c0daf2
--- /dev/null
+++ b/include/asm-sh/signal.h
@@ -0,0 +1,183 @@
+#ifndef __ASM_SH_SIGNAL_H
+#define __ASM_SH_SIGNAL_H
+
+#include <linux/types.h>
+
+/* Avoid too many header ordering problems. */
+struct siginfo;
+
+#ifdef __KERNEL__
+/* Most things should be clean enough to redefine this at will, if care
+ is taken to make libc match. */
+
+#define _NSIG 64
+#define _NSIG_BPW 32
+#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
+
+typedef unsigned long old_sigset_t; /* at least 32 bits */
+
+typedef struct {
+ unsigned long sig[_NSIG_WORDS];
+} sigset_t;
+
+#else
+/* Here we must cater to libcs that poke about in kernel headers. */
+
+#define NSIG 32
+typedef unsigned long sigset_t;
+
+#endif /* __KERNEL__ */
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGTRAP 5
+#define SIGABRT 6
+#define SIGIOT 6
+#define SIGBUS 7
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGUSR1 10
+#define SIGSEGV 11
+#define SIGUSR2 12
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGSTKFLT 16
+#define SIGCHLD 17
+#define SIGCONT 18
+#define SIGSTOP 19
+#define SIGTSTP 20
+#define SIGTTIN 21
+#define SIGTTOU 22
+#define SIGURG 23
+#define SIGXCPU 24
+#define SIGXFSZ 25
+#define SIGVTALRM 26
+#define SIGPROF 27
+#define SIGWINCH 28
+#define SIGIO 29
+#define SIGPOLL SIGIO
+/*
+#define SIGLOST 29
+*/
+#define SIGPWR 30
+#define SIGUNUSED 31
+
+/* These should not be considered constants from userland. */
+#define SIGRTMIN 32
+#define SIGRTMAX (_NSIG-1)
+
+/*
+ * SA_FLAGS values:
+ *
+ * SA_ONSTACK indicates that a registered stack_t will be used.
+ * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
+ * SA_RESTART flag to get restarting signals (which were the default long ago)
+ * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
+ * SA_RESETHAND clears the handler when the signal is delivered.
+ * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
+ * SA_NODEFER prevents the current signal from being masked in the handler.
+ *
+ * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
+ * Unix names RESETHAND and NODEFER respectively.
+ */
+#define SA_NOCLDSTOP 0x00000001
+#define SA_NOCLDWAIT 0x00000002 /* not supported yet */
+#define SA_SIGINFO 0x00000004
+#define SA_ONSTACK 0x08000000
+#define SA_RESTART 0x10000000
+#define SA_NODEFER 0x40000000
+#define SA_RESETHAND 0x80000000
+
+#define SA_NOMASK SA_NODEFER
+#define SA_ONESHOT SA_RESETHAND
+#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */
+
+#define SA_RESTORER 0x04000000
+
+/*
+ * sigaltstack controls
+ */
+#define SS_ONSTACK 1
+#define SS_DISABLE 2
+
+#define MINSIGSTKSZ 2048
+#define SIGSTKSZ 8192
+
+#ifdef __KERNEL__
+
+/*
+ * These values of sa_flags are used only by the kernel as part of the
+ * irq handling routines.
+ *
+ * SA_INTERRUPT is also used by the irq handling routines.
+ * SA_SHIRQ is for shared interrupt support on PCI and EISA.
+ */
+#define SA_PROBE SA_ONESHOT
+#define SA_SAMPLE_RANDOM SA_RESTART
+#define SA_SHIRQ 0x04000000
+#endif
+
+#define SIG_BLOCK 0 /* for blocking signals */
+#define SIG_UNBLOCK 1 /* for unblocking signals */
+#define SIG_SETMASK 2 /* for setting the signal mask */
+
+/* Type of a signal handler. */
+typedef void (*__sighandler_t)(int);
+
+#define SIG_DFL ((__sighandler_t)0) /* default signal handling */
+#define SIG_IGN ((__sighandler_t)1) /* ignore signal */
+#define SIG_ERR ((__sighandler_t)-1) /* error return from signal */
+
+#ifdef __KERNEL__
+struct old_sigaction {
+ __sighandler_t sa_handler;
+ old_sigset_t sa_mask;
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+};
+
+struct sigaction {
+ __sighandler_t sa_handler;
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+ sigset_t sa_mask; /* mask last for extensibility */
+};
+
+struct k_sigaction {
+ struct sigaction sa;
+};
+#else
+/* Here we must cater to libcs that poke about in kernel headers. */
+
+struct sigaction {
+ union {
+ __sighandler_t _sa_handler;
+ void (*_sa_sigaction)(int, struct siginfo *, void *);
+ } _u;
+ sigset_t sa_mask;
+ unsigned long sa_flags;
+ void (*sa_restorer)(void);
+};
+
+#define sa_handler _u._sa_handler
+#define sa_sigaction _u._sa_sigaction
+
+#endif /* __KERNEL__ */
+
+typedef struct sigaltstack {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+} stack_t;
+
+#ifdef __KERNEL__
+#include <asm/sigcontext.h>
+
+#define sigmask(sig) (1UL << ((sig) - 1))
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_SH_SIGNAL_H */
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h
new file mode 100644
index 000000000..e15f0beba
--- /dev/null
+++ b/include/asm-sh/smp.h
@@ -0,0 +1,4 @@
+#ifndef __ASM_SH_SMP_H
+#define __ASM_SH_SMP_H
+
+#endif /* __ASM_SH_SMP_H */
diff --git a/include/asm-sh/smp_lock.h b/include/asm-sh/smp_lock.h
new file mode 100644
index 000000000..dfe8722a3
--- /dev/null
+++ b/include/asm-sh/smp_lock.h
@@ -0,0 +1,17 @@
+#ifndef __ASM_SH_SMPLOCK_H
+#define __ASM_SH_SMPLOCK_H
+
+#ifndef __SMP__
+
+#define lock_kernel() do { } while(0)
+#define unlock_kernel() do { } while(0)
+#define release_kernel_lock(task, cpu, depth) ((depth) = 1)
+#define reacquire_kernel_lock(task, cpu, depth) do { } while(0)
+
+#else
+
+#error "We do not support SMP on SH yet"
+
+#endif /* __SMP__ */
+
+#endif /* __ASM_SH_SMPLOCK_H */
diff --git a/include/asm-sh/socket.h b/include/asm-sh/socket.h
new file mode 100644
index 000000000..c6d2ae97d
--- /dev/null
+++ b/include/asm-sh/socket.h
@@ -0,0 +1,51 @@
+#ifndef __ASM_SH_SOCKET_H
+#define __ASM_SH_SOCKET_H
+
+#include <asm/sockios.h>
+
+/* For setsockoptions(2) */
+#define SOL_SOCKET 1
+
+#define SO_DEBUG 1
+#define SO_REUSEADDR 2
+#define SO_TYPE 3
+#define SO_ERROR 4
+#define SO_DONTROUTE 5
+#define SO_BROADCAST 6
+#define SO_SNDBUF 7
+#define SO_RCVBUF 8
+#define SO_KEEPALIVE 9
+#define SO_OOBINLINE 10
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_LINGER 13
+#define SO_BSDCOMPAT 14
+/* To add :#define SO_REUSEPORT 15 */
+#define SO_PASSCRED 16
+#define SO_PEERCRED 17
+#define SO_RCVLOWAT 18
+#define SO_SNDLOWAT 19
+#define SO_RCVTIMEO 20
+#define SO_SNDTIMEO 21
+
+/* Security levels - as per NRL IPv6 - don't actually do anything */
+#define SO_SECURITY_AUTHENTICATION 22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define SO_SECURITY_ENCRYPTION_NETWORK 24
+
+/* Nasty libc5 fixup - bletch */
+#if defined(__KERNEL__)
+/* Socket types. */
+#define SOCK_STREAM 1 /* stream (connection) socket */
+#define SOCK_DGRAM 2 /* datagram (conn.less) socket */
+#define SOCK_RAW 3 /* raw socket */
+#define SOCK_RDM 4 /* reliably-delivered message */
+#define SOCK_SEQPACKET 5 /* sequential packet socket */
+#define SOCK_PACKET 10 /* linux specific way of */
+ /* getting packets at the dev */
+ /* level. For writing rarp and */
+ /* other similar things on the */
+ /* user level. */
+#endif
+
+#endif /* __ASM_SH_SOCKET_H */
diff --git a/include/asm-sh/sockios.h b/include/asm-sh/sockios.h
new file mode 100644
index 000000000..08a71df8a
--- /dev/null
+++ b/include/asm-sh/sockios.h
@@ -0,0 +1,13 @@
+#ifndef __ASM_SH_SOCKIOS_H
+#define __ASM_SH_SOCKIOS_H
+
+/* Socket-level I/O control calls. */
+#define FIOGETOWN _IOR('f', 123, int)
+#define FIOSETOWN _IOW('f', 124, int)
+
+#define SIOCATMARK _IOR('s', 7, int)
+#define SIOCSPGRP _IOW('s', 8, pid_t)
+#define SIOCGPGRP _IOR('s', 9, pid_t)
+
+#define SIOCGSTAMP _IOR('s', 100, struct timeval) /* Get stamp - linux-specific */
+#endif /* __ASM_SH_SOCKIOS_H */
diff --git a/include/asm-sh/softirq.h b/include/asm-sh/softirq.h
new file mode 100644
index 000000000..66b0963a8
--- /dev/null
+++ b/include/asm-sh/softirq.h
@@ -0,0 +1,72 @@
+#ifndef __ASM_SH_SOFTIRQ_H
+#define __ASM_SH_SOFTIRQ_H
+
+extern unsigned int local_bh_count[NR_CPUS];
+
+#define cpu_bh_disable(cpu) do { local_bh_count[(cpu)]++; barrier(); } while (0)
+#define cpu_bh_enable(cpu) do { barrier(); local_bh_count[(cpu)]--; } while (0)
+
+#define cpu_bh_trylock(cpu) (local_bh_count[(cpu)] ? 0 : (local_bh_count[(cpu)] = 1))
+#define cpu_bh_endlock(cpu) (local_bh_count[(cpu)] = 0)
+
+#define local_bh_disable() cpu_bh_disable(smp_processor_id())
+#define local_bh_enable() cpu_bh_enable(smp_processor_id())
+
+#define get_active_bhs() (bh_mask & bh_active)
+/* XXX */
+#define clear_active_bhs(x) atomic_clear_mask((x),&bh_active)
+
+extern inline void init_bh(int nr, void (*routine)(void))
+{
+ bh_base[nr] = routine;
+ atomic_set(&bh_mask_count[nr], 0);
+ bh_mask |= 1 << nr;
+}
+
+extern inline void remove_bh(int nr)
+{
+ bh_mask &= ~(1 << nr);
+ mb();
+ bh_base[nr] = NULL;
+}
+
+extern inline void mark_bh(int nr)
+{
+ set_bit(nr, &bh_active);
+}
+
+extern inline void start_bh_atomic(void)
+{
+ local_bh_disable();
+ barrier();
+}
+
+extern inline void end_bh_atomic(void)
+{
+ barrier();
+ local_bh_enable();
+}
+
+/* These are for the irq's testing the lock */
+#define softirq_trylock(cpu) (cpu_bh_trylock(cpu))
+#define softirq_endlock(cpu) (cpu_bh_endlock(cpu))
+#define synchronize_bh() barrier()
+
+/*
+ * These use a mask count to correctly handle
+ * nested disable/enable calls
+ */
+extern inline void disable_bh(int nr)
+{
+ bh_mask &= ~(1 << nr);
+ atomic_inc(&bh_mask_count[nr]);
+ synchronize_bh();
+}
+
+extern inline void enable_bh(int nr)
+{
+ if (atomic_dec_and_test(&bh_mask_count[nr]))
+ bh_mask |= 1 << nr;
+}
+
+#endif /* __ASM_SH_SOFTIRQ_H */
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
new file mode 100644
index 000000000..16f70ffd7
--- /dev/null
+++ b/include/asm-sh/spinlock.h
@@ -0,0 +1,6 @@
+#ifndef __ASM_SH_SPINLOCK_H
+#define __ASM_SH_SPINLOCK_H
+
+#error "No SMP on SH"
+
+#endif /* __ASM_SH_SPINLOCK_H */
diff --git a/include/asm-sh/stat.h b/include/asm-sh/stat.h
new file mode 100644
index 000000000..5e484792a
--- /dev/null
+++ b/include/asm-sh/stat.h
@@ -0,0 +1,41 @@
+#ifndef __ASM_SH_STAT_H
+#define __ASM_SH_STAT_H
+
+struct __old_kernel_stat {
+ unsigned short st_dev;
+ unsigned short st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned long st_size;
+ unsigned long st_atime;
+ unsigned long st_mtime;
+ unsigned long st_ctime;
+};
+
+struct stat {
+ unsigned short st_dev;
+ unsigned short __pad1;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned short __pad2;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long __unused1;
+ unsigned long st_mtime;
+ unsigned long __unused2;
+ unsigned long st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+#endif /* __ASM_SH_STAT_H */
diff --git a/include/asm-sh/statfs.h b/include/asm-sh/statfs.h
new file mode 100644
index 000000000..e0e3385ed
--- /dev/null
+++ b/include/asm-sh/statfs.h
@@ -0,0 +1,25 @@
+#ifndef __ASM_SH_STATFS_H
+#define __ASM_SH_STATFS_H
+
+#ifndef __KERNEL_STRICT_NAMES
+
+#include <linux/types.h>
+
+typedef __kernel_fsid_t fsid_t;
+
+#endif
+
+struct statfs {
+ long f_type;
+ long f_bsize;
+ long f_blocks;
+ long f_bfree;
+ long f_bavail;
+ long f_files;
+ long f_ffree;
+ __kernel_fsid_t f_fsid;
+ long f_namelen;
+ long f_spare[6];
+};
+
+#endif /* __ASM_SH_STATFS_H */
diff --git a/include/asm-sh/string.h b/include/asm-sh/string.h
new file mode 100644
index 000000000..6752d3f9c
--- /dev/null
+++ b/include/asm-sh/string.h
@@ -0,0 +1,140 @@
+#ifndef __ASM_SH_STRING_H
+#define __ASM_SH_STRING_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ * But consider these trivial functions to be public domain.
+ */
+
+#define __HAVE_ARCH_STRCPY
+extern __inline__ char *strcpy(char *__dest, const char *__src)
+{
+ register char *__xdest = __dest;
+ unsigned long __dummy;
+
+ __asm__ __volatile__("1:\n\t"
+ "mov.b @%1+,%2\n\t"
+ "mov.b %2,@%0\n\t"
+ "cmp/eq #0,%2\n\t"
+ "bf/s 1b\n\t"
+ " add #1,%0\n\t"
+ :"=&r" (__dest), "=&r" (__src), "=&z" (__dummy)
+ :"0" (__dest), "1" (__src)
+ :"memory");
+
+ return __xdest;
+}
+
+#define __HAVE_ARCH_STRNCPY
+extern __inline__ char *strncpy(char *__dest, const char *__src, size_t __n)
+{
+ register char *__xdest = __dest;
+ unsigned long __dummy;
+
+ if (__n == 0)
+ return __xdest;
+
+ __asm__ __volatile__(
+ "1:\n"
+ "mov.b @%1+,%2\n\t"
+ "mov.b %2,@%0\n\t"
+ "cmp/eq #0,%2\n\t"
+ "bt/s 2f\n\t"
+ " cmp/eq %5,%1\n\t"
+ "bf/s 1b\n\t"
+ " add #1,%0\n"
+ "2:"
+ : "=r" (__dest), "=r" (__src), "=&z" (__dummy)
+ : "0" (__dest), "1" (__src), "r" (__src+__n)
+ : "memory");
+
+ return __xdest;
+}
+
+#define __HAVE_ARCH_STRCMP
+extern __inline__ int strcmp(const char *__cs, const char *__ct)
+{
+ register int __res;
+ unsigned long __dummy;
+
+ __asm__ __volatile__(
+ "mov.b @%1+,%3\n"
+ "1:\n\t"
+ "mov.b @%0+,%2\n\t"
+ "cmp/eq #0,%3\n\t"
+ "bt 2f\n\t"
+ "cmp/eq %2,%3\n\t"
+ "bt/s 1b\n\t"
+ " mov.b @%1+,%3\n\t"
+ "add #-2,%1\n\t"
+ "mov.b @%1,%3\n\t"
+ "sub %3,%2\n"
+ "2:"
+ : "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
+ : "0" (__cs), "1" (__ct));
+
+ return __res;
+}
+
+#define __HAVE_ARCH_STRNCMP
+extern __inline__ int strncmp(const char *__cs, const char *__ct, size_t __n)
+{
+ register int __res;
+ unsigned long __dummy;
+
+ __asm__ __volatile__(
+ "mov.b @%1+,%3\n"
+ "1:\n\t"
+ "mov.b @%0+,%2\n\t"
+ "cmp/eq %6,%0\n\t"
+ "bt/s 2f\n\t"
+ " cmp/eq #0,%3\n\t"
+ "bt/s 3f\n\t"
+ " cmp/eq %3,%2\n\t"
+ "bt/s 1b\n\t"
+ " mov.b @%1+,%3\n\t"
+ "add #-2,%1\n\t"
+ "mov.b @%1,%3\n"
+ "2:\n\t"
+ "sub %3,%2\n"
+ "3:"
+ :"=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
+ : "0" (__cs), "1" (__ct), "r" (__cs+__n));
+
+ return __res;
+}
+
+#define __HAVE_ARCH_MEMSET
+extern void *memset(void *__s, int __c, size_t __count);
+
+#define __HAVE_ARCH_MEMCPY
+extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
+
+#define __HAVE_ARCH_MEMMOVE
+extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
+
+/* Don't build bcopy at all ... */
+#define __HAVE_ARCH_BCOPY
+
+#define __HAVE_ARCH_MEMSCAN
+extern __inline__ void *memscan(void *__addr, int __c, size_t __size)
+{
+ register char *__end;
+ unsigned long __dummy;
+
+ __asm__("mov #0,%2\n"
+ "1:\n\t"
+ "cmp/eq %0,%1\n\t"
+ "bt 2f\n\t"
+ "cmp/eq %5,%2\n\t"
+ "bf/s 1b\n\t"
+ " mov.b @%0+,%2\n\t"
+ "add #-1,%0\n\t"
+ "2:"
+ : "=r" (__addr), "=r" (__end), "=&z" (__dummy)
+ : "0" (__addr), "1" ((char *)__addr + __size), "r" (__c));
+
+ return __addr;
+}
+
+#endif /* __ASM_SH_STRING_H */
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
new file mode 100644
index 000000000..f2e452ca2
--- /dev/null
+++ b/include/asm-sh/system.h
@@ -0,0 +1,185 @@
+#ifndef __ASM_SH_SYSTEM_H
+#define __ASM_SH_SYSTEM_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ */
+
+/*
+ * switch_to() should switch tasks to task nr n, first
+ */
+
+typedef struct {
+ unsigned long seg;
+} mm_segment_t;
+
+#ifdef __SMP__
+#error no SMP SuperH
+#else
+#define prepare_to_switch() do { } while(0)
+#define switch_to(prev,next,last) do { \
+ register struct task_struct *__last; \
+ register unsigned long *__ts1 __asm__ ("r1") = &prev->thread.sp; \
+ register unsigned long *__ts2 __asm__ ("r2") = &prev->thread.pc; \
+ register unsigned long *__ts4 __asm__ ("r4") = (unsigned long *)prev; \
+ register unsigned long *__ts5 __asm__ ("r5") = (unsigned long *)next; \
+ register unsigned long *__ts6 __asm__ ("r6") = &next->thread.sp; \
+ register unsigned long __ts7 __asm__ ("r7") = next->thread.pc; \
+ __asm__ __volatile__ (".balign 4\n\t" \
+ "sts.l pr,@-r15\n\t" \
+ "mov.l r8,@-r15\n\t" \
+ "mov.l r9,@-r15\n\t" \
+ "mov.l r10,@-r15\n\t" \
+ "mov.l r11,@-r15\n\t" \
+ "mov.l r12,@-r15\n\t" \
+ "mov.l r13,@-r15\n\t" \
+ "mov.l r14,@-r15\n\t" \
+ "mov.l r15,@r1 ! save SP\n\t" \
+ "mov.l @r6,r15 ! change to new stack\n\t" \
+ "mov.l %0,@-r15 ! push R0 onto new stack\n\t" \
+ "mova 1f,%0\n\t" \
+ "mov.l %0,@r2 ! save PC\n\t" \
+ "mov.l 2f,%0\n\t" \
+ "jmp @%0 ! call __switch_to\n\t" \
+ " lds r7,pr ! with return to new PC\n" \
+ "2:\n" \
+ ".long " "_" "__switch_to\n\t" \
+ ".balign 4\n" \
+ "1:\n" \
+ "mov.l @r15+,%0 ! pop R0 from new stack\n\t" \
+ "mov.l @r15+,r14\n\t" \
+ "mov.l @r15+,r13\n\t" \
+ "mov.l @r15+,r12\n\t" \
+ "mov.l @r15+,r11\n\t" \
+ "mov.l @r15+,r10\n\t" \
+ "mov.l @r15+,r9\n\t" \
+ "mov.l @r15+,r8\n\t" \
+ "lds.l @r15+,pr\n\t" \
+ :"=&z" (__last) \
+ :"0" (prev), \
+ "r" (__ts1), "r" (__ts2), \
+ "r" (__ts4), "r" (__ts5), "r" (__ts6), "r" (__ts7) \
+ :"r3"); \
+ last = __last; \
+} while (0)
+#endif
+
+#define nop() __asm__ __volatile__ ("nop")
+
+
+#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+
+static __inline__ unsigned long tas(volatile int *m)
+{ /* #define tas(ptr) (xchg((ptr),1)) */
+ unsigned long retval;
+
+ __asm__ __volatile__ ("tas.b @%1\n\t"
+ "movt %0"
+ : "=r" (retval): "r" (m): "t", "memory");
+ return retval;
+}
+
+extern void __xchg_called_with_bad_pointer(void);
+
+#define mb() __asm__ __volatile__ ("": : :"memory")
+#define rmb() mb()
+#define wmb() __asm__ __volatile__ ("": : :"memory")
+
+/* Interrupt Control */
+extern __inline__ void __sti(void)
+{
+ unsigned long __dummy;
+
+ __asm__ __volatile__("stc sr,%0\n\t"
+ "and %1,%0\n\t"
+ "ldc %0,sr"
+ : "=&z" (__dummy)
+ : "r" (0xefffffff)
+ : "memory");
+}
+
+extern __inline__ void __cli(void)
+{
+ unsigned long __dummy;
+ __asm__ __volatile__("stc sr,%0\n\t"
+ "or %1,%0\n\t"
+ "ldc %0,sr"
+ : "=&z" (__dummy)
+ : "r" (0x10000000)
+ : "memory");
+}
+
+#define __save_flags(x) \
+__asm__ __volatile__("stc sr,%0\n\tnop\n\tnop\n\tnop\n\tnop\n\tnop":"=r" (x): /* no inputs */ :"memory")
+
+#define __save_and_cli(x) \
+({ unsigned long __dummy; \
+__asm__ __volatile__( \
+ "stc sr,%0\n\t" \
+ "mov %0,%1\n\t" \
+ "or %2,%1\n\t" \
+ "ldc %1,sr" \
+ : "=&r" (x), "=&z" (__dummy) \
+ : "r" (0x10000000) \
+ : "memory"); })
+
+#define __restore_flags(x) \
+__asm__ __volatile__("ldc %0,sr": /* no output */: "r" (x):"memory")
+
+/* For spinlocks etc */
+#define local_irq_save(x) __save_and_cli(x)
+#define local_irq_restore(x) __restore_flags(x)
+#define local_irq_disable() __cli()
+#define local_irq_enable() __sti()
+
+#ifdef __SMP__
+
+extern void __global_cli(void);
+extern void __global_sti(void);
+extern unsigned long __global_save_flags(void);
+extern void __global_restore_flags(unsigned long);
+#define cli() __global_cli()
+#define sti() __global_sti()
+#define save_flags(x) ((x)=__global_save_flags())
+#define restore_flags(x) __global_restore_flags(x)
+
+#else
+
+#define cli() __cli()
+#define sti() __sti()
+#define save_flags(x) __save_flags(x)
+#define save_and_cli(x) __save_and_cli(x)
+#define restore_flags(x) __restore_flags(x)
+
+#endif
+
+extern __inline__ unsigned long xchg_u32(volatile int * m, unsigned long val)
+{
+ unsigned long flags, retval;
+
+ save_and_cli(flags);
+ retval = *m;
+ *m = val;
+ restore_flags(flags);
+ return retval;
+}
+
+static __inline__ unsigned long __xchg(unsigned long x, void * ptr, int size)
+{
+ switch (size) {
+ case 4:
+ return xchg_u32(ptr, x);
+ break;
+ }
+ __xchg_called_with_bad_pointer();
+ return x;
+}
+
+/* XXX
+ * disable hlt during certain critical i/o operations
+ */
+#define HAVE_DISABLE_HLT
+void disable_hlt(void);
+void enable_hlt(void);
+
+#endif
diff --git a/include/asm-sh/termbits.h b/include/asm-sh/termbits.h
new file mode 100644
index 000000000..da16fd45c
--- /dev/null
+++ b/include/asm-sh/termbits.h
@@ -0,0 +1,161 @@
+#ifndef __ASM_SH_TERMBITS_H
+#define __ASM_SH_TERMBITS_H
+
+#include <linux/posix_types.h>
+
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 19
+struct termios {
+ tcflag_t c_iflag; /* input mode flags */
+ tcflag_t c_oflag; /* output mode flags */
+ tcflag_t c_cflag; /* control mode flags */
+ tcflag_t c_lflag; /* local mode flags */
+ cc_t c_line; /* line discipline */
+ cc_t c_cc[NCCS]; /* control characters */
+};
+
+/* c_cc characters */
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOL2 16
+
+/* c_iflag bits */
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IUCLC 0001000
+#define IXON 0002000
+#define IXANY 0004000
+#define IXOFF 0010000
+#define IMAXBEL 0020000
+
+/* c_oflag bits */
+#define OPOST 0000001
+#define OLCUC 0000002
+#define ONLCR 0000004
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+#define OFILL 0000100
+#define OFDEL 0000200
+#define NLDLY 0000400
+#define NL0 0000000
+#define NL1 0000400
+#define CRDLY 0003000
+#define CR0 0000000
+#define CR1 0001000
+#define CR2 0002000
+#define CR3 0003000
+#define TABDLY 0014000
+#define TAB0 0000000
+#define TAB1 0004000
+#define TAB2 0010000
+#define TAB3 0014000
+#define XTABS 0014000
+#define BSDLY 0020000
+#define BS0 0000000
+#define BS1 0020000
+#define VTDLY 0040000
+#define VT0 0000000
+#define VT1 0040000
+#define FFDLY 0100000
+#define FF0 0000000
+#define FF1 0100000
+
+/* c_cflag bit meaning */
+#define CBAUD 0010017
+#define B0 0000000 /* hang up */
+#define B50 0000001
+#define B75 0000002
+#define B110 0000003
+#define B134 0000004
+#define B150 0000005
+#define B200 0000006
+#define B300 0000007
+#define B600 0000010
+#define B1200 0000011
+#define B1800 0000012
+#define B2400 0000013
+#define B4800 0000014
+#define B9600 0000015
+#define B19200 0000016
+#define B38400 0000017
+#define EXTA B19200
+#define EXTB B38400
+#define CSIZE 0000060
+#define CS5 0000000
+#define CS6 0000020
+#define CS7 0000040
+#define CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
+#define CBAUDEX 0010000
+#define B57600 0010001
+#define B115200 0010002
+#define B230400 0010003
+#define B460800 0010004
+#define CIBAUD 002003600000 /* input baud rate (not used) */
+#define CMSPAR 010000000000 /* mark or space (stick) parity */
+#define CRTSCTS 020000000000 /* flow control */
+
+/* c_lflag bits */
+#define ISIG 0000001
+#define ICANON 0000002
+#define XCASE 0000004
+#define ECHO 0000010
+#define ECHOE 0000020
+#define ECHOK 0000040
+#define ECHONL 0000100
+#define NOFLSH 0000200
+#define TOSTOP 0000400
+#define ECHOCTL 0001000
+#define ECHOPRT 0002000
+#define ECHOKE 0004000
+#define FLUSHO 0010000
+#define PENDIN 0040000
+#define IEXTEN 0100000
+
+/* tcflow() and TCXONC use these */
+#define TCOOFF 0
+#define TCOON 1
+#define TCIOFF 2
+#define TCION 3
+
+/* tcflush() and TCFLSH use these */
+#define TCIFLUSH 0
+#define TCOFLUSH 1
+#define TCIOFLUSH 2
+
+/* tcsetattr uses these */
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
+
+#endif /* __ASM_SH_TERMBITS_H */
diff --git a/include/asm-sh/termios.h b/include/asm-sh/termios.h
new file mode 100644
index 000000000..e3fada644
--- /dev/null
+++ b/include/asm-sh/termios.h
@@ -0,0 +1,98 @@
+#ifndef __ASM_SH_TERMIOS_H
+#define __ASM_SH_TERMIOS_H
+
+#include <asm/termbits.h>
+#include <asm/ioctls.h>
+
+struct winsize {
+ unsigned short ws_row;
+ unsigned short ws_col;
+ unsigned short ws_xpixel;
+ unsigned short ws_ypixel;
+};
+
+#define NCC 8
+struct termio {
+ unsigned short c_iflag; /* input mode flags */
+ unsigned short c_oflag; /* output mode flags */
+ unsigned short c_cflag; /* control mode flags */
+ unsigned short c_lflag; /* local mode flags */
+ unsigned char c_line; /* line discipline */
+ unsigned char c_cc[NCC]; /* control characters */
+};
+
+/* modem lines */
+#define TIOCM_LE 0x001
+#define TIOCM_DTR 0x002
+#define TIOCM_RTS 0x004
+#define TIOCM_ST 0x008
+#define TIOCM_SR 0x010
+#define TIOCM_CTS 0x020
+#define TIOCM_CAR 0x040
+#define TIOCM_RNG 0x080
+#define TIOCM_DSR 0x100
+#define TIOCM_CD TIOCM_CAR
+#define TIOCM_RI TIOCM_RNG
+#define TIOCM_OUT1 0x2000
+#define TIOCM_OUT2 0x4000
+
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+
+/* line disciplines */
+#define N_TTY 0
+#define N_SLIP 1
+#define N_MOUSE 2
+#define N_PPP 3
+#define N_STRIP 4
+#define N_AX25 5
+#define N_X25 6 /* X.25 async */
+#define N_6PACK 7
+#define N_MASC 8 /* Reserved fo Mobitex module <kaz@cafe.net> */
+
+#ifdef __KERNEL__
+
+/* intr=^C quit=^\ erase=del kill=^U
+ eof=^D vtime=\0 vmin=\1 sxtc=\0
+ start=^Q stop=^S susp=^Z eol=\0
+ reprint=^R discard=^U werase=^W lnext=^V
+ eol2=\0
+*/
+#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
+
+/*
+ * Translate a "termio" structure into a "termios". Ugh.
+ */
+#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
+ unsigned short __tmp; \
+ get_user(__tmp,&(termio)->x); \
+ *(unsigned short *) &(termios)->x = __tmp; \
+}
+
+#define user_termio_to_kernel_termios(termios, termio) \
+({ \
+ SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
+ SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
+ SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
+ SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
+ copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
+})
+
+/*
+ * Translate a "termios" structure into a "termio". Ugh.
+ */
+#define kernel_termios_to_user_termio(termio, termios) \
+({ \
+ put_user((termios)->c_iflag, &(termio)->c_iflag); \
+ put_user((termios)->c_oflag, &(termio)->c_oflag); \
+ put_user((termios)->c_cflag, &(termio)->c_cflag); \
+ put_user((termios)->c_lflag, &(termio)->c_lflag); \
+ put_user((termios)->c_line, &(termio)->c_line); \
+ copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
+})
+
+#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
+#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_SH_TERMIOS_H */
diff --git a/include/asm-sh/timex.h b/include/asm-sh/timex.h
new file mode 100644
index 000000000..c58ec44d5
--- /dev/null
+++ b/include/asm-sh/timex.h
@@ -0,0 +1,24 @@
+/*
+ * linux/include/asm-sh/timex.h
+ *
+ * sh architecture timex specifications
+ */
+#ifndef __ASM_SH_TIMEX_H
+#define __ASM_SH_TIMEX_H
+
+#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
+#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
+#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
+ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
+ << (SHIFT_SCALE-SHIFT_HZ)) / HZ)
+
+typedef unsigned long cycles_t;
+
+extern cycles_t cacheflush_time;
+
+static __inline__ cycles_t get_cycles (void)
+{
+ return 0;
+}
+
+#endif /* __ASM_SH_TIMEX_H */
diff --git a/include/asm-sh/types.h b/include/asm-sh/types.h
new file mode 100644
index 000000000..d23eeb74f
--- /dev/null
+++ b/include/asm-sh/types.h
@@ -0,0 +1,46 @@
+#ifndef __ASM_SH_TYPES_H
+#define __ASM_SH_TYPES_H
+
+typedef unsigned short umode_t;
+
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+typedef __signed__ long long __s64;
+typedef unsigned long long __u64;
+#endif
+
+/*
+ * These aren't exported outside the kernel to avoid name space clashes
+ */
+#ifdef __KERNEL__
+
+typedef signed char s8;
+typedef unsigned char u8;
+
+typedef signed short s16;
+typedef unsigned short u16;
+
+typedef signed int s32;
+typedef unsigned int u32;
+
+typedef signed long long s64;
+typedef unsigned long long u64;
+
+#define BITS_PER_LONG 32
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_SH_TYPES_H */
diff --git a/include/asm-sh/uaccess.h b/include/asm-sh/uaccess.h
new file mode 100644
index 000000000..37da01331
--- /dev/null
+++ b/include/asm-sh/uaccess.h
@@ -0,0 +1,439 @@
+/*
+ * User space memory access functions
+ *
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ * Based on:
+ * MIPS implementation version 1.15 by
+ * Copyright (C) 1996, 1997, 1998 by Ralf Baechle
+ * and i386 version.
+ */
+#ifndef __ASM_SH_UACCESS_H
+#define __ASM_SH_UACCESS_H
+
+#include <linux/errno.h>
+#include <linux/sched.h>
+
+#define VERIFY_READ 0
+#define VERIFY_WRITE 1
+
+/*
+ * The fs value determines whether argument validity checking should be
+ * performed or not. If get_fs() == USER_DS, checking is performed, with
+ * get_fs() == KERNEL_DS, checking is bypassed.
+ *
+ * For historical reasons (Data Segment Register?), these macros are misnamed.
+ */
+
+#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
+
+#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
+#define USER_DS MAKE_MM_SEG(0x80000000)
+
+#define get_ds() (KERNEL_DS)
+#define get_fs() (current->addr_limit)
+#define set_fs(x) (current->addr_limit=(x))
+
+#define segment_eq(a,b) ((a).seg == (b).seg)
+
+#define __addr_ok(addr) ((unsigned long)(addr) < (current->addr_limit.seg))
+
+/*
+ * Uhhuh, this needs 33-bit arithmetic. We have a carry..
+ *
+ * sum := addr + size; carry? --> flag = true;
+ * if (sum >= addr_limit) flag = true;
+ */
+#define __range_ok(addr,size) ({ \
+ unsigned long flag,sum; \
+ __asm__("clrt; addc %3,%1; movt %0; cmp/hi %4,%1; rotcl %0" \
+ :"=&r" (flag), "=r" (sum) \
+ :"1" (addr), "r" (size), "r" (current->addr_limit.seg)); \
+ flag; })
+
+#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
+#define __access_ok(addr,size) (__range_ok(addr,size) == 0)
+
+extern inline int verify_area(int type, const void * addr, unsigned long size)
+{
+ return access_ok(type,addr,size) ? 0 : -EFAULT;
+}
+
+/*
+ * Uh, these should become the main single-value transfer routines ...
+ * They automatically use the right size if we just have the right
+ * pointer type ...
+ *
+ * As MIPS uses the same address space for kernel and user data, we
+ * can just do these as direct assignments.
+ *
+ * Careful to not
+ * (a) re-use the arguments for side effects (sizeof is ok)
+ * (b) require any knowledge of processes at this stage
+ */
+#define put_user(x,ptr) __put_user_check((x),(ptr),sizeof(*(ptr)))
+#define get_user(x,ptr) __get_user_check((x),(ptr),sizeof(*(ptr)))
+
+/*
+ * The "__xxx" versions do not do address space checking, useful when
+ * doing multiple accesses to the same area (the user has to do the
+ * checks by hand with "access_ok()")
+ */
+#define __put_user(x,ptr) __put_user_nocheck((x),(ptr),sizeof(*(ptr)))
+#define __get_user(x,ptr) __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
+
+/*
+ * The "xxx_ret" versions return constant specified in third argument, if
+ * something bad happens. These macros can be optimized for the
+ * case of just returning from the function xxx_ret is used.
+ */
+
+#define put_user_ret(x,ptr,ret) ({ \
+if (put_user(x,ptr)) return ret; })
+
+#define get_user_ret(x,ptr,ret) ({ \
+if (get_user(x,ptr)) return ret; })
+
+#define __put_user_ret(x,ptr,ret) ({ \
+if (__put_user(x,ptr)) return ret; })
+
+#define __get_user_ret(x,ptr,ret) ({ \
+if (__get_user(x,ptr)) return ret; })
+
+struct __large_struct { unsigned long buf[100]; };
+#define __m(x) (*(struct __large_struct *)(x))
+
+#define __get_user_nocheck(x,ptr,size) ({ \
+long __gu_err; \
+__typeof(*(ptr)) __gu_val; \
+long __gu_addr; \
+__asm__("":"=r" (__gu_val)); \
+__gu_addr = (long) (ptr); \
+__asm__("":"=r" (__gu_err)); \
+switch (size) { \
+case 1: __get_user_asm("b"); break; \
+case 2: __get_user_asm("w"); break; \
+case 4: __get_user_asm("l"); break; \
+default: __get_user_unknown(); break; \
+} x = (__typeof__(*(ptr))) __gu_val; __gu_err; })
+
+#define __get_user_check(x,ptr,size) ({ \
+long __gu_err; \
+__typeof__(*(ptr)) __gu_val; \
+long __gu_addr; \
+__asm__("":"=r" (__gu_val)); \
+__gu_addr = (long) (ptr); \
+__asm__("":"=r" (__gu_err)); \
+if (__access_ok(__gu_addr,size)) { \
+switch (size) { \
+case 1: __get_user_asm("b"); break; \
+case 2: __get_user_asm("w"); break; \
+case 4: __get_user_asm("l"); break; \
+default: __get_user_unknown(); break; \
+} } x = (__typeof__(*(ptr))) __gu_val; __gu_err; })
+
+#define __get_user_asm(insn) \
+({ \
+__asm__ __volatile__( \
+ "1:\n\t" \
+ "mov." insn " %2,%1\n\t" \
+ "mov #0,%0\n" \
+ "2:\n\t" \
+ ".section .fixup,\"ax\"\n" \
+ "3:\n\t" \
+ "mov #0,%1\n\t" \
+ "mov.l 4f,%0\n\t" \
+ "jmp @%0\n\t" \
+ " mov %3,%0\n" \
+ "4: .long 2b\n\t" \
+ ".previous\n\t" \
+ ".section __ex_table,\"a\"\n\t" \
+ ".long 1b, 3b\n\t" \
+ ".previous" \
+ :"=&r" (__gu_err), "=&r" (__gu_val) \
+ :"m" (__m(__gu_addr)), "i" (-EFAULT)); })
+
+extern void __get_user_unknown(void);
+
+#define __put_user_nocheck(x,ptr,size) ({ \
+long __pu_err; \
+__typeof__(*(ptr)) __pu_val; \
+long __pu_addr; \
+__pu_val = (x); \
+__pu_addr = (long) (ptr); \
+__asm__("":"=r" (__pu_err)); \
+switch (size) { \
+case 1: __put_user_asm("b"); break; \
+case 2: __put_user_asm("w"); break; \
+case 4: __put_user_asm("l"); break; \
+default: __put_user_unknown(); break; \
+} __pu_err; })
+
+#define __put_user_check(x,ptr,size) ({ \
+long __pu_err; \
+__typeof__(*(ptr)) __pu_val; \
+long __pu_addr; \
+__pu_val = (x); \
+__pu_addr = (long) (ptr); \
+__asm__("":"=r" (__pu_err)); \
+if (__access_ok(__pu_addr,size)) { \
+switch (size) { \
+case 1: __put_user_asm("b"); break; \
+case 2: __put_user_asm("w"); break; \
+case 4: __put_user_asm("l"); break; \
+default: __put_user_unknown(); break; \
+} } __pu_err; })
+
+#define __put_user_asm(insn) \
+({ \
+__asm__ __volatile__( \
+ "1:\n\t" \
+ "mov." insn " %1,%2\n\t" \
+ "mov #0,%0\n" \
+ "2:\n\t" \
+ ".section .fixup,\"ax\"\n" \
+ "3:\n\t" \
+ "nop\n\t" \
+ "mov.l 4f,%0\n\t" \
+ "jmp @%0\n\t" \
+ "mov %3,%0\n" \
+ "4: .long 2b\n\t" \
+ ".previous\n\t" \
+ ".section __ex_table,\"a\"\n\t" \
+ ".long 1b, 3b\n\t" \
+ ".previous" \
+ :"=&r" (__pu_err) \
+ :"r" (__pu_val), "m" (__m(__pu_addr)), "i" (-EFAULT)); })
+
+extern void __put_user_unknown(void);
+
+/* Generic arbitrary sized copy. */
+/* XXX: should be such that: 4byte and the rest. */
+extern __inline__ __kernel_size_t
+__copy_user(void *__to, const void *__from, __kernel_size_t __n)
+{
+ unsigned long __dummy, _f, _t;
+ __kernel_size_t res;
+
+ __asm__ __volatile__(
+ "9:\n\t"
+ "mov.b @%2+,%1\n\t"
+ "dt %0\n"
+ "1:\n\t"
+ "mov.b %1,@%3\n\t"
+ "bf/s 9b\n\t"
+ " add #1,%3\n"
+ "2:"
+ ".section .fixup,\"ax\"\n"
+ "3:\n\t"
+ "mov.l 5f,%1\n\t"
+ "jmp @%1\n\t"
+ " mov %7,%0\n\t"
+ ".align 4\n"
+ "5: .long 2b\n"
+ ".previous\n"
+ ".section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 9b,3b\n"
+ " .long 1b,2b\n"
+ ".previous"
+ : "=&r" (res), "=&z" (__dummy), "=&r" (_f), "=&r" (_t)
+ : "2" (__from), "3" (__to), "0" (__n), "i" (-EFAULT)
+ : "memory");
+
+ return res;
+}
+
+#define copy_to_user(to,from,n) ({ \
+void *__copy_to = (void *) (to); \
+__kernel_size_t __copy_size = (__kernel_size_t) (n); \
+__kernel_size_t __copy_res; \
+if(__copy_size && __access_ok((unsigned long)__copy_to, __copy_size)) { \
+__copy_res = __copy_user(__copy_to, (void *) (from), __copy_size); \
+} else __copy_res = __copy_size; \
+__copy_res; })
+
+#define copy_to_user_ret(to,from,n,retval) ({ \
+if (copy_to_user(to,from,n)) \
+ return retval; \
+})
+
+#define __copy_to_user(to,from,n) \
+ __copy_user((void *)(to), \
+ (void *)(from), n)
+
+#define __copy_to_user_ret(to,from,n,retval) ({ \
+if (__copy_to_user(to,from,n)) \
+ return retval; \
+})
+
+#define copy_from_user(to,from,n) ({ \
+void *__copy_to = (void *) (to); \
+void *__copy_from = (void *) (from); \
+__kernel_size_t __copy_size = (__kernel_size_t) (n); \
+__kernel_size_t __copy_res; \
+if(__copy_size && __access_ok((unsigned long)__copy_from, __copy_size)) { \
+__copy_res = __copy_user(__copy_to, __copy_from, __copy_size); \
+} else __copy_res = __copy_size; \
+__copy_res; })
+
+#define copy_from_user_ret(to,from,n,retval) ({ \
+if (copy_from_user(to,from,n)) \
+ return retval; \
+})
+
+#define __copy_from_user(to,from,n) \
+ __copy_user((void *)(to), \
+ (void *)(from), n)
+
+#define __copy_from_user_ret(to,from,n,retval) ({ \
+if (__copy_from_user(to,from,n)) \
+ return retval; \
+})
+
+/* XXX: Not sure it works well..
+ should be such that: 4byte clear and the rest. */
+extern __inline__ __kernel_size_t
+__clear_user(void *addr, __kernel_size_t size)
+{
+ __kernel_size_t res;
+ unsigned long __a, __s;
+
+ __asm__ __volatile__(
+ "9:\n\t"
+ "dt %2\n"
+ "1:\n\t"
+ "mov.b %5,@%1\n\t"
+ "bf/s 9b\n\t"
+ " add #1,%1\n\t"
+ "sub %2,%0\n"
+ "2:\n"
+ ".section .fixup,\"ax\"\n"
+ "3:\n\t"
+ "mov.l 4f,%0\n\t"
+ "jmp @%0\n\t"
+ " mov %7,%0\n"
+ ".align 4\n"
+ "4: .long 2b\n"
+ ".previous\n"
+ ".section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 1b,3b\n"
+ ".previous"
+ : "=&r" (res), "=&r" (__a), "=&r" (__s)
+ : "1" (addr), "2" (size), "r" (0), "0" (size), "i" (-EFAULT));
+
+ return res;
+}
+
+#define clear_user(addr,n) ({ \
+void * __cl_addr = (addr); \
+unsigned long __cl_size = (n); \
+if (__cl_size && __access_ok(((unsigned long)(__cl_addr)), __cl_size)) \
+__cl_size = __clear_user(__cl_addr, __cl_size); \
+__cl_size; })
+
+extern __inline__ int
+__strncpy_from_user(unsigned long __dest, unsigned long __src, int __count)
+{
+ __kernel_size_t res;
+ unsigned long __dummy, _d, _s;
+
+ __asm__ __volatile__(
+ "9:\n"
+ "mov.b @%2+,%1\n\t"
+ "cmp/eq #0,%1\n\t"
+ "bt/s 2f\n"
+ "1:\n"
+ "mov.b %1,@%3\n\t"
+ "dt %0\n\t"
+ "bf/s 9b\n\t"
+ " add #1,%3\n\t"
+ "sub %6,%0\n"
+ "2:\n"
+ ".section .fixup,\"ax\"\n"
+ "3:\n\t"
+ "mov.l 4f,%1\n\t"
+ "jmp @%1\n\t"
+ " mov %8,%0\n\t"
+ ".align 4\n"
+ "4: .long 2b\n"
+ ".previous\n"
+ ".section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 9b,3b\n"
+ " .long 1b,2b\n"
+ ".previous"
+ : "=&r" (res), "=&z" (__dummy), "=&r" (_s), "=&r" (_d)
+ : "2" (__src), "3" (__dest), "r" (__count), "0" (__count),
+ "i" (-EFAULT)
+ : "memory");
+
+ return res;
+}
+
+#define strncpy_from_user(dest,src,count) ({ \
+unsigned long __sfu_src = (unsigned long) (src); \
+int __sfu_count = (int) (count); \
+long __sfu_res = -EFAULT; \
+if(__access_ok(__sfu_src, __sfu_count)) { \
+__sfu_res = __strncpy_from_user((unsigned long) (dest), __sfu_src, __sfu_count); \
+} __sfu_res; })
+
+/*
+ * Return the size of a string (including the ending 0!)
+ */
+extern __inline__ long __strlen_user(const char *__s)
+{
+ unsigned long res;
+ unsigned long __dummy;
+
+ __asm__ __volatile__(
+ "mov #-1,%1\n"
+ "9:\n"
+ "cmp/eq #0,%1\n\t"
+ "bf/s 9b\n\t"
+ "1:\t"
+ " mov.b @%0+,%1\n\t"
+ "sub %3,%0\n"
+ "2:\n"
+ ".section .fixup,\"ax\"\n"
+ "3:\n\t"
+ "mov.l 4f,%1\n\t"
+ "jmp @%1\n\t"
+ " mov %4,%0\n"
+ ".align 4\n"
+ "4: .long 2b\n"
+ ".previous\n"
+ ".section __ex_table,\"a\"\n"
+ " .align 4\n"
+ " .long 1b,3b\n"
+ ".previous"
+ : "=&r" (res), "=&z" (__dummy)
+ : "0" (__s), "r" (__s), "i" (-EFAULT));
+ return res;
+}
+
+extern __inline__ long strlen_user(const char *s)
+{
+ if(!access_ok(VERIFY_READ, s, 0))
+ return 0;
+ else
+ return __strlen_user(s);
+}
+
+struct exception_table_entry
+{
+ unsigned long insn, fixup;
+};
+
+/* Returns 0 if exception not found and fixup.unit otherwise. */
+extern unsigned long search_exception_table(unsigned long addr);
+
+/* Returns the new pc */
+#define fixup_exception(map_reg, fixup_unit, pc) \
+({ \
+ fixup_unit; \
+})
+
+#endif /* __ASM_SH_UACCESS_H */
diff --git a/include/asm-sh/ucontext.h b/include/asm-sh/ucontext.h
new file mode 100644
index 000000000..202ef1d5a
--- /dev/null
+++ b/include/asm-sh/ucontext.h
@@ -0,0 +1,12 @@
+#ifndef __ASM_SH_UCONTEXT_H
+#define __ASM_SH_UCONTEXT_H
+
+struct ucontext {
+ unsigned long uc_flags;
+ struct ucontext *uc_link;
+ stack_t uc_stack;
+ struct sigcontext uc_mcontext;
+ sigset_t uc_sigmask; /* mask last for extensibility */
+};
+
+#endif /* __ASM_SH_UCONTEXT_H */
diff --git a/include/asm-sh/unaligned.h b/include/asm-sh/unaligned.h
new file mode 100644
index 000000000..70f94b939
--- /dev/null
+++ b/include/asm-sh/unaligned.h
@@ -0,0 +1,19 @@
+#ifndef __ASM_SH_UNALIGNED_H
+#define __ASM_SH_UNALIGNED_H
+
+/* SH can't handle unaligned accesses. */
+
+#include <linux/string.h>
+
+
+/* Use memmove here, so gcc does not insert a __builtin_memcpy. */
+
+#define get_unaligned(ptr) \
+ ({ __typeof__(*(ptr)) __tmp; memmove(&__tmp, (ptr), sizeof(*(ptr))); __tmp; })
+
+#define put_unaligned(val, ptr) \
+ ({ __typeof__(*(ptr)) __tmp = (val); \
+ memmove((ptr), &__tmp, sizeof(*(ptr))); \
+ (void)0; })
+
+#endif /* __ASM_SH_UNALIGNED_H */
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h
new file mode 100644
index 000000000..aeb6d8715
--- /dev/null
+++ b/include/asm-sh/unistd.h
@@ -0,0 +1,316 @@
+#ifndef __ASM_SH_UNISTD_H
+#define __ASM_SH_UNISTD_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ */
+
+/*
+ * This file contains the system call numbers.
+ */
+
+#define __NR_setup 0 /* used only by init, to get system going */
+#define __NR_exit 1
+#define __NR_fork 2
+#define __NR_read 3
+#define __NR_write 4
+#define __NR_open 5
+#define __NR_close 6
+#define __NR_waitpid 7
+#define __NR_creat 8
+#define __NR_link 9
+#define __NR_unlink 10
+#define __NR_execve 11
+#define __NR_chdir 12
+#define __NR_time 13
+#define __NR_mknod 14
+#define __NR_chmod 15
+#define __NR_lchown 16
+#define __NR_break 17
+#define __NR_oldstat 18
+#define __NR_lseek 19
+#define __NR_getpid 20
+#define __NR_mount 21
+#define __NR_oldumount 22
+#define __NR_setuid 23
+#define __NR_getuid 24
+#define __NR_stime 25
+#define __NR_ptrace 26
+#define __NR_alarm 27
+#define __NR_oldfstat 28
+#define __NR_pause 29
+#define __NR_utime 30
+#define __NR_stty 31
+#define __NR_gtty 32
+#define __NR_access 33
+#define __NR_nice 34
+#define __NR_ftime 35
+#define __NR_sync 36
+#define __NR_kill 37
+#define __NR_rename 38
+#define __NR_mkdir 39
+#define __NR_rmdir 40
+#define __NR_dup 41
+#define __NR_pipe 42
+#define __NR_times 43
+#define __NR_prof 44
+#define __NR_brk 45
+#define __NR_setgid 46
+#define __NR_getgid 47
+#define __NR_signal 48
+#define __NR_geteuid 49
+#define __NR_getegid 50
+#define __NR_acct 51
+#define __NR_umount 52
+#define __NR_lock 53
+#define __NR_ioctl 54
+#define __NR_fcntl 55
+#define __NR_mpx 56
+#define __NR_setpgid 57
+#define __NR_ulimit 58
+#define __NR_oldolduname 59
+#define __NR_umask 60
+#define __NR_chroot 61
+#define __NR_ustat 62
+#define __NR_dup2 63
+#define __NR_getppid 64
+#define __NR_getpgrp 65
+#define __NR_setsid 66
+#define __NR_sigaction 67
+#define __NR_sgetmask 68
+#define __NR_ssetmask 69
+#define __NR_setreuid 70
+#define __NR_setregid 71
+#define __NR_sigsuspend 72
+#define __NR_sigpending 73
+#define __NR_sethostname 74
+#define __NR_setrlimit 75
+#define __NR_getrlimit 76
+#define __NR_getrusage 77
+#define __NR_gettimeofday 78
+#define __NR_settimeofday 79
+#define __NR_getgroups 80
+#define __NR_setgroups 81
+#define __NR_select 82
+#define __NR_symlink 83
+#define __NR_oldlstat 84
+#define __NR_readlink 85
+#define __NR_uselib 86
+#define __NR_swapon 87
+#define __NR_reboot 88
+#define __NR_readdir 89
+#define __NR_mmap 90
+#define __NR_munmap 91
+#define __NR_truncate 92
+#define __NR_ftruncate 93
+#define __NR_fchmod 94
+#define __NR_fchown 95
+#define __NR_getpriority 96
+#define __NR_setpriority 97
+#define __NR_profil 98
+#define __NR_statfs 99
+#define __NR_fstatfs 100
+#define __NR_ioperm 101
+#define __NR_socketcall 102
+#define __NR_syslog 103
+#define __NR_setitimer 104
+#define __NR_getitimer 105
+#define __NR_stat 106
+#define __NR_lstat 107
+#define __NR_fstat 108
+#define __NR_olduname 109
+#define __NR_iopl 110
+#define __NR_vhangup 111
+#define __NR_idle 112
+#define __NR_vm86old 113
+#define __NR_wait4 114
+#define __NR_swapoff 115
+#define __NR_sysinfo 116
+#define __NR_ipc 117
+#define __NR_fsync 118
+#define __NR_sigreturn 119
+#define __NR_clone 120
+#define __NR_setdomainname 121
+#define __NR_uname 122
+#define __NR_modify_ldt 123
+#define __NR_adjtimex 124
+#define __NR_mprotect 125
+#define __NR_sigprocmask 126
+#define __NR_create_module 127
+#define __NR_init_module 128
+#define __NR_delete_module 129
+#define __NR_get_kernel_syms 130
+#define __NR_quotactl 131
+#define __NR_getpgid 132
+#define __NR_fchdir 133
+#define __NR_bdflush 134
+#define __NR_sysfs 135
+#define __NR_personality 136
+#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
+#define __NR_setfsuid 138
+#define __NR_setfsgid 139
+#define __NR__llseek 140
+#define __NR_getdents 141
+#define __NR__newselect 142
+#define __NR_flock 143
+#define __NR_msync 144
+#define __NR_readv 145
+#define __NR_writev 146
+#define __NR_getsid 147
+#define __NR_fdatasync 148
+#define __NR__sysctl 149
+#define __NR_mlock 150
+#define __NR_munlock 151
+#define __NR_mlockall 152
+#define __NR_munlockall 153
+#define __NR_sched_setparam 154
+#define __NR_sched_getparam 155
+#define __NR_sched_setscheduler 156
+#define __NR_sched_getscheduler 157
+#define __NR_sched_yield 158
+#define __NR_sched_get_priority_max 159
+#define __NR_sched_get_priority_min 160
+#define __NR_sched_rr_get_interval 161
+#define __NR_nanosleep 162
+#define __NR_mremap 163
+#define __NR_setresuid 164
+#define __NR_getresuid 165
+#define __NR_vm86 166
+#define __NR_query_module 167
+#define __NR_poll 168
+#define __NR_nfsservctl 169
+#define __NR_setresgid 170
+#define __NR_getresgid 171
+#define __NR_prctl 172
+#define __NR_rt_sigreturn 173
+#define __NR_rt_sigaction 174
+#define __NR_rt_sigprocmask 175
+#define __NR_rt_sigpending 176
+#define __NR_rt_sigtimedwait 177
+#define __NR_rt_sigqueueinfo 178
+#define __NR_rt_sigsuspend 179
+#define __NR_pread 180
+#define __NR_pwrite 181
+#define __NR_chown 182
+#define __NR_getcwd 183
+#define __NR_capget 184
+#define __NR_capset 185
+#define __NR_sigaltstack 186
+#define __NR_sendfile 187
+#define __NR_streams1 188 /* some people actually want it */
+#define __NR_streams2 189 /* some people actually want it */
+#define __NR_vfork 190
+
+/* user-visible error numbers are in the range -1 - -125: see <asm-sh/errno.h> */
+
+#define __syscall_return(type, res) \
+do { \
+ if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+ /* Avoid using "res" which is declared to be in register r0; \
+ errno might expand to a function call and clobber it. */ \
+ int __err = -(res); \
+ errno = __err; \
+ res = -1; \
+ } \
+ return (type) (res); \
+} while (0)
+
+/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
+#define _syscall0(type,name) \
+type name(void) \
+{ \
+register long __sc0 __asm__ ("r0") = __NR_##name; \
+__asm__ __volatile__ ("trapa #0" \
+ : "=z" (__sc0) \
+ : "0" (__sc0)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall1(type,name,type1,arg1) \
+type name(type1 arg1) \
+{ \
+register long __sc0 __asm__ ("r0") = __NR_##name; \
+register long __sc4 __asm__ ("r4") = (long) arg1; \
+__asm__ __volatile__ ("trapa #0" \
+ : "=z" (__sc0) \
+ : "0" (__sc0), "r" (__sc4)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall2(type,name,type1,arg1,type2,arg2) \
+type name(type1 arg1,type2 arg2) \
+{ \
+register long __sc0 __asm__ ("r0") = __NR_##name; \
+register long __sc4 __asm__ ("r4") = (long) arg1; \
+register long __sc5 __asm__ ("r5") = (long) arg2; \
+__asm__ __volatile__ ("trapa #0" \
+ : "=z" (__sc0) \
+ : "0" (__sc0), "r" (__sc4), "r" (__sc5)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
+type name(type1 arg1,type2 arg2,type3 arg3) \
+{ \
+register long __sc0 __asm__ ("r0") = __NR_##name; \
+register long __sc4 __asm__ ("r4") = (long) arg1; \
+register long __sc5 __asm__ ("r5") = (long) arg2; \
+register long __sc6 __asm__ ("r6") = (long) arg3; \
+__asm__ __volatile__ ("trapa #0" \
+ : "=z" (__sc0) \
+ : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
+type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
+{ \
+register long __sc0 __asm__ ("r0") = __NR_##name; \
+register long __sc4 __asm__ ("r4") = (long) arg1; \
+register long __sc5 __asm__ ("r5") = (long) arg2; \
+register long __sc6 __asm__ ("r6") = (long) arg3; \
+register long __sc6 __asm__ ("r7") = (long) arg4; \
+__asm__ __volatile__ ("trapa #0" \
+ : "=z" (__sc0) \
+ : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \
+ "r" (__sc7)); \
+__syscall_return(type,__sc0); \
+}
+
+#ifdef __KERNEL_SYSCALLS__
+
+/*
+ * we need this inline - forking from kernel space will result
+ * in NO COPY ON WRITE (!!!), until an execve is executed. This
+ * is no problem, but for the stack. This is handled by not letting
+ * main() use the stack at all after fork(). Thus, no function
+ * calls - which means inline code for fork too, as otherwise we
+ * would use the stack upon exit from 'fork()'.
+ *
+ * Actually only pause and fork are needed inline, so that there
+ * won't be any messing with the stack from main(), but we define
+ * some others too.
+ */
+#define __NR__exit __NR_exit
+static __inline__ _syscall0(int,pause)
+static __inline__ _syscall1(int,setup,int,magic)
+static __inline__ _syscall0(int,sync)
+static __inline__ _syscall0(pid_t,setsid)
+static __inline__ _syscall3(int,write,int,fd,const char *,buf,off_t,count)
+static __inline__ _syscall3(int,read,int,fd,char *,buf,off_t,count)
+static __inline__ _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
+static __inline__ _syscall1(int,dup,int,fd)
+static __inline__ _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
+static __inline__ _syscall3(int,open,const char *,file,int,flag,int,mode)
+static __inline__ _syscall1(int,close,int,fd)
+static __inline__ _syscall1(int,_exit,int,exitcode)
+static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
+static __inline__ _syscall1(int,delete_module,const char *,name)
+
+static __inline__ pid_t wait(int * wait_stat)
+{
+ return waitpid(-1,wait_stat,0);
+}
+#endif
+
+#endif /* __ASM_SH_UNISTD_H */
diff --git a/include/asm-sh/user.h b/include/asm-sh/user.h
new file mode 100644
index 000000000..793c9691e
--- /dev/null
+++ b/include/asm-sh/user.h
@@ -0,0 +1,50 @@
+#ifndef __ASM_SH_USER_H
+#define __ASM_SH_USER_H
+
+#include <linux/types.h>
+#include <asm/ptrace.h>
+#include <asm/page.h>
+
+/*
+ * Core file format: The core file is written in such a way that gdb
+ * can understand it and provide useful information to the user (under
+ * linux we use the `trad-core' bfd). The file contents are as follows:
+ *
+ * upage: 1 page consisting of a user struct that tells gdb
+ * what is present in the file. Directly after this is a
+ * copy of the task_struct, which is currently not used by gdb,
+ * but it may come in handy at some point. All of the registers
+ * are stored as part of the upage. The upage should always be
+ * only one page long.
+ * data: The data segment follows next. We use current->end_text to
+ * current->brk to pick up all of the user variables, plus any memory
+ * that may have been sbrk'ed. No attempt is made to determine if a
+ * page is demand-zero or if a page is totally unused, we just cover
+ * the entire range. All of the addresses are rounded in such a way
+ * that an integral number of pages is written.
+ * stack: We need the stack information in order to get a meaningful
+ * backtrace. We need to write the data from usp to
+ * current->start_stack, so we round each of these in order to be able
+ * to write an integer number of pages.
+ */
+struct user {
+ struct pt_regs regs; /* entire machine state */
+ size_t u_tsize; /* text size (pages) */
+ size_t u_dsize; /* data size (pages) */
+ size_t u_ssize; /* stack size (pages) */
+ unsigned long start_code; /* text starting address */
+ unsigned long start_data; /* data starting address */
+ unsigned long start_stack; /* stack starting address */
+ long int signal; /* signal causing core dump */
+ struct regs * u_ar0; /* help gdb find registers */
+ unsigned long magic; /* identifies a core file */
+ char u_comm[32]; /* user command name */
+};
+
+#define NBPG PAGE_SIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_DATA_START_ADDR (u.start_data)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+
+#endif /* __ASM_SH_USER_H */
diff --git a/include/asm-sparc/ap1000/apreg.h b/include/asm-sparc/ap1000/apreg.h
index 11a7a8666..bf1ea66d3 100644
--- a/include/asm-sparc/ap1000/apreg.h
+++ b/include/asm-sparc/ap1000/apreg.h
@@ -12,7 +12,7 @@
#include <asm/page.h>
#include <asm/ap1000/apservice.h>
#include <asm/ap1000/apbif.h>
-#include <linux/tasks.h>
+#include <linux/threads.h>
/*
* Macros for accessing I/O registers.
diff --git a/include/asm-sparc/asm_offsets.h b/include/asm-sparc/asm_offsets.h
index dc35d5481..306e89d06 100644
--- a/include/asm-sparc/asm_offsets.h
+++ b/include/asm-sparc/asm_offsets.h
@@ -36,10 +36,8 @@
#define ASIZ_task_next_task 0x00000004
#define AOFF_task_prev_task 0x00000038
#define ASIZ_task_prev_task 0x00000004
-#define AOFF_task_next_run 0x0000003c
-#define ASIZ_task_next_run 0x00000004
-#define AOFF_task_prev_run 0x00000040
-#define ASIZ_task_prev_run 0x00000004
+#define AOFF_task_run_list 0x0000003c
+#define ASIZ_task_run_list 0x00000008
#define AOFF_task_binfmt 0x00000044
#define ASIZ_task_binfmt 0x00000004
#define AOFF_task_exit_code 0x00000048
@@ -74,113 +72,113 @@
#define ASIZ_task_pidhash_next 0x00000004
#define AOFF_task_pidhash_pprev 0x00000088
#define ASIZ_task_pidhash_pprev 0x00000004
-#define AOFF_task_tarray_ptr 0x0000008c
-#define ASIZ_task_tarray_ptr 0x00000004
-#define AOFF_task_wait_chldexit 0x00000090
+#define AOFF_task_wait_chldexit 0x0000008c
#define ASIZ_task_wait_chldexit 0x00000014
-#define AOFF_task_vfork_sem 0x000000a4
+#define AOFF_task_vfork_sem 0x000000a0
#define ASIZ_task_vfork_sem 0x00000004
-#define AOFF_task_policy 0x000000a8
+#define AOFF_task_policy 0x000000a4
#define ASIZ_task_policy 0x00000004
-#define AOFF_task_rt_priority 0x000000ac
+#define AOFF_task_rt_priority 0x000000a8
#define ASIZ_task_rt_priority 0x00000004
-#define AOFF_task_it_real_value 0x000000b0
+#define AOFF_task_it_real_value 0x000000ac
#define ASIZ_task_it_real_value 0x00000004
-#define AOFF_task_it_prof_value 0x000000b4
+#define AOFF_task_it_prof_value 0x000000b0
#define ASIZ_task_it_prof_value 0x00000004
-#define AOFF_task_it_virt_value 0x000000b8
+#define AOFF_task_it_virt_value 0x000000b4
#define ASIZ_task_it_virt_value 0x00000004
-#define AOFF_task_it_real_incr 0x000000bc
+#define AOFF_task_it_real_incr 0x000000b8
#define ASIZ_task_it_real_incr 0x00000004
-#define AOFF_task_it_prof_incr 0x000000c0
+#define AOFF_task_it_prof_incr 0x000000bc
#define ASIZ_task_it_prof_incr 0x00000004
-#define AOFF_task_it_virt_incr 0x000000c4
+#define AOFF_task_it_virt_incr 0x000000c0
#define ASIZ_task_it_virt_incr 0x00000004
-#define AOFF_task_real_timer 0x000000c8
+#define AOFF_task_real_timer 0x000000c4
#define ASIZ_task_real_timer 0x00000014
-#define AOFF_task_times 0x000000dc
+#define AOFF_task_times 0x000000d8
#define ASIZ_task_times 0x00000010
-#define AOFF_task_start_time 0x000000ec
+#define AOFF_task_start_time 0x000000e8
#define ASIZ_task_start_time 0x00000004
-#define AOFF_task_per_cpu_utime 0x000000f0
+#define AOFF_task_per_cpu_utime 0x000000ec
#define ASIZ_task_per_cpu_utime 0x00000004
-#define AOFF_task_min_flt 0x000000f8
+#define AOFF_task_min_flt 0x000000f4
#define ASIZ_task_min_flt 0x00000004
-#define AOFF_task_maj_flt 0x000000fc
+#define AOFF_task_maj_flt 0x000000f8
#define ASIZ_task_maj_flt 0x00000004
-#define AOFF_task_nswap 0x00000100
+#define AOFF_task_nswap 0x000000fc
#define ASIZ_task_nswap 0x00000004
-#define AOFF_task_cmin_flt 0x00000104
+#define AOFF_task_cmin_flt 0x00000100
#define ASIZ_task_cmin_flt 0x00000004
-#define AOFF_task_cmaj_flt 0x00000108
+#define AOFF_task_cmaj_flt 0x00000104
#define ASIZ_task_cmaj_flt 0x00000004
-#define AOFF_task_cnswap 0x0000010c
+#define AOFF_task_cnswap 0x00000108
#define ASIZ_task_cnswap 0x00000004
-#define AOFF_task_uid 0x00000112
+#define AOFF_task_uid 0x0000010e
#define ASIZ_task_uid 0x00000002
-#define AOFF_task_euid 0x00000114
+#define AOFF_task_euid 0x00000110
#define ASIZ_task_euid 0x00000002
-#define AOFF_task_suid 0x00000116
+#define AOFF_task_suid 0x00000112
#define ASIZ_task_suid 0x00000002
-#define AOFF_task_fsuid 0x00000118
+#define AOFF_task_fsuid 0x00000114
#define ASIZ_task_fsuid 0x00000002
-#define AOFF_task_gid 0x0000011a
+#define AOFF_task_gid 0x00000116
#define ASIZ_task_gid 0x00000002
-#define AOFF_task_egid 0x0000011c
+#define AOFF_task_egid 0x00000118
#define ASIZ_task_egid 0x00000002
-#define AOFF_task_sgid 0x0000011e
+#define AOFF_task_sgid 0x0000011a
#define ASIZ_task_sgid 0x00000002
-#define AOFF_task_fsgid 0x00000120
+#define AOFF_task_fsgid 0x0000011c
#define ASIZ_task_fsgid 0x00000002
-#define AOFF_task_ngroups 0x00000124
+#define AOFF_task_ngroups 0x00000120
#define ASIZ_task_ngroups 0x00000004
-#define AOFF_task_groups 0x00000128
+#define AOFF_task_groups 0x00000124
#define ASIZ_task_groups 0x00000040
-#define AOFF_task_cap_effective 0x00000168
+#define AOFF_task_cap_effective 0x00000164
#define ASIZ_task_cap_effective 0x00000004
-#define AOFF_task_cap_inheritable 0x0000016c
+#define AOFF_task_cap_inheritable 0x00000168
#define ASIZ_task_cap_inheritable 0x00000004
-#define AOFF_task_cap_permitted 0x00000170
+#define AOFF_task_cap_permitted 0x0000016c
#define ASIZ_task_cap_permitted 0x00000004
-#define AOFF_task_user 0x00000174
+#define AOFF_task_user 0x00000170
#define ASIZ_task_user 0x00000004
-#define AOFF_task_rlim 0x00000178
+#define AOFF_task_rlim 0x00000174
#define ASIZ_task_rlim 0x00000050
-#define AOFF_task_used_math 0x000001c8
+#define AOFF_task_used_math 0x000001c4
#define ASIZ_task_used_math 0x00000002
-#define AOFF_task_comm 0x000001ca
+#define AOFF_task_comm 0x000001c6
#define ASIZ_task_comm 0x00000010
-#define AOFF_task_link_count 0x000001dc
+#define AOFF_task_link_count 0x000001d8
#define ASIZ_task_link_count 0x00000004
-#define AOFF_task_tty 0x000001e0
+#define AOFF_task_tty 0x000001dc
#define ASIZ_task_tty 0x00000004
-#define AOFF_task_semundo 0x000001e4
+#define AOFF_task_semundo 0x000001e0
#define ASIZ_task_semundo 0x00000004
-#define AOFF_task_semsleeping 0x000001e8
+#define AOFF_task_semsleeping 0x000001e4
#define ASIZ_task_semsleeping 0x00000004
-#define AOFF_task_tss 0x000001f0
-#define ASIZ_task_tss 0x00000388
-#define AOFF_task_fs 0x00000578
+#define AOFF_task_thread 0x000001e8
+#define ASIZ_task_thread 0x00000388
+#define AOFF_task_fs 0x00000570
#define ASIZ_task_fs 0x00000004
-#define AOFF_task_files 0x0000057c
+#define AOFF_task_files 0x00000574
#define ASIZ_task_files 0x00000004
-#define AOFF_task_mm 0x00000580
+#define AOFF_task_mm 0x00000578
#define ASIZ_task_mm 0x00000004
-#define AOFF_task_sigmask_lock 0x00000584
+#define AOFF_task_active_mm 0x0000057c
+#define ASIZ_task_active_mm 0x00000004
+#define AOFF_task_sigmask_lock 0x00000580
#define ASIZ_task_sigmask_lock 0x00000001
-#define AOFF_task_sig 0x00000588
+#define AOFF_task_sig 0x00000584
#define ASIZ_task_sig 0x00000004
-#define AOFF_task_signal 0x0000058c
+#define AOFF_task_signal 0x00000588
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x00000594
+#define AOFF_task_blocked 0x00000590
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x0000059c
+#define AOFF_task_sigqueue 0x00000598
#define ASIZ_task_sigqueue 0x00000004
-#define AOFF_task_sigqueue_tail 0x000005a0
+#define AOFF_task_sigqueue_tail 0x0000059c
#define ASIZ_task_sigqueue_tail 0x00000004
-#define AOFF_task_sas_ss_sp 0x000005a4
+#define AOFF_task_sas_ss_sp 0x000005a0
#define ASIZ_task_sas_ss_sp 0x00000004
-#define AOFF_task_sas_ss_size 0x000005a8
+#define AOFF_task_sas_ss_size 0x000005a4
#define ASIZ_task_sas_ss_size 0x00000004
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000004
@@ -190,53 +188,55 @@
#define ASIZ_mm_mmap_cache 0x00000004
#define AOFF_mm_pgd 0x0000000c
#define ASIZ_mm_pgd 0x00000004
-#define AOFF_mm_count 0x00000010
-#define ASIZ_mm_count 0x00000004
-#define AOFF_mm_map_count 0x00000014
+#define AOFF_mm_mm_users 0x00000010
+#define ASIZ_mm_mm_users 0x00000004
+#define AOFF_mm_mm_count 0x00000014
+#define ASIZ_mm_mm_count 0x00000004
+#define AOFF_mm_map_count 0x00000018
#define ASIZ_mm_map_count 0x00000004
-#define AOFF_mm_mmap_sem 0x00000018
+#define AOFF_mm_mmap_sem 0x0000001c
#define ASIZ_mm_mmap_sem 0x00000020
-#define AOFF_mm_page_table_lock 0x00000038
+#define AOFF_mm_page_table_lock 0x0000003c
#define ASIZ_mm_page_table_lock 0x00000001
-#define AOFF_mm_context 0x0000003c
+#define AOFF_mm_context 0x00000040
#define ASIZ_mm_context 0x00000004
-#define AOFF_mm_start_code 0x00000040
+#define AOFF_mm_start_code 0x00000044
#define ASIZ_mm_start_code 0x00000004
-#define AOFF_mm_end_code 0x00000044
+#define AOFF_mm_end_code 0x00000048
#define ASIZ_mm_end_code 0x00000004
-#define AOFF_mm_start_data 0x00000048
+#define AOFF_mm_start_data 0x0000004c
#define ASIZ_mm_start_data 0x00000004
-#define AOFF_mm_end_data 0x0000004c
+#define AOFF_mm_end_data 0x00000050
#define ASIZ_mm_end_data 0x00000004
-#define AOFF_mm_start_brk 0x00000050
+#define AOFF_mm_start_brk 0x00000054
#define ASIZ_mm_start_brk 0x00000004
-#define AOFF_mm_brk 0x00000054
+#define AOFF_mm_brk 0x00000058
#define ASIZ_mm_brk 0x00000004
-#define AOFF_mm_start_stack 0x00000058
+#define AOFF_mm_start_stack 0x0000005c
#define ASIZ_mm_start_stack 0x00000004
-#define AOFF_mm_arg_start 0x0000005c
+#define AOFF_mm_arg_start 0x00000060
#define ASIZ_mm_arg_start 0x00000004
-#define AOFF_mm_arg_end 0x00000060
+#define AOFF_mm_arg_end 0x00000064
#define ASIZ_mm_arg_end 0x00000004
-#define AOFF_mm_env_start 0x00000064
+#define AOFF_mm_env_start 0x00000068
#define ASIZ_mm_env_start 0x00000004
-#define AOFF_mm_env_end 0x00000068
+#define AOFF_mm_env_end 0x0000006c
#define ASIZ_mm_env_end 0x00000004
-#define AOFF_mm_rss 0x0000006c
+#define AOFF_mm_rss 0x00000070
#define ASIZ_mm_rss 0x00000004
-#define AOFF_mm_total_vm 0x00000070
+#define AOFF_mm_total_vm 0x00000074
#define ASIZ_mm_total_vm 0x00000004
-#define AOFF_mm_locked_vm 0x00000074
+#define AOFF_mm_locked_vm 0x00000078
#define ASIZ_mm_locked_vm 0x00000004
-#define AOFF_mm_def_flags 0x00000078
+#define AOFF_mm_def_flags 0x0000007c
#define ASIZ_mm_def_flags 0x00000004
-#define AOFF_mm_cpu_vm_mask 0x0000007c
+#define AOFF_mm_cpu_vm_mask 0x00000080
#define ASIZ_mm_cpu_vm_mask 0x00000004
-#define AOFF_mm_swap_cnt 0x00000080
+#define AOFF_mm_swap_cnt 0x00000084
#define ASIZ_mm_swap_cnt 0x00000004
-#define AOFF_mm_swap_address 0x00000084
+#define AOFF_mm_swap_address 0x00000088
#define ASIZ_mm_swap_address 0x00000004
-#define AOFF_mm_segments 0x00000088
+#define AOFF_mm_segments 0x0000008c
#define ASIZ_mm_segments 0x00000004
#define AOFF_thread_uwinmask 0x00000000
#define ASIZ_thread_uwinmask 0x00000004
@@ -313,10 +313,8 @@
#define ASIZ_task_next_task 0x00000004
#define AOFF_task_prev_task 0x00000038
#define ASIZ_task_prev_task 0x00000004
-#define AOFF_task_next_run 0x0000003c
-#define ASIZ_task_next_run 0x00000004
-#define AOFF_task_prev_run 0x00000040
-#define ASIZ_task_prev_run 0x00000004
+#define AOFF_task_run_list 0x0000003c
+#define ASIZ_task_run_list 0x00000008
#define AOFF_task_binfmt 0x00000044
#define ASIZ_task_binfmt 0x00000004
#define AOFF_task_exit_code 0x00000048
@@ -351,113 +349,113 @@
#define ASIZ_task_pidhash_next 0x00000004
#define AOFF_task_pidhash_pprev 0x00000088
#define ASIZ_task_pidhash_pprev 0x00000004
-#define AOFF_task_tarray_ptr 0x0000008c
-#define ASIZ_task_tarray_ptr 0x00000004
-#define AOFF_task_wait_chldexit 0x00000090
+#define AOFF_task_wait_chldexit 0x0000008c
#define ASIZ_task_wait_chldexit 0x00000018
-#define AOFF_task_vfork_sem 0x000000a8
+#define AOFF_task_vfork_sem 0x000000a4
#define ASIZ_task_vfork_sem 0x00000004
-#define AOFF_task_policy 0x000000ac
+#define AOFF_task_policy 0x000000a8
#define ASIZ_task_policy 0x00000004
-#define AOFF_task_rt_priority 0x000000b0
+#define AOFF_task_rt_priority 0x000000ac
#define ASIZ_task_rt_priority 0x00000004
-#define AOFF_task_it_real_value 0x000000b4
+#define AOFF_task_it_real_value 0x000000b0
#define ASIZ_task_it_real_value 0x00000004
-#define AOFF_task_it_prof_value 0x000000b8
+#define AOFF_task_it_prof_value 0x000000b4
#define ASIZ_task_it_prof_value 0x00000004
-#define AOFF_task_it_virt_value 0x000000bc
+#define AOFF_task_it_virt_value 0x000000b8
#define ASIZ_task_it_virt_value 0x00000004
-#define AOFF_task_it_real_incr 0x000000c0
+#define AOFF_task_it_real_incr 0x000000bc
#define ASIZ_task_it_real_incr 0x00000004
-#define AOFF_task_it_prof_incr 0x000000c4
+#define AOFF_task_it_prof_incr 0x000000c0
#define ASIZ_task_it_prof_incr 0x00000004
-#define AOFF_task_it_virt_incr 0x000000c8
+#define AOFF_task_it_virt_incr 0x000000c4
#define ASIZ_task_it_virt_incr 0x00000004
-#define AOFF_task_real_timer 0x000000cc
+#define AOFF_task_real_timer 0x000000c8
#define ASIZ_task_real_timer 0x00000014
-#define AOFF_task_times 0x000000e0
+#define AOFF_task_times 0x000000dc
#define ASIZ_task_times 0x00000010
-#define AOFF_task_start_time 0x000000f0
+#define AOFF_task_start_time 0x000000ec
#define ASIZ_task_start_time 0x00000004
-#define AOFF_task_per_cpu_utime 0x000000f4
+#define AOFF_task_per_cpu_utime 0x000000f0
#define ASIZ_task_per_cpu_utime 0x00000080
-#define AOFF_task_min_flt 0x000001f4
+#define AOFF_task_min_flt 0x000001f0
#define ASIZ_task_min_flt 0x00000004
-#define AOFF_task_maj_flt 0x000001f8
+#define AOFF_task_maj_flt 0x000001f4
#define ASIZ_task_maj_flt 0x00000004
-#define AOFF_task_nswap 0x000001fc
+#define AOFF_task_nswap 0x000001f8
#define ASIZ_task_nswap 0x00000004
-#define AOFF_task_cmin_flt 0x00000200
+#define AOFF_task_cmin_flt 0x000001fc
#define ASIZ_task_cmin_flt 0x00000004
-#define AOFF_task_cmaj_flt 0x00000204
+#define AOFF_task_cmaj_flt 0x00000200
#define ASIZ_task_cmaj_flt 0x00000004
-#define AOFF_task_cnswap 0x00000208
+#define AOFF_task_cnswap 0x00000204
#define ASIZ_task_cnswap 0x00000004
-#define AOFF_task_uid 0x0000020e
+#define AOFF_task_uid 0x0000020a
#define ASIZ_task_uid 0x00000002
-#define AOFF_task_euid 0x00000210
+#define AOFF_task_euid 0x0000020c
#define ASIZ_task_euid 0x00000002
-#define AOFF_task_suid 0x00000212
+#define AOFF_task_suid 0x0000020e
#define ASIZ_task_suid 0x00000002
-#define AOFF_task_fsuid 0x00000214
+#define AOFF_task_fsuid 0x00000210
#define ASIZ_task_fsuid 0x00000002
-#define AOFF_task_gid 0x00000216
+#define AOFF_task_gid 0x00000212
#define ASIZ_task_gid 0x00000002
-#define AOFF_task_egid 0x00000218
+#define AOFF_task_egid 0x00000214
#define ASIZ_task_egid 0x00000002
-#define AOFF_task_sgid 0x0000021a
+#define AOFF_task_sgid 0x00000216
#define ASIZ_task_sgid 0x00000002
-#define AOFF_task_fsgid 0x0000021c
+#define AOFF_task_fsgid 0x00000218
#define ASIZ_task_fsgid 0x00000002
-#define AOFF_task_ngroups 0x00000220
+#define AOFF_task_ngroups 0x0000021c
#define ASIZ_task_ngroups 0x00000004
-#define AOFF_task_groups 0x00000224
+#define AOFF_task_groups 0x00000220
#define ASIZ_task_groups 0x00000040
-#define AOFF_task_cap_effective 0x00000264
+#define AOFF_task_cap_effective 0x00000260
#define ASIZ_task_cap_effective 0x00000004
-#define AOFF_task_cap_inheritable 0x00000268
+#define AOFF_task_cap_inheritable 0x00000264
#define ASIZ_task_cap_inheritable 0x00000004
-#define AOFF_task_cap_permitted 0x0000026c
+#define AOFF_task_cap_permitted 0x00000268
#define ASIZ_task_cap_permitted 0x00000004
-#define AOFF_task_user 0x00000270
+#define AOFF_task_user 0x0000026c
#define ASIZ_task_user 0x00000004
-#define AOFF_task_rlim 0x00000274
+#define AOFF_task_rlim 0x00000270
#define ASIZ_task_rlim 0x00000050
-#define AOFF_task_used_math 0x000002c4
+#define AOFF_task_used_math 0x000002c0
#define ASIZ_task_used_math 0x00000002
-#define AOFF_task_comm 0x000002c6
+#define AOFF_task_comm 0x000002c2
#define ASIZ_task_comm 0x00000010
-#define AOFF_task_link_count 0x000002d8
+#define AOFF_task_link_count 0x000002d4
#define ASIZ_task_link_count 0x00000004
-#define AOFF_task_tty 0x000002dc
+#define AOFF_task_tty 0x000002d8
#define ASIZ_task_tty 0x00000004
-#define AOFF_task_semundo 0x000002e0
+#define AOFF_task_semundo 0x000002dc
#define ASIZ_task_semundo 0x00000004
-#define AOFF_task_semsleeping 0x000002e4
+#define AOFF_task_semsleeping 0x000002e0
#define ASIZ_task_semsleeping 0x00000004
-#define AOFF_task_tss 0x000002e8
-#define ASIZ_task_tss 0x00000388
+#define AOFF_task_thread 0x000002e8
+#define ASIZ_task_thread 0x00000388
#define AOFF_task_fs 0x00000670
#define ASIZ_task_fs 0x00000004
#define AOFF_task_files 0x00000674
#define ASIZ_task_files 0x00000004
#define AOFF_task_mm 0x00000678
#define ASIZ_task_mm 0x00000004
-#define AOFF_task_sigmask_lock 0x0000067c
+#define AOFF_task_active_mm 0x0000067c
+#define ASIZ_task_active_mm 0x00000004
+#define AOFF_task_sigmask_lock 0x00000680
#define ASIZ_task_sigmask_lock 0x00000008
-#define AOFF_task_sig 0x00000684
+#define AOFF_task_sig 0x00000688
#define ASIZ_task_sig 0x00000004
-#define AOFF_task_signal 0x00000688
+#define AOFF_task_signal 0x0000068c
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x00000690
+#define AOFF_task_blocked 0x00000694
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x00000698
+#define AOFF_task_sigqueue 0x0000069c
#define ASIZ_task_sigqueue 0x00000004
-#define AOFF_task_sigqueue_tail 0x0000069c
+#define AOFF_task_sigqueue_tail 0x000006a0
#define ASIZ_task_sigqueue_tail 0x00000004
-#define AOFF_task_sas_ss_sp 0x000006a0
+#define AOFF_task_sas_ss_sp 0x000006a4
#define ASIZ_task_sas_ss_sp 0x00000004
-#define AOFF_task_sas_ss_size 0x000006a4
+#define AOFF_task_sas_ss_size 0x000006a8
#define ASIZ_task_sas_ss_size 0x00000004
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000004
@@ -467,53 +465,55 @@
#define ASIZ_mm_mmap_cache 0x00000004
#define AOFF_mm_pgd 0x0000000c
#define ASIZ_mm_pgd 0x00000004
-#define AOFF_mm_count 0x00000010
-#define ASIZ_mm_count 0x00000004
-#define AOFF_mm_map_count 0x00000014
+#define AOFF_mm_mm_users 0x00000010
+#define ASIZ_mm_mm_users 0x00000004
+#define AOFF_mm_mm_count 0x00000014
+#define ASIZ_mm_mm_count 0x00000004
+#define AOFF_mm_map_count 0x00000018
#define ASIZ_mm_map_count 0x00000004
-#define AOFF_mm_mmap_sem 0x00000018
+#define AOFF_mm_mmap_sem 0x0000001c
#define ASIZ_mm_mmap_sem 0x00000024
-#define AOFF_mm_page_table_lock 0x0000003c
+#define AOFF_mm_page_table_lock 0x00000040
#define ASIZ_mm_page_table_lock 0x00000008
-#define AOFF_mm_context 0x00000044
+#define AOFF_mm_context 0x00000048
#define ASIZ_mm_context 0x00000004
-#define AOFF_mm_start_code 0x00000048
+#define AOFF_mm_start_code 0x0000004c
#define ASIZ_mm_start_code 0x00000004
-#define AOFF_mm_end_code 0x0000004c
+#define AOFF_mm_end_code 0x00000050
#define ASIZ_mm_end_code 0x00000004
-#define AOFF_mm_start_data 0x00000050
+#define AOFF_mm_start_data 0x00000054
#define ASIZ_mm_start_data 0x00000004
-#define AOFF_mm_end_data 0x00000054
+#define AOFF_mm_end_data 0x00000058
#define ASIZ_mm_end_data 0x00000004
-#define AOFF_mm_start_brk 0x00000058
+#define AOFF_mm_start_brk 0x0000005c
#define ASIZ_mm_start_brk 0x00000004
-#define AOFF_mm_brk 0x0000005c
+#define AOFF_mm_brk 0x00000060
#define ASIZ_mm_brk 0x00000004
-#define AOFF_mm_start_stack 0x00000060
+#define AOFF_mm_start_stack 0x00000064
#define ASIZ_mm_start_stack 0x00000004
-#define AOFF_mm_arg_start 0x00000064
+#define AOFF_mm_arg_start 0x00000068
#define ASIZ_mm_arg_start 0x00000004
-#define AOFF_mm_arg_end 0x00000068
+#define AOFF_mm_arg_end 0x0000006c
#define ASIZ_mm_arg_end 0x00000004
-#define AOFF_mm_env_start 0x0000006c
+#define AOFF_mm_env_start 0x00000070
#define ASIZ_mm_env_start 0x00000004
-#define AOFF_mm_env_end 0x00000070
+#define AOFF_mm_env_end 0x00000074
#define ASIZ_mm_env_end 0x00000004
-#define AOFF_mm_rss 0x00000074
+#define AOFF_mm_rss 0x00000078
#define ASIZ_mm_rss 0x00000004
-#define AOFF_mm_total_vm 0x00000078
+#define AOFF_mm_total_vm 0x0000007c
#define ASIZ_mm_total_vm 0x00000004
-#define AOFF_mm_locked_vm 0x0000007c
+#define AOFF_mm_locked_vm 0x00000080
#define ASIZ_mm_locked_vm 0x00000004
-#define AOFF_mm_def_flags 0x00000080
+#define AOFF_mm_def_flags 0x00000084
#define ASIZ_mm_def_flags 0x00000004
-#define AOFF_mm_cpu_vm_mask 0x00000084
+#define AOFF_mm_cpu_vm_mask 0x00000088
#define ASIZ_mm_cpu_vm_mask 0x00000004
-#define AOFF_mm_swap_cnt 0x00000088
+#define AOFF_mm_swap_cnt 0x0000008c
#define ASIZ_mm_swap_cnt 0x00000004
-#define AOFF_mm_swap_address 0x0000008c
+#define AOFF_mm_swap_address 0x00000090
#define ASIZ_mm_swap_address 0x00000004
-#define AOFF_mm_segments 0x00000090
+#define AOFF_mm_segments 0x00000094
#define ASIZ_mm_segments 0x00000004
#define AOFF_thread_uwinmask 0x00000000
#define ASIZ_thread_uwinmask 0x00000004
diff --git a/include/asm-sparc/audioio.h b/include/asm-sparc/audioio.h
index 01bebaf73..cb9a213a3 100644
--- a/include/asm-sparc/audioio.h
+++ b/include/asm-sparc/audioio.h
@@ -299,6 +299,8 @@ struct sparcaudio_driver
/* Hack to make it look like we support variable size buffers. */
int buffer_size;
+
+ int mixer_modify_counter;
};
struct sparcaudio_operations
@@ -432,23 +434,6 @@ extern int cs4231_init(void);
#endif
-/* Mixer helper ioctls */
-#define right(a) (((a >> 8) & 0xff) % 101)
-#define left(a) ((a & 0xff) % 101)
-
-/* Macros to convert between mixer stereo volumes and gain (mono) */
-#define s_to_m(a) ((((left(a) + right(a)) * 255) / 200) % 256)
-#define m_to_s(a) ((a * 100 / 255) + ((a * 100 / 255) << 8))
-
-/* convert mixer stereo volume to balance */
-#define s_to_b(a) (s_to_g(a) == 0) ? 32 : ((left(a) * AUDIO_RIGHT_BALANCE / (left(a) + right(a))))
-
-/* convert mixer stereo volume to audio gain */
-#define s_to_g(a) ((((right(a) + left(a)) * 255) / 200) % 256)
-
-/* convert gain a and balance b to mixer volume */
-#define b_to_s(a,b) (((((b * a * 200) / (AUDIO_RIGHT_BALANCE * 255)) % 100) << 8) + ((((AUDIO_RIGHT_BALANCE - b) * a * 200) / (AUDIO_RIGHT_BALANCE * 255)) % 100))
-
/* Device minor numbers */
#define SPARCAUDIO_MIXER_MINOR 0
@@ -514,4 +499,147 @@ struct stdata
#define I_GETSIG _IOR('S',012,int)
#define I_GETSIG_SOLARIS (('S'<<8)|12)
-#endif
+
+/* Conversion between Sun and OSS volume settings */
+static __inline__
+int OSS_LEFT(int value)
+{
+ return ((value & 0xff) % 101);
+}
+
+static __inline__
+int OSS_RIGHT(int value)
+{
+ return (((value >> 8) & 0xff) % 101);
+}
+
+static __inline__
+int O_TO_S(int value)
+{
+ return value * 255 / 100;
+}
+
+static __inline__
+int S_TO_O(int value)
+{
+ return value * 100 / 255;
+}
+
+static __inline__
+int OSS_TO_GAIN(int value)
+{
+ int l = O_TO_S(OSS_LEFT(value));
+ int r = O_TO_S(OSS_RIGHT(value));
+ return ((l > r) ? l : r);
+}
+
+static __inline__
+int OSS_TO_LGAIN(int value)
+{
+ int l = O_TO_S(OSS_LEFT(value));
+ int r = O_TO_S(OSS_RIGHT(value));
+ return ((l < r) ? l : r);
+}
+
+static __inline__
+int OSS_TO_BAL(int value)
+{
+ if (!OSS_TO_GAIN(value))
+ return AUDIO_MID_BALANCE;
+ if (!OSS_TO_LGAIN(value)) {
+ if (OSS_TO_GAIN(value) == OSS_TO_GAIN(OSS_RIGHT(value)))
+ return AUDIO_RIGHT_BALANCE;
+ else
+ return AUDIO_LEFT_BALANCE;
+ }
+ if (OSS_TO_GAIN(value) == OSS_TO_GAIN(OSS_RIGHT(value)))
+ return ((OSS_TO_GAIN(value) - OSS_TO_LGAIN(value)) >> AUDIO_BALANCE_SHIFT)
+ + AUDIO_MID_BALANCE;
+ else
+ return AUDIO_MID_BALANCE - ((OSS_TO_GAIN(value) - OSS_TO_LGAIN(value))
+ >> AUDIO_BALANCE_SHIFT);
+}
+
+static __inline__
+int BAL_TO_OSS(int value, unsigned char balance)
+{
+ int l, r, adj;
+ if (balance > 63) balance = 63;
+ if (balance < AUDIO_MID_BALANCE) {
+ l = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
+ adj = ((AUDIO_MID_BALANCE - balance) << AUDIO_BALANCE_SHIFT);
+ if (adj < value)
+ r = (int)(value - adj)
+ * 100 / 255;
+ else r = 0;
+ } else if (balance > AUDIO_MID_BALANCE) {
+ r = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
+ adj = ((balance - AUDIO_MID_BALANCE) << AUDIO_BALANCE_SHIFT);
+ if (adj < value)
+ l = (int)(value - adj)
+ * 100 / 255;
+ else l = 0;
+ } else {
+ l = r = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
+ }
+
+ return ((r << 8) + l);
+}
+
+/* OSS mixer ioctl port handling */
+static __inline__
+int OSS_PORT_AUDIO(struct sparcaudio_driver *drv, unsigned int set)
+{
+ int p;
+ if (drv->ops->get_output_port) {
+ p = drv->ops->get_output_port(drv);
+ if (p & set)
+ return 0x6464;
+ }
+ return 0;
+}
+
+static __inline__
+int OSS_IPORT_AUDIO(struct sparcaudio_driver *drv, unsigned int set)
+{
+ int p;
+ if (drv->ops->get_input_port) {
+ p = drv->ops->get_input_port(drv);
+ if (p & set)
+ return 0x6464;
+ }
+ return 0;
+}
+
+static __inline__
+void OSS_TWIDDLE_PORT(struct sparcaudio_driver *drv, unsigned int ioctl,
+ unsigned int port, unsigned int set, unsigned int value)
+{
+ if (ioctl == port) {
+ int p;
+ if (drv->ops->get_output_port && drv->ops->set_output_port) {
+ p = drv->ops->get_output_port(drv);
+ if ((value == 0) || ((p & set) && (OSS_LEFT(value) < 100)))
+ drv->ops->set_output_port(drv, p & ~(set));
+ else
+ drv->ops->set_output_port(drv, p | set);
+ }
+ }
+}
+
+static __inline__
+void OSS_TWIDDLE_IPORT(struct sparcaudio_driver *drv, unsigned int ioctl,
+ unsigned int port, unsigned int set, unsigned int value)
+{
+ if (ioctl == port) {
+ int p;
+ if (drv->ops->get_input_port && drv->ops->set_input_port) {
+ p = drv->ops->get_input_port(drv);
+ if ((value == 0) || ((p & set) && (OSS_LEFT(value) < 100)))
+ drv->ops->set_input_port(drv, p & ~(set));
+ else
+ drv->ops->set_input_port(drv, p | set);
+ }
+ }
+}
+#endif /* _AUDIOIO_H_ */
diff --git a/include/asm-sparc/cache.h b/include/asm-sparc/cache.h
index 19885d7e9..6a5b74bb0 100644
--- a/include/asm-sparc/cache.h
+++ b/include/asm-sparc/cache.h
@@ -1,4 +1,4 @@
-/* $Id: cache.h,v 1.8 1999/03/11 00:14:45 davem Exp $
+/* $Id: cache.h,v 1.9 1999/08/14 03:51:58 anton Exp $
* cache.h: Cache specific code for the Sparc. These include flushing
* and direct tag/data line access.
*
@@ -15,6 +15,14 @@
#define SMP_CACHE_BYTES 32
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(SMP_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
/* Direct access to the instruction cache is provided through and
* alternate address space. The IDC bit must be off in the ICCR on
* HyperSparcs for these accesses to work. The code below does not do
diff --git a/include/asm-sparc/dma.h b/include/asm-sparc/dma.h
index 133e497c4..5bd5a4e53 100644
--- a/include/asm-sparc/dma.h
+++ b/include/asm-sparc/dma.h
@@ -1,4 +1,4 @@
-/* $Id: dma.h,v 1.29 1998/11/29 15:49:44 davem Exp $
+/* $Id: dma.h,v 1.31 1999/09/10 10:44:15 davem Exp $
* include/asm-sparc/dma.h
*
* Copyright 1995 (C) David S. Miller (davem@caip.rutgers.edu)
@@ -16,7 +16,7 @@
#include <asm/delay.h>
#include <asm/oplib.h>
#include <asm/system.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t dma_spin_lock;
@@ -119,6 +119,7 @@ extern void dvma_init(struct linux_sbus *);
#define DMA_FIFO_STDRAIN 0x00000040 /* DMA_VERS1 Drain the FIFO */
#define DMA_RST_SCSI 0x00000080 /* Reset the SCSI controller */
#define DMA_RST_ENET DMA_RST_SCSI /* Reset the ENET controller */
+#define DMA_RST_BPP DMA_RST_SCSI /* Reset the BPP controller */
#define DMA_ST_WRITE 0x00000100 /* write from device to memory */
#define DMA_ENABLE 0x00000200 /* Fire up DMA, handle requests */
#define DMA_PEND_READ 0x00000400 /* DMA_VERS1/0/PLUS Pending Read */
@@ -135,8 +136,8 @@ extern void dvma_init(struct linux_sbus *);
#define DMA_E_BURST8 0x00040000 /* ENET: SBUS r/w burst size */
#define DMA_BRST_SZ 0x000c0000 /* SCSI: SBUS r/w burst size */
#define DMA_BRST64 0x00080000 /* SCSI: 64byte bursts (HME on UltraSparc only) */
-#define DMA_BRST32 0x00040000 /* SCSI: 32byte bursts */
-#define DMA_BRST16 0x00000000 /* SCSI: 16byte bursts */
+#define DMA_BRST32 0x00040000 /* SCSI/BPP: 32byte bursts */
+#define DMA_BRST16 0x00000000 /* SCSI/BPP: 16byte bursts */
#define DMA_BRST0 0x00080000 /* SCSI: no bursts (non-HME gate arrays) */
#define DMA_ADDR_DISAB 0x00100000 /* No FIFO drains during addr */
#define DMA_2CLKS 0x00200000 /* Each transfer = 2 clock ticks */
@@ -145,6 +146,7 @@ extern void dvma_init(struct linux_sbus *);
#define DMA_CNTR_DISAB 0x00800000 /* No IRQ when DMA_TERM_CNTR set */
#define DMA_AUTO_NADDR 0x01000000 /* Use "auto nxt addr" feature */
#define DMA_SCSI_ON 0x02000000 /* Enable SCSI dma */
+#define DMA_BPP_ON DMA_SCSI_ON /* Enable BPP dma */
#define DMA_PARITY_OFF 0x02000000 /* HME: disable parity checking */
#define DMA_LOADED_ADDR 0x04000000 /* Address has been loaded */
#define DMA_LOADED_NADDR 0x08000000 /* Next address has been loaded */
diff --git a/include/asm-sparc/fbio.h b/include/asm-sparc/fbio.h
index 41329f311..a4b6afecc 100644
--- a/include/asm-sparc/fbio.h
+++ b/include/asm-sparc/fbio.h
@@ -36,6 +36,7 @@
/* Does not seem to be listed in the Sun file either */
#define FBTYPE_CREATOR 22
#define FBTYPE_PCI_IGA1682 23
+#define FBTYPE_P9100COLOR 24
/* fbio ioctls */
/* Returned by FBIOGTYPE */
diff --git a/include/asm-sparc/hardirq.h b/include/asm-sparc/hardirq.h
index 12452e839..ed47c7760 100644
--- a/include/asm-sparc/hardirq.h
+++ b/include/asm-sparc/hardirq.h
@@ -7,7 +7,7 @@
#ifndef __SPARC_HARDIRQ_H
#define __SPARC_HARDIRQ_H
-#include <linux/tasks.h>
+#include <linux/threads.h>
#ifndef __SMP__
extern unsigned int local_irq_count;
@@ -29,7 +29,7 @@ extern unsigned int local_irq_count;
#else
#include <asm/atomic.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#include <asm/system.h>
#include <asm/smp.h>
diff --git a/include/asm-sparc/init.h b/include/asm-sparc/init.h
index b5b1bbc47..17d215574 100644
--- a/include/asm-sparc/init.h
+++ b/include/asm-sparc/init.h
@@ -1,27 +1 @@
-#ifndef _SPARC_INIT_H
-#define _SPARC_INIT_H
-
-#if (defined (__svr4__) || defined (__ELF__))
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
-#define __cacheline_aligned __attribute__ \
- ((__section__ (".data.cacheline_aligned")))
-/* For assembly routines */
-#define __INIT .section ".text.init",#alloc,#execinstr
-#define __FINIT .previous
-#define __INITDATA .section ".data.init",#alloc,#write
-#else
-#define __init
-#define __initdata
-#define __initfunc(__arginit) __arginit
-#define __cacheline_aligned
-/* For assembly routines */
-#define __INIT
-#define __FINIT
-#define __INITDATA
-#endif
-
-#endif
+#error "<asm/init.h> should never be used - use <linux/init.h> instead"
diff --git a/include/asm-sparc/io-unit.h b/include/asm-sparc/io-unit.h
index fa020cd3f..42ff9b6a7 100644
--- a/include/asm-sparc/io-unit.h
+++ b/include/asm-sparc/io-unit.h
@@ -5,8 +5,8 @@
#ifndef _SPARC_IO_UNIT_H
#define _SPARC_IO_UNIT_H
+#include <linux/spinlock.h>
#include <asm/page.h>
-#include <asm/spinlock.h>
#include <asm/pgtable.h>
/* The io-unit handles all virtual to physical address translations
diff --git a/include/asm-sparc/irq.h b/include/asm-sparc/irq.h
index 38e861eb6..05c3374fa 100644
--- a/include/asm-sparc/irq.h
+++ b/include/asm-sparc/irq.h
@@ -1,4 +1,4 @@
-/* $Id: irq.h,v 1.26 1999/04/20 13:22:44 anton Exp $
+/* $Id: irq.h,v 1.27 1999/08/14 03:52:02 anton Exp $
* irq.h: IRQ registers on the Sparc.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -8,7 +8,7 @@
#define _SPARC_IRQ_H
#include <linux/linkage.h>
-#include <linux/tasks.h> /* For NR_CPUS */
+#include <linux/threads.h> /* For NR_CPUS */
#include <asm/system.h> /* For SUN4M_NCPUS */
#include <asm/btfixup.h>
diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h
index e83d44d3c..c9a10cd86 100644
--- a/include/asm-sparc/mostek.h
+++ b/include/asm-sparc/mostek.h
@@ -1,4 +1,4 @@
-/* $Id: mostek.h,v 1.10 1998/08/18 15:03:11 davem Exp $
+/* $Id: mostek.h,v 1.12 1999/08/31 18:51:41 davem Exp $
* mostek.h: Describes the various Mostek time of day clock registers.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -38,6 +38,18 @@
* other than the control register are in binary coded decimal. Some
* control bits also live outside the control register.
*/
+#define mostek_read(_addr) (*((volatile u8 *)(_addr)))
+#define mostek_write(_addr,_val) ((*((volatile u8 *)(_addr))) = (_val))
+#define MOSTEK_EEPROM 0x0000UL
+#define MOSTEK_IDPROM 0x07d8UL
+#define MOSTEK_CREG 0x07f8UL
+#define MOSTEK_SEC 0x07f9UL
+#define MOSTEK_MIN 0x07faUL
+#define MOSTEK_HOUR 0x07fbUL
+#define MOSTEK_DOW 0x07fcUL
+#define MOSTEK_DOM 0x07fdUL
+#define MOSTEK_MONTH 0x07feUL
+#define MOSTEK_YEAR 0x07ffUL
struct mostek48t02 {
volatile char eeprom[2008]; /* This is the eeprom, don't touch! */
@@ -52,7 +64,7 @@ struct mostek48t02 {
volatile unsigned char year; /* Year (0-99) */
};
-extern struct mostek48t02 *mstk48t02_regs;
+extern unsigned long mstk48t02_regs;
/* Control register values. */
#define MSTK_CREG_WRITE 0x80 /* Must set this before placing values. */
@@ -81,14 +93,14 @@ extern struct mostek48t02 *mstk48t02_regs;
#define MSTK_DECIMAL_TO_REGVAL(x) ((((x) / 0x0A) << 0x04) + ((x) % 0x0A))
/* Generic register set and get macros for internal use. */
-#define MSTK_GET(regs,var,mask) (MSTK_REGVAL_TO_DECIMAL(regs->var & MSTK_ ## mask ## _MASK))
-#define MSTK_SET(regs,var,value,mask) do { regs->var &= ~(MSTK_ ## mask ## _MASK); regs->var |= MSTK_DECIMAL_TO_REGVAL(value) & (MSTK_ ## mask ## _MASK); } while (0)
+#define MSTK_GET(regs,var,mask) (MSTK_REGVAL_TO_DECIMAL(((struct mostek48t02 *)regs)->var & MSTK_ ## mask ## _MASK))
+#define MSTK_SET(regs,var,value,mask) do { ((struct mostek48t02 *)regs)->var &= ~(MSTK_ ## mask ## _MASK); ((struct mostek48t02 *)regs)->var |= MSTK_DECIMAL_TO_REGVAL(value) & (MSTK_ ## mask ## _MASK); } while (0)
/* Macros to make register access easier on our fingers. These give you
* the decimal value of the register requested if applicable. You pass
* the a pointer to a 'struct mostek48t02'.
*/
-#define MSTK_REG_CREG(regs) (regs->creg)
+#define MSTK_REG_CREG(regs) (((struct mostek48t02 *)regs)->creg)
#define MSTK_REG_SEC(regs) MSTK_GET(regs,sec,SEC)
#define MSTK_REG_MIN(regs) MSTK_GET(regs,min,MIN)
#define MSTK_REG_HOUR(regs) MSTK_GET(regs,hour,HOUR)
diff --git a/include/asm-sparc/page.h b/include/asm-sparc/page.h
index 7ea969e04..a3754dfe2 100644
--- a/include/asm-sparc/page.h
+++ b/include/asm-sparc/page.h
@@ -1,4 +1,4 @@
-/* $Id: page.h,v 1.43 1998/05/11 08:40:11 davem Exp $
+/* $Id: page.h,v 1.45 1999/07/03 08:58:05 davem Exp $
* page.h: Various defines and such for MMU operations on the Sparc for
* the Linux kernel.
*
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
new file mode 100644
index 000000000..17c8ce462
--- /dev/null
+++ b/include/asm-sparc/pci.h
@@ -0,0 +1,10 @@
+#ifndef __SPARC_PCI_H
+#define __SPARC_PCI_H
+
+/* Can be used to override the logic in pci_scan_bus for skipping
+ * already-configured bus numbers - to be used for buggy BIOSes
+ * or architectures with incomplete PCI setup by the loader.
+ */
+#define pcibios_assign_all_busses() 0
+
+#endif /* __SPARC_PCI_H */
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index 05dfda736..305f6c6e4 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.80 1999/05/27 04:52:40 davem Exp $ */
+/* $Id: pgtable.h,v 1.82 1999/09/10 10:44:21 davem Exp $ */
#ifndef _SPARC_PGTABLE_H
#define _SPARC_PGTABLE_H
@@ -11,6 +11,7 @@
#include <linux/mm.h>
#include <linux/config.h>
+#include <linux/spinlock.h>
#include <asm/asi.h>
#ifdef CONFIG_SUN4
#include <asm/pgtsun4.h>
@@ -22,7 +23,6 @@
#include <asm/oplib.h>
#include <asm/sbus.h>
#include <asm/btfixup.h>
-#include <asm/spinlock.h>
extern void load_mmu(void);
extern int io_remap_page_range(unsigned long from, unsigned long to,
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h
index 2cec2f103..81739b0a5 100644
--- a/include/asm-sparc/processor.h
+++ b/include/asm-sparc/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.71 1999/05/27 04:52:43 davem Exp $
+/* $Id: processor.h,v 1.72 1999/08/14 03:52:04 anton Exp $
* include/asm-sparc/processor.h
*
* Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
@@ -96,7 +96,7 @@ struct thread_struct {
#define INIT_MMAP { &init_mm, (0), (0), \
NULL, __pgprot(0x0) , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-#define INIT_TSS { \
+#define INIT_THREAD { \
/* uwinmask, kregs, sig_address, sig_desc, ksp, kpc, kpsr, kwim */ \
0, 0, 0, 0, 0, 0, 0, 0, \
/* fork_kpsr, fork_kwim */ \
@@ -154,7 +154,7 @@ extern __inline__ void start_thread(struct pt_regs * regs, unsigned long pc,
extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
-#define copy_segments(__nr, __tsk, __mm) \
+#define copy_segments(__tsk, __mm) \
if((__tsk) == current && \
(__mm) != NULL) \
flush_user_windows()
@@ -162,6 +162,7 @@ extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
#define forget_segments() do { } while (0)
#ifdef __KERNEL__
+#define THREAD_SIZE (2*PAGE_SIZE)
extern struct task_struct *last_task_used_math;
@@ -177,14 +178,4 @@ BTFIXUPDEF_CALL(void, free_task_struct, struct task_struct *)
#endif
-/*
- * Return_address is a replacement for __builtin_return_address(count)
- * which on certain architectures cannot reasonably be implemented in GCC
- * (MIPS, Alpha) or is unuseable with -fomit-frame-pointer (i386).
- * Note that __builtin_return_address(x>=1) is forbidden because the GCC
- * aborts compilation on some CPUs. It's simply not possible to unwind
- * some CPU's stackframes.
- */
-#define return_address() __builtin_return_address(0)
-
#endif /* __ASM_SPARC_PROCESSOR_H */
diff --git a/include/asm-sparc/resource.h b/include/asm-sparc/resource.h
index 7e4f49093..466cfc1ea 100644
--- a/include/asm-sparc/resource.h
+++ b/include/asm-sparc/resource.h
@@ -1,4 +1,4 @@
-/* $Id: resource.h,v 1.7 1998/11/19 20:01:44 davem Exp $
+/* $Id: resource.h,v 1.9 1999/08/14 03:52:05 anton Exp $
* resource.h: Resource definitions.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -25,14 +25,13 @@
#define RLIM_NLIMITS 10
#ifdef __KERNEL__
-
-#define INIT_RLIMITS \
-{ \
- {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
- {LONG_MAX, LONG_MAX}, {_STK_LIM, LONG_MAX}, \
- { 0, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
- {NR_OPEN, NR_OPEN}, {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, \
- {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX} \
+#define INIT_RLIMITS \
+{ \
+ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
+ {LONG_MAX, LONG_MAX}, {_STK_LIM, LONG_MAX}, \
+ { 0, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
+ {INR_OPEN, INR_OPEN}, {0, 0}, \
+ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX} \
}
#endif /* __KERNEL__ */
diff --git a/include/asm-sparc/sigcontext.h b/include/asm-sparc/sigcontext.h
index 3c85783f1..ff9ccda16 100644
--- a/include/asm-sparc/sigcontext.h
+++ b/include/asm-sparc/sigcontext.h
@@ -1,18 +1,14 @@
-/* $Id: sigcontext.h,v 1.13 1998/10/06 09:28:35 jj Exp $ */
+/* $Id: sigcontext.h,v 1.14 1999/09/06 08:22:05 jj Exp $ */
#ifndef __SPARC_SIGCONTEXT_H
#define __SPARC_SIGCONTEXT_H
+#ifdef __KERNEL__
#include <asm/ptrace.h>
-
-#define SUNOS_MAXWIN 31
+#endif
#ifndef __ASSEMBLY__
-/* SunOS system call sigstack() uses this arg. */
-struct sunos_sigstack {
- unsigned long sig_sp;
- int onstack_flag;
-};
+#define __SUNOS_MAXWIN 31
/* This is what SunOS does, so shall I. */
struct sigcontext {
@@ -31,14 +27,23 @@ struct sigcontext {
int sigc_oswins; /* outstanding windows */
/* stack ptrs for each regwin buf */
- char *sigc_spbuf[SUNOS_MAXWIN];
+ char *sigc_spbuf[__SUNOS_MAXWIN];
/* Windows to restore after signal */
- struct reg_window sigc_wbuf[SUNOS_MAXWIN];
+ struct {
+ unsigned long locals[8];
+ unsigned long ins[8];
+ } sigc_wbuf[__SUNOS_MAXWIN];
};
typedef struct {
- struct pt_regs si_regs;
+ struct {
+ unsigned long psr;
+ unsigned long pc;
+ unsigned long npc;
+ unsigned long y;
+ unsigned long u_regs[16]; /* globals and ins */
+ } si_regs;
int si_mask;
} __siginfo_t;
@@ -52,6 +57,8 @@ typedef struct {
} si_fpqueue [16];
} __siginfo_fpu_t;
+#ifdef __KERNEL__
+
/* This magic should be in g_upper[0] for all upper parts
to be valid.
This is generated by sparc64 only, but for 32bit processes,
@@ -62,6 +69,8 @@ typedef struct {
unsigned int o_upper[8];
} siginfo_extra_v8plus_t;
+#endif
+
#endif /* !(__ASSEMBLY__) */
#endif /* !(__SPARC_SIGCONTEXT_H) */
diff --git a/include/asm-sparc/siginfo.h b/include/asm-sparc/siginfo.h
index 0a838c3a9..2baed407f 100644
--- a/include/asm-sparc/siginfo.h
+++ b/include/asm-sparc/siginfo.h
@@ -1,4 +1,4 @@
-/* $Id: siginfo.h,v 1.4 1999/04/28 19:45:20 davem Exp $
+/* $Id: siginfo.h,v 1.5 1999/07/29 12:56:57 jj Exp $
* siginfo.c:
*/
@@ -26,7 +26,7 @@ typedef struct siginfo {
/* kill() */
struct {
pid_t _pid; /* sender's pid */
- uid_t _uid; /* sender's uid */
+ unsigned int _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
@@ -38,20 +38,20 @@ typedef struct siginfo {
/* POSIX.1b signals */
struct {
pid_t _pid; /* sender's pid */
- uid_t _uid; /* sender's uid */
+ unsigned int _uid; /* sender's uid */
sigval_t _sigval;
} _rt;
/* SIGCHLD */
struct {
pid_t _pid; /* which child */
- uid_t _uid; /* sender's uid */
+ unsigned int _uid; /* sender's uid */
int _status; /* exit code */
clock_t _utime;
clock_t _stime;
} _sigchld;
- /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
+ /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
struct {
void *_addr; /* faulting insn/memory ref. */
int _trapno; /* TRAP # which caused the signal */
@@ -85,6 +85,7 @@ typedef struct siginfo {
* si_code values
* Digital reserves positive values for kernel-generated signals.
*/
+#define SI_NOINFO 32767 /* no information in siginfo_t */
#define SI_USER 0 /* sent by kill, sigsend, raise */
#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
#define SI_QUEUE -1 /* sent by sigqueue */
@@ -167,6 +168,12 @@ typedef struct siginfo {
#define NSIGPOLL 6
/*
+ * SIGEMT si_codes
+ */
+#define EMT_TAGOVF 1 /* tag overflow */
+#define NSIGEMT 1
+
+/*
* sigevent definitions
*
* It seems likely that SIGEV_THREAD will have to be handled from
diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
index c3517216b..51d75eee1 100644
--- a/include/asm-sparc/signal.h
+++ b/include/asm-sparc/signal.h
@@ -1,4 +1,4 @@
-/* $Id: signal.h,v 1.34 1998/07/29 16:32:38 jj Exp $ */
+/* $Id: signal.h,v 1.35 1999/09/06 08:22:04 jj Exp $ */
#ifndef _ASMSPARC_SIGNAL_H
#define _ASMSPARC_SIGNAL_H
@@ -196,10 +196,12 @@ struct __new_sigaction {
__new_sigset_t sa_mask;
};
+#ifdef __KERNEL__
struct k_sigaction {
struct __new_sigaction sa;
void *ka_restorer;
};
+#endif
struct __old_sigaction {
__sighandler_t sa_handler;
@@ -211,7 +213,7 @@ struct __old_sigaction {
typedef struct sigaltstack {
void *ss_sp;
int ss_flags;
- __kernel_size_t ss_size;
+ size_t ss_size;
} stack_t;
#endif /* !(__ASSEMBLY__) */
diff --git a/include/asm-sparc/smp.h b/include/asm-sparc/smp.h
index e1ba06201..7c69f57c2 100644
--- a/include/asm-sparc/smp.h
+++ b/include/asm-sparc/smp.h
@@ -6,7 +6,7 @@
#ifndef _SPARC_SMP_H
#define _SPARC_SMP_H
-#include <linux/tasks.h>
+#include <linux/threads.h>
#include <asm/head.h>
#include <asm/btfixup.h>
diff --git a/include/asm-sparc/smplock.h b/include/asm-sparc/smplock.h
index e62326a10..1590fafe9 100644
--- a/include/asm-sparc/smplock.h
+++ b/include/asm-sparc/smplock.h
@@ -4,7 +4,7 @@
* Default SMP lock implementation
*/
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-sparc/softirq.h b/include/asm-sparc/softirq.h
index e72d714cb..c82a080ad 100644
--- a/include/asm-sparc/softirq.h
+++ b/include/asm-sparc/softirq.h
@@ -7,7 +7,7 @@
#ifndef __SPARC_SOFTIRQ_H
#define __SPARC_SOFTIRQ_H
-#include <linux/tasks.h> /* For NR_CPUS */
+#include <linux/threads.h> /* For NR_CPUS */
#include <asm/atomic.h>
#include <asm/smp.h>
diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h
index 2cad9d56f..bcc8f0b87 100644
--- a/include/asm-sparc/spinlock.h
+++ b/include/asm-sparc/spinlock.h
@@ -6,61 +6,10 @@
#ifndef __SPARC_SPINLOCK_H
#define __SPARC_SPINLOCK_H
-#include <linux/tasks.h> /* For NR_CPUS */
+#include <linux/threads.h> /* For NR_CPUS */
#ifndef __ASSEMBLY__
-#ifndef __SMP__
-
-typedef unsigned char spinlock_t;
-#define SPIN_LOCK_UNLOCKED 0
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) do { } while(0)
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) do { } while(0)
-#define spin_lock_irq(lock) cli()
-#define spin_unlock_irq(lock) sti()
-#define spin_lock_bh(lock) local_bh_disable()
-#define spin_unlock_bh(lock) local_bh_enable()
-
-#define spin_lock_irqsave(lock, flags) save_and_cli(flags)
-#define spin_unlock_irqrestore(lock, flags) restore_flags(flags)
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- */
-typedef struct { volatile unsigned int lock; } rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
-
-#define read_lock(lock) do { } while(0)
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) do { } while(0)
-#define write_unlock(lock) do { } while(0)
-#define read_lock_irq(lock) cli()
-#define read_unlock_irq(lock) sti()
-#define write_lock_irq(lock) cli()
-#define write_unlock_irq(lock) sti()
-#define read_lock_bh(lock) local_bh_disable()
-#define read_unlock_bh(lock) local_bh_enable()
-#define write_lock_bh(lock) local_bh_disable()
-#define write_unlock_bh(lock) local_bh_enable()
-
-#define read_lock_irqsave(lock, flags) save_and_cli(flags)
-#define read_unlock_irqrestore(lock, flags) restore_flags(flags)
-#define write_lock_irqsave(lock, flags) save_and_cli(flags)
-#define write_unlock_irqrestore(lock, flags) restore_flags(flags)
-
-#else /* !(__SMP__) */
-
#include <asm/psr.h>
/* Define this to use the verbose/debugging versions in arch/sparc/lib/debuglocks.c */
@@ -371,8 +320,6 @@ extern __inline__ void write_lock(rwlock_t *rw)
#endif /* SPIN_LOCK_DEBUG */
-#endif /* __SMP__ */
-
#endif /* !(__ASSEMBLY__) */
#endif /* __SPARC_SPINLOCK_H */
diff --git a/include/asm-sparc/sunbpp.h b/include/asm-sparc/sunbpp.h
new file mode 100644
index 000000000..568db79b7
--- /dev/null
+++ b/include/asm-sparc/sunbpp.h
@@ -0,0 +1,80 @@
+/* $Id: sunbpp.h,v 1.1 1999/08/08 14:09:49 shadow Exp $
+ * include/asm-sparc/sunbpp.h
+ */
+
+#ifndef _ASM_SPARC_SUNBPP_H
+#define _ASM_SPARC_SUNBPP_H
+
+struct bpp_regs {
+ /* DMA registers */
+ __volatile__ __u32 p_csr; /* DMA Control/Status Register */
+ __volatile__ __u32 p_addr; /* Address Register */
+ __volatile__ __u32 p_bcnt; /* Byte Count Register */
+ __volatile__ __u32 p_tst_csr; /* Test Control/Status (DMA2 only) */
+ /* Parallel Port registers */
+ __volatile__ __u16 p_hcr; /* Hardware Configuration Register */
+ __volatile__ __u16 p_ocr; /* Operation Configuration Register */
+ __volatile__ __u8 p_dr; /* Parallel Data Register */
+ __volatile__ __u8 p_tcr; /* Transfer Control Register */
+ __volatile__ __u8 p_or; /* Output Register */
+ __volatile__ __u8 p_ir; /* Input Register */
+ __volatile__ __u16 p_icr; /* Interrupt Control Register */
+};
+
+/* P_HCR. Time is in increments of SBus clock. */
+#define P_HCR_TEST 0x8000 /* Allows buried counters to be read */
+#define P_HCR_DSW 0x7f00 /* Data strobe width (in ticks) */
+#define P_HCR_DDS 0x007f /* Data setup before strobe (in ticks) */
+
+/* P_OCR. */
+#define P_OCR_MEM_CLR 0x8000
+#define P_OCR_DATA_SRC 0x4000 /* ) */
+#define P_OCR_DS_DSEL 0x2000 /* ) Bidirectional */
+#define P_OCR_BUSY_DSEL 0x1000 /* ) selects */
+#define P_OCR_ACK_DSEL 0x0800 /* ) */
+#define P_OCR_EN_DIAG 0x0400
+#define P_OCR_BUSY_OP 0x0200 /* Busy operation */
+#define P_OCR_ACK_OP 0x0100 /* Ack operation */
+#define P_OCR_SRST 0x0080 /* Reset state machines. Not selfcleaning. */
+#define P_OCR_IDLE 0x0008 /* PP data transfer state machine is idle */
+#define P_OCR_V_ILCK 0x0002 /* Versatec faded. Zebra only. */
+#define P_OCR_EN_VER 0x0001 /* Enable Versatec (0 - enable). Zebra only. */
+
+/* P_TCR */
+#define P_TCR_DIR 0x08
+#define P_TCR_BUSY 0x04
+#define P_TCR_ACK 0x02
+#define P_TCR_DS 0x01 /* Strobe */
+
+/* P_OR */
+#define P_OR_V3 0x20 /* ) */
+#define P_OR_V2 0x10 /* ) on Zebra only */
+#define P_OR_V1 0x08 /* ) */
+#define P_OR_INIT 0x04
+#define P_OR_AFXN 0x02 /* Auto Feed */
+#define P_OR_SLCT_IN 0x01
+
+/* P_IR */
+#define P_IR_PE 0x04
+#define P_IR_SLCT 0x02
+#define P_IR_ERR 0x01
+
+/* P_ICR */
+#define P_DS_IRQ 0x8000 /* RW1 */
+#define P_ACK_IRQ 0x4000 /* RW1 */
+#define P_BUSY_IRQ 0x2000 /* RW1 */
+#define P_PE_IRQ 0x1000 /* RW1 */
+#define P_SLCT_IRQ 0x0800 /* RW1 */
+#define P_ERR_IRQ 0x0400 /* RW1 */
+#define P_DS_IRQ_EN 0x0200 /* RW Always on rising edge */
+#define P_ACK_IRQ_EN 0x0100 /* RW Always on rising edge */
+#define P_BUSY_IRP 0x0080 /* RW 1= rising edge */
+#define P_BUSY_IRQ_EN 0x0040 /* RW */
+#define P_PE_IRP 0x0020 /* RW 1= rising edge */
+#define P_PE_IRQ_EN 0x0010 /* RW */
+#define P_SLCT_IRP 0x0008 /* RW 1= rising edge */
+#define P_SLCT_IRQ_EN 0x0004 /* RW */
+#define P_ERR_IRP 0x0002 /* RW1 1= rising edge */
+#define P_ERR_IRQ_EN 0x0001 /* RW */
+
+#endif /* !(_ASM_SPARC_SUNBPP_H) */
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index 3a4ee58a3..b489cac95 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -1,4 +1,4 @@
-/* $Id: system.h,v 1.74 1999/05/08 03:03:14 davem Exp $ */
+/* $Id: system.h,v 1.75 1999/09/01 08:06:08 davem Exp $ */
#include <linux/config.h>
#ifndef __SPARC_SYSTEM_H
@@ -309,6 +309,9 @@ do { register unsigned long bits asm("g7"); \
#define mb() __asm__ __volatile__ ("" : : : "memory")
#define rmb() mb()
#define wmb() mb()
+#define set_mb(__var, __value) do { __var = __value; mb(); } while(0)
+#define set_rmb(__var, __value) set_mb(__var, __value)
+#define set_wmb(__var, __value) set_mb(__var, __value)
#define nop() __asm__ __volatile__ ("nop");
diff --git a/include/asm-sparc/turbosparc.h b/include/asm-sparc/turbosparc.h
index 094573025..5078d901b 100644
--- a/include/asm-sparc/turbosparc.h
+++ b/include/asm-sparc/turbosparc.h
@@ -1,4 +1,4 @@
-/* $Id: turbosparc.h,v 1.2 1998/10/19 19:40:01 ralf Exp $
+/* $Id: turbosparc.h,v 1.4 1998/08/16 16:02:42 ecd Exp $
* turbosparc.h: Defines specific to the TurboSparc module.
* This is SRMMU stuff.
*
diff --git a/include/asm-sparc/uaccess.h b/include/asm-sparc/uaccess.h
index 56f81b81f..bccefbe47 100644
--- a/include/asm-sparc/uaccess.h
+++ b/include/asm-sparc/uaccess.h
@@ -1,4 +1,4 @@
-/* $Id: uaccess.h,v 1.18 1999/03/30 06:38:38 jj Exp $
+/* $Id: uaccess.h,v 1.19 1999/08/14 03:52:11 anton Exp $
* uaccess.h: User space memore access functions.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -29,8 +29,8 @@
#define VERIFY_WRITE 1
#define get_ds() (KERNEL_DS)
-#define get_fs() (current->tss.current_ds)
-#define set_fs(val) ((current->tss.current_ds) = (val))
+#define get_fs() (current->thread.current_ds)
+#define set_fs(val) ((current->thread.current_ds) = (val))
#define segment_eq(a,b) ((a).seg == (b).seg)
diff --git a/include/asm-sparc/winmacro.h b/include/asm-sparc/winmacro.h
index f31322e8e..90f70cbc8 100644
--- a/include/asm-sparc/winmacro.h
+++ b/include/asm-sparc/winmacro.h
@@ -1,4 +1,4 @@
-/* $Id: winmacro.h,v 1.20 1998/03/09 14:04:54 jj Exp $
+/* $Id: winmacro.h,v 1.21 1999/08/14 03:52:13 anton Exp $
* winmacro.h: Window loading-unloading macros.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -98,18 +98,18 @@
STORE_PT_INS(base_reg)
#define SAVE_BOLIXED_USER_STACK(cur_reg, scratch) \
- ld [%cur_reg + AOFF_task_tss + AOFF_thread_w_saved], %scratch; \
+ ld [%cur_reg + AOFF_task_thread + AOFF_thread_w_saved], %scratch; \
sll %scratch, 2, %scratch; \
add %scratch, %cur_reg, %scratch; \
- st %sp, [%scratch + AOFF_task_tss + AOFF_thread_rwbuf_stkptrs]; \
+ st %sp, [%scratch + AOFF_task_thread + AOFF_thread_rwbuf_stkptrs]; \
sub %scratch, %cur_reg, %scratch; \
sll %scratch, 4, %scratch; \
add %scratch, %cur_reg, %scratch; \
- STORE_WINDOW(scratch + AOFF_task_tss + AOFF_thread_reg_window); \
+ STORE_WINDOW(scratch + AOFF_task_thread + AOFF_thread_reg_window); \
sub %scratch, %cur_reg, %scratch; \
srl %scratch, 6, %scratch; \
add %scratch, 1, %scratch; \
- st %scratch, [%cur_reg + AOFF_task_tss + AOFF_thread_w_saved];
+ st %scratch, [%cur_reg + AOFF_task_thread + AOFF_thread_w_saved];
#ifdef __SMP__
#define LOAD_CURRENT4M(dest_reg, idreg) \
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h
index 1a16d0a74..02a745c81 100644
--- a/include/asm-sparc64/a.out.h
+++ b/include/asm-sparc64/a.out.h
@@ -1,4 +1,4 @@
-/* $Id: a.out.h,v 1.4 1997/05/04 07:21:19 davem Exp $ */
+/* $Id: a.out.h,v 1.6 1999/08/04 07:04:21 jj Exp $ */
#ifndef __SPARC64_A_OUT_H__
#define __SPARC64_A_OUT_H__
@@ -95,7 +95,7 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
#ifdef __KERNEL__
-#define STACK_TOP (current->tss.flags & SPARC_FLAG_32BIT ? 0xf0000000 : TASK_SIZE)
+#define STACK_TOP (current->thread.flags & SPARC_FLAG_32BIT ? 0xf0000000 : 0x80000000000L)
#endif
diff --git a/include/asm-sparc64/asm_offsets.h b/include/asm-sparc64/asm_offsets.h
index b1f87cc58..4b39659eb 100644
--- a/include/asm-sparc64/asm_offsets.h
+++ b/include/asm-sparc64/asm_offsets.h
@@ -4,6 +4,12 @@
#include <linux/config.h>
+#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
+# if !((__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
+# error Please issue 'make check_asm' in linux top-level directory first
+# endif
+#endif
+
#ifndef CONFIG_SMP
#define AOFF_task_state 0x00000000
@@ -36,10 +42,8 @@
#define ASIZ_task_next_task 0x00000008
#define AOFF_task_prev_task 0x00000058
#define ASIZ_task_prev_task 0x00000008
-#define AOFF_task_next_run 0x00000060
-#define ASIZ_task_next_run 0x00000008
-#define AOFF_task_prev_run 0x00000068
-#define ASIZ_task_prev_run 0x00000008
+#define AOFF_task_run_list 0x00000060
+#define ASIZ_task_run_list 0x00000010
#define AOFF_task_binfmt 0x00000070
#define ASIZ_task_binfmt 0x00000008
#define AOFF_task_exit_code 0x00000078
@@ -74,115 +78,115 @@
#define ASIZ_task_pidhash_next 0x00000008
#define AOFF_task_pidhash_pprev 0x000000d8
#define ASIZ_task_pidhash_pprev 0x00000008
-#define AOFF_task_tarray_ptr 0x000000e0
-#define ASIZ_task_tarray_ptr 0x00000008
-#define AOFF_task_wait_chldexit 0x000000e8
-#define ASIZ_task_wait_chldexit 0x00000028
-#define AOFF_task_vfork_sem 0x00000110
+#define AOFF_task_wait_chldexit 0x000000e0
+#define ASIZ_task_wait_chldexit 0x00000020
+#define AOFF_task_vfork_sem 0x00000100
#define ASIZ_task_vfork_sem 0x00000008
-#define AOFF_task_policy 0x00000118
+#define AOFF_task_policy 0x00000108
#define ASIZ_task_policy 0x00000008
-#define AOFF_task_rt_priority 0x00000120
+#define AOFF_task_rt_priority 0x00000110
#define ASIZ_task_rt_priority 0x00000008
-#define AOFF_task_it_real_value 0x00000128
+#define AOFF_task_it_real_value 0x00000118
#define ASIZ_task_it_real_value 0x00000008
-#define AOFF_task_it_prof_value 0x00000130
+#define AOFF_task_it_prof_value 0x00000120
#define ASIZ_task_it_prof_value 0x00000008
-#define AOFF_task_it_virt_value 0x00000138
+#define AOFF_task_it_virt_value 0x00000128
#define ASIZ_task_it_virt_value 0x00000008
-#define AOFF_task_it_real_incr 0x00000140
+#define AOFF_task_it_real_incr 0x00000130
#define ASIZ_task_it_real_incr 0x00000008
-#define AOFF_task_it_prof_incr 0x00000148
+#define AOFF_task_it_prof_incr 0x00000138
#define ASIZ_task_it_prof_incr 0x00000008
-#define AOFF_task_it_virt_incr 0x00000150
+#define AOFF_task_it_virt_incr 0x00000140
#define ASIZ_task_it_virt_incr 0x00000008
-#define AOFF_task_real_timer 0x00000158
+#define AOFF_task_real_timer 0x00000148
#define ASIZ_task_real_timer 0x00000028
-#define AOFF_task_times 0x00000180
+#define AOFF_task_times 0x00000170
#define ASIZ_task_times 0x00000020
-#define AOFF_task_start_time 0x000001a0
+#define AOFF_task_start_time 0x00000190
#define ASIZ_task_start_time 0x00000008
-#define AOFF_task_per_cpu_utime 0x000001a8
+#define AOFF_task_per_cpu_utime 0x00000198
#define ASIZ_task_per_cpu_utime 0x00000008
-#define AOFF_task_min_flt 0x000001b8
+#define AOFF_task_min_flt 0x000001a8
#define ASIZ_task_min_flt 0x00000008
-#define AOFF_task_maj_flt 0x000001c0
+#define AOFF_task_maj_flt 0x000001b0
#define ASIZ_task_maj_flt 0x00000008
-#define AOFF_task_nswap 0x000001c8
+#define AOFF_task_nswap 0x000001b8
#define ASIZ_task_nswap 0x00000008
-#define AOFF_task_cmin_flt 0x000001d0
+#define AOFF_task_cmin_flt 0x000001c0
#define ASIZ_task_cmin_flt 0x00000008
-#define AOFF_task_cmaj_flt 0x000001d8
+#define AOFF_task_cmaj_flt 0x000001c8
#define ASIZ_task_cmaj_flt 0x00000008
-#define AOFF_task_cnswap 0x000001e0
+#define AOFF_task_cnswap 0x000001d0
#define ASIZ_task_cnswap 0x00000008
-#define AOFF_task_uid 0x000001ec
+#define AOFF_task_uid 0x000001dc
#define ASIZ_task_uid 0x00000004
-#define AOFF_task_euid 0x000001f0
+#define AOFF_task_euid 0x000001e0
#define ASIZ_task_euid 0x00000004
-#define AOFF_task_suid 0x000001f4
+#define AOFF_task_suid 0x000001e4
#define ASIZ_task_suid 0x00000004
-#define AOFF_task_fsuid 0x000001f8
+#define AOFF_task_fsuid 0x000001e8
#define ASIZ_task_fsuid 0x00000004
-#define AOFF_task_gid 0x000001fc
+#define AOFF_task_gid 0x000001ec
#define ASIZ_task_gid 0x00000004
-#define AOFF_task_egid 0x00000200
+#define AOFF_task_egid 0x000001f0
#define ASIZ_task_egid 0x00000004
-#define AOFF_task_sgid 0x00000204
+#define AOFF_task_sgid 0x000001f4
#define ASIZ_task_sgid 0x00000004
-#define AOFF_task_fsgid 0x00000208
+#define AOFF_task_fsgid 0x000001f8
#define ASIZ_task_fsgid 0x00000004
-#define AOFF_task_ngroups 0x0000020c
+#define AOFF_task_ngroups 0x000001fc
#define ASIZ_task_ngroups 0x00000004
-#define AOFF_task_groups 0x00000210
+#define AOFF_task_groups 0x00000200
#define ASIZ_task_groups 0x00000080
-#define AOFF_task_cap_effective 0x00000290
+#define AOFF_task_cap_effective 0x00000280
#define ASIZ_task_cap_effective 0x00000004
-#define AOFF_task_cap_inheritable 0x00000294
+#define AOFF_task_cap_inheritable 0x00000284
#define ASIZ_task_cap_inheritable 0x00000004
-#define AOFF_task_cap_permitted 0x00000298
+#define AOFF_task_cap_permitted 0x00000288
#define ASIZ_task_cap_permitted 0x00000004
-#define AOFF_task_user 0x000002a0
+#define AOFF_task_user 0x00000290
#define ASIZ_task_user 0x00000008
-#define AOFF_task_rlim 0x000002a8
+#define AOFF_task_rlim 0x00000298
#define ASIZ_task_rlim 0x000000a0
-#define AOFF_task_used_math 0x00000348
+#define AOFF_task_used_math 0x00000338
#define ASIZ_task_used_math 0x00000002
-#define AOFF_task_comm 0x0000034a
+#define AOFF_task_comm 0x0000033a
#define ASIZ_task_comm 0x00000010
-#define AOFF_task_link_count 0x0000035c
+#define AOFF_task_link_count 0x0000034c
#define ASIZ_task_link_count 0x00000004
-#define AOFF_task_tty 0x00000360
+#define AOFF_task_tty 0x00000350
#define ASIZ_task_tty 0x00000008
-#define AOFF_task_semundo 0x00000368
+#define AOFF_task_semundo 0x00000358
#define ASIZ_task_semundo 0x00000008
-#define AOFF_task_semsleeping 0x00000370
+#define AOFF_task_semsleeping 0x00000360
#define ASIZ_task_semsleeping 0x00000008
-#define AOFF_task_tss 0x00000380
-#define ASIZ_task_tss 0x00000460
-#define AOFF_task_fs 0x000007e0
+#define AOFF_task_thread 0x00000370
+#define ASIZ_task_thread 0x00000460
+#define AOFF_task_fs 0x000007d0
#define ASIZ_task_fs 0x00000008
-#define AOFF_task_files 0x000007e8
+#define AOFF_task_files 0x000007d8
#define ASIZ_task_files 0x00000008
-#define AOFF_task_mm 0x000007f0
+#define AOFF_task_mm 0x000007e0
#define ASIZ_task_mm 0x00000008
-#define AOFF_task_sigmask_lock 0x000007f8
-#define ASIZ_task_sigmask_lock 0x00000001
-#define AOFF_task_sig 0x00000800
+#define AOFF_task_active_mm 0x000007e8
+#define ASIZ_task_active_mm 0x00000008
+#define AOFF_task_sigmask_lock 0x000007f0
+#define ASIZ_task_sigmask_lock 0x00000000
+#define AOFF_task_sig 0x000007f0
#define ASIZ_task_sig 0x00000008
-#define AOFF_task_signal 0x00000808
+#define AOFF_task_signal 0x000007f8
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x00000810
+#define AOFF_task_blocked 0x00000800
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x00000818
+#define AOFF_task_sigqueue 0x00000808
#define ASIZ_task_sigqueue 0x00000008
-#define AOFF_task_sigqueue_tail 0x00000820
+#define AOFF_task_sigqueue_tail 0x00000810
#define ASIZ_task_sigqueue_tail 0x00000008
-#define AOFF_task_sas_ss_sp 0x00000828
+#define AOFF_task_sas_ss_sp 0x00000818
#define ASIZ_task_sas_ss_sp 0x00000008
-#define AOFF_task_sas_ss_size 0x00000830
+#define AOFF_task_sas_ss_size 0x00000820
#define ASIZ_task_sas_ss_size 0x00000008
-#define ASIZ_task 0x00000840
+#define ASIZ_task 0x00000830
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000008
#define AOFF_mm_mmap_avl 0x00000008
@@ -191,91 +195,95 @@
#define ASIZ_mm_mmap_cache 0x00000008
#define AOFF_mm_pgd 0x00000018
#define ASIZ_mm_pgd 0x00000008
-#define AOFF_mm_count 0x00000020
-#define ASIZ_mm_count 0x00000004
-#define AOFF_mm_map_count 0x00000024
+#define AOFF_mm_mm_users 0x00000020
+#define ASIZ_mm_mm_users 0x00000004
+#define AOFF_mm_mm_count 0x00000024
+#define ASIZ_mm_mm_count 0x00000004
+#define AOFF_mm_map_count 0x00000028
#define ASIZ_mm_map_count 0x00000004
-#define AOFF_mm_mmap_sem 0x00000028
-#define ASIZ_mm_mmap_sem 0x00000038
+#define AOFF_mm_mmap_sem 0x00000030
+#define ASIZ_mm_mmap_sem 0x00000030
#define AOFF_mm_page_table_lock 0x00000060
-#define ASIZ_mm_page_table_lock 0x00000001
-#define AOFF_mm_context 0x00000068
+#define ASIZ_mm_page_table_lock 0x00000000
+#define AOFF_mm_context 0x00000060
#define ASIZ_mm_context 0x00000008
-#define AOFF_mm_start_code 0x00000070
+#define AOFF_mm_start_code 0x00000068
#define ASIZ_mm_start_code 0x00000008
-#define AOFF_mm_end_code 0x00000078
+#define AOFF_mm_end_code 0x00000070
#define ASIZ_mm_end_code 0x00000008
-#define AOFF_mm_start_data 0x00000080
+#define AOFF_mm_start_data 0x00000078
#define ASIZ_mm_start_data 0x00000008
-#define AOFF_mm_end_data 0x00000088
+#define AOFF_mm_end_data 0x00000080
#define ASIZ_mm_end_data 0x00000008
-#define AOFF_mm_start_brk 0x00000090
+#define AOFF_mm_start_brk 0x00000088
#define ASIZ_mm_start_brk 0x00000008
-#define AOFF_mm_brk 0x00000098
+#define AOFF_mm_brk 0x00000090
#define ASIZ_mm_brk 0x00000008
-#define AOFF_mm_start_stack 0x000000a0
+#define AOFF_mm_start_stack 0x00000098
#define ASIZ_mm_start_stack 0x00000008
-#define AOFF_mm_arg_start 0x000000a8
+#define AOFF_mm_arg_start 0x000000a0
#define ASIZ_mm_arg_start 0x00000008
-#define AOFF_mm_arg_end 0x000000b0
+#define AOFF_mm_arg_end 0x000000a8
#define ASIZ_mm_arg_end 0x00000008
-#define AOFF_mm_env_start 0x000000b8
+#define AOFF_mm_env_start 0x000000b0
#define ASIZ_mm_env_start 0x00000008
-#define AOFF_mm_env_end 0x000000c0
+#define AOFF_mm_env_end 0x000000b8
#define ASIZ_mm_env_end 0x00000008
-#define AOFF_mm_rss 0x000000c8
+#define AOFF_mm_rss 0x000000c0
#define ASIZ_mm_rss 0x00000008
-#define AOFF_mm_total_vm 0x000000d0
+#define AOFF_mm_total_vm 0x000000c8
#define ASIZ_mm_total_vm 0x00000008
-#define AOFF_mm_locked_vm 0x000000d8
+#define AOFF_mm_locked_vm 0x000000d0
#define ASIZ_mm_locked_vm 0x00000008
-#define AOFF_mm_def_flags 0x000000e0
+#define AOFF_mm_def_flags 0x000000d8
#define ASIZ_mm_def_flags 0x00000008
-#define AOFF_mm_cpu_vm_mask 0x000000e8
+#define AOFF_mm_cpu_vm_mask 0x000000e0
#define ASIZ_mm_cpu_vm_mask 0x00000008
-#define AOFF_mm_swap_cnt 0x000000f0
+#define AOFF_mm_swap_cnt 0x000000e8
#define ASIZ_mm_swap_cnt 0x00000008
-#define AOFF_mm_swap_address 0x000000f8
+#define AOFF_mm_swap_address 0x000000f0
#define ASIZ_mm_swap_address 0x00000008
-#define AOFF_mm_segments 0x00000100
+#define AOFF_mm_segments 0x000000f8
#define ASIZ_mm_segments 0x00000008
-#define ASIZ_mm 0x00000108
+#define ASIZ_mm 0x00000100
#define AOFF_thread_ksp 0x00000000
#define ASIZ_thread_ksp 0x00000008
#define AOFF_thread_wstate 0x00000008
-#define ASIZ_thread_wstate 0x00000002
-#define AOFF_thread_cwp 0x0000000a
-#define ASIZ_thread_cwp 0x00000002
-#define AOFF_thread_flags 0x0000000c
-#define ASIZ_thread_flags 0x00000002
-#define AOFF_thread_current_ds 0x0000000e
+#define ASIZ_thread_wstate 0x00000001
+#define AOFF_thread_cwp 0x00000009
+#define ASIZ_thread_cwp 0x00000001
+#define AOFF_thread_flags 0x0000000a
+#define ASIZ_thread_flags 0x00000001
+#define AOFF_thread_current_ds 0x0000000b
#define ASIZ_thread_current_ds 0x00000001
-#define AOFF_thread_w_saved 0x00000010
-#define ASIZ_thread_w_saved 0x00000002
-#define AOFF_thread_new_signal 0x00000012
-#define ASIZ_thread_new_signal 0x00000002
-#define AOFF_thread_ctx 0x00000014
-#define ASIZ_thread_ctx 0x00000002
+#define AOFF_thread_w_saved 0x0000000c
+#define ASIZ_thread_w_saved 0x00000001
+#define AOFF_thread_fpdepth 0x0000000d
+#define ASIZ_thread_fpdepth 0x00000001
+#define AOFF_thread_fpsaved 0x0000000e
+#define ASIZ_thread_fpsaved 0x00000007
+#define AOFF_thread___pad1 0x00000015
+#define ASIZ_thread___pad1 0x00000003
#define AOFF_thread_kregs 0x00000018
#define ASIZ_thread_kregs 0x00000008
#define AOFF_thread_utraps 0x00000020
#define ASIZ_thread_utraps 0x00000008
-#define AOFF_thread_fpdepth 0x00000028
-#define ASIZ_thread_fpdepth 0x00000001
-#define AOFF_thread_fpsaved 0x00000029
-#define ASIZ_thread_fpsaved 0x00000007
-#define AOFF_thread_gsr 0x00000030
+#define AOFF_thread_gsr 0x00000028
#define ASIZ_thread_gsr 0x00000007
-#define AOFF_thread_xfsr 0x00000038
+#define AOFF_thread___pad2 0x0000002f
+#define ASIZ_thread___pad2 0x00000001
+#define AOFF_thread_sig_address 0x00000030
+#define ASIZ_thread_sig_address 0x00000008
+#define AOFF_thread_sig_desc 0x00000038
+#define ASIZ_thread_sig_desc 0x00000008
+#define AOFF_thread_xfsr 0x00000040
#define ASIZ_thread_xfsr 0x00000038
-#define AOFF_thread_reg_window 0x00000070
+#define AOFF_thread___pad3 0x00000078
+#define ASIZ_thread___pad3 0x00000008
+#define AOFF_thread_reg_window 0x00000080
#define ASIZ_thread_reg_window 0x00000380
-#define AOFF_thread_rwbuf_stkptrs 0x000003f0
+#define AOFF_thread_rwbuf_stkptrs 0x00000400
#define ASIZ_thread_rwbuf_stkptrs 0x00000038
-#define AOFF_thread_sig_address 0x00000428
-#define ASIZ_thread_sig_address 0x00000008
-#define AOFF_thread_sig_desc 0x00000430
-#define ASIZ_thread_sig_desc 0x00000008
#define AOFF_thread_user_cntd0 0x00000438
#define ASIZ_thread_user_cntd0 0x00000008
#define AOFF_thread_user_cntd1 0x00000440
@@ -322,10 +330,8 @@
#define ASIZ_task_next_task 0x00000008
#define AOFF_task_prev_task 0x00000058
#define ASIZ_task_prev_task 0x00000008
-#define AOFF_task_next_run 0x00000060
-#define ASIZ_task_next_run 0x00000008
-#define AOFF_task_prev_run 0x00000068
-#define ASIZ_task_prev_run 0x00000008
+#define AOFF_task_run_list 0x00000060
+#define ASIZ_task_run_list 0x00000010
#define AOFF_task_binfmt 0x00000070
#define ASIZ_task_binfmt 0x00000008
#define AOFF_task_exit_code 0x00000078
@@ -360,115 +366,115 @@
#define ASIZ_task_pidhash_next 0x00000008
#define AOFF_task_pidhash_pprev 0x000000d8
#define ASIZ_task_pidhash_pprev 0x00000008
-#define AOFF_task_tarray_ptr 0x000000e0
-#define ASIZ_task_tarray_ptr 0x00000008
-#define AOFF_task_wait_chldexit 0x000000e8
+#define AOFF_task_wait_chldexit 0x000000e0
#define ASIZ_task_wait_chldexit 0x00000028
-#define AOFF_task_vfork_sem 0x00000110
+#define AOFF_task_vfork_sem 0x00000108
#define ASIZ_task_vfork_sem 0x00000008
-#define AOFF_task_policy 0x00000118
+#define AOFF_task_policy 0x00000110
#define ASIZ_task_policy 0x00000008
-#define AOFF_task_rt_priority 0x00000120
+#define AOFF_task_rt_priority 0x00000118
#define ASIZ_task_rt_priority 0x00000008
-#define AOFF_task_it_real_value 0x00000128
+#define AOFF_task_it_real_value 0x00000120
#define ASIZ_task_it_real_value 0x00000008
-#define AOFF_task_it_prof_value 0x00000130
+#define AOFF_task_it_prof_value 0x00000128
#define ASIZ_task_it_prof_value 0x00000008
-#define AOFF_task_it_virt_value 0x00000138
+#define AOFF_task_it_virt_value 0x00000130
#define ASIZ_task_it_virt_value 0x00000008
-#define AOFF_task_it_real_incr 0x00000140
+#define AOFF_task_it_real_incr 0x00000138
#define ASIZ_task_it_real_incr 0x00000008
-#define AOFF_task_it_prof_incr 0x00000148
+#define AOFF_task_it_prof_incr 0x00000140
#define ASIZ_task_it_prof_incr 0x00000008
-#define AOFF_task_it_virt_incr 0x00000150
+#define AOFF_task_it_virt_incr 0x00000148
#define ASIZ_task_it_virt_incr 0x00000008
-#define AOFF_task_real_timer 0x00000158
+#define AOFF_task_real_timer 0x00000150
#define ASIZ_task_real_timer 0x00000028
-#define AOFF_task_times 0x00000180
+#define AOFF_task_times 0x00000178
#define ASIZ_task_times 0x00000020
-#define AOFF_task_start_time 0x000001a0
+#define AOFF_task_start_time 0x00000198
#define ASIZ_task_start_time 0x00000008
-#define AOFF_task_per_cpu_utime 0x000001a8
+#define AOFF_task_per_cpu_utime 0x000001a0
#define ASIZ_task_per_cpu_utime 0x00000100
-#define AOFF_task_min_flt 0x000003a8
+#define AOFF_task_min_flt 0x000003a0
#define ASIZ_task_min_flt 0x00000008
-#define AOFF_task_maj_flt 0x000003b0
+#define AOFF_task_maj_flt 0x000003a8
#define ASIZ_task_maj_flt 0x00000008
-#define AOFF_task_nswap 0x000003b8
+#define AOFF_task_nswap 0x000003b0
#define ASIZ_task_nswap 0x00000008
-#define AOFF_task_cmin_flt 0x000003c0
+#define AOFF_task_cmin_flt 0x000003b8
#define ASIZ_task_cmin_flt 0x00000008
-#define AOFF_task_cmaj_flt 0x000003c8
+#define AOFF_task_cmaj_flt 0x000003c0
#define ASIZ_task_cmaj_flt 0x00000008
-#define AOFF_task_cnswap 0x000003d0
+#define AOFF_task_cnswap 0x000003c8
#define ASIZ_task_cnswap 0x00000008
-#define AOFF_task_uid 0x000003dc
+#define AOFF_task_uid 0x000003d4
#define ASIZ_task_uid 0x00000004
-#define AOFF_task_euid 0x000003e0
+#define AOFF_task_euid 0x000003d8
#define ASIZ_task_euid 0x00000004
-#define AOFF_task_suid 0x000003e4
+#define AOFF_task_suid 0x000003dc
#define ASIZ_task_suid 0x00000004
-#define AOFF_task_fsuid 0x000003e8
+#define AOFF_task_fsuid 0x000003e0
#define ASIZ_task_fsuid 0x00000004
-#define AOFF_task_gid 0x000003ec
+#define AOFF_task_gid 0x000003e4
#define ASIZ_task_gid 0x00000004
-#define AOFF_task_egid 0x000003f0
+#define AOFF_task_egid 0x000003e8
#define ASIZ_task_egid 0x00000004
-#define AOFF_task_sgid 0x000003f4
+#define AOFF_task_sgid 0x000003ec
#define ASIZ_task_sgid 0x00000004
-#define AOFF_task_fsgid 0x000003f8
+#define AOFF_task_fsgid 0x000003f0
#define ASIZ_task_fsgid 0x00000004
-#define AOFF_task_ngroups 0x000003fc
+#define AOFF_task_ngroups 0x000003f4
#define ASIZ_task_ngroups 0x00000004
-#define AOFF_task_groups 0x00000400
+#define AOFF_task_groups 0x000003f8
#define ASIZ_task_groups 0x00000080
-#define AOFF_task_cap_effective 0x00000480
+#define AOFF_task_cap_effective 0x00000478
#define ASIZ_task_cap_effective 0x00000004
-#define AOFF_task_cap_inheritable 0x00000484
+#define AOFF_task_cap_inheritable 0x0000047c
#define ASIZ_task_cap_inheritable 0x00000004
-#define AOFF_task_cap_permitted 0x00000488
+#define AOFF_task_cap_permitted 0x00000480
#define ASIZ_task_cap_permitted 0x00000004
-#define AOFF_task_user 0x00000490
+#define AOFF_task_user 0x00000488
#define ASIZ_task_user 0x00000008
-#define AOFF_task_rlim 0x00000498
+#define AOFF_task_rlim 0x00000490
#define ASIZ_task_rlim 0x000000a0
-#define AOFF_task_used_math 0x00000538
+#define AOFF_task_used_math 0x00000530
#define ASIZ_task_used_math 0x00000002
-#define AOFF_task_comm 0x0000053a
+#define AOFF_task_comm 0x00000532
#define ASIZ_task_comm 0x00000010
-#define AOFF_task_link_count 0x0000054c
+#define AOFF_task_link_count 0x00000544
#define ASIZ_task_link_count 0x00000004
-#define AOFF_task_tty 0x00000550
+#define AOFF_task_tty 0x00000548
#define ASIZ_task_tty 0x00000008
-#define AOFF_task_semundo 0x00000558
+#define AOFF_task_semundo 0x00000550
#define ASIZ_task_semundo 0x00000008
-#define AOFF_task_semsleeping 0x00000560
+#define AOFF_task_semsleeping 0x00000558
#define ASIZ_task_semsleeping 0x00000008
-#define AOFF_task_tss 0x00000570
-#define ASIZ_task_tss 0x00000460
-#define AOFF_task_fs 0x000009d0
+#define AOFF_task_thread 0x00000560
+#define ASIZ_task_thread 0x00000460
+#define AOFF_task_fs 0x000009c0
#define ASIZ_task_fs 0x00000008
-#define AOFF_task_files 0x000009d8
+#define AOFF_task_files 0x000009c8
#define ASIZ_task_files 0x00000008
-#define AOFF_task_mm 0x000009e0
+#define AOFF_task_mm 0x000009d0
#define ASIZ_task_mm 0x00000008
-#define AOFF_task_sigmask_lock 0x000009e8
+#define AOFF_task_active_mm 0x000009d8
+#define ASIZ_task_active_mm 0x00000008
+#define AOFF_task_sigmask_lock 0x000009e0
#define ASIZ_task_sigmask_lock 0x00000001
-#define AOFF_task_sig 0x000009f0
+#define AOFF_task_sig 0x000009e8
#define ASIZ_task_sig 0x00000008
-#define AOFF_task_signal 0x000009f8
+#define AOFF_task_signal 0x000009f0
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x00000a00
+#define AOFF_task_blocked 0x000009f8
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x00000a08
+#define AOFF_task_sigqueue 0x00000a00
#define ASIZ_task_sigqueue 0x00000008
-#define AOFF_task_sigqueue_tail 0x00000a10
+#define AOFF_task_sigqueue_tail 0x00000a08
#define ASIZ_task_sigqueue_tail 0x00000008
-#define AOFF_task_sas_ss_sp 0x00000a18
+#define AOFF_task_sas_ss_sp 0x00000a10
#define ASIZ_task_sas_ss_sp 0x00000008
-#define AOFF_task_sas_ss_size 0x00000a20
+#define AOFF_task_sas_ss_size 0x00000a18
#define ASIZ_task_sas_ss_size 0x00000008
-#define ASIZ_task 0x00000a30
+#define ASIZ_task 0x00000a20
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000008
#define AOFF_mm_mmap_avl 0x00000008
@@ -477,91 +483,95 @@
#define ASIZ_mm_mmap_cache 0x00000008
#define AOFF_mm_pgd 0x00000018
#define ASIZ_mm_pgd 0x00000008
-#define AOFF_mm_count 0x00000020
-#define ASIZ_mm_count 0x00000004
-#define AOFF_mm_map_count 0x00000024
+#define AOFF_mm_mm_users 0x00000020
+#define ASIZ_mm_mm_users 0x00000004
+#define AOFF_mm_mm_count 0x00000024
+#define ASIZ_mm_mm_count 0x00000004
+#define AOFF_mm_map_count 0x00000028
#define ASIZ_mm_map_count 0x00000004
-#define AOFF_mm_mmap_sem 0x00000028
+#define AOFF_mm_mmap_sem 0x00000030
#define ASIZ_mm_mmap_sem 0x00000038
-#define AOFF_mm_page_table_lock 0x00000060
+#define AOFF_mm_page_table_lock 0x00000068
#define ASIZ_mm_page_table_lock 0x00000001
-#define AOFF_mm_context 0x00000068
+#define AOFF_mm_context 0x00000070
#define ASIZ_mm_context 0x00000008
-#define AOFF_mm_start_code 0x00000070
+#define AOFF_mm_start_code 0x00000078
#define ASIZ_mm_start_code 0x00000008
-#define AOFF_mm_end_code 0x00000078
+#define AOFF_mm_end_code 0x00000080
#define ASIZ_mm_end_code 0x00000008
-#define AOFF_mm_start_data 0x00000080
+#define AOFF_mm_start_data 0x00000088
#define ASIZ_mm_start_data 0x00000008
-#define AOFF_mm_end_data 0x00000088
+#define AOFF_mm_end_data 0x00000090
#define ASIZ_mm_end_data 0x00000008
-#define AOFF_mm_start_brk 0x00000090
+#define AOFF_mm_start_brk 0x00000098
#define ASIZ_mm_start_brk 0x00000008
-#define AOFF_mm_brk 0x00000098
+#define AOFF_mm_brk 0x000000a0
#define ASIZ_mm_brk 0x00000008
-#define AOFF_mm_start_stack 0x000000a0
+#define AOFF_mm_start_stack 0x000000a8
#define ASIZ_mm_start_stack 0x00000008
-#define AOFF_mm_arg_start 0x000000a8
+#define AOFF_mm_arg_start 0x000000b0
#define ASIZ_mm_arg_start 0x00000008
-#define AOFF_mm_arg_end 0x000000b0
+#define AOFF_mm_arg_end 0x000000b8
#define ASIZ_mm_arg_end 0x00000008
-#define AOFF_mm_env_start 0x000000b8
+#define AOFF_mm_env_start 0x000000c0
#define ASIZ_mm_env_start 0x00000008
-#define AOFF_mm_env_end 0x000000c0
+#define AOFF_mm_env_end 0x000000c8
#define ASIZ_mm_env_end 0x00000008
-#define AOFF_mm_rss 0x000000c8
+#define AOFF_mm_rss 0x000000d0
#define ASIZ_mm_rss 0x00000008
-#define AOFF_mm_total_vm 0x000000d0
+#define AOFF_mm_total_vm 0x000000d8
#define ASIZ_mm_total_vm 0x00000008
-#define AOFF_mm_locked_vm 0x000000d8
+#define AOFF_mm_locked_vm 0x000000e0
#define ASIZ_mm_locked_vm 0x00000008
-#define AOFF_mm_def_flags 0x000000e0
+#define AOFF_mm_def_flags 0x000000e8
#define ASIZ_mm_def_flags 0x00000008
-#define AOFF_mm_cpu_vm_mask 0x000000e8
+#define AOFF_mm_cpu_vm_mask 0x000000f0
#define ASIZ_mm_cpu_vm_mask 0x00000008
-#define AOFF_mm_swap_cnt 0x000000f0
+#define AOFF_mm_swap_cnt 0x000000f8
#define ASIZ_mm_swap_cnt 0x00000008
-#define AOFF_mm_swap_address 0x000000f8
+#define AOFF_mm_swap_address 0x00000100
#define ASIZ_mm_swap_address 0x00000008
-#define AOFF_mm_segments 0x00000100
+#define AOFF_mm_segments 0x00000108
#define ASIZ_mm_segments 0x00000008
-#define ASIZ_mm 0x00000108
+#define ASIZ_mm 0x00000110
#define AOFF_thread_ksp 0x00000000
#define ASIZ_thread_ksp 0x00000008
#define AOFF_thread_wstate 0x00000008
-#define ASIZ_thread_wstate 0x00000002
-#define AOFF_thread_cwp 0x0000000a
-#define ASIZ_thread_cwp 0x00000002
-#define AOFF_thread_flags 0x0000000c
-#define ASIZ_thread_flags 0x00000002
-#define AOFF_thread_current_ds 0x0000000e
+#define ASIZ_thread_wstate 0x00000001
+#define AOFF_thread_cwp 0x00000009
+#define ASIZ_thread_cwp 0x00000001
+#define AOFF_thread_flags 0x0000000a
+#define ASIZ_thread_flags 0x00000001
+#define AOFF_thread_current_ds 0x0000000b
#define ASIZ_thread_current_ds 0x00000001
-#define AOFF_thread_w_saved 0x00000010
-#define ASIZ_thread_w_saved 0x00000002
-#define AOFF_thread_new_signal 0x00000012
-#define ASIZ_thread_new_signal 0x00000002
-#define AOFF_thread_ctx 0x00000014
-#define ASIZ_thread_ctx 0x00000002
+#define AOFF_thread_w_saved 0x0000000c
+#define ASIZ_thread_w_saved 0x00000001
+#define AOFF_thread_fpdepth 0x0000000d
+#define ASIZ_thread_fpdepth 0x00000001
+#define AOFF_thread_fpsaved 0x0000000e
+#define ASIZ_thread_fpsaved 0x00000007
+#define AOFF_thread___pad1 0x00000015
+#define ASIZ_thread___pad1 0x00000003
#define AOFF_thread_kregs 0x00000018
#define ASIZ_thread_kregs 0x00000008
#define AOFF_thread_utraps 0x00000020
#define ASIZ_thread_utraps 0x00000008
-#define AOFF_thread_fpdepth 0x00000028
-#define ASIZ_thread_fpdepth 0x00000001
-#define AOFF_thread_fpsaved 0x00000029
-#define ASIZ_thread_fpsaved 0x00000007
-#define AOFF_thread_gsr 0x00000030
+#define AOFF_thread_gsr 0x00000028
#define ASIZ_thread_gsr 0x00000007
-#define AOFF_thread_xfsr 0x00000038
+#define AOFF_thread___pad2 0x0000002f
+#define ASIZ_thread___pad2 0x00000001
+#define AOFF_thread_sig_address 0x00000030
+#define ASIZ_thread_sig_address 0x00000008
+#define AOFF_thread_sig_desc 0x00000038
+#define ASIZ_thread_sig_desc 0x00000008
+#define AOFF_thread_xfsr 0x00000040
#define ASIZ_thread_xfsr 0x00000038
-#define AOFF_thread_reg_window 0x00000070
+#define AOFF_thread___pad3 0x00000078
+#define ASIZ_thread___pad3 0x00000008
+#define AOFF_thread_reg_window 0x00000080
#define ASIZ_thread_reg_window 0x00000380
-#define AOFF_thread_rwbuf_stkptrs 0x000003f0
+#define AOFF_thread_rwbuf_stkptrs 0x00000400
#define ASIZ_thread_rwbuf_stkptrs 0x00000038
-#define AOFF_thread_sig_address 0x00000428
-#define ASIZ_thread_sig_address 0x00000008
-#define AOFF_thread_sig_desc 0x00000430
-#define ASIZ_thread_sig_desc 0x00000008
#define AOFF_thread_user_cntd0 0x00000438
#define ASIZ_thread_user_cntd0 0x00000008
#define AOFF_thread_user_cntd1 0x00000440
@@ -606,10 +616,8 @@
#define ASIZ_task_next_task 0x00000008
#define AOFF_task_prev_task 0x00000058
#define ASIZ_task_prev_task 0x00000008
-#define AOFF_task_next_run 0x00000060
-#define ASIZ_task_next_run 0x00000008
-#define AOFF_task_prev_run 0x00000068
-#define ASIZ_task_prev_run 0x00000008
+#define AOFF_task_run_list 0x00000060
+#define ASIZ_task_run_list 0x00000010
#define AOFF_task_binfmt 0x00000070
#define ASIZ_task_binfmt 0x00000008
#define AOFF_task_exit_code 0x00000078
@@ -644,115 +652,115 @@
#define ASIZ_task_pidhash_next 0x00000008
#define AOFF_task_pidhash_pprev 0x000000d8
#define ASIZ_task_pidhash_pprev 0x00000008
-#define AOFF_task_tarray_ptr 0x000000e0
-#define ASIZ_task_tarray_ptr 0x00000008
-#define AOFF_task_wait_chldexit 0x000000e8
+#define AOFF_task_wait_chldexit 0x000000e0
#define ASIZ_task_wait_chldexit 0x00000030
-#define AOFF_task_vfork_sem 0x00000118
+#define AOFF_task_vfork_sem 0x00000110
#define ASIZ_task_vfork_sem 0x00000008
-#define AOFF_task_policy 0x00000120
+#define AOFF_task_policy 0x00000118
#define ASIZ_task_policy 0x00000008
-#define AOFF_task_rt_priority 0x00000128
+#define AOFF_task_rt_priority 0x00000120
#define ASIZ_task_rt_priority 0x00000008
-#define AOFF_task_it_real_value 0x00000130
+#define AOFF_task_it_real_value 0x00000128
#define ASIZ_task_it_real_value 0x00000008
-#define AOFF_task_it_prof_value 0x00000138
+#define AOFF_task_it_prof_value 0x00000130
#define ASIZ_task_it_prof_value 0x00000008
-#define AOFF_task_it_virt_value 0x00000140
+#define AOFF_task_it_virt_value 0x00000138
#define ASIZ_task_it_virt_value 0x00000008
-#define AOFF_task_it_real_incr 0x00000148
+#define AOFF_task_it_real_incr 0x00000140
#define ASIZ_task_it_real_incr 0x00000008
-#define AOFF_task_it_prof_incr 0x00000150
+#define AOFF_task_it_prof_incr 0x00000148
#define ASIZ_task_it_prof_incr 0x00000008
-#define AOFF_task_it_virt_incr 0x00000158
+#define AOFF_task_it_virt_incr 0x00000150
#define ASIZ_task_it_virt_incr 0x00000008
-#define AOFF_task_real_timer 0x00000160
+#define AOFF_task_real_timer 0x00000158
#define ASIZ_task_real_timer 0x00000028
-#define AOFF_task_times 0x00000188
+#define AOFF_task_times 0x00000180
#define ASIZ_task_times 0x00000020
-#define AOFF_task_start_time 0x000001a8
+#define AOFF_task_start_time 0x000001a0
#define ASIZ_task_start_time 0x00000008
-#define AOFF_task_per_cpu_utime 0x000001b0
+#define AOFF_task_per_cpu_utime 0x000001a8
#define ASIZ_task_per_cpu_utime 0x00000100
-#define AOFF_task_min_flt 0x000003b0
+#define AOFF_task_min_flt 0x000003a8
#define ASIZ_task_min_flt 0x00000008
-#define AOFF_task_maj_flt 0x000003b8
+#define AOFF_task_maj_flt 0x000003b0
#define ASIZ_task_maj_flt 0x00000008
-#define AOFF_task_nswap 0x000003c0
+#define AOFF_task_nswap 0x000003b8
#define ASIZ_task_nswap 0x00000008
-#define AOFF_task_cmin_flt 0x000003c8
+#define AOFF_task_cmin_flt 0x000003c0
#define ASIZ_task_cmin_flt 0x00000008
-#define AOFF_task_cmaj_flt 0x000003d0
+#define AOFF_task_cmaj_flt 0x000003c8
#define ASIZ_task_cmaj_flt 0x00000008
-#define AOFF_task_cnswap 0x000003d8
+#define AOFF_task_cnswap 0x000003d0
#define ASIZ_task_cnswap 0x00000008
-#define AOFF_task_uid 0x000003e4
+#define AOFF_task_uid 0x000003dc
#define ASIZ_task_uid 0x00000004
-#define AOFF_task_euid 0x000003e8
+#define AOFF_task_euid 0x000003e0
#define ASIZ_task_euid 0x00000004
-#define AOFF_task_suid 0x000003ec
+#define AOFF_task_suid 0x000003e4
#define ASIZ_task_suid 0x00000004
-#define AOFF_task_fsuid 0x000003f0
+#define AOFF_task_fsuid 0x000003e8
#define ASIZ_task_fsuid 0x00000004
-#define AOFF_task_gid 0x000003f4
+#define AOFF_task_gid 0x000003ec
#define ASIZ_task_gid 0x00000004
-#define AOFF_task_egid 0x000003f8
+#define AOFF_task_egid 0x000003f0
#define ASIZ_task_egid 0x00000004
-#define AOFF_task_sgid 0x000003fc
+#define AOFF_task_sgid 0x000003f4
#define ASIZ_task_sgid 0x00000004
-#define AOFF_task_fsgid 0x00000400
+#define AOFF_task_fsgid 0x000003f8
#define ASIZ_task_fsgid 0x00000004
-#define AOFF_task_ngroups 0x00000404
+#define AOFF_task_ngroups 0x000003fc
#define ASIZ_task_ngroups 0x00000004
-#define AOFF_task_groups 0x00000408
+#define AOFF_task_groups 0x00000400
#define ASIZ_task_groups 0x00000080
-#define AOFF_task_cap_effective 0x00000488
+#define AOFF_task_cap_effective 0x00000480
#define ASIZ_task_cap_effective 0x00000004
-#define AOFF_task_cap_inheritable 0x0000048c
+#define AOFF_task_cap_inheritable 0x00000484
#define ASIZ_task_cap_inheritable 0x00000004
-#define AOFF_task_cap_permitted 0x00000490
+#define AOFF_task_cap_permitted 0x00000488
#define ASIZ_task_cap_permitted 0x00000004
-#define AOFF_task_user 0x00000498
+#define AOFF_task_user 0x00000490
#define ASIZ_task_user 0x00000008
-#define AOFF_task_rlim 0x000004a0
+#define AOFF_task_rlim 0x00000498
#define ASIZ_task_rlim 0x000000a0
-#define AOFF_task_used_math 0x00000540
+#define AOFF_task_used_math 0x00000538
#define ASIZ_task_used_math 0x00000002
-#define AOFF_task_comm 0x00000542
+#define AOFF_task_comm 0x0000053a
#define ASIZ_task_comm 0x00000010
-#define AOFF_task_link_count 0x00000554
+#define AOFF_task_link_count 0x0000054c
#define ASIZ_task_link_count 0x00000004
-#define AOFF_task_tty 0x00000558
+#define AOFF_task_tty 0x00000550
#define ASIZ_task_tty 0x00000008
-#define AOFF_task_semundo 0x00000560
+#define AOFF_task_semundo 0x00000558
#define ASIZ_task_semundo 0x00000008
-#define AOFF_task_semsleeping 0x00000568
+#define AOFF_task_semsleeping 0x00000560
#define ASIZ_task_semsleeping 0x00000008
-#define AOFF_task_tss 0x00000570
-#define ASIZ_task_tss 0x00000460
+#define AOFF_task_thread 0x00000570
+#define ASIZ_task_thread 0x00000460
#define AOFF_task_fs 0x000009d0
#define ASIZ_task_fs 0x00000008
#define AOFF_task_files 0x000009d8
#define ASIZ_task_files 0x00000008
#define AOFF_task_mm 0x000009e0
#define ASIZ_task_mm 0x00000008
-#define AOFF_task_sigmask_lock 0x000009e8
+#define AOFF_task_active_mm 0x000009e8
+#define ASIZ_task_active_mm 0x00000008
+#define AOFF_task_sigmask_lock 0x000009f0
#define ASIZ_task_sigmask_lock 0x0000000c
-#define AOFF_task_sig 0x000009f8
+#define AOFF_task_sig 0x00000a00
#define ASIZ_task_sig 0x00000008
-#define AOFF_task_signal 0x00000a00
+#define AOFF_task_signal 0x00000a08
#define ASIZ_task_signal 0x00000008
-#define AOFF_task_blocked 0x00000a08
+#define AOFF_task_blocked 0x00000a10
#define ASIZ_task_blocked 0x00000008
-#define AOFF_task_sigqueue 0x00000a10
+#define AOFF_task_sigqueue 0x00000a18
#define ASIZ_task_sigqueue 0x00000008
-#define AOFF_task_sigqueue_tail 0x00000a18
+#define AOFF_task_sigqueue_tail 0x00000a20
#define ASIZ_task_sigqueue_tail 0x00000008
-#define AOFF_task_sas_ss_sp 0x00000a20
+#define AOFF_task_sas_ss_sp 0x00000a28
#define ASIZ_task_sas_ss_sp 0x00000008
-#define AOFF_task_sas_ss_size 0x00000a28
+#define AOFF_task_sas_ss_size 0x00000a30
#define ASIZ_task_sas_ss_size 0x00000008
-#define ASIZ_task 0x00000a30
+#define ASIZ_task 0x00000a40
#define AOFF_mm_mmap 0x00000000
#define ASIZ_mm_mmap 0x00000008
#define AOFF_mm_mmap_avl 0x00000008
@@ -761,91 +769,95 @@
#define ASIZ_mm_mmap_cache 0x00000008
#define AOFF_mm_pgd 0x00000018
#define ASIZ_mm_pgd 0x00000008
-#define AOFF_mm_count 0x00000020
-#define ASIZ_mm_count 0x00000004
-#define AOFF_mm_map_count 0x00000024
+#define AOFF_mm_mm_users 0x00000020
+#define ASIZ_mm_mm_users 0x00000004
+#define AOFF_mm_mm_count 0x00000024
+#define ASIZ_mm_mm_count 0x00000004
+#define AOFF_mm_map_count 0x00000028
#define ASIZ_mm_map_count 0x00000004
-#define AOFF_mm_mmap_sem 0x00000028
+#define AOFF_mm_mmap_sem 0x00000030
#define ASIZ_mm_mmap_sem 0x00000040
-#define AOFF_mm_page_table_lock 0x00000068
+#define AOFF_mm_page_table_lock 0x00000070
#define ASIZ_mm_page_table_lock 0x0000000c
-#define AOFF_mm_context 0x00000078
+#define AOFF_mm_context 0x00000080
#define ASIZ_mm_context 0x00000008
-#define AOFF_mm_start_code 0x00000080
+#define AOFF_mm_start_code 0x00000088
#define ASIZ_mm_start_code 0x00000008
-#define AOFF_mm_end_code 0x00000088
+#define AOFF_mm_end_code 0x00000090
#define ASIZ_mm_end_code 0x00000008
-#define AOFF_mm_start_data 0x00000090
+#define AOFF_mm_start_data 0x00000098
#define ASIZ_mm_start_data 0x00000008
-#define AOFF_mm_end_data 0x00000098
+#define AOFF_mm_end_data 0x000000a0
#define ASIZ_mm_end_data 0x00000008
-#define AOFF_mm_start_brk 0x000000a0
+#define AOFF_mm_start_brk 0x000000a8
#define ASIZ_mm_start_brk 0x00000008
-#define AOFF_mm_brk 0x000000a8
+#define AOFF_mm_brk 0x000000b0
#define ASIZ_mm_brk 0x00000008
-#define AOFF_mm_start_stack 0x000000b0
+#define AOFF_mm_start_stack 0x000000b8
#define ASIZ_mm_start_stack 0x00000008
-#define AOFF_mm_arg_start 0x000000b8
+#define AOFF_mm_arg_start 0x000000c0
#define ASIZ_mm_arg_start 0x00000008
-#define AOFF_mm_arg_end 0x000000c0
+#define AOFF_mm_arg_end 0x000000c8
#define ASIZ_mm_arg_end 0x00000008
-#define AOFF_mm_env_start 0x000000c8
+#define AOFF_mm_env_start 0x000000d0
#define ASIZ_mm_env_start 0x00000008
-#define AOFF_mm_env_end 0x000000d0
+#define AOFF_mm_env_end 0x000000d8
#define ASIZ_mm_env_end 0x00000008
-#define AOFF_mm_rss 0x000000d8
+#define AOFF_mm_rss 0x000000e0
#define ASIZ_mm_rss 0x00000008
-#define AOFF_mm_total_vm 0x000000e0
+#define AOFF_mm_total_vm 0x000000e8
#define ASIZ_mm_total_vm 0x00000008
-#define AOFF_mm_locked_vm 0x000000e8
+#define AOFF_mm_locked_vm 0x000000f0
#define ASIZ_mm_locked_vm 0x00000008
-#define AOFF_mm_def_flags 0x000000f0
+#define AOFF_mm_def_flags 0x000000f8
#define ASIZ_mm_def_flags 0x00000008
-#define AOFF_mm_cpu_vm_mask 0x000000f8
+#define AOFF_mm_cpu_vm_mask 0x00000100
#define ASIZ_mm_cpu_vm_mask 0x00000008
-#define AOFF_mm_swap_cnt 0x00000100
+#define AOFF_mm_swap_cnt 0x00000108
#define ASIZ_mm_swap_cnt 0x00000008
-#define AOFF_mm_swap_address 0x00000108
+#define AOFF_mm_swap_address 0x00000110
#define ASIZ_mm_swap_address 0x00000008
-#define AOFF_mm_segments 0x00000110
+#define AOFF_mm_segments 0x00000118
#define ASIZ_mm_segments 0x00000008
-#define ASIZ_mm 0x00000118
+#define ASIZ_mm 0x00000120
#define AOFF_thread_ksp 0x00000000
#define ASIZ_thread_ksp 0x00000008
#define AOFF_thread_wstate 0x00000008
-#define ASIZ_thread_wstate 0x00000002
-#define AOFF_thread_cwp 0x0000000a
-#define ASIZ_thread_cwp 0x00000002
-#define AOFF_thread_flags 0x0000000c
-#define ASIZ_thread_flags 0x00000002
-#define AOFF_thread_current_ds 0x0000000e
+#define ASIZ_thread_wstate 0x00000001
+#define AOFF_thread_cwp 0x00000009
+#define ASIZ_thread_cwp 0x00000001
+#define AOFF_thread_flags 0x0000000a
+#define ASIZ_thread_flags 0x00000001
+#define AOFF_thread_current_ds 0x0000000b
#define ASIZ_thread_current_ds 0x00000001
-#define AOFF_thread_w_saved 0x00000010
-#define ASIZ_thread_w_saved 0x00000002
-#define AOFF_thread_new_signal 0x00000012
-#define ASIZ_thread_new_signal 0x00000002
-#define AOFF_thread_ctx 0x00000014
-#define ASIZ_thread_ctx 0x00000002
+#define AOFF_thread_w_saved 0x0000000c
+#define ASIZ_thread_w_saved 0x00000001
+#define AOFF_thread_fpdepth 0x0000000d
+#define ASIZ_thread_fpdepth 0x00000001
+#define AOFF_thread_fpsaved 0x0000000e
+#define ASIZ_thread_fpsaved 0x00000007
+#define AOFF_thread___pad1 0x00000015
+#define ASIZ_thread___pad1 0x00000003
#define AOFF_thread_kregs 0x00000018
#define ASIZ_thread_kregs 0x00000008
#define AOFF_thread_utraps 0x00000020
#define ASIZ_thread_utraps 0x00000008
-#define AOFF_thread_fpdepth 0x00000028
-#define ASIZ_thread_fpdepth 0x00000001
-#define AOFF_thread_fpsaved 0x00000029
-#define ASIZ_thread_fpsaved 0x00000007
-#define AOFF_thread_gsr 0x00000030
+#define AOFF_thread_gsr 0x00000028
#define ASIZ_thread_gsr 0x00000007
-#define AOFF_thread_xfsr 0x00000038
+#define AOFF_thread___pad2 0x0000002f
+#define ASIZ_thread___pad2 0x00000001
+#define AOFF_thread_sig_address 0x00000030
+#define ASIZ_thread_sig_address 0x00000008
+#define AOFF_thread_sig_desc 0x00000038
+#define ASIZ_thread_sig_desc 0x00000008
+#define AOFF_thread_xfsr 0x00000040
#define ASIZ_thread_xfsr 0x00000038
-#define AOFF_thread_reg_window 0x00000070
+#define AOFF_thread___pad3 0x00000078
+#define ASIZ_thread___pad3 0x00000008
+#define AOFF_thread_reg_window 0x00000080
#define ASIZ_thread_reg_window 0x00000380
-#define AOFF_thread_rwbuf_stkptrs 0x000003f0
+#define AOFF_thread_rwbuf_stkptrs 0x00000400
#define ASIZ_thread_rwbuf_stkptrs 0x00000038
-#define AOFF_thread_sig_address 0x00000428
-#define ASIZ_thread_sig_address 0x00000008
-#define AOFF_thread_sig_desc 0x00000430
-#define ASIZ_thread_sig_desc 0x00000008
#define AOFF_thread_user_cntd0 0x00000438
#define ASIZ_thread_user_cntd0 0x00000008
#define AOFF_thread_user_cntd1 0x00000440
diff --git a/include/asm-sparc64/audioio.h b/include/asm-sparc64/audioio.h
index 01bebaf73..cb9a213a3 100644
--- a/include/asm-sparc64/audioio.h
+++ b/include/asm-sparc64/audioio.h
@@ -299,6 +299,8 @@ struct sparcaudio_driver
/* Hack to make it look like we support variable size buffers. */
int buffer_size;
+
+ int mixer_modify_counter;
};
struct sparcaudio_operations
@@ -432,23 +434,6 @@ extern int cs4231_init(void);
#endif
-/* Mixer helper ioctls */
-#define right(a) (((a >> 8) & 0xff) % 101)
-#define left(a) ((a & 0xff) % 101)
-
-/* Macros to convert between mixer stereo volumes and gain (mono) */
-#define s_to_m(a) ((((left(a) + right(a)) * 255) / 200) % 256)
-#define m_to_s(a) ((a * 100 / 255) + ((a * 100 / 255) << 8))
-
-/* convert mixer stereo volume to balance */
-#define s_to_b(a) (s_to_g(a) == 0) ? 32 : ((left(a) * AUDIO_RIGHT_BALANCE / (left(a) + right(a))))
-
-/* convert mixer stereo volume to audio gain */
-#define s_to_g(a) ((((right(a) + left(a)) * 255) / 200) % 256)
-
-/* convert gain a and balance b to mixer volume */
-#define b_to_s(a,b) (((((b * a * 200) / (AUDIO_RIGHT_BALANCE * 255)) % 100) << 8) + ((((AUDIO_RIGHT_BALANCE - b) * a * 200) / (AUDIO_RIGHT_BALANCE * 255)) % 100))
-
/* Device minor numbers */
#define SPARCAUDIO_MIXER_MINOR 0
@@ -514,4 +499,147 @@ struct stdata
#define I_GETSIG _IOR('S',012,int)
#define I_GETSIG_SOLARIS (('S'<<8)|12)
-#endif
+
+/* Conversion between Sun and OSS volume settings */
+static __inline__
+int OSS_LEFT(int value)
+{
+ return ((value & 0xff) % 101);
+}
+
+static __inline__
+int OSS_RIGHT(int value)
+{
+ return (((value >> 8) & 0xff) % 101);
+}
+
+static __inline__
+int O_TO_S(int value)
+{
+ return value * 255 / 100;
+}
+
+static __inline__
+int S_TO_O(int value)
+{
+ return value * 100 / 255;
+}
+
+static __inline__
+int OSS_TO_GAIN(int value)
+{
+ int l = O_TO_S(OSS_LEFT(value));
+ int r = O_TO_S(OSS_RIGHT(value));
+ return ((l > r) ? l : r);
+}
+
+static __inline__
+int OSS_TO_LGAIN(int value)
+{
+ int l = O_TO_S(OSS_LEFT(value));
+ int r = O_TO_S(OSS_RIGHT(value));
+ return ((l < r) ? l : r);
+}
+
+static __inline__
+int OSS_TO_BAL(int value)
+{
+ if (!OSS_TO_GAIN(value))
+ return AUDIO_MID_BALANCE;
+ if (!OSS_TO_LGAIN(value)) {
+ if (OSS_TO_GAIN(value) == OSS_TO_GAIN(OSS_RIGHT(value)))
+ return AUDIO_RIGHT_BALANCE;
+ else
+ return AUDIO_LEFT_BALANCE;
+ }
+ if (OSS_TO_GAIN(value) == OSS_TO_GAIN(OSS_RIGHT(value)))
+ return ((OSS_TO_GAIN(value) - OSS_TO_LGAIN(value)) >> AUDIO_BALANCE_SHIFT)
+ + AUDIO_MID_BALANCE;
+ else
+ return AUDIO_MID_BALANCE - ((OSS_TO_GAIN(value) - OSS_TO_LGAIN(value))
+ >> AUDIO_BALANCE_SHIFT);
+}
+
+static __inline__
+int BAL_TO_OSS(int value, unsigned char balance)
+{
+ int l, r, adj;
+ if (balance > 63) balance = 63;
+ if (balance < AUDIO_MID_BALANCE) {
+ l = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
+ adj = ((AUDIO_MID_BALANCE - balance) << AUDIO_BALANCE_SHIFT);
+ if (adj < value)
+ r = (int)(value - adj)
+ * 100 / 255;
+ else r = 0;
+ } else if (balance > AUDIO_MID_BALANCE) {
+ r = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
+ adj = ((balance - AUDIO_MID_BALANCE) << AUDIO_BALANCE_SHIFT);
+ if (adj < value)
+ l = (int)(value - adj)
+ * 100 / 255;
+ else l = 0;
+ } else {
+ l = r = (int)value * 100 / 255 + ((value * 100 % 255) > 0);
+ }
+
+ return ((r << 8) + l);
+}
+
+/* OSS mixer ioctl port handling */
+static __inline__
+int OSS_PORT_AUDIO(struct sparcaudio_driver *drv, unsigned int set)
+{
+ int p;
+ if (drv->ops->get_output_port) {
+ p = drv->ops->get_output_port(drv);
+ if (p & set)
+ return 0x6464;
+ }
+ return 0;
+}
+
+static __inline__
+int OSS_IPORT_AUDIO(struct sparcaudio_driver *drv, unsigned int set)
+{
+ int p;
+ if (drv->ops->get_input_port) {
+ p = drv->ops->get_input_port(drv);
+ if (p & set)
+ return 0x6464;
+ }
+ return 0;
+}
+
+static __inline__
+void OSS_TWIDDLE_PORT(struct sparcaudio_driver *drv, unsigned int ioctl,
+ unsigned int port, unsigned int set, unsigned int value)
+{
+ if (ioctl == port) {
+ int p;
+ if (drv->ops->get_output_port && drv->ops->set_output_port) {
+ p = drv->ops->get_output_port(drv);
+ if ((value == 0) || ((p & set) && (OSS_LEFT(value) < 100)))
+ drv->ops->set_output_port(drv, p & ~(set));
+ else
+ drv->ops->set_output_port(drv, p | set);
+ }
+ }
+}
+
+static __inline__
+void OSS_TWIDDLE_IPORT(struct sparcaudio_driver *drv, unsigned int ioctl,
+ unsigned int port, unsigned int set, unsigned int value)
+{
+ if (ioctl == port) {
+ int p;
+ if (drv->ops->get_input_port && drv->ops->set_input_port) {
+ p = drv->ops->get_input_port(drv);
+ if ((value == 0) || ((p & set) && (OSS_LEFT(value) < 100)))
+ drv->ops->set_input_port(drv, p & ~(set));
+ else
+ drv->ops->set_input_port(drv, p | set);
+ }
+ }
+}
+#endif /* _AUDIOIO_H_ */
diff --git a/include/asm-sparc64/cache.h b/include/asm-sparc64/cache.h
index bc40fe99d..216b665f2 100644
--- a/include/asm-sparc64/cache.h
+++ b/include/asm-sparc64/cache.h
@@ -11,4 +11,12 @@
#define SMP_CACHE_BYTES 64 /* L2 cache line size. */
+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(SMP_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
#endif
diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h
index 5308186e7..519074118 100644
--- a/include/asm-sparc64/checksum.h
+++ b/include/asm-sparc64/checksum.h
@@ -1,4 +1,4 @@
-/* $Id: checksum.h,v 1.12 1999/05/25 16:53:36 jj Exp $ */
+/* $Id: checksum.h,v 1.13 1999/07/30 09:31:13 davem Exp $ */
#ifndef __SPARC64_CHECKSUM_H
#define __SPARC64_CHECKSUM_H
@@ -50,7 +50,7 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len,
unsigned int sum)
{
int ret;
- unsigned char cur_ds = current->tss.current_ds.seg;
+ unsigned char cur_ds = current->thread.current_ds.seg;
__asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "i" (ASI_P));
ret = csum_partial_copy_sparc64(src, dst, len, sum);
__asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" (cur_ds));
diff --git a/include/asm-sparc64/dma.h b/include/asm-sparc64/dma.h
index a0980bc30..b21cbcc9f 100644
--- a/include/asm-sparc64/dma.h
+++ b/include/asm-sparc64/dma.h
@@ -1,4 +1,4 @@
-/* $Id: dma.h,v 1.13 1998/12/16 04:33:55 davem Exp $
+/* $Id: dma.h,v 1.16 1999/09/10 10:44:32 davem Exp $
* include/asm-sparc64/dma.h
*
* Copyright 1996 (C) David S. Miller (davem@caip.rutgers.edu)
@@ -7,13 +7,14 @@
#ifndef _ASM_SPARC64_DMA_H
#define _ASM_SPARC64_DMA_H
+#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/types.h>
+#include <linux/spinlock.h>
#include <asm/sbus.h>
#include <asm/delay.h>
#include <asm/oplib.h>
-#include <asm/spinlock.h>
extern spinlock_t dma_spin_lock;
@@ -188,4 +189,12 @@ extern int get_dma_list(char *);
extern int request_dma(unsigned int, __const__ char *);
extern void free_dma(unsigned int);
+/* From PCI */
+
+#ifdef CONFIG_PCI
+extern int isa_dma_bridge_buggy;
+#else
+#define isa_dma_bridge_buggy (0)
+#endif
+
#endif /* !(_ASM_SPARC64_DMA_H) */
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index 8724757c7..7910d03ae 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -1,12 +1,14 @@
-/* $Id: ebus.h,v 1.8 1998/05/07 21:00:27 ecd Exp $
+/* $Id: ebus.h,v 1.9 1999/08/30 10:14:37 davem Exp $
* ebus.h: PCI to Ebus pseudo driver software state.
*
* Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
+ * Copyright (C) 1999 David S. Miller (davem@redhat.com)
*/
#ifndef __SPARC64_EBUS_H
#define __SPARC64_EBUS_H
+#include <asm/pbm.h>
#include <asm/oplib.h>
struct linux_ebus_child {
@@ -15,7 +17,7 @@ struct linux_ebus_child {
struct linux_ebus *bus;
int prom_node;
char prom_name[64];
- unsigned long base_address[PROMREG_MAX];
+ struct resource resource[PROMREG_MAX];
int num_addrs;
unsigned int irqs[PROMINTR_MAX];
int num_irqs;
@@ -27,7 +29,7 @@ struct linux_ebus_device {
struct linux_ebus *bus;
int prom_node;
char prom_name[64];
- unsigned long base_address[PROMREG_MAX];
+ struct resource resource[PROMREG_MAX];
int num_addrs;
unsigned int irqs[PROMINTR_MAX];
int num_irqs;
@@ -36,8 +38,9 @@ struct linux_ebus_device {
struct linux_ebus {
struct linux_ebus *next;
struct linux_ebus_device *devices;
- struct linux_pbm_info *parent;
+ struct pci_pbm_info *parent;
struct pci_dev *self;
+ int index;
int prom_node;
char prom_name[64];
struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h
index e0db514fc..6fc6c3c03 100644
--- a/include/asm-sparc64/elf.h
+++ b/include/asm-sparc64/elf.h
@@ -1,4 +1,4 @@
-/* $Id: elf.h,v 1.19 1999/06/11 13:26:04 jj Exp $ */
+/* $Id: elf.h,v 1.21 1999/08/04 07:04:23 jj Exp $ */
#ifndef __ASM_SPARC64_ELF_H
#define __ASM_SPARC64_ELF_H
@@ -48,7 +48,7 @@ typedef struct {
that it will "exec", and that there is sufficient room for the brk. */
#ifndef ELF_ET_DYN_BASE
-#define ELF_ET_DYN_BASE 0x50000000000
+#define ELF_ET_DYN_BASE 0xfffff80000000000UL
#endif
@@ -67,17 +67,30 @@ typedef struct {
#define ELF_PLATFORM (NULL)
#ifdef __KERNEL__
-#define SET_PERSONALITY(ex, ibcs2) \
-do { \
- if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
- current->tss.flags |= SPARC_FLAG_32BIT; \
- else \
- current->tss.flags &= ~SPARC_FLAG_32BIT; \
- \
- if (ibcs2) \
- current->personality = PER_SVR4; \
- else if (current->personality != PER_LINUX32) \
- current->personality = PER_LINUX; \
+#define SET_PERSONALITY(ex, ibcs2) \
+do { unsigned char flags = current->thread.flags; \
+ if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
+ flags |= SPARC_FLAG_32BIT; \
+ else \
+ flags &= ~SPARC_FLAG_32BIT; \
+ if (flags != current->thread.flags) { \
+ unsigned long pgd_cache = 0UL; \
+ if (flags & SPARC_FLAG_32BIT) \
+ pgd_cache = \
+ pgd_val(current->mm->pgd[0])<<11UL; \
+ __asm__ __volatile__( \
+ "stxa\t%0, [%1] %2" \
+ : /* no outputs */ \
+ : "r" (pgd_cache), \
+ "r" (TSB_REG), \
+ "i" (ASI_DMMU)); \
+ current->thread.flags = flags; \
+ } \
+ \
+ if (ibcs2) \
+ current->personality = PER_SVR4; \
+ else if (current->personality != PER_LINUX32) \
+ current->personality = PER_LINUX; \
} while (0)
#endif
diff --git a/include/asm-sparc64/fbio.h b/include/asm-sparc64/fbio.h
index 6f45ce973..3f5f3c81f 100644
--- a/include/asm-sparc64/fbio.h
+++ b/include/asm-sparc64/fbio.h
@@ -35,6 +35,8 @@
/* Does not seem to be listed in the Sun file either */
#define FBTYPE_CREATOR 22
+#define FBTYPE_PCI_IGA1682 23
+#define FBTYPE_P9100COLOR 24
#define FBTYPE_PCI_GENERIC 1000
#define FBTYPE_PCI_MACH64 1001
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 80b58af20..d6d292f7d 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -289,16 +289,19 @@ extern void floppy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static unsigned char sun_pci_fd_inb(unsigned long port)
{
+ udelay(5);
return inb(port);
}
static void sun_pci_fd_outb(unsigned char val, unsigned long port)
{
+ udelay(5);
outb(val, port);
}
static void sun_pci_fd_broken_outb(unsigned char val, unsigned long port)
{
+ udelay(5);
/*
* XXX: Due to SUN's broken floppy connector on AX and AXi
* we need to turn on MOTOR_0 also, if the floppy is
@@ -317,6 +320,7 @@ static void sun_pci_fd_broken_outb(unsigned char val, unsigned long port)
#ifdef PCI_FDC_SWAP_DRIVES
static void sun_pci_fd_lde_broken_outb(unsigned char val, unsigned long port)
{
+ udelay(5);
/*
* XXX: Due to SUN's broken floppy connector on AX and AXi
* we need to turn on MOTOR_0 also, if the floppy is
@@ -339,9 +343,9 @@ static void sun_pci_fd_reset_dma(void)
unsigned int dcsr;
writel(EBUS_DCSR_RESET, &sun_pci_fd_ebus_dma->dcsr);
-
+ udelay(1);
dcsr = EBUS_DCSR_BURST_SZ_16 | EBUS_DCSR_TCI_DIS |
- EBUS_DCSR_EN_CNT | EBUS_DCSR_INT_EN;
+ EBUS_DCSR_EN_CNT;
writel(dcsr, (unsigned long)&sun_pci_fd_ebus_dma->dcsr);
}
@@ -359,12 +363,19 @@ static void sun_pci_fd_disable_dma(void)
unsigned int dcsr;
dcsr = readl(&sun_pci_fd_ebus_dma->dcsr);
- while (dcsr & EBUS_DCSR_DRAIN)
- dcsr = readl(&sun_pci_fd_ebus_dma->dcsr);
- dcsr &= ~(EBUS_DCSR_EN_DMA);
- if (dcsr & EBUS_DCSR_ERR_PEND)
- sun_pci_fd_reset_dma();
- writel(dcsr, &sun_pci_fd_ebus_dma->dcsr);
+ if (dcsr & EBUS_DCSR_EN_DMA) {
+ while (dcsr & EBUS_DCSR_DRAIN) {
+ udelay(1);
+ dcsr = readl(&sun_pci_fd_ebus_dma->dcsr);
+ }
+ dcsr &= ~(EBUS_DCSR_EN_DMA);
+ writel(dcsr, &sun_pci_fd_ebus_dma->dcsr);
+ if (dcsr & EBUS_DCSR_ERR_PEND) {
+ sun_pci_fd_reset_dma();
+ dcsr &= ~(EBUS_DCSR_ERR_PEND);
+ writel(dcsr, &sun_pci_fd_ebus_dma->dcsr);
+ }
+ }
}
static void sun_pci_fd_set_dma_mode(int mode)
@@ -372,6 +383,11 @@ static void sun_pci_fd_set_dma_mode(int mode)
unsigned int dcsr;
dcsr = readl(&sun_pci_fd_ebus_dma->dcsr);
+ if (readl(&sun_pci_fd_ebus_dma->dbcr)) {
+ sun_pci_fd_reset_dma();
+ writel(dcsr, &sun_pci_fd_ebus_dma->dcsr);
+ }
+
dcsr |= EBUS_DCSR_EN_CNT | EBUS_DCSR_TC;
/*
* For EBus WRITE means to system memory, which is
@@ -397,7 +413,15 @@ static void sun_pci_fd_set_dma_addr(char *buffer)
static unsigned int sun_pci_get_dma_residue(void)
{
- return readl(&sun_pci_fd_ebus_dma->dbcr);
+ unsigned int dcsr, res;
+
+ res = readl(&sun_pci_fd_ebus_dma->dbcr);
+ if (res != 0) {
+ dcsr = readl(&sun_pci_fd_ebus_dma->dcsr);
+ sun_pci_fd_reset_dma();
+ writel(dcsr, &sun_pci_fd_ebus_dma->dcsr);
+ }
+ return res;
}
static void sun_pci_fd_enable_irq(void)
@@ -538,7 +562,7 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive)
static struct linux_prom_registers fd_regs[2];
-__initfunc(static unsigned long sun_floppy_init(void))
+static unsigned long __init sun_floppy_init(void)
{
char state[128];
int fd_node, num_regs;
@@ -561,6 +585,9 @@ __initfunc(static unsigned long sun_floppy_init(void))
#ifdef CONFIG_PCI
struct linux_ebus *ebus;
struct linux_ebus_device *edev = 0;
+ unsigned long config = 0;
+ unsigned long auxio_reg;
+ unsigned char cfg;
for_each_ebus(ebus) {
for_each_ebusdev(edev, ebus) {
@@ -577,20 +604,17 @@ __initfunc(static unsigned long sun_floppy_init(void))
if(!strncmp(state, "disabled", 8))
return 0;
- if (check_region(edev->base_address[1],
- sizeof(struct linux_ebus_dma))) {
- printk("sun_floppy_init: can't get region at %016lx\n",
- edev->base_address[1]);
- return 0;
- }
- request_region(edev->base_address[1],
- sizeof(struct linux_ebus_dma), "floppy DMA");
-
- sun_fdc = (struct sun_flpy_controller *)edev->base_address[0];
+ sun_fdc = (struct sun_flpy_controller *)edev->resource[0].start;
FLOPPY_IRQ = edev->irqs[0];
+ /* Make sure the high density bit is set, some systems
+ * (most notably Ultra5/Ultra10) come up with it clear.
+ */
+ auxio_reg = edev->resource[2].start;
+ writel(readl(auxio_reg)|0x2, auxio_reg);
+
sun_pci_fd_ebus_dma = (struct linux_ebus_dma *)
- edev->base_address[1];
+ edev->resource[1].start;
sun_pci_fd_reset_dma();
sun_fdops.fd_inb = sun_pci_fd_inb;
@@ -628,57 +652,62 @@ __initfunc(static unsigned long sun_floppy_init(void))
if (sun_pci_fd_test_drive((unsigned long)sun_fdc, 1))
sun_floppy_types[1] = 4;
-#ifdef PCI_FDC_SWAP_DRIVES
/*
- * If only Floppy 1 is present, swap drives.
+ * Find NS87303 SuperIO config registers (through ecpp).
*/
- if (!sun_floppy_types[0] && sun_floppy_types[1]) {
- unsigned long config = 0;
- unsigned char tmp;
-
- for_each_ebus(ebus) {
- for_each_ebusdev(edev, ebus) {
- if (!strcmp(edev->prom_name, "ecpp")) {
- config = edev->base_address[1];
- goto config_done;
- }
+ for_each_ebus(ebus) {
+ for_each_ebusdev(edev, ebus) {
+ if (!strcmp(edev->prom_name, "ecpp")) {
+ config = edev->resource[1].start;
+ goto config_done;
}
}
- config_done:
+ }
+ config_done:
- /*
- * Sanity check, is this really the NS87303?
- */
- switch (config & 0x3ff) {
- case 0x02e:
- case 0x15c:
- case 0x26e:
- case 0x398:
- break;
- default:
- config = 0;
- }
+ /*
+ * Sanity check, is this really the NS87303?
+ */
+ switch (config & 0x3ff) {
+ case 0x02e:
+ case 0x15c:
+ case 0x26e:
+ case 0x398:
+ break;
+ default:
+ config = 0;
+ }
+
+ if (!config)
+ return sun_floppy_types[0];
- if (!config)
- return sun_floppy_types[0];
+ /* Enable PC-AT mode. */
+ cfg = ns87303_readb(config, ASC);
+ cfg |= 0xc0;
+ ns87303_writeb(config, ASC, cfg);
+#ifdef PCI_FDC_SWAP_DRIVES
+ /*
+ * If only Floppy 1 is present, swap drives.
+ */
+ if (!sun_floppy_types[0] && sun_floppy_types[1]) {
/*
* Set the drive exchange bit in FCR on NS87303,
* make shure other bits are sane before doing so.
*/
- tmp = ns87303_readb(config, FER);
- tmp &= ~(FER_EDM);
- ns87303_writeb(config, FER, tmp);
- tmp = ns87303_readb(config, ASC);
- tmp &= ~(ASC_DRV2_SEL);
- ns87303_writeb(config, ASC, tmp);
- tmp = ns87303_readb(config, FCR);
- tmp |= FCR_LDE;
- ns87303_writeb(config, FCR, tmp);
-
- tmp = sun_floppy_types[0];
+ cfg = ns87303_readb(config, FER);
+ cfg &= ~(FER_EDM);
+ ns87303_writeb(config, FER, cfg);
+ cfg = ns87303_readb(config, ASC);
+ cfg &= ~(ASC_DRV2_SEL);
+ ns87303_writeb(config, ASC, cfg);
+ cfg = ns87303_readb(config, FCR);
+ cfg |= FCR_LDE;
+ ns87303_writeb(config, FCR, cfg);
+
+ cfg = sun_floppy_types[0];
sun_floppy_types[0] = sun_floppy_types[1];
- sun_floppy_types[1] = tmp;
+ sun_floppy_types[1] = cfg;
if (sun_pci_broken_drive != -1) {
sun_pci_broken_drive = 1 - sun_pci_broken_drive;
diff --git a/include/asm-sparc64/hardirq.h b/include/asm-sparc64/hardirq.h
index 6ab9ef7ec..7df1d1346 100644
--- a/include/asm-sparc64/hardirq.h
+++ b/include/asm-sparc64/hardirq.h
@@ -6,7 +6,7 @@
#ifndef __SPARC64_HARDIRQ_H
#define __SPARC64_HARDIRQ_H
-#include <linux/tasks.h>
+#include <linux/threads.h>
#ifndef __SMP__
extern unsigned int local_irq_count;
@@ -33,7 +33,7 @@ extern unsigned int local_irq_count;
#else /* (__SMP__) */
#include <asm/atomic.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#include <asm/system.h>
#include <asm/smp.h>
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h
index c8db43d59..0f6d0de23 100644
--- a/include/asm-sparc64/ide.h
+++ b/include/asm-sparc64/ide.h
@@ -1,4 +1,4 @@
-/* $Id: ide.h,v 1.14 1999/05/15 05:02:35 davem Exp $
+/* $Id: ide.h,v 1.16 1999/08/30 10:14:42 davem Exp $
* ide.h: Ultra/PCI specific IDE glue.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -10,6 +10,7 @@
#ifdef __KERNEL__
+#include <linux/config.h>
#include <asm/pgtable.h>
#include <asm/io.h>
#include <asm/hdreg.h>
@@ -53,7 +54,7 @@ static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
*/
static __inline__ void ide_init_default_hwifs(void)
{
-#ifdef __DO_I_NEED_THIS
+#ifndef CONFIG_BLK_DEV_IDEPCI
hw_regs_t hw;
int index;
@@ -62,7 +63,7 @@ static __inline__ void ide_init_default_hwifs(void)
hw.irq = ide_default_irq(ide_default_io_base(index));
ide_register_hw(&hw, NULL);
}
-#endif /* __DO_I_NEED_THIS */
+#endif /* CONFIG_BLK_DEV_IDEPCI */
}
typedef union {
@@ -134,50 +135,62 @@ static __inline__ void ide_release_region(ide_ioreg_t base, unsigned int size)
#define insw(port, buf, nr) ide_insw((port), (buf), (nr))
#define outsw(port, buf, nr) ide_outsw((port), (buf), (nr))
+static __inline__ unsigned int inw_be(unsigned long addr)
+{
+ unsigned int ret;
+
+ __asm__ __volatile__("lduha [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
+
+ return ret;
+}
+
static __inline__ void ide_insw(unsigned long port,
void *dst,
unsigned long count)
{
- volatile unsigned short *data_port;
unsigned long end = (unsigned long)dst + (count << 1);
u16 *ps = dst;
u32 *pi;
- data_port = (volatile unsigned short *)port;
-
if(((u64)ps) & 0x2) {
- *ps++ = *data_port;
+ *ps++ = inw_be(port);
count--;
}
pi = (u32 *)ps;
while(count >= 2) {
u32 w;
- w = (*data_port) << 16;
- w |= (*data_port);
+ w = inw_be(port) << 16;
+ w |= inw_be(port);
*pi++ = w;
count -= 2;
}
ps = (u16 *)pi;
if(count)
- *ps++ = *data_port;
+ *ps++ = inw_be(port);
__flush_dcache_range((unsigned long)dst, end);
}
+static __inline__ void outw_be(unsigned short w, unsigned long addr)
+{
+ __asm__ __volatile__("stha %0, [%1] %2"
+ : /* no outputs */
+ : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
+}
+
static __inline__ void ide_outsw(unsigned long port,
const void *src,
unsigned long count)
{
- volatile unsigned short *data_port;
unsigned long end = (unsigned long)src + (count << 1);
const u16 *ps = src;
const u32 *pi;
- data_port = (volatile unsigned short *)port;
-
if(((u64)src) & 0x2) {
- *data_port = *ps++;
+ outw_be(*ps++, port);
count--;
}
pi = (const u32 *)ps;
@@ -185,13 +198,13 @@ static __inline__ void ide_outsw(unsigned long port,
u32 w;
w = *pi++;
- *data_port = (w >> 16);
- *data_port = w;
+ outw_be((w >> 16), port);
+ outw_be(w, port);
count -= 2;
}
ps = (const u16 *)pi;
if(count)
- *data_port = *ps;
+ outw_be(*ps, port);
__flush_dcache_range((unsigned long)src, end);
}
diff --git a/include/asm-sparc64/init.h b/include/asm-sparc64/init.h
index 4aec3125a..17d215574 100644
--- a/include/asm-sparc64/init.h
+++ b/include/asm-sparc64/init.h
@@ -1,16 +1 @@
-#ifndef _SPARC_INIT_H
-#define _SPARC_INIT_H
-
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
-/* For assembly routines */
-#define __INIT .section ".text.init",#alloc,#execinstr
-#define __FINIT .previous
-#define __INITDATA .section ".data.init",#alloc,#write
-
-#define __cacheline_aligned __attribute__ ((aligned (64)))
-
-#endif
+#error "<asm/init.h> should never be used - use <linux/init.h> instead"
diff --git a/include/asm-sparc64/io.h b/include/asm-sparc64/io.h
index c80345840..254babf91 100644
--- a/include/asm-sparc64/io.h
+++ b/include/asm-sparc64/io.h
@@ -1,4 +1,4 @@
-/* $Id: io.h,v 1.20 1999/05/14 07:23:18 davem Exp $ */
+/* $Id: io.h,v 1.24 1999/09/06 01:17:54 davem Exp $ */
#ifndef __SPARC64_IO_H
#define __SPARC64_IO_H
@@ -16,9 +16,6 @@
#define PCI_DVMA_HASHSZ 256
-extern unsigned long pci_dvma_offset;
-extern unsigned long pci_dvma_mask;
-
extern unsigned long pci_dvma_v2p_hash[PCI_DVMA_HASHSZ];
extern unsigned long pci_dvma_p2v_hash[PCI_DVMA_HASHSZ];
@@ -49,11 +46,13 @@ extern __inline__ void *phys_to_virt(unsigned long addr)
#define virt_to_bus virt_to_phys
#define bus_to_virt phys_to_virt
-extern __inline__ unsigned long bus_dvma_to_mem(unsigned long vaddr)
-{
- return vaddr & pci_dvma_mask;
-}
+/* Different PCI controllers we support have their PCI MEM space
+ * mapped to an either 2GB (Psycho) or 4GB (Sabre) aligned area,
+ * so need to chop off the top 33 or 32 bits.
+ */
+extern unsigned long pci_memspace_mask;
+#define bus_dvma_to_mem(__vaddr) ((__vaddr) & pci_memspace_mask)
extern __inline__ unsigned int inb(unsigned long addr)
{
@@ -61,7 +60,7 @@ extern __inline__ unsigned int inb(unsigned long addr)
__asm__ __volatile__("lduba [%1] %2, %0"
: "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
+ : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
return ret;
}
@@ -72,7 +71,7 @@ extern __inline__ unsigned int inw(unsigned long addr)
__asm__ __volatile__("lduha [%1] %2, %0"
: "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
+ : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
return ret;
}
@@ -83,7 +82,7 @@ extern __inline__ unsigned int inl(unsigned long addr)
__asm__ __volatile__("lduwa [%1] %2, %0"
: "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
+ : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
return ret;
}
@@ -92,21 +91,21 @@ extern __inline__ void outb(unsigned char b, unsigned long addr)
{
__asm__ __volatile__("stba %0, [%1] %2"
: /* no outputs */
- : "r" (b), "r" (addr), "i" (ASI_PL));
+ : "r" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
}
extern __inline__ void outw(unsigned short w, unsigned long addr)
{
__asm__ __volatile__("stha %0, [%1] %2"
: /* no outputs */
- : "r" (w), "r" (addr), "i" (ASI_PL));
+ : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
}
extern __inline__ void outl(unsigned int l, unsigned long addr)
{
__asm__ __volatile__("stwa %0, [%1] %2"
: /* no outputs */
- : "r" (l), "r" (addr), "i" (ASI_PL));
+ : "r" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
}
#define inb_p inb
@@ -120,12 +119,66 @@ extern void insw(unsigned long addr, void *dst, unsigned long count);
extern void insl(unsigned long addr, void *dst, unsigned long count);
/* Memory functions, same as I/O accesses on Ultra. */
-#define readb(addr) inb((unsigned long)(addr))
-#define readw(addr) inw((unsigned long)(addr))
-#define readl(addr) inl((unsigned long)(addr))
-#define writeb(b, addr) outb((b), (unsigned long)(addr))
-#define writew(w, addr) outw((w), (unsigned long)(addr))
-#define writel(l, addr) outl((l), (unsigned long)(addr))
+extern __inline__ unsigned int _readb(unsigned long addr)
+{
+ unsigned int ret;
+
+ __asm__ __volatile__("lduba [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
+
+ return ret;
+}
+
+extern __inline__ unsigned int _readw(unsigned long addr)
+{
+ unsigned int ret;
+
+ __asm__ __volatile__("lduha [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
+
+ return ret;
+}
+
+extern __inline__ unsigned int _readl(unsigned long addr)
+{
+ unsigned int ret;
+
+ __asm__ __volatile__("lduwa [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
+
+ return ret;
+}
+
+extern __inline__ void _writeb(unsigned char b, unsigned long addr)
+{
+ __asm__ __volatile__("stba %0, [%1] %2"
+ : /* no outputs */
+ : "r" (b), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
+}
+
+extern __inline__ void _writew(unsigned short w, unsigned long addr)
+{
+ __asm__ __volatile__("stha %0, [%1] %2"
+ : /* no outputs */
+ : "r" (w), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
+}
+
+extern __inline__ void _writel(unsigned int l, unsigned long addr)
+{
+ __asm__ __volatile__("stwa %0, [%1] %2"
+ : /* no outputs */
+ : "r" (l), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E_L));
+}
+
+#define readb(__addr) (_readb((unsigned long)(__addr)))
+#define readw(__addr) (_readw((unsigned long)(__addr)))
+#define readl(__addr) (_readl((unsigned long)(__addr)))
+#define writeb(__b, __addr) (_writeb((__b), (unsigned long)(__addr)))
+#define writew(__w, __addr) (_writew((__w), (unsigned long)(__addr)))
+#define writel(__l, __addr) (_writel((__l), (unsigned long)(__addr)))
/*
* Memcpy to/from I/O space is just a regular memory operation on
@@ -190,19 +243,11 @@ out:
return retval;
}
-/*
- * On the sparc we have the whole physical IO address space mapped at all
- * times, so ioremap() and iounmap() do not need to do anything.
+/* On sparc64 we have the whole physical IO address space accessible
+ * using physically addressed loads and stores, so this does nothing.
*/
-extern __inline__ void *ioremap(unsigned long offset, unsigned long size)
-{
- return __va(offset);
-}
-
-extern __inline__ void iounmap(void *addr)
-{
-}
-
+#define ioremap(__offset, __size) ((void *)(__offset))
+#define iounmap(__addr) do { } while(0)
extern void sparc_ultra_mapioaddr(unsigned long physaddr,
unsigned long virt_addr,
diff --git a/include/asm-sparc64/iommu.h b/include/asm-sparc64/iommu.h
index d74f3fc85..9c21b9dc3 100644
--- a/include/asm-sparc64/iommu.h
+++ b/include/asm-sparc64/iommu.h
@@ -5,9 +5,9 @@
#ifndef _SPARC64_IOMMU_H
#define _SPARC64_IOMMU_H
+#include <linux/spinlock.h>
#include <asm/page.h>
#include <asm/sysio.h>
-#include <asm/spinlock.h>
/* The iommu handles all virtual to physical address translations
* that occur between the SYSIO and physical memory. Access by
@@ -39,7 +39,8 @@
#define IOPTE_64K 0x2000000000000000 /* IOPTE is for 64k page */
#define IOPTE_STBUF 0x1000000000000000 /* DVMA can use streaming buffer */
#define IOPTE_INTRA 0x0800000000000000 /* SBUS slot-->slot direct transfer */
-#define IOPTE_PAGE 0x000001ffffffe000 /* Physical page number (PA[40:13]) */
+#define IOPTE_CONTEXT 0x07ff800000000000 /* Context number */
+#define IOPTE_PAGE 0x00007fffffffe000 /* Physical page number (PA[40:13]) */
#define IOPTE_CACHE 0x0000000000000010 /* Cached (in UPA E-cache) */
#define IOPTE_WRITE 0x0000000000000002 /* Writeable */
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index bad6a838a..045ae8bc9 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -1,4 +1,4 @@
-/* $Id: irq.h,v 1.14 1998/12/19 11:05:41 davem Exp $
+/* $Id: irq.h,v 1.16 1999/09/06 01:17:52 davem Exp $
* irq.h: IRQ registers on the 64-bit Sparc.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -61,19 +61,27 @@ struct ino_bucket {
/*0x08*/void *irq_info;
/* Sun5 Interrupt Clear Register. */
-/*0x10*/unsigned int *iclr;
+/*0x10*/volatile unsigned int *iclr;
/* Sun5 Interrupt Mapping Register. */
-/*0x18*/unsigned int *imap;
+/*0x18*/volatile unsigned int *imap;
};
+/* Only 8-bits are available, be careful. -DaveM */
+#define IBF_DMA_SYNC 0x01 /* DMA synchronization behind PCI bridge needed. */
+#define IBF_PCI 0x02 /* Indicates PSYCHO/SABRE/SCHIZO PCI interrupt. */
+#define IBF_ACTIVE 0x04 /* This interrupt is active and has a handler. */
+#define IBF_MULTI 0x08 /* On PCI, indicates shared bucket. */
+
#define NUM_IVECS 8192
extern struct ino_bucket ivector_table[NUM_IVECS];
#define __irq_ino(irq) \
(((struct ino_bucket *)(unsigned long)(irq)) - &ivector_table[0])
#define __irq_pil(irq) ((struct ino_bucket *)(unsigned long)(irq))->pil
+#define __bucket(irq) ((struct ino_bucket *)(unsigned long)(irq))
+#define __irq(bucket) ((unsigned int)(unsigned long)(bucket))
static __inline__ char *__irq_itoa(unsigned int irq)
{
@@ -86,10 +94,11 @@ static __inline__ char *__irq_itoa(unsigned int irq)
#define NR_IRQS 15
extern void disable_irq(unsigned int);
+#define disable_irq_nosync disable_irq
extern void enable_irq(unsigned int);
extern void init_timers(void (*lvl10_irq)(int, void *, struct pt_regs *),
unsigned long *);
-extern unsigned int build_irq(int pil, int inofixup, unsigned int *iclr, unsigned int *imap);
+extern unsigned int build_irq(int pil, int inofixup, volatile unsigned int *iclr, volatile unsigned int *imap);
extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
extern unsigned int psycho_build_irq(void *psycho, int imap_off, int ino, int need_dma_sync);
diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index c9f984418..e19335be7 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -1,129 +1,147 @@
-/* $Id: mmu_context.h,v 1.36 1999/05/25 16:53:34 jj Exp $ */
+/* $Id: mmu_context.h,v 1.40 1999/09/10 10:44:37 davem Exp $ */
#ifndef __SPARC64_MMU_CONTEXT_H
#define __SPARC64_MMU_CONTEXT_H
/* Derived heavily from Linus's Alpha/AXP ASN code... */
+#include <linux/spinlock.h>
#include <asm/system.h>
#include <asm/spitfire.h>
-#include <asm/spinlock.h>
-
-#define NO_CONTEXT 0
#ifndef __ASSEMBLY__
+extern spinlock_t ctx_alloc_lock;
extern unsigned long tlb_context_cache;
extern unsigned long mmu_context_bmap[];
#define CTX_VERSION_SHIFT (PAGE_SHIFT - 3)
#define CTX_VERSION_MASK ((~0UL) << CTX_VERSION_SHIFT)
#define CTX_FIRST_VERSION ((1UL << CTX_VERSION_SHIFT) + 1UL)
+#define CTX_VALID(__ctx) \
+ (!(((__ctx) ^ tlb_context_cache) & CTX_VERSION_MASK))
+#define CTX_HWBITS(__ctx) ((__ctx) & ~CTX_VERSION_MASK)
extern void get_new_mmu_context(struct mm_struct *mm);
-/* Initialize/destroy the context related info for a new mm_struct
- * instance.
+/* Initialize a new mmu context. This is invoked when a new
+ * address space instance (unique or shared) is instantiated.
+ * A fresh mm_struct is cleared out to zeros, so this need not
+ * do anything on Sparc64 since the only thing we care about
+ * is that mm->context is an invalid context (ie. zero).
*/
-#define init_new_context(__mm) ((__mm)->context = NO_CONTEXT)
-
-/* Kernel threads like rpciod and nfsd drop their mm, and then use
- * init_mm, when this happens we must make sure the secondary context is
- * updated as well. Otherwise we have disasters relating to
- * set_fs/get_fs usage later on.
- *
- * Also we can only clear the mmu_context_bmap bit when this is
- * the final reference to the address space.
+#define init_new_context(__tsk, __mm) do { } while(0)
+
+/* Destroy a dead context. This occurs when mmput drops the
+ * mm_users count to zero, the mmaps have been released, and
+ * all the page tables have been flushed. Our job is to destroy
+ * any remaining processor-specific state, and in the sparc64
+ * case this just means freeing up the mmu context ID held by
+ * this task if valid.
*/
-#define destroy_context(__mm) do { \
- if ((__mm)->context != NO_CONTEXT && \
- atomic_read(&(__mm)->count) == 1) { \
- if (!(((__mm)->context ^ tlb_context_cache) & CTX_VERSION_MASK))\
- clear_bit((__mm)->context & ~(CTX_VERSION_MASK), \
- mmu_context_bmap); \
- (__mm)->context = NO_CONTEXT; \
- if(current->mm == (__mm)) { \
- current->tss.ctx = 0; \
- spitfire_set_secondary_context(0); \
- __asm__ __volatile__("flush %g6"); \
- } \
- } \
-} while (0)
-
-/* The caller must flush the current set of user windows
- * to the stack (if necessary) before we get here.
+#define destroy_context(__mm) \
+do { spin_lock(&ctx_alloc_lock); \
+ if (CTX_VALID((__mm)->context)) { \
+ unsigned long nr = CTX_HWBITS((__mm)->context); \
+ mmu_context_bmap[nr>>6] &= ~(1UL << (nr & 63)); \
+ } \
+ spin_unlock(&ctx_alloc_lock); \
+} while(0)
+
+/* Reload the two core values used by TLB miss handler
+ * processing on sparc64. They are:
+ * 1) The physical address of mm->pgd, when full page
+ * table walks are necessary, this is where the
+ * search begins.
+ * 2) A "PGD cache". For 32-bit tasks only pgd[0] is
+ * ever used since that maps the entire low 4GB
+ * completely. To speed up TLB miss processing we
+ * make this value available to the handlers. This
+ * decreases the amount of memory traffic incurred.
*/
-extern __inline__ void __get_mmu_context(struct task_struct *tsk)
+#define reload_tlbmiss_state(__tsk, __mm) \
+do { \
+ register unsigned long paddr asm("o5"); \
+ register unsigned long pgd_cache asm("o4"); \
+ paddr = __pa((__mm)->pgd); \
+ pgd_cache = 0UL; \
+ if ((__tsk)->thread.flags & SPARC_FLAG_32BIT) \
+ pgd_cache = pgd_val((__mm)->pgd[0]) << 11UL; \
+ __asm__ __volatile__("wrpr %%g0, 0x494, %%pstate\n\t" \
+ "mov %3, %%g4\n\t" \
+ "mov %0, %%g7\n\t" \
+ "stxa %1, [%%g4] %2\n\t" \
+ "wrpr %%g0, 0x096, %%pstate" \
+ : /* no outputs */ \
+ : "r" (paddr), "r" (pgd_cache),\
+ "i" (ASI_DMMU), "i" (TSB_REG)); \
+} while(0)
+
+/* Set MMU context in the actual hardware. */
+#define load_secondary_context(__mm) \
+ __asm__ __volatile__("stxa %0, [%1] %2\n\t" \
+ "flush %%g6" \
+ : /* No outputs */ \
+ : "r" (CTX_HWBITS((__mm)->context)), \
+ "r" (0x10), "i" (0x58))
+
+/* Clean out potential stale TLB entries due to previous
+ * users of this TLB context. We flush TLB contexts
+ * lazily on sparc64.
+ */
+#define clean_secondary_context() \
+ __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" \
+ "stxa %%g0, [%0] %2\n\t" \
+ "flush %%g6" \
+ : /* No outputs */ \
+ : "r" (0x50), "i" (0x5f), "i" (0x57))
+
+/* Switch the current MM context. */
+static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk, int cpu)
{
- register unsigned long paddr asm("o5");
- register unsigned long pgd_cache asm("o4");
- struct mm_struct *mm = tsk->mm;
- unsigned long asi;
-
- if(!(tsk->tss.flags & SPARC_FLAG_KTHREAD) &&
- !(tsk->flags & PF_EXITING)) {
- unsigned long ctx = tlb_context_cache;
- if((mm->context ^ ctx) & CTX_VERSION_MASK)
+ long dirty;
+
+ spin_lock(&mm->page_table_lock);
+ if (CTX_VALID(mm->context))
+ dirty = 0;
+ else
+ dirty = 1;
+ if (dirty || (old_mm != mm)) {
+ unsigned long vm_mask;
+
+ if (dirty)
get_new_mmu_context(mm);
- tsk->tss.ctx = mm->context & 0x3ff;
- spitfire_set_secondary_context(mm->context & 0x3ff);
- __asm__ __volatile__("flush %g6");
- if(!(mm->cpu_vm_mask & (1UL<<smp_processor_id()))) {
- spitfire_flush_dtlb_secondary_context();
- spitfire_flush_itlb_secondary_context();
- __asm__ __volatile__("flush %g6");
+
+ vm_mask = (1UL << cpu);
+ if (!(mm->cpu_vm_mask & vm_mask)) {
+ mm->cpu_vm_mask |= vm_mask;
+ dirty = 1;
}
- asi = tsk->tss.current_ds.seg;
- } else {
- tsk->tss.ctx = 0;
- spitfire_set_secondary_context(0);
- __asm__ __volatile__("flush %g6");
- asi = ASI_P;
+
+ load_secondary_context(mm);
+ if (dirty != 0)
+ clean_secondary_context();
+ reload_tlbmiss_state(tsk, mm);
}
- /* Sigh, damned include loops... just poke seg directly. */
- __asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" (asi));
- paddr = __pa(mm->pgd);
- if((tsk->tss.flags & (SPARC_FLAG_32BIT|SPARC_FLAG_KTHREAD)) ==
- (SPARC_FLAG_32BIT))
- pgd_cache = ((unsigned long) mm->pgd[0]) << 11UL;
- else
- pgd_cache = 0;
- __asm__ __volatile__("
- rdpr %%pstate, %%o2
- andn %%o2, %2, %%o3
- wrpr %%o3, %5, %%pstate
- mov %4, %%g4
- mov %0, %%g7
- stxa %1, [%%g4] %3
- wrpr %%o2, 0x0, %%pstate
- " : /* no outputs */
- : "r" (paddr), "r" (pgd_cache), "i" (PSTATE_IE),
- "i" (ASI_DMMU), "i" (TSB_REG), "i" (PSTATE_MG)
- : "o2", "o3");
+ spin_unlock(&mm->page_table_lock);
}
-/* Now we define this as a do nothing macro, because the only
- * generic user right now is the scheduler, and we handle all
- * the atomicity issues by having switch_to() call the above
- * function itself.
- */
-#define get_mmu_context(x) do { } while(0)
-
-/*
- * After we have set current->mm to a new value, this activates
- * the context for the new mm so we see the new mappings. Currently,
- * this is always called for 'current', if that changes put appropriate
- * checks here.
- *
- * We set the cpu_vm_mask first to zero to enforce a tlb flush for
- * the new context above, then we set it to the current cpu so the
- * smp tlb flush routines do not get confused.
- */
-#define activate_context(__tsk) \
-do { flushw_user(); \
- (__tsk)->mm->cpu_vm_mask = 0; \
- __get_mmu_context(__tsk); \
- (__tsk)->mm->cpu_vm_mask = (1UL<<smp_processor_id()); \
-} while(0)
+/* Activate a new MM instance for the current task. */
+static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm)
+{
+ unsigned long vm_mask;
+
+ spin_lock(&mm->page_table_lock);
+ if (!CTX_VALID(mm->context))
+ get_new_mmu_context(mm);
+ vm_mask = (1UL << smp_processor_id());
+ if (!(mm->cpu_vm_mask & vm_mask))
+ mm->cpu_vm_mask |= vm_mask;
+ spin_unlock(&mm->page_table_lock);
+
+ load_secondary_context(mm);
+ clean_secondary_context();
+ reload_tlbmiss_state(current, mm);
+}
#endif /* !(__ASSEMBLY__) */
diff --git a/include/asm-sparc64/mostek.h b/include/asm-sparc64/mostek.h
index e956a9565..e153a36cf 100644
--- a/include/asm-sparc64/mostek.h
+++ b/include/asm-sparc64/mostek.h
@@ -1,4 +1,4 @@
-/* $Id: mostek.h,v 1.2 1997/03/25 03:58:30 davem Exp $
+/* $Id: mostek.h,v 1.3 1999/08/30 10:14:50 davem Exp $
* mostek.h: Describes the various Mostek time of day clock registers.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -35,22 +35,38 @@
/* The Mostek 48t02 real time clock and NVRAM chip. The registers
* other than the control register are in binary coded decimal. Some
* control bits also live outside the control register.
+ *
+ * We now deal with physical addresses for I/O to the chip. -DaveM
*/
-
-struct mostek48t02 {
- volatile char eeprom[2008]; /* This is the eeprom, don't touch! */
- struct idprom idprom; /* The idprom lives here. */
- volatile unsigned char creg; /* Control register */
- volatile unsigned char sec; /* Seconds (0-59) */
- volatile unsigned char min; /* Minutes (0-59) */
- volatile unsigned char hour; /* Hour (0-23) */
- volatile unsigned char dow; /* Day of the week (1-7) */
- volatile unsigned char dom; /* Day of the month (1-31) */
- volatile unsigned char month; /* Month of year (1-12) */
- volatile unsigned char year; /* Year (0-99) */
-};
-
-extern struct mostek48t02 *mstk48t02_regs;
+static __inline__ u8 mostek_read(unsigned long addr)
+{
+ u8 ret;
+
+ __asm__ __volatile__("lduba [%1] %2, %0"
+ : "=r" (ret)
+ : "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
+ return ret;
+}
+
+static __inline__ void mostek_write(unsigned long addr, u8 val)
+{
+ __asm__ __volatile__("stba %0, [%1] %2"
+ : /* no outputs */
+ : "r" (val), "r" (addr), "i" (ASI_PHYS_BYPASS_EC_E));
+}
+
+#define MOSTEK_EEPROM 0x0000UL
+#define MOSTEK_IDPROM 0x07d8UL
+#define MOSTEK_CREG 0x07f8UL
+#define MOSTEK_SEC 0x07f9UL
+#define MOSTEK_MIN 0x07faUL
+#define MOSTEK_HOUR 0x07fbUL
+#define MOSTEK_DOW 0x07fcUL
+#define MOSTEK_DOM 0x07fdUL
+#define MOSTEK_MONTH 0x07feUL
+#define MOSTEK_YEAR 0x07ffUL
+
+extern unsigned long mstk48t02_regs;
/* Control register values. */
#define MSTK_CREG_WRITE 0x80 /* Must set this before placing values. */
@@ -79,48 +95,51 @@ extern struct mostek48t02 *mstk48t02_regs;
#define MSTK_DECIMAL_TO_REGVAL(x) ((((x) / 0x0A) << 0x04) + ((x) % 0x0A))
/* Generic register set and get macros for internal use. */
-#define MSTK_GET(regs,var,mask) (MSTK_REGVAL_TO_DECIMAL(regs->var & MSTK_ ## mask ## _MASK))
-#define MSTK_SET(regs,var,value,mask) do { regs->var &= ~(MSTK_ ## mask ## _MASK); regs->var |= MSTK_DECIMAL_TO_REGVAL(value) & (MSTK_ ## mask ## _MASK); } while (0)
+#define MSTK_GET(regs,name) \
+ (MSTK_REGVAL_TO_DECIMAL(mostek_read(regs + MOSTEK_ ## name) & MSTK_ ## name ## _MASK))
+#define MSTK_SET(regs,name,value) \
+do { u8 __val = mostek_read(regs + MOSTEK_ ## name); \
+ __val &= ~(MSTK_ ## name ## _MASK); \
+ __val |= (MSTK_DECIMAL_TO_REGVAL(value) & \
+ (MSTK_ ## name ## _MASK)); \
+ mostek_write(regs + MOSTEK_ ## name, __val); \
+} while(0)
/* Macros to make register access easier on our fingers. These give you
* the decimal value of the register requested if applicable. You pass
* the a pointer to a 'struct mostek48t02'.
*/
-#define MSTK_REG_CREG(regs) (regs->creg)
-#define MSTK_REG_SEC(regs) MSTK_GET(regs,sec,SEC)
-#define MSTK_REG_MIN(regs) MSTK_GET(regs,min,MIN)
-#define MSTK_REG_HOUR(regs) MSTK_GET(regs,hour,HOUR)
-#define MSTK_REG_DOW(regs) MSTK_GET(regs,dow,DOW)
-#define MSTK_REG_DOM(regs) MSTK_GET(regs,dom,DOM)
-#define MSTK_REG_MONTH(regs) MSTK_GET(regs,month,MONTH)
-#define MSTK_REG_YEAR(regs) MSTK_GET(regs,year,YEAR)
-
-#define MSTK_SET_REG_SEC(regs,value) MSTK_SET(regs,sec,value,SEC)
-#define MSTK_SET_REG_MIN(regs,value) MSTK_SET(regs,min,value,MIN)
-#define MSTK_SET_REG_HOUR(regs,value) MSTK_SET(regs,hour,value,HOUR)
-#define MSTK_SET_REG_DOW(regs,value) MSTK_SET(regs,dow,value,DOW)
-#define MSTK_SET_REG_DOM(regs,value) MSTK_SET(regs,dom,value,DOM)
-#define MSTK_SET_REG_MONTH(regs,value) MSTK_SET(regs,month,value,MONTH)
-#define MSTK_SET_REG_YEAR(regs,value) MSTK_SET(regs,year,value,YEAR)
+#define MSTK_REG_CREG(regs) (mostek_read((regs) + MOSTEK_CREG))
+#define MSTK_REG_SEC(regs) MSTK_GET(regs,SEC)
+#define MSTK_REG_MIN(regs) MSTK_GET(regs,MIN)
+#define MSTK_REG_HOUR(regs) MSTK_GET(regs,HOUR)
+#define MSTK_REG_DOW(regs) MSTK_GET(regs,DOW)
+#define MSTK_REG_DOM(regs) MSTK_GET(regs,DOM)
+#define MSTK_REG_MONTH(regs) MSTK_GET(regs,MONTH)
+#define MSTK_REG_YEAR(regs) MSTK_GET(regs,YEAR)
+
+#define MSTK_SET_REG_SEC(regs,value) MSTK_SET(regs,SEC,value)
+#define MSTK_SET_REG_MIN(regs,value) MSTK_SET(regs,MIN,value)
+#define MSTK_SET_REG_HOUR(regs,value) MSTK_SET(regs,HOUR,value)
+#define MSTK_SET_REG_DOW(regs,value) MSTK_SET(regs,DOW,value)
+#define MSTK_SET_REG_DOM(regs,value) MSTK_SET(regs,DOM,value)
+#define MSTK_SET_REG_MONTH(regs,value) MSTK_SET(regs,MONTH,value)
+#define MSTK_SET_REG_YEAR(regs,value) MSTK_SET(regs,YEAR,value)
/* The Mostek 48t08 clock chip. Found on Sun4m's I think. It has the
* same (basically) layout of the 48t02 chip except for the extra
* NVRAM on board (8 KB against the 48t02's 2 KB).
*/
-struct mostek48t08 {
- char offset[6*1024]; /* Magic things may be here, who knows? */
- struct mostek48t02 regs; /* Here is what we are interested in. */
-};
-extern struct mostek48t08 *mstk48t08_regs;
+#define MOSTEK_48T08_OFFSET 0x0000UL /* Lower NVRAM portions */
+#define MOSTEK_48T08_48T02 0x1800UL /* Offset to 48T02 chip */
+extern unsigned long mstk48t08_regs;
/* SUN5 systems usually have 48t59 model clock chipsets. But we keep the older
* clock chip definitions around just in case.
*/
-struct mostek48t59 {
- char offset[6*1024];
- struct mostek48t02 regs;
-};
-extern struct mostek48t59 *mstk48t59_regs;
+#define MOSTEK_48T59_OFFSET 0x0000UL /* Lower NVRAM portions */
+#define MOSTEK_48T59_48T02 0x1800UL /* Offset to 48T02 chip */
+extern unsigned long mstk48t59_regs;
#endif /* !(_SPARC64_MOSTEK_H) */
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index 52e55758a..f0ca1df71 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -1,4 +1,4 @@
-/* $Id: oplib.h,v 1.10 1998/12/18 10:02:03 davem Exp $
+/* $Id: oplib.h,v 1.11 1999/08/31 19:25:49 davem Exp $
* oplib.h: Describes the interface and available routines in the
* Linux Prom library.
*
@@ -205,7 +205,8 @@ extern int prom_wakeupsystem(void);
/* MMU and memory related OBP interfaces. */
/* Get unique string identifying SIMM at given physical address. */
-extern int prom_getunumber(unsigned long phys_lo, unsigned long phys_hi,
+extern int prom_getunumber(int syndrome_code,
+ unsigned long phys_addr,
char *buf, int buflen);
/* Retain physical memory to the caller across soft resets. */
@@ -336,6 +337,7 @@ extern long p1275_cmd (char *, long, ...);
#define P1275_ARG_OUT_32B 3
#define P1275_ARG_IN_FUNCTION 4
#define P1275_ARG_IN_BUF 5
+#define P1275_ARG_IN_64B 6
#define P1275_IN(x) ((x) & 0xf)
#define P1275_OUT(x) (((x) << 4) & 0xf0)
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index 1a808c0ba..1e89c16e6 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -1,4 +1,4 @@
-/* $Id: page.h,v 1.24 1998/10/20 03:09:16 jj Exp $ */
+/* $Id: page.h,v 1.27 1999/07/31 00:07:25 davem Exp $ */
#ifndef _SPARC64_PAGE_H
#define _SPARC64_PAGE_H
@@ -18,9 +18,8 @@
#ifndef __ASSEMBLY__
-#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); *(int *)0=0; } while (0)
-#define PAGE_BUG(page) do { \
- BUG(); } while (0)
+#define BUG() __builtin_trap()
+#define PAGE_BUG(page) BUG()
extern void clear_page(unsigned long page);
extern void copy_page(unsigned long to, unsigned long from);
@@ -85,7 +84,7 @@ typedef unsigned long iopgprot_t;
#endif /* (STRICT_MM_TYPECHECKS) */
-#define TASK_UNMAPPED_BASE ((current->tss.flags & SPARC_FLAG_32BIT) ? \
+#define TASK_UNMAPPED_BASE ((current->thread.flags & SPARC_FLAG_32BIT) ? \
(0x0000000070000000UL) : (PAGE_OFFSET))
#endif /* !(__ASSEMBLY__) */
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
new file mode 100644
index 000000000..67a0da1fa
--- /dev/null
+++ b/include/asm-sparc64/parport.h
@@ -0,0 +1,182 @@
+/* $Id: parport.h,v 1.5 1999/08/30 10:14:52 davem Exp $
+ * parport.h: sparc64 specific parport initialization and dma.
+ *
+ * Copyright (C) 1999 Eddie C. Dost (ecd@skynet.be)
+ */
+
+#ifndef _ASM_SPARC64_PARPORT_H
+#define _ASM_SPARC64_PARPORT_H 1
+
+#include <linux/config.h>
+#include <asm/ebus.h>
+#include <asm/ns87303.h>
+
+#ifdef CONFIG_PARPORT_PC_PCMCIA
+#define __maybe_init
+#define __maybe_initdata
+#else
+#define __maybe_init __init
+#define __maybe_initdata __initdata
+#endif
+
+#undef HAVE_SLOW_DEVICES
+
+#define PARPORT_PC_MAX_PORTS PARPORT_MAX
+
+static struct linux_ebus_dma *sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
+
+static __inline__ void
+reset_dma(unsigned int dmanr)
+{
+ unsigned int dcsr;
+
+ writel(EBUS_DCSR_RESET, &sparc_ebus_dmas[dmanr]->dcsr);
+ udelay(1);
+ dcsr = EBUS_DCSR_BURST_SZ_16 | EBUS_DCSR_TCI_DIS |
+ EBUS_DCSR_EN_CNT;
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
+}
+
+static __inline__ void
+enable_dma(unsigned int dmanr)
+{
+ unsigned int dcsr;
+
+ dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
+ dcsr |= EBUS_DCSR_EN_DMA;
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
+}
+
+static __inline__ void
+disable_dma(unsigned int dmanr)
+{
+ unsigned int dcsr;
+
+ dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
+ if (dcsr & EBUS_DCSR_EN_DMA) {
+ while (dcsr & EBUS_DCSR_DRAIN) {
+ udelay(1);
+ dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
+ }
+ dcsr &= ~(EBUS_DCSR_EN_DMA);
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
+
+ dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
+ if (dcsr & EBUS_DCSR_ERR_PEND) {
+ reset_dma(dmanr);
+ dcsr &= ~(EBUS_DCSR_ERR_PEND);
+ }
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
+ }
+}
+
+static __inline__ void
+clear_dma_ff(unsigned int dmanr)
+{
+ /* nothing */
+}
+
+static __inline__ void
+set_dma_mode(unsigned int dmanr, char mode)
+{
+ unsigned int dcsr;
+
+ dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
+ dcsr |= EBUS_DCSR_EN_CNT | EBUS_DCSR_TC;
+ if (mode == DMA_MODE_WRITE)
+ dcsr &= ~(EBUS_DCSR_WRITE);
+ else
+ dcsr |= EBUS_DCSR_WRITE;
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
+}
+
+static __inline__ void
+set_dma_addr(unsigned int dmanr, unsigned int addr)
+{
+ writel(addr, &sparc_ebus_dmas[dmanr]->dacr);
+}
+
+static __inline__ void
+set_dma_count(unsigned int dmanr, unsigned int count)
+{
+ writel(count, &sparc_ebus_dmas[dmanr]->dbcr);
+}
+
+static __inline__ int
+get_dma_residue(unsigned int dmanr)
+{
+ unsigned int dcsr;
+ int res;
+
+ res = readl(&sparc_ebus_dmas[dmanr]->dbcr);
+ if (res != 0) {
+ dcsr = readl(&sparc_ebus_dmas[dmanr]->dcsr);
+ reset_dma(dmanr);
+ writel(dcsr, &sparc_ebus_dmas[dmanr]->dcsr);
+ }
+ return res;
+}
+
+static int __maybe_init parport_pc_init_pci(int irq, int dma);
+
+static int user_specified __initdata = 0;
+
+int __init
+parport_pc_init(int *io, int *io_hi, int *irq, int *dma)
+{
+ struct linux_ebus *ebus;
+ struct linux_ebus_device *edev;
+ int count = 0;
+
+ if (!pci_present())
+ return 0;
+
+ for_each_ebus(ebus) {
+ for_each_ebusdev(edev, ebus) {
+ if (!strcmp(edev->prom_name, "ecpp")) {
+ unsigned long base = edev->resource[0].start;
+ unsigned long config = edev->resource[1].start;
+ unsigned char cfg;
+
+ sparc_ebus_dmas[count] =
+ (struct linux_ebus_dma *)
+ edev->resource[2].start;
+ reset_dma(count);
+
+ /* Enable ECP, set bit 2 of the CTR first */
+ outb(0x04, base + 0x02);
+ cfg = ns87303_readb(config, PCR);
+ cfg |= (PCR_ECP_ENABLE | PCR_ECP_CLK_ENA);
+ ns87303_writeb(config, PCR, cfg);
+
+ /* CTR bit 5 controls direction of port */
+ cfg = ns87303_readb(config, PTR);
+ cfg |= PTR_LPT_REG_DIR;
+ ns87303_writeb(config, PTR, cfg);
+
+ /* Configure IRQ to Push Pull, Level Low */
+ cfg = ns87303_readb(config, PCR);
+ cfg &= ~(PCR_IRQ_ODRAIN);
+ cfg |= PCR_IRQ_POLAR;
+ ns87303_writeb(config, PCR, cfg);
+
+#ifndef HAVE_SLOW_DEVICES
+ /* Enable Zero Wait State for ECP */
+ cfg = ns87303_readb(config, FCR);
+ cfg |= FCR_ZWS_ENA;
+ ns87303_writeb(config, FCR, cfg);
+#endif
+
+ if (parport_pc_probe_port(base, base + 0x400,
+ edev->irqs[0],
+ count))
+ count++;
+ }
+ }
+ }
+
+ count += parport_pc_init_pci(PARPORT_IRQ_AUTO, PARPORT_DMA_NONE);
+ return count;
+}
+
+#endif /* !(_ASM_SPARC64_PARPORT_H */
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 4f0f51f30..1f740c845 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -1,34 +1,92 @@
-/* $Id: pbm.h,v 1.16 1999/03/14 18:13:03 davem Exp $
- * pbm.h: U2P PCI bus module pseudo driver software state.
+/* $Id: pbm.h,v 1.18 1999/09/10 10:44:40 davem Exp $
+ * pbm.h: UltraSparc PCI controller software state.
*
- * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
*/
#ifndef __SPARC64_PBM_H
#define __SPARC64_PBM_H
+#include <linux/types.h>
#include <linux/pci.h>
+#include <linux/ioport.h>
+#include <linux/spinlock.h>
-#include <asm/psycho.h>
+#include <asm/io.h>
+#include <asm/page.h>
#include <asm/oplib.h>
-struct linux_pbm_info;
+/* The abstraction used here is that there are PCI controllers,
+ * each with one (Sabre) or two (PSYCHO/SCHIZO) PCI bus modules
+ * underneath. Each PCI controller has a single IOMMU shared
+ * by the PCI bus modules underneath, and if a streaming buffer
+ * is present, each PCI bus module has it's own. (ie. the IOMMU
+ * is shared between PBMs, the STC is not) Furthermore, each
+ * PCI bus module controls it's own autonomous PCI bus.
+ */
+
+struct pci_controller_info;
-/* This is what we use to determine what the PROM has assigned so
- * far, so that we can perform assignments for addresses which
- * were not taken care of by OBP. See psycho.c for details.
- * Per-PBM these are ordered by start address.
+/* This contains the software state necessary to drive a PCI
+ * controller's IOMMU.
*/
-struct pci_vma {
- struct pci_vma *next;
- struct linux_pbm_info *pbm;
- unsigned int start;
- unsigned int end;
- unsigned int offset;
- unsigned int _pad;
+struct pci_iommu {
+ /* This protects the controller's IOMMU and all
+ * streaming buffers underneath.
+ */
+ spinlock_t lock;
+
+ /* Context allocator. */
+ unsigned int iommu_cur_ctx;
+
+ /* IOMMU page table, a linear array of ioptes. */
+ iopte_t *page_table; /* The page table itself. */
+ int page_table_sz; /* How many pages does it map? */
+
+ /* Base PCI memory space address where IOMMU mappings
+ * begin.
+ */
+ u32 page_table_map_base;
+
+ /* IOMMU Controller Registers */
+ int iommu_has_ctx_flush; /* Feature test. */
+ unsigned long iommu_control; /* IOMMU control register */
+ unsigned long iommu_tsbbase; /* IOMMU page table base register */
+ unsigned long iommu_flush; /* IOMMU page flush register */
+ unsigned long iommu_ctxflush; /* IOMMU context flush register */
+
+ /* This is a register in the PCI controller, which if
+ * read will have no side-effects but will guarentee
+ * completion of all previous writes into IOMMU/STC.
+ */
+ unsigned long write_complete_reg;
};
-struct linux_psycho;
+/* This describes a PCI bus module's streaming buffer. */
+struct pci_strbuf {
+ int strbuf_enabled; /* Present and using it? */
+ int strbuf_has_ctx_flush; /* Supports context flushing? */
+
+ /* Streaming Buffer Control Registers */
+ unsigned long strbuf_control; /* STC control register */
+ unsigned long strbuf_pflush; /* STC page flush register */
+ unsigned long strbuf_fsync; /* STC flush synchronization reg */
+ unsigned long strbuf_ctxflush; /* STC context flush register */
+ unsigned long strbuf_ctxmatch_base; /* STC context flush match reg */
+ unsigned long strbuf_flushflag_pa; /* Physical address of flush flag */
+ volatile unsigned long *strbuf_flushflag; /* The flush flag itself */
+
+ /* And this is the actual flush flag area.
+ * We allocate extra because the chips require
+ * a 64-byte aligned area.
+ */
+ volatile unsigned long __flushflag_buf[(64 + (64 - 1)) / sizeof(long)];
+};
+
+#define PCI_STC_FLUSHFLAG_INIT(STC) \
+ (*((STC)->strbuf_flushflag) = 0UL)
+#define PCI_STC_FLUSHFLAG_SET(STC) \
+ (*((STC)->strbuf_flushflag) != 0UL)
/* There can be quite a few ranges and interrupt maps on a PCI
* segment. Thus...
@@ -36,10 +94,14 @@ struct linux_psycho;
#define PROM_PCIRNG_MAX 64
#define PROM_PCIIMAP_MAX 64
-struct linux_pbm_info {
- struct linux_psycho *parent;
- struct pci_vma *IO_assignments;
- struct pci_vma *MEM_assignments;
+struct pci_pbm_info {
+ /* PCI controller we sit under. */
+ struct pci_controller_info *parent;
+
+ /* Name used for top-level resources. */
+ char name[64];
+
+ /* OBP specific information. */
int prom_node;
char prom_name[64];
struct linux_prom_pci_ranges pbm_ranges[PROM_PCIRNG_MAX];
@@ -48,27 +110,54 @@ struct linux_pbm_info {
int num_pbm_intmap;
struct linux_prom_pci_intmask pbm_intmask;
+ /* PBM I/O and Memory space resources. */
+ struct resource io_space;
+ struct resource mem_space;
+
+ /* This PBM's streaming buffer. */
+ struct pci_strbuf stc;
+
/* Now things for the actual PCI bus probes. */
unsigned int pci_first_busno;
unsigned int pci_last_busno;
- struct pci_bus pci_bus;
+ struct pci_bus *pci_bus;
};
-struct linux_psycho {
- struct linux_psycho *next;
- struct psycho_regs *psycho_regs;
- unsigned long *pci_config_space;
- unsigned long *pci_IO_space;
- unsigned long *pci_mem_space;
- u32 upa_portid;
+struct pci_controller_info {
+ /* List of all PCI controllers. */
+ struct pci_controller_info *next;
+
+ /* Physical address base of controller registers
+ * and PCI config space.
+ */
+ unsigned long controller_regs;
+ unsigned long config_space;
+
+ /* Opaque 32-bit system bus Port ID. */
+ u32 portid;
+
+ /* Each controller gets a unique index, used mostly for
+ * error logging purposes.
+ */
int index;
- struct linux_pbm_info pbm_A;
- struct linux_pbm_info pbm_B;
+
+ /* The PCI bus modules controlled by us. */
+ struct pci_pbm_info pbm_A;
+ struct pci_pbm_info pbm_B;
+
+ /* Operations which are controller specific. */
+ void (*scan_bus)(struct pci_controller_info *);
+ unsigned int (*irq_build)(struct pci_controller_info *, struct pci_dev *, unsigned int);
+ void (*base_address_update)(struct pci_dev *, int);
+ void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *);
/* Now things for the actual PCI bus probes. */
+ struct pci_ops *pci_ops;
unsigned int pci_first_busno;
unsigned int pci_last_busno;
- struct pci_bus *pci_bus;
+
+ /* IOMMU state shared by both PBM segments. */
+ struct pci_iommu iommu;
void *starfire_cookie;
};
@@ -78,17 +167,19 @@ struct linux_psycho {
* code.
*/
struct pcidev_cookie {
- struct linux_pbm_info *pbm;
+ struct pci_pbm_info *pbm;
+ char prom_name[64];
int prom_node;
+ struct linux_prom_pci_registers prom_regs[PROMREG_MAX];
+ int num_prom_regs;
+ struct linux_prom_pci_registers prom_assignments[PROMREG_MAX];
+ int num_prom_assignments;
};
-
-#define PCI_IRQ_IGN 0x000007c0 /* PSYCHO "Int Group Number". */
-#define PCI_IRQ_INO 0x0000003f /* PSYCHO INO. */
-
-/* Used by EBus */
-extern unsigned int psycho_irq_build(struct linux_pbm_info *pbm,
- struct pci_dev *pdev,
- unsigned int full_ino);
+/* Currently these are the same across all PCI controllers
+ * we support. Someday they may not be...
+ */
+#define PCI_IRQ_IGN 0x000007c0 /* Interrupt Group Number */
+#define PCI_IRQ_INO 0x0000003f /* Interrupt Number */
#endif /* !(__SPARC64_PBM_H) */
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
new file mode 100644
index 000000000..6d1558daf
--- /dev/null
+++ b/include/asm-sparc64/pci.h
@@ -0,0 +1,44 @@
+#ifndef __SPARC64_PCI_H
+#define __SPARC64_PCI_H
+
+#include <asm/scatterlist.h>
+
+/* Can be used to override the logic in pci_scan_bus for skipping
+ * already-configured bus numbers - to be used for buggy BIOSes
+ * or architectures with incomplete PCI setup by the loader.
+ */
+#define pcibios_assign_all_busses() 0
+
+/* Map kernel buffer using consistant mode DMA for PCI device.
+ * Returns a 32-bit PCI DMA address.
+ */
+extern u32 pci_map_consistant(struct pci_dev *, void *, int);
+
+/* Unmap a consistant DMA translation. */
+extern void pci_unmap_consistant(struct pci_dev *, u32, int);
+
+/* Map a single buffer for PCI DMA in streaming mode. */
+extern u32 pci_map_single(struct pci_dev *, void *, int);
+
+/* Unmap a single streaming mode DMA translation. */
+extern void pci_unmap_single(struct pci_dev *, u32, int);
+
+/* Map a set of buffers described by scatterlist in streaming
+ * mode for PCI DMA.
+ */
+extern void pci_map_sg(struct pci_dev *, struct scatterlist *, int);
+
+/* Unmap a set of streaming mode DMA translations. */
+extern void pci_unmap_sg(struct pci_dev *, struct scatterlist *, int);
+
+/* Make physical memory consistant for a single
+ * streaming mode DMA translation after a transfer.
+ */
+extern void pci_dma_sync_single(struct pci_dev *, u32, int);
+
+/* Make physical memory consistant for a set of streaming
+ * mode DMA translations after a transfer.
+ */
+extern void pci_dma_sync_sg(struct pci_dev *, struct scatterlist *, int);
+
+#endif /* __SPARC64_PCI_H */
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index d3a8ec9a2..5b31257da 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.105 1999/05/27 04:52:51 davem Exp $
+/* $Id: pgtable.h,v 1.110 1999/08/30 10:14:57 davem Exp $
* pgtable.h: SpitFire page table operations.
*
* Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu)
@@ -47,14 +47,14 @@
* is different so we can optimize correctly for 32-bit tasks.
*/
#define REAL_PTRS_PER_PMD (1UL << (PAGE_SHIFT-2))
-#define PTRS_PER_PMD ((const int)((current->tss.flags & SPARC_FLAG_32BIT) ? \
+#define PTRS_PER_PMD ((const int)((current->thread.flags & SPARC_FLAG_32BIT) ? \
(REAL_PTRS_PER_PMD >> 2) : (REAL_PTRS_PER_PMD)))
/* We cannot use the top 16G because VPTE table lives there. */
#define PTRS_PER_PGD ((1UL << (PAGE_SHIFT-3))-1)
/* Kernel has a separate 44bit address space. */
-#define USER_PTRS_PER_PGD ((const int)((current->tss.flags & SPARC_FLAG_32BIT) ? \
+#define USER_PTRS_PER_PGD ((const int)((current->thread.flags & SPARC_FLAG_32BIT) ? \
(1) : (PTRS_PER_PGD)))
#define PTE_TABLE_SIZE 0x2000 /* 1024 entries 8 bytes each */
@@ -167,9 +167,12 @@ extern void *sparc_init_alloc(unsigned long *kbrk, unsigned long size);
/* Cache and TLB flush operations. */
/* These are the same regardless of whether this is an SMP kernel or not. */
-#define flush_cache_mm(mm) flushw_user()
-#define flush_cache_range(mm, start, end) flushw_user()
-#define flush_cache_page(vma, page) flushw_user()
+#define flush_cache_mm(__mm) \
+ do { if ((__mm) == current->mm) flushw_user(); } while(0)
+#define flush_cache_range(mm, start, end) \
+ flush_cache_mm(mm)
+#define flush_cache_page(vma, page) \
+ flush_cache_mm((vma)->vm_mm)
/* These operations are unnecessary on the SpitFire since D-CACHE is write-through. */
#define flush_icache_range(start, end) do { } while (0)
@@ -191,16 +194,16 @@ extern void __flush_tlb_page(unsigned long context, unsigned long page, unsigned
#define flush_cache_all() __flush_cache_all()
#define flush_tlb_all() __flush_tlb_all()
-#define flush_tlb_mm(mm) \
-do { if((mm)->context != NO_CONTEXT) \
- __flush_tlb_mm((mm)->context & 0x3ff, SECONDARY_CONTEXT); \
+#define flush_tlb_mm(__mm) \
+do { if(CTX_VALID((__mm)->context)) \
+ __flush_tlb_mm(CTX_HWBITS((__mm)->context), SECONDARY_CONTEXT); \
} while(0)
-#define flush_tlb_range(mm, start, end) \
-do { if((mm)->context != NO_CONTEXT) { \
+#define flush_tlb_range(__mm, start, end) \
+do { if(CTX_VALID((__mm)->context)) { \
unsigned long __start = (start)&PAGE_MASK; \
unsigned long __end = (end)&PAGE_MASK; \
- __flush_tlb_range((mm)->context & 0x3ff, __start, \
+ __flush_tlb_range(CTX_HWBITS((__mm)->context), __start, \
SECONDARY_CONTEXT, __end, PAGE_SIZE, \
(__end - __start)); \
} \
@@ -208,8 +211,8 @@ do { if((mm)->context != NO_CONTEXT) { \
#define flush_tlb_page(vma, page) \
do { struct mm_struct *__mm = (vma)->vm_mm; \
- if(__mm->context != NO_CONTEXT) \
- __flush_tlb_page(__mm->context & 0x3ff, (page)&PAGE_MASK, \
+ if(CTX_VALID(__mm->context)) \
+ __flush_tlb_page(CTX_HWBITS(__mm->context), (page)&PAGE_MASK, \
SECONDARY_CONTEXT); \
} while(0)
@@ -227,14 +230,14 @@ extern void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page);
extern __inline__ void flush_tlb_mm(struct mm_struct *mm)
{
- if(mm->context != NO_CONTEXT)
+ if (CTX_VALID(mm->context))
smp_flush_tlb_mm(mm);
}
extern __inline__ void flush_tlb_range(struct mm_struct *mm, unsigned long start,
unsigned long end)
{
- if(mm->context != NO_CONTEXT)
+ if (CTX_VALID(mm->context))
smp_flush_tlb_range(mm, start, end);
}
@@ -242,7 +245,7 @@ extern __inline__ void flush_tlb_page(struct vm_area_struct *vma, unsigned long
{
struct mm_struct *mm = vma->vm_mm;
- if(mm->context != NO_CONTEXT)
+ if (CTX_VALID(mm->context))
smp_flush_tlb_page(mm, page);
}
@@ -520,34 +523,13 @@ extern int do_check_pgt_cache(int, int);
#define set_pgdir(address, entry) do { } while(0)
extern pgd_t swapper_pg_dir[1];
-
-extern inline void SET_PAGE_DIR(struct task_struct *tsk, pgd_t *pgdir)
-{
- if(pgdir != swapper_pg_dir && tsk == current) {
- register unsigned long paddr asm("o5");
-
- paddr = __pa(pgdir);
- __asm__ __volatile__ ("
- rdpr %%pstate, %%o4
- wrpr %%o4, %1, %%pstate
- mov %3, %%g4
- mov %0, %%g7
- stxa %%g0, [%%g4] %2
- wrpr %%o4, 0x0, %%pstate
- " : /* No outputs */
- : "r" (paddr), "i" (PSTATE_MG|PSTATE_IE),
- "i" (ASI_DMMU), "i" (TSB_REG)
- : "o4");
- flush_tlb_mm(current->mm);
- }
-}
-
/* Routines for getting a dvma scsi buffer. */
struct mmu_sglist {
char *addr;
char *__dont_touch;
unsigned int len;
__u32 dvma_addr;
+ __u32 dvma_len;
};
extern __u32 mmu_get_scsi_one(char *, unsigned long, struct linux_sbus *sbus);
diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h
index 855be2e88..d5074144d 100644
--- a/include/asm-sparc64/processor.h
+++ b/include/asm-sparc64/processor.h
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.55 1999/05/27 04:52:54 davem Exp $
+/* $Id: processor.h,v 1.57 1999/08/04 03:20:05 davem Exp $
* include/asm-sparc64/processor.h
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -47,66 +47,61 @@ typedef struct {
/* The Sparc processor specific thread struct. */
struct thread_struct {
-/*DC1*/ unsigned long ksp __attribute__ ((aligned(16)));
- unsigned short wstate;
- unsigned short cwp;
- unsigned short flags;
+ /* D$ line 1 */
+ unsigned long ksp __attribute__ ((aligned(16)));
+ unsigned char wstate, cwp, flags;
mm_segment_t current_ds;
-
-/*DC2*/ unsigned short w_saved;
- unsigned short new_signal;
- unsigned short ctx;
- struct pt_regs *kregs;
-
-/*DC3*/ unsigned long *utraps;
- unsigned char fpdepth;
+ unsigned char w_saved, fpdepth;
unsigned char fpsaved[7];
+ unsigned char __pad1[3];
+ struct pt_regs *kregs;
+
+ /* D$ line 2 */
+ unsigned long *utraps;
+ unsigned char gsr[7];
+ unsigned char __pad2;
+ unsigned long sig_address;
+ unsigned long sig_desc;
-/*DC4*/ unsigned char gsr[7];
+ /* D$ lines 3 and 4 */
unsigned long xfsr[7];
+ unsigned long __pad3;
- struct reg_window reg_window[NSWINS] __attribute__ ((aligned (16)));
- unsigned long rwbuf_stkptrs[NSWINS] __attribute__ ((aligned (8)));
-
- unsigned long sig_address __attribute__ ((aligned (8)));
- unsigned long sig_desc;
+ struct reg_window reg_window[NSWINS];
+ unsigned long rwbuf_stkptrs[NSWINS];
/* Performance counter state */
u64 *user_cntd0, *user_cntd1;
u64 kernel_cntd0, kernel_cntd1;
u64 pcr_reg;
-
};
#endif /* !(__ASSEMBLY__) */
-#define SPARC_FLAG_KTHREAD 0x010 /* task is a kernel thread */
-#define SPARC_FLAG_UNALIGNED 0x020 /* is allowed to do unaligned accesses */
-#define SPARC_FLAG_NEWSIGNALS 0x040 /* task wants new-style signals */
-#define SPARC_FLAG_32BIT 0x080 /* task is older 32-bit binary */
-#define SPARC_FLAG_NEWCHILD 0x100 /* task is just-spawned child process */
-#define SPARC_FLAG_PERFCTR 0x200 /* task has performance counters active */
+#define SPARC_FLAG_UNALIGNED 0x01 /* is allowed to do unaligned accesses */
+#define SPARC_FLAG_NEWSIGNALS 0x02 /* task wants new-style signals */
+#define SPARC_FLAG_32BIT 0x04 /* task is older 32-bit binary */
+#define SPARC_FLAG_NEWCHILD 0x08 /* task is just-spawned child process */
+#define SPARC_FLAG_PERFCTR 0x10 /* task has performance counters active */
#define INIT_MMAP { &init_mm, 0xfffff80000000000, 0xfffff80001000000, \
NULL, PAGE_SHARED , VM_READ | VM_WRITE | VM_EXEC, 1, NULL, NULL }
-#define INIT_TSS { \
-/* ksp, wstate, cwp, flags, current_ds, */ \
- 0, 0, 0, SPARC_FLAG_KTHREAD, KERNEL_DS, \
-/* w_saved, new_signal, ctx, kregs, */ \
- 0, 0, 0, 0, \
-/* utraps, */ \
- 0, \
-/* fpdepth, fpsaved, gsr, xfsr */ \
- 0, { 0 }, { 0 }, { 0 }, \
-/* reg_window */ \
- { { { 0, }, { 0, } }, }, \
-/* rwbuf_stkptrs */ \
- { 0, 0, 0, 0, 0, 0, 0, }, \
-/* sig_address, sig_desc */ \
- 0, 0, \
+#define INIT_THREAD { \
+/* ksp, wstate, cwp, flags, current_ds, */ \
+ 0, 0, 0, 0, KERNEL_DS, \
+/* w_saved, fpdepth, fpsaved, pad1, kregs, */ \
+ 0, 0, { 0 }, { 0 }, 0, \
+/* utraps, gsr, pad2, sig_address, sig_desc, */ \
+ 0, { 0 }, 0, 0, 0, \
+/* xfsr, pad3, */ \
+ { 0 }, 0, \
+/* reg_window */ \
+ { { { 0, }, { 0, } }, }, \
+/* rwbuf_stkptrs */ \
+ { 0, 0, 0, 0, 0, 0, 0, }, \
/* user_cntd0, user_cndd1, kernel_cntd0, kernel_cntd0, pcr_reg */ \
- 0, 0, 0, 0, 0, \
+ 0, 0, 0, 0, 0, \
}
#ifndef __ASSEMBLY__
@@ -134,14 +129,13 @@ do { \
regs->tpc = ((pc & (~3)) - 4); \
regs->tnpc = regs->tpc + 4; \
regs->y = 0; \
- current->tss.flags &= ~SPARC_FLAG_32BIT; \
- current->tss.wstate = (1 << 3); \
- if (current->tss.utraps) { \
- if (*(current->tss.utraps) < 2) \
- kfree (current->tss.utraps); \
+ current->thread.wstate = (1 << 3); \
+ if (current->thread.utraps) { \
+ if (*(current->thread.utraps) < 2) \
+ kfree (current->thread.utraps); \
else \
- (*(current->tss.utraps))--; \
- current->tss.utraps = NULL; \
+ (*(current->thread.utraps))--; \
+ current->thread.utraps = NULL; \
} \
__asm__ __volatile__( \
"stx %%g0, [%0 + %2 + 0x00]\n\t" \
@@ -175,17 +169,15 @@ do { \
regs->tpc = ((pc & (~3)) - 4); \
regs->tnpc = regs->tpc + 4; \
regs->y = 0; \
- current->tss.flags |= SPARC_FLAG_32BIT; \
- current->tss.wstate = (2 << 3); \
- if (current->tss.utraps) { \
- if (*(current->tss.utraps) < 2) \
- kfree (current->tss.utraps); \
+ current->thread.wstate = (2 << 3); \
+ if (current->thread.utraps) { \
+ if (*(current->thread.utraps) < 2) \
+ kfree (current->thread.utraps); \
else \
- (*(current->tss.utraps))--; \
- current->tss.utraps = NULL; \
+ (*(current->thread.utraps))--; \
+ current->thread.utraps = NULL; \
} \
__asm__ __volatile__( \
- "stxa %3, [%4] %5\n\t" \
"stx %%g0, [%0 + %2 + 0x00]\n\t" \
"stx %%g0, [%0 + %2 + 0x08]\n\t" \
"stx %%g0, [%0 + %2 + 0x10]\n\t" \
@@ -205,19 +197,20 @@ do { \
"wrpr %%g0, (2 << 3), %%wstate\n\t" \
: \
: "r" (regs), "r" (sp - REGWIN32_SZ), \
- "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])), \
- "r" (((unsigned long)current->mm->pgd[0])<<11UL), \
- "r" (TSB_REG), "i" (ASI_DMMU)); \
+ "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))); \
} while(0)
/* Free all resources held by a thread. */
#define release_thread(tsk) do { } while(0)
-#define copy_segments(nr, tsk, mm) do { } while (0)
+extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
+
+#define copy_segments(tsk, mm) do { } while (0)
#define release_segments(mm) do { } while (0)
#define forget_segments() do { } while (0)
#ifdef __KERNEL__
+#define THREAD_SIZE (2*PAGE_SIZE)
/* Allocation and freeing of task_struct and kernel stack. */
#define alloc_task_struct() ((struct task_struct *)__get_free_pages(GFP_KERNEL, 1))
#define free_task_struct(tsk) free_pages((unsigned long)(tsk),1)
diff --git a/include/asm-sparc64/psycho.h b/include/asm-sparc64/psycho.h
deleted file mode 100644
index 0833bf0eb..000000000
--- a/include/asm-sparc64/psycho.h
+++ /dev/null
@@ -1,400 +0,0 @@
-/* $Id: psycho.h,v 1.5 1999/04/01 12:27:28 davem Exp $
- * psycho.h: UltraSparc AX specific PCI definitions.
- *
- * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
- */
-
-#ifndef __SPARC64_PSYCHO_H
-#define __SPARC64_PSYCHO_H
-
-#include <linux/types.h>
-
-/* Ultra AX PSYCHO Register Set, one per controller probed. */
-struct psycho_regs {
-/*0x0000*/ u64 upa_id; /* PSYCHO UPA Port ID Register */
-/*0x0008*/ u64 upa_cfg; /* PSYCHO UPA Config Register */
-/*0x0010*/ u64 control; /* PSYCHO Control Register */
-/*0x0018*/ u64 __pad0;
-/*0x0020*/ u64 ecc_control; /* ECC Control Register */
-/*0x0028*/ u64 __pad1;
-
- /* Uncorrectable Error Fault Registers */
-/*0x0030*/ u64 ue_afsr; /* UE Async Fault Status */
-/*0x0038*/ u64 ue_afar; /* UE Async Fault Address */
-
- /* Correctable Error Fault Registers */
-/*0x0040*/ u64 ce_afsr; /* CE Async Fault Status */
-/*0x0048*/ u64 ce_afar; /* CE Async Fault Address */
-
- u64 __pad2[0x16];
-
- /* Performance Monitoring Registers */
-/*0x0100*/ u64 pmon_control;
-/*0x0108*/ u64 pmon_counter;
-
- u64 __pad3[0x1e];
-
- /* PCI Bus IOMMU lives here */
-/*0x0200*/ u64 iommu_control; /* IOMMU Control */
-/*0x0208*/ u64 iommu_tsbbase; /* IOMMU TSB Base */
-/*0x0210*/ u64 iommu_flush; /* IOMMU Flush Register */
-
- u64 __pad4[0x13d];
-
- /* Interrupt mapping/control registers */
-/*0x0c00*/ u64 imap_a_slot0; /* PCI A Slot 0 Int Mapping */
-/*0x0c08*/ u64 imap_a_slot1; /* PCI A Slot 1 Int Mapping */
-/*0x0c10*/ u64 imap_a_slot2; /* PCI A Slot 2 Int Mapping (IIi only)*/
-/*0x0c18*/ u64 imap_a_slot3; /* PCI A Slot 3 Int Mapping (IIi only)*/
-
-/*0x0c20*/ u64 imap_b_slot0; /* PCI B Slot 0 Int Mapping */
-/*0x0c28*/ u64 imap_b_slot1; /* PCI B Slot 1 Int Mapping */
-/*0x0c30*/ u64 imap_b_slot2; /* PCI B Slot 2 Int Mapping */
-/*0x0c38*/ u64 imap_b_slot3; /* PCI B Slot 3 Int Mapping */
-
- u64 __pad6[0x78];
-
-/*0x1000*/ u64 imap_scsi; /* SCSI Int Mapping */
-/*0x1008*/ u64 imap_eth; /* Ethernet Int Mapping */
-/*0x1010*/ u64 imap_bpp; /* Parallel Port Int Mapping */
-/*0x1018*/ u64 imap_au_rec; /* Audio Record Int Mapping */
-/*0x1020*/ u64 imap_au_play; /* Audio Playback Int Mapping */
-/*0x1028*/ u64 imap_pfail; /* Power Fail Int Mapping */
-/*0x1030*/ u64 imap_kms; /* Kbd/Mouse/Ser Int Mapping */
-/*0x1038*/ u64 imap_flpy; /* Floppy Int Mapping */
-/*0x1040*/ u64 imap_shw; /* Spare HW Int Mapping */
-/*0x1048*/ u64 imap_kbd; /* Kbd Only Int Mapping */
-/*0x1050*/ u64 imap_ms; /* Mouse Only Int Mapping */
-/*0x1058*/ u64 imap_ser; /* Serial Only Int Mapping */
-/*0x1060*/ u64 imap_tim0; /* Timer 0 Int Mapping */
-/*0x1068*/ u64 imap_tim1; /* Timer 1 Int Mapping */
-/*0x1070*/ u64 imap_ue; /* UE Int Mapping */
-/*0x1078*/ u64 imap_ce; /* CE Int Mapping */
-/*0x1080*/ u64 imap_a_err; /* PCI A Err Int Mapping */
-/*0x1088*/ u64 imap_b_err; /* PCI B Err Int Mapping */
-/*0x1090*/ u64 imap_pmgmt; /* Power Mgmt Int Mapping */
-/*0x1098*/ u64 imap_gfx; /* OB Graphics Int Mapping */
-/*0x10a0*/ u64 imap_eupa; /* UPA Expansion Int Mapping */
-
- u64 __pad7[0x6b];
-
- /* Interrupt Clear Registers */
-/*0x1400*/ u64 iclr_a_slot0[4]; /* PCI A Slot 0 Clear Int Reg */
-/*0x1420*/ u64 iclr_a_slot1[4]; /* PCI A Slot 1 Clear Int Reg */
-/*0x1440*/ u64 iclr_a_slot2[4]; /* PCI A Slot 2 Clear Int Reg */
-/*0x1460*/ u64 iclr_a_slot3[4]; /* PCI A Slot 3 Clear Int Reg */
-
-/*0x1480*/ u64 iclr_b_slot0[4]; /* PCI B Slot 0 Clear Int Reg */
-/*0x14a0*/ u64 iclr_b_slot1[4]; /* PCI B Slot 1 Clear Int Reg */
-/*0x14c0*/ u64 iclr_b_slot2[4]; /* PCI B Slot 2 Clear Int Reg */
-/*0x14e0*/ u64 iclr_b_slot3[4]; /* PCI B Slot 3 Clear Int Reg */
-
- u64 __pad9[0x60];
-
-/*0x1800*/ u64 iclr_scsi;
-/*0x1808*/ u64 iclr_eth;
-/*0x1810*/ u64 iclr_bpp;
-/*0x1818*/ u64 iclr_au_rec;
-/*0x1820*/ u64 iclr_au_play;
-/*0x1828*/ u64 iclr_pfail;
-/*0x1830*/ u64 iclr_kms;
-/*0x1838*/ u64 iclr_flpy;
-/*0x1840*/ u64 iclr_shw;
-/*0x1848*/ u64 iclr_kbd;
-/*0x1850*/ u64 iclr_ms;
-/*0x1858*/ u64 iclr_ser;
-/*0x1860*/ u64 iclr_tim0;
-/*0x1868*/ u64 iclr_tim1;
-/*0x1870*/ u64 iclr_ue;
-/*0x1878*/ u64 iclr_ce;
-/*0x1880*/ u64 iclr_a_err;
-/*0x1888*/ u64 iclr_b_err;
-/*0x1890*/ u64 iclr_pmgmt;
-
- u64 __pad10[0x2d];
-
- /* Interrupt Retry Timer. */
-/*0x1a00*/ u64 irq_retry;
-
- u64 __pad11[0x3f];
-
- /* Counters/Timers */
-/*0x1c00*/ u64 tim0_cnt;
-/*0x1c08*/ u64 tim0_lim;
-/*0x1c10*/ u64 tim1_cnt;
-/*0x1c18*/ u64 tim1_lim;
-/*0x1c20*/ u64 pci_dma_wsync; /* PCI DMA Write Sync Register (IIi) */
-
- u64 __pad12[0x7b];
-
- /* PCI Bus A Registers */
-/*0x2000*/ u64 pci_a_control; /* PCI Bus A Control Register */
-/*0x2008*/ u64 __pad13;
-/*0x2010*/ u64 pci_a_afsr; /* PCI Bus A Async Fault Status */
-/*0x2018*/ u64 pci_a_afar; /* PCI Bus A Async Fault Address*/
-/*0x2020*/ u64 pci_a_diag; /* PCI Bus A Diag Register */
-/*0x2028*/ u64 pci_tasr; /* PCI Target Address Space Reg (IIi) */
-
- u64 __pad14[0xfa];
-
- /* PCI Bus A/IOMMU Streaming Buffer Registers */
-/*0x2800*/ u64 sbuf_a_control; /* StrBuffer Control */
-/*0x2808*/ u64 sbuf_a_pflush; /* StrBuffer Page Flush */
-/*0x2810*/ u64 sbuf_a_fsync; /* StrBuffer Flush Sync Reg */
-
- u64 __pad15[0x2fd];
-
- /* PCI Bus B Registers */
-/*0x4000*/ u64 pci_b_control; /* PCI Bus B Control Register */
-/*0x4008*/ u64 __pad16;
-/*0x4010*/ u64 pci_b_afsr; /* PCI Bus B Async Fault Status */
-/*0x4018*/ u64 pci_b_afar; /* PCI Bus B Async Fault Address*/
-/*0x4020*/ u64 pci_b_diag; /* PCI Bus B Diag Register */
-
- u64 __pad17[0x7b];
-
- /* IOMMU diagnostic things */
-/*0x4400*/ u64 iommu_vdiag; /* VADDR Diagnostic Register */
-/*0x4408*/ u64 iommu_tcompare; /* IOMMU TLB Tag Compare */
-
- u64 __pad18[0x7e];
-
- /* PCI Bus B/IOMMU Streaming Buffer Registers */
-/*0x4800*/ u64 sbuf_b_control; /* StrBuffer Control */
-/*0x4808*/ u64 sbuf_b_pflush; /* StrBuffer Page Flush */
-/*0x4810*/ u64 sbuf_b_fsync; /* StrBuffer Flush Sync Reg */
-
- u64 __pad19[0xafd];
-
- /* DMA Scoreboard Diagnostic Registers */
-/*0xa000*/ u64 dscore_reg0; /* DMA Scoreboard Diag Reg 0 */
-/*0xa008*/ u64 dscore_reg1; /* DMA Scoreboard Diag Reg 1 */
-
- u64 __pad20[0x9e];
-
- /* More IOMMU diagnostic things */
-/*0xa500*/ u64 iommu_lru[16]; /* IOMMU LRU Queue Diag */
-/*0xa580*/ u64 iommu_tag[16]; /* IOMMU TLB Tag Diag */
-/*0xa600*/ u64 iommu_data[16]; /* IOMMU TLB Data RAM Diag */
-
- u64 __pad21[0x30];
-
- /* Interrupt State Diagnostics */
-/*0xa800*/ u64 pci_istate;
-/*0xa808*/ u64 obio_istate;
-
- u64 __pad22[0xfe];
-
- /* Streaming Buffer A Diagnostic Area */
-/*0xb000*/ u64 sbuf_a_data[128]; /* StrBuffer Data Ram Diag */
-/*0xb400*/ u64 sbuf_a_errs[128]; /* StrBuffer Error Status Diag*/
-/*0xb800*/ u64 sbuf_a_ptag[16]; /* StrBuffer Page Tag Diag */
-/*0xb880*/ u64 __pad23[16];
-/*0xb900*/ u64 sbuf_a_ltag[16]; /* StrBuffer Line Tag Diag */
-
- u64 __pad24[0xd0];
-
- /* Streaming Buffer B Diagnostic Area */
-/*0xc000*/ u64 sbuf_b_data[128]; /* StrBuffer Data Ram Diag */
-/*0xc400*/ u64 sbuf_b_errs[128]; /* StrBuffer Error Status Diag*/
-/*0xc800*/ u64 sbuf_b_ptag[16]; /* StrBuffer Page Tag Diag */
-/*0xc880*/ u64 __pad25[16];
-/*0xc900*/ u64 sbuf_b_ltag[16]; /* StrBuffer Line Tag Diag */
-};
-
-/* PSYCHO UPA Port ID */
-#define PSYCHO_UPPID_FESC 0xff00000000000000 /* FCode escape, 0xfc */
-#define PSYCHO_UPPID_RESV1 0x00fffff800000000 /* Reserved */
-#define PSYCHO_UPPID_ENV 0x0000000400000000 /* Cannot generate ECC */
-#define PSYCHO_UPPID_ORD 0x0000000200000000 /* One Outstanding Read */
-#define PSYCHO_UPPID_RESV2 0x0000000180000000 /* Reserved */
-#define PSYCHO_UPPID_PDQ 0x000000007e000000 /* Data Queue size */
-#define PSYCHO_UPPID_PRQ 0x0000000001e00000 /* Request Queue size */
-#define PSYCHO_UPPID_UCAP 0x00000000001f0000 /* UPA Capabilities */
-#define PSYCHO_UPPID_JEDEC 0x000000000000ffff /* JEDEC ID for PSYCHO */
-
-/* PSYCHO UPA Configuration Register */
-#define PSYCHO_UPCFG_RESV 0xffffffffffffff00 /* Reserved */
-#define PSYCHO_UPCFG_SCIQ1 0x00000000000000f0 /* Unused, always zero */
-#define PSYCHO_UPCFG_SCIQ2 0x000000000000000f /* Requests Queue size 0x2 */
-
-/* PSYCHO Control Register */
-#define PSYCHO_CONTROL_IMPL 0xf000000000000000 /* Implementation of this PSYCHO*/
-#define PSYCHO_CONTROL_VER 0x0f00000000000000 /* Version of this PSYCHO */
-#define PSYCHO_CONTROL_MID 0x00f8000000000000 /* UPA Module ID of PSYCHO */
-#define PSYCHO_CONTROL_IGN 0x0007c00000000000 /* Interrupt Group Number */
-#define PSYCHO_CONTROL_RESV 0x00003ffffffffff0 /* Reserved */
-#define PSYCHO_CONTROL_APCKEN 0x0000000000000008 /* Address Parity Check Enable */
-#define PSYCHO_CONTROL_APERR 0x0000000000000004 /* Incoming System Addr Parerr */
-#define PSYCHO_CONTROL_IAP 0x0000000000000002 /* Invert UPA Parity */
-#define PSYCHO_CONTROL_MODE 0x0000000000000001 /* PSYCHO clock mode */
-
-/* PSYCHO ECC Control Register */
-#define PSYCHO_ECNTRL_ECCEN 0x8000000000000000 /* Enable ECC Checking */
-#define PSYCHO_ECNTRL_UEEN 0x4000000000000000 /* Enable UE Interrupts */
-#define PSYCHO_ECNTRL_CEEN 0x2000000000000000 /* Enable CE Interrupts */
-
-/* Uncorrectable Error AFSR, AFAR holds low 40bits of faulting physical address. */
-#define PSYCHO_UEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */
-#define PSYCHO_UEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */
-#define PSYCHO_UEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */
-#define PSYCHO_UEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */
-#define PSYCHO_UEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */
-#define PSYCHO_UEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/
-#define PSYCHO_UEAFSR_RESV1 0x03ff000000000000 /* Reserved */
-#define PSYCHO_UEAFSR_BMSK 0x0000ffff00000000 /* Bytemask of failed transfer */
-#define PSYCHO_UEAFSR_DOFF 0x00000000e0000000 /* Doubleword Offset */
-#define PSYCHO_UEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */
-#define PSYCHO_UEAFSR_BLK 0x0000000000800000 /* Trans was block operation */
-#define PSYCHO_UEAFSR_RESV2 0x00000000007fffff /* Reserved */
-
-/* Correctable Error AFSR, AFAR holds low 40bits of faulting physical address. */
-#define PSYCHO_CEAFSR_PPIO 0x8000000000000000 /* Primary PIO is cause */
-#define PSYCHO_CEAFSR_PDRD 0x4000000000000000 /* Primary DVMA read is cause */
-#define PSYCHO_CEAFSR_PDWR 0x2000000000000000 /* Primary DVMA write is cause */
-#define PSYCHO_CEAFSR_SPIO 0x1000000000000000 /* Secondary PIO is cause */
-#define PSYCHO_CEAFSR_SDRD 0x0800000000000000 /* Secondary DVMA read is cause */
-#define PSYCHO_CEAFSR_SDWR 0x0400000000000000 /* Secondary DVMA write is cause*/
-#define PSYCHO_CEAFSR_RESV1 0x0300000000000000 /* Reserved */
-#define PSYCHO_CEAFSR_ESYND 0x00ff000000000000 /* Syndrome Bits */
-#define PSYCHO_CEAFSR_SIZE 0x0000ffff00000000 /* Bytemask of failed transfer */
-#define PSYCHO_CEAFSR_DOFF 0x00000000e0000000 /* Double Offset */
-#define PSYCHO_CEAFSR_MID 0x000000001f000000 /* UPA MID causing the fault */
-#define PSYCHO_CEAFSR_BLK 0x0000000000800000 /* Trans was block operation */
-#define PSYCHO_CEAFSR_RESV2 0x00000000007fffff /* Reserved */
-
-/* PSYCHO Performance Monitor Register, the counter holds 2 32-bit event counters. */
-#define PSYCHO_PMCTRL_RESV3 0xffffffffffff0000 /* Reserved */
-#define PSYCHO_PMCTRL_CLR1 0x0000000000008000 /* Clear SEL1 counter */
-#define PSYCHO_PMCTRL_RESV2 0x0000000000006000 /* Reserved */
-#define PSYCHO_PMCTRL_SEL1 0x0000000000001f00 /* Event source 1 */
-#define PSYCHO_PMCTRL_CLR0 0x0000000000000080 /* Clear SEL0 counter */
-#define PSYCHO_PMCTRL_RESV1 0x0000000000000060 /* Reserved */
-#define PSYCHO_PMCTRL_SEL0 0x000000000000001f /* Event source 0 */
-
-/* SEL0/SEL1 each can take any one of the following values. */
-#define PMCTRL_SEL_NSDRA 0x00 /* # of streaming dvma reads for PCI A */
-#define PMCTRL_SEL_NSDWA 0x01 /* # of streaming dvma writes for PCI A */
-#define PMCTRL_SEL_NCDRA 0x02 /* # of consistent dvma reads for PCI A */
-#define PMCTRL_SEL_NCDWA 0x03 /* # of consistent dvma writes for PCI A */
-#define PMCTRL_SEL_SBMA 0x04 /* # of streaming buffer misses on PCI A */
-#define PMCTRL_SEL_DCGA 0x05 /* # of DVMA granted cycles on PCI A */
-#define PMCTRL_SEL_DWTA 0x06 /* # of DVMA words transferred on PCI A */
-#define PMCTRL_SEL_CPIOA 0x07 /* # of PIO cycles used by PSYCHO on PCI A */
-#define PMCTRL_SEL_NSDRB 0x08 /* # of streaming dvma reads for PCI B */
-#define PMCTRL_SEL_NSDWB 0x09 /* # of streaming dvma writes for PCI B */
-#define PMCTRL_SEL_NCDRB 0x0a /* # of consistent dvma reads for PCI B */
-#define PMCTRL_SEL_NCDWB 0x0b /* # of consistent dvma writes for PCI B */
-#define PMCTRL_SEL_SBMB 0x0c /* # of streaming buffer misses on PCI B */
-#define PMCTRL_SEL_DCGB 0x0d /* # of DVMA granted cycles on PCI B */
-#define PMCTRL_SEL_DWTB 0x0e /* # of DVMA words transferred on PCI B */
-#define PMCTRL_SEL_CPIOB 0x0f /* # of PIO cycles used by PSYCHO on PCI B */
-#define PMCTRL_SEL_TMISS 0x10 /* # of IOMMU TLB misses */
-#define PMCTRL_SEL_IRQ 0x11 /* # of interrupts */
-#define PMCTRL_SEL_INACK 0x12 /* # of interrupt NACKs on UPA */
-#define PMCTRL_SEL_PRD 0x13 /* # of PIO reads */
-#define PMCTRL_SEL_PWR 0x14 /* # of PIO writes */
-#define PMCTRL_SEL_MBT 0x15 /* # of Merge Buffer transactions */
-#define PMCTRL_SEL_PDRTA 0x16 /* # of PCI A DVMA tablewalk induced retries */
-#define PMCTRL_SEL_PDRSA 0x17 /* # of PCI A DVMA str buf induced retries */
-#define PMCTRL_SEL_PDRTB 0x18 /* # of PCI B DVMA tablewalk induced retries */
-#define PMCTRL_SEL_PDRSB 0x19 /* # of PCI B DVMA str buf induced retries */
-/* Values 0x1a --> 0x1f are reserved. */
-
-/* PSYCHO PCI Control Register */
-#define PSYCHO_PCICTRL_RESV1 0xfffffff000000000 /* Reserved */
-#define PSYCHO_PCICTRL_SBH_ERR 0x0000000800000000 /* Streaming byte hole error */
-#define PSYCHO_PCICTRL_SERR 0x0000000400000000 /* SERR signal asserted */
-#define PSYCHO_PCICTRL_SPEED 0x0000000200000000 /* PCI speed (1 is U2P clock) */
-#define PSYCHO_PCICTRL_RESV2 0x00000001ffc00000 /* Reserved */
-#define PSYCHO_PCICTRL_ARB_PARK 0x0000000000200000 /* PCI arbitration parking */
-#define PSYCHO_PCICTRL_RESV3 0x00000000001ff800 /* Reserved */
-#define PSYCHO_PCICTRL_SBH_INT 0x0000000000000400 /* Streaming byte hole int enab */
-#define PSYCHO_PCICTRL_WEN 0x0000000000000200 /* Power Mgmt Wake Enable */
-#define PSYCHO_PCICTRL_EEN 0x0000000000000100 /* PCI Error Interrupt Enable */
-#define PSYCHO_PCICTRL_RESV4 0x00000000000000c0 /* Reserved */
-#define PSYCHO_PCICTRL_AEN 0x000000000000003f /* PCI DVMA Arbitration Enable */
-
-/* PSYCHO PCI AFSR, AFAR holds low 40 bits of physical address causing the fault. */
-#define PSYCHO_PCIAFSR_PMA 0x8000000000000000 /* Primary Master Abort Error */
-#define PSYCHO_PCIAFSR_PTA 0x4000000000000000 /* Primary Target Abort Error */
-#define PSYCHO_PCIAFSR_PRTRY 0x2000000000000000 /* Primary Excessive Retries */
-#define PSYCHO_PCIAFSR_PPERR 0x1000000000000000 /* Primary Parity Error */
-#define PSYCHO_PCIAFSR_SMA 0x0800000000000000 /* Secondary Master Abort Error */
-#define PSYCHO_PCIAFSR_STA 0x0400000000000000 /* Secondary Target Abort Error */
-#define PSYCHO_PCIAFSR_SRTRY 0x0200000000000000 /* Secondary Excessive Retries */
-#define PSYCHO_PCIAFSR_SPERR 0x0100000000000000 /* Secondary Parity Error */
-#define PSYCHO_PCIAFSR_RESV1 0x00ff000000000000 /* Reserved */
-#define PSYCHO_PCIAFSR_SIZE 0x0000ffff00000000 /* Bytemask of failed transfer */
-#define PSYCHO_PCIAFSR_BLK 0x0000000080000000 /* Trans was block operation */
-#define PSYCHO_PCIAFSR_RESV2 0x0000000040000000 /* Reserved */
-#define PSYCHO_PCIAFSR_MID 0x000000003e000000 /* MID causing the error */
-#define PSYCHO_PCIAFSR_RESV3 0x0000000001ffffff /* Reserved */
-
-/* PSYCHO Diagnostic Register. */
-#define PSYCHO_PSYDIAG_RESV 0xffffffffffffff80 /* Reserved */
-#define PSYCHO_PCIDIAG_DRETRY 0x0000000000000040 /* Disable retry limit */
-#define PSYCHO_PCIDIAG_DISYNC 0x0000000000000020 /* Disable DMA wr / irq sync */
-#define PSYCHO_PCIDIAG_DDWSYNC 0x0000000000000010 /* Disable DMA wr / PIO rd sync */
-#define PSYCHO_PCIDIAG_IDDPAR 0x0000000000000008 /* Invert DMA data parity */
-#define PSYCHO_PCIDIAG_IPDPAR 0x0000000000000004 /* Invert PIO data parity */
-#define PSYCHO_PCIDIAG_IPAPAR 0x0000000000000002 /* Invert PIO address parity */
-#define PSYCHO_PCIDIAG_LPBACK 0x0000000000000001 /* Enable loopback mode */
-
-/* IOMMU things defined fully in asm-sparc64/iommu.h */
-
-/* Streaming Buffer Control Register */
-#define PSYCHO_SBUFCTRL_RESV 0xffffffffffffff80 /* Reserved */
-#define PSYCHO_SBUFCTRL_LRU_LP 0x0000000000000070 /* LRU Lock Pointer */
-#define PSYCHO_SBUFCTRL_LRU_LE 0x0000000000000008 /* LRU Lock Enable */
-#define PSYCHO_SBUFCTRL_RR_DIS 0x0000000000000004 /* Rerun Disable */
-#define PSYCHO_SBUFCTRL_DE 0x0000000000000002 /* Diag Mode Enable */
-#define PSYCHO_SBUFCTRL_SB_EN 0x0000000000000001 /* Streaming Buffer Enable */
-
-/* Streaming Buffer Page Invalidate/Flush Register */
-#define PSYCHO_SBUFFLUSH_ADDR 0x00000000ffffe000 /* DVMA Page to be flushed */
-#define PSYCHO_SBUFFLUSH_RESV 0x0000000000001fff /* Ignored bits */
-
-/* Streaming Buffer Flush Synchronization Register */
-#define PSYCHO_SBUFSYNC_ADDR 0x000001ffffffffc0 /* Physical address to update */
-#define PSYCHO_SBUFSYNC_RESV 0x000000000000003f /* Ignored bits */
-
-/* DMA Scoreboard Diagnostic Register(s) */
-#define PSYCHO_DSCORE_VALID 0x8000000000000000 /* Entry is valid */
-#define PSYCHO_DSCORE_C 0x4000000000000000 /* Transaction cacheable */
-#define PSYCHO_DSCORE_READ 0x2000000000000000 /* Transaction was a read */
-#define PSYCHO_DSCORE_TAG 0x1f00000000000000 /* Transaction ID */
-#define PSYCHO_DSCORE_ADDR 0x00fffffffff80000 /* Transaction PADDR */
-#define PSYCHO_DSCORE_BMSK 0x000000000007fff8 /* Bytemask of pending transfer */
-#define PSYCHO_DSCORE_SRC 0x0000000000000007 /* Transaction source */
-
-/* PSYCHO Interrupt mapping register(s). */
-#define PSYCHO_IMAP_RESV1 0xffffffff00000000 /* Reserved */
-#define PSYCHO_IMAP_VALID 0x0000000080000000 /* This enables delivery. */
-#define PSYCHO_IMAP_TID 0x000000007c000000 /* Target ID (MID to send it to)*/
-#define PSYCHO_IMAP_RESV2 0x0000000003fff800 /* Reserved */
-#define PSYCHO_IMAP_IGN 0x00000000000007c0 /* Interrupt Group Number. */
-#define PSYCHO_IMAP_INO 0x000000000000003f /* Interrupt Number Offset. */
-#define PSYCHO_IMAP_INR 0x00000000000007ff /* Interrupt # (Gfx/UPA_slave) */
-
-/* PSYCHO Interrupt clear pseudo register(s). */
-#define PSYCHO_ICLR_RESV1 0xfffffffffffffff0 /* Reserved */
-#define PSYCHO_ICLR_IDLE 0x0000000000000000 /* Transition to idle state. */
-#define PSYCHO_ICLR_TRANSMIT 0x0000000000000001 /* Transition to transmit state */
-#define PSYCHO_ICLR_RESV2 0x0000000000000002 /* Reserved. */
-#define PSYCHO_ICLR_PENDING 0x0000000000000003 /* Transition to pending state. */
-
-/* PSYCHO Interrupt Retry Timer register. */
-#define PSYCHO_IRETRY_LIMIT 0x00000000000fffff /* The retry interval. */
-
-/* PSYCHO Interrupt State registers. XXX fields to be documented later */
-
-/* PSYCHO Counter register. XXX fields to be documented later */
-
-/* PSYCHO Limit register. XXX fields to be documented later */
-
-/* PSYCHO Performance Monitor Control register. XXX fields to be documented later */
-
-/* PSYCHO Performance Monitor Counter register. XXX fields to be documented later */
-
-#endif /* !(__SPARC64_PSYCHO_H) */
diff --git a/include/asm-sparc64/reg.h b/include/asm-sparc64/reg.h
index 2aabb1f42..fc68f9018 100644
--- a/include/asm-sparc64/reg.h
+++ b/include/asm-sparc64/reg.h
@@ -1,4 +1,4 @@
-/* $Id: reg.h,v 1.4 1997/09/14 08:40:29 davem Exp $
+/* $Id: reg.h,v 1.6 1999/09/06 08:22:10 jj Exp $
* linux/asm-sparc64/reg.h
* Layout of the registers as expected by gdb on the Sparc
* we should replace the user.h definitions with those in
@@ -38,6 +38,9 @@ struct regs {
unsigned int r_fprs;
};
+#define FPU_REGS_TYPE unsigned int
+#define FPU_FSR_TYPE unsigned long
+
struct fp_status {
unsigned long fpu_fr[32];
unsigned long Fpu_fsr;
@@ -48,5 +51,6 @@ struct fpu {
};
#define fpu_regs f_fpstatus.fpu_fr
+#define fpu_fsr f_fpstatus.Fpu_fsr
#endif /* __SPARC64_REG_H */
diff --git a/include/asm-sparc64/resource.h b/include/asm-sparc64/resource.h
index 02ba40894..a8ecef2a7 100644
--- a/include/asm-sparc64/resource.h
+++ b/include/asm-sparc64/resource.h
@@ -1,4 +1,4 @@
-/* $Id: resource.h,v 1.4 1998/11/19 20:01:49 davem Exp $
+/* $Id: resource.h,v 1.5 1999/07/30 09:31:21 davem Exp $
* resource.h: Resource definitions.
*
* Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -25,13 +25,13 @@
#define RLIM_NLIMITS 10
#ifdef __KERNEL__
-#define INIT_RLIMITS \
-{ \
- {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
- {LONG_MAX, LONG_MAX}, {_STK_LIM, LONG_MAX}, \
- { 0, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
- {NR_OPEN, NR_OPEN}, {MAX_TASKS_PER_USER, MAX_TASKS_PER_USER}, \
- {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX} \
+#define INIT_RLIMITS \
+{ \
+ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
+ {LONG_MAX, LONG_MAX}, {_STK_LIM, LONG_MAX}, \
+ { 0, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
+ {INR_OPEN, INR_OPEN}, {0, 0}, \
+ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX} \
}
#endif /* __KERNEL__ */
diff --git a/include/asm-sparc64/scatterlist.h b/include/asm-sparc64/scatterlist.h
index 9811fc06e..d64162a5a 100644
--- a/include/asm-sparc64/scatterlist.h
+++ b/include/asm-sparc64/scatterlist.h
@@ -1,4 +1,4 @@
-/* $Id: scatterlist.h,v 1.6 1998/12/16 04:33:57 davem Exp $ */
+/* $Id: scatterlist.h,v 1.7 1999/08/30 10:15:01 davem Exp $ */
#ifndef _SPARC64_SCATTERLIST_H
#define _SPARC64_SCATTERLIST_H
@@ -11,6 +11,7 @@ struct scatterlist {
unsigned int length;
__u32 dvma_address; /* A place to hang host-specific addresses at. */
+ __u32 dvma_length;
};
extern unsigned long phys_base;
diff --git a/include/asm-sparc64/sigcontext.h b/include/asm-sparc64/sigcontext.h
index 4ce040a78..d7128a875 100644
--- a/include/asm-sparc64/sigcontext.h
+++ b/include/asm-sparc64/sigcontext.h
@@ -1,20 +1,18 @@
-/* $Id: sigcontext.h,v 1.11 1998/10/06 09:28:37 jj Exp $ */
+/* $Id: sigcontext.h,v 1.12 1999/09/06 08:22:09 jj Exp $ */
#ifndef __SPARC64_SIGCONTEXT_H
#define __SPARC64_SIGCONTEXT_H
+#ifdef __KERNEL__
#include <asm/ptrace.h>
-
-#define SUNOS_MAXWIN 31
+#endif
#ifndef __ASSEMBLY__
-/* SunOS system call sigstack() uses this arg. */
-struct sunos_sigstack {
- unsigned int sig_sp;
- int onstack_flag;
-};
+#ifdef __KERNEL__
+
+#define __SUNOS_MAXWIN 31
-/* This is what SunOS does, so shall I. */
+/* This is what SunOS does, so shall I unless we use new 32bit signals or rt signals. */
struct sigcontext32 {
int sigc_onstack; /* state to restore */
int sigc_mask; /* sigmask to restore */
@@ -31,44 +29,30 @@ struct sigcontext32 {
int sigc_oswins; /* outstanding windows */
/* stack ptrs for each regwin buf */
- unsigned sigc_spbuf[SUNOS_MAXWIN];
+ unsigned sigc_spbuf[__SUNOS_MAXWIN];
/* Windows to restore after signal */
- struct reg_window32 sigc_wbuf[SUNOS_MAXWIN];
+ struct reg_window32 sigc_wbuf[__SUNOS_MAXWIN];
};
-/* This is what SunOS doesn't, so we have to write this alone. */
-struct sigcontext {
- int sigc_onstack; /* state to restore */
- int sigc_mask; /* sigmask to restore */
- unsigned long sigc_sp; /* stack pointer */
- unsigned long sigc_pc; /* program counter */
- unsigned long sigc_npc; /* next program counter */
- unsigned long sigc_psr; /* for condition codes etc */
- unsigned long sigc_g1; /* User uses these two registers */
- unsigned long sigc_o0; /* within the trampoline code. */
-
- /* Now comes information regarding the users window set
- * at the time of the signal.
- */
- int sigc_oswins; /* outstanding windows */
+#endif
- /* stack ptrs for each regwin buf */
- char *sigc_spbuf[SUNOS_MAXWIN];
+#ifdef __KERNEL__
- /* Windows to restore after signal */
- struct reg_window sigc_wbuf[SUNOS_MAXWIN];
-};
+/* This is what we use for 32bit new non-rt signals. */
typedef struct {
- struct pt_regs32 si_regs;
+ struct {
+ unsigned int psr;
+ unsigned int pc;
+ unsigned int npc;
+ unsigned int y;
+ unsigned int u_regs[16]; /* globals and ins */
+ } si_regs;
int si_mask;
} __siginfo32_t;
-typedef struct {
- struct pt_regs si_regs;
- long si_mask;
-} __siginfo_t;
+#endif
typedef struct {
unsigned int si_float_regs [64];
@@ -77,6 +61,30 @@ typedef struct {
unsigned long si_fprs;
} __siginfo_fpu_t;
+/* This is what SunOS doesn't, so we have to write this alone
+ and do it properly. */
+struct sigcontext {
+ /* The size of this array has to match SI_MAX_SIZE from siginfo.h */
+ char sigc_info[128];
+ struct {
+ unsigned long u_regs[16]; /* globals and ins */
+ unsigned long tstate;
+ unsigned long tpc;
+ unsigned long tnpc;
+ unsigned int y;
+ unsigned int fprs;
+ } sigc_regs;
+ __siginfo_fpu_t * sigc_fpu_save;
+ struct {
+ void * ss_sp;
+ int ss_flags;
+ unsigned long ss_size;
+ } sigc_stack;
+ unsigned long sigc_mask;
+};
+
+#ifdef __KERNEL__
+
/* This magic should be in g_upper[0] for all upper parts
to be valid. */
#define SIGINFO_EXTRA_V8PLUS_MAGIC 0x130e269
@@ -85,6 +93,8 @@ typedef struct {
unsigned int o_upper[8];
} siginfo_extra_v8plus_t;
+#endif
+
#endif /* !(__ASSEMBLY__) */
#endif /* !(__SPARC64_SIGCONTEXT_H) */
diff --git a/include/asm-sparc64/siginfo.h b/include/asm-sparc64/siginfo.h
index a23240e66..9e60d6015 100644
--- a/include/asm-sparc64/siginfo.h
+++ b/include/asm-sparc64/siginfo.h
@@ -57,7 +57,7 @@ typedef struct siginfo {
clock_t _stime;
} _sigchld;
- /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
+ /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
struct {
void *_addr; /* faulting insn/memory ref. */
int _trapno; /* TRAP # which caused the signal */
@@ -84,7 +84,7 @@ typedef struct siginfo32 {
/* kill() */
struct {
__kernel_pid_t32 _pid; /* sender's pid */
- __kernel_uid_t32 _uid; /* sender's uid */
+ unsigned int _uid; /* sender's uid */
} _kill;
/* POSIX.1b timers */
@@ -96,19 +96,20 @@ typedef struct siginfo32 {
/* POSIX.1b signals */
struct {
__kernel_pid_t32 _pid; /* sender's pid */
- __kernel_uid_t32 _uid; /* sender's uid */
+ unsigned int _uid; /* sender's uid */
sigval_t32 _sigval;
} _rt;
/* SIGCHLD */
struct {
__kernel_pid_t32 _pid; /* which child */
- int _status; /* exit code */
+ unsigned int _uid; /* sender's uid */
+ int _status; /* exit code */
__kernel_clock_t32 _utime;
__kernel_clock_t32 _stime;
} _sigchld;
- /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
+ /* SIGILL, SIGFPE, SIGSEGV, SIGBUS, SIGEMT */
struct {
u32 _addr; /* faulting insn/memory ref. */
int _trapno;
@@ -144,6 +145,7 @@ typedef struct siginfo32 {
* si_code values
* Digital reserves positive values for kernel-generated signals.
*/
+#define SI_NOINFO 32767 /* no information in siginfo_t */
#define SI_USER 0 /* sent by kill, sigsend, raise */
#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
#define SI_QUEUE -1 /* sent by sigqueue */
@@ -226,6 +228,12 @@ typedef struct siginfo32 {
#define NSIGPOLL 6
/*
+ * SIGEMT si_codes
+ */
+#define EMT_TAGOVF 1 /* tag overflow */
+#define NSIGEMT 1
+
+/*
* sigevent definitions
*
* It seems likely that SIGEV_THREAD will have to be handled from
diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h
index ba179564b..463ef3fdd 100644
--- a/include/asm-sparc64/signal.h
+++ b/include/asm-sparc64/signal.h
@@ -1,4 +1,4 @@
-/* $Id: signal.h,v 1.8 1998/07/29 16:32:39 jj Exp $ */
+/* $Id: signal.h,v 1.9 1999/09/06 08:22:11 jj Exp $ */
#ifndef _ASMSPARC64_SIGNAL_H
#define _ASMSPARC64_SIGNAL_H
@@ -196,7 +196,7 @@ struct sigstack {
/* Type of a signal handler. */
#ifdef __KERNEL__
-typedef void (*__sighandler_t)(int, int, struct sigcontext *, char *);
+typedef void (*__sighandler_t)(int, struct sigcontext *);
#else
typedef void (*__sighandler_t)(int);
#endif
@@ -219,10 +219,12 @@ struct __new_sigaction32 {
__new_sigset_t32 sa_mask;
};
+#ifdef __KERNEL__
struct k_sigaction {
struct __new_sigaction sa;
void *ka_restorer;
};
+#endif
struct __old_sigaction {
__sighandler_t sa_handler;
@@ -239,16 +241,18 @@ struct __old_sigaction32 {
};
typedef struct sigaltstack {
- void *ss_sp;
- int ss_flags;
- __kernel_size_t ss_size;
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
} stack_t;
+#ifdef __KERNEL__
typedef struct sigaltstack32 {
- u32 ss_sp;
- int ss_flags;
- __kernel_size_t32 ss_size;
+ u32 ss_sp;
+ int ss_flags;
+ __kernel_size_t32 ss_size;
} stack_t32;
+#endif
#endif /* !(__ASSEMBLY__) */
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index c5e99dab3..d20d9f1b4 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -6,7 +6,7 @@
#ifndef _SPARC64_SMP_H
#define _SPARC64_SMP_H
-#include <linux/tasks.h>
+#include <linux/threads.h>
#include <asm/asi.h>
#ifndef __ASSEMBLY__
diff --git a/include/asm-sparc64/smplock.h b/include/asm-sparc64/smplock.h
index 88a9e8bd1..5791e3c7a 100644
--- a/include/asm-sparc64/smplock.h
+++ b/include/asm-sparc64/smplock.h
@@ -5,7 +5,7 @@
*/
#include <linux/sched.h>
#include <linux/interrupt.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
extern spinlock_t kernel_flag;
diff --git a/include/asm-sparc64/spinlock.h b/include/asm-sparc64/spinlock.h
index e8d68eca3..c4e571564 100644
--- a/include/asm-sparc64/spinlock.h
+++ b/include/asm-sparc64/spinlock.h
@@ -8,78 +8,6 @@
#ifndef __ASSEMBLY__
-#ifndef __SMP__
-
-typedef unsigned char spinlock_t;
-#define SPIN_LOCK_UNLOCKED 0
-
-#define spin_lock_init(lock) do { } while(0)
-#define spin_lock(lock) do { } while(0)
-#define spin_trylock(lock) (1)
-#define spin_unlock_wait(lock) do { } while(0)
-#define spin_unlock(lock) do { } while(0)
-#define spin_lock_irq(lock) cli()
-#define spin_unlock_irq(lock) sti()
-#define spin_lock_bh(lock) \
-do { local_bh_count++; \
- barrier(); \
-} while(0)
-#define spin_unlock_bh(lock) \
-do { barrier(); \
- local_bh_count--; \
-} while(0)
-
-#define spin_lock_irqsave(lock, flags) save_and_cli(flags)
-#define spin_unlock_irqrestore(lock, flags) restore_flags(flags)
-
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- */
-typedef unsigned int rwlock_t;
-#define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
-
-#define read_lock(lock) do { } while(0)
-#define read_unlock(lock) do { } while(0)
-#define write_lock(lock) do { } while(0)
-#define write_unlock(lock) do { } while(0)
-#define read_lock_irq(lock) cli()
-#define read_unlock_irq(lock) sti()
-#define read_lock_bh(lock) \
-do { local_bh_count++; \
- barrier(); \
-} while(0)
-#define read_unlock_bh(lock) \
-do { barrier(); \
- local_bh_count--; \
-} while(0)
-
-#define write_lock_irq(lock) cli()
-#define write_unlock_irq(lock) sti()
-
-#define write_lock_bh(lock) \
-do { local_bh_count++; \
- barrier(); \
-} while(0)
-
-#define write_unlock_bh(lock) \
-do { barrier(); \
- local_bh_count--; \
-} while(0)
-
-#define read_lock_irqsave(lock, flags) save_and_cli(flags)
-#define read_unlock_irqrestore(lock, flags) restore_flags(flags)
-#define write_lock_irqsave(lock, flags) save_and_cli(flags)
-#define write_unlock_irqrestore(lock, flags) restore_flags(flags)
-
-#else /* !(__SMP__) */
-
/* To get debugging spinlocks which detect and catch
* deadlock situations, set DEBUG_SPINLOCKS in the sparc64
* specific makefile and rebuild your kernel.
@@ -141,82 +69,12 @@ extern __inline__ int spin_trylock(spinlock_t *lock)
extern __inline__ void spin_unlock(spinlock_t *lock)
{
__asm__ __volatile__("membar #StoreStore | #LoadStore\n\t"
- "stb %%g0, [%0]\n\t"
+ "stb %%g0, [%0]"
: /* No outputs */
: "r" (lock)
: "memory");
}
-extern __inline__ void spin_lock_irq(spinlock_t *lock)
-{
- __asm__ __volatile__("
- wrpr %%g0, 15, %%pil
-1: ldstub [%0], %%g7
- brnz,pn %%g7, 2f
- membar #StoreLoad | #StoreStore
- .subsection 2
-2: ldub [%0], %%g7
- brnz,pt %%g7, 2b
- membar #LoadLoad
- b,a,pt %%xcc, 1b
- .previous
-" : /* no outputs */
- : "r" (lock)
- : "g7", "memory");
-}
-
-extern __inline__ void spin_unlock_irq(spinlock_t *lock)
-{
- __asm__ __volatile__("
- membar #StoreStore | #LoadStore
- stb %%g0, [%0]
- wrpr %%g0, 0x0, %%pil
-" : /* no outputs */
- : "r" (lock)
- : "memory");
-}
-
-#define spin_lock_bh(__lock) \
-do { local_bh_count++; \
- spin_lock(__lock); \
-} while(0)
-
-#define spin_unlock_bh(__lock) \
-do { spin_unlock(__lock); \
- local_bh_count--; \
-} while(0)
-
-#define spin_lock_irqsave(__lock, flags) \
-do { register spinlock_t *__lp asm("g1"); \
- __lp = (__lock); \
- __asm__ __volatile__( \
- "\n rdpr %%pil, %0\n" \
- " wrpr %%g0, 15, %%pil\n" \
- "1: ldstub [%1], %%g7\n" \
- " brnz,pn %%g7, 2f\n" \
- " membar #StoreLoad | #StoreStore\n" \
- " .subsection 2\n" \
- "2: ldub [%1], %%g7\n" \
- " brnz,pt %%g7, 2b\n" \
- " membar #LoadLoad\n" \
- " b,a,pt %%xcc, 1b\n" \
- " .previous\n" \
- : "=&r" (flags) \
- : "r" (__lp) \
- : "g7", "memory"); \
-} while(0)
-
-extern __inline__ void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
-{
- __asm__ __volatile__("
- membar #StoreStore | #LoadStore
- stb %%g0, [%0]
- wrpr %1, 0x0, %%pil
-" : /* no outputs */
- : "r" (lock), "r" (flags)
- : "memory");
-}
-
#else /* !(SPIN_LOCK_DEBUG) */
typedef struct {
@@ -241,13 +99,7 @@ extern int _spin_trylock (spinlock_t *lock);
#define spin_trylock(lp) _spin_trylock(lp)
#define spin_lock(lock) _do_spin_lock(lock, "spin_lock")
-#define spin_lock_irq(lock) do { __cli(); _do_spin_lock(lock, "spin_lock_irq"); } while(0)
-#define spin_lock_bh(lock) do { local_bh_count++; _do_spin_lock(lock, "spin_lock_bh"); } while(0)
-#define spin_lock_irqsave(lock, flags) do { __save_and_cli(flags); _do_spin_lock(lock, "spin_lock_irqsave"); } while(0)
#define spin_unlock(lock) _do_spin_unlock(lock)
-#define spin_unlock_irq(lock) do { _do_spin_unlock(lock); __sti(); } while(0)
-#define spin_unlock_bh(lock) do { _do_spin_unlock(lock); local_bh_count--; } while(0)
-#define spin_unlock_irqrestore(lock, flags) do { _do_spin_unlock(lock); __restore_flags(flags); } while(0)
#endif /* SPIN_LOCK_DEBUG */
@@ -294,24 +146,6 @@ do { register rwlock_t *__X asm("g1"); \
: "g2", "g3", "g5", "g7", "cc", "memory"); \
} while(0)
-#define read_lock_irq(lock) do { __cli(); read_lock(lock); } while (0)
-#define read_unlock_irq(lock) do { read_unlock(lock); __sti(); } while (0)
-#define read_lock_bh(lock) do { local_bh_count++; read_lock(lock); } while (0)
-#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_count--; } while (0)
-#define write_lock_irq(lock) do { __cli(); write_lock(lock); } while (0)
-#define write_unlock_irq(lock) do { write_unlock(lock); __sti(); } while (0)
-#define write_lock_bh(lock) do { local_bh_count++; write_lock(lock); } while (0)
-#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_count--; } while (0)
-
-#define read_lock_irqsave(lock, flags) \
- do { __save_and_cli(flags); read_lock(lock); } while (0)
-#define read_unlock_irqrestore(lock, flags) \
- do { read_unlock(lock); __restore_flags(flags); } while (0)
-#define write_lock_irqsave(lock, flags) \
- do { __save_and_cli(flags); write_lock(lock); } while (0)
-#define write_unlock_irqrestore(lock, flags) \
- do { write_unlock(lock); __restore_flags(flags); } while (0)
-
#else /* !(SPIN_LOCK_DEBUG) */
typedef struct {
@@ -332,9 +166,6 @@ do { unsigned long flags; \
_do_read_lock(lock, "read_lock"); \
__restore_flags(flags); \
} while(0)
-#define read_lock_irq(lock) do { __cli(); _do_read_lock(lock, "read_lock_irq"); } while(0)
-#define read_lock_bh(lock) do { local_bh_count++; _do_read_lock(lock, "read_lock_bh"); } while(0)
-#define read_lock_irqsave(lock, flags) do { __save_and_cli(flags); _do_read_lock(lock, "read_lock_irqsave"); } while(0)
#define read_unlock(lock) \
do { unsigned long flags; \
@@ -342,9 +173,6 @@ do { unsigned long flags; \
_do_read_unlock(lock, "read_unlock"); \
__restore_flags(flags); \
} while(0)
-#define read_unlock_irq(lock) do { _do_read_unlock(lock, "read_unlock_irq"); __sti() } while(0)
-#define read_unlock_bh(lock) do { _do_read_unlock(lock, "read_unlock_bh"); local_bh_count--; } while(0)
-#define read_unlock_irqrestore(lock, flags) do { _do_read_unlock(lock, "read_unlock_irqrestore"); __restore_flags(flags); } while(0)
#define write_lock(lock) \
do { unsigned long flags; \
@@ -352,9 +180,6 @@ do { unsigned long flags; \
_do_write_lock(lock, "write_lock"); \
__restore_flags(flags); \
} while(0)
-#define write_lock_irq(lock) do { __cli(); _do_write_lock(lock, "write_lock_irq"); } while(0)
-#define write_lock_bh(lock) do { local_bh_count++; _do_write_lock(lock, "write_lock_bh"); } while(0)
-#define write_lock_irqsave(lock, flags) do { __save_and_cli(flags); _do_write_lock(lock, "write_lock_irqsave"); } while(0)
#define write_unlock(lock) \
do { unsigned long flags; \
@@ -362,14 +187,9 @@ do { unsigned long flags; \
_do_write_unlock(lock); \
__restore_flags(flags); \
} while(0)
-#define write_unlock_irq(lock) do { _do_write_unlock(lock); __sti(); } while(0)
-#define write_unlock_bh(lock) do { _do_write_unlock(lock); local_bh_count--; } while(0)
-#define write_unlock_irqrestore(lock, flags) do { _do_write_unlock(lock); __restore_flags(flags); } while(0)
#endif /* SPIN_LOCK_DEBUG */
-#endif /* __SMP__ */
-
#endif /* !(__ASSEMBLY__) */
-#endif /* !(__SPARC64_SPIN%0_H) */
+#endif /* !(__SPARC64_SPINLOCK_H) */
diff --git a/include/asm-sparc64/sunbpp.h b/include/asm-sparc64/sunbpp.h
new file mode 100644
index 000000000..b441cc9c4
--- /dev/null
+++ b/include/asm-sparc64/sunbpp.h
@@ -0,0 +1,80 @@
+/* $Id: sunbpp.h,v 1.1 1999/08/13 06:21:44 shadow Exp $
+ * include/asm-sparc64/sunbpp.h
+ */
+
+#ifndef _ASM_SPARC64_SUNBPP_H
+#define _ASM_SPARC64_SUNBPP_H
+
+struct bpp_regs {
+ /* DMA registers */
+ __volatile__ __u32 p_csr; /* DMA Control/Status Register */
+ __volatile__ __u32 p_addr; /* Address Register */
+ __volatile__ __u32 p_bcnt; /* Byte Count Register */
+ __volatile__ __u32 p_tst_csr; /* Test Control/Status (DMA2 only) */
+ /* Parallel Port registers */
+ __volatile__ __u16 p_hcr; /* Hardware Configuration Register */
+ __volatile__ __u16 p_ocr; /* Operation Configuration Register */
+ __volatile__ __u8 p_dr; /* Parallel Data Register */
+ __volatile__ __u8 p_tcr; /* Transfer Control Register */
+ __volatile__ __u8 p_or; /* Output Register */
+ __volatile__ __u8 p_ir; /* Input Register */
+ __volatile__ __u16 p_icr; /* Interrupt Control Register */
+};
+
+/* P_HCR. Time is in increments of SBus clock. */
+#define P_HCR_TEST 0x8000 /* Allows buried counters to be read */
+#define P_HCR_DSW 0x7f00 /* Data strobe width (in ticks) */
+#define P_HCR_DDS 0x007f /* Data setup before strobe (in ticks) */
+
+/* P_OCR. */
+#define P_OCR_MEM_CLR 0x8000
+#define P_OCR_DATA_SRC 0x4000 /* ) */
+#define P_OCR_DS_DSEL 0x2000 /* ) Bidirectional */
+#define P_OCR_BUSY_DSEL 0x1000 /* ) selects */
+#define P_OCR_ACK_DSEL 0x0800 /* ) */
+#define P_OCR_EN_DIAG 0x0400
+#define P_OCR_BUSY_OP 0x0200 /* Busy operation */
+#define P_OCR_ACK_OP 0x0100 /* Ack operation */
+#define P_OCR_SRST 0x0080 /* Reset state machines. Not selfcleaning. */
+#define P_OCR_IDLE 0x0008 /* PP data transfer state machine is idle */
+#define P_OCR_V_ILCK 0x0002 /* Versatec faded. Zebra only. */
+#define P_OCR_EN_VER 0x0001 /* Enable Versatec (0 - enable). Zebra only. */
+
+/* P_TCR */
+#define P_TCR_DIR 0x08
+#define P_TCR_BUSY 0x04
+#define P_TCR_ACK 0x02
+#define P_TCR_DS 0x01 /* Strobe */
+
+/* P_OR */
+#define P_OR_V3 0x20 /* ) */
+#define P_OR_V2 0x10 /* ) on Zebra only */
+#define P_OR_V1 0x08 /* ) */
+#define P_OR_INIT 0x04
+#define P_OR_AFXN 0x02 /* Auto Feed */
+#define P_OR_SLCT_IN 0x01
+
+/* P_IR */
+#define P_IR_PE 0x04
+#define P_IR_SLCT 0x02
+#define P_IR_ERR 0x01
+
+/* P_ICR */
+#define P_DS_IRQ 0x8000 /* RW1 */
+#define P_ACK_IRQ 0x4000 /* RW1 */
+#define P_BUSY_IRQ 0x2000 /* RW1 */
+#define P_PE_IRQ 0x1000 /* RW1 */
+#define P_SLCT_IRQ 0x0800 /* RW1 */
+#define P_ERR_IRQ 0x0400 /* RW1 */
+#define P_DS_IRQ_EN 0x0200 /* RW Always on rising edge */
+#define P_ACK_IRQ_EN 0x0100 /* RW Always on rising edge */
+#define P_BUSY_IRP 0x0080 /* RW 1= rising edge */
+#define P_BUSY_IRQ_EN 0x0040 /* RW */
+#define P_PE_IRP 0x0020 /* RW 1= rising edge */
+#define P_PE_IRQ_EN 0x0010 /* RW */
+#define P_SLCT_IRP 0x0008 /* RW 1= rising edge */
+#define P_SLCT_IRQ_EN 0x0004 /* RW */
+#define P_ERR_IRP 0x0002 /* RW1 1= rising edge */
+#define P_ERR_IRQ_EN 0x0001 /* RW */
+
+#endif /* !(_ASM_SPARC64_SUNBPP_H) */
diff --git a/include/asm-sparc64/sysio.h b/include/asm-sparc64/sysio.h
index 8508f7e0c..5ee5875f2 100644
--- a/include/asm-sparc64/sysio.h
+++ b/include/asm-sparc64/sysio.h
@@ -1,4 +1,4 @@
-/* $Id: sysio.h,v 1.8 1998/11/29 15:49:54 davem Exp $
+/* $Id: sysio.h,v 1.9 1999/08/30 10:15:03 davem Exp $
* sysio.h: UltraSparc sun5 specific SBUS definitions.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -11,34 +11,34 @@
/* SUN5 SYSIO Register Set, one per controller probed. */
struct sysio_regs {
-/*0x0000*/ u64 upa_id; /* SYSIO UPA Port ID Register */
-/*0x0008*/ u64 upa_cfg; /* SYSIO UPA Config Register */
-/*0x0010*/ u64 control; /* SYSIO Control Register */
-/*0x0018*/ u64 _unused1;
-/*0x0020*/ u64 ecc_control; /* ECC Control Register */
-/*0x0028*/ u64 _unused2;
+/*0x0000*/ volatile u64 upa_id; /* SYSIO UPA Port ID Register */
+/*0x0008*/ volatile u64 upa_cfg; /* SYSIO UPA Config Register */
+/*0x0010*/ volatile u64 control; /* SYSIO Control Register */
+/*0x0018*/ volatile u64 _unused1;
+/*0x0020*/ volatile u64 ecc_control; /* ECC Control Register */
+/*0x0028*/ volatile u64 _unused2;
/* Uncorrectable Error Fault Registers */
-/*0x0030*/ u64 ue_afsr; /* UE Async Fault Status */
-/*0x0038*/ u64 ue_afar; /* UE Async Fault Address */
+/*0x0030*/ volatile u64 ue_afsr; /* UE Async Fault Status */
+/*0x0038*/ volatile u64 ue_afar; /* UE Async Fault Address */
/* Correctable Error Fault Registers */
-/*0x0040*/ u64 ce_afsr; /* CE Async Fault Status */
-/*0x0048*/ u64 ce_afar; /* CE Async Fault Address */
+/*0x0040*/ volatile u64 ce_afsr; /* CE Async Fault Status */
+/*0x0048*/ volatile u64 ce_afar; /* CE Async Fault Address */
- u64 __pad0[0x16];
+ volatile u64 __pad0[0x16];
/* Performance Monitoring Registers */
-/*0x0100*/ u64 pmon_control;
-/*0x0108*/ u64 pmon_counter;
+/*0x0100*/ volatile u64 pmon_control;
+/*0x0108*/ volatile u64 pmon_counter;
- u64 __pad1[0x3de];
+ volatile u64 __pad1[0x3de];
/* SBUS Module Registers */
-/*0x2000*/ u64 sbus_control; /* SBUS Control Register */
-/*0x2008*/ u64 _unused3;
-/*0x2010*/ u64 sbus_afsr; /* SBUS Async Fault Status */
-/*0x2018*/ u64 sbus_afar; /* SBUS Async Fault Address */
+/*0x2000*/ volatile u64 sbus_control; /* SBUS Control Register */
+/*0x2008*/ volatile u64 _unused3;
+/*0x2010*/ volatile u64 sbus_afsr; /* SBUS Async Fault Status */
+/*0x2018*/ volatile u64 sbus_afar; /* SBUS Async Fault Address */
/* SBUS Slot Configuration Registers.
* On Fusion/Electron/Pulsar desktops/servers slots 4-->6
@@ -52,137 +52,137 @@ struct sysio_regs {
* On Sunfire/Starfire/Wildfire enterprise boxen these upper slots
* are unused.
*/
-/*0x2020*/ u64 sbus_s0cfg; /* SBUS Slot 0 Config */
-/*0x2028*/ u64 sbus_s1cfg; /* SBUS Slot 1 Config */
-/*0x2030*/ u64 sbus_s2cfg; /* SBUS Slot 2 Config */
-/*0x2038*/ u64 sbus_s3cfg; /* SBUS Slot 3 Config */
-/*0x2040*/ u64 sbus_s4cfg; /* SBUS Slot 4 Config */
-/*0x2048*/ u64 sbus_s5cfg; /* SBUS Slot 5 Config */
-/*0x2050*/ u64 sbus_s6cfg; /* SBUS Slot 6 Config */
+/*0x2020*/ volatile u64 sbus_s0cfg; /* SBUS Slot 0 Config */
+/*0x2028*/ volatile u64 sbus_s1cfg; /* SBUS Slot 1 Config */
+/*0x2030*/ volatile u64 sbus_s2cfg; /* SBUS Slot 2 Config */
+/*0x2038*/ volatile u64 sbus_s3cfg; /* SBUS Slot 3 Config */
+/*0x2040*/ volatile u64 sbus_s4cfg; /* SBUS Slot 4 Config */
+/*0x2048*/ volatile u64 sbus_s5cfg; /* SBUS Slot 5 Config */
+/*0x2050*/ volatile u64 sbus_s6cfg; /* SBUS Slot 6 Config */
- u64 __pad2[0x75];
+ volatile u64 __pad2[0x75];
/* SBUS IOMMU lives here */
-/*0x2400*/ u64 iommu_control; /* IOMMU Control */
-/*0x2408*/ u64 iommu_tsbbase; /* IOMMU TSB Base */
-/*0x2410*/ u64 iommu_flush; /* IOMMU Flush Register */
+/*0x2400*/ volatile u64 iommu_control; /* IOMMU Control */
+/*0x2408*/ volatile u64 iommu_tsbbase; /* IOMMU TSB Base */
+/*0x2410*/ volatile u64 iommu_flush; /* IOMMU Flush Register */
- u64 __pad3[0x7d];
+ volatile u64 __pad3[0x7d];
/* SBUS/IOMMU Streaming Buffer Registers */
-/*0x2800*/ u64 sbuf_control; /* StrBuffer Control */
-/*0x2808*/ u64 sbuf_pflush; /* StrBuffer Page Flush */
-/*0x2810*/ u64 sbuf_fsync; /* StrBuffer Flush Synchronization Reg */
+/*0x2800*/ volatile u64 sbuf_control; /* StrBuffer Control */
+/*0x2808*/ volatile u64 sbuf_pflush; /* StrBuffer Page Flush */
+/*0x2810*/ volatile u64 sbuf_fsync; /* StrBuffer Flush Synchronization Reg */
- u64 __pad4[0x7d];
+ volatile u64 __pad4[0x7d];
/* Interrupt mapping/control registers */
-/*0x2c00*/ u32 _uim0, imap_slot0; /* SBUS Slot 0 Int Mapping */
-/*0x2c08*/ u32 _uim1, imap_slot1; /* SBUS Slot 1 Int Mapping */
-/*0x2c10*/ u32 _uim2, imap_slot2; /* SBUS Slot 2 Int Mapping */
-/*0x2c18*/ u32 _uim3, imap_slot3; /* SBUS Slot 3 Int Mapping */
+/*0x2c00*/ volatile u32 _uim0, imap_slot0; /* SBUS Slot 0 Int Mapping */
+/*0x2c08*/ volatile u32 _uim1, imap_slot1; /* SBUS Slot 1 Int Mapping */
+/*0x2c10*/ volatile u32 _uim2, imap_slot2; /* SBUS Slot 2 Int Mapping */
+/*0x2c18*/ volatile u32 _uim3, imap_slot3; /* SBUS Slot 3 Int Mapping */
/* Interrupt Retry Timer. */
-/*0x2c20*/ u32 _irpad, irq_retry;
+/*0x2c20*/ volatile u32 _irpad, irq_retry;
- u64 __pad5[0x7b];
+ volatile u64 __pad5[0x7b];
/* The following are only used on Fusion/Electron/Pulsar
* desktop systems, they mean nothing on Sunfire/Starfire/Wildfire
*/
-/*0x3000*/ u32 _uis, imap_scsi; /* SCSI Int Mapping */
-/*0x3008*/ u32 _uie, imap_eth; /* Ethernet Int Mapping */
-/*0x3010*/ u32 _uip, imap_bpp; /* Parallel Port Int Mapping */
-/*0x3018*/ u32 _uia, imap_audio; /* Audio Int Mapping */
-/*0x3020*/ u32 _uipf, imap_pfail; /* Power Fail Int Mapping */
-/*0x3028*/ u32 _uik, imap_kms; /* Kbd/Mouse/Serial Int Mapping */
-/*0x3030*/ u32 _uif, imap_flpy; /* Floppy Int Mapping */
-/*0x3038*/ u32 _uishw, imap_shw; /* Spare HW Int Mapping */
-/*0x3040*/ u32 _uikbd, imap_kbd; /* Kbd Only Int Mapping */
-/*0x3048*/ u32 _uims, imap_ms; /* Mouse Only Int Mapping */
-/*0x3050*/ u32 _uiser, imap_ser; /* Serial Only Int Mapping */
-/*0x3058*/ u64 _imap_unused;
-/*0x3060*/ u32 _uit0, imap_tim0; /* Timer 0 Int Mapping */
-/*0x3068*/ u32 _uit1, imap_tim1; /* Timer 1 Int Mapping */
-/*0x3070*/ u32 _uiue, imap_ue; /* UE Int Mapping */
-/*0x3078*/ u32 _uice, imap_ce; /* CE Int Mapping */
-/*0x3080*/ u32 _uisbe, imap_sberr; /* SBUS Err Int Mapping */
-/*0x3088*/ u32 _uipm, imap_pmgmt; /* Power Mgmt Int Mapping */
-/*0x3090*/ u32 _uigfx, imap_gfx; /* OB Graphics Int Mapping */
-/*0x3098*/ u32 _uieupa, imap_eupa; /* UPA Expansion Int Mapping */
-
- u64 __pad6[0x6c];
+/*0x3000*/ volatile u32 _uis, imap_scsi; /* SCSI Int Mapping */
+/*0x3008*/ volatile u32 _uie, imap_eth; /* Ethernet Int Mapping */
+/*0x3010*/ volatile u32 _uip, imap_bpp; /* Parallel Port Int Mapping */
+/*0x3018*/ volatile u32 _uia, imap_audio; /* Audio Int Mapping */
+/*0x3020*/ volatile u32 _uipf, imap_pfail; /* Power Fail Int Mapping */
+/*0x3028*/ volatile u32 _uik, imap_kms; /* Kbd/Ms/Serial Int Mapping */
+/*0x3030*/ volatile u32 _uif, imap_flpy; /* Floppy Int Mapping */
+/*0x3038*/ volatile u32 _uishw, imap_shw; /* Spare HW Int Mapping */
+/*0x3040*/ volatile u32 _uikbd, imap_kbd; /* Kbd Only Int Mapping */
+/*0x3048*/ volatile u32 _uims, imap_ms; /* Mouse Only Int Mapping */
+/*0x3050*/ volatile u32 _uiser, imap_ser; /* Serial Only Int Mapping */
+/*0x3058*/ volatile u64 _imap_unused;
+/*0x3060*/ volatile u32 _uit0, imap_tim0; /* Timer 0 Int Mapping */
+/*0x3068*/ volatile u32 _uit1, imap_tim1; /* Timer 1 Int Mapping */
+/*0x3070*/ volatile u32 _uiue, imap_ue; /* UE Int Mapping */
+/*0x3078*/ volatile u32 _uice, imap_ce; /* CE Int Mapping */
+/*0x3080*/ volatile u32 _uisbe, imap_sberr; /* SBUS Err Int Mapping */
+/*0x3088*/ volatile u32 _uipm, imap_pmgmt; /* Power Mgmt Int Mapping */
+/*0x3090*/ volatile u32 _uigfx, imap_gfx; /* OB Graphics Int Mapping */
+/*0x3098*/ volatile u32 _uieupa, imap_eupa; /* UPA Expansion Int Mapping */
+
+ volatile u64 __pad6[0x6c];
/* Interrupt Clear Registers */
-/*0x3400*/ u32 __ucu0, iclr_unused0;
-/*0x3408*/ u32 _ucs0, iclr_slot0;
- u64 __pad7[0x7];
-/*0x3448*/ u32 _ucs1, iclr_slot1;
- u64 __pad8[0x7];
-/*0x3488*/ u32 _ucs2, iclr_slot2;
- u64 __pad9[0x7];
-/*0x34c8*/ u32 _ucs3, iclr_slot3;
- u64 __pad10[0x66];
-/*0x3800*/ u32 _ucscsi, iclr_scsi;
-/*0x3808*/ u32 _uceth, iclr_eth;
-/*0x3810*/ u32 _ucbpp, iclr_bpp;
-/*0x3818*/ u32 _ucaudio, iclr_audio;
-/*0x3820*/ u32 _ucpfail, iclr_pfail;
-/*0x3828*/ u32 _uckms, iclr_kms;
-/*0x3830*/ u32 _ucflpy, iclr_flpt;
-/*0x3838*/ u32 _ucshw, iclr_shw;
-/*0x3840*/ u32 _uckbd, iclr_kbd;
-/*0x3848*/ u32 _ucms, iclr_ms;
-/*0x3850*/ u32 _ucser, iclr_ser;
-/*0x3858*/ u64 iclr_unused1;
-/*0x3860*/ u32 _uctim0, iclr_tim0;
-/*0x3868*/ u32 _uctim1, iclr_tim1;
-/*0x3870*/ u32 _ucue, iclr_ue;
-/*0x3878*/ u32 _ucce, iclr_ce;
-/*0x3880*/ u32 _ucserr, iclr_serr;
-/*0x3888*/ u32 _ucpmgmt, iclr_pmgmt;
-
- u64 __pad11[0x6e];
+/*0x3400*/ volatile u32 __ucu0, iclr_unused0;
+/*0x3408*/ volatile u32 _ucs0, iclr_slot0;
+ volatile u64 __pad7[0x7];
+/*0x3448*/ volatile u32 _ucs1, iclr_slot1;
+ volatile u64 __pad8[0x7];
+/*0x3488*/ volatile u32 _ucs2, iclr_slot2;
+ volatile u64 __pad9[0x7];
+/*0x34c8*/ volatile u32 _ucs3, iclr_slot3;
+ volatile u64 __pad10[0x66];
+/*0x3800*/ volatile u32 _ucscsi, iclr_scsi;
+/*0x3808*/ volatile u32 _uceth, iclr_eth;
+/*0x3810*/ volatile u32 _ucbpp, iclr_bpp;
+/*0x3818*/ volatile u32 _ucaudio, iclr_audio;
+/*0x3820*/ volatile u32 _ucpfail, iclr_pfail;
+/*0x3828*/ volatile u32 _uckms, iclr_kms;
+/*0x3830*/ volatile u32 _ucflpy, iclr_flpt;
+/*0x3838*/ volatile u32 _ucshw, iclr_shw;
+/*0x3840*/ volatile u32 _uckbd, iclr_kbd;
+/*0x3848*/ volatile u32 _ucms, iclr_ms;
+/*0x3850*/ volatile u32 _ucser, iclr_ser;
+/*0x3858*/ volatile u64 iclr_unused1;
+/*0x3860*/ volatile u32 _uctim0, iclr_tim0;
+/*0x3868*/ volatile u32 _uctim1, iclr_tim1;
+/*0x3870*/ volatile u32 _ucue, iclr_ue;
+/*0x3878*/ volatile u32 _ucce, iclr_ce;
+/*0x3880*/ volatile u32 _ucserr, iclr_serr;
+/*0x3888*/ volatile u32 _ucpmgmt, iclr_pmgmt;
+
+ volatile u64 __pad11[0x6e];
/* Counters/Timers */
-/*0x3c00*/ u64 tim0_cnt;
-/*0x3c08*/ u64 tim0_lim;
-/*0x3c10*/ u64 tim1_cnt;
-/*0x3c18*/ u64 tim1_lim;
+/*0x3c00*/ volatile u64 tim0_cnt;
+/*0x3c08*/ volatile u64 tim0_lim;
+/*0x3c10*/ volatile u64 tim1_cnt;
+/*0x3c18*/ volatile u64 tim1_lim;
- u64 __pad12[0x7c];
+ volatile u64 __pad12[0x7c];
/* DMA Scoreboard Diagnostic Registers */
-/*0x4000*/ u64 dscore_reg0; /* DMA Scoreboard Diag Reg 0 */
-/*0x4008*/ u64 dscore_reg1; /* DMA Scoreboard Diag Reg 1 */
+/*0x4000*/ volatile u64 dscore_reg0; /* DMA Scoreboard Diag Reg 0 */
+/*0x4008*/ volatile u64 dscore_reg1; /* DMA Scoreboard Diag Reg 1 */
- u64 __pad13[0x7e];
+ volatile u64 __pad13[0x7e];
/* SBUS IOMMU Diagnostic Registers */
-/*0x4400*/ u64 sbus_vdiag; /* SBUS VADDR Diagnostic Register */
-/*0x4408*/ u64 sbus_tcompare; /* SBUS IOMMU TLB Tag Compare */
+/*0x4400*/ volatile u64 sbus_vdiag; /* SBUS VADDR Diagnostic Register */
+/*0x4408*/ volatile u64 sbus_tcompare; /* SBUS IOMMU TLB Tag Compare */
- u64 __pad14[0x1e];
+ volatile u64 __pad14[0x1e];
/* More IOMMU diagnostic things */
-/*0x4500*/ u64 iommu_lru[16]; /* IOMMU LRU Queue Diagnostic Access */
-/*0x4580*/ u64 iommu_tag[16]; /* IOMMU TLB Tag Diagnostic Access */
-/*0x4600*/ u64 iommu_data[32]; /* IOMMU TLB Data RAM Diagnostic Access */
+/*0x4500*/ volatile u64 iommu_lru[16]; /* IOMMU LRU Queue Diagnostic Access */
+/*0x4580*/ volatile u64 iommu_tag[16]; /* IOMMU TLB Tag Diagnostic Access */
+/*0x4600*/ volatile u64 iommu_data[32]; /* IOMMU TLB Data RAM Diag Access */
- u64 __pad15[0x20];
+ volatile u64 __pad15[0x20];
/* Interrupt State Diagnostics */
-/*0x4800*/ u64 sbus_istate;
-/*0x4808*/ u64 obio_istate;
+/*0x4800*/ volatile u64 sbus_istate;
+/*0x4808*/ volatile u64 obio_istate;
- u64 __pad16[0xfe];
+ volatile u64 __pad16[0xfe];
/* Streaming Buffer Diagnostic Area */
-/*0x5000*/ u64 sbuf_data[128]; /* StrBuffer Data Ram Diagnostic */
-/*0x5400*/ u64 sbuf_errs[128]; /* StrBuffer Error Status Diagnostics */
-/*0x5800*/ u64 sbuf_ptag[16]; /* StrBuffer Page Tag Diagnostics */
-/*0x5880*/ u64 _unusedXXX[16];
-/*0x5900*/ u64 sbuf_ltag[16]; /* StrBuffer Line Tag Diagnostics */
+/*0x5000*/ volatile u64 sbuf_data[128]; /* StrBuffer Data Ram Diagnostic */
+/*0x5400*/ volatile u64 sbuf_errs[128]; /* StrBuffer Error Status Diagnostics */
+/*0x5800*/ volatile u64 sbuf_ptag[16]; /* StrBuffer Page Tag Diagnostics */
+/*0x5880*/ volatile u64 _unusedXXX[16];
+/*0x5900*/ volatile u64 sbuf_ltag[16]; /* StrBuffer Line Tag Diagnostics */
};
/* SYSIO UPA Port ID */
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 82cf1eb41..5989d8c4a 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -1,4 +1,4 @@
-/* $Id: system.h,v 1.50 1999/05/08 03:03:22 davem Exp $ */
+/* $Id: system.h,v 1.55 1999/09/10 10:44:44 davem Exp $ */
#ifndef __SPARC64_SYSTEM_H
#define __SPARC64_SYSTEM_H
@@ -63,9 +63,13 @@ extern unsigned long empty_zero_page;
retval; \
})
-#define __save_flags(flags) ((flags) = getipl())
-#define __save_and_cli(flags) ((flags) = read_pil_and_cli())
-#define __restore_flags(flags) setipl((flags))
+#define __save_flags(flags) ((flags) = getipl())
+#define __save_and_cli(flags) ((flags) = read_pil_and_cli())
+#define __restore_flags(flags) setipl((flags))
+#define local_irq_disable() __cli()
+#define local_irq_enable() __sti()
+#define local_irq_save(flags) __save_and_cli(flags)
+#define local_irq_restore(flags) __restore_flags(flags)
#ifndef __SMP__
#define cli() __cli()
@@ -97,6 +101,12 @@ extern void __global_restore_flags(unsigned long flags);
#define membar(type) __asm__ __volatile__ ("membar " type : : : "memory");
#define rmb() membar("#LoadLoad | #LoadStore")
#define wmb() membar("#StoreLoad | #StoreStore")
+#define set_mb(__var, __value) \
+ do { __var = __value; membar("#StoreLoad | #StoreStore"); } while(0)
+#define set_rmb(__var, __value) \
+ do { __var = __value; membar("#StoreLoad"); } while(0)
+#define set_wmb(__var, __value) \
+ do { __var = __value; membar("#StoreStore"); } while(0)
#define flushi(addr) __asm__ __volatile__ ("flush %0" : : "r" (addr) : "memory")
@@ -124,6 +134,8 @@ extern __inline__ void flushw_user(void)
}
#define flush_user_windows flushw_user
+#define flush_register_windows flushw_all
+#define prepare_to_switch flushw_all
/* See what happens when you design the chip correctly?
*
@@ -135,20 +147,19 @@ extern __inline__ void flushw_user(void)
* and 2 stores in this critical code path. -DaveM
*/
#define switch_to(prev, next, last) \
-do { if (current->tss.flags & SPARC_FLAG_PERFCTR) { \
+do { if (current->thread.flags & SPARC_FLAG_PERFCTR) { \
unsigned long __tmp; \
read_pcr(__tmp); \
- current->tss.pcr_reg = __tmp; \
+ current->thread.pcr_reg = __tmp; \
read_pic(__tmp); \
- current->tss.kernel_cntd0 += (unsigned int)(__tmp); \
- current->tss.kernel_cntd1 += ((__tmp) >> 32); \
+ current->thread.kernel_cntd0 += (unsigned int)(__tmp); \
+ current->thread.kernel_cntd1 += ((__tmp) >> 32); \
} \
save_and_clear_fpu(); \
- __asm__ __volatile__( \
- "flushw\n\t" \
- "wrpr %g0, 0x94, %pstate\n\t"); \
- __get_mmu_context(next); \
- (next)->mm->cpu_vm_mask |= (1UL << smp_processor_id()); \
+ /* If you are tempted to conditionalize the following */ \
+ /* so that ASI is only written if it changes, think again. */ \
+ __asm__ __volatile__("wr %%g0, %0, %%asi" \
+ : : "r" (next->thread.current_ds.seg)); \
__asm__ __volatile__( \
"mov %%g6, %%g5\n\t" \
"wrpr %%g0, 0x95, %%pstate\n\t" \
@@ -156,15 +167,15 @@ do { if (current->tss.flags & SPARC_FLAG_PERFCTR) { \
"stx %%i7, [%%sp + 2047 + 0x78]\n\t" \
"rdpr %%wstate, %%o5\n\t" \
"stx %%o6, [%%g6 + %3]\n\t" \
- "sth %%o5, [%%g6 + %2]\n\t" \
+ "stb %%o5, [%%g6 + %2]\n\t" \
"rdpr %%cwp, %%o5\n\t" \
- "sth %%o5, [%%g6 + %5]\n\t" \
+ "stb %%o5, [%%g6 + %5]\n\t" \
"mov %1, %%g6\n\t" \
- "lduh [%1 + %5], %%g1\n\t" \
+ "ldub [%1 + %5], %%g1\n\t" \
"wrpr %%g1, %%cwp\n\t" \
"ldx [%%g6 + %3], %%o6\n\t" \
- "lduh [%%g6 + %2], %%o5\n\t" \
- "lduh [%%g6 + %4], %%o7\n\t" \
+ "ldub [%%g6 + %2], %%o5\n\t" \
+ "ldub [%%g6 + %4], %%o7\n\t" \
"mov %%g6, %%l2\n\t" \
"wrpr %%o5, 0x0, %%wstate\n\t" \
"ldx [%%sp + 2047 + 0x70], %%i6\n\t" \
@@ -172,22 +183,23 @@ do { if (current->tss.flags & SPARC_FLAG_PERFCTR) { \
"wrpr %%g0, 0x94, %%pstate\n\t" \
"mov %%l2, %%g6\n\t" \
"wrpr %%g0, 0x96, %%pstate\n\t" \
- "andcc %%o7, 0x100, %%g0\n\t" \
+ "andcc %%o7, %6, %%g0\n\t" \
"bne,pn %%icc, ret_from_syscall\n\t" \
" mov %%g5, %0\n\t" \
: "=&r" (last) \
: "r" (next), \
- "i" ((const unsigned long)(&((struct task_struct *)0)->tss.wstate)), \
- "i" ((const unsigned long)(&((struct task_struct *)0)->tss.ksp)), \
- "i" ((const unsigned long)(&((struct task_struct *)0)->tss.flags)), \
- "i" ((const unsigned long)(&((struct task_struct *)0)->tss.cwp)) \
+ "i" ((const unsigned long)(&((struct task_struct *)0)->thread.wstate)),\
+ "i" ((const unsigned long)(&((struct task_struct *)0)->thread.ksp)), \
+ "i" ((const unsigned long)(&((struct task_struct *)0)->thread.flags)),\
+ "i" ((const unsigned long)(&((struct task_struct *)0)->thread.cwp)), \
+ "i" (SPARC_FLAG_NEWCHILD) \
: "cc", "g1", "g2", "g3", "g5", "g7", \
"l2", "l3", "l4", "l5", "l6", "l7", \
"i0", "i1", "i2", "i3", "i4", "i5", \
"o0", "o1", "o2", "o3", "o4", "o5", "o7"); \
/* If you fuck with this, update ret_from_syscall code too. */ \
- if (current->tss.flags & SPARC_FLAG_PERFCTR) { \
- write_pcr(current->tss.pcr_reg); \
+ if (current->thread.flags & SPARC_FLAG_PERFCTR) { \
+ write_pcr(current->thread.pcr_reg); \
reset_pic(); \
} \
} while(0)
diff --git a/include/asm-sparc64/timer.h b/include/asm-sparc64/timer.h
index 135692768..2d1067c7d 100644
--- a/include/asm-sparc64/timer.h
+++ b/include/asm-sparc64/timer.h
@@ -1,4 +1,4 @@
-/* $Id: timer.h,v 1.2 1998/05/04 12:43:59 ralf Exp $
+/* $Id: timer.h,v 1.2 1998/03/15 17:23:52 ecd Exp $
* timer.h: System timer definitions for sun5.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h
index 7619264ae..4289e581c 100644
--- a/include/asm-sparc64/ttable.h
+++ b/include/asm-sparc64/ttable.h
@@ -1,4 +1,4 @@
-/* $Id: ttable.h,v 1.11 1999/03/29 12:38:12 jj Exp $ */
+/* $Id: ttable.h,v 1.13 1999/08/31 19:25:50 davem Exp $ */
#ifndef _SPARC64_TTABLE_H
#define _SPARC64_TTABLE_H
@@ -54,6 +54,13 @@
clr %l6; \
nop;
+#define TRAPTL1_CEE \
+ ldxa [%g0] ASI_AFSR, %g1; \
+ membar #Sync; \
+ stxa %g1, [%g0] ASI_AFSR; \
+ membar #Sync; \
+ retry; nop; nop; nop;
+
#define TRAP_ARG(routine, arg) \
sethi %hi(109f), %g7; \
ba,pt %xcc, etrap; \
@@ -91,7 +98,7 @@
nop;nop;nop;
#define TRAP_UTRAP(handler,lvl) \
- ldx [%g6 + AOFF_task_tss + AOFF_thread_utraps], %g1; \
+ ldx [%g6 + AOFF_task_thread + AOFF_thread_utraps], %g1; \
sethi %hi(109f), %g7; \
brz,pn %g1, utrap; \
or %g7, %lo(109f), %g7; \
diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
index a6f5c9a44..e0dd2e4f3 100644
--- a/include/asm-sparc64/uaccess.h
+++ b/include/asm-sparc64/uaccess.h
@@ -1,4 +1,4 @@
-/* $Id: uaccess.h,v 1.30 1999/05/25 16:53:32 jj Exp $ */
+/* $Id: uaccess.h,v 1.31 1999/07/30 09:31:24 davem Exp $ */
#ifndef _ASM_UACCESS_H
#define _ASM_UACCESS_H
@@ -36,14 +36,14 @@
#define VERIFY_READ 0
#define VERIFY_WRITE 1
-#define get_fs() (current->tss.current_ds)
+#define get_fs() (current->thread.current_ds)
#define get_ds() (KERNEL_DS)
#define segment_eq(a,b) ((a).seg == (b).seg)
#define set_fs(val) \
do { \
- current->tss.current_ds = (val); \
+ current->thread.current_ds = (val); \
__asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg)); \
} while(0)
diff --git a/include/asm-sparc64/uctx.h b/include/asm-sparc64/uctx.h
index 1899ff971..6eaf16ef2 100644
--- a/include/asm-sparc64/uctx.h
+++ b/include/asm-sparc64/uctx.h
@@ -1,4 +1,4 @@
-/* $Id: uctx.h,v 1.1 1997/07/18 06:29:24 ralf Exp $
+/* $Id: uctx.h,v 1.1 1997/06/18 16:51:58 davem Exp $
* uctx.h: Sparc64 {set,get}context() register state layouts.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
diff --git a/include/asm-sparc64/unistd.h b/include/asm-sparc64/unistd.h
index 87a6833c5..6e364cc7d 100644
--- a/include/asm-sparc64/unistd.h
+++ b/include/asm-sparc64/unistd.h
@@ -1,4 +1,4 @@
-/* $Id: unistd.h,v 1.28 1999/04/07 17:14:19 davem Exp $ */
+/* $Id: unistd.h,v 1.31 1999/08/04 03:20:06 davem Exp $ */
#ifndef _SPARC64_UNISTD_H
#define _SPARC64_UNISTD_H
@@ -225,7 +225,7 @@
#define __NR_syslog 207 /* Linux Specific */
/* #define __NR_olduname 208 Linux Specific */
/* #define __NR_iopl 209 Linux Specific - i386 specific, unused */
-#define __NR_idle 210 /* Linux Specific */
+/* #define __NR_idle 210 Linux Specific - was sys_idle, now unused */
/* #define __NR_vm86 211 Linux Specific - i386 specific, unused */
#define __NR_waitpid 212 /* Linux Specific */
#define __NR_swapoff 213 /* Linux Specific */
@@ -411,7 +411,6 @@ return -1; \
* some others too.
*/
#define __NR__exit __NR_exit
-static __inline__ _syscall0(int,idle)
static __inline__ _syscall0(int,pause)
static __inline__ _syscall0(int,sync)
static __inline__ _syscall0(pid_t,setsid)
@@ -431,8 +430,6 @@ static __inline__ pid_t wait(int * wait_stat)
return waitpid(-1,wait_stat,0);
}
-extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
-
#endif /* __KERNEL_SYSCALLS__ */
#ifdef __KERNEL__
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
new file mode 100644
index 000000000..98b115c13
--- /dev/null
+++ b/include/linux/acpi.h
@@ -0,0 +1,156 @@
+/*
+ * acpi.h - ACPI driver interface
+ *
+ * Copyright (C) 1999 Andrew Henroid
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _LINUX_ACPI_H
+#define _LINUX_ACPI_H
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* /dev/acpi minor number */
+#define ACPI_MINOR_DEV 167
+
+/* RSDP location */
+#define ACPI_BIOS_ROM_BASE ((__u8*) 0xe0000)
+#define ACPI_BIOS_ROM_END ((__u8*) 0x100000)
+
+/* Table signatures */
+#define ACPI_RSDP1_SIG 0x20445352 /* 'RSD ' */
+#define ACPI_RSDP2_SIG 0x20525450 /* 'PTR ' */
+#define ACPI_RSDT_SIG 0x54445352 /* 'RSDT' */
+#define ACPI_FACP_SIG 0x50434146 /* 'FACP' */
+#define ACPI_DSDT_SIG 0x54445344 /* 'DSDT' */
+
+/* PM1_STS flags */
+#define ACPI_TMR_STS 0x0001
+#define ACPI_BM_STS 0x0010
+#define ACPI_GBL_STS 0x0020
+#define ACPI_PWRBTN_STS 0x0100
+#define ACPI_SLPBTN_STS 0x0200
+#define ACPI_RTC_STS 0x0400
+#define ACPI_WAK_STS 0x8000
+
+/* PM1_EN flags */
+#define ACPI_TMR_EN 0x0001
+#define ACPI_GBL_EN 0x0020
+#define ACPI_PWRBTN_EN 0x0100
+#define ACPI_SLPBTN_EN 0x0200
+#define ACPI_RTC_EN 0x0400
+
+/* PM1_CNT flags */
+#define ACPI_SCI_EN 0x0001
+#define ACPI_BM_RLD 0x0002
+#define ACPI_GBL_RLS 0x0004
+#define ACPI_SLP_TYP0 0x0400
+#define ACPI_SLP_TYP1 0x0800
+#define ACPI_SLP_TYP2 0x1000
+#define ACPI_SLP_EN 0x2000
+
+/* PM_TMR masks */
+#define ACPI_TMR_VAL_MASK 0x00ffffff
+#define ACPI_E_TMR_VAL_MASK 0xff000000
+
+/* PM2_CNT flags */
+#define ACPI_ARB_DIS 0x01
+
+/* FACP flags */
+#define ACPI_WBINVD 0x00000001
+#define ACPI_WBINVD_FLUSH 0x00000002
+#define ACPI_PROC_C1 0x00000004
+#define ACPI_P_LVL2_UP 0x00000008
+#define ACPI_PWR_BUTTON 0x00000010
+#define ACPI_SLP_BUTTON 0x00000020
+#define ACPI_FIX_RTC 0x00000040
+#define ACPI_RTC_64 0x00000080
+#define ACPI_TMR_VAL_EXT 0x00000100
+#define ACPI_DCK_CAP 0x00000200
+
+struct acpi_rsdp {
+ __u32 signature[2];
+ __u8 checksum;
+ __u8 oem[6];
+ __u8 reserved;
+ __u32 rsdt;
+};
+
+struct acpi_table {
+ __u32 signature;
+ __u32 length;
+ __u8 rev;
+ __u8 checksum;
+ __u8 oem[6];
+ __u8 oem_table[8];
+ __u32 oem_rev;
+ __u32 creator;
+ __u32 creator_rev;
+};
+
+struct acpi_facp {
+ struct acpi_table hdr;
+ __u32 facs;
+ __u32 dsdt;
+ __u8 int_model;
+ __u8 reserved;
+ __u16 sci_int;
+ __u32 smi_cmd;
+ __u8 acpi_enable;
+ __u8 acpi_disable;
+ __u8 s4bios_req;
+ __u8 reserved2;
+ __u32 pm1a_evt;
+ __u32 pm1b_evt;
+ __u32 pm1a_cnt;
+ __u32 pm1b_cnt;
+ __u32 pm2_cnt;
+ __u32 pm_tmr;
+ __u32 gpe0;
+ __u32 gpe1;
+ __u8 pm1_evt_len;
+ __u8 pm1_cnt_len;
+ __u8 pm2_cnt_len;
+ __u8 pm_tm_len;
+ __u8 gpe0_len;
+ __u8 gpe1_len;
+ __u8 gpe1_base;
+ __u8 reserved3;
+ __u16 p_lvl2_lat;
+ __u16 p_lvl3_lat;
+ __u16 flush_size;
+ __u16 flush_stride;
+ __u8 duty_offset;
+ __u8 duty_width;
+ __u8 day_alarm;
+ __u8 mon_alarm;
+ __u8 century;
+ __u8 reserved4;
+ __u8 reserved5;
+ __u8 reserved6;
+ __u32 flags;
+};
+
+#define ACPI_FIND_TABLES _IOR('A', 1, struct acpi_find_tables)
+#define ACPI_WAIT_EVENT _IO('A', 2)
+
+struct acpi_find_tables {
+ unsigned long facp;
+ unsigned long dsdt;
+};
+
+#endif /* _LINUX_ACPI_H */
diff --git a/include/linux/apm_bios.h b/include/linux/apm_bios.h
index a478c0c66..a9015d35a 100644
--- a/include/linux/apm_bios.h
+++ b/include/linux/apm_bios.h
@@ -76,9 +76,6 @@ struct apm_bios_struct {
*/
extern struct apm_bios_info apm_bios_info;
-extern void apm_bios_init(void);
-extern void apm_setup(char *, int *);
-
extern int apm_register_callback(int (*callback)(apm_event_t));
extern void apm_unregister_callback(int (*callback)(apm_event_t));
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 4c0f2e05d..5b6c9f3db 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -69,7 +69,7 @@
* increased. The larger it is, though, the longer it will be between
* necessary transmits - don't set this too large.
*/
-#define TX_TIMEOUT 20
+#define TX_TIMEOUT (20*HZ/100)
/* Display warnings about the driver being an ALPHA version.
@@ -298,28 +298,28 @@ struct arcnet_local {
int card_type;
char *card_type_str;
- void (*inthandler) (struct device *dev);
- int (*arcnet_reset) (struct device *dev, int reset_delay);
- void (*asetmask) (struct device *dev, u_char mask);
- void (*acommand) (struct device *dev, u_char command);
- u_char (*astatus) (struct device *dev);
- void (*en_dis_able_TX) (struct device *dev, int enable);
- void (*prepare_tx)(struct device *dev,u_char *hdr,int hdrlen,
+ void (*inthandler) (struct net_device *dev);
+ int (*arcnet_reset) (struct net_device *dev, int reset_delay);
+ void (*asetmask) (struct net_device *dev, u_char mask);
+ void (*acommand) (struct net_device *dev, u_char command);
+ u_char (*astatus) (struct net_device *dev);
+ void (*en_dis_able_TX) (struct net_device *dev, int enable);
+ void (*prepare_tx)(struct net_device *dev,u_char *hdr,int hdrlen,
char *data,int length,int daddr,int exceptA, int offset);
void (*openclose_device)(int open);
- struct device *adev; /* RFC1201 protocol device */
+ struct net_device *adev; /* RFC1201 protocol device */
/* These are last to ensure that the chipset drivers don't depend on the
* CONFIG_ARCNET_ETH and CONFIG_ARCNET_1051 options.
*/
#ifdef CONFIG_ARCNET_ETH
- struct device *edev; /* Ethernet-Encap device */
+ struct net_device *edev; /* Ethernet-Encap device */
#endif
#ifdef CONFIG_ARCNET_1051
- struct device *sdev; /* RFC1051 protocol device */
+ struct net_device *sdev; /* RFC1051 protocol device */
#endif
};
@@ -327,25 +327,25 @@ struct arcnet_local {
*/
#if ARCNET_DEBUG_MAX & D_SKB
-extern void arcnet_dump_skb(struct device *dev,struct sk_buff *skb,
+extern void arcnet_dump_skb(struct net_device *dev,struct sk_buff *skb,
char *desc);
#else
#define arcnet_dump_skb(dev,skb,desc) ;
#endif
#if (ARCNET_DEBUG_MAX & D_RX) || (ARCNET_DEBUG_MAX & D_TX)
-extern void arcnet_dump_packet(struct device *dev,u_char *buffer,int ext,
+extern void arcnet_dump_packet(struct net_device *dev,u_char *buffer,int ext,
char *desc);
#else
#define arcnet_dump_packet(dev,buffer,ext,desc) ;
#endif
-extern void arcnet_tx_done(struct device *dev, struct arcnet_local *lp);
+extern void arcnet_tx_done(struct net_device *dev, struct arcnet_local *lp);
extern void arcnet_makename(char *device);
extern void arcnet_interrupt(int irq,void *dev_id,struct pt_regs *regs);
-extern void arcnet_setup(struct device *dev);
-extern int arcnet_go_tx(struct device *dev,int enable_irq);
-extern void arcnetA_continue_tx(struct device *dev);
+extern void arcnet_setup(struct net_device *dev);
+extern int arcnet_go_tx(struct net_device *dev,int enable_irq);
+extern void arcnetA_continue_tx(struct net_device *dev);
extern void arcnet_rx(struct arcnet_local *lp, u_char *arcsoft, short length, int saddr, int daddr);
extern void arcnet_use_count(int open);
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index e9d209791..5b1dafc17 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -43,7 +43,7 @@ struct netrange
struct atalk_route
{
- struct device *dev;
+ struct net_device *dev;
struct at_addr target;
struct at_addr gateway;
int flags;
@@ -52,7 +52,7 @@ struct atalk_route
struct atalk_iface
{
- struct device *dev;
+ struct net_device *dev;
struct at_addr address; /* Our address */
int status; /* What are we doing? */
#define ATIF_PROBE 1 /* Probing for an address */
@@ -161,16 +161,16 @@ extern void aarp_proto_init(void);
* Give a device find its atif control structure
*/
-extern __inline__ struct atalk_iface *atalk_find_dev(struct device *dev)
+extern __inline__ struct atalk_iface *atalk_find_dev(struct net_device *dev)
{
return dev->atalk_ptr;
}
-extern struct at_addr *atalk_find_dev_addr(struct device *dev);
-extern struct device *atrtr_get_dev(struct at_addr *sa);
-extern int aarp_send_ddp(struct device *dev,struct sk_buff *skb, struct at_addr *sa, void *hwaddr);
-extern void aarp_send_probe(struct device *dev, struct at_addr *addr);
-extern void aarp_device_down(struct device *dev);
+extern struct at_addr *atalk_find_dev_addr(struct net_device *dev);
+extern struct net_device *atrtr_get_dev(struct at_addr *sa);
+extern int aarp_send_ddp(struct net_device *dev,struct sk_buff *skb, struct at_addr *sa, void *hwaddr);
+extern void aarp_send_probe(struct net_device *dev, struct at_addr *addr);
+extern void aarp_device_down(struct net_device *dev);
#ifdef MODULE
extern void aarp_cleanup_module(void);
diff --git a/include/linux/atm.h b/include/linux/atm.h
new file mode 100644
index 000000000..67a8f3465
--- /dev/null
+++ b/include/linux/atm.h
@@ -0,0 +1,253 @@
+/* atm.h - general ATM declarations */
+
+/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
+
+
+/*
+ * WARNING: User-space programs should not #include <linux/atm.h> directly.
+ * Instead, #include <atm.h>
+ */
+
+#ifndef _LINUX_ATM_H
+#define _LINUX_ATM_H
+
+/*
+ * BEGIN_xx and END_xx markers are used for automatic generation of
+ * documentation. Do not change them.
+ */
+
+#ifdef __KERNEL__
+#include <linux/socket.h>
+#include <linux/types.h>
+#endif
+#include <linux/atmsap.h>
+#include <linux/atmioc.h>
+
+
+/* general ATM constants */
+#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */
+#define ATM_CELL_PAYLOAD 48 /* ATM payload size */
+#define ATM_AAL0_SDU 52 /* AAL0 SDU size */
+#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */
+#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */
+#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */
+#define ATM_MAX_CDV 9999 /* maximum (default) CDV */
+#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */
+
+#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */
+#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */
+#define ATM_MAX_VCI 65535 /* maximum VCI */
+
+
+/* "protcol" values for the socket system call */
+#define ATM_NO_AAL 0 /* AAL not specified */
+#define ATM_AAL0 13 /* "raw" ATM cells */
+#define ATM_AAL1 1 /* AAL1 (CBR) */
+#define ATM_AAL2 2 /* AAL2 (VBR) */
+#define ATM_AAL34 3 /* AAL3/4 (data) */
+#define ATM_AAL5 5 /* AAL5 (data) */
+
+/*
+ * socket option name coding functions
+ *
+ * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the
+ * << 22 only reserves 9 bits for the level. On some architectures
+ * SOL_SOCKET is 0xFFFF, so that's a bit of a problem
+ */
+
+#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \
+ sizeof(t))
+#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF))
+#define __SO_NUMBER(c) (((c) >> 16) & 0x3f)
+#define __SO_SIZE(c) ((c) & 0x3fff)
+
+/*
+ * ATM layer
+ */
+
+#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int)
+ /* set CLP bit value - TODO */
+#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange)
+ /* connection identifier range; socket must be
+ bound or connected */
+#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos)
+ /* Quality of Service setting */
+#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap)
+ /* Service Access Point */
+#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
+ /* "PVC" address (also for SVCs); get only */
+
+/*
+ * Note @@@: since the socket layers don't really distinguish the control and
+ * the data plane but generally seems to be data plane-centric, any layer is
+ * about equally wrong for the SAP. If you have a better idea about this,
+ * please speak up ...
+ */
+
+/* socket layer */
+#define SO_BCTXOPT __SO_ENCODE(SOL_SOCKET,16,struct atm_buffconst)
+ /* not ATM specific - should go somewhere else */
+#define SO_BCRXOPT __SO_ENCODE(SOL_SOCKET,17,struct atm_buffconst)
+
+
+/* for SO_BCTXOPT and SO_BCRXOPT */
+
+struct atm_buffconst {
+ unsigned long buf_fac; /* buffer alignment factor */
+ unsigned long buf_off; /* buffer alignment offset */
+ unsigned long size_fac; /* buffer size factor */
+ unsigned long size_off; /* buffer size offset */
+ unsigned long min_size; /* minimum size */
+ unsigned long max_size; /* maximum size, 0 = unlimited */
+};
+
+
+/* ATM cell header (for AAL0) */
+
+/* BEGIN_CH */
+#define ATM_HDR_GFC_MASK 0xf0000000
+#define ATM_HDR_GFC_SHIFT 28
+#define ATM_HDR_VPI_MASK 0x0ff00000
+#define ATM_HDR_VPI_SHIFT 20
+#define ATM_HDR_VCI_MASK 0x000ffff0
+#define ATM_HDR_VCI_SHIFT 4
+#define ATM_HDR_PTI_MASK 0x0000000e
+#define ATM_HDR_PTI_SHIFT 1
+#define ATM_HDR_CLP 0x00000001
+/* END_CH */
+
+
+/* PTI codings */
+
+/* BEGIN_PTI */
+#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */
+#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */
+#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */
+#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */
+#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */
+#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */
+#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */
+#define ATM_PTI_RSV 7 /* reserved */
+/* END_PTI */
+
+
+/*
+ * The following items should stay in linux/atm.h, which should be linked to
+ * netatm/atm.h
+ */
+
+/* Traffic description */
+
+#define ATM_NONE 0 /* no traffic */
+#define ATM_UBR 1
+#define ATM_CBR 2
+#define ATM_VBR 3
+#define ATM_ABR 4
+#define ATM_ANYCLASS 5 /* compatible with everything */
+
+#define ATM_MAX_PCR -1 /* maximum available PCR */
+
+struct atm_trafprm {
+ unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */
+ int max_pcr; /* maximum PCR in cells per second */
+ int pcr; /* desired PCR in cells per second */
+ int min_pcr; /* minimum PCR in cells per second */
+ int max_cdv; /* maximum CDV in microseconds */
+ int max_sdu; /* maximum SDU in bytes */
+};
+
+struct atm_qos {
+ struct atm_trafprm txtp; /* parameters in TX direction */
+ struct atm_trafprm rxtp; /* parameters in RX direction */
+ unsigned char aal;
+};
+
+/* PVC addressing */
+
+#define ATM_ITF_ANY -1 /* "magic" PVC address values */
+#define ATM_VPI_ANY -1
+#define ATM_VCI_ANY -1
+#define ATM_VPI_UNSPEC -2
+#define ATM_VCI_UNSPEC -2
+
+
+struct sockaddr_atmpvc {
+ unsigned short sap_family; /* address family, AF_ATMPVC */
+ struct { /* PVC address */
+ short itf; /* ATM interface */
+ short vpi; /* VPI (only 8 bits at UNI) */
+ int vci; /* VCI (only 16 bits at UNI) */
+ } sap_addr; /* PVC address */
+};
+
+/* SVC addressing */
+
+#define ATM_ESA_LEN 20 /* ATM End System Address length */
+#define ATM_E164_LEN 12 /* maximum E.164 number length */
+
+#define ATM_AFI_DCC 0x39 /* DCC ATM Format */
+#define ATM_AFI_ICD 0x47 /* ICD ATM Format */
+#define ATM_AFI_E164 0x45 /* E.164 ATM Format */
+#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */
+
+#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */
+#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */
+#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */
+#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */
+
+#define ATM_LIJ_NONE 0 /* no leaf-initiated join */
+#define ATM_LIJ 1 /* request joining */
+#define ATM_LIJ_RPJ 2 /* set to root-prompted join */
+#define ATM_LIJ_NJ 3 /* set to network join */
+
+
+struct sockaddr_atmsvc {
+ unsigned short sas_family; /* address family, AF_ATMSVC */
+ struct { /* SVC address */
+ unsigned char prv[ATM_ESA_LEN];/* private ATM address */
+ char pub[ATM_E164_LEN+1]; /* public address (E.164) */
+ /* unused addresses must be bzero'ed */
+ char lij_type; /* role in LIJ call; one of ATM_LIJ* */
+ uint32_t lij_id; /* LIJ call identifier */
+ } sas_addr; /* SVC address */
+};
+
+
+static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr)
+{
+ return *addr.sas_addr.prv || *addr.sas_addr.pub;
+}
+
+
+static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
+{
+ return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci;
+}
+
+
+/*
+ * Some stuff for linux/sockios.h
+ */
+
+struct atmif_sioc {
+ int number;
+ int length;
+ void *arg;
+};
+
+
+#define ATM_CREATE_LEAF _IO('a',ATMIOC_SPECIAL+2)
+ /* create a point-to-multipoint leaf socket */
+
+
+#ifdef __KERNEL__
+
+#include <linux/net.h> /* struct net_proto */
+
+
+void atmpvc_proto_init(struct net_proto *pro);
+void atmsvc_proto_init(struct net_proto *pro);
+
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/include/linux/atm_eni.h b/include/linux/atm_eni.h
new file mode 100644
index 000000000..7ed89d105
--- /dev/null
+++ b/include/linux/atm_eni.h
@@ -0,0 +1,15 @@
+/* atm_eni.h - Driver-specific declarations of the ENI driver (for use by
+ driver-specific utilities) */
+
+/* Written 1995-1997 by Werner Almesberger, EPFL LRC */
+
+
+#ifndef LINUX_ATM_ENI_H
+#define LINUX_ATM_ENI_H
+
+#include <linux/atmioc.h>
+
+#define ENI_MEMDUMP _IOW('a',ATMIOC_SARPRV,struct atmif_sioc)
+ /* printk memory map */
+
+#endif
diff --git a/include/linux/atm_nicstar.h b/include/linux/atm_nicstar.h
new file mode 100644
index 000000000..3b564d227
--- /dev/null
+++ b/include/linux/atm_nicstar.h
@@ -0,0 +1,52 @@
+/******************************************************************************
+ *
+ * atm_nicstar.h
+ *
+ * Driver-specific declarations for use by NICSTAR driver specific utils.
+ *
+ * Author: Rui Prior
+ *
+ * (C) INESC 1998
+ *
+ ******************************************************************************/
+
+
+#ifndef LINUX_ATM_NICSTAR_H
+#define LINUX_ATM_NICSTAR_H
+
+/* Note: non-kernel programs including this file must also include
+ * sys/types.h for struct timeval
+ */
+
+#include <linux/atmioc.h>
+
+#define NS_GETPSTAT _IOWR('a',ATMIOC_SARPRV+1,struct atmif_sioc)
+ /* get pool statistics */
+#define NS_SETBUFLEV _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc)
+ /* set buffer level markers */
+#define NS_ADJBUFLEV _IO('a',ATMIOC_SARPRV+3)
+ /* adjust buffer level */
+
+typedef struct buf_nr
+{
+ unsigned min;
+ unsigned init;
+ unsigned max;
+} buf_nr;
+
+
+typedef struct pool_levels
+{
+ int buftype;
+ int count; /* (At least for now) only used in NS_GETPSTAT */
+ buf_nr level;
+} pool_levels;
+
+/* type must be one of the following: */
+#define NS_BUFTYPE_SMALL 1
+#define NS_BUFTYPE_LARGE 2
+#define NS_BUFTYPE_HUGE 3
+#define NS_BUFTYPE_IOVEC 4
+
+
+#endif /* LINUX_ATM_NICSTAR_H */
diff --git a/include/linux/atm_suni.h b/include/linux/atm_suni.h
new file mode 100644
index 000000000..2e6a01a61
--- /dev/null
+++ b/include/linux/atm_suni.h
@@ -0,0 +1,19 @@
+/* atm_suni.h - Driver-specific declarations of the SUNI driver (for use by
+ driver-specific utilities) */
+
+/* Written 1998 by Werner Almesberger, EPFL ICA */
+
+
+#ifndef LINUX_ATM_SUNI_H
+#define LINUX_ATM_SUNI_H
+
+#include <linux/atmioc.h>
+
+#define SUNI_GETLOOP _IOR('a',ATMIOC_PHYPRV,int) /* get loopback mode */
+#define SUNI_SETLOOP _IO('a',ATMIOC_PHYPRV+1) /* set loopback mode */
+
+#define SUNI_LM_NONE 0 /* no loopback */
+#define SUNI_LM_DIAG 1 /* diagnostic (i.e. loop TX to RX) */
+#define SUNI_LM_LOOP 2 /* line (i.e. loop RX to TX) */
+
+#endif
diff --git a/include/linux/atm_tcp.h b/include/linux/atm_tcp.h
new file mode 100644
index 000000000..7e8eb77d6
--- /dev/null
+++ b/include/linux/atm_tcp.h
@@ -0,0 +1,72 @@
+/* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by
+ driver-specific utilities) */
+
+/* Written 1997-1999 by Werner Almesberger, EPFL LRC/ICA */
+
+
+#ifndef LINUX_ATM_TCP_H
+#define LINUX_ATM_TCP_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+#include <linux/atmioc.h>
+
+
+/*
+ * All values in struct atmtcp_hdr are in network byte order
+ */
+
+struct atmtcp_hdr {
+ uint16_t vpi;
+ uint16_t vci;
+ uint32_t length; /* ... of data part */
+};
+
+/*
+ * All values in struct atmtcp_command are in host byte order
+ */
+
+#define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */
+#define ATMTCP_CTRL_OPEN 1 /* request/reply */
+#define ATMTCP_CTRL_CLOSE 2 /* request/reply */
+
+struct atmtcp_control {
+ struct atmtcp_hdr hdr; /* must be first */
+ int type; /* message type; both directions */
+ unsigned long vcc; /* both directions */
+ struct sockaddr_atmpvc addr; /* suggested value from kernel */
+ struct atm_qos qos; /* both directions */
+ int result; /* to kernel only */
+};
+
+/*
+ * Field usage:
+ * Messge type dir. hdr.v?i type addr qos vcc result
+ * ----------- ---- ------- ---- ---- --- --- ------
+ * OPEN K->D Y Y Y Y Y 0
+ * OPEN D->K - Y Y Y Y Y
+ * CLOSE K->D - - Y - Y 0
+ * CLOSE D->K - - - - Y Y
+ */
+
+#define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */
+#define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP
+ interface */
+#define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP
+ interface */
+
+
+#ifdef __KERNEL__
+
+struct atm_tcp_ops {
+ int (*attach)(struct atm_vcc *vcc,int itf);
+ int (*create_persistent)(int itf);
+ int (*remove_persistent)(int itf);
+};
+
+extern struct atm_tcp_ops atm_tcp_ops;
+
+#endif
+
+#endif
diff --git a/include/linux/atm_zatm.h b/include/linux/atm_zatm.h
new file mode 100644
index 000000000..d8d85cb76
--- /dev/null
+++ b/include/linux/atm_zatm.h
@@ -0,0 +1,54 @@
+/* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by
+ driver-specific utilities) */
+
+/* Written 1995-1997 by Werner Almesberger, EPFL LRC */
+
+
+#ifndef LINUX_ATM_ZATM_H
+#define LINUX_ATM_ZATM_H
+
+/*
+ * Note: non-kernel programs including this file must also include
+ * sys/types.h for struct timeval
+ */
+
+#include <linux/atmioc.h>
+
+#define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
+ /* get pool statistics */
+#define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc)
+ /* get statistics and zero */
+#define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc)
+ /* set pool parameters */
+#define ZATM_GETTHIST _IOW('a',ATMIOC_SARPRV+4,struct atmif_sioc)
+ /* get a history of timer
+ differences */
+
+struct zatm_pool_info {
+ int ref_count; /* free buffer pool usage counters */
+ int low_water,high_water; /* refill parameters */
+ int rqa_count,rqu_count; /* queue condition counters */
+ int offset,next_off; /* alignment optimizations: offset */
+ int next_cnt,next_thres; /* repetition counter and threshold */
+};
+
+struct zatm_pool_req {
+ int pool_num; /* pool number */
+ struct zatm_pool_info info; /* actual information */
+};
+
+struct zatm_t_hist {
+ struct timeval real; /* real (wall-clock) time */
+ struct timeval expected; /* expected real time */
+};
+
+
+#define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */
+#define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */
+#define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */
+#define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */
+
+#define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to
+ record; must be 2^n */
+
+#endif
diff --git a/include/linux/atmarp.h b/include/linux/atmarp.h
new file mode 100644
index 000000000..057300fd5
--- /dev/null
+++ b/include/linux/atmarp.h
@@ -0,0 +1,42 @@
+/* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */
+
+/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */
+
+
+#ifndef _LINUX_ATMARP_H
+#define _LINUX_ATMARP_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+#include <linux/atmioc.h>
+
+
+#define ATMARP_RETRY_DELAY 30 /* request next resolution or forget
+ NAK after 30 sec - should go into
+ atmclip.h */
+#define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while
+ waiting for the resolver */
+
+
+#define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */
+#define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */
+#define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */
+#define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */
+
+
+enum atmarp_ctrl_type {
+ act_invalid, /* catch uninitialized structures */
+ act_need, /* need address resolution */
+ act_up, /* interface is coming up */
+ act_down, /* interface is going down */
+ act_change /* interface configuration has changed */
+};
+
+struct atmarp_ctrl {
+ enum atmarp_ctrl_type type; /* message type */
+ int itf_num;/* interface number (if present) */
+ uint32_t ip; /* IP address (act_need only) */
+};
+
+#endif
diff --git a/include/linux/atmclip.h b/include/linux/atmclip.h
new file mode 100644
index 000000000..7d657c0dc
--- /dev/null
+++ b/include/linux/atmclip.h
@@ -0,0 +1,25 @@
+/* atmclip.h - Classical IP over ATM */
+
+/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */
+
+
+#ifndef LINUX_ATMCLIP_H
+#define LINUX_ATMCLIP_H
+
+#include <linux/sockios.h>
+#include <linux/atmioc.h>
+
+
+#define RFC1483LLC_LEN 8 /* LLC+OUI+PID = 8 */
+#define RFC1626_MTU 9180 /* RFC1626 default MTU */
+
+#define CLIP_DEFAULT_IDLETIMER 1200 /* 20 minutes, see RFC1755 */
+#define CLIP_CHECK_INTERVAL 10 /* check every ten seconds */
+
+#define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */
+
+#ifdef __KERNEL__
+extern const unsigned char llc_oui[6];
+#endif
+
+#endif
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
new file mode 100644
index 000000000..0287d1661
--- /dev/null
+++ b/include/linux/atmdev.h
@@ -0,0 +1,351 @@
+/* atmdev.h - ATM device driver declarations and various related items */
+
+/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
+
+
+#ifndef LINUX_ATMDEV_H
+#define LINUX_ATMDEV_H
+
+
+#include <linux/config.h>
+#include <linux/atmioc.h>
+
+
+#define ESI_LEN 6
+
+#define ATM_OC3_PCR (155520000/270*260/8/53)
+ /* OC3 link rate: 155520000 bps
+ SONET overhead: /270*260 (9 section, 1 path)
+ bits per cell: /8/53
+ max cell rate: 353207.547 cells/sec */
+
+#define ATM_PDU_OVHD 0 /* number of bytes to charge against buffer
+ quota per PDU */
+
+#define ATM_SD(s) ((s)->sk->protinfo.af_atm)
+
+
+struct atm_aal_stats {
+ long tx,tx_err; /* TX okay and errors */
+ long rx,rx_err; /* RX okay and errors */
+ long rx_drop; /* RX out of memory */
+};
+
+
+struct atm_dev_stats {
+ struct atm_aal_stats aal0;
+ struct atm_aal_stats aal34;
+ struct atm_aal_stats aal5;
+};
+
+
+#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
+ /* get link rate */
+#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
+ /* get interface names (numbers) */
+#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
+ /* get interface type name */
+#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
+ /* get interface ESI */
+#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
+ /* get itf's local ATM addr. list */
+#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
+ /* reset itf's ATM address list */
+#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
+ /* add a local ATM address */
+#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
+ /* remove a local ATM address */
+#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
+ /* get connection identifier range */
+#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
+ /* set connection identifier range */
+#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
+ /* set interface ESI */
+#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
+ /* force interface ESI */
+#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
+ /* get AAL layer statistics */
+#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
+ /* get AAL layer statistics and zero */
+#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int)
+ /* enable or disable single-copy */
+
+/* for ATM_GETTYPE */
+#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */
+
+
+
+struct atm_iobuf {
+ int length;
+ void *buffer;
+};
+
+/* for ATM_GETCIRANGE / ATM_SETCIRANGE */
+
+#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
+
+struct atm_cirange {
+ char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
+ char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
+};
+
+/* for ATM_SETSC; actually taken from the ATM_VF number space */
+
+#define ATM_SC_RX 1024 /* enable RX single-copy */
+#define ATM_SC_TX 2048 /* enable TX single-copy */
+
+#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
+ anyway */
+
+/* MF: change_qos (Modify) flags */
+
+#define ATM_MF_IMMED 1 /* Block until change is effective */
+#define ATM_MF_INC_RSV 2 /* Change reservation on increase */
+#define ATM_MF_INC_SHP 4 /* Change shaping on increase */
+#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */
+#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */
+#define ATM_MF_BWD 32 /* Set the backward direction parameters */
+
+#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
+ ATM_MF_DEC_SHP | ATM_MF_BWD)
+
+/*
+ * ATM_VS_* are used to express VC state in a human-friendly way.
+ */
+
+#define ATM_VS_IDLE 0 /* VC is not used */
+#define ATM_VS_CONNECTED 1 /* VC is connected */
+#define ATM_VS_CLOSING 2 /* VC is closing */
+#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */
+#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */
+#define ATM_VS_BOUND 5 /* VC is bound */
+
+#define ATM_VS2TXT_MAP \
+ "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
+
+
+#ifdef __KERNEL__
+
+#include <linux/sched.h> /* wait_queue_head_t */
+#include <linux/time.h> /* struct timeval */
+#include <linux/net.h>
+#include <linux/skbuff.h> /* struct sk_buff */
+#include <linux/atm.h>
+#include <linux/uio.h>
+#include <asm/atomic.h>
+
+#ifdef CONFIG_PROC_FS
+#include <linux/proc_fs.h>
+#endif
+
+
+#define ATM_VF_ADDR 1 /* Address is in use. Set by anybody, cleared
+ by device driver. */
+#define ATM_VF_READY 2 /* VC is ready to transfer data. Set by device
+ driver, cleared by anybody. */
+#define ATM_VF_PARTIAL 4 /* resources are bound to PVC (partial PVC
+ setup), controlled by socket layer */
+#define ATM_VF_BOUND 16384 /* local SAP is set, controlled by SVC socket
+ layer */
+#define ATM_VF_REGIS 8 /* registered with demon, controlled by SVC
+ socket layer */
+#define ATM_VF_RELEASED 16 /* demon has indicated/requested release,
+ controlled by SVC socket layer */
+#define ATM_VF_HASQOS 32 /* QOS parameters have been set */
+#define ATM_VF_LISTEN 64 /* socket is used for listening */
+#define ATM_VF_META 128 /* SVC socket isn't used for normal data
+ traffic and doesn't depend on signaling
+ to be available */
+#define ATM_VF_AQREL 256 /* Arequipa VC is being released */
+#define ATM_VF_AQDANG 512 /* VC is in Arequipa's dangling list */
+#define ATM_VF_SCRX ATM_SC_RX /* 1024; allow single-copy in the RX dir. */
+#define ATM_VF_SCTX ATM_SC_TX /* 2048; allow single-copy in the TX dir. */
+#define ATM_VF_SESSION 4096 /* VCC is p2mp session control descriptor */
+#define ATM_VF_HASSAP 8192 /* SAP has been set */
+#define ATM_VF_CLOSE 32768 /* asynchronous close - treat like VF_RELEASED*/
+
+#define ATM_VF2VS(flags) \
+ ((flags) & ATM_VF_READY ? ATM_VS_CONNECTED : \
+ (flags) & ATM_VF_RELEASED ? ATM_VS_CLOSING : \
+ (flags) & ATM_VF_LISTEN ? ATM_VS_LISTEN : \
+ (flags) & ATM_VF_REGIS ? ATM_VS_INUSE : \
+ (flags) & ATM_VF_BOUND ? ATM_VS_BOUND : ATM_VS_IDLE)
+
+#define ATM_DF_CLOSE 1 /* close device when last VCC is closed */
+
+#define ATM_PHY_SIG_LOST 0 /* no carrier/light */
+#define ATM_PHY_SIG_UNKNOWN 1 /* carrier/light status is unknown */
+#define ATM_PHY_SIG_FOUND 2 /* carrier/light okay */
+
+#define ATM_ATMOPT_CLP 1 /* set CLP bit */
+
+
+struct atm_vcc {
+ unsigned short flags; /* VCC flags (ATM_VF_*) */
+ unsigned char family; /* address family; 0 if unused */
+ short vpi; /* VPI and VCI (types must be equal */
+ /* with sockaddr) */
+ int vci;
+ unsigned long aal_options; /* AAL layer options */
+ unsigned long atm_options; /* ATM layer options */
+ struct atm_dev *dev; /* device back pointer */
+ struct atm_qos qos; /* QOS */
+ struct atm_sap sap; /* SAP */
+ unsigned long tx_quota,rx_quota; /* buffer quotas */
+ atomic_t tx_inuse,rx_inuse; /* buffer space in use */
+ void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
+ void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
+ struct sk_buff *(*alloc_tx)(struct atm_vcc *vcc,unsigned int size);
+ /* TX allocation routine - can be */
+ /* modified by protocol or by driver.*/
+ /* NOTE: this interface will change */
+ int (*push_oam)(struct atm_vcc *vcc,void *cell);
+ void *dev_data; /* per-device data */
+ void *proto_data; /* per-protocol data */
+ struct timeval timestamp; /* AAL timestamps */
+ struct sk_buff_head recvq; /* receive queue */
+ struct atm_aal_stats *stats; /* pointer to AAL stats group */
+ wait_queue_head_t sleep; /* if socket is busy */
+ wait_queue_head_t wsleep; /* if waiting for write buffer space */
+ struct atm_vcc *prev,*next;
+ /* SVC part --- may move later ------------------------------------- */
+ short itf; /* interface number */
+ struct sockaddr_atmsvc local;
+ struct sockaddr_atmsvc remote;
+ void (*callback)(struct atm_vcc *vcc);
+ struct sk_buff_head listenq;
+ int backlog_quota; /* number of connection requests we */
+ /* can still accept */
+ int reply; /* also used by ATMTCP */
+ /* Multipoint part ------------------------------------------------- */
+ struct atm_vcc *session; /* session VCC descriptor */
+ /* Other stuff ----------------------------------------------------- */
+ void *user_back; /* user backlink - not touched */
+};
+
+
+struct atm_dev_addr {
+ struct sockaddr_atmsvc addr; /* ATM address */
+ struct atm_dev_addr *next; /* next address */
+};
+
+
+struct atm_dev {
+ const struct atmdev_ops *ops; /* device operations; NULL if unused */
+ const struct atmphy_ops *phy; /* PHY operations, may be undefined */
+ /* (NULL) */
+ const char *type; /* device type name */
+ int number; /* device index */
+ struct atm_vcc *vccs; /* VCC table (or NULL) */
+ struct atm_vcc *last; /* last VCC (or undefined) */
+ void *dev_data; /* per-device data */
+ void *phy_data; /* private PHY date */
+ unsigned long flags; /* device flags (ATM_DF_*) */
+ struct atm_dev_addr *local; /* local ATM addresses */
+ unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */
+ struct atm_cirange ci_range; /* VPI/VCI range */
+ struct atm_dev_stats stats; /* statistics */
+ char signal; /* signal status (ATM_PHY_SIG_*) */
+ int link_rate; /* link rate (default: OC3) */
+#ifdef CONFIG_PROC_FS
+ struct proc_dir_entry *proc_entry; /* proc entry */
+ char *proc_name; /* proc entry name */
+#endif
+ struct atm_dev *prev,*next; /* linkage */
+};
+
+
+/*
+ * ioctl, getsockopt, setsockopt, and sg_send are optional and can be set to
+ * NULL. */
+
+/* OF: send_Oam Flags */
+
+#define ATM_OF_IMMED 1 /* Attempt immediate delivery */
+#define ATM_OF_INRATE 2 /* Attempt in-rate delivery */
+
+struct atmdev_ops { /* only send is required */
+ void (*dev_close)(struct atm_dev *dev);
+ int (*open)(struct atm_vcc *vcc,short vpi,int vci);
+ void (*close)(struct atm_vcc *vcc);
+ int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg);
+ int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
+ void *optval,int optlen);
+ int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
+ void *optval,int optlen);
+ int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
+ int (*sg_send)(struct atm_vcc *vcc,unsigned long start,
+ unsigned long size);
+#if 0 /* keep the current hack for now */
+ int (*send_iovec)(struct atm_vcc *vcc,struct iovec *iov,int size,
+ void (*discard)(struct atm_vcc *vcc,void *user),void *user);
+#endif
+ int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
+ void (*phy_put)(struct atm_dev *dev,unsigned char value,
+ unsigned long addr);
+ unsigned char (*phy_get)(struct atm_dev *dev,unsigned long addr);
+ void (*feedback)(struct atm_vcc *vcc,struct sk_buff *skb,
+ unsigned long start,unsigned long dest,int len);
+ int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags);
+ void (*free_rx_skb)(struct atm_vcc *vcc, struct sk_buff *skb);
+ /* @@@ temporary hack */
+ int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page);
+};
+
+
+struct atmphy_ops {
+ int (*start)(struct atm_dev *dev);
+ int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void *arg);
+ void (*interrupt)(struct atm_dev *dev);
+};
+
+struct atm_skb_data {
+ struct atm_vcc *vcc; /* ATM VCC */
+ int iovcnt; /* 0 for "normal" operation */
+ unsigned long atm_options; /* ATM layer options */
+};
+
+#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb))
+
+struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
+ int number,unsigned long flags); /* number == -1: pick first available */
+struct atm_dev *atm_find_dev(int number);
+void atm_dev_deregister(struct atm_dev *dev);
+void shutdown_atm_dev(struct atm_dev *dev);
+void bind_vcc(struct atm_vcc *vcc,struct atm_dev *dev);
+
+
+/*
+ * This is approximately the algorithm used by alloc_skb.
+ *
+ */
+
+static __inline__ int atm_guess_pdu2truesize(int pdu_size)
+{
+ return ((pdu_size+15) & ~15) + sizeof(struct sk_buff);
+}
+
+
+static __inline__ void atm_force_charge(struct atm_vcc *vcc,int truesize)
+{
+ atomic_add(truesize+ATM_PDU_OVHD,&vcc->rx_inuse);
+}
+
+
+static __inline__ void atm_return(struct atm_vcc *vcc,int truesize)
+{
+ atomic_sub(truesize+ATM_PDU_OVHD,&vcc->rx_inuse);
+}
+
+
+int atm_charge(struct atm_vcc *vcc,int truesize);
+struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
+ int gfp_flags);
+int atm_find_ci(struct atm_vcc *vcc,short *vpi,int *vci);
+int atm_pcr_goal(struct atm_trafprm *tp);
+
+void atm_async_release_vcc(struct atm_vcc *vcc,int reply);
+
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/include/linux/atmioc.h b/include/linux/atmioc.h
new file mode 100644
index 000000000..17a5f4ca3
--- /dev/null
+++ b/include/linux/atmioc.h
@@ -0,0 +1,39 @@
+/* atmioc.h - ranges for ATM-related ioctl numbers */
+
+/* Written 1995-1998 by Werner Almesberger, EPFL LRC */
+
+
+/*
+ * See http://lrcwww.epfl.ch/linux-atm/magic.html for the complete list of
+ * "magic" ioctl numbers.
+ */
+
+
+#ifndef _LINUX_ATMIOC_H
+#define _LINUX_ATMIOC_H
+
+#include <asm/ioctl.h>
+ /* everybody including atmioc.h will also need _IO{,R,W,WR} */
+
+#define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */
+#define ATMIOC_PHYCOM_END 0x0f
+#define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */
+#define ATMIOC_PHYTYP_END 0x2f
+#define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */
+#define ATMIOC_PHYPRV_END 0x4f
+#define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */
+#define ATMIOC_SARCOM_END 0x50
+#define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */
+#define ATMIOC_SARPRV_END 0x7f
+#define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */
+#define ATMIOC_ITF_END 0x8f
+/* 0x90-0xbf: Reserved for future use */
+#define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */
+#define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */
+#define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */
+#define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */
+#define ATMIOC_CLIP_END 0xef
+#define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */
+#define ATMIOC_SPECIAL_END 0xff
+
+#endif
diff --git a/include/linux/atmlec.h b/include/linux/atmlec.h
new file mode 100644
index 000000000..6b1be5adf
--- /dev/null
+++ b/include/linux/atmlec.h
@@ -0,0 +1,85 @@
+/*
+ *
+ * ATM Lan Emulation Daemon vs. driver interface
+ *
+ * carnil@cs.tut.fi
+ *
+ */
+
+#ifndef _ATMLEC_H_
+#define _ATMLEC_H_
+
+#include <linux/atmioc.h>
+#include <linux/atm.h>
+#include <linux/if_ether.h>
+/* ATM lec daemon control socket */
+#define ATMLEC_CTRL _IO('a',ATMIOC_LANE)
+#define ATMLEC_DATA _IO('a',ATMIOC_LANE+1)
+#define ATMLEC_MCAST _IO('a',ATMIOC_LANE+2)
+
+/* Maximum number of LEC interfaces (tweakable) */
+#define MAX_LEC_ITF 48
+
+/* From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
+ * E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
+ * Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
+ */
+#define NUM_TR_DEVS 8
+
+typedef enum {
+ l_set_mac_addr, l_del_mac_addr,
+ l_svc_setup,
+ l_addr_delete, l_topology_change,
+ l_flush_complete, l_arp_update,
+ l_narp_req, /* LANE2 mandates the use of this */
+ l_config, l_flush_tran_id,
+ l_set_lecid, l_arp_xmt,
+ l_rdesc_arp_xmt,
+ l_associate_req,
+ l_should_bridge /* should we bridge this MAC? */
+} atmlec_msg_type;
+
+#define ATMLEC_MSG_TYPE_MAX l_should_bridge
+
+struct atmlec_config_msg {
+ unsigned int maximum_unknown_frame_count;
+ unsigned long max_unknown_frame_time;
+ unsigned short max_retry_count;
+ unsigned long aging_time;
+ unsigned long forward_delay_time;
+ unsigned long arp_response_time;
+ unsigned long flush_timeout;
+ unsigned long path_switching_delay;
+ unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */
+ int mtu;
+};
+
+struct atmlec_msg {
+ atmlec_msg_type type;
+ int sizeoftlvs; /* LANE2: if != 0, tlvs follow */
+ union {
+ struct {
+ unsigned char mac_addr[ETH_ALEN];
+ unsigned char atm_addr[ATM_ESA_LEN];
+ unsigned long flag;/* Topology_change flag,
+ remoteflag, permanent flag,
+ lecid, transaction id */
+ unsigned int targetless_le_arp; /* LANE2 */
+ unsigned int no_source_le_narp; /* LANE2 */
+ } normal;
+ struct atmlec_config_msg config;
+ struct {
+ uint16_t lec_id; /* requestor lec_id */
+ uint32_t tran_id; /* transaction id */
+ unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */
+ unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */
+ } proxy; /* For mapping LE_ARP requests to responses. Filled by */
+ } content; /* zeppelin, returned by kernel. Used only when proxying */
+};
+
+struct atmlec_ioc {
+ int dev_num;
+ unsigned char atm_addr[ATM_ESA_LEN];
+ unsigned char receive; /* 1= receive vcc, 0 = send vcc */
+};
+#endif /* _ATMLEC_H_ */
diff --git a/include/linux/atmmpc.h b/include/linux/atmmpc.h
new file mode 100644
index 000000000..e9c2ace8c
--- /dev/null
+++ b/include/linux/atmmpc.h
@@ -0,0 +1,124 @@
+#ifndef _ATMMPC_H_
+#define _ATMMPC_H_
+
+#include <linux/atmioc.h>
+#include <linux/atm.h>
+
+#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA)
+#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1)
+
+#define MPC_SOCKET_INGRESS 1
+#define MPC_SOCKET_EGRESS 2
+
+struct atmmpc_ioc {
+ int dev_num;
+ uint32_t ipaddr; /* the IP address of the shortcut */
+ int type; /* ingress or egress */
+};
+
+typedef struct in_ctrl_info {
+ uint8_t Last_NHRP_CIE_code;
+ uint8_t Last_Q2931_cause_value;
+ uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN];
+ uint32_t tag;
+ uint32_t in_dst_ip; /* IP address this ingress MPC sends packets to */
+ uint16_t holding_time;
+ uint32_t request_id;
+} in_ctrl_info;
+
+typedef struct eg_ctrl_info {
+ uint8_t DLL_header[256];
+ uint8_t DH_length;
+ uint32_t cache_id;
+ uint32_t tag;
+ uint32_t mps_ip;
+ uint32_t eg_dst_ip; /* IP address to which ingress MPC sends packets */
+ uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN];
+ uint16_t holding_time;
+} eg_ctrl_info;
+
+struct mpc_parameters{
+ uint16_t mpc_p1; /* Shortcut-Setup Frame Count */
+ uint16_t mpc_p2; /* Shortcut-Setup Frame Time */
+ uint8_t mpc_p3[8]; /* Flow-detection Protocols */
+ uint16_t mpc_p4; /* MPC Initial Retry Time */
+ uint16_t mpc_p5; /* MPC Retry Time Maximum */
+ uint16_t mpc_p6; /* Hold Down Time */
+};
+
+struct k_message{
+ uint16_t type;
+ uint32_t ip_mask;
+ uint8_t MPS_ctrl[ATM_ESA_LEN];
+ union {
+ in_ctrl_info in_info;
+ eg_ctrl_info eg_info;
+ struct mpc_parameters params;
+ } content;
+ struct atm_qos qos;
+};
+
+struct llc_snap_hdr { /* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */
+ uint8_t dsap; /* Destination Service Access Point (0xAA) */
+ uint8_t ssap; /* Source Service Access Point (0xAA) */
+ uint8_t ui; /* Unnumbered Information (0x03) */
+ uint8_t org[3]; /* Organizational identification (0x000000) */
+ uint8_t type[2]; /* Ether type (for IP) (0x0800) */
+};
+
+/* TLVs this MPC recognizes */
+#define TLV_MPOA_DEVICE_TYPE 0x00a03e2a
+
+/* MPOA device types in MPOA Device Type TLV */
+#define NON_MPOA 0
+#define MPS 1
+#define MPC 2
+#define MPS_AND_MPC 3
+
+
+/* MPC parameter defaults */
+
+#define MPC_P1 10 /* Shortcut-Setup Frame Count */
+#define MPC_P2 1 /* Shortcut-Setup Frame Time */
+#define MPC_P3 0 /* Flow-detection Protocols */
+#define MPC_P4 5 /* MPC Initial Retry Time */
+#define MPC_P5 40 /* MPC Retry Time Maximum */
+#define MPC_P6 160 /* Hold Down Time */
+#define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */
+
+/* MPC constants */
+
+#define MPC_C1 2 /* Retry Time Multiplier */
+#define MPC_C2 60 /* Initial Keep-Alive Lifetime */
+
+/* Message types - to MPOA daemon */
+
+#define SND_MPOA_RES_RQST 201
+#define SET_MPS_CTRL_ADDR 202
+#define SND_MPOA_RES_RTRY 203 /* Different type in a retry due to req id */
+#define STOP_KEEP_ALIVE_SM 204
+#define EGRESS_ENTRY_REMOVED 205
+#define SND_EGRESS_PURGE 206
+#define DIE 207 /* tell the daemon to exit() */
+#define DATA_PLANE_PURGE 208 /* Data plane purge because of egress cache hit miss or dead MPS */
+#define OPEN_INGRESS_SVC 209
+
+/* Message types - from MPOA daemon */
+
+#define MPOA_TRIGGER_RCVD 101
+#define MPOA_RES_REPLY_RCVD 102
+#define INGRESS_PURGE_RCVD 103
+#define EGRESS_PURGE_RCVD 104
+#define MPS_DEATH 105
+#define CACHE_IMPOS_RCVD 106
+#define SET_MPC_CTRL_ADDR 107 /* Our MPC's control ATM address */
+#define SET_MPS_MAC_ADDR 108
+#define CLEAN_UP_AND_EXIT 109
+#define SET_MPC_PARAMS 110 /* MPC configuration parameters */
+
+/* Message types - bidirectional */
+
+#define RELOAD 301 /* kill -HUP the daemon for reload */
+
+#endif /* _ATMMPC_H_ */
+
diff --git a/include/linux/atmsap.h b/include/linux/atmsap.h
new file mode 100644
index 000000000..f49418862
--- /dev/null
+++ b/include/linux/atmsap.h
@@ -0,0 +1,161 @@
+/* atmsap.h - ATM Service Access Point addressing definitions */
+
+/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */
+
+
+#ifndef _LINUX_ATMSAP_H
+#define _LINUX_ATMSAP_H
+
+/*
+ * BEGIN_xx and END_xx markers are used for automatic generation of
+ * documentation. Do not change them.
+ */
+
+
+/*
+ * Layer 2 protocol identifiers
+ */
+
+/* BEGIN_L2 */
+#define ATM_L2_NONE 0 /* L2 not specified */
+#define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */
+#define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */
+#define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */
+#define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */
+#define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */
+#define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */
+#define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */
+#define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */
+#define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */
+#define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */
+#define ATM_L2_Q922 0x0e /* ITU-T Q.922 */
+#define ATM_L2_USER 0x10 /* user-specified */
+#define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */
+/* END_L2 */
+
+
+/*
+ * Layer 3 protocol identifiers
+ */
+
+/* BEGIN_L3 */
+#define ATM_L3_NONE 0 /* L3 not specified */
+#define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */
+#define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */
+#define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */
+#define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */
+#define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */
+#define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */
+#define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */
+#define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */
+#define ATM_L3_USER 0x10 /* user-specified */
+/* END_L3 */
+
+
+/*
+ * High layer identifiers
+ */
+
+/* BEGIN_HL */
+#define ATM_HL_NONE 0 /* HL not specified */
+#define ATM_HL_ISO 0x01 /* ISO */
+#define ATM_HL_USER 0x02 /* user-specific */
+#define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */
+#define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */
+/* END_HL */
+
+
+/*
+ * ITU-T coded mode of operation
+ */
+
+/* BEGIN_IMD */
+#define ATM_IMD_NONE 0 /* mode not specified */
+#define ATM_IMD_NORMAL 1 /* normal mode of operation */
+#define ATM_IMD_EXTENDED 2 /* extended mode of operation */
+/* END_IMD */
+
+/*
+ * H.310 code points
+ */
+
+#define ATM_TT_NONE 0 /* terminal type not specified */
+#define ATM_TT_RX 1 /* receive only */
+#define ATM_TT_TX 2 /* send only */
+#define ATM_TT_RXTX 3 /* receive and send */
+
+#define ATM_MC_NONE 0 /* no multiplexing */
+#define ATM_MC_TS 1 /* transport stream (TS) */
+#define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */
+#define ATM_MC_PS 3 /* program stream (PS) */
+#define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */
+#define ATM_MC_H221 5 /* ITU-T Rec. H.221 */
+
+/*
+ * SAP structures
+ */
+
+#define ATM_MAX_HLI 8 /* maximum high-layer information length */
+
+
+struct atm_blli {
+ unsigned char l2_proto; /* layer 2 protocol */
+ union {
+ struct {
+ unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */
+ /* absent */
+ unsigned char window; /* window size (k), 1-127 (0 to omit) */
+ } itu; /* ITU-T encoding */
+ unsigned char user; /* user-specified l2 information */
+ } l2;
+ unsigned char l3_proto; /* layer 3 protocol */
+ union {
+ struct {
+ unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */
+ /* absent */
+ unsigned char def_size; /* default packet size (log2), 4-12 (0 to */
+ /* omit) */
+ unsigned char window;/* packet window size, 1-127 (0 to omit) */
+ } itu; /* ITU-T ecoding */
+ unsigned char user; /* user specified l3 information */
+ struct { /* if l3_proto = ATM_L3_H310 */
+ unsigned char term_type; /* terminal type */
+ unsigned char fw_mpx_cap; /* forward multiplexing capability */
+ /* only if term_type != ATM_TT_NONE */
+ unsigned char bw_mpx_cap; /* backward multiplexing capability */
+ /* only if term_type != ATM_TT_NONE */
+ } h310;
+ struct { /* if l3_proto = ATM_L3_TR9577 */
+ unsigned char ipi; /* initial protocol id */
+ unsigned char snap[5];/* IEEE 802.1 SNAP identifier */
+ /* (only if ipi == NLPID_IEEE802_1_SNAP) */
+ } tr9577;
+ } l3;
+ struct atm_blli *next; /* next BLLI or NULL (undefined when used in */
+ /* atmsvc_msg) ONLY USED IN OLD-STYLE API */
+};
+
+
+struct atm_bhli {
+ unsigned char hl_type; /* high layer information type */
+ unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */
+ /* hl_type == ATM_HL_ISO) */
+ unsigned char hl_info[ATM_MAX_HLI];/* high layer information */
+};
+
+
+#define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */
+
+
+struct atm_sap {
+ struct atm_bhli bhli; /* local SAP, high-layer information */
+ struct atm_blli blli[ATM_MAX_BLLI]; /* local SAP, low-layer info */
+};
+
+
+static __inline__ int blli_in_use(struct atm_blli blli)
+{
+ return blli.l2_proto || blli.l3_proto;
+}
+
+#endif
diff --git a/include/linux/atmsvc.h b/include/linux/atmsvc.h
new file mode 100644
index 000000000..8b93f5644
--- /dev/null
+++ b/include/linux/atmsvc.h
@@ -0,0 +1,53 @@
+/* atmsvc.h - ATM signaling kernel-demon interface definitions */
+
+/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
+
+
+#ifndef _LINUX_ATMSVC_H
+#define _LINUX_ATMSVC_H
+
+#include <linux/atm.h>
+#include <linux/atmioc.h>
+
+
+#define ATMSIGD_CTRL _IO('a',ATMIOC_SPECIAL)
+ /* become ATM signaling demon control socket */
+
+enum atmsvc_msg_type { as_catch_null,as_bind,as_connect,as_accept,as_reject,
+ as_listen,as_okay,as_error,as_indicate,as_close,as_itf_notify,
+ as_modify,as_identify,as_terminate };
+
+struct atmsvc_msg {
+ enum atmsvc_msg_type type;
+ unsigned long vcc;
+ unsigned long listen_vcc; /* indicate */
+ int reply; /* for okay and close: */
+ /* < 0: error before active */
+ /* (sigd has discarded ctx) */
+ /* ==0: success */
+ /* > 0: error when active (still */
+ /* need to close) */
+ struct sockaddr_atmpvc pvc; /* indicate, okay (connect) */
+ struct sockaddr_atmsvc local; /* local SVC address */
+ struct atm_qos qos; /* QOS parameters */
+ struct atm_sap sap; /* SAP */
+ unsigned long session; /* for p2pm */
+ struct sockaddr_atmsvc svc; /* SVC address */
+};
+
+/*
+ * Message contents: see ftp://lrcftp.epfl.ch/pub/linux/atm/docs/isp-*.tar.gz
+ */
+
+/*
+ * Some policy stuff for atmsigd and for net/atm/svc.c. Both have to agree on
+ * what PCR is used to request bandwidth from the device driver. net/atm/svc.c
+ * tries to do better than that, but only if there's no routing decision (i.e.
+ * if signaling only uses one ATM interface).
+ */
+
+#define SELECT_TOP_PCR(tp) ((tp).pcr ? (tp).pcr : \
+ (tp).max_pcr && (tp).max_pcr != ATM_MAX_PCR ? (tp).max_pcr : \
+ (tp).min_pcr ? (tp).min_pcr : ATM_MAX_PCR)
+
+#endif
diff --git a/include/linux/b1lli.h b/include/linux/b1lli.h
index 71ad74f6e..72cae4d27 100644
--- a/include/linux/b1lli.h
+++ b/include/linux/b1lli.h
@@ -1,11 +1,30 @@
/*
- * $Id: b1lli.h,v 1.6 1999/04/15 19:49:36 calle Exp $
+ * $Id: b1lli.h,v 1.8 1999/07/01 15:26:54 calle Exp $
*
* ISDN lowlevel-module for AVM B1-card.
*
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log: b1lli.h,v $
+ * Revision 1.8 1999/07/01 15:26:54 calle
+ * complete new version (I love it):
+ * + new hardware independed "capi_driver" interface that will make it easy to:
+ * - support other controllers with CAPI-2.0 (i.e. USB Controller)
+ * - write a CAPI-2.0 for the passive cards
+ * - support serial link CAPI-2.0 boxes.
+ * + wrote "capi_driver" for all supported cards.
+ * + "capi_driver" (supported cards) now have to be configured with
+ * make menuconfig, in the past all supported cards where included
+ * at once.
+ * + new and better informations in /proc/capi/
+ * + new ioctl to switch trace of capi messages per controller
+ * using "avmcapictrl trace [contr] on|off|...."
+ * + complete testcircle with all supported cards and also the
+ * PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
+ *
+ * Revision 1.7 1999/06/21 15:24:25 calle
+ * extend information in /proc.
+ *
* Revision 1.6 1999/04/15 19:49:36 calle
* fix fuer die B1-PCI. Jetzt geht z.B. auch IRQ 17 ...
*
@@ -96,7 +115,6 @@ typedef struct avmb1_carddef {
#define AVM_CARDTYPE_T1 1
#define AVM_CARDTYPE_M1 2
#define AVM_CARDTYPE_M2 3
-#define AVM_CARDTYPE_B1PCI 4
typedef struct avmb1_extcarddef {
int port;
@@ -113,107 +131,6 @@ typedef struct avmb1_extcarddef {
#define AVMB1_GET_CARDINFO 5 /* get cardtype */
#define AVMB1_REMOVECARD 6 /* remove a card (usefull for T1) */
-
-
-/*
- * card states for startup
- */
-
-#define CARD_FREE 0
-#define CARD_DETECTED 1
-#define CARD_LOADING 2
-#define CARD_INITSTATE 4
-#define CARD_RUNNING 5
-#define CARD_ACTIVE 6
-
-#ifdef __KERNEL__
-
-#define AVMB1_PORTLEN 0x1f
-
-#define AVM_MAXVERSION 8
-
-#define AVM_NAPPS 30
-#define AVM_NNCCI_PER_CHANNEL 4
-
-/*
- * Main driver data
- */
-
-typedef struct avmb1_card {
- struct avmb1_card *next;
- int cnr;
- unsigned int port;
- unsigned irq;
- int cardtype;
- int cardnr; /* for T1-HEMA */
- volatile unsigned short cardstate;
- int interrupt;
- int blocked;
- int versionlen;
- char versionbuf[1024];
- char *version[AVM_MAXVERSION];
- char msgbuf[128]; /* capimsg msg part */
- char databuf[2048]; /* capimsg data part */
- capi_version cversion;
- char name[10];
-} avmb1_card;
-
-/*
- * Versions
- */
-
-#define VER_DRIVER 0
-#define VER_CARDTYPE 1
-#define VER_HWID 2
-#define VER_SERIAL 3
-#define VER_OPTION 4
-#define VER_PROTO 5
-#define VER_PROFILE 6
-#define VER_CAPI 7
-
-
-/* b1lli.c */
-int B1_detect(unsigned int base, int cardtype);
-int T1_detectandinit(unsigned int base, unsigned irq, int cardnr);
-void B1_reset(unsigned int base);
-void T1_reset(unsigned int base);
-int B1_load_t4file(unsigned int base, avmb1_t4file * t4file);
-int B1_load_config(unsigned int base, avmb1_t4file * config);
-int B1_loaded(unsigned int base);
-void B1_setinterrupt(unsigned int base, unsigned irq, int cardtype);
-unsigned char B1_disable_irq(unsigned int base);
-void T1_disable_irq(unsigned int base);
-int B1_valid_irq(unsigned irq, int cardtype);
-int B1_valid_port(unsigned port, int cardtype);
-void B1_handle_interrupt(avmb1_card * card);
-void B1_send_init(unsigned int port,
- unsigned int napps, unsigned int nncci, unsigned int cardnr);
-void B1_send_register(unsigned int port,
- __u16 appid, __u32 nmsg,
- __u32 nb3conn, __u32 nb3blocks, __u32 b3bsize);
-void B1_send_release(unsigned int port, __u16 appid);
-void B1_send_message(unsigned int port, struct sk_buff *skb);
-
-/* b1capi.c */
-void avmb1_handle_new_ncci(avmb1_card * card,
- __u16 appl, __u32 ncci, __u32 winsize);
-void avmb1_handle_free_ncci(avmb1_card * card,
- __u16 appl, __u32 ncci);
-void avmb1_handle_capimsg(avmb1_card * card, __u16 appl, struct sk_buff *skb);
-void avmb1_card_ready(avmb1_card * card);
-
-/* standard calls, with check and allocation of resources */
-int avmb1_addcard(int port, int irq, int cardtype);
-int avmb1_probecard(int port, int irq, int cardtype);
-
-
-int avmb1_resetcard(int cardnr);
-
-/* calls for pcmcia driver */
-int avmb1_detectcard(int port, int irq, int cardtype);
-int avmb1_registercard(int port, int irq, int cardtype, int allocio);
-int avmb1_unregistercard(int cnr, int freeio);
-
-#endif /* __KERNEL__ */
+#define AVMB1_REGISTERCARD_IS_OBSOLETE
#endif /* _B1LLI_H_ */
diff --git a/include/linux/b1pcmcia.h b/include/linux/b1pcmcia.h
new file mode 100644
index 000000000..e13307ba0
--- /dev/null
+++ b/include/linux/b1pcmcia.h
@@ -0,0 +1,36 @@
+/*
+ * $Id: b1pcmcia.h,v 1.1 1999/07/01 15:26:56 calle Exp $
+ *
+ * Exported functions of module b1pcmcia to be called by
+ * avm_cs card services module.
+ *
+ * Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
+ *
+ * $Log: b1pcmcia.h,v $
+ * Revision 1.1 1999/07/01 15:26:56 calle
+ * complete new version (I love it):
+ * + new hardware independed "capi_driver" interface that will make it easy to:
+ * - support other controllers with CAPI-2.0 (i.e. USB Controller)
+ * - write a CAPI-2.0 for the passive cards
+ * - support serial link CAPI-2.0 boxes.
+ * + wrote "capi_driver" for all supported cards.
+ * + "capi_driver" (supported cards) now have to be configured with
+ * make menuconfig, in the past all supported cards where included
+ * at once.
+ * + new and better informations in /proc/capi/
+ * + new ioctl to switch trace of capi messages per controller
+ * using "avmcapictrl trace [contr] on|off|...."
+ * + complete testcircle with all supported cards and also the
+ * PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
+ *
+ */
+
+#ifndef _B1PCMCIA_H_
+#define _B1PCMCIA_H_
+
+int b1pcmcia_addcard_b1(unsigned int port, unsigned irq);
+int b1pcmcia_addcard_m1(unsigned int port, unsigned irq);
+int b1pcmcia_addcard_m2(unsigned int port, unsigned irq);
+int b1pcmcia_delcard(unsigned int port, unsigned irq);
+
+#endif /* _B1PCMCIA_H_ */
diff --git a/include/linux/bigmem.h b/include/linux/bigmem.h
new file mode 100644
index 000000000..289183bfe
--- /dev/null
+++ b/include/linux/bigmem.h
@@ -0,0 +1,48 @@
+#ifndef _LINUX_BIGMEM_H
+#define _LINUX_BIGMEM_H
+
+#include <linux/config.h>
+
+#ifdef CONFIG_BIGMEM
+
+#include <asm/bigmem.h>
+
+/* declarations for linux/mm/bigmem.c */
+extern unsigned long bigmem_mapnr;
+extern int nr_free_bigpages;
+
+extern struct page * prepare_bigmem_swapout(struct page *);
+extern struct page * replace_with_bigmem(struct page *);
+
+#else /* CONFIG_BIGMEM */
+
+#define prepare_bigmem_swapout(page) page
+#define replace_with_bigmem(page) page
+#define kmap(kaddr, type) kaddr
+#define kunmap(vaddr, type) do { } while (0)
+#define nr_free_bigpages 0
+
+#endif /* CONFIG_BIGMEM */
+
+/* when CONFIG_BIGMEM is not set these will be plain clear/copy_page */
+extern inline void clear_bigpage(unsigned long kaddr)
+{
+ unsigned long vaddr;
+
+ vaddr = kmap(kaddr, KM_WRITE);
+ clear_page(vaddr);
+ kunmap(vaddr, KM_WRITE);
+}
+
+extern inline void copy_bigpage(unsigned long to, unsigned long from)
+{
+ unsigned long vfrom, vto;
+
+ vfrom = kmap(from, KM_READ);
+ vto = kmap(to, KM_WRITE);
+ copy_page(vto, vfrom);
+ kunmap(vfrom, KM_READ);
+ kunmap(vto, KM_WRITE);
+}
+
+#endif /* _LINUX_BIGMEM_H */
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 7ada54246..4f7fe13f7 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -38,7 +38,8 @@ struct linux_binfmt {
struct module *module;
int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
int (*load_shlib)(int fd);
- int (*core_dump)(long signr, struct pt_regs * regs);
+ int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
+ unsigned long min_coredump; /* minimal dump size */
};
extern int register_binfmt(struct linux_binfmt *);
@@ -49,15 +50,6 @@ extern int read_exec(struct dentry *, unsigned long offset,
extern int open_dentry(struct dentry *, int mode);
-extern int init_elf_binfmt(void);
-extern int init_elf32_binfmt(void);
-extern int init_irix_binfmt(void);
-extern int init_aout_binfmt(void);
-extern int init_aout32_binfmt(void);
-extern int init_script_binfmt(void);
-extern int init_em86_binfmt(void);
-extern int init_misc_binfmt(void);
-
extern int prepare_binprm(struct linux_binprm *);
extern void remove_arg_zero(struct linux_binprm *);
extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
@@ -66,6 +58,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm);
extern int copy_strings(int argc,char ** argv,struct linux_binprm *bprm);
extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
extern void compute_creds(struct linux_binprm *binprm);
+extern int do_coredump(long signr, struct pt_regs * regs);
#if 0
diff --git a/include/linux/bios32.h b/include/linux/bios32.h
deleted file mode 100644
index 2f2c14b7c..000000000
--- a/include/linux/bios32.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This is only a stub file to make drivers not yet converted to the new
- * PCI probing mechanism work. [mj]
- */
-
-#ifndef BIOS32_H
-#define BIOS32_H
-
-#include <linux/pci.h>
-
-#warning This driver uses the old PCI interface, please fix it (see Documentation/pci.txt)
-
-extern inline int __pcibios_read_irq(unsigned char bus, unsigned char dev_fn, unsigned char *to)
-{
- struct pci_dev *pdev = pci_find_slot(bus, dev_fn);
- if (!pdev) {
- *to = 0;
- return PCIBIOS_DEVICE_NOT_FOUND;
- } else {
- *to = pdev->irq;
- return PCIBIOS_SUCCESSFUL;
- }
-}
-
-extern inline int __pcibios_read_config_byte(unsigned char bus,
- unsigned char dev_fn, unsigned char where, unsigned char *to)
-{
- return pcibios_read_config_byte(bus, dev_fn, where, to);
-}
-
-#define pcibios_read_config_byte(b,d,w,p) \
- (((w) == PCI_INTERRUPT_LINE) ? __pcibios_read_irq(b,d,p) : __pcibios_read_config_byte(b,d,w,p))
-
-#endif
diff --git a/include/linux/blk.h b/include/linux/blk.h
index fa4272075..d0db1bce6 100644
--- a/include/linux/blk.h
+++ b/include/linux/blk.h
@@ -4,8 +4,7 @@
#include <linux/blkdev.h>
#include <linux/locks.h>
#include <linux/config.h>
-
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
/*
* Spinlock for protecting the request queue which
@@ -19,7 +18,7 @@ extern spinlock_t io_request_lock;
* NOTE that writes may use only the low 2/3 of these: reads
* take precedence.
*/
-#define NR_REQUEST 64
+#define NR_REQUEST 128
/*
* This is used in the elevator algorithm. We don't prioritise reads
@@ -57,6 +56,7 @@ extern int ap_init(void);
extern int ddv_init(void);
extern int z2_init(void);
extern int swim3_init(void);
+extern int swimiop_init(void);
extern int amiga_floppy_init(void);
extern int atari_floppy_init(void);
extern int nbd_init(void);
@@ -86,6 +86,19 @@ void initrd_init(void);
#endif
+/*
+ * end_request() and friends. Must be called with the request queue spinlock
+ * acquired. All functions called within end_request() _must_be_ atomic.
+ *
+ * Several drivers define their own end_request and call
+ * end_that_request_first() and end_that_request_last()
+ * for parts of the original function. This prevents
+ * code duplication in drivers.
+ */
+
+int end_that_request_first(struct request *req, int uptodate, char *name);
+void end_that_request_last(struct request *req);
+
#if defined(MAJOR_NR) || defined(IDE_DRIVER)
/*
@@ -333,24 +346,6 @@ static void floppy_off(unsigned int nr);
#define DEVICE_ON(device)
#define DEVICE_OFF(device)
-#elif (MAJOR_NR == MFM_ACORN_MAJOR)
-
-#define DEVICE_NAME "mfm disk"
-#define DEVICE_INTR do_mfm
-#define DEVICE_REQUEST do_mfm_request
-#define DEVICE_NR(device) (MINOR(device) >> 6)
-#define DEVICE_ON(device)
-#define DEVICE_OFF(device)
-
-#elif (MAJOR_NR == MFM_ACORN_MAJOR)
-
-#define DEVICE_NAME "mfm disk"
-#define DEVICE_INTR do_mfm
-#define DEVICE_REQUEST do_mfm_request
-#define DEVICE_NR(device) (MINOR(device) >> 6)
-#define DEVICE_ON(device)
-#define DEVICE_OFF(device)
-
#elif (MAJOR_NR == NBD_MAJOR)
#define DEVICE_NAME "nbd"
@@ -377,6 +372,15 @@ static void floppy_off(unsigned int nr);
#define DEVICE_ON(device)
#define DEVICE_OFF(device)
+#elif (MAJOR_NR == COMPAQ_SMART2_MAJOR)
+
+#define DEVICE_NAME "ida"
+#define TIMEOUT_VALUE (25*HZ)
+#define DEVICE_REQUEST do_ida_request0
+#define DEVICE_NR(device) (MINOR(device) >> 4)
+#define DEVICE_ON(device)
+#define DEVICE_OFF(device)
+
#endif /* MAJOR_NR == whatever */
#if (MAJOR_NR != SCSI_TAPE_MAJOR)
@@ -439,17 +443,6 @@ static void (DEVICE_REQUEST)(void);
#endif /* !defined(IDE_DRIVER) */
-/*
- * end_request() and friends. Must be called with the request queue spinlock
- * acquired. All functions called within end_request() _must_be_ atomic.
- *
- * Several drivers define their own end_request and call end_that_request_first()
- * and end_that_request_last() for parts of the original function. This prevents
- * code duplication in drivers.
- */
-
-int end_that_request_first(struct request *req, int uptodate, char *name);
-void end_that_request_last(struct request *req);
#ifndef LOCAL_END_REQUEST /* If we have our own end_request, we do not want to include this mess */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 03ce66426..d3aa602c9 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -25,6 +25,7 @@ struct request {
int errors;
unsigned long sector;
unsigned long nr_sectors;
+ unsigned long nr_segments;
unsigned long current_nr_sectors;
char * buffer;
struct semaphore * sem;
@@ -75,14 +76,18 @@ extern int * max_readahead[MAX_BLKDEV];
extern int * max_sectors[MAX_BLKDEV];
-#define MAX_SECTORS 244 /* 254 ? */
+extern int * max_segments[MAX_BLKDEV];
+
+#define MAX_SECTORS 128
+
+#define MAX_SEGMENTS MAX_SECTORS
#define PageAlignSize(size) (((size) + PAGE_SIZE -1) & PAGE_MASK)
#if 0 /* small readahead */
#define MAX_READAHEAD PageAlignSize(4096*7)
#define MIN_READAHEAD PageAlignSize(4096*2)
#else /* large readahead */
-#define MAX_READAHEAD PageAlignSize(4096*18)
+#define MAX_READAHEAD PageAlignSize(4096*31)
#define MIN_READAHEAD PageAlignSize(4096*3)
#endif
diff --git a/include/linux/capability.h b/include/linux/capability.h
index f6fb2c9c3..fd3c97ac3 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -131,6 +131,7 @@ typedef __u32 kernel_cap_t;
#define CAP_LINUX_IMMUTABLE 9
/* Allows binding to TCP/UDP sockets below 1024 */
+/* Allows binding to ATM VCIs below 32 */
#define CAP_NET_BIND_SERVICE 10
@@ -150,6 +151,7 @@ typedef __u32 kernel_cap_t;
/* Allow clearing driver statistics */
/* Allow multicasting */
/* Allow read/write of device-specific registers */
+/* Allow activation of ATM control sockets */
#define CAP_NET_ADMIN 12
@@ -173,6 +175,7 @@ typedef __u32 kernel_cap_t;
#define CAP_SYS_MODULE 16
/* Allow ioperm/iopl access */
+/* Allow sending USB messages to any device via /proc/bus/usb */
#define CAP_SYS_RAWIO 17
@@ -264,6 +267,10 @@ typedef __u32 kernel_cap_t;
#define CAP_SYS_TTY_CONFIG 26
#ifdef __KERNEL__
+/*
+ * Bounding set
+ */
+extern kernel_cap_t cap_bset;
/*
* Internal kernel functions only
@@ -289,7 +296,7 @@ typedef __u32 kernel_cap_t;
#define CAP_TO_MASK(x) (1 << (x))
#define cap_raise(c, flag) (cap_t(c) |= CAP_TO_MASK(flag))
#define cap_lower(c, flag) (cap_t(c) &= ~CAP_TO_MASK(flag))
-#define cap_raised(c, flag) (cap_t(c) & CAP_TO_MASK(flag))
+#define cap_raised(c, flag) (cap_t(c) & CAP_TO_MASK(flag) & cap_bset)
static inline kernel_cap_t cap_combine(kernel_cap_t a, kernel_cap_t b)
{
diff --git a/include/linux/cd1400.h b/include/linux/cd1400.h
index d07d1e61a..69f9730eb 100644
--- a/include/linux/cd1400.h
+++ b/include/linux/cd1400.h
@@ -4,7 +4,7 @@
* cd1400.h -- cd1400 UART hardware info.
*
* Copyright (C) 1996-1998 Stallion Technologies (support@stallion.oz.au).
- * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au).
+ * Copyright (C) 1994-1996 Greg Ungerer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/include/linux/cdk.h b/include/linux/cdk.h
index 2180e4330..b7576643d 100644
--- a/include/linux/cdk.h
+++ b/include/linux/cdk.h
@@ -4,7 +4,7 @@
* cdk.h -- CDK interface definitions.
*
* Copyright (C) 1996-1998 Stallion Technologies (support@stallion.oz.au).
- * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au).
+ * Copyright (C) 1994-1996 Greg Ungerer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index a8c028fb3..bf3796692 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -11,6 +11,8 @@
#ifndef _LINUX_CDROM_H
#define _LINUX_CDROM_H
+#include <linux/types.h>
+
/*******************************************************
* As of Linux 2.1.x, all Linux CD-ROM application programs will use this
* (and only this) include file. It is my hope to provide Linux with
@@ -94,16 +96,26 @@
#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
/*
- * These ioctls are used only used in optcd.c
+ * These ioctls are only used in optcd.c
*/
#define CDROMREADALL 0x5318 /* read all 2646 bytes */
-#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
+
+/*
+ * These ioctls are (now) only in ide-cd.c for controlling
+ * drive spindown time. They should be implemented in the
+ * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
+ * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
+ * -Erik
+ */
+#define CDROMGETSPINDOWN 0x531d
+#define CDROMSETSPINDOWN 0x531e
/*
* These ioctls are implemented through the uniform CD-ROM driver
* They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
* drivers are eventually ported to the uniform CD-ROM driver interface.
*/
+#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
#define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
#define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
#define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
@@ -119,6 +131,15 @@
/* This ioctl is only used by sbpcd at the moment */
#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
+/* DVD-ROM Specific ioctls */
+#define DVD_READ_STRUCT 0x5390 /* Read structure */
+#define DVD_WRITE_STRUCT 0x5391 /* Write structure */
+#define DVD_AUTH 0x5392 /* Authentication */
+
+#define CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
+#define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
+#define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
+
/*******************************************************
* CDROM IOCTL structures
*******************************************************/
@@ -126,9 +147,9 @@
/* Address in MSF format */
struct cdrom_msf0
{
- u_char minute;
- u_char second;
- u_char frame;
+ __u8 minute;
+ __u8 second;
+ __u8 frame;
};
/* Address in either MSF or logical format */
@@ -141,48 +162,48 @@ union cdrom_addr
/* This struct is used by the CDROMPLAYMSF ioctl */
struct cdrom_msf
{
- u_char cdmsf_min0; /* start minute */
- u_char cdmsf_sec0; /* start second */
- u_char cdmsf_frame0; /* start frame */
- u_char cdmsf_min1; /* end minute */
- u_char cdmsf_sec1; /* end second */
- u_char cdmsf_frame1; /* end frame */
+ __u8 cdmsf_min0; /* start minute */
+ __u8 cdmsf_sec0; /* start second */
+ __u8 cdmsf_frame0; /* start frame */
+ __u8 cdmsf_min1; /* end minute */
+ __u8 cdmsf_sec1; /* end second */
+ __u8 cdmsf_frame1; /* end frame */
};
/* This struct is used by the CDROMPLAYTRKIND ioctl */
struct cdrom_ti
{
- u_char cdti_trk0; /* start track */
- u_char cdti_ind0; /* start index */
- u_char cdti_trk1; /* end track */
- u_char cdti_ind1; /* end index */
+ __u8 cdti_trk0; /* start track */
+ __u8 cdti_ind0; /* start index */
+ __u8 cdti_trk1; /* end track */
+ __u8 cdti_ind1; /* end index */
};
/* This struct is used by the CDROMREADTOCHDR ioctl */
struct cdrom_tochdr
{
- u_char cdth_trk0; /* start track */
- u_char cdth_trk1; /* end track */
+ __u8 cdth_trk0; /* start track */
+ __u8 cdth_trk1; /* end track */
};
/* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */
struct cdrom_volctrl
{
- u_char channel0;
- u_char channel1;
- u_char channel2;
- u_char channel3;
+ __u8 channel0;
+ __u8 channel1;
+ __u8 channel2;
+ __u8 channel3;
};
/* This struct is used by the CDROMSUBCHNL ioctl */
struct cdrom_subchnl
{
- u_char cdsc_format;
- u_char cdsc_audiostatus;
- u_char cdsc_adr: 4;
- u_char cdsc_ctrl: 4;
- u_char cdsc_trk;
- u_char cdsc_ind;
+ __u8 cdsc_format;
+ __u8 cdsc_audiostatus;
+ __u8 cdsc_adr: 4;
+ __u8 cdsc_ctrl: 4;
+ __u8 cdsc_trk;
+ __u8 cdsc_ind;
union cdrom_addr cdsc_absaddr;
union cdrom_addr cdsc_reladdr;
};
@@ -191,12 +212,12 @@ struct cdrom_subchnl
/* This struct is used by the CDROMREADTOCENTRY ioctl */
struct cdrom_tocentry
{
- u_char cdte_track;
- u_char cdte_adr :4;
- u_char cdte_ctrl :4;
- u_char cdte_format;
+ __u8 cdte_track;
+ __u8 cdte_adr :4;
+ __u8 cdte_ctrl :4;
+ __u8 cdte_format;
union cdrom_addr cdte_addr;
- u_char cdte_datamode;
+ __u8 cdte_datamode;
};
/* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */
@@ -211,9 +232,9 @@ struct cdrom_read
struct cdrom_read_audio
{
union cdrom_addr addr; /* frame address */
- u_char addr_format; /* CDROM_LBA or CDROM_MSF */
+ __u8 addr_format; /* CDROM_LBA or CDROM_MSF */
int nframes; /* number of 2352-byte-frames to read at once */
- u_char *buf; /* frame buffer (size: nframes*2352 bytes) */
+ __u8 *buf; /* frame buffer (size: nframes*2352 bytes) */
};
/* This struct is used with the CDROMMULTISESSION ioctl */
@@ -222,8 +243,8 @@ struct cdrom_multisession
union cdrom_addr addr; /* frame address: start-of-last-session
(not the new "frame 16"!). Only valid
if the "xa_flag" is true. */
- u_char xa_flag; /* 1: "is XA disk" */
- u_char addr_format; /* CDROM_LBA or CDROM_MSF */
+ __u8 xa_flag; /* 1: "is XA disk" */
+ __u8 addr_format; /* CDROM_LBA or CDROM_MSF */
};
/* This struct is used with the CDROM_GET_MCN ioctl.
@@ -233,7 +254,7 @@ struct cdrom_multisession
*/
struct cdrom_mcn
{
- u_char medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */
+ __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */
};
/* This is used by the CDROMPLAYBLK ioctl */
@@ -243,6 +264,17 @@ struct cdrom_blk
unsigned short len;
};
+#define CDROM_PACKET_SIZE 12
+
+/* for CDROM_PACKET_COMMAND ioctl */
+struct cdrom_generic_command
+{
+ unsigned char cmd[CDROM_PACKET_SIZE];
+ unsigned char *buffer;
+ unsigned int buflen;
+ int stat;
+};
+
/*
* A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336,
@@ -321,14 +353,6 @@ struct cdrom_blk
#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */
#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */
-/* CD-ROM-specific SCSI command opcodes */
-#define SCMD_READ_TOC 0x43 /* read table of contents */
-#define SCMD_PLAYAUDIO_MSF 0x47 /* play data at time offset */
-#define SCMD_PLAYAUDIO_TI 0x48 /* play data at track/index */
-#define SCMD_PAUSE_RESUME 0x4B /* pause/resume audio */
-#define SCMD_READ_SUBCHANNEL 0x42 /* read SC info on playing disc */
-#define SCMD_PLAYAUDIO10 0x45 /* play data at logical block */
-
/* capability flags used with the uniform CD-ROM driver */
#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */
#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */
@@ -342,6 +366,12 @@ struct cdrom_blk
#define CDC_RESET 0x200 /* hard reset device */
#define CDC_IOCTLS 0x400 /* driver has non-standard ioctls */
#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */
+#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */
+#define CDC_CD_R 0x2000 /* drive is a CD-R */
+#define CDC_CD_RW 0x4000 /* drive is a CD-RW */
+#define CDC_DVD 0x8000 /* drive is a DVD */
+#define CDC_DVD_R 0x10000 /* drive can write DVD-R */
+#define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */
/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
#define CDS_NO_INFO 0 /* if not implemented */
@@ -370,6 +400,260 @@ struct cdrom_blk
#define CDSL_NONE ((int) (~0U>>1)-1)
#define CDSL_CURRENT ((int) (~0U>>1))
+/* For partition based multisession access. IDE can handle 64 partitions
+ * per drive - SCSI CD-ROM's use minors to differentiate between the
+ * various drives, so we can't do multisessions the same way there.
+ * Use the -o session=x option to mount on them.
+ */
+#define CD_PART_MAX 64
+#define CD_PART_MASK (CD_PART_MAX - 1)
+
+/*********************************************************************
+ * Generic Packet commands, MMC commands, and such
+ *********************************************************************/
+
+ /* The generic packet command opcodes for CD/DVD Logical Units,
+ * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
+#define GPCMD_BLANK 0xa1
+#define GPCMD_CLOSE_TRACK 0x5b
+#define GPCMD_FLUSH_CACHE 0x35
+#define GPCMD_FORMAT_UNIT 0x04
+#define GPCMD_GET_CONFIGURATION 0x46
+#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
+#define GPCMD_GET_PERFORMANCE 0xac
+#define GPCMD_INQUIRY 0x12
+#define GPCMD_LOAD_UNLOAD 0xa6
+#define GPCMD_MECHANISM_STATUS 0xbd
+#define GPCMD_MODE_SELECT_10 0x55
+#define GPCMD_MODE_SENSE_10 0x5a
+#define GPCMD_PAUSE_RESUME 0x4b
+#define GPCMD_PLAY_AUDIO_10 0x45
+#define GPCMD_PLAY_AUDIO_MSF 0x47
+#define GPCMD_PLAY_CD 0xbc
+#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
+#define GPCMD_READ_10 0x28
+#define GPCMD_READ_12 0xa8
+#define GPCMD_READ_CDVD_CAPACITY 0x25
+#define GPCMD_READ_CD 0xbe
+#define GPCMD_READ_CD_MSF 0xb9
+#define GPCMD_READ_DISC_INFO 0x51
+#define GPCMD_READ_DVD_STRUCTURE 0xad
+#define GPCMD_READ_FORMAT_CAPACITIES 0x23
+#define GPCMD_READ_HEADER 0x44
+#define GPCMD_READ_TRACK_RZONE_INFO 0x52
+#define GPCMD_READ_SUBCHANNEL 0x42
+#define GPCMD_READ_TOC_PMA_ATIP 0x43
+#define GPCMD_REPAIR_RZONE_TRACK 0x58
+#define GPCMD_REPORT_KEY 0xa4
+#define GPCMD_REQUEST_SENSE 0x03
+#define GPCMD_RESERVE_RZONE_TRACK 0x53
+#define GPCMD_SCAN 0xba
+#define GPCMD_SEEK 0x2b
+#define GPCMD_SEND_DVD_STRUCTURE 0xad
+#define GPCMD_SEND_EVENT 0xa2
+#define GPCMD_SEND_KEY 0xa3
+#define GPCMD_SEND_OPC 0x54
+#define GPCMD_SET_READ_AHEAD 0xa7
+#define GPCMD_SET_STREAMING 0xb6
+#define GPCMD_START_STOP_UNIT 0x1b
+#define GPCMD_STOP_PLAY_SCAN 0x4e
+#define GPCMD_TEST_UNIT_READY 0x00
+#define GPCMD_VERIFY_10 0x2f
+#define GPCMD_WRITE_10 0x2a
+#define GPCMD_WRITE_AND_VERIFY_10 0x2e
+/* This is listed as optional in ATAPI 2.6, but is (curiously)
+ * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
+ * Table 377 as an MMC command for SCSi devices though... Most ATAPI
+ * drives support it. */
+#define GPCMD_SET_SPEED 0xbb
+/* This seems to be a SCSI specific CD-ROM opcode
+ * to play data at track/index */
+#define GPCMD_PLAYAUDIO_TI 0x48
+
+/* Is this really used by anything? I couldn't find these...*/
+#if 0
+/* MMC2/MTFuji Opcodes */
+#define ERASE 0x2c
+#define READ_BUFFER 0x3c
+#endif
+
+
+
+
+/* Mode page codes for mode sense/set */
+#define GPMODE_R_W_ERROR_PAGE 0x1
+#define GPMODE_WRITE_PARMS_PAGE 0x5
+#define GPMODE_AUDIO_CTL_PAGE 0xe
+#define GPMODE_POWER_PAGE 0x1a
+#define GPMODE_FAULT_FAIL_PAGE 0x1c
+#define GPMODE_TO_PROTECT_PAGE 0x1d
+#define GPMODE_CAPABILITIES_PAGE 0x2a
+#define GPMODE_ALL_PAGES 0x3f
+/* Not in Mt. Fuji, but in ATAPI 2.6 -- depricated now in favor
+ * of MODE_SENSE_POWER_PAGE */
+#define GPMODE_CDROM_PAGE 0x0d
+
+
+
+/* DVD struct types */
+#define DVD_STRUCT_PHYSICAL 0x00
+#define DVD_STRUCT_COPYRIGHT 0x01
+#define DVD_STRUCT_DISCKEY 0x02
+#define DVD_STRUCT_BCA 0x03
+#define DVD_STRUCT_MANUFACT 0x04
+
+struct dvd_layer {
+ __u8 book_version : 4;
+ __u8 book_type : 4;
+ __u8 min_rate : 4;
+ __u8 disc_size : 4;
+ __u8 layer_type : 4;
+ __u8 track_path : 1;
+ __u8 nlayers : 2;
+ __u8 track_density : 4;
+ __u8 linear_density : 4;
+ __u8 bca : 1;
+ __u8 start_sector;
+ __u8 end_sector;
+ __u8 end_sector_l0;
+};
+
+struct dvd_physical {
+ __u8 type;
+ __u8 layer_num;
+ struct dvd_layer layer[4];
+};
+
+struct dvd_copyright {
+ __u8 type;
+
+ __u8 layer_num;
+ __u8 cpst;
+ __u8 rmi;
+};
+
+struct dvd_disckey {
+ __u8 type;
+
+ unsigned agid : 2;
+ __u8 value[2048];
+};
+
+struct dvd_bca {
+ __u8 type;
+
+ int len;
+ __u8 value[188];
+};
+
+struct dvd_manufact {
+ __u8 type;
+
+ __u8 layer_num;
+ int len;
+ __u8 value[2048];
+};
+
+typedef union {
+ __u8 type;
+
+ struct dvd_physical physical;
+ struct dvd_copyright copyright;
+ struct dvd_disckey disckey;
+ struct dvd_bca bca;
+ struct dvd_manufact manufact;
+} dvd_struct;
+
+/*
+ * DVD authentication ioctl
+ */
+
+/* Authentication states */
+#define DVD_LU_SEND_AGID 0
+#define DVD_HOST_SEND_CHALLENGE 1
+#define DVD_LU_SEND_KEY1 2
+#define DVD_LU_SEND_CHALLENGE 3
+#define DVD_HOST_SEND_KEY2 4
+
+/* Termination states */
+#define DVD_AUTH_ESTABLISHED 5
+#define DVD_AUTH_FAILURE 6
+
+/* Other functions */
+#define DVD_LU_SEND_TITLE_KEY 7
+#define DVD_LU_SEND_ASF 8
+#define DVD_INVALIDATE_AGID 9
+
+/* State data */
+typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */
+typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */
+
+struct dvd_lu_send_agid {
+ __u8 type;
+ unsigned agid : 2;
+};
+
+struct dvd_host_send_challenge {
+ __u8 type;
+ unsigned agid : 2;
+
+ dvd_challenge chal;
+};
+
+struct dvd_send_key {
+ __u8 type;
+ unsigned agid : 2;
+
+ dvd_key key;
+};
+
+struct dvd_lu_send_challenge {
+ __u8 type;
+ unsigned agid : 2;
+
+ dvd_challenge chal;
+};
+
+#define DVD_CPM_NO_COPYRIGHT 0
+#define DVD_CPM_COPYRIGHTED 1
+
+#define DVD_CP_SEC_NONE 0
+#define DVD_CP_SEC_EXIST 1
+
+#define DVD_CGMS_UNRESTRICTED 0
+#define DVD_CGMS_SINGLE 2
+#define DVD_CGMS_RESTRICTED 3
+
+struct dvd_lu_send_title_key {
+ __u8 type;
+ unsigned agid : 2;
+
+ dvd_key title_key;
+ int lba;
+ unsigned cpm : 1;
+ unsigned cp_sec : 1;
+ unsigned cgms : 2;
+};
+
+struct dvd_lu_send_asf {
+ __u8 type;
+ unsigned agid : 2;
+
+ unsigned asf : 1;
+};
+
+typedef union {
+ __u8 type;
+
+ struct dvd_lu_send_agid lsa;
+ struct dvd_host_send_challenge hsc;
+ struct dvd_send_key lsk;
+ struct dvd_lu_send_challenge lsc;
+ struct dvd_send_key hsk;
+ struct dvd_lu_send_title_key lstk;
+ struct dvd_lu_send_asf lsasf;
+} dvd_authinfo;
+
#ifdef __KERNEL__
/* Uniform cdrom data structures for cdrom.c */
struct cdrom_device_info {
@@ -382,11 +666,13 @@ struct cdrom_device_info {
int speed; /* maximum speed for reading data */
int capacity; /* number of discs in jukebox */
/* device-related storage */
- int options : 30; /* options flags */
- unsigned mc_flags : 2; /* media change buffer flags */
+ int options : 30; /* options flags */
+ unsigned mc_flags : 2; /* media change buffer flags */
int use_count; /* number of times device opened */
char name[20]; /* name of the device type */
-
+/* per-device flags */
+ __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */
+ __u8 reserved : 6; /* not used yet */
};
struct cdrom_device_ops {
@@ -413,6 +699,9 @@ struct cdrom_device_ops {
/* driver specifications */
const int capability; /* capability flags */
int n_minors; /* number of active minor devices */
+ /* handle uniform packets for scsi type devices (scsi,atapi) */
+ int (*generic_packet) (struct cdrom_device_info *,
+ struct cdrom_generic_command *);
};
/* the general file operations structure: */
@@ -420,6 +709,7 @@ extern struct file_operations cdrom_fops;
extern int register_cdrom(struct cdrom_device_info *cdi);
extern int unregister_cdrom(struct cdrom_device_info *cdi);
+
typedef struct {
int data;
int audio;
@@ -427,7 +717,161 @@ typedef struct {
int xa;
long error;
} tracktype;
+
extern void cdrom_count_tracks(struct cdrom_device_info *cdi,tracktype* tracks);
+extern int cdrom_get_next_writable(kdev_t dev, long *next_writable);
+extern int cdrom_get_last_written(kdev_t dev, long *last_written);
+extern int cdrom_number_of_slots(struct cdrom_device_info *cdi);
+extern int cdrom_select_disc(struct cdrom_device_info *cdi, int slot);
+extern int cdrom_mode_select(struct cdrom_device_info *cdi,
+ struct cdrom_generic_command *cgc);
+extern int cdrom_mode_sense(struct cdrom_device_info *cdi,
+ struct cdrom_generic_command *cgc,
+ int page_code, int page_control);
+extern void init_cdrom_command(struct cdrom_generic_command *cgc,
+ void *buffer, int len);
+
+typedef struct {
+ __u16 disc_information_length;
+#if defined(__BIG_ENDIAN_BITFIELD)
+ __u8 reserved1 : 3;
+ __u8 erasable : 1;
+ __u8 border_status : 2;
+ __u8 disc_border : 2;
+#elif defined(__LITTLE_ENDIAN_BITFIELD)
+ __u8 disc_border : 2;
+ __u8 border_status : 2;
+ __u8 erasable : 1;
+ __u8 reserved1 : 3;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ __u8 n_first_track;
+ __u8 n_sessions_lsb;
+ __u8 first_track_lsb;
+ __u8 last_track_lsb;
+#if defined(__BIG_ENDIAN_BITFIELD)
+ __u8 did_v : 1;
+ __u8 dbc_v : 1;
+ __u8 uru : 1;
+ __u8 reserved2 : 5;
+#elif defined(__LITTLE_ENDIAN_BITFIELD)
+ __u8 reserved2 : 5;
+ __u8 uru : 1;
+ __u8 dbc_v : 1;
+ __u8 did_v : 1;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ __u8 disc_type;
+ __u8 n_sessions_msb;
+ __u8 first_track_msb;
+ __u8 last_track_msb;
+ __u32 disc_id;
+ __u32 lead_in;
+ __u32 lead_out;
+ __u8 disc_bar_code[8];
+ __u8 reserved3;
+ __u8 n_opc;
+} disc_information;
+
+typedef struct {
+ __u16 track_information_length;
+ __u8 track_lsb;
+ __u8 session_lsb;
+ __u8 reserved1;
+#if defined(__BIG_ENDIAN_BITFIELD)
+ __u8 reserved2 : 2;
+ __u8 damage : 1;
+ __u8 copy : 1;
+ __u8 track_mode : 4;
+ __u8 rt : 1;
+ __u8 blank : 1;
+ __u8 packet : 1;
+ __u8 fp : 1;
+ __u8 data_mode : 4;
+ __u8 reserved3 : 6;
+ __u8 lra_v : 1;
+ __u8 nwa_v : 1;
+#elif defined(__LITTLE_ENDIAN_BITFIELD)
+ __u8 track_mode : 4;
+ __u8 copy : 1;
+ __u8 damage : 1;
+ __u8 reserved2 : 2;
+ __u8 data_mode : 4;
+ __u8 fp : 1;
+ __u8 packet : 1;
+ __u8 blank : 1;
+ __u8 rt : 1;
+ __u8 nwa_v : 1;
+ __u8 lra_v : 1;
+ __u8 reserved3 : 6;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ __u32 track_start;
+ __u32 next_writable;
+ __u32 free_blocks;
+ __u32 fixed_packet_size;
+ __u32 track_size;
+ __u32 last_rec_address;
+} track_information;
+
+/* The SCSI spec says there could be 256 slots. */
+#define CDROM_MAX_SLOTS 256
+
+struct cdrom_mechstat_header {
+#if defined(__BIG_ENDIAN_BITFIELD)
+ __u8 fault : 1;
+ __u8 changer_state : 2;
+ __u8 curslot : 5;
+ __u8 mech_state : 3;
+ __u8 door_open : 1;
+ __u8 reserved1 : 4;
+#elif defined(__LITTLE_ENDIAN_BITFIELD)
+ __u8 curslot : 5;
+ __u8 changer_state : 2;
+ __u8 fault : 1;
+ __u8 reserved1 : 4;
+ __u8 door_open : 1;
+ __u8 mech_state : 3;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ __u8 curlba[3];
+ __u8 nslots;
+ __u8 short slot_tablelen;
+};
+
+
+struct cdrom_slot {
+#if defined(__BIG_ENDIAN_BITFIELD)
+ __u8 disc_present : 1;
+ __u8 reserved1 : 6;
+ __u8 change : 1;
+#elif defined(__LITTLE_ENDIAN_BITFIELD)
+ __u8 change : 1;
+ __u8 reserved1 : 6;
+ __u8 disc_present : 1;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
+ __u8 reserved2[3];
+};
+
+struct cdrom_changer_info {
+ struct cdrom_mechstat_header hdr;
+ struct cdrom_slot slots[CDROM_MAX_SLOTS];
+};
+
+typedef enum {
+ mechtype_caddy = 0,
+ mechtype_tray = 1,
+ mechtype_popup = 2,
+ mechtype_individual_changer = 4,
+ mechtype_cartridge_changer = 5
+} mechtype_t;
+
#endif /* End of kernel only stuff */
#endif /* _LINUX_CDROM_H */
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 82ace8e27..cd0e46cea 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -113,10 +113,10 @@ void coda_sysctl_clean(void);
do { \
if (size < 3000) { \
ptr = (cast)kmalloc((unsigned long) size, GFP_KERNEL); \
- CDEBUG(D_MALLOC, "kmalloced: %x at %x.\n", (int) size, (int) ptr);\
+ CDEBUG(D_MALLOC, "kmalloced: %lx at %p.\n", (long)size, ptr);\
} else { \
ptr = (cast)vmalloc((unsigned long) size); \
- CDEBUG(D_MALLOC, "vmalloced: %x at %x.\n", (int) size, (int) ptr);}\
+ CDEBUG(D_MALLOC, "vmalloced: %lx at %p .\n", (long)size, ptr);}\
if (ptr == 0) { \
printk("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \
} \
@@ -124,7 +124,7 @@ do { \
} while (0)
-#define CODA_FREE(ptr,size) do {if (size < 3000) { kfree_s((ptr), (size)); CDEBUG(D_MALLOC, "kfreed: %x at %x.\n", (int) size, (int) ptr); } else { vfree((ptr)); CDEBUG(D_MALLOC, "vfreed: %x at %x.\n", (int) size, (int) ptr);} } while (0)
+#define CODA_FREE(ptr,size) do {if (size < 3000) { kfree_s((ptr), (size)); CDEBUG(D_MALLOC, "kfreed: %lx at %p.\n", (long) size, ptr); } else { vfree((ptr)); CDEBUG(D_MALLOC, "vfreed: %lx at %p.\n", (long) size, ptr);} } while (0)
/* inode to cnode */
diff --git a/include/linux/comstats.h b/include/linux/comstats.h
index 066888599..84ef9b2b0 100644
--- a/include/linux/comstats.h
+++ b/include/linux/comstats.h
@@ -4,7 +4,7 @@
* comstats.h -- Serial Port Stats.
*
* Copyright (C) 1996-1998 Stallion Technologies (support@stallion.oz.au).
- * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au).
+ * Copyright (C) 1994-1996 Greg Ungerer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/include/linux/concap.h b/include/linux/concap.h
index 05f74d820..a0743ec14 100644
--- a/include/linux/concap.h
+++ b/include/linux/concap.h
@@ -1,10 +1,11 @@
-/* $Id: concap.h,v 1.1 1998/02/01 00:15:11 keil Exp $
+/* $Id: concap.h,v 1.2 1999/08/23 15:54:21 keil Exp $
*/
#ifndef _LINUX_CONCAP_H
#define _LINUX_CONCAP_H
#ifdef __KERNEL__
#include <linux/skbuff.h>
#include <linux/netdevice.h>
+#include <linux/isdn_compat.h>
/* Stuff to support encapsulation protocols genericly. The encapsulation
protocol is processed at the uppermost layer of the network interface.
@@ -25,11 +26,11 @@ struct concap_device_ops;
/* this manages all data needed by the encapsulation protocol
*/
struct concap_proto{
- struct device *net_dev; /* net device using our service */
- struct concap_device_ops *dops; /* callbacks provided by device */
- struct concap_proto_ops *pops; /* callbacks provided by us */
+ struct net_device *net_dev; /* net device using our service */
+ struct concap_device_ops *dops; /* callbacks provided by device */
+ struct concap_proto_ops *pops; /* callbacks provided by us */
int flags;
- void *proto_data; /* protocol specific private data, to
+ void *proto_data; /* protocol specific private data, to
be accessed via *pops methods only*/
/*
:
@@ -72,7 +73,7 @@ struct concap_proto_ops{
or when the device driver resets the interface. All services of the
encapsulation protocol may be used after this*/
int (*restart)(struct concap_proto *cprot,
- struct device *ndev,
+ struct net_device *ndev,
struct concap_device_ops *dops);
/* inactivate an encapsulation protocol instance. The encapsulation
@@ -107,7 +108,3 @@ extern int concap_nop(struct concap_proto *cprot);
extern int concap_drop_skb(struct concap_proto *cprot, struct sk_buff *skb);
#endif
#endif
-
-
-
-
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index c1c79c96e..768e815c6 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -1,9 +1,9 @@
/* $Revision: 2.6 $$Date: 1998/08/10 16:57:01 $
* linux/include/linux/cyclades.h
*
- * This file is maintained by Ivan Passos <ivan@cyclades.com>,
- * Marcio Saito <marcio@cyclades.com> and
- * Randolph Bentson <bentson@grieg.seaslug.org>.
+ * This file was initially written by
+ * Randolph Bentson <bentson@grieg.seaslug.org> and is maintained by
+ * Ivan Passos <ivan@cyclades.com>.
*
* This file contains the general definitions for the cyclades.c driver
*$Log: cyclades.h,v $
@@ -317,6 +317,7 @@ struct FIRM_ID {
#define C_IN_RXOFL 0x00010000 /* RX buffer overflow */
#define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */
#define C_IN_MRTS 0x00040000 /* modem RTS drop */
+#define C_IN_ICHAR 0x00080000
/* flow control */
@@ -373,6 +374,8 @@ struct FIRM_ID {
#define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */
#define C_CM_RXHIWM 0x62 /* Rx buffer high water mark */
#define C_CM_RXNNDT 0x63 /* rx no new data timeout */
+#define C_CM_TXFEMPTY 0x64
+#define C_CM_ICHAR 0x65
#define C_CM_MDCD 0x70 /* modem DCD change */
#define C_CM_MDSR 0x71 /* modem DSR change */
#define C_CM_MRI 0x72 /* modem RI change */
@@ -410,6 +413,8 @@ struct CH_CTRL {
uclong hw_overflow; /* hw overflow counter */
uclong sw_overflow; /* sw overflow counter */
uclong comm_error; /* frame/parity error counter */
+ uclong ichar;
+ uclong filler[7];
};
@@ -490,7 +495,25 @@ struct ZFW_CTRL {
/****************** ****************** *******************/
#endif
+/* Per card data structure */
+struct cyclades_card {
+ long base_addr;
+ long ctl_addr;
+ int irq;
+ int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
+ int first_line; /* minor number of first channel on card */
+ int bus_index; /* address shift - 0 for ISA, 1 for PCI */
+ int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */
+#ifdef __KERNEL__
+ spinlock_t card_lock;
+#else
+ uclong filler;
+#endif
+};
+struct cyclades_chip {
+ int filler;
+};
#ifdef __KERNEL__
@@ -508,20 +531,13 @@ struct ZFW_CTRL {
#define cy_readw(port) readw(port)
#define cy_readl(port) readl(port)
-/* Per card data structure */
-
-struct cyclades_card {
- long base_addr;
- long ctl_addr;
- int irq;
- int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
- int first_line; /* minor number of first channel on card */
- int bus_index; /* address shift - 0 for ISA, 1 for PCI */
- int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */
-};
-
-struct cyclades_chip {
- int filler;
+/*
+ * Statistics counters
+ */
+struct cyclades_icount {
+ __u32 cts, dsr, rng, dcd, tx, rx;
+ __u32 frame, parity, overrun, brk;
+ __u32 buf_overrun;
};
/*
@@ -568,16 +584,18 @@ struct cyclades_port {
int xmit_cnt;
int default_threshold;
int default_timeout;
- struct tq_struct tqueue;
- struct termios normal_termios;
- struct termios callout_termios;
- wait_queue_head_t open_wait;
- wait_queue_head_t close_wait;
- wait_queue_head_t shutdown_wait;
- struct cyclades_monitor mon;
unsigned long jiffies[3];
unsigned long rflush_count;
- struct cyclades_idle_stats idle_stats;
+ struct termios normal_termios;
+ struct termios callout_termios;
+ struct cyclades_monitor mon;
+ struct cyclades_idle_stats idle_stats;
+ struct cyclades_icount icount;
+ struct tq_struct tqueue;
+ wait_queue_head_t open_wait;
+ wait_queue_head_t close_wait;
+ wait_queue_head_t shutdown_wait;
+ wait_queue_head_t delta_msr_wait;
};
/*
@@ -590,6 +608,8 @@ struct cyclades_port {
#define Cy_EVENT_BREAK 3
#define Cy_EVENT_OPEN_WAKEUP 4
#define Cy_EVENT_SHUTDOWN_WAKEUP 5
+#define Cy_EVENT_DELTA_WAKEUP 6
+#define Cy_EVENT_Z_RX_FULL 7
#define CLOSING_WAIT_DELAY 30*HZ
#define CY_CLOSING_WAIT_NONE 65535
@@ -768,6 +788,7 @@ struct cyclades_port {
#define CyRTPR (0x21*2)
#define CyMSVR1 (0x6C*2)
#define CyMSVR2 (0x6D*2)
+#define CyANY_DELTA (0xF0)
#define CyDSR (0x80)
#define CyCTS (0x40)
#define CyRI (0x20)
diff --git a/include/linux/cyclomx.h b/include/linux/cyclomx.h
index aaf4a917d..d94e45b41 100644
--- a/include/linux/cyclomx.h
+++ b/include/linux/cyclomx.h
@@ -23,7 +23,7 @@
#include <linux/config.h>
#include <linux/wanrouter.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#ifdef __KERNEL__
/* Kernel Interface */
@@ -56,8 +56,7 @@ typedef struct cycx {
spinlock_t lock;
char in_isr; /* interrupt-in-service flag */
char buff_int_mode_unbusy; /* flag for carrying out dev_tint */
- u16 irq_dis_if_send_count; /* Disabling irqs in if_send*/
-#if LINUX_VERSION_CODE >= 0x020300
+#if (LINUX_VERSION_CODE >= 0x20300)
wait_queue_head_t wait_stats; /* to wait for the STATS indication */
#else
struct wait_queue* wait_stats; /* to wait for the STATS indication */
@@ -73,7 +72,7 @@ typedef struct cycx {
u32 lo_svc;
u32 hi_svc;
TX25Stats stats;
- unsigned critical; /* critical section flag */
+ spinlock_t lock;
u32 connection_keys;
} x;
#endif
@@ -81,12 +80,12 @@ typedef struct cycx {
} cycx_t;
/* Public Functions */
-void cyclomx_open (cycx_t* card); /* cycx_main.c */
-void cyclomx_close (cycx_t* card); /* cycx_main.c */
-void cyclomx_set_state (cycx_t* card, int state); /* cycx_main.c */
+void cyclomx_open (cycx_t *card); /* cycx_main.c */
+void cyclomx_close (cycx_t *card); /* cycx_main.c */
+void cyclomx_set_state (cycx_t *card, int state); /* cycx_main.c */
#ifdef CONFIG_CYCLOMX_X25
-int cyx_init (cycx_t* card, wandev_conf_t* conf); /* cycx_x25.c */
+int cyx_init (cycx_t *card, wandev_conf_t *conf); /* cycx_x25.c */
#endif
#endif /* __KERNEL__ */
#endif /* _CYCLOMX_H */
diff --git a/include/linux/cycx_drv.h b/include/linux/cycx_drv.h
index 3448b9066..ebbe91850 100644
--- a/include/linux/cycx_drv.h
+++ b/include/linux/cycx_drv.h
@@ -54,13 +54,11 @@ typedef struct cycxhw {
} cycxhw_t;
/* Function Prototypes */
-extern int cycx_setup (cycxhw_t* hw, void* sfm, u32 len);
-extern int cycx_down (cycxhw_t* hw);
-extern int cycx_inten (cycxhw_t* hw);
-extern int cycx_intde (cycxhw_t* hw);
-extern int cycx_intack (cycxhw_t* hw);
-extern int cycx_intr (cycxhw_t* hw);
-extern int cycx_peek (cycxhw_t* hw, u32 addr, void* buf, u32 len);
-extern int cycx_poke (cycxhw_t* hw, u32 addr, void* buf, u32 len);
-extern int cycx_exec (u32 addr);
+extern int cycx_setup (cycxhw_t *hw, void *sfm, u32 len);
+extern int cycx_down (cycxhw_t *hw);
+extern int cycx_inten (cycxhw_t *hw);
+extern int cycx_intr (cycxhw_t *hw);
+extern int cycx_peek (cycxhw_t *hw, u32 addr, void *buf, u32 len);
+extern int cycx_poke (cycxhw_t *hw, u32 addr, void *buf, u32 len);
+extern int cycx_exec (u32 addr);
#endif /* _CYCX_DRV_H */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 8e88496a6..a1625640f 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -20,15 +20,15 @@ typedef __s64 Elf64_Sword;
typedef __u64 Elf64_Word;
/* These constants are for the segment types stored in the image headers */
-#define PT_NULL 0
-#define PT_LOAD 1
-#define PT_DYNAMIC 2
-#define PT_INTERP 3
-#define PT_NOTE 4
-#define PT_SHLIB 5
-#define PT_PHDR 6
-#define PT_LOPROC 0x70000000
-#define PT_HIPROC 0x7fffffff
+#define PT_NULL 0
+#define PT_LOAD 1
+#define PT_DYNAMIC 2
+#define PT_INTERP 3
+#define PT_NOTE 4
+#define PT_SHLIB 5
+#define PT_PHDR 6
+#define PT_LOPROC 0x70000000
+#define PT_HIPROC 0x7fffffff
#define PT_MIPS_REGINFO 0x70000000
/* Flags in the e_flags field of the header */
@@ -47,27 +47,24 @@ typedef __u64 Elf64_Word;
#define ET_HIPROC 0xffff
/* These constants define the various ELF target machines */
-#define EM_NONE 0
-#define EM_M32 1
-#define EM_SPARC 2
-#define EM_386 3
-#define EM_68K 4
-#define EM_88K 5
-#define EM_486 6 /* Perhaps disused */
-#define EM_860 7
-
-#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
-
+#define EM_NONE 0
+#define EM_M32 1
+#define EM_SPARC 2
+#define EM_386 3
+#define EM_68K 4
+#define EM_88K 5
+#define EM_486 6 /* Perhaps disused */
+#define EM_860 7
+#define EM_MIPS 8 /* MIPS R3000 (officially, big-endian only) */
#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
-
#define EM_PARISC 15 /* HPPA */
-
#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
-
#define EM_PPC 20 /* PowerPC */
-
#define EM_SPARCV9 43 /* SPARC v9 64-bit */
+
+#define EM_IA_64 50 /* HP/Intel IA-64 */
+
/*
* This is an interim value that we will use until the committee comes
* up with a final number.
@@ -76,32 +73,32 @@ typedef __u64 Elf64_Word;
/* This is the info that is needed to parse the dynamic section of the file */
-#define DT_NULL 0
-#define DT_NEEDED 1
-#define DT_PLTRELSZ 2
-#define DT_PLTGOT 3
-#define DT_HASH 4
-#define DT_STRTAB 5
-#define DT_SYMTAB 6
-#define DT_RELA 7
-#define DT_RELASZ 8
-#define DT_RELAENT 9
-#define DT_STRSZ 10
-#define DT_SYMENT 11
-#define DT_INIT 12
-#define DT_FINI 13
-#define DT_SONAME 14
-#define DT_RPATH 15
-#define DT_SYMBOLIC 16
-#define DT_REL 17
-#define DT_RELSZ 18
-#define DT_RELENT 19
-#define DT_PLTREL 20
-#define DT_DEBUG 21
-#define DT_TEXTREL 22
-#define DT_JMPREL 23
-#define DT_LOPROC 0x70000000
-#define DT_HIPROC 0x7fffffff
+#define DT_NULL 0
+#define DT_NEEDED 1
+#define DT_PLTRELSZ 2
+#define DT_PLTGOT 3
+#define DT_HASH 4
+#define DT_STRTAB 5
+#define DT_SYMTAB 6
+#define DT_RELA 7
+#define DT_RELASZ 8
+#define DT_RELAENT 9
+#define DT_STRSZ 10
+#define DT_SYMENT 11
+#define DT_INIT 12
+#define DT_FINI 13
+#define DT_SONAME 14
+#define DT_RPATH 15
+#define DT_SYMBOLIC 16
+#define DT_REL 17
+#define DT_RELSZ 18
+#define DT_RELENT 19
+#define DT_PLTREL 20
+#define DT_DEBUG 21
+#define DT_TEXTREL 22
+#define DT_JMPREL 23
+#define DT_LOPROC 0x70000000
+#define DT_HIPROC 0x7fffffff
#define DT_MIPS_RLD_VERSION 0x70000001
#define DT_MIPS_TIME_STAMP 0x70000002
#define DT_MIPS_ICHECKSUM 0x70000003
@@ -176,18 +173,18 @@ typedef struct {
#define ELF32_R_SYM(x) ((x) >> 8)
#define ELF32_R_TYPE(x) ((x) & 0xff)
-#define R_386_NONE 0
-#define R_386_32 1
-#define R_386_PC32 2
-#define R_386_GOT32 3
-#define R_386_PLT32 4
-#define R_386_COPY 5
-#define R_386_GLOB_DAT 6
-#define R_386_JMP_SLOT 7
-#define R_386_RELATIVE 8
-#define R_386_GOTOFF 9
-#define R_386_GOTPC 10
-#define R_386_NUM 11
+#define R_386_NONE 0
+#define R_386_32 1
+#define R_386_PC32 2
+#define R_386_GOT32 3
+#define R_386_PLT32 4
+#define R_386_COPY 5
+#define R_386_GLOB_DAT 6
+#define R_386_JMP_SLOT 7
+#define R_386_RELATIVE 8
+#define R_386_GOTOFF 9
+#define R_386_GOTPC 10
+#define R_386_NUM 11
#define R_MIPS_NONE 0
#define R_MIPS_16 1
@@ -458,23 +455,23 @@ typedef struct elf64_phdr {
} Elf64_Phdr;
/* sh_type */
-#define SHT_NULL 0
-#define SHT_PROGBITS 1
-#define SHT_SYMTAB 2
-#define SHT_STRTAB 3
-#define SHT_RELA 4
-#define SHT_HASH 5
-#define SHT_DYNAMIC 6
-#define SHT_NOTE 7
-#define SHT_NOBITS 8
-#define SHT_REL 9
-#define SHT_SHLIB 10
-#define SHT_DYNSYM 11
-#define SHT_NUM 12
-#define SHT_LOPROC 0x70000000
-#define SHT_HIPROC 0x7fffffff
-#define SHT_LOUSER 0x80000000
-#define SHT_HIUSER 0xffffffff
+#define SHT_NULL 0
+#define SHT_PROGBITS 1
+#define SHT_SYMTAB 2
+#define SHT_STRTAB 3
+#define SHT_RELA 4
+#define SHT_HASH 5
+#define SHT_DYNAMIC 6
+#define SHT_NOTE 7
+#define SHT_NOBITS 8
+#define SHT_REL 9
+#define SHT_SHLIB 10
+#define SHT_DYNSYM 11
+#define SHT_NUM 12
+#define SHT_LOPROC 0x70000000
+#define SHT_HIPROC 0x7fffffff
+#define SHT_LOUSER 0x80000000
+#define SHT_HIUSER 0xffffffff
#define SHT_MIPS_LIST 0x70000000
#define SHT_MIPS_CONFLICT 0x70000002
#define SHT_MIPS_GPTAB 0x70000003
@@ -488,13 +485,13 @@ typedef struct elf64_phdr {
#define SHF_MIPS_GPREL 0x10000000
/* special section indexes */
-#define SHN_UNDEF 0
-#define SHN_LORESERVE 0xff00
-#define SHN_LOPROC 0xff00
-#define SHN_HIPROC 0xff1f
-#define SHN_ABS 0xfff1
-#define SHN_COMMON 0xfff2
-#define SHN_HIRESERVE 0xffff
+#define SHN_UNDEF 0
+#define SHN_LORESERVE 0xff00
+#define SHN_LOPROC 0xff00
+#define SHN_HIPROC 0xff1f
+#define SHN_ABS 0xfff1
+#define SHN_COMMON 0xfff2
+#define SHN_HIRESERVE 0xffff
#define SHN_MIPS_ACCOMON 0xff00
typedef struct {
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 9101855c5..56ace40e0 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -28,18 +28,18 @@
#include <linux/if_ether.h>
#ifdef __KERNEL__
-extern int eth_header(struct sk_buff *skb, struct device *dev,
+extern int eth_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, void *daddr,
void *saddr, unsigned len);
extern int eth_rebuild_header(struct sk_buff *skb);
-extern unsigned short eth_type_trans(struct sk_buff *skb, struct device *dev);
-extern void eth_header_cache_update(struct hh_cache *hh, struct device *dev,
+extern unsigned short eth_type_trans(struct sk_buff *skb, struct net_device *dev);
+extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
unsigned char * haddr);
extern int eth_header_cache(struct neighbour *neigh,
struct hh_cache *hh);
extern int eth_header_parse(struct sk_buff *skb,
unsigned char *haddr);
-extern struct device * init_etherdev(struct device *, int);
+extern struct net_device * init_etherdev(struct net_device *, int);
#ifdef CONFIG_IP_ROUTER
static __inline__ void eth_copy_and_sum (struct sk_buff *dest, unsigned char *src, int len, int base)
diff --git a/include/linux/fat_cvf.h b/include/linux/fat_cvf.h
index 1c4df58f6..6349e45cf 100644
--- a/include/linux/fat_cvf.h
+++ b/include/linux/fat_cvf.h
@@ -27,7 +27,6 @@ struct cvf_format
int (*fat_access) (struct super_block *sb,int nr,int new_value);
int (*cvf_statfs) (struct super_block *sb,struct statfs *buf, int bufsiz);
int (*cvf_bmap) (struct inode *inode,int block);
- int (*cvf_smap) (struct inode *inode,int sector);
ssize_t (*cvf_file_read) ( struct file *, char *, size_t, loff_t *);
ssize_t (*cvf_file_write) ( struct file *, const char *, size_t, loff_t *);
int (*cvf_mmap) (struct file *, struct vm_area_struct *);
diff --git a/include/linux/fb.h b/include/linux/fb.h
index f084ca036..f7a7e2b64 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -39,6 +39,10 @@
#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */
#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */
+#define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */
+#define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */
+#define FB_AUX_VGA_PLANES_CFB8 2 /* CFB8 in planes (VGA) */
+
#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */
#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */
#define FB_VISUAL_TRUECOLOR 2 /* True color */
@@ -69,13 +73,17 @@
#define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */
#define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */
#define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */
-#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */
-#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */
-#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */
+#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */
+#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */
+#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */
+#define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */
+#define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */
+#define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */
+#define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */
struct fb_fix_screeninfo {
char id[16]; /* identification string eg "TT Builtin" */
- char *smem_start; /* Start of frame buffer mem */
+ unsigned long smem_start; /* Start of frame buffer mem */
/* (physical address) */
__u32 smem_len; /* Length of frame buffer mem */
__u32 type; /* see FB_TYPE_* */
@@ -85,7 +93,7 @@ struct fb_fix_screeninfo {
__u16 ypanstep; /* zero if no hardware panning */
__u16 ywrapstep; /* zero if no hardware ywrap */
__u32 line_length; /* length of a line in bytes */
- char *mmio_start; /* Start of Memory Mapped I/O */
+ unsigned long mmio_start; /* Start of Memory Mapped I/O */
/* (physical address) */
__u32 mmio_len; /* Length of Memory Mapped I/O */
__u32 accel; /* Type of acceleration available */
@@ -199,6 +207,7 @@ struct fb_monspecs {
#ifdef __KERNEL__
#include <linux/fs.h>
+#include <linux/init.h>
struct fb_info;
@@ -395,12 +404,6 @@ extern int fbgen_switch(int con, struct fb_info *info);
extern void fbgen_blank(int blank, struct fb_info *info);
-struct fb_videomode {
- const char *name;
- struct fb_var_screeninfo var;
-};
-
-
/* drivers/char/fbmem.c */
extern int register_framebuffer(struct fb_info *fb_info);
extern int unregister_framebuffer(const struct fb_info *fb_info);
@@ -437,6 +440,30 @@ extern void fb_invert_cmaps(void);
#define VESA_HSYNC_SUSPEND 2
#define VESA_POWERDOWN 3
+
+struct fb_videomode {
+ const char *name; /* optional */
+ u32 refresh; /* optional */
+ u32 xres;
+ u32 yres;
+ u32 pixclock;
+ u32 left_margin;
+ u32 right_margin;
+ u32 upper_margin;
+ u32 lower_margin;
+ u32 hsync_len;
+ u32 vsync_len;
+ u32 sync;
+ u32 vmode;
+};
+
+extern int __init fb_find_mode(struct fb_var_screeninfo *var,
+ struct fb_info *info, const char *mode_option,
+ const struct fb_videomode *db,
+ unsigned int dbsize,
+ const struct fb_videomode *default_mode,
+ unsigned int default_bpp);
+
#endif /* __KERNEL__ */
#if 1
diff --git a/include/linux/fcdevice.h b/include/linux/fcdevice.h
new file mode 100644
index 000000000..c63d03bc1
--- /dev/null
+++ b/include/linux/fcdevice.h
@@ -0,0 +1,40 @@
+/*
+ * INET An implementation of the TCP/IP protocol suite for the LINUX
+ * operating system. NET is implemented using the BSD Socket
+ * interface as the means of communication with the user level.
+ *
+ * Definitions for the Fibre Channel handlers.
+ *
+ * Version: @(#)fcdevice.h 1.0.0 09/26/98
+ *
+ * Authors: Vineet Abraham <vma@iol.unh.edu>
+ *
+ * Relocated to include/linux where it belongs by Alan Cox
+ * <gw4pts@gw4pts.ampr.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * WARNING: This move may well be temporary. This file will get merged with others RSN.
+ *
+ */
+#ifndef _LINUX_FCDEVICE_H
+#define _LINUX_FCDEVICE_H
+
+
+#include <linux/if_fc.h>
+
+#ifdef __KERNEL__
+extern int fc_header(struct sk_buff *skb, struct net_device *dev,
+ unsigned short type, void *daddr,
+ void *saddr, unsigned len);
+extern int fc_rebuild_header(struct sk_buff *skb);
+//extern unsigned short fc_type_trans(struct sk_buff *skb, struct net_device *dev);
+
+extern struct net_device * init_fcdev(struct net_device *, int);
+
+#endif
+
+#endif /* _LINUX_FCDEVICE_H */
diff --git a/include/linux/fd.h b/include/linux/fd.h
index dc8439540..c0ed2792b 100644
--- a/include/linux/fd.h
+++ b/include/linux/fd.h
@@ -216,7 +216,7 @@ struct floppy_drive_struct {
/* Prevent "aliased" accesses. */
int fd_ref;
int fd_device;
- int last_checked; /* when was the drive last checked for a disk
+ unsigned long last_checked; /* when was the drive last checked for a disk
* change? */
char *dmabuf;
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h
index a093ccf71..8821bbdb1 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -26,14 +26,14 @@
#ifdef __KERNEL__
extern int fddi_header(struct sk_buff *skb,
- struct device *dev,
+ struct net_device *dev,
unsigned short type,
void *daddr,
void *saddr,
unsigned len);
extern int fddi_rebuild_header(struct sk_buff *skb);
extern unsigned short fddi_type_trans(struct sk_buff *skb,
- struct device *dev);
+ struct net_device *dev);
#endif
#endif /* _LINUX_FDDIDEVICE_H */
diff --git a/include/linux/file.h b/include/linux/file.h
index 1bdd56a0c..1a11904b6 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -5,7 +5,6 @@
#ifndef __LINUX_FILE_H
#define __LINUX_FILE_H
-extern void __fput(struct file *); /* goner? */
extern void _fput(struct file *);
/*
@@ -57,18 +56,6 @@ extern inline struct file * fget(unsigned int fd)
}
/*
- * Install a file pointer in the fd array.
- */
-extern inline void fd_install(unsigned int fd, struct file * file)
-{
- struct files_struct *files = current->files;
-
- write_lock(&files->file_lock);
- files->fd[fd] = file;
- write_unlock(&files->file_lock);
-}
-
-/*
* 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>:
*
* Since those functions where calling other functions, it was compleatly
@@ -91,4 +78,26 @@ extern inline void fput(struct file * file)
}
extern void put_filp(struct file *);
+/*
+ * Install a file pointer in the fd array.
+ *
+ * The VFS is full of places where we drop the files lock between
+ * setting the open_fds bitmap and installing the file in the file
+ * array. At any such point, we are vulnerable to a dup2() race
+ * installing a file in the array before us. We need to detect this and
+ * fput() the struct file we are about to overwrite in this case.
+ */
+
+extern inline void fd_install(unsigned int fd, struct file * file)
+{
+ struct files_struct *files = current->files;
+ struct file * result;
+
+ write_lock(&files->file_lock);
+ result = xchg(&files->fd[fd], file);
+ write_unlock(&files->file_lock);
+ if (result)
+ fput(result);
+}
+
#endif /* __LINUX_FILE_H */
diff --git a/include/linux/firewall.h b/include/linux/firewall.h
deleted file mode 100644
index 1747f3811..000000000
--- a/include/linux/firewall.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef __LINUX_FIREWALL_H
-#define __LINUX_FIREWALL_H
-
-#include <linux/config.h>
-
-/*
- * Definitions for loadable firewall modules
- */
-
-#define FW_QUEUE 0
-#define FW_BLOCK 1
-#define FW_ACCEPT 2
-#define FW_REJECT (-1)
-#define FW_REDIRECT 3
-#define FW_MASQUERADE 4
-#define FW_SKIP 5
-
-struct firewall_ops
-{
- struct firewall_ops *next;
- int (*fw_forward)(struct firewall_ops *this, int pf,
- struct device *dev, void *phdr, void *arg, struct sk_buff **pskb);
- int (*fw_input)(struct firewall_ops *this, int pf,
- struct device *dev, void *phdr, void *arg, struct sk_buff **pskb);
- int (*fw_output)(struct firewall_ops *this, int pf,
- struct device *dev, void *phdr, void *arg, struct sk_buff **pskb);
- /* Data falling in the second 486 cache line isn't used directly
- during a firewall call and scan, only by insert/delete and other
- unusual cases
- */
- int fw_pf; /* Protocol family */
- int fw_priority; /* Priority of chosen firewalls */
-};
-
-#ifdef __KERNEL__
-extern int register_firewall(int pf, struct firewall_ops *fw);
-extern int unregister_firewall(int pf, struct firewall_ops *fw);
-extern void fwchain_init(void);
-#ifdef CONFIG_FIREWALL
-extern int call_fw_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **pskb);
-extern int call_in_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **pskb);
-extern int call_out_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **pskb);
-#else
-extern __inline__ int call_fw_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **skb)
-{
- return FW_ACCEPT;
-}
-
-extern __inline__ int call_in_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **skb)
-{
- return FW_ACCEPT;
-}
-
-extern __inline__ int call_out_firewall(int pf, struct device *dev, void *phdr, void *arg, struct sk_buff **skb)
-{
- return FW_ACCEPT;
-}
-
-#endif
-#endif
-#endif
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 07efcad85..8667c79db 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -27,17 +27,19 @@ struct poll_table_struct;
/*
- * It's silly to have NR_OPEN bigger than NR_FILE, but I'll fix
- * that later. Anyway, now the file code is no longer dependent
- * on bitmaps in unsigned longs, but uses the new fd_set structure..
+ * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
+ * the file limit at runtime and only root can increase the per-process
+ * nr_file rlimit, so it's safe to set up a ridiculously high absolute
+ * upper limit on files-per-process.
*
* Some programs (notably those using select()) may have to be
- * recompiled to take full advantage of the new limits..
+ * recompiled to take full advantage of the new limits..
*/
/* Fixed constants first: */
#undef NR_OPEN
-#define NR_OPEN 1024
+#define NR_OPEN (1024*1024) /* Absolute upper limit on fd num */
+#define INR_OPEN 1024 /* Initial setting for nfile rlimits */
#define BLOCK_SIZE_BITS 10
#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
@@ -61,7 +63,8 @@ extern int max_super_blocks, nr_super_blocks;
#define READ 0
#define WRITE 1
#define READA 2 /* read-ahead - don't block if no resources */
-#define WRITEA 3 /* write-ahead - don't block if no resources */
+
+#define WRITERAW 5 /* raw write - don't play with buffer lists */
#ifndef NULL
#define NULL ((void *) 0)
@@ -228,6 +231,7 @@ struct buffer_head {
unsigned long b_rsector; /* Real buffer location on disk */
wait_queue_head_t b_wait;
+ struct kiobuf * b_kiobuf; /* kiobuf which owns this IO */
};
typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
@@ -265,6 +269,7 @@ void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
#include <linux/hfs_fs_i.h>
#include <linux/adfs_fs_i.h>
#include <linux/qnx4_fs_i.h>
+#include <linux/udf_fs_i.h>
/*
* Attribute flags. These should be or-ed together to figure out what
@@ -376,7 +381,8 @@ struct inode {
struct smb_inode_info smbfs_i;
struct hfs_inode_info hfs_i;
struct adfs_inode_info adfs_i;
- struct qnx4_inode_info qnx4_i;
+ struct qnx4_inode_info qnx4_i;
+ struct udf_inode_info udf_i;
struct socket socket_i;
void *generic_ip;
} u;
@@ -506,6 +512,7 @@ extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
#include <linux/hfs_fs_sb.h>
#include <linux/adfs_fs_sb.h>
#include <linux/qnx4_fs_sb.h>
+#include <linux/udf_fs_sb.h>
extern struct list_head super_blocks;
@@ -550,6 +557,7 @@ struct super_block {
struct hfs_sb_info hfs_sb;
struct adfs_sb_info adfs_sb;
struct qnx4_sb_info qnx4_sb;
+ struct udf_sb_info udf_sb;
void *generic_sbp;
} u;
/*
@@ -702,8 +710,9 @@ extern inline int locks_verify_area(int read_write, struct inode *inode,
/* fs/open.c */
-asmlinkage int sys_open(const char *, int, int);
-asmlinkage int sys_close(unsigned int); /* yes, it's really unsigned */
+asmlinkage long sys_open(const char *, int, int);
+asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
+extern int do_close(unsigned int, int); /* yes, it's really unsigned */
extern int do_truncate(struct dentry *, unsigned long);
extern int get_unused_fd(void);
extern void put_unused_fd(unsigned int);
@@ -846,6 +855,25 @@ extern ino_t find_inode_number(struct dentry *, struct qstr *);
#define LOOKUP_SLASHOK (4)
#define LOOKUP_CONTINUE (8)
+/*
+ * "descriptor" for what we're up to with a read for sendfile().
+ * This allows us to use the same read code yet
+ * have multiple different users of the data that
+ * we read from a file.
+ *
+ * The simplest case just copies the data to user
+ * mode.
+ */
+typedef struct {
+ size_t written;
+ size_t count;
+ char * buf;
+ int error;
+} read_descriptor_t;
+
+typedef int (*read_actor_t)(read_descriptor_t *, const char *, unsigned long);
+
+
extern struct dentry * lookup_dentry(const char *, struct dentry *, unsigned int);
extern struct dentry * __namei(const char *, unsigned int);
@@ -893,11 +921,13 @@ typedef int (*writepage_t)(struct file *, struct page *, unsigned long, unsigned
extern int block_read_full_page(struct file *, struct page *);
extern int block_write_full_page (struct file *, struct page *);
extern int block_write_partial_page (struct file *, struct page *, unsigned long, unsigned long, const char *);
+extern int block_write_cont_page (struct file *, struct page *, unsigned long, unsigned long, const char *);
extern int block_flushpage(struct inode *, struct page *, unsigned long);
extern int generic_file_mmap(struct file *, struct vm_area_struct *);
extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *);
extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *, writepage_t);
+extern void do_generic_file_read(struct file * filp, loff_t *ppos, read_descriptor_t * desc, read_actor_t actor);
extern struct super_block *get_super(kdev_t);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 85bbf3422..be07a362e 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -12,20 +12,6 @@
#include <linux/config.h>
#include <linux/types.h>
-#define CONFIG_MSDOS_PARTITION 1
-
-#ifdef __alpha__
-#define CONFIG_OSF_PARTITION 1
-#endif
-
-#if defined(__sparc__) || defined(CONFIG_SMD_DISKLABEL)
-#define CONFIG_SUN_PARTITION 1
-#endif
-
-#if defined(CONFIG_SGI) || defined(CONFIG_SGI_DISKLABEL)
-#define CONFIG_SGI_PARTITION 1
-#endif
-
/* These three have identical behaviour; use the second one if DOS fdisk gets
confused about extended/logical partitions starting past cylinder 1023. */
#define DOS_EXTENDED_PARTITION 5
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index 11cd8c6a0..2c7e5db58 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -106,7 +106,7 @@ struct hdlcdrv_ioctl {
#include <linux/netdevice.h>
#include <linux/if.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#define HDLCDRV_MAGIC 0x5ac6e778
#define HDLCDRV_IFNAMELEN 6
@@ -173,9 +173,9 @@ struct hdlcdrv_ops {
/*
* the routines called by the hdlcdrv routines
*/
- int (*open)(struct device *);
- int (*close)(struct device *);
- int (*ioctl)(struct device *, struct ifreq *,
+ int (*open)(struct net_device *);
+ int (*close)(struct net_device *);
+ int (*ioctl)(struct net_device *, struct ifreq *,
struct hdlcdrv_ioctl *, int);
};
@@ -361,14 +361,14 @@ extern inline int hdlcdrv_ptt(struct hdlcdrv_state *s)
/* -------------------------------------------------------------------- */
-void hdlcdrv_receiver(struct device *, struct hdlcdrv_state *);
-void hdlcdrv_transmitter(struct device *, struct hdlcdrv_state *);
-void hdlcdrv_arbitrate(struct device *, struct hdlcdrv_state *);
-int hdlcdrv_register_hdlcdrv(struct device *dev, const struct hdlcdrv_ops *ops,
+void hdlcdrv_receiver(struct net_device *, struct hdlcdrv_state *);
+void hdlcdrv_transmitter(struct net_device *, struct hdlcdrv_state *);
+void hdlcdrv_arbitrate(struct net_device *, struct hdlcdrv_state *);
+int hdlcdrv_register_hdlcdrv(struct net_device *dev, const struct hdlcdrv_ops *ops,
unsigned int privsize, char *ifname,
unsigned int baseaddr, unsigned int irq,
unsigned int dma);
-int hdlcdrv_unregister_hdlcdrv(struct device *dev);
+int hdlcdrv_unregister_hdlcdrv(struct net_device *dev);
/* -------------------------------------------------------------------- */
diff --git a/include/linux/hfmodem.h b/include/linux/hfmodem.h
deleted file mode 100644
index d23108ee9..000000000
--- a/include/linux/hfmodem.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*****************************************************************************/
-
-/*
- * hfmodem.h -- Linux soundcard HF FSK driver.
- *
- * Copyright (C) 1997 Thomas Sailer (sailer@ife.ee.ethz.ch)
- * Swiss Federal Institute of Technology (ETH), Electronics Lab
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * This is the Linux realtime sound output driver
- */
-
-/*****************************************************************************/
-
-#ifndef _HFMODEM_H
-#define _HFMODEM_H
-/* --------------------------------------------------------------------- */
-
-#include <linux/version.h>
-
-#include <linux/ioctl.h>
-#include <linux/types.h>
-#include <linux/fs.h>
-#if LINUX_VERSION_CODE >= 0x20100
-#include <linux/poll.h>
-#endif
-
-/* --------------------------------------------------------------------- */
-
-#define HFMODEM_MINOR 145
-
-#define HFMODEM_SRATE 8000
-#define HFMODEM_MAXBITS 4800 /* required for GTOR 300 baud mode */
-#define HFMODEM_MINBAUD 40
-#define HFMODEM_MAXBAUD 400
-#define HFMODEM_MAXCORRLEN ((HFMODEM_SRATE+HFMODEM_MINBAUD-1)/HFMODEM_MINBAUD)
-
-/* --------------------------------------------------------------------- */
-
-typedef unsigned long hfmodem_time_t;
-typedef int hfmodem_soft_t;
-typedef unsigned long hfmodem_id_t;
-
-/* --------------------------------------------------------------------- */
-
-struct hfmodem_ioctl_fsk_tx_request {
- hfmodem_time_t tstart;
- hfmodem_time_t tinc;
- int inv;
- hfmodem_id_t id;
- unsigned int nbits;
- unsigned char *data;
- unsigned int freq[2];
-};
-
-struct hfmodem_ioctl_fsk_rx_request {
- hfmodem_time_t tstart;
- hfmodem_time_t tinc;
- unsigned int baud;
- hfmodem_id_t id;
- unsigned int nbits;
- hfmodem_soft_t *data;
- unsigned int freq[2];
-};
-
-struct hfmodem_ioctl_mixer_params {
- int src;
- int igain;
- int ogain;
-};
-
-struct hfmodem_ioctl_sample_params {
- __s16 *data;
- int len;
-};
-
-#define HFMODEM_IOCTL_FSKTXREQUEST _IOW('H', 0, struct hfmodem_ioctl_fsk_tx_request)
-#define HFMODEM_IOCTL_FSKRXREQUEST _IOW('H', 1, struct hfmodem_ioctl_fsk_rx_request)
-#define HFMODEM_IOCTL_CLEARRQ _IO('H', 3)
-#define HFMODEM_IOCTL_GETCURTIME _IOR('H', 4, hfmodem_time_t)
-#define HFMODEM_IOCTL_WAITRQ _IOR('H', 5, hfmodem_id_t)
-#define HFMODEM_IOCTL_MIXERPARAMS _IOW('H', 6, struct hfmodem_ioctl_mixer_params)
-#define HFMODEM_IOCTL_SAMPLESTART _IOW('H', 7, struct hfmodem_ioctl_sample_params)
-#define HFMODEM_IOCTL_SAMPLEFINISHED _IO('H', 8)
-
-/* --------------------------------------------------------------------- */
-#ifdef __KERNEL__
-
-#include <linux/parport.h>
-
-#define DMA_MODE_AUTOINIT 0x10
-
-#define NR_DEVICE 1
-
-#define HFMODEM_FRAGSAMPLES (HFMODEM_SRATE/100)
-#define HFMODEM_FRAGSIZE (HFMODEM_FRAGSAMPLES*2)
-#define HFMODEM_NUMFRAGS 8
-#define HFMODEM_EXCESSFRAGS 3
-
-#define HFMODEM_NUMRXSLOTS 20
-#define HFMODEM_NUMTXSLOTS 4
-
-#define HFMODEM_CORRELATOR_CACHE 8
-
-enum slot_st { ss_unused = 0, ss_ready, ss_oper, ss_retired };
-typedef int hfmodem_conv_t;
-
-struct hfmodem_state {
- const struct hfmodem_scops *scops;
-
- /* io params */
- struct {
- unsigned int base_addr;
- unsigned int dma;
- unsigned int irq;
- } io;
-
- struct {
- unsigned int seriobase;
- unsigned int pariobase;
- unsigned int midiiobase;
- unsigned int flags;
- struct pardevice *pardev;
- } ptt_out;
-
- struct {
- __s16 *buf;
- unsigned int lastfrag;
- unsigned int fragptr;
- unsigned int last_dmaptr;
- int ptt_frames;
- } dma;
-
- struct {
- unsigned int last_tvusec;
- unsigned long long time_cnt;
- hfmodem_time_t lasttime;
-#ifdef __i386__
- unsigned int starttime_lo, starttime_hi;
-#endif /* __i386__ */
- } clk;
-
- int active;
- wait_queue_head_t wait;
-
- struct {
- __s16 *kbuf;
- __s16 *ubuf;
- __s16 *kptr;
- unsigned int size;
- int rem;
- } sbuf;
-
- struct {
- hfmodem_time_t last_time;
- unsigned int tx_phase;
-
- struct hfmodem_l1_rxslot {
- enum slot_st state;
- hfmodem_time_t tstart, tinc;
- hfmodem_soft_t *data;
- hfmodem_soft_t *userdata;
- unsigned int nbits;
- unsigned int cntbits;
- hfmodem_id_t id;
- unsigned int corrlen;
- hfmodem_conv_t scale;
- unsigned int corr_cache;
- } rxslots[HFMODEM_NUMRXSLOTS];
-
- struct hfmodem_l1_txslot {
- enum slot_st state;
- hfmodem_time_t tstart, tinc;
- unsigned char *data;
- unsigned int nbits;
- unsigned int cntbits;
- hfmodem_id_t id;
- unsigned char inv;
- unsigned int phinc;
- unsigned int phase_incs[2];
- } txslots[HFMODEM_NUMTXSLOTS];
- } l1;
-};
-
-struct hfmodem_correlator_cache {
- int refcnt;
- int lru;
- unsigned short phase_incs[2];
- hfmodem_conv_t correlator[2][2][HFMODEM_MAXCORRLEN];
-};
-
-struct hfmodem_scops {
- unsigned int extent;
-
- void (*init)(struct hfmodem_state *dev);
- void (*prepare_input)(struct hfmodem_state *dev);
- void (*trigger_input)(struct hfmodem_state *dev);
- void (*prepare_output)(struct hfmodem_state *dev);
- void (*trigger_output)(struct hfmodem_state *dev);
- void (*stop)(struct hfmodem_state *dev);
- unsigned int (*intack)(struct hfmodem_state *dev);
- void (*mixer)(struct hfmodem_state *dev, int src, int igain, int ogain);
-};
-
-/* --------------------------------------------------------------------- */
-
-extern int hfmodem_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
-#if LINUX_VERSION_CODE >= 0x20100
-extern unsigned int hfmodem_poll(struct file *file, poll_table *wait);
-#else
-extern int hfmodem_select(struct inode *inode, struct file *file, int sel_type, select_table *wait);
-#endif
-
-extern void hfmodem_clear_rq(struct hfmodem_state *dev);
-extern void hfmodem_input_samples(struct hfmodem_state *dev, hfmodem_time_t tstart,
- hfmodem_time_t tinc, __s16 *samples);
-extern int hfmodem_output_samples(struct hfmodem_state *dev, hfmodem_time_t tstart,
- hfmodem_time_t tinc, __s16 *samples);
-extern long hfmodem_next_tx_event(struct hfmodem_state *dev, hfmodem_time_t curr);
-extern void hfmodem_finish_pending_rx_requests(struct hfmodem_state *dev);
-extern void hfmodem_wakeup(struct hfmodem_state *dev);
-
-
-extern int hfmodem_sbcprobe(struct hfmodem_state *dev);
-extern int hfmodem_wssprobe(struct hfmodem_state *dev);
-
-extern void hfmodem_refclock_probe(void);
-extern void hfmodem_refclock_init(struct hfmodem_state *dev);
-extern hfmodem_time_t hfmodem_refclock_current(struct hfmodem_state *dev, hfmodem_time_t expected, int exp_valid);
-
-/* --------------------------------------------------------------------- */
-
-extern const char hfmodem_drvname[];
-extern const char hfmodem_drvinfo[];
-
-extern struct hfmodem_state hfmodem_state[NR_DEVICE];
-extern struct hfmodem_correlator_cache hfmodem_correlator_cache[HFMODEM_CORRELATOR_CACHE];
-
-/* --------------------------------------------------------------------- */
-#endif /* __KERNEL__ */
-/* --------------------------------------------------------------------- */
-#endif /* _HFMODEM_H */
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index e345a9d22..7e57075f8 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -27,7 +27,7 @@
#ifdef __KERNEL__
extern int hippi_header(struct sk_buff *skb,
- struct device *dev,
+ struct net_device *dev,
unsigned short type,
void *daddr,
void *saddr,
@@ -36,23 +36,23 @@ extern int hippi_header(struct sk_buff *skb,
extern int hippi_rebuild_header(struct sk_buff *skb);
extern unsigned short hippi_type_trans(struct sk_buff *skb,
- struct device *dev);
+ struct net_device *dev);
extern void hippi_header_cache_bind(struct hh_cache ** hhp,
- struct device *dev,
+ struct net_device *dev,
unsigned short htype,
__u32 daddr);
extern void hippi_header_cache_update(struct hh_cache *hh,
- struct device *dev,
+ struct net_device *dev,
unsigned char * haddr);
extern int hippi_header_parse(struct sk_buff *skb, unsigned char *haddr);
extern void hippi_net_init(void);
-void hippi_setup(struct device *dev);
+void hippi_setup(struct net_device *dev);
-extern struct device *init_hippi_dev(struct device *, int);
-extern void unregister_hipdev(struct device *dev);
+extern struct net_device *init_hippi_dev(struct net_device *, int);
+extern void unregister_hipdev(struct net_device *dev);
#endif
#endif /* _LINUX_HIPPIDEVICE_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index feb877ed0..f5e1a3015 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -41,6 +41,8 @@ struct i2c_device;
#define I2C_BUSID_BT848 1 /* I2C bus on a BT848 */
#define I2C_BUSID_PARPORT 2 /* Bit banging on a parallel port */
#define I2C_BUSID_BUZ 3
+#define I2C_BUSID_ZORAN 4
+
/*
* struct for a driver for a i2c chip (tuner, soundprocessor,
* videotext, ... ).
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 03118dd5f..d11ff1f09 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -11,12 +11,16 @@
#define MAX_I2O_CONTROLLERS 32
+
#ifdef __KERNEL__ /* ioctl stuff only thing exported to users */
+#define I2O_MAX_MANAGERS 4
+
/*
* I2O Interface Objects
*/
+#include <linux/config.h>
#include <linux/notifier.h>
#include <asm/atomic.h>
@@ -32,111 +36,6 @@ struct i2o_message
/* List follows */
};
-/**************************************************************************
- * HRT related constants and structures
- **************************************************************************/
-#define I2O_BUS_LOCAL 0
-#define I2O_BUS_ISA 1
-#define I2O_BUS_EISA 2
-#define I2O_BUS_MCA 3
-#define I2O_BUS_PCI 4
-#define I2O_BUS_PCMCIA 5
-#define I2O_BUS_NUBUS 6
-#define I2O_BUS_CARDBUS 7
-#define I2O_BUS_UNKNOWN 0x80
-
-typedef struct _i2o_pci_bus {
- u8 PciFunctionNumber;
- u8 PciDeviceNumber;
- u8 PciBusNumber;
- u8 reserved;
- u16 PciVendorID;
- u16 PciDeviceID;
-} i2o_pci_bus, *pi2o_pci_bus;
-
-typedef struct _i2o_local_bus {
- u16 LbBaseIOPort;
- u16 reserved;
- u32 LbBaseMemoryAddress;
-} i2o_local_bus, *pi2o_local_bus;
-
-typedef struct _i2o_isa_bus {
- u16 IsaBaseIOPort;
- u8 CSN;
- u8 reserved;
- u32 IsaBaseMemoryAddress;
-} i2o_isa_bus, *pi2o_isa_bus;
-
-typedef struct _i2o_eisa_bus_info {
- u16 EisaBaseIOPort;
- u8 reserved;
- u8 EisaSlotNumber;
- u32 EisaBaseMemoryAddress;
-} i2o_eisa_bus, *pi2o_eisa_bus;
-
-typedef struct _i2o_mca_bus {
- u16 McaBaseIOPort;
- u8 reserved;
- u8 McaSlotNumber;
- u32 McaBaseMemoryAddress;
-} i2o_mca_bus, *pi2o_mca_bus;
-
-typedef struct _i2o_other_bus {
- u16 BaseIOPort;
- u16 reserved;
- u32 BaseMemoryAddress;
-} i2o_other_bus, *pi2o_other_bus;
-
-
-typedef struct _i2o_hrt_entry {
- u32 adapter_id;
- u32 parent_tid:12;
- u32 state:4;
- u32 bus_num:8;
- u32 bus_type:8;
- union {
- i2o_pci_bus pci_bus;
- i2o_local_bus local_bus;
- i2o_isa_bus isa_bus;
- i2o_eisa_bus eisa_bus;
- i2o_mca_bus mca_bus;
- i2o_other_bus other_bus;
- } bus;
-} i2o_hrt_entry, *pi2o_hrt_entry;
-
-typedef struct _i2o_hrt {
- u16 num_entries;
- u8 entry_len;
- u8 hrt_version;
- u32 change_ind;
- i2o_hrt_entry hrt_entry[1];
-} i2o_hrt, *pi2o_hrt;
-
-typedef struct _i2o_lct_entry {
- u32 entry_size:16;
- u32 tid:12;
- u32 reserved:4;
- u32 change_ind;
- u32 device_flags;
- u32 class_id;
- u32 sub_class;
- u32 user_tid:12;
- u32 parent_tid:12;
- u32 bios_info:8;
- u8 identity_tag[8];
- u32 event_capabilities;
-} i2o_lct_entry, *pi2o_lct_entry;
-
-typedef struct _i2o_lct {
- u32 table_size:16;
- u32 boot_tid:12;
- u32 lct_ver:4;
- u32 iop_flags;
- u32 current_change_ind;
- i2o_lct_entry lct_entry[1];
-} i2o_lct, *pi2o_lct;
-
-
/*
* Each I2O device entity has one or more of these. There is one
* per device. *FIXME* how to handle multiple types on one unit.
@@ -152,7 +51,14 @@ struct i2o_device
int i2oversion; /* I2O version supported. Actually there
* should be high and low version */
struct proc_dir_entry* proc_entry; /* /proc dir */
- struct i2o_driver *owner; /* Owning device */
+
+ /* Primary user */
+ struct i2o_handler *owner;
+
+ /* Management users */
+ struct i2o_handler *managers[I2O_MAX_MANAGERS];
+ int num_managers;
+
struct i2o_controller *controller; /* Controlling IOP */
struct i2o_device *next; /* Chain */
char dev_name[8]; /* linux /dev name if available */
@@ -161,12 +67,12 @@ struct i2o_device
/*
* Resource data for each PCI I2O controller
*/
-
struct i2o_pci
{
int irq;
};
+
/*
* Each I2O controller has one of these objects
*/
@@ -178,7 +84,9 @@ struct i2o_controller
int status; /* I2O status */
int i2oversion;
int type;
+
#define I2O_TYPE_PCI 0x01 /* PCI I2O controller */
+
struct notifier_block *event_notifer; /* Events */
atomic_t users;
struct i2o_device *devices; /* I2O device chain */
@@ -201,9 +109,13 @@ struct i2o_controller
{ /* Bus information */
struct i2o_pci pci;
} bus;
- void (*destructor)(struct i2o_controller *); /* Bus specific destructor */
- int (*bind)(struct i2o_controller *, struct i2o_device *); /* Bus specific attach/detach */
+ /* Bus specific destructor */
+ void (*destructor)(struct i2o_controller *);
+ /* Bus specific attach/detach */
+ int (*bind)(struct i2o_controller *, struct i2o_device *);
+ /* Bus specific initiator */
int (*unbind)(struct i2o_controller *, struct i2o_device *);
+
void *page_frame; /* Message buffers */
int inbound_size; /* Inbound queue size */
};
@@ -213,9 +125,33 @@ struct i2o_handler
void (*reply)(struct i2o_handler *, struct i2o_controller *, struct i2o_message *);
char *name;
int context; /* Low 8 bits of the transaction info */
+ u32 class; /* I2O classes that this driver handles */
/* User data follows */
};
+#ifdef MODULE
+/*
+ * Used by bus specific modules to communicate with the core
+ *
+ * This is needed because the bus modules cannot make direct
+ * calls to the core as this results in the i2o_bus_specific_module
+ * being dependent on the core, not the otherway around.
+ * In that case, a 'modprobe i2o_lan' loads i2o_core & i2o_lan,
+ * but _not_ i2o_pci...which makes the whole thing pretty useless :)
+ *
+ */
+struct i2o_core_func_table
+{
+ int (*install)(struct i2o_controller *);
+ int (*activate)(struct i2o_controller *);
+ struct i2o_controller*
+ (*find)(int);
+ void (*unlock)(struct i2o_controller *);
+ void (*run_queue)(struct i2o_controller *c);
+ int (*delete)(struct i2o_controller *);
+};
+#endif
+
/*
* Messenger inlines
*/
@@ -282,12 +218,14 @@ extern int i2o_remove_handler(struct i2o_handler *);
extern int i2o_install_device(struct i2o_controller *, struct i2o_device *);
extern int i2o_delete_device(struct i2o_device *);
-extern int i2o_claim_device(struct i2o_device *, struct i2o_driver *);
-extern int i2o_release_device(struct i2o_device *);
+extern int i2o_claim_device(struct i2o_device *, struct i2o_handler *, u32);
+extern int i2o_release_device(struct i2o_device *, struct i2o_handler *, u32);
extern int i2o_post_this(struct i2o_controller *, int, u32 *, int);
extern int i2o_post_wait(struct i2o_controller *, int, u32 *, int, int *, int);
-extern int i2o_issue_claim(struct i2o_controller *, int, int, int, int *);
+extern int i2o_issue_claim(struct i2o_controller *, int, int, int, int *, u32);
+extern int i2o_issue_params(int, struct i2o_controller *, int, int, void *,
+ int, void *, int, int *);
extern int i2o_query_scalar(struct i2o_controller *, int, int, int, int,
void *, int, int *);
@@ -559,6 +497,12 @@ extern const char *i2o_get_class_name(int);
#define I2O_DSC_UNSUPPORTED_VERSION 0x001A
#define I2O_DSC_DEVICE_BUSY 0x001B
#define I2O_DSC_DEVICE_NOT_AVAILABLE 0x001C
+
+/* Device Claim Types */
+#define I2O_CLAIM_PRIMARY 0x01000000
+#define I2O_CLAIM_MANAGEMENT 0x02000000
+#define I2O_CLAIM_AUTHORIZED 0x03000000
+#define I2O_CLAIM_SECONDARY 0x04000000
/* Message header defines for VersionOffset */
#define I2OVER15 0x0001
@@ -612,67 +556,177 @@ extern const char *i2o_get_class_name(int);
#endif /* __KERNEL__ */
-#include <asm/ioctl.h>
+#include <linux/ioctl.h>
/*
* I2O Control IOCTLs and structures
*/
#define I2O_MAGIC_NUMBER 'i'
-#define I2OGETIOPS _IO(I2O_MAGIC_NUMBER,0)
-#define I2OHRTGET _IO(I2O_MAGIC_NUMBER,1)
-#define I2OLCTGET _IO(I2O_MAGIC_NUMBER,2)
-#define I2OPARMSET _IO(I2O_MAGIC_NUMBER,3)
-#define I2OPARMGET _IO(I2O_MAGIC_NUMBER,4)
-#define I2OSWDL _IO(I2O_MAGIC_NUMBER,5)
-#define I2OSWUL _IO(I2O_MAGIC_NUMBER,6)
-#define I2OSWDEL _IO(I2O_MAGIC_NUMBER,7)
-#define I2OHTML _IO(I2O_MAGIC_NUMBER,8)
+#define I2OGETIOPS _IOR(I2O_MAGIC_NUMBER,0,u8[MAX_I2O_CONTROLLERS])
+#define I2OHRTGET _IOWR(I2O_MAGIC_NUMBER,1,struct i2o_cmd_hrtlct)
+#define I2OLCTGET _IOWR(I2O_MAGIC_NUMBER,2,struct i2o_cmd_hrtlct)
+#define I2OPARMSET _IOWR(I2O_MAGIC_NUMBER,3,struct i2o_cmd_psetget)
+#define I2OPARMGET _IOWR(I2O_MAGIC_NUMBER,4,struct i2o_cmd_psetget)
+#define I2OSWDL _IOWR(I2O_MAGIC_NUMBER,5,struct i2o_sw_xfer)
+#define I2OSWUL _IOWR(I2O_MAGIC_NUMBER,6,struct i2o_sw_xfer)
+#define I2OSWDEL _IOWR(I2O_MAGIC_NUMBER,7,struct i2o_sw_xfer)
+#define I2OVALIDATE _IOR(I2O_MAGIC_NUMBER,8,u32)
+#define I2OHTML _IOWR(I2O_MAGIC_NUMBER,9,struct i2o_html)
/* On hold until we figure this out
-#define I2OEVTREG _IO(I2O_MAGIC_NUMBER,9)
-#define I2OEVTCLR _IO(I2O_MAGIC_NUMBER,10)
-#define I2OEVTGET _IO(I2O_MAGIC_NUMBER,11)
+#define I2OEVTREG _IO(I2O_MAGIC_NUMBER,10)
+#define I2OEVTCLR _IO(I2O_MAGIC_NUMBER,11)
+#define I2OEVTGET _IO(I2O_MAGIC_NUMBER,12)
*/
struct i2o_cmd_hrtlct
{
- unsigned int iop; /* IOP unit number */
- void *resbuf; /* Buffer for result */
- unsigned int *reslen; /* Buffer length in bytes */
+ unsigned int iop; /* IOP unit number */
+ void *resbuf; /* Buffer for result */
+ unsigned int *reslen; /* Buffer length in bytes */
};
-
struct i2o_cmd_psetget
{
- unsigned int iop; /* IOP unit number */
- unsigned int tid; /* Target device TID */
- void *opbuf; /* Operation List buffer */
- unsigned int oplen; /* Operation List buffer length in bytes */
- void *resbuf; /* Result List buffer */
- unsigned int *reslen; /* Result List buffer length in bytes */
+ unsigned int iop; /* IOP unit number */
+ unsigned int tid; /* Target device TID */
+ void *opbuf; /* Operation List buffer */
+ unsigned int oplen; /* Operation List buffer length in bytes */
+ void *resbuf; /* Result List buffer */
+ unsigned int *reslen; /* Result List buffer length in bytes */
};
struct i2o_sw_xfer
{
unsigned int iop; /* IOP unit number */
- unsigned char dl_flags; /* DownLoadFlags field */
+ unsigned char flags; /* Flags field */
unsigned char sw_type; /* Software type */
- unsigned int sw_id; /* Software ID */
- void *buf; /* Pointer to software buffer */
- unsigned int *swlen; /* Length of software data */
- unsigned int *maxfrag; /* Maximum fragment count */
- unsigned int *curfrag; /* Current fragment count */
+ unsigned int sw_id; /* Software ID */
+ void *buf; /* Pointer to software buffer */
+ unsigned int *swlen; /* Length of software data */
+ unsigned int *maxfrag; /* Maximum fragment count */
+ unsigned int *curfrag; /* Current fragment count */
};
struct i2o_html
{
- unsigned int iop; /* IOP unit number */
- unsigned int tid; /* Target device ID */
- unsigned int page; /* HTML page */
- void *resbuf; /* Buffer for reply HTML page */
- unsigned int *reslen; /* Length in bytes of reply buffer */
- void *qbuf; /* Pointer to HTTP query string */
- unsigned int qlen; /* Length in bytes of query string buffer */
+ unsigned int iop; /* IOP unit number */
+ unsigned int tid; /* Target device ID */
+ unsigned int page; /* HTML page */
+ void *resbuf; /* Buffer for reply HTML page */
+ unsigned int *reslen; /* Length in bytes of reply buffer */
+ void *qbuf; /* Pointer to HTTP query string */
+ unsigned int qlen; /* Length in bytes of query string buffer */
};
+
+/**************************************************************************
+ * HRT related constants and structures
+ **************************************************************************/
+#define I2O_BUS_LOCAL 0
+#define I2O_BUS_ISA 1
+#define I2O_BUS_EISA 2
+#define I2O_BUS_MCA 3
+#define I2O_BUS_PCI 4
+#define I2O_BUS_PCMCIA 5
+#define I2O_BUS_NUBUS 6
+#define I2O_BUS_CARDBUS 7
+#define I2O_BUS_UNKNOWN 0x80
+
+#ifndef __KERNEL__
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+#endif /* __KERNEL__ */
+
+typedef struct _i2o_pci_bus {
+ u8 PciFunctionNumber;
+ u8 PciDeviceNumber;
+ u8 PciBusNumber;
+ u8 reserved;
+ u16 PciVendorID;
+ u16 PciDeviceID;
+} i2o_pci_bus, *pi2o_pci_bus;
+
+typedef struct _i2o_local_bus {
+ u16 LbBaseIOPort;
+ u16 reserved;
+ u32 LbBaseMemoryAddress;
+} i2o_local_bus, *pi2o_local_bus;
+
+typedef struct _i2o_isa_bus {
+ u16 IsaBaseIOPort;
+ u8 CSN;
+ u8 reserved;
+ u32 IsaBaseMemoryAddress;
+} i2o_isa_bus, *pi2o_isa_bus;
+
+typedef struct _i2o_eisa_bus_info {
+ u16 EisaBaseIOPort;
+ u8 reserved;
+ u8 EisaSlotNumber;
+ u32 EisaBaseMemoryAddress;
+} i2o_eisa_bus, *pi2o_eisa_bus;
+
+typedef struct _i2o_mca_bus {
+ u16 McaBaseIOPort;
+ u8 reserved;
+ u8 McaSlotNumber;
+ u32 McaBaseMemoryAddress;
+} i2o_mca_bus, *pi2o_mca_bus;
+
+typedef struct _i2o_other_bus {
+ u16 BaseIOPort;
+ u16 reserved;
+ u32 BaseMemoryAddress;
+} i2o_other_bus, *pi2o_other_bus;
+
+typedef struct _i2o_hrt_entry {
+ u32 adapter_id;
+ u32 parent_tid:12;
+ u32 state:4;
+ u32 bus_num:8;
+ u32 bus_type:8;
+ union {
+ i2o_pci_bus pci_bus;
+ i2o_local_bus local_bus;
+ i2o_isa_bus isa_bus;
+ i2o_eisa_bus eisa_bus;
+ i2o_mca_bus mca_bus;
+ i2o_other_bus other_bus;
+ } bus;
+} i2o_hrt_entry, *pi2o_hrt_entry;
+
+typedef struct _i2o_hrt {
+ u16 num_entries;
+ u8 entry_len;
+ u8 hrt_version;
+ u32 change_ind;
+ i2o_hrt_entry hrt_entry[1];
+} i2o_hrt, *pi2o_hrt;
+
+typedef struct _i2o_lct_entry {
+ u32 entry_size:16;
+ u32 tid:12;
+ u32 reserved:4;
+ u32 change_ind;
+ u32 device_flags;
+ u32 class_id;
+ u32 sub_class;
+ u32 user_tid:12;
+ u32 parent_tid:12;
+ u32 bios_info:8;
+ u8 identity_tag[8];
+ u32 event_capabilities;
+} i2o_lct_entry, *pi2o_lct_entry;
+
+typedef struct _i2o_lct {
+ u32 table_size:16;
+ u32 boot_tid:12;
+ u32 lct_ver:4;
+ u32 iop_flags;
+ u32 current_change_ind;
+ i2o_lct_entry lct_entry[1];
+} i2o_lct, *pi2o_lct;
+
#endif
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index fcd6fce28..2eb0a6680 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -136,7 +136,7 @@ struct icmp6_filter {
extern void icmpv6_send(struct sk_buff *skb,
int type, int code,
__u32 info,
- struct device *dev);
+ struct net_device *dev);
extern int icmpv6_init(struct net_proto_family *ops);
extern int icmpv6_err_convert(int type, int code,
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 5156d0d75..71bcdc98e 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1,7 +1,7 @@
#ifndef _IDE_H
#define _IDE_H
/*
- * linux/drivers/block/ide.h
+ * linux/include/linux/ide.h
*
* Copyright (C) 1994-1998 Linus Torvalds & authors
*/
@@ -318,7 +318,8 @@ typedef struct ide_drive_s {
typedef enum { ide_dma_read, ide_dma_write, ide_dma_begin,
ide_dma_end, ide_dma_check, ide_dma_on,
ide_dma_off, ide_dma_off_quietly, ide_dma_test_irq,
- ide_dma_bad_drive, ide_dma_good_drive
+ ide_dma_bad_drive, ide_dma_good_drive,
+ ide_dma_lostirq, ide_dma_timeout
} ide_dma_action_t;
typedef int (ide_dmaproc_t)(ide_dma_action_t, ide_drive_t *);
@@ -758,6 +759,12 @@ void do_ide6_request (void);
#if MAX_HWIFS > 7
void do_ide7_request (void);
#endif
+#if MAX_HWIFS > 8
+void do_ide8_request (void);
+#endif
+#if MAX_HWIFS > 9
+void do_ide9_request (void);
+#endif
void ide_init_subdrivers (void);
#ifndef _IDE_C
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 867320549..23e0777ae 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -35,6 +35,7 @@
#define ARPHRD_ARCNET 7 /* ARCnet */
#define ARPHRD_APPLETLK 8 /* APPLEtalk */
#define ARPHRD_DLCI 15 /* Frame Relay DLCI */
+#define ARPHRD_ATM 19 /* ATM */
#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */
/* Dummy types for non ARP hardware */
@@ -66,7 +67,7 @@
#define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */
#define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */
#define ARPHRD_ECONET 782 /* Acorn Econet */
-#define ARPHRD_IRDA 783 /* Linux/IR */
+#define ARPHRD_IRDA 783 /* Linux-IrDA */
/* ARP works differently on different FC media .. so */
#define ARPHRD_FCPP 784 /* Point to point fibrechanel */
#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */
@@ -80,6 +81,9 @@
#define ARPOP_REPLY 2 /* ARP reply */
#define ARPOP_RREQUEST 3 /* RARP request */
#define ARPOP_RREPLY 4 /* RARP reply */
+#define ARPOP_InREQUEST 8 /* InARP request */
+#define ARPOP_InREPLY 9 /* InARP reply */
+#define ARPOP_NAK 10 /* (ATM)ARP NAK */
/* ARP ioctl request. */
diff --git a/include/linux/if_cablemodem.h b/include/linux/if_cablemodem.h
new file mode 100644
index 000000000..9ca1007ed
--- /dev/null
+++ b/include/linux/if_cablemodem.h
@@ -0,0 +1,22 @@
+#ifndef _LINUX_CABLEMODEM_H_
+#define _LINUX_CABLEMODEM_H_
+/*
+ * Author: Franco Venturi <fventuri@mediaone.net>
+ * Copyright 1998 Franco Venturi
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+/* some useful defines for sb1000.c e cmconfig.c - fv */
+#define SIOCGCMSTATS SIOCDEVPRIVATE+0 /* get cable modem stats */
+#define SIOCGCMFIRMWARE SIOCDEVPRIVATE+1 /* get cm firmware version */
+#define SIOCGCMFREQUENCY SIOCDEVPRIVATE+2 /* get cable modem frequency */
+#define SIOCSCMFREQUENCY SIOCDEVPRIVATE+3 /* set cable modem frequency */
+#define SIOCGCMPIDS SIOCDEVPRIVATE+4 /* get cable modem PIDs */
+#define SIOCSCMPIDS SIOCDEVPRIVATE+5 /* set cable modem PIDs */
+
+#endif
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h
index 320dbebf1..03c80ef58 100644
--- a/include/linux/if_eql.h
+++ b/include/linux/if_eql.h
@@ -36,7 +36,7 @@
#define EQL_SETMASTRCFG (SIOCDEVPRIVATE + 5)
typedef struct slave {
- struct device *dev;
+ struct net_device *dev;
long priority;
long priority_bps;
long priority_Bps;
@@ -48,7 +48,7 @@ typedef struct slave_queue {
slave_t *head;
slave_t *best_slave;
int num_slaves;
- struct device *master_dev;
+ struct net_device *master_dev;
char lock;
} slave_queue_t;
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 99bb97fa2..18bde1113 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -74,7 +74,8 @@
#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
#define ETH_P_CONTROL 0x0016 /* Card specific control frames */
-#define ETH_P_IRDA 0x0017 /* Linux/IR */
+#define ETH_P_IRDA 0x0017 /* Linux-IrDA */
+#define ETH_P_ECONET 0x0018 /* Acorn Econet */
/*
* This is an Ethernet frame header.
diff --git a/include/linux/if_fc.h b/include/linux/if_fc.h
new file mode 100644
index 000000000..33330b458
--- /dev/null
+++ b/include/linux/if_fc.h
@@ -0,0 +1,50 @@
+/*
+ * INET An implementation of the TCP/IP protocol suite for the LINUX
+ * operating system. INET is implemented using the BSD Socket
+ * interface as the means of communication with the user level.
+ *
+ * Global definitions for Fibre Channel.
+ *
+ * Version: @(#)if_fc.h 0.0 11/20/98
+ *
+ * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
+ * Donald Becker, <becker@super.org>
+ * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
+ * Vineet Abraham, <vma@iol.unh.edu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#ifndef _LINUX_IF_FC_H
+#define _LINUX_IF_FC_H
+
+
+#define FC_ALEN 6 /* Octets in one ethernet addr */
+#define FC_HLEN (sizeof(struct fch_hdr)+sizeof(struct fcllc))
+#define FC_ID_LEN 3 /* Octets in a Fibre Channel Address */
+
+/* LLC and SNAP constants */
+#define EXTENDED_SAP 0xAA
+#define UI_CMD 0x03
+
+/* This is NOT the Fibre Channel frame header. The FC frame header is
+ * constructed in the driver as the Tachyon needs certain fields in
+ * certains positions. So, it can't be generalized here.*/
+
+struct fch_hdr {
+ __u8 daddr[FC_ALEN]; /* destination address */
+ __u8 saddr[FC_ALEN]; /* source address */
+};
+
+/* This is a Fibre Channel LLC structure */
+struct fcllc {
+ __u8 dsap; /* destination SAP */
+ __u8 ssap; /* source SAP */
+ __u8 llc; /* LLC control field */
+ __u8 protid[3]; /* protocol id */
+ __u16 ethertype; /* ether type field */
+};
+
+#endif /* _LINUX_IF_FC_H */
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 4f1a1e2f3..7a2fe04e3 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -155,12 +155,12 @@ struct frhdr
struct dlci_local
{
struct enet_statistics stats;
- struct device *slave;
+ struct net_device *slave;
struct dlci_conf config;
int configured;
/* callback function */
- void (*receive)(struct sk_buff *skb, struct device *);
+ void (*receive)(struct sk_buff *skb, struct net_device *);
};
struct frad_local
@@ -168,7 +168,7 @@ struct frad_local
struct enet_statistics stats;
/* devices which this FRAD is slaved to */
- struct device *master[CONFIG_DLCI_MAX];
+ struct net_device *master[CONFIG_DLCI_MAX];
short dlci[CONFIG_DLCI_MAX];
struct frad_conf config;
@@ -176,11 +176,11 @@ struct frad_local
int initialized; /* mem_start, port, irq set ? */
/* callback functions */
- int (*activate)(struct device *, struct device *);
- int (*deactivate)(struct device *, struct device *);
- int (*assoc)(struct device *, struct device *);
- int (*deassoc)(struct device *, struct device *);
- int (*dlci_conf)(struct device *, struct device *, int get);
+ int (*activate)(struct net_device *, struct net_device *);
+ int (*deactivate)(struct net_device *, struct net_device *);
+ int (*assoc)(struct net_device *, struct net_device *);
+ int (*deassoc)(struct net_device *, struct net_device *);
+ int (*dlci_conf)(struct net_device *, struct net_device *, int get);
/* fields that are used by the Sangoma SDLA cards */
struct timer_list timer;
diff --git a/include/linux/if_ltalk.h b/include/linux/if_ltalk.h
index d7b17d323..e75e832b7 100644
--- a/include/linux/if_ltalk.h
+++ b/include/linux/if_ltalk.h
@@ -6,7 +6,7 @@
#define LTALK_ALEN 1
#ifdef __KERNEL__
-extern void ltalk_setup(struct device *);
+extern void ltalk_setup(struct net_device *);
#endif
#endif
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index ad5655cf1..0fcf3bfb2 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -34,6 +34,56 @@ struct sockaddr_ll
#define PACKET_ADD_MEMBERSHIP 1
#define PACKET_DROP_MEMBERSHIP 2
+#define PACKET_RECV_OUTPUT 3
+/* Value 4 is still used by obsolete turbo-packet. */
+#define PACKET_RX_RING 5
+#define PACKET_STATISTICS 6
+
+struct tpacket_stats
+{
+ unsigned int tp_packets;
+ unsigned int tp_drops;
+};
+
+struct tpacket_hdr
+{
+ unsigned long tp_status;
+#define TP_STATUS_KERNEL 0
+#define TP_STATUS_USER 1
+#define TP_STATUS_COPY 2
+#define TP_STATUS_LOSING 4
+ unsigned int tp_len;
+ unsigned int tp_snaplen;
+ unsigned short tp_mac;
+ unsigned short tp_net;
+ unsigned int tp_sec;
+ unsigned int tp_usec;
+};
+
+#define TPACKET_ALIGNMENT 16
+#define TPACKET_ALIGN(x) (((x)+TPACKET_ALIGNMENT-1)&~(TPACKET_ALIGNMENT-1))
+#define TPACKET_HDRLEN (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + sizeof(struct sockaddr_ll))
+
+/*
+ Frame structure:
+
+ - Start. Frame must be aligned to TPACKET_ALIGNMENT=16
+ - struct tpacket_hdr
+ - pad to TPACKET_ALIGNMENT=16
+ - struct sockaddr_ll
+ - Gap, chosen so that packet data (Start+tp_net) alignes to TPACKET_ALIGNMENT=16
+ - Start+tp_mac: [ Optional MAC header ]
+ - Start+tp_net: Packet data, aligned to TPACKET_ALIGNMENT=16.
+ - Pad to align to TPACKET_ALIGNMENT=16
+ */
+
+struct tpacket_req
+{
+ unsigned int tp_block_size; /* Minimal size of contiguous block */
+ unsigned int tp_block_nr; /* Number of blocks */
+ unsigned int tp_frame_size; /* Size of frame */
+ unsigned int tp_frame_nr; /* Total number of frames */
+};
struct packet_mreq
{
diff --git a/include/linux/if_ppp.h b/include/linux/if_ppp.h
index 1d103bdca..18a265d18 100644
--- a/include/linux/if_ppp.h
+++ b/include/linux/if_ppp.h
@@ -21,7 +21,7 @@
*/
/*
- * ==FILEVERSION 990331==
+ * ==FILEVERSION 990806==
*
* NOTE TO MAINTAINERS:
* If you modify this file at all, please set the above date.
@@ -41,8 +41,6 @@
#define PPP_MTU 1500 /* Default MTU (size of Info field) */
#define PPP_MAXMRU 65000 /* Largest MRU we allow */
-#define PPP_VERSION "2.3.7"
-#define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */
#define PROTO_IPX 0x002b /* protocol numbers */
#define PROTO_DNA_RT 0x0027 /* DNA Routing */
@@ -60,6 +58,8 @@
#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
+#define SC_LOOP_TRAFFIC 0x00000200 /* send traffic to pppd */
+#define SC_MULTILINK 0x00000400 /* do multilink encapsulation */
#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
#define SC_DEBUG 0x00010000 /* enable debug messages */
@@ -68,7 +68,7 @@
#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
#define SC_SYNC 0x00200000 /* synchronous serial mode */
-#define SC_MASK 0x0f2000ff /* bits that user can change */
+#define SC_MASK 0x0f200fff /* bits that user can change */
/* state bits */
#define SC_XMIT_BUSY 0x10000000 /* (used by isdn_ppp?) */
@@ -131,6 +131,9 @@ struct ifpppcstatsreq {
#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
+#define PPPIOCNEWUNIT _IOWR('t', 62, int) /* create new ppp unit */
+#define PPPIOCATTACH _IOW('t', 61, int) /* attach to ppp unit */
+#define PPPIOCDETACH _IOW('t', 60, int) /* detach from ppp unit */
#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
diff --git a/include/linux/if_pppvar.h b/include/linux/if_pppvar.h
index e01e4d23f..7603d29cd 100644
--- a/include/linux/if_pppvar.h
+++ b/include/linux/if_pppvar.h
@@ -42,7 +42,7 @@
*/
/*
- * ==FILEVERSION 990325==
+ * ==FILEVERSION 990806==
*
* NOTE TO MAINTAINERS:
* If you modify this file at all, please set the above date.
@@ -126,10 +126,13 @@ struct ppp {
enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
int sc_xfer; /* PID of reserved PPP table */
- char name[8]; /* space for unit name */
- struct device dev; /* net device structure */
+ char name[16]; /* space for unit name */
+ struct net_device dev; /* net device structure */
struct enet_statistics estats; /* more detailed stats */
/* tty output buffer */
unsigned char obuf[OBUFSIZE]; /* buffer for characters to send */
};
+
+#define PPP_MAGIC 0x5002
+#define PPP_VERSION "2.3.7"
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h
index da449f7e4..d8e2a3b29 100644
--- a/include/linux/if_shaper.h
+++ b/include/linux/if_shaper.h
@@ -23,20 +23,21 @@ struct shaper
__u32 shapeclock;
__u32 recovery; /* Time we can next clock a packet out on
an empty queue */
- unsigned long locked;
- struct device *dev;
+ unsigned long locked;
+ struct net_device_stats stats;
+ struct net_device *dev;
int (*hard_start_xmit) (struct sk_buff *skb,
- struct device *dev);
+ struct net_device *dev);
int (*hard_header) (struct sk_buff *skb,
- struct device *dev,
+ struct net_device *dev,
unsigned short type,
void *daddr,
void *saddr,
unsigned len);
int (*rebuild_header)(struct sk_buff *skb);
int (*hard_header_cache)(struct neighbour *neigh, struct hh_cache *hh);
- void (*header_cache_update)(struct hh_cache *hh, struct device *dev, unsigned char * haddr);
- struct net_device_stats* (*get_stats)(struct device *dev);
+ void (*header_cache_update)(struct hh_cache *hh, struct net_device *dev, unsigned char * haddr);
+ struct net_device_stats* (*get_stats)(struct net_device *dev);
wait_queue_head_t wait_queue;
struct timer_list timer;
};
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f3f6c2363..0c971919f 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -95,13 +95,15 @@ struct ip_mc_list
struct ip_mc_list *next;
struct timer_list timer;
int users;
+ atomic_t refcnt;
+ spinlock_t lock;
char tm_running;
char reporter;
char unsolicit_count;
char loaded;
};
-extern int ip_check_mc(struct device *dev, u32 mc_addr);
+extern int ip_check_mc(struct in_device *dev, u32 mc_addr);
extern int igmp_rcv(struct sk_buff *, unsigned short);
extern int ip_mc_join_group(struct sock *sk, struct ip_mreqn *imr);
extern int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr);
diff --git a/include/linux/in.h b/include/linux/in.h
index 8d6c8b5b6..37db22a9a 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -38,6 +38,10 @@ enum {
IPPROTO_PIM = 103, /* Protocol Independent Multicast */
+ IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
+ IPPROTO_AH = 51, /* Authentication Header protocol */
+ IPPROTO_COMP = 108, /* Compression Header protocol */
+
IPPROTO_RAW = 255, /* Raw IP packets */
IPPROTO_MAX
};
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 4f31677b9..ca5e768ba 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -129,8 +129,6 @@ struct in6_flowlabel_req
#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
#define IPPROTO_ROUTING 43 /* IPv6 routing header */
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
-#define IPPROTO_ESP 50 /* encapsulating security payload */
-#define IPPROTO_AH 51 /* authentication header */
#define IPPROTO_ICMPV6 58 /* ICMPv6 */
#define IPPROTO_NONE 59 /* IPv6 no next header */
#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index d4de5b918..8164ec72f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -16,6 +16,7 @@ struct ipv4_devconf
int log_martians;
int forwarding;
int mc_forwarding;
+ int tag;
void *sysctl;
};
@@ -23,11 +24,13 @@ extern struct ipv4_devconf ipv4_devconf;
struct in_device
{
- struct device *dev;
+ struct net_device *dev;
+ atomic_t refcnt;
+ rwlock_t lock;
+ int dead;
struct in_ifaddr *ifa_list; /* IP ifaddr chain */
struct ip_mc_list *mc_list; /* IP multicast filter chain */
unsigned long mr_v1_seen;
- unsigned flags;
struct neigh_parms *arp_parms;
struct ipv4_devconf cnf;
};
@@ -43,6 +46,7 @@ struct in_device
#define IN_DEV_SHARED_MEDIA(in_dev) (ipv4_devconf.shared_media || (in_dev)->cnf.shared_media)
#define IN_DEV_TX_REDIRECTS(in_dev) (ipv4_devconf.send_redirects || (in_dev)->cnf.send_redirects)
#define IN_DEV_SEC_REDIRECTS(in_dev) (ipv4_devconf.secure_redirects || (in_dev)->cnf.secure_redirects)
+#define IN_DEV_IDTAG(in_dev) ((in_dev)->cnf.tag)
#define IN_DEV_RX_REDIRECTS(in_dev) \
((IN_DEV_FORWARD(in_dev) && \
@@ -68,13 +72,13 @@ struct in_ifaddr
extern int register_inetaddr_notifier(struct notifier_block *nb);
extern int unregister_inetaddr_notifier(struct notifier_block *nb);
-extern struct device *ip_dev_find(u32 addr);
-extern struct in_ifaddr *inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b);
+extern struct net_device *ip_dev_find(u32 addr);
+extern int inet_addr_onlink(struct in_device *in_dev, u32 a, u32 b);
extern int devinet_ioctl(unsigned int cmd, void *);
extern void devinet_init(void);
-extern struct in_device *inetdev_init(struct device *dev);
+extern struct in_device *inetdev_init(struct net_device *dev);
extern struct in_device *inetdev_by_index(int);
-extern u32 inet_select_addr(const struct device *dev, u32 dst, int scope);
+extern u32 inet_select_addr(const struct net_device *dev, u32 dst, int scope);
extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, u32 prefix, u32 mask);
extern void inet_forward_change(void);
@@ -106,6 +110,40 @@ extern __inline__ int bad_mask(u32 mask, u32 addr)
#define endfor_ifa(in_dev) }
+extern rwlock_t inetdev_lock;
+
+
+extern __inline__ struct in_device *
+in_dev_get(const struct net_device *dev)
+{
+ struct in_device *in_dev;
+
+ read_lock(&inetdev_lock);
+ in_dev = dev->ip_ptr;
+ if (in_dev)
+ atomic_inc(&in_dev->refcnt);
+ read_unlock(&inetdev_lock);
+ return in_dev;
+}
+
+extern __inline__ struct in_device *
+__in_dev_get(const struct net_device *dev)
+{
+ return (struct in_device*)dev->ip_ptr;
+}
+
+extern void in_dev_finish_destroy(struct in_device *idev);
+
+extern __inline__ void
+in_dev_put(struct in_device *idev)
+{
+ if (atomic_dec_and_test(&idev->refcnt))
+ in_dev_finish_destroy(idev);
+}
+
+#define __in_dev_put(idev) atomic_dec(&(idev)->refcnt)
+#define in_dev_hold(idev) atomic_inc(&(idev)->refcnt)
+
#endif /* __KERNEL__ */
extern __inline__ __u32 inet_make_mask(int logmask)
diff --git a/include/linux/init.h b/include/linux/init.h
index 4465f38b5..15fb273ec 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -17,14 +17,6 @@
* extern int z; z = x * y;
* }
*
- * Depricated: you can surround the whole function declaration
- * just before function body into __initfunc() macro, like:
- *
- * __initfunc (static void initme(int x, int y))
- * {
- * extern int z; z = x * y;
- * }
- *
* If the function has a prototype somewhere, you can also add
* __init between closing brace of the prototype and semicolon:
*
@@ -41,25 +33,79 @@
* you should use __initlocaldata instead, due to a bug in GCC 2.7.
*/
+#ifndef MODULE
+
+#ifndef __ASSEMBLY__
+
+/*
+ * Used for initialization calls..
+ */
+typedef int (*initcall_t)(void);
+
+extern initcall_t __initcall_start, __initcall_end;
+
+#define __initcall(fn) \
+ static initcall_t __initcall_##fn __init_call = fn
+
/*
- * Disable the __initfunc macros if a file that is a part of a
- * module attempts to use them. We do not want to interfere
- * with module linking.
+ * Used for kernel command line parameter setup
*/
+struct kernel_param {
+ const char *str;
+ int (*setup_func)(char *);
+};
+
+extern struct kernel_param __setup_start, __setup_end;
+
+#define __setup(str, fn) \
+ static char __setup_str_##fn[] __initdata = str; \
+ static struct kernel_param __setup_##fn __initsetup = { __setup_str_##fn, fn }
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * Mark functions and data as being only used at initialization
+ * or exit time.
+ */
+#define __init __attribute__ ((__section__ (".text.init")))
+#define __exit __attribute__ ((unused, __section__(".text.init")))
+#define __initdata __attribute__ ((__section__ (".data.init")))
+#define __exitdata __attribute__ ((unused, __section__ (".data.init")))
+#define __initsetup __attribute__ ((unused,__section__ (".setup.init")))
+#define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
+
+/* For assembly routines */
+#define __INIT .section ".text.init","ax"
+#define __FINIT .previous
+#define __INITDATA .section ".data.init","aw"
+
+#define module_init(x) __initcall(x);
+#define module_exit(x) /* nothing */
-#ifndef MODULE
-#include <asm/init.h>
#else
+
#define __init
+#define __exit
#define __initdata
-#define __initfunc(__arginit) __arginit
+#define __exitdata
+#define __initcall
/* For assembly routines */
#define __INIT
#define __FINIT
#define __INITDATA
+
+/* Not sure what version aliases were introduced in, but certainly in 2.95. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define module_init(x) int init_module(void) __attribute__((alias(#x)));
+#define module_exit(x) void cleanup_module(void) __attribute__((alias(#x)));
+#else
+#define module_init(x) int init_module(void) { return x(); }
+#define module_exit(x) void cleanup_module(void) { x(); }
+#endif
+
#endif
-#if __GNUC__ >= 2 && __GNUC_MINOR__ >= 8
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
#define __initlocaldata __initdata
#else
#define __initlocaldata
diff --git a/include/linux/iobuf.h b/include/linux/iobuf.h
new file mode 100644
index 000000000..c5cb78aff
--- /dev/null
+++ b/include/linux/iobuf.h
@@ -0,0 +1,80 @@
+/*
+ * iobuf.h
+ *
+ * Defines the structures used to track abstract kernel-space io buffers.
+ *
+ */
+
+#ifndef __LINUX_IOBUF_H
+#define __LINUX_IOBUF_H
+
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/wait.h>
+#include <asm/atomic.h>
+
+/*
+ * The kiobuf structure describes a physical set of pages reserved
+ * locked for IO. The reference counts on each page will have been
+ * incremented, and the flags field will indicate whether or not we have
+ * pre-locked all of the pages for IO.
+ *
+ * kiobufs may be passed in arrays to form a kiovec, but we must
+ * preserve the property that no page is present more than once over the
+ * entire iovec.
+ */
+
+#define KIO_MAX_ATOMIC_IO 64 /* in kb */
+#define KIO_MAX_ATOMIC_BYTES (64 * 1024)
+#define KIO_STATIC_PAGES (KIO_MAX_ATOMIC_IO / (PAGE_SIZE >> 10) + 1)
+#define KIO_MAX_SECTORS (KIO_MAX_ATOMIC_IO * 2)
+
+struct kiobuf
+{
+ int nr_pages; /* Pages actually referenced */
+ int array_len; /* Space in the allocated lists */
+ int offset; /* Offset to start of valid data */
+ int length; /* Number of valid bytes of data */
+
+ /* Keep separate track of the physical addresses and page
+ * structs involved. If we do IO to a memory-mapped device
+ * region, there won't necessarily be page structs defined for
+ * every address. */
+
+ unsigned long * pagelist;
+ struct page ** maplist;
+
+ unsigned int locked : 1; /* If set, pages has been locked */
+
+ /* Always embed enough struct pages for 64k of IO */
+ unsigned long page_array[KIO_STATIC_PAGES];
+ struct page * map_array[KIO_STATIC_PAGES];
+
+ /* Dynamic state for IO completion: */
+ atomic_t io_count; /* IOs still in progress */
+ int errno; /* Status of completed IO */
+ void (*end_io) (struct kiobuf *); /* Completion callback */
+ wait_queue_head_t wait_queue;
+};
+
+
+/* mm/memory.c */
+
+int map_user_kiobuf(int rw, struct kiobuf *, unsigned long va, size_t len);
+void unmap_kiobuf(struct kiobuf *iobuf);
+
+/* fs/iobuf.c */
+
+void __init kiobuf_init(void);
+void simple_wakeup_kiobuf(struct kiobuf *);
+int alloc_kiovec(int nr, struct kiobuf **);
+void free_kiovec(int nr, struct kiobuf **);
+int expand_kiobuf(struct kiobuf *, int);
+void kiobuf_wait_for_io(struct kiobuf *);
+
+/* fs/buffer.c */
+
+int brw_kiovec(int rw, int nr, struct kiobuf *iovec[],
+ kdev_t dev, unsigned long b[], int size, int bmap);
+
+#endif /* __LINUX_IOBUF_H */
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 2f729f96b..cf5f36775 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -2,56 +2,106 @@
* ioport.h Definitions of routines for detecting, reserving and
* allocating system resources.
*
- * Authors: Donald Becker (becker@cesdis.gsfc.nasa.gov)
- * David Hinds (dhinds@zen.stanford.edu)
+ * Authors: Linus Torvalds
*/
#ifndef _LINUX_IOPORT_H
#define _LINUX_IOPORT_H
-#define RES_IO 0
-#define RES_MEM 1
+/*
+ * Resources are tree-like, allowing
+ * nesting etc..
+ */
+struct resource {
+ const char *name;
+ unsigned long start, end;
+ unsigned long flags;
+ struct resource *parent, *sibling, *child;
+};
-extern void reserve_setup(char *str, int *ints);
+/*
+ * IO resources have these defined flags.
+ */
+#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
-extern struct resource_entry *iolist, *memlist;
+#define IORESOURCE_IO 0x00000100 /* Resource type */
+#define IORESOURCE_MEM 0x00000200
+#define IORESOURCE_IRQ 0x00000400
+#define IORESOURCE_DMA 0x00000800
-extern int get_resource_list(int class, char *buf);
-extern int check_resource(int class,
- unsigned long from, unsigned long extent);
-extern void request_resource(int class,
- unsigned long from, unsigned long extent,
- const char *name);
-extern void release_resource(int class,
- unsigned long from, unsigned long extent);
-extern unsigned long occupy_resource(int class,
- unsigned long base, unsigned long end,
- unsigned long num, unsigned long align,
- const char *name);
-extern void vacate_resource(int class,
- unsigned long from, unsigned long extent);
+#define IORESOURCE_PREFETCH 0x00001000 /* No side effects */
+#define IORESOURCE_READONLY 0x00002000
+#define IORESOURCE_CACHEABLE 0x00004000
+#define IORESOURCE_RANGELENGTH 0x00008000
+#define IORESOURCE_SHADOWABLE 0x00010000
-#define get_ioport_list(buf) get_resource_list(RES_IO, buf)
-#define get_mem_list(buf) get_resource_list(RES_MEM, buf)
+#define IORESOURCE_UNSET 0x20000000
+#define IORESOURCE_AUTO 0x40000000
+#define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */
-#define HAVE_PORTRESERVE
-/*
- * Call check_region() before probing for your hardware.
- * Once you have found you hardware, register it with request_region().
- * If you unload the driver, use release_region to free ports.
- */
-#define check_region(f,e) check_resource(RES_IO,f,e)
-#define request_region(f,e,n) request_resource(RES_IO,f,e,n)
-#define release_region(f,e) release_resource(RES_IO,f,e)
-#define occupy_region(b,e,n,a,s) occupy_resource(RES_IO,b,e,n,a,s)
-#define vacate_region(f,e) vacate_resource(RES_IO,f,e)
-
-#define HAVE_MEMRESERVE
-#define check_mem_region(f,e) check_resource(RES_MEM,f,e)
-#define request_mem_region(f,e,n) request_resource(RES_MEM,f,e,n)
-#define release_mem_region(f,e) release_resource(RES_MEM,f,e)
-#define occupy_mem_region(b,e,n,a,s) occupy_resource(RES_MEM,b,e,n,a,s)
-#define vacate_mem_region(f,e) vacate_resource(RES_MEM,f,e)
+/* ISA PnP IRQ specific bits (IORESOURCE_BITS) */
+#define IORESOURCE_IRQ_HIGHEDGE (1<<0)
+#define IORESOURCE_IRQ_LOWEDGE (1<<1)
+#define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
+#define IORESOURCE_IRQ_LOWLEVEL (1<<3)
+
+/* ISA PnP DMA specific bits (IORESOURCE_BITS) */
+#define IORESOURCE_DMA_TYPE_MASK (3<<0)
+#define IORESOURCE_DMA_8BIT (0<<0)
+#define IORESOURCE_DMA_8AND16BIT (1<<0)
+#define IORESOURCE_DMA_16BIT (2<<0)
+
+#define IORESOURCE_DMA_MASTER (1<<2)
+#define IORESOURCE_DMA_BYTE (1<<3)
+#define IORESOURCE_DMA_WORD (1<<4)
+
+#define IORESOURCE_DMA_SPEED_MASK (3<<6)
+#define IORESOURCE_DMA_COMPATIBLE (0<<6)
+#define IORESOURCE_DMA_TYPEA (1<<6)
+#define IORESOURCE_DMA_TYPEB (2<<6)
+#define IORESOURCE_DMA_TYPEF (3<<6)
+
+/* ISA PnP memory I/O specific bits (IORESOURCE_BITS) */
+#define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */
+#define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */
+#define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */
+#define IORESOURCE_MEM_TYPE_MASK (3<<3)
+#define IORESOURCE_MEM_8BIT (0<<3)
+#define IORESOURCE_MEM_16BIT (1<<3)
+#define IORESOURCE_MEM_8AND16BIT (2<<3)
+#define IORESOURCE_MEM_SHADOWABLE (1<<5) /* dup: IORESOURCE_SHADOWABLE */
+#define IORESOURCE_MEM_EXPANSIONROM (1<<6)
+
+/* PC/ISA/whatever - the normal PC address spaces: IO and memory */
+extern struct resource ioport_resource;
+extern struct resource iomem_resource;
+
+extern int get_resource_list(struct resource *, char *buf, int size);
+
+extern int request_resource(struct resource *root, struct resource *new);
+extern int release_resource(struct resource *new);
+extern int allocate_resource(struct resource *root, struct resource *new,
+ unsigned long size,
+ unsigned long min, unsigned long max,
+ unsigned long align);
+
+/* Convenience shorthand with allocation */
+#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
+#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name))
+
+extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
+
+/* Compatibility cruft */
+#define check_region(start,n) __check_region(&ioport_resource, (start), (n))
+#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
+#define check_mem_region(start,n) __check_region(&iomem_resource, (start), (n))
+#define release_mem_region(start,n) __release_region(&iomem_resource, (start), (n))
+
+extern int __check_region(struct resource *, unsigned long, unsigned long);
+extern void __release_region(struct resource *, unsigned long, unsigned long);
+
+#define get_ioport_list(buf) get_resource_list(&ioport_resource, buf, PAGE_SIZE)
+#define get_mem_list(buf) get_resource_list(&iomem_resource, buf, PAGE_SIZE)
#define HAVE_AUTOIRQ
extern void autoirq_setup(int waittime);
diff --git a/include/linux/ip_fw.h b/include/linux/ip_fw.h
deleted file mode 100644
index f36ec7e6f..000000000
--- a/include/linux/ip_fw.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * This code is heavily based on the code in ip_fw.h; see that file for
- * copyrights and attributions. This code is basically GPL.
- *
- * 15-Feb-1997: Major changes to allow graphs for firewall rules.
- * Paul Russell <Paul.Russell@rustcorp.com.au> and
- * Michael Neuling <Michael.Neuling@rustcorp.com.au>
- * 2-Nov-1997: Changed types to __u16, etc.
- * Removed IP_FW_F_TCPACK & IP_FW_F_BIDIR.
- * Added inverse flags field.
- * Removed multiple port specs.
- */
-
-/*
- * Format of an IP firewall descriptor
- *
- * src, dst, src_mask, dst_mask are always stored in network byte order.
- * flags are stored in host byte order (of course).
- * Port numbers are stored in HOST byte order.
- */
-
-#ifndef _IP_FWCHAINS_H
-#define _IP_FWCHAINS_H
-
-#ifdef __KERNEL__
-#include <linux/icmp.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>
-#include <linux/udp.h>
-#endif /* __KERNEL__ */
-#define IP_FW_MAX_LABEL_LENGTH 8
-typedef char ip_chainlabel[IP_FW_MAX_LABEL_LENGTH+1];
-
-struct ip_fw
-{
- struct in_addr fw_src, fw_dst; /* Source and destination IP addr */
- struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */
- __u32 fw_mark; /* ID to stamp on packet */
- __u16 fw_proto; /* Protocol, 0 = ANY */
- __u16 fw_flg; /* Flags word */
- __u16 fw_invflg; /* Inverse flags */
- __u16 fw_spts[2]; /* Source port range. */
- __u16 fw_dpts[2]; /* Destination port range. */
- __u16 fw_redirpt; /* Port to redirect to. */
- __u16 fw_outputsize; /* Max amount to output to
- NETLINK */
- char fw_vianame[IFNAMSIZ]; /* name of interface "via" */
- __u8 fw_tosand, fw_tosxor; /* Revised packet priority */
-};
-
-struct ip_fwuser
-{
- struct ip_fw ipfw;
- ip_chainlabel label;
-};
-
-/* Values for "fw_flg" field . */
-#define IP_FW_F_PRN 0x0001 /* Print packet if it matches */
-#define IP_FW_F_TCPSYN 0x0002 /* For tcp packets-check SYN only */
-#define IP_FW_F_FRAG 0x0004 /* Set if rule is a fragment rule */
-#define IP_FW_F_MARKABS 0x0008 /* Set the mark to fw_mark, not add. */
-#define IP_FW_F_WILDIF 0x0010 /* Need only match start of interface name. */
-#define IP_FW_F_NETLINK 0x0020 /* Redirect to netlink: 2.1.x only */
-#define IP_FW_F_MASK 0x003F /* All possible flag bits mask */
-
-/* Values for "fw_invflg" field. */
-#define IP_FW_INV_SRCIP 0x0001 /* Invert the sense of fw_src. */
-#define IP_FW_INV_DSTIP 0x0002 /* Invert the sense of fw_dst. */
-#define IP_FW_INV_PROTO 0x0004 /* Invert the sense of fw_proto. */
-#define IP_FW_INV_SRCPT 0x0008 /* Invert the sense of source ports. */
-#define IP_FW_INV_DSTPT 0x0010 /* Invert the sense of destination ports. */
-#define IP_FW_INV_VIA 0x0020 /* Invert the sense of fw_vianame. */
-#define IP_FW_INV_SYN 0x0040 /* Invert the sense of IP_FW_F_TCPSYN. */
-#define IP_FW_INV_FRAG 0x0080 /* Invert the sense of IP_FW_F_FRAG. */
-
-/*
- * New IP firewall options for [gs]etsockopt at the RAW IP level.
- * Unlike BSD Linux inherits IP options so you don't have to use
- * a raw socket for this. Instead we check rights in the calls. */
-
-#define IP_FW_BASE_CTL 64 /* base for firewall socket options */
-
-#define IP_FW_APPEND (IP_FW_BASE_CTL) /* Takes ip_fwchange */
-#define IP_FW_REPLACE (IP_FW_BASE_CTL+1) /* Takes ip_fwnew */
-#define IP_FW_DELETE_NUM (IP_FW_BASE_CTL+2) /* Takes ip_fwdelnum */
-#define IP_FW_DELETE (IP_FW_BASE_CTL+3) /* Takes ip_fwchange */
-#define IP_FW_INSERT (IP_FW_BASE_CTL+4) /* Takes ip_fwnew */
-#define IP_FW_FLUSH (IP_FW_BASE_CTL+5) /* Takes ip_chainlabel */
-#define IP_FW_ZERO (IP_FW_BASE_CTL+6) /* Takes ip_chainlabel */
-#define IP_FW_CHECK (IP_FW_BASE_CTL+7) /* Takes ip_fwtest */
-#define IP_FW_MASQ_TIMEOUTS (IP_FW_BASE_CTL+8) /* Takes 3 ints */
-#define IP_FW_CREATECHAIN (IP_FW_BASE_CTL+9) /* Takes ip_chainlabel */
-#define IP_FW_DELETECHAIN (IP_FW_BASE_CTL+10) /* Takes ip_chainlabel */
-#define IP_FW_POLICY (IP_FW_BASE_CTL+11) /* Takes ip_fwpolicy */
-/* Masquerade control, only 1 optname */
-
-#define IP_FW_MASQ_CTL (IP_FW_BASE_CTL+12) /* General ip_masq ctl */
-
-/* Builtin chain labels */
-#define IP_FW_LABEL_FORWARD "forward"
-#define IP_FW_LABEL_INPUT "input"
-#define IP_FW_LABEL_OUTPUT "output"
-
-/* Special targets */
-#define IP_FW_LABEL_MASQUERADE "MASQ"
-#define IP_FW_LABEL_REDIRECT "REDIRECT"
-#define IP_FW_LABEL_ACCEPT "ACCEPT"
-#define IP_FW_LABEL_BLOCK "DENY"
-#define IP_FW_LABEL_REJECT "REJECT"
-#define IP_FW_LABEL_RETURN "RETURN"
-#define IP_FW_LABEL_QUEUE "QUEUE"
-
-/* Files in /proc/net */
-#define IP_FW_PROC_CHAINS "ip_fwchains"
-#define IP_FW_PROC_CHAIN_NAMES "ip_fwnames"
-
-
-struct ip_fwpkt
-{
- struct iphdr fwp_iph; /* IP header */
- union {
- struct tcphdr fwp_tcph; /* TCP header or */
- struct udphdr fwp_udph; /* UDP header */
- struct icmphdr fwp_icmph; /* ICMP header */
- } fwp_protoh;
- struct in_addr fwp_via; /* interface address */
- char fwp_vianame[IFNAMSIZ]; /* interface name */
-};
-
-/* The argument to IP_FW_DELETE and IP_FW_APPEND */
-struct ip_fwchange
-{
- struct ip_fwuser fwc_rule;
- ip_chainlabel fwc_label;
-};
-
-/* The argument to IP_FW_CHECK. */
-struct ip_fwtest
-{
- struct ip_fwpkt fwt_packet; /* Packet to be tested */
- ip_chainlabel fwt_label; /* Block to start test in */
-};
-
-/* The argument to IP_FW_DELETE_NUM */
-struct ip_fwdelnum
-{
- __u32 fwd_rulenum;
- ip_chainlabel fwd_label;
-};
-
-/* The argument to IP_FW_REPLACE and IP_FW_INSERT */
-struct ip_fwnew
-{
- __u32 fwn_rulenum;
- struct ip_fwuser fwn_rule;
- ip_chainlabel fwn_label;
-};
-
-/* The argument to IP_FW_POLICY */
-struct ip_fwpolicy
-{
- ip_chainlabel fwp_policy;
- ip_chainlabel fwp_label;
-};
-/*
- * timeouts for ip masquerading
- */
-
-extern int ip_fw_masq_timeouts(void *, int);
-
-
-/*
- * Main firewall chains definitions and global var's definitions.
- */
-
-#ifdef __KERNEL__
-
-#include <linux/config.h>
-#include <linux/version.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
-#include <linux/init.h>
-extern void ip_fw_init(void) __init;
-#else /* 2.0.x */
-extern void ip_fw_init(void);
-#endif /* 2.1.x */
-extern int ip_fw_ctl(int, void *, int);
-#ifdef CONFIG_IP_MASQUERADE
-extern int ip_masq_uctl(int, char *, int);
-#endif
-#endif /* KERNEL */
-
-#endif /* _IP_FWCHAINS_H */
diff --git a/include/linux/ip_masq.h b/include/linux/ip_masq.h
deleted file mode 100644
index ba8931383..000000000
--- a/include/linux/ip_masq.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * IP_MASQ user space control interface
- * $Id: ip_masq.h,v 1.2 1998/12/08 05:41:48 davem Exp $
- */
-
-#ifndef _LINUX_IP_MASQ_H
-#define _LINUX_IP_MASQ_H
-
-#ifdef __KERNEL__
-#include <linux/types.h>
-#include <linux/stddef.h>
-#else
-#include <sys/types.h>
-#include <stddef.h>
-#endif
-
-struct ip_masq_user {
- int protocol;
- u_int16_t sport, dport, mport;
- u_int32_t saddr, daddr, maddr;
- u_int32_t rt_daddr; /* dst address to use for rt query */
- u_int32_t rt_saddr;
- u_int32_t ip_tos; /* TOS */
- unsigned timeout; /* in ticks (HZ per sec) */
- unsigned flags;
- int fd; /* NOT IMPL: attach tunnel to this fd */
- int state; /* NOT IMPL: return conn state */
-};
-
-#define IP_MASQ_USER_F_LISTEN 0x01 /* put entry to LISTEN state */
-#define IP_MASQ_USER_F_DEAD 0x02 /* mark as DEAD */
-#define IP_MASQ_USER_F_FORCE 0x04 /* force operation */
-
-struct ip_masq_timeout {
- int protocol;
- union {
- struct {
- unsigned established;
- unsigned syn_sent;
- unsigned syn_recv;
- unsigned fin_wait;
- unsigned time_wait;
- unsigned close;
- unsigned close_wait;
- unsigned last_ack;
- unsigned listen;
- } tcp;
- unsigned udp;
- unsigned icmp;
- } u;
-};
-
-/*
- * AUTOFW stuff
- */
-#define IP_FWD_RANGE 1
-#define IP_FWD_PORT 2
-#define IP_FWD_DIRECT 3
-
-#define IP_AUTOFW_ACTIVE 1
-#define IP_AUTOFW_USETIME 2
-#define IP_AUTOFW_SECURE 4
-
-
-/* WARNING: bitwise equal to ip_autofw in net/ip_autofw.h */
-struct ip_autofw_user {
- void * next;
- u_int16_t type;
- u_int16_t low;
- u_int16_t hidden;
- u_int16_t high;
- u_int16_t visible;
- u_int16_t protocol;
- u_int32_t lastcontact;
- u_int32_t where;
- u_int16_t ctlproto;
- u_int16_t ctlport;
- u_int16_t flags;
- /* struct timer_list timer; */
-};
-
-/*
- * PORTFW stuff
- */
-struct ip_portfw_user {
- u_int16_t protocol; /* Which protocol are we talking? */
- u_int32_t laddr, raddr; /* Remote address */
- u_int16_t lport, rport; /* Local and remote port */
- int pref; /* Preference value */
-};
-
-/*
- * MFW stuff
- */
-struct ip_mfw_user {
- u_int32_t fwmark; /* Firewalling mark */
- u_int32_t raddr; /* remote port */
- u_int16_t rport; /* remote port */
- u_int16_t dummy; /* Make up to multiple of 4 */
- int pref; /* Preference value */
- unsigned flags; /* misc flags */
-};
-
-#define IP_MASQ_MFW_SCHED 0x01
-
-#define IP_FW_MASQCTL_MAX 256
-#define IP_MASQ_TNAME_MAX 32
-
-struct ip_masq_ctl {
- int m_target;
- int m_cmd;
- char m_tname[IP_MASQ_TNAME_MAX];
- union {
- struct ip_portfw_user portfw_user;
- struct ip_autofw_user autofw_user;
- struct ip_mfw_user mfw_user;
- struct ip_masq_user user;
- unsigned char m_raw[IP_FW_MASQCTL_MAX];
- } u;
-};
-
-#define IP_MASQ_CTL_BSIZE (offsetof (struct ip_masq_ctl,u))
-
-#define IP_MASQ_TARGET_CORE 1
-#define IP_MASQ_TARGET_MOD 2 /* masq_mod is selected by "name" */
-#define IP_MASQ_TARGET_USER 3
-#define IP_MASQ_TARGET_LAST 4
-
-#define IP_MASQ_CMD_NONE 0 /* just peek */
-#define IP_MASQ_CMD_INSERT 1
-#define IP_MASQ_CMD_ADD 2
-#define IP_MASQ_CMD_SET 3
-#define IP_MASQ_CMD_DEL 4
-#define IP_MASQ_CMD_GET 5
-#define IP_MASQ_CMD_FLUSH 6
-#define IP_MASQ_CMD_LIST 7 /* actually fake: done via /proc */
-#define IP_MASQ_CMD_ENABLE 8
-#define IP_MASQ_CMD_DISABLE 9
-
-#endif /* _LINUX_IP_MASQ_H */
diff --git a/include/linux/irda.h b/include/linux/irda.h
index 275d82fc9..5d547a99f 100644
--- a/include/linux/irda.h
+++ b/include/linux/irda.h
@@ -1,12 +1,12 @@
/*********************************************************************
*
* Filename: irda.h
- * Version:
- * Description:
+ * Version: 1.0
+ * Description: Exported IrDA sockets interface
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Mar 8 14:06:12 1999
- * Modified at: Mon Mar 22 14:14:54 1999
+ * Modified at: Mon Sep 27 12:11:49 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
@@ -83,8 +83,8 @@ struct sockaddr_irda {
};
struct irda_device_info {
- unsigned int saddr; /* Address of remote device */
- unsigned int daddr; /* Link where it was discovered */
+ unsigned int saddr; /* Address of remote device */
+ unsigned int daddr; /* Link where it was discovered */
char info[22]; /* Description */
unsigned char charset; /* Charset used for description */
unsigned char hints[2]; /* Hint bits */
@@ -92,7 +92,7 @@ struct irda_device_info {
struct irda_device_list {
unsigned int len;
- struct irda_device_info dev[0];
+ struct irda_device_info dev[1];
};
struct irda_ias_set {
diff --git a/include/linux/irq.h b/include/linux/irq.h
new file mode 100644
index 000000000..4063fe743
--- /dev/null
+++ b/include/linux/irq.h
@@ -0,0 +1,79 @@
+#ifndef __irq_h
+#define __irq_h
+
+#include <asm/irq.h>
+/*
+ * IRQ line status.
+ */
+#define IRQ_INPROGRESS 1 /* IRQ handler active - do not enter! */
+#define IRQ_DISABLED 2 /* IRQ disabled - do not enter! */
+#define IRQ_PENDING 4 /* IRQ pending - replay on enable */
+#define IRQ_REPLAY 8 /* IRQ has been replayed but not acked yet */
+#define IRQ_AUTODETECT 16 /* IRQ is being autodetected */
+#define IRQ_WAITING 32 /* IRQ not yet seen - for autodetection */
+
+/*
+ * Interrupt controller descriptor. This is all we need
+ * to describe about the low-level hardware.
+ */
+struct hw_interrupt_type {
+ const char * typename;
+ unsigned int (*startup)(unsigned int irq);
+ void (*shutdown)(unsigned int irq);
+ void (*enable)(unsigned int irq);
+ void (*disable)(unsigned int irq);
+ void (*ack)(unsigned int irq);
+ void (*end)(unsigned int irq);
+};
+
+typedef struct hw_interrupt_type hw_irq_controller;
+
+/*
+ * This is the "IRQ descriptor", which contains various information
+ * about the irq, including what kind of hardware handling it has,
+ * whether it is disabled etc etc.
+ *
+ * Pad this out to 32 bytes for cache and indexing reasons.
+ */
+typedef struct {
+ unsigned int status; /* IRQ status
+ - IRQ_INPROGRESS, IRQ_DISABLED */
+ hw_irq_controller *handler; /* never derefed in arch
+ independent code */
+ struct irqaction *action; /* IRQ action list */
+ unsigned int depth; /* Disable depth for nested irq disables */
+} irq_desc_t;
+
+#include <asm/hw_irq.h> /* the arch dependent stuff */
+
+extern irq_desc_t irq_desc[NR_IRQS];
+
+extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
+extern spinlock_t irq_controller_lock;
+extern int setup_irq(unsigned int , struct irqaction * );
+
+#ifdef __SMP__
+
+#include <asm/atomic.h>
+
+static inline void irq_enter(int cpu, unsigned int irq)
+{
+ hardirq_enter(cpu);
+ while (test_bit(0,&global_irq_lock)) {
+ /* nothing */;
+ }
+}
+
+static inline void irq_exit(int cpu, unsigned int irq)
+{
+ hardirq_exit(cpu);
+}
+#else
+#define irq_enter(cpu, irq) (++local_irq_count[cpu])
+#define irq_exit(cpu, irq) (--local_irq_count[cpu])
+#endif
+
+extern hw_irq_controller no_irq_type; /* needed in every arch ? */
+
+#endif /* __asm_h */
+
diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
new file mode 100644
index 000000000..e5b426d07
--- /dev/null
+++ b/include/linux/isapnp.h
@@ -0,0 +1,185 @@
+/*
+ * ISA Plug & Play support
+ * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef LINUX_ISAPNP_H
+#define LINUX_ISAPNP_H
+
+#include <linux/config.h>
+
+/*
+ * Configuration registers (TODO: change by specification)
+ */
+
+#define ISAPNP_CFG_ACTIVATE 0x30 /* byte */
+#define ISAPNP_CFG_MEM 0x40 /* 4 * dword */
+#define ISAPNP_CFG_PORT 0x60 /* 8 * word */
+#define ISAPNP_CFG_IRQ 0x70 /* 2 * word */
+#define ISAPNP_CFG_DMA 0x74 /* 2 * byte */
+
+/*
+ *
+ */
+
+#define ISAPNP_VENDOR(a,b,c) (((((a)-'A'+1)&0x3f)<<2)|\
+ ((((b)-'A'+1)&0x18)>>3)|((((b)-'A'+1)&7)<<13)|\
+ ((((c)-'A'+1)&0x1f)<<8))
+#define ISAPNP_DEVICE(x) ((((x)&0xf000)>>8)|\
+ (((x)&0x0f00)>>8)|\
+ (((x)&0x00f0)<<8)|\
+ (((x)&0x000f)<<8))
+#define ISAPNP_FUNCTION(x) ISAPNP_DEVICE(x)
+
+/*
+ *
+ */
+
+#ifdef __KERNEL__
+
+#include <linux/pci.h>
+
+#define ISAPNP_PORT_FLAG_16BITADDR (1<<0)
+#define ISAPNP_PORT_FLAG_FIXED (1<<1)
+
+struct isapnp_port {
+ unsigned short min; /* min base number */
+ unsigned short max; /* max base number */
+ unsigned char align; /* align boundary */
+ unsigned char size; /* size of range */
+ unsigned char flags; /* port flags */
+ unsigned char pad; /* pad */
+ struct isapnp_resources *res; /* parent */
+ struct isapnp_port *next; /* next port */
+};
+
+struct isapnp_irq {
+ unsigned short map; /* bitmaks for IRQ lines */
+ unsigned char flags; /* IRQ flags */
+ unsigned char pad; /* pad */
+ struct isapnp_resources *res; /* parent */
+ struct isapnp_irq *next; /* next IRQ */
+};
+
+struct isapnp_dma {
+ unsigned char map; /* bitmask for DMA channels */
+ unsigned char flags; /* DMA flags */
+ struct isapnp_resources *res; /* parent */
+ struct isapnp_dma *next; /* next port */
+};
+
+struct isapnp_mem {
+ unsigned int min; /* min base number */
+ unsigned int max; /* max base number */
+ unsigned int align; /* align boundary */
+ unsigned int size; /* size of range */
+ unsigned char flags; /* memory flags */
+ unsigned char pad; /* pad */
+ struct isapnp_resources *res; /* parent */
+ struct isapnp_mem *next; /* next memory resource */
+};
+
+struct isapnp_mem32 {
+ /* TODO */
+ unsigned char data[17];
+ struct isapnp_resources *res; /* parent */
+ struct isapnp_mem32 *next; /* next 32-bit memory resource */
+};
+
+#define ISAPNP_RES_PRIORITY_PREFERRED 0
+#define ISAPNP_RES_PRIORITY_ACCEPTABLE 1
+#define ISAPNP_RES_PRIORITY_FUNCTIONAL 2
+#define ISAPNP_RES_PRIORITY_INVALID 65535
+
+struct isapnp_resources {
+ unsigned short priority; /* priority */
+ unsigned short dependent; /* dependent resources */
+ struct isapnp_port *port; /* first port */
+ struct isapnp_irq *irq; /* first IRQ */
+ struct isapnp_dma *dma; /* first DMA */
+ struct isapnp_mem *mem; /* first memory resource */
+ struct isapnp_mem32 *mem32; /* first 32-bit memory */
+ struct pci_dev *dev; /* parent */
+ struct isapnp_resources *alt; /* alternative resource (aka dependent resources) */
+ struct isapnp_resources *next; /* next resource */
+};
+
+#if defined(CONFIG_ISAPNP) || (defined(CONFIG_ISAPNP_MODULE) && defined(MODULE))
+
+/* lowlevel configuration */
+int isapnp_present(void);
+int isapnp_cfg_begin(int csn, int device);
+int isapnp_cfg_end(void);
+unsigned char isapnp_read_byte(unsigned char idx);
+unsigned short isapnp_read_word(unsigned char idx);
+unsigned int isapnp_read_dword(unsigned char idx);
+void isapnp_write_byte(unsigned char idx, unsigned char val);
+void isapnp_write_word(unsigned char idx, unsigned short val);
+void isapnp_write_dword(unsigned char idx, unsigned int val);
+void isapnp_wake(unsigned char csn);
+void isapnp_device(unsigned char device);
+void isapnp_activate(unsigned char device);
+void isapnp_deactivate(unsigned char device);
+/* manager */
+struct pci_bus *isapnp_find_card(unsigned short vendor,
+ unsigned short device,
+ struct pci_bus *from);
+struct pci_dev *isapnp_find_dev(struct pci_bus *card,
+ unsigned short vendor,
+ unsigned short function,
+ struct pci_dev *from);
+/* misc */
+void isapnp_resource_change(struct resource *resource,
+ unsigned long start,
+ unsigned long size);
+/* init/main.c */
+int isapnp_init(void);
+
+#else /* !CONFIG_ISAPNP */
+
+/* lowlevel configuration */
+extern inline int isapnp_present(void) { return 0; }
+extern inline int isapnp_cfg_begin(int csn, int device) { return -ENODEV; }
+extern inline int isapnp_cfg_end(void) { return -ENODEV; }
+extern inline unsigned char isapnp_read_byte(unsigned char idx) { return 0xff; }
+extern inline unsigned short isapnp_read_word(unsigned char idx) { return 0xffff; }
+extern inline unsigned int isapnp_read_dword(unsigned char idx) { return 0xffffffff; }
+extern inline void isapnp_write_byte(unsigned char idx, unsigned char val) { ; }
+extern inline void isapnp_write_word(unsigned char idx, unsigned short val) { ; }
+extern inline void isapnp_write_dword(unsigned char idx, unsigned int val) { ; }
+extern void isapnp_wake(unsigned char csn) { ; }
+extern void isapnp_device(unsigned char device) { ; }
+extern void isapnp_activate(unsigned char device) { ; }
+extern void isapnp_deactivate(unsigned char device) { ; }
+/* manager */
+extern struct pci_bus *isapnp_find_card(unsigned short vendor,
+ unsigned short device,
+ struct pci_bus *from) { return NULL; }
+extern struct pci_dev *isapnp_find_dev(struct pci_bus *card,
+ unsigned short vendor,
+ unsigned short function,
+ struct pci_dev *from) { return NULL; }
+extern void isapnp_resource_change(struct resource *resource,
+ unsigned long start,
+ unsigned long size) { ; }
+
+#endif /* CONFIG_ISAPNP */
+
+#endif /* __KERNEL__ */
+#endif /* LINUX_ISAPNP_H */
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 52e501eea..d1d7350b1 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -1,4 +1,4 @@
-/* $Id: isdn.h,v 1.64 1999/04/18 14:57:14 fritz Exp $
+/* $Id: isdn.h,v 1.71 1999/08/23 15:54:22 keil Exp $
*
* Main header for the Linux ISDN subsystem (linklevel).
*
@@ -21,6 +21,28 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdn.h,v $
+ * Revision 1.71 1999/08/23 15:54:22 keil
+ * more backported changes from kernel 2.3.14
+ *
+ * Revision 1.70 1999/07/31 12:59:58 armin
+ * Added tty fax capabilities.
+ *
+ * Revision 1.69 1999/07/13 20:47:53 werner
+ * added channel bit ISDN_USAGE_DISABLED for limiting b-channel access.
+ *
+ * Revision 1.68 1999/07/11 17:07:37 armin
+ * Added tty modem register S23.
+ * Added new layer 2 and 3 protocols for Fax and DSP functions.
+ *
+ * Revision 1.67 1999/07/07 10:17:24 detabc
+ * remove unused messages
+ *
+ * Revision 1.66 1999/07/01 08:35:37 keil
+ * compatibility to 2.3
+ *
+ * Revision 1.65 1999/06/10 11:51:27 paul
+ * fixed comment for NET_DV
+ *
* Revision 1.64 1999/04/18 14:57:14 fritz
* Removed TIMRU stuff
*
@@ -66,26 +88,6 @@
* brute force fix to avoid Ugh's in isdn_tty_write()
* cleaned up some dead code
*
- * Revision 1.52 1998/06/12 11:42:18 detabc
- * cleanup abc
- *
- * Revision 1.51 1998/06/02 12:10:30 detabc
- * wegen einer einstweiliger verfuegung gegen DW ist zur zeit
- * die abc-extension bis zur klaerung der rechtslage nicht verfuegbar
- *
- * Revision 1.50 1998/05/05 23:11:51 detabc
- * add Item to stop icmp-unreach (max. 6 times of dialwait delay)
- *
- * Revision 1.49 1998/05/03 17:45:00 detabc
- * Add Item to send icmp-host-unreach to all packets
- *
- * Revision 1.48 1998/04/26 19:58:14 detabc
- * include the new abc-extension-items from 2.0.xx kernels
- * remove some unused code
- *
- * Revision 1.47 1998/04/21 18:00:25 detabc
- * Add items for secure-callback (abc-extension only)
- *
* Revision 1.46 1998/04/14 16:28:59 he
* Fixed user space access with interrupts off and remaining
* copy_{to,from}_user() -> -EFAULT return codes
@@ -100,12 +102,6 @@
* Revision 1.43 1998/03/09 17:46:44 he
* merged in 2.1.89 changes
*
- * Revision 1.42 1998/03/08 13:53:46 detabc
- * add ABC-variables in structur isdn_devt
- *
- * Revision 1.41 1998/03/08 13:14:37 detabc
- * abc-extension support for kernels > 2.1.x
- * first try (sorry experimental)
*
* Revision 1.40 1998/03/08 01:08:29 fritz
* Increased NET_DV because of TIMRU
@@ -254,6 +250,7 @@
#ifndef isdn_h
#define isdn_h
+#include <linux/isdn_compat.h>
#include <linux/config.h>
#include <linux/ioctl.h>
@@ -333,10 +330,11 @@
#define ISDN_USAGE_VOICE 4
#define ISDN_USAGE_FAX 5
#define ISDN_USAGE_MASK 7 /* Mask to get plain usage */
+#define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */
#define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
#define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */
-#define ISDN_MODEM_ANZREG 23 /* Number of Modem-Registers */
+#define ISDN_MODEM_ANZREG 24 /* Number of Modem-Registers */
#define ISDN_MSNLEN 20
#define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */
#define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */
@@ -358,9 +356,9 @@ typedef struct {
int outgoing;
} isdn_net_ioctl_phone;
-#define NET_DV 0x05 /* Data version for net_cfg */
-#define TTY_DV 0x05 /* Data version for iprofd etc. */
-#define INF_DV 0x01 /* Data version for /dev/isdninfo */
+#define NET_DV 0x05 /* Data version for isdn_net_ioctl_cfg */
+#define TTY_DV 0x05 /* Data version for iprofd etc. */
+#define INF_DV 0x01 /* Data version for /dev/isdninfo */
typedef struct {
char name[10]; /* Name of interface */
@@ -464,6 +462,7 @@ typedef struct {
#define USG_MODEM(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM)
#define USG_VOICE(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE)
#define USG_NET(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_NET)
+#define USG_FAX(x) ((x & ISDN_USAGE_MASK)==ISDN_USAGE_FAX)
#define USG_OUTGOING(x) ((x & ISDN_USAGE_OUTGOING)==ISDN_USAGE_OUTGOING)
#define USG_MODEMORVOICE(x) (((x & ISDN_USAGE_MASK)==ISDN_USAGE_MODEM) || \
((x & ISDN_USAGE_MASK)==ISDN_USAGE_VOICE) )
@@ -581,13 +580,13 @@ typedef struct isdn_net_local_s {
ulong sqfull_stamp; /* Start-Time of overload */
ulong slavedelay; /* Dynamic bundling delaytime */
int triggercps; /* BogoCPS needed for trigger slave */
- struct device *srobin; /* Ptr to Master device for slaves */
+ struct net_device *srobin; /* Ptr to Master device for slaves */
isdn_net_phone *phone[2]; /* List of remote-phonenumbers */
/* phone[0] = Incoming Numbers */
/* phone[1] = Outgoing Numbers */
isdn_net_phone *dial; /* Pointer to dialed number */
- struct device *master; /* Ptr to Master device for slaves */
- struct device *slave; /* Ptr to Slave device for masters */
+ struct net_device *master; /* Ptr to Master device for slaves */
+ struct net_device *slave; /* Ptr to Slave device for masters */
struct isdn_net_local_s *next; /* Ptr to next link in bundle */
struct isdn_net_local_s *last; /* Ptr to last link in bundle */
struct isdn_net_dev_s *netdev; /* Ptr to netdev */
@@ -599,7 +598,7 @@ typedef struct isdn_net_local_s {
struct hh_cache *hh);
/* Ptr to orig. header_cache_update */
void (*org_hcu)(struct hh_cache *,
- struct device *,
+ struct net_device *,
unsigned char *);
int pppbind; /* ippp device for bindings */
int dialtimeout; /* How long shall we try on dialing? (jiffies) */
@@ -620,7 +619,7 @@ typedef struct isdn_net_dev_s {
isdn_net_local *local;
isdn_net_local *queue;
void *next; /* Pointer to next isdn-interface */
- struct device dev; /* interface to upper levels */
+ struct net_device dev; /* interface to upper levels */
#ifdef CONFIG_ISDN_PPP
struct mpqueue *mp_last;
struct ippp_bundle ib;
@@ -736,15 +735,19 @@ typedef struct modem_info {
void *dtmf_state; /* state for dtmf decoder */
void *silence_state; /* state for silence detection */
#endif
+#ifdef CONFIG_ISDN_TTY_FAX
+ struct T30_s *fax; /* T30 Fax Group 3 data/interface */
+ int faxonline; /* Fax-channel status */
+#endif
struct tty_struct *tty; /* Pointer to corresponding tty */
atemu emu; /* AT-emulator data */
struct termios normal_termios; /* For saving termios structs */
struct termios callout_termios;
-#if LINUX_VERSION_CODE < 131841
+#ifdef COMPAT_HAS_NEW_WAITQ
+ wait_queue_head_t open_wait, close_wait;
+#else
struct wait_queue *open_wait;
struct wait_queue *close_wait;
-#else
- wait_queue_head_t open_wait, close_wait;
#endif
struct semaphore write_sem;
} modem_info;
@@ -806,10 +809,10 @@ typedef struct isdn_module {
int (*command)(isdn_ctrl *);
int (*receive_callback)(int, int, struct sk_buff *);
int (*writebuf_skb)(int, int, int, struct sk_buff *);
- int (*net_start_xmit)(struct sk_buff *, struct device *);
- int (*net_receive)(struct device *, struct sk_buff *);
- int (*net_open)(struct device *);
- int (*net_close)(struct device *);
+ int (*net_start_xmit)(struct sk_buff *, struct net_device *);
+ int (*net_receive)(struct net_device *, struct sk_buff *);
+ int (*net_open)(struct net_device *);
+ int (*net_close)(struct net_device *);
int priority;
} isdn_module;
@@ -823,10 +826,10 @@ typedef struct {
ulong flags; /* Misc driver Flags */
int locks; /* Number of locks for this driver */
int channels; /* Number of channels */
-#if LINUX_VERSION_CODE < 131841
- struct wait_queue *st_waitq; /* Wait-Queue for status-read's */
-#else
+#ifdef COMPAT_HAS_NEW_WAITQ
wait_queue_head_t st_waitq; /* Wait-Queue for status-read's */
+#else
+ struct wait_queue *st_waitq; /* Wait-Queue for status-read's */
#endif
int maxbufsize; /* Maximum Buffersize supported */
unsigned long pktcount; /* Until now: unused */
@@ -838,12 +841,12 @@ typedef struct {
unsigned long DLEflag; /* Flags: Insert DLE at next read */
#endif
struct sk_buff_head *rpqueue; /* Pointers to start of Rcv-Queue */
-#if LINUX_VERSION_CODE < 131841
- struct wait_queue **rcv_waitq; /* Wait-Queues for B-Channel-Reads */
- struct wait_queue **snd_waitq; /* Wait-Queue for B-Channel-Send's */
-#else
+#ifdef COMPAT_HAS_NEW_WAITQ
wait_queue_head_t *rcv_waitq; /* Wait-Queues for B-Channel-Reads */
wait_queue_head_t *snd_waitq; /* Wait-Queue for B-Channel-Send's */
+#else
+ struct wait_queue **rcv_waitq; /* Wait-Queues for B-Channel-Reads */
+ struct wait_queue **snd_waitq; /* Wait-Queue for B-Channel-Send's */
#endif
char msn2eaz[10][ISDN_MSNLEN]; /* Mapping-Table MSN->EAZ */
} driver;
@@ -860,10 +863,10 @@ typedef struct isdn_devt {
/* see ISDN_TIMER_..defines */
int global_flags;
infostruct *infochain; /* List of open info-devs. */
-#if LINUX_VERSION_CODE < 131841
- struct wait_queue *info_waitq; /* Wait-Queue for isdninfo */
-#else
+#ifdef COMPAT_HAS_NEW_WAITQ
wait_queue_head_t info_waitq; /* Wait-Queue for isdninfo */
+#else
+ struct wait_queue *info_waitq; /* Wait-Queue for isdninfo */
#endif
struct timer_list timer; /* Misc.-function Timer */
int chanmap[ISDN_MAX_CHANNELS];/* Map minor->device-channel */
diff --git a/include/linux/isdn_budget.h b/include/linux/isdn_budget.h
deleted file mode 100644
index 2eacceacf..000000000
--- a/include/linux/isdn_budget.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* isdn_budget.h
- *
- * Linux ISDN subsystem, budget-accounting for network interfaces.
- *
- * Copyright 1997 by Christian Lademann <cal@zls.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-/*
-30.06.97:cal:angelegt
-04.11.97:cal:budget.period: int --> time_t
-*/
-
-#ifndef __isdn_budget_h__
-#define __isdn_budget_h__
-
-#include <linux/types.h>
-
-#define ISDN_BUDGET_DIAL 0
-#define ISDN_BUDGET_CHARGE 1
-#define ISDN_BUDGET_ONLINE 2
-#define ISDN_BUDGET_NUM_BUDGET 3
-
-#define ISDN_BUDGET_INIT 0
-#define ISDN_BUDGET_CHECK_DIAL 1
-#define ISDN_BUDGET_CHECK_CHARGE 2
-#define ISDN_BUDGET_CHECK_ONLINE 3
-#define ISDN_BUDGET_START_ONLINE 10
-
-#define ISDN_BUDGET_SET_BUDGET 0
-#define ISDN_BUDGET_GET_BUDGET 1
-
-typedef struct {
- char name [9]; /* Interface */
- int command, /* subcommand */
- budget, /* budget-nr. */
- amount, /* set/get budget-amount */
- used; /* set/get used amount */
- time_t period, /* set/get length of period */
- period_started; /* set/get startpoint of period */
-} isdn_ioctl_budget;
-
-#ifdef __KERNEL__
-extern int isdn_net_budget(int, struct device *);
-extern int isdn_budget_ioctl(isdn_ioctl_budget *);
-#endif /* __KERNEL__ */
-
-#endif /* __isdn_budget_h__ */
diff --git a/include/linux/isdn_compat.h b/include/linux/isdn_compat.h
new file mode 100644
index 000000000..7750f6303
--- /dev/null
+++ b/include/linux/isdn_compat.h
@@ -0,0 +1,116 @@
+#ifdef __KERNEL__
+/* Compatibility for various Linux kernel versions */
+
+#ifndef _LINUX_ISDN_COMPAT_H
+#define _LINUX_ISDN_COMPAT_H
+
+#ifndef LINUX_VERSION_CODE
+#include <linux/version.h>
+#endif
+
+#ifndef KERNEL_VERSION
+#define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
+#include <linux/mm.h>
+
+#define ioremap vremap
+#define ioremap_nocache vremap
+#define iounmap vfree
+
+static inline unsigned long copy_from_user(void *to, const void *from, unsigned long n)
+{
+ int i;
+ if ((i = verify_area(VERIFY_READ, from, n)) != 0)
+ return i;
+ memcpy_fromfs(to, from, n);
+ return 0;
+}
+
+static inline unsigned long copy_to_user(void *to, const void *from, unsigned long n)
+{
+ int i;
+ if ((i = verify_area(VERIFY_WRITE, to, n)) != 0)
+ return i;
+ memcpy_tofs(to, from, n);
+ return 0;
+}
+
+#define GET_USER(x, addr) ( x = get_user(addr) )
+#ifdef __alpha__ /* needed for 2.0.x with alpha-patches */
+#define RWTYPE long
+#define LSTYPE long
+#define RWARG unsigned long
+#else
+#define RWTYPE int
+#define LSTYPE int
+#define RWARG int
+#endif
+#define LSARG off_t
+#else
+#include <asm/uaccess.h>
+#define GET_USER get_user
+#define PUT_USER put_user
+#define RWTYPE long
+#define LSTYPE long long
+#define RWARG unsigned long
+#define LSARG long long
+#endif /* LINUX_VERSION_CODE */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,15)
+#define SET_SKB_FREE(x) ( x->free = 1 )
+#define idev_kfree_skb(a,b) dev_kfree_skb(a,b)
+#else
+#define SET_SKB_FREE(x)
+#define idev_kfree_skb(a,b) dev_kfree_skb(a)
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,18)
+#define COMPAT_HAS_NEW_SYMTAB
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,31)
+#define CLOSETYPE void
+#define CLOSEVAL
+#else
+#define CLOSETYPE int
+#define CLOSEVAL (0)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,37)
+#define test_and_clear_bit clear_bit
+#define test_and_set_bit set_bit
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,81)
+#define kstat_irqs( PAR ) kstat.interrupts[PAR]
+#endif
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,1,91)
+#define COMPAT_HAS_NEW_PCI
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13)
+#define get_pcibase(ps, nr) ps->base_address[nr]
+#else
+#define get_pcibase(ps, nr) ps->resource[nr].start
+#endif
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,127)
+#define schedule_timeout(a) current->timeout = jiffies + (a); schedule ();
+#endif
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,0)
+#define COMPAT_HAS_NEW_WAITQ
+#endif
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,12)
+#define COMPAT_HAS_NEW_SETUP
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,14)
+#define net_device device
+#endif
+
+#endif /* __KERNEL__ */
+#endif /* _LINUX_ISDN_COMPAT_H */
diff --git a/include/linux/isdn_divertif.h b/include/linux/isdn_divertif.h
new file mode 100644
index 000000000..2892d0218
--- /dev/null
+++ b/include/linux/isdn_divertif.h
@@ -0,0 +1,62 @@
+/*
+ * $Id: isdn_divertif.h,v 1.3 1999/07/05 20:22:00 werner Exp $
+ *
+ * Header for the diversion supplementary interface for i4l.
+ *
+ * Copyright 1998 by Werner Cornelius (werner@isdn4linux.de)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Log: isdn_divertif.h,v $
+ * Revision 1.3 1999/07/05 20:22:00 werner
+ * changes to use diversion sources for all kernel versions.
+ * removed static device, only proc filesystem used
+ *
+ * Revision 1.2 1999/07/04 21:38:38 werner
+ * ported from kernel version 2.0
+ *
+ *
+ */
+
+
+/***********************************************************/
+/* magic value is also used to control version information */
+/***********************************************************/
+#define DIVERT_IF_MAGIC 0x25873401
+#define DIVERT_CMD_REG 0x00 /* register command */
+#define DIVERT_CMD_REL 0x01 /* release command */
+#define DIVERT_NO_ERR 0x00 /* return value no error */
+#define DIVERT_CMD_ERR 0x01 /* invalid cmd */
+#define DIVERT_VER_ERR 0x02 /* magic/version invalid */
+#define DIVERT_REG_ERR 0x03 /* module already registered */
+#define DIVERT_REL_ERR 0x04 /* module not registered */
+#define DIVERT_REG_NAME isdn_register_divert
+
+/***************************************************************/
+/* structure exchanging data between isdn hl and divert module */
+/***************************************************************/
+typedef struct
+ { ulong if_magic; /* magic info and version */
+ int cmd; /* command */
+ int (*stat_callback)(isdn_ctrl *); /* supplied by divert module when calling */
+ int (*ll_cmd)(isdn_ctrl *); /* supplied by hl on return */
+ char * (*drv_to_name)(int); /* map a driver id to name, supplied by hl */
+ int (*name_to_drv)(char *); /* map a driver id to name, supplied by hl */
+ } isdn_divert_if;
+
+/*********************/
+/* function register */
+/*********************/
+extern int DIVERT_REG_NAME(isdn_divert_if *);
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index 39c63d5cb..9ca7dc7cd 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -4,6 +4,7 @@
#define _LINUX_ISDN_PPP_H
#include <linux/config.h>
+#include <linux/isdn_compat.h>
#define CALLTYPE_INCOMING 0x1
#define CALLTYPE_OUTGOING 0x2
@@ -206,10 +207,10 @@ struct ippp_struct {
struct ippp_buf_queue rq[NUM_RCV_BUFFS]; /* packet queue for isdn_ppp_read() */
struct ippp_buf_queue *first; /* pointer to (current) first packet */
struct ippp_buf_queue *last; /* pointer to (current) last used packet in queue */
-#if LINUX_VERSION_CODE < 131841
- struct wait_queue *wq;
-#else
+#ifdef COMPAT_HAS_NEW_WAITQ
wait_queue_head_t wq;
+#else
+ struct wait_queue *wq;
#endif
struct task_struct *tk;
unsigned int mpppcfg;
@@ -237,6 +238,4 @@ struct ippp_struct {
};
#endif /* __KERNEL__ */
-
#endif /* _LINUX_ISDN_PPP_H */
-
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index 5f1fcacaa..06206eb91 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -1,4 +1,4 @@
-/* $Id: isdnif.h,v 1.25 1998/06/17 19:51:55 he Exp $
+/* $Id: isdnif.h,v 1.30 1999/08/23 15:54:29 keil Exp $
*
* Linux ISDN subsystem
*
@@ -22,6 +22,22 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnif.h,v $
+ * Revision 1.30 1999/08/23 15:54:29 keil
+ * more backported changes from kernel 2.3.14
+ *
+ * Revision 1.29 1999/07/31 13:00:02 armin
+ * Added tty fax capabilities.
+ *
+ * Revision 1.28 1999/07/13 20:57:48 werner
+ * added callback ISDN_STAT_DISCH for limiting b-channel resources.
+ *
+ * Revision 1.27 1999/07/11 17:07:39 armin
+ * Added tty modem register S23.
+ * Added new layer 2 and 3 protocols for Fax and DSP functions.
+ *
+ * Revision 1.26 1999/07/01 08:35:44 keil
+ * compatibility to 2.3
+ *
* Revision 1.25 1998/06/17 19:51:55 he
* merged with 2.1.10[34] (cosmetics and udelay() -> mdelay())
* brute force fix to avoid Ugh's in isdn_tty_write()
@@ -121,6 +137,9 @@
#ifndef isdnif_h
#define isdnif_h
+#include <linux/config.h>
+#include <linux/isdn_compat.h>
+
/*
* Values for general protocol-selection
*/
@@ -145,18 +164,105 @@
#define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */
#define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */
#define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */
+#define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */
#define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */
/*
* Values for Layer-3-protocol-selection
*/
#define ISDN_PROTO_L3_TRANS 0 /* Transparent */
+#define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */
+#define ISDN_PROTO_L3_FAX 2 /* Fax Group 2/3 */
#define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */
#ifdef __KERNEL__
#include <linux/skbuff.h>
+/***************************************************************************/
+/* Extensions made by Werner Cornelius (werner@ikt.de) */
+/* */
+/* The proceed command holds a incoming call in a state to leave processes */
+/* enough time to check whether ist should be accepted. */
+/* The PROT_IO Command extends the interface to make protocol dependant */
+/* features available (call diversion, call waiting...). */
+/* */
+/* The PROT_IO Command is executed with the desired driver id and the arg */
+/* parameter coded as follows: */
+/* The lower 8 bits of arg contain the desired protocol from ISDN_PTYPE */
+/* definitions. The upper 24 bits represent the protocol specific cmd/stat.*/
+/* Any additional data is protocol and command specific. */
+/* This mechanism also applies to the statcallb callback STAT_PROT. */
+/* */
+/* This suggested extension permits an easy expansion of protocol specific */
+/* handling. Extensions may be added at any time without changing the HL */
+/* driver code and not getting conflicts without certifications. */
+/* The well known CAPI 2.0 interface handles such extensions in a similar */
+/* way. Perhaps a protocol specific module may be added and separately */
+/* loaded and linked to the basic isdn module for handling. */
+/***************************************************************************/
+
+/*****************/
+/* DSS1 commands */
+/*****************/
+#define DSS1_CMD_INVOKE ((0x00 << 8) | ISDN_PTYPE_EURO) /* invoke a supplementary service */
+#define DSS1_CMD_INVOKE_ABORT ((0x01 << 8) | ISDN_PTYPE_EURO) /* abort a invoke cmd */
+
+/*******************************/
+/* DSS1 Status callback values */
+/*******************************/
+#define DSS1_STAT_INVOKE_RES ((0x80 << 8) | ISDN_PTYPE_EURO) /* Result for invocation */
+#define DSS1_STAT_INVOKE_ERR ((0x81 << 8) | ISDN_PTYPE_EURO) /* Error Return for invocation */
+#define DSS1_STAT_INVOKE_BRD ((0x82 << 8) | ISDN_PTYPE_EURO) /* Deliver invoke broadcast info */
+
+
+/*********************************************************************/
+/* structures for DSS1 commands and callback */
+/* */
+/* An action is invoked by sending a DSS1_CMD_INVOKE. The ll_id, proc*/
+/* timeout, datalen and data fields must be set before calling. */
+/* */
+/* The return value is a positive hl_id value also delivered in the */
+/* hl_id field. A value of zero signals no more left hl_id capacitys.*/
+/* A negative return value signals errors in LL. So if the return */
+/* value is <= 0 no action in LL will be taken -> request ignored */
+/* */
+/* The timeout field must be filled with a positive value specifying */
+/* the amount of time the INVOKED process waits for a reaction from */
+/* the network. */
+/* If a response (either error or result) is received during this */
+/* intervall, a reporting callback is initiated and the process will */
+/* be deleted, the hl identifier will be freed. */
+/* If no response is received during the specified intervall, a error*/
+/* callback is initiated with timeout set to -1 and a datalen set */
+/* to 0. */
+/* If timeout is set to a value <= 0 during INVOCATION the process is*/
+/* immediately deleted after sending the data. No callback occurs ! */
+/* */
+/* A currently waiting process may be aborted with INVOKE_ABORT. No */
+/* callback will occur when a process has been aborted. */
+/* */
+/* Broadcast invoke frames from the network are reported via the */
+/* STAT_INVOKE_BRD callback. The ll_id is set to 0, the other fields */
+/* are supplied by the network and not by the HL. */
+/*********************************************************************/
+typedef struct
+ { ulong ll_id; /* ID supplied by LL when executing */
+ /* a command and returned by HL for */
+ /* INVOKE_RES and INVOKE_ERR */
+ int hl_id; /* ID supplied by HL when called */
+ /* for executing a cmd and delivered */
+ /* for results and errors */
+ /* must be supplied by LL when aborting*/
+ int proc; /* invoke procedure used by CMD_INVOKE */
+ /* returned by callback and broadcast */
+ int timeout; /* timeout for INVOKE CMD in ms */
+ /* -1 in stat callback when timed out */
+ /* error value when error callback */
+ int datalen; /* length of cmd or stat data */
+ u_char *data;/* pointer to data delivered or send */
+ } dss1_cmd_stat;
+
/*
* Commands from linklevel to lowlevel
*
@@ -179,7 +285,13 @@
#define ISDN_CMD_UNLOCK 15 /* Release usage-lock */
#define ISDN_CMD_SUSPEND 16 /* Suspend connection */
#define ISDN_CMD_RESUME 17 /* Resume connection */
-#define CAPI_PUT_MESSAGE 18 /* CAPI message send down or up */
+#define ISDN_CMD_PROCEED 18 /* Proceed with call establishment */
+#define ISDN_CMD_ALERT 19 /* Alert after Proceeding */
+#define ISDN_CMD_REDIR 20 /* Redir a incoming call */
+#define ISDN_CMD_PROT_IO 21 /* Protocol specific commands */
+#define CAPI_PUT_MESSAGE 22 /* CAPI message send down or up */
+#define ISDN_CMD_FAXCMD 23 /* FAX commands to HL-driver */
+#define ISDN_CMD_AUDIO 24 /* DSP, DTMF, ... settings */
/*
* Status-Values delivered from lowlevel to linklevel via
@@ -201,7 +313,20 @@
#define ISDN_STAT_NODCH 268 /* Signal no D-Channel */
#define ISDN_STAT_ADDCH 269 /* Add more Channels */
#define ISDN_STAT_CAUSE 270 /* Cause-Message */
-#define ISDN_STAT_L1ERR 271 /* Signal Layer-1 Error */
+#define ISDN_STAT_ICALLW 271 /* Incoming call without B-chan waiting */
+#define ISDN_STAT_REDIR 272 /* Redir result */
+#define ISDN_STAT_PROT 273 /* protocol IO specific callback */
+#define ISDN_STAT_DISPLAY 274 /* deliver a received display message */
+#define ISDN_STAT_L1ERR 275 /* Signal Layer-1 Error */
+#define ISDN_STAT_FAXIND 276 /* FAX indications from HL-driver */
+#define ISDN_STAT_AUDIO 277 /* DTMF, DSP indications */
+#define ISDN_STAT_DISCH 278 /* Disable/Enable channel usage */
+
+/*
+ * Audio commands
+ */
+#define ISDN_AUDIO_SETDD 0 /* Set DTMF detection */
+#define ISDN_AUDIO_DTMF 1 /* Rx/Tx DTMF */
/*
* Values for errcode field
@@ -224,12 +349,15 @@
#define ISDN_FEATURE_L2_V11019 (0x0001 << ISDN_PROTO_L2_V11019)
#define ISDN_FEATURE_L2_V11038 (0x0001 << ISDN_PROTO_L2_V11038)
#define ISDN_FEATURE_L2_MODEM (0x0001 << ISDN_PROTO_L2_MODEM)
+#define ISDN_FEATURE_L2_FAX (0x0001 << ISDN_PROTO_L2_FAX)
#define ISDN_FEATURE_L2_MASK (0x0FFFF) /* Max. 16 protocols */
#define ISDN_FEATURE_L2_SHIFT (0)
/* Layer 3 */
#define ISDN_FEATURE_L3_TRANS (0x10000 << ISDN_PROTO_L3_TRANS)
+#define ISDN_FEATURE_L3_TRANSDSP (0x10000 << ISDN_PROTO_L3_TRANSDSP)
+#define ISDN_FEATURE_L3_FAX (0x10000 << ISDN_PROTO_L3_FAX)
#define ISDN_FEATURE_L3_MASK (0x0FF0000) /* Max. 8 Protocols */
#define ISDN_FEATURE_L3_SHIFT (16)
@@ -252,6 +380,84 @@ typedef struct setup_parm {
unsigned char screen; /* Screening info */
} setup_parm;
+
+#ifdef CONFIG_ISDN_TTY_FAX
+/* T.30 Fax G3 */
+
+#define FAXIDLEN 21
+
+typedef struct T30_s {
+ /* session parameters */
+ __u8 resolution __attribute__ ((packed));
+ __u8 rate __attribute__ ((packed));
+ __u8 width __attribute__ ((packed));
+ __u8 length __attribute__ ((packed));
+ __u8 compression __attribute__ ((packed));
+ __u8 ecm __attribute__ ((packed));
+ __u8 binary __attribute__ ((packed));
+ __u8 scantime __attribute__ ((packed));
+ __u8 id[FAXIDLEN] __attribute__ ((packed));
+ /* additional parameters */
+ __u8 phase __attribute__ ((packed));
+ __u8 direction __attribute__ ((packed));
+ __u8 code __attribute__ ((packed));
+ __u8 badlin __attribute__ ((packed));
+ __u8 badmul __attribute__ ((packed));
+ __u8 bor __attribute__ ((packed));
+ __u8 fet __attribute__ ((packed));
+ __u8 pollid[FAXIDLEN] __attribute__ ((packed));
+ __u8 cq __attribute__ ((packed));
+ __u8 cr __attribute__ ((packed));
+ __u8 ctcrty __attribute__ ((packed));
+ __u8 minsp __attribute__ ((packed));
+ __u8 phcto __attribute__ ((packed));
+ __u8 rel __attribute__ ((packed));
+ __u8 nbc __attribute__ ((packed));
+ /* remote station parameters */
+ __u8 r_resolution __attribute__ ((packed));
+ __u8 r_rate __attribute__ ((packed));
+ __u8 r_width __attribute__ ((packed));
+ __u8 r_length __attribute__ ((packed));
+ __u8 r_compression __attribute__ ((packed));
+ __u8 r_ecm __attribute__ ((packed));
+ __u8 r_binary __attribute__ ((packed));
+ __u8 r_scantime __attribute__ ((packed));
+ __u8 r_id[FAXIDLEN] __attribute__ ((packed));
+ __u8 r_code __attribute__ ((packed));
+} T30_s;
+
+#define ISDN_TTY_FAX_CONN_IN 0
+#define ISDN_TTY_FAX_CONN_OUT 1
+
+#define ISDN_TTY_FAX_FCON 0
+#define ISDN_TTY_FAX_DIS 1
+#define ISDN_TTY_FAX_FTT 2
+#define ISDN_TTY_FAX_MCF 3
+#define ISDN_TTY_FAX_DCS 4
+#define ISDN_TTY_FAX_TRAIN_OK 5
+#define ISDN_TTY_FAX_EOP 6
+#define ISDN_TTY_FAX_EOM 7
+#define ISDN_TTY_FAX_MPS 8
+#define ISDN_TTY_FAX_DTC 9
+#define ISDN_TTY_FAX_RID 10
+#define ISDN_TTY_FAX_HNG 11
+#define ISDN_TTY_FAX_DT 12
+#define ISDN_TTY_FAX_FCON_I 13
+#define ISDN_TTY_FAX_DR 14
+#define ISDN_TTY_FAX_ET 15
+#define ISDN_TTY_FAX_CFR 16
+#define ISDN_TTY_FAX_PTS 17
+#define ISDN_TTY_FAX_SENT 18
+
+#define ISDN_FAX_PHASE_IDLE 0
+#define ISDN_FAX_PHASE_A 1
+#define ISDN_FAX_PHASE_B 2
+#define ISDN_FAX_PHASE_C 3
+#define ISDN_FAX_PHASE_D 4
+#define ISDN_FAX_PHASE_E 5
+
+#endif /* TTY_FAX */
+
/* CAPI structs */
/* this is compatible to the old union size */
@@ -274,22 +480,26 @@ typedef struct {
__u8 para[MAX_CAPI_PARA_LEN];
} capi_msg;
-
/*
* Structure for exchanging above infos
*
*/
typedef struct {
- int driver; /* Lowlevel-Driver-ID */
- int command; /* Command or Status (see above) */
- ulong arg; /* Additional Data */
- union {
- ulong errcode; /* Type of error with STAT_L1ERR */
- int length; /* Amount of bytes sent with STAT_BSENT */
- u_char num[50]; /* Additional Data */
- setup_parm setup; /* For SETUP msg */
- capi_msg cmsg; /* For CAPI like messages */
- } parm;
+ int driver; /* Lowlevel-Driver-ID */
+ int command; /* Command or Status (see above) */
+ ulong arg; /* Additional Data */
+ union {
+ ulong errcode; /* Type of error with STAT_L1ERR */
+ int length; /* Amount of bytes sent with STAT_BSENT */
+ u_char num[50];/* Additional Data */
+ setup_parm setup;/* For SETUP msg */
+ capi_msg cmsg; /* For CAPI like messages */
+ char display[85];/* display message data */
+ dss1_cmd_stat dss1_io; /* DSS1 IO-parameter/result */
+#ifdef CONFIG_ISDN_TTY_FAX
+ T30_s *fax; /* Pointer to ttys fax struct */
+#endif
+ } parm;
} isdn_ctrl;
/*
@@ -410,10 +620,6 @@ typedef struct {
*
*/
extern int register_isdn(isdn_if*);
-
-#ifndef LINUX_VERSION_CODE
-#include <linux/version.h>
-#endif
#include <asm/uaccess.h>
#endif /* __KERNEL__ */
diff --git a/include/linux/isicom.h b/include/linux/isicom.h
index 7f929b895..670d72f4e 100644
--- a/include/linux/isicom.h
+++ b/include/linux/isicom.h
@@ -52,6 +52,13 @@ typedef struct {
#define ISICOM_NAME "ISICom"
/*
+ * PCI definitions
+ */
+
+ #define DEVID_COUNT 9
+ #define VENDOR_ID 0x10b5
+
+/*
* These are now officially allocated numbers
*/
@@ -129,6 +136,7 @@ struct isi_board {
unsigned short shift_count;
struct isi_port * ports;
signed char count;
+ unsigned char isa;
};
struct isi_port {
@@ -166,7 +174,7 @@ extern inline void raise_dtr(struct isi_port * port)
struct isi_board * card = port->card;
unsigned short base = card->base;
unsigned char channel = port->channel;
- short wait=300;
+ short wait=400;
while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
if (wait <= 0) {
printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr.\n");
@@ -186,7 +194,7 @@ extern inline void drop_dtr(struct isi_port * port)
struct isi_board * card = port->card;
unsigned short base = card->base;
unsigned char channel = port->channel;
- short wait=300;
+ short wait=400;
while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
if (wait <= 0) {
printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr.\n");
@@ -205,7 +213,7 @@ extern inline void raise_rts(struct isi_port * port)
struct isi_board * card = port->card;
unsigned short base = card->base;
unsigned char channel = port->channel;
- short wait=300;
+ short wait=400;
while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
if (wait <= 0) {
printk(KERN_WARNING "ISICOM: Card found busy in raise_rts.\n");
@@ -224,7 +232,7 @@ extern inline void drop_rts(struct isi_port * port)
struct isi_board * card = port->card;
unsigned short base = card->base;
unsigned char channel = port->channel;
- short wait=300;
+ short wait=400;
while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
if (wait <= 0) {
printk(KERN_WARNING "ISICOM: Card found busy in drop_rts.\n");
@@ -243,7 +251,7 @@ extern inline void raise_dtr_rts(struct isi_port * port)
struct isi_board * card = port->card;
unsigned short base = card->base;
unsigned char channel = port->channel;
- short wait=300;
+ short wait=400;
while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
if (wait <= 0) {
printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr_rts.\n");
@@ -262,7 +270,7 @@ extern inline void drop_dtr_rts(struct isi_port * port)
struct isi_board * card = port->card;
unsigned short base = card->base;
unsigned char channel = port->channel;
- short wait=300;
+ short wait=400;
while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
if (wait <= 0) {
printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr_rts.\n");
@@ -282,7 +290,7 @@ extern inline void kill_queue(struct isi_port * port, short queue)
struct isi_board * card = port->card;
unsigned short base = card->base;
unsigned char channel = port->channel;
- short wait=300;
+ short wait=400;
while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
if (wait <= 0) {
printk(KERN_WARNING "ISICOM: Card found busy in kill_queue.\n");
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index cc9831b44..e8a2709f6 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -4,7 +4,7 @@
* istallion.h -- stallion intelligent multiport serial driver.
*
* Copyright (C) 1996-1998 Stallion Technologies (support@stallion.oz.au).
- * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au).
+ * Copyright (C) 1994-1996 Greg Ungerer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -70,9 +70,15 @@ typedef struct {
long pgrp;
unsigned int rxmarkmsk;
struct tty_struct *tty;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
+ struct wait_queue *open_wait;
+ struct wait_queue *close_wait;
+ struct wait_queue *raw_wait;
+#else
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
wait_queue_head_t raw_wait;
+#endif
struct tq_struct tqhangup;
struct termios normaltermios;
struct termios callouttermios;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 73a0a689e..89bea4477 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -21,6 +21,8 @@
#define STACK_MAGIC 0xdeadbeef
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be taken immediately */
#define KERN_CRIT "<2>" /* critical conditions */
@@ -50,6 +52,8 @@ extern unsigned long simple_strtoul(const char *,char **,unsigned int);
extern long simple_strtol(const char *,char **,unsigned int);
extern int sprintf(char * buf, const char * fmt, ...);
extern int vsprintf(char *buf, const char *, va_list);
+extern int get_option(char **str, int *pint);
+extern char *get_options(char *str, int nints, int *ints);
extern int session_of_pgrp(int pgrp);
@@ -90,7 +94,9 @@ struct sysinfo {
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* swap space still available */
unsigned short procs; /* Number of current processes */
- char _f[22]; /* Pads structure to 64 bytes */
+ unsigned long totalbig; /* Total big memory size */
+ unsigned long freebig; /* Available big memory size */
+ char _f[20-2*sizeof(long)]; /* Padding: libc5 uses this.. */
};
#endif
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index cd584c1af..8c58edf5e 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -3,7 +3,7 @@
#include <asm/irq.h>
#include <linux/smp.h>
-#include <linux/tasks.h>
+#include <linux/threads.h>
/*
* 'kernel_stat.h' contains the definitions needed for doing
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index da0dea8c0..7b212be05 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -1,11 +1,30 @@
/*
- * $Id: kernelcapi.h,v 1.1 1997/03/04 21:27:33 calle Exp $
+ * $Id: kernelcapi.h,v 1.3 1999/07/01 15:26:56 calle Exp $
*
* Kernel CAPI 2.0 Interface for Linux
*
* (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
*
* $Log: kernelcapi.h,v $
+ * Revision 1.3 1999/07/01 15:26:56 calle
+ * complete new version (I love it):
+ * + new hardware independed "capi_driver" interface that will make it easy to:
+ * - support other controllers with CAPI-2.0 (i.e. USB Controller)
+ * - write a CAPI-2.0 for the passive cards
+ * - support serial link CAPI-2.0 boxes.
+ * + wrote "capi_driver" for all supported cards.
+ * + "capi_driver" (supported cards) now have to be configured with
+ * make menuconfig, in the past all supported cards where included
+ * at once.
+ * + new and better informations in /proc/capi/
+ * + new ioctl to switch trace of capi messages per controller
+ * using "avmcapictrl trace [contr] on|off|...."
+ * + complete testcircle with all supported cards and also the
+ * PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
+ *
+ * Revision 1.2 1999/06/21 15:24:26 calle
+ * extend information in /proc.
+ *
* Revision 1.1 1997/03/04 21:27:33 calle
* First version in isdn4linux
*
@@ -17,17 +36,37 @@
*
*
*/
-#ifndef __KERNEL_CAPI_H__
-#define __KERNEL_CAPI_H__
+#ifndef __KERNELCAPI_H__
+#define __KERNELCAPI_H__
#define CAPI_MAXAPPL 20 /*
* maximum number of applications
*/
-#define CAPI_MAXCONTR 4 /*
+#define CAPI_MAXCONTR 10 /*
* maximum number of controller
*/
#define CAPI_MAXDATAWINDOW 8
+
+typedef struct kcapi_flagdef {
+ int contr;
+ int flag;
+} kcapi_flagdef;
+
+/* new ioctls >= 10 */
+#define KCAPI_CMD_TRACE 10
+
+/*
+ * flag > 2 => trace also data
+ * flag & 1 => show trace
+ */
+#define KCAPI_TRACE_OFF 0
+#define KCAPI_TRACE_SHORT_NO_DATA 1
+#define KCAPI_TRACE_FULL_NO_DATA 2
+#define KCAPI_TRACE_SHORT 3
+#define KCAPI_TRACE_FULL 4
+
+
#ifdef __KERNEL__
struct capi_interface {
@@ -58,6 +97,7 @@ struct capi_interface {
struct capi_interface_user {
char name[20];
void (*callback) (unsigned int cmd, __u16 contr, void *data);
+ /* internal */
struct capi_interface_user *next;
};
@@ -93,4 +133,4 @@ int detach_capi_interface(struct capi_interface_user *);
#endif /* __KERNEL__ */
-#endif /* __KERNEL_CAPI_H__ */
+#endif /* __KERNELCAPI_H__ */
diff --git a/include/linux/limits.h b/include/linux/limits.h
index 5848688e7..51c49ec4e 100644
--- a/include/linux/limits.h
+++ b/include/linux/limits.h
@@ -1,7 +1,7 @@
#ifndef _LINUX_LIMITS_H
#define _LINUX_LIMITS_H
-#define NR_OPEN 1024
+#define NR_OPEN 1024
#define NGROUPS_MAX 32 /* supplemental group IDs are available */
#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 190202f05..b7657dd8a 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -13,6 +13,17 @@
#define asmlinkage CPP_ASMLINKAGE
#endif
+#ifdef __sh__
+#define STRINGIFY(X) #X
+#define SYMBOL_NAME_STR(X) STRINGIFY(SYMBOL_NAME(X))
+#ifdef __STDC__
+#define SYMBOL_NAME(X) _##X
+#define SYMBOL_NAME_LABEL(X) _##X##:
+#else
+#define SYMBOL_NAME(X) _/**/X
+#define SYMBOL_NAME_LABEL(X) _/**/X/**/:
+#endif
+#else
#define SYMBOL_NAME_STR(X) #X
#define SYMBOL_NAME(X) X
#ifdef __STDC__
@@ -20,6 +31,7 @@
#else
#define SYMBOL_NAME_LABEL(X) X/**/:
#endif
+#endif
#ifdef __arm__
#define __ALIGN .align 0
@@ -29,6 +41,10 @@
#define __ALIGN .align 4
#define __ALIGN_STR ".align 4"
#else
+#ifdef __sh__
+#define __ALIGN .balign 4
+#define __ALIGN_STR ".balign 4"
+#else
#if !defined(__i486__) && !defined(__i586__)
#define __ALIGN .align 4,0x90
#define __ALIGN_STR ".align 4,0x90"
@@ -36,6 +52,7 @@
#define __ALIGN .align 16,0x90
#define __ALIGN_STR ".align 16,0x90"
#endif /* __i486__/__i586__ */
+#endif /* __sh__ */
#endif /* __mc68000__ */
#endif /* __arm__ */
diff --git a/include/linux/list.h b/include/linux/list.h
index e77559a68..656aacc2a 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -17,8 +17,10 @@ struct list_head {
struct list_head *next, *prev;
};
+#define LIST_HEAD_INIT(name) { &(name), &(name) }
+
#define LIST_HEAD(name) \
- struct list_head name = { &name, &name }
+ struct list_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
@@ -49,6 +51,14 @@ static __inline__ void list_add(struct list_head *new, struct list_head *head)
}
/*
+ * Insert a new entry before the specified head..
+ */
+static __inline__ void list_add_tail(struct list_head *new, struct list_head *head)
+{
+ __list_add(new, head->prev, head);
+}
+
+/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
diff --git a/include/linux/busmouse.h b/include/linux/logibusmouse.h
index ccbf0f8b6..ccbf0f8b6 100644
--- a/include/linux/busmouse.h
+++ b/include/linux/logibusmouse.h
diff --git a/include/linux/lp_intern.h b/include/linux/lp_intern.h
deleted file mode 100644
index c7af535fb..000000000
--- a/include/linux/lp_intern.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _LINUX_LP_INTERN_H_
-#define _LINUX_LP_INTERN_H_
-
-/*
- * split in two parts by Joerg Dorchain
- * usr/include/linux/lp.h modified for Amiga by Michael Rausch
- * modified for Atari by Andreas Schwab
- * bug fixed by Jes Sorensen 18/8-94:
- * It was not possible to compile the kernel only for Atari or Amiga.
- *
- * linux i386 version c.1991-1992 James Wiegand
- * many modifications copyright (C) 1992 Michael K. Johnson
- * Interrupt support added 1993 Nigel Gamble
- */
-
-#include <linux/types.h>
-#include <linux/lp_m68k.h>
-
-int lp_internal_init(void);
-
-#endif
-
diff --git a/include/linux/lp_m68k.h b/include/linux/lp_m68k.h
deleted file mode 100644
index 22bdc5ce2..000000000
--- a/include/linux/lp_m68k.h
+++ /dev/null
@@ -1,135 +0,0 @@
-#ifndef _LINUX_LP_H
-#define _LINUX_LP_H
-
-/*
- * split in two parts by Joerg Dorchain
- * usr/include/linux/lp.h modified for Amiga by Michael Rausch
- * modified for Atari by Andreas Schwab
- * bug fixed by Jes Sorensen 18/8-94:
- * It was not possible to compile the kernel only for Atari or Amiga.
- *
- * linux i386 version c.1991-1992 James Wiegand
- * many modifications copyright (C) 1992 Michael K. Johnson
- * Interrupt support added 1993 Nigel Gamble
- */
-
-/*
- * many many printers are we going to support? currently, this is the
- * hardcoded limit
- */
-#define MAX_LP 5
-
-/*
- * Per POSIX guidelines, this module reserves the LP and lp prefixes
- * These are the lp_table[minor].flags flags...
- */
-#define LP_EXIST 0x0001
-#define LP_BUSY 0x0004
-#define LP_ABORT 0x0040
-#define LP_CAREFUL 0x0080
-#define LP_ABORTOPEN 0x0100
-
-/* timeout for each character. This is relative to bus cycles -- it
- * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you
- * have extremely slow printing, or if the machine seems to slow down
- * a lot when you print. If you have slow printing, increase this
- * number and recompile, and if your system gets bogged down, decrease
- * this number. This can be changed with the tunelp(8) command as well.
- */
-
-#define LP_INIT_CHAR 1000
-
-/* The parallel port specs apparently say that there needs to be
- * a .5usec wait before and after the strobe. Since there are wildly
- * different computers running linux, I can't come up with a perfect
- * value, but since it worked well on most printers before without,
- * I'll initialize it to 0.
- */
-
-#define LP_INIT_WAIT 0
-
-/* This is the amount of time that the driver waits for the printer to
- * catch up when the printer's buffer appears to be filled. If you
- * want to tune this and have a fast printer (i.e. HPIIIP), decrease
- * this number, and if you have a slow printer, increase this number.
- * This is in hundredths of a second, the default 2 being .05 second.
- * Or use the tunelp(8) command, which is especially nice if you want
- * change back and forth between character and graphics printing, which
- * are wildly different...
- */
-
-#define LP_INIT_TIME 40
-
-/* IOCTL numbers */
-#define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */
-#define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */
-#define LPABORT 0x0604 /* call with TRUE arg to abort on error,
- FALSE to retry. Default is retry. */
-#define LPSETIRQ 0x0605 /* call with new IRQ number,
- or 0 for polling (no IRQ) */
-#define LPGETIRQ 0x0606 /* get the current IRQ number */
-#define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */
-#define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off-
- line, and error indicators good on all writes,
- FALSE to ignore them. Default is ignore. */
-#define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error,
- FALSE to ignore error. Default is ignore. */
-#define LPGETSTATUS 0x060b /* return LP_S(minor) */
-#define LPRESET 0x060c /* reset printer */
-
-/* timeout for printk'ing a timeout, in jiffies (100ths of a second).
- This is also used for re-checking error conditions if LP_ABORT is
- not set. This is the default behavior. */
-
-#define LP_TIMEOUT_INTERRUPT (60 * HZ)
-#define LP_TIMEOUT_POLLED (10 * HZ)
-
-
-#define LP_BUFFER_SIZE 1024 /*256*/
-
-enum lp_type {
-LP_UNKNOWN = 0,
-LP_AMIGA = 1,
-LP_ATARI = 2,
-LP_MFC = 3,
-LP_IOEXT = 4,
-LP_MVME167 = 5,
-LP_BVME6000 = 6
-};
-
-/*
- * warning: this structure is in kernel space and has to fit in one page,
- * i.e. must not be larger than 4k
- */
-struct lp_struct {
- char *name;
- unsigned int irq;
- void (*lp_out)(int,int); /*output char function*/
- int (*lp_is_busy)(int);
- int (*lp_has_pout)(int);
- int (*lp_is_online)(int);
- int (*lp_dummy)(int);
- int (*lp_ioctl)(int, unsigned int, unsigned long);
- int (*lp_open)(int); /* for module use counter */
- void (*lp_release)(int); /* for module use counter */
- int flags; /*for BUSY... */
- unsigned int chars; /*busy timeout */
- unsigned int time; /*wait time */
- unsigned int wait;
- struct wait_queue_head_t lp_wait_q; /*strobe wait */
- void *base; /* hardware drivers internal use*/
- enum lp_type type;
- char lp_buffer[LP_BUFFER_SIZE];
- int do_print;
- unsigned long copy_size,bytes_written;
-};
-
-extern struct lp_struct *lp_table[MAX_LP];
-extern unsigned int lp_irq;
-
-void lp_interrupt(int dev);
-int lp_m68k_init(void);
-int register_parallel(struct lp_struct *, int);
-void unregister_parallel(int);
-
-#endif
diff --git a/include/linux/lp_mfc.h b/include/linux/lp_mfc.h
deleted file mode 100644
index cf8cfb442..000000000
--- a/include/linux/lp_mfc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _LINUX_LP_MFC_H_
-#define _LINUX_LP_MFC_H_
-
-/*
- * created 6.11.95 Joerg Dorchain
- */
-
-#include <linux/types.h>
-#include <linux/lp_m68k.h>
-
-int lp_mfc_init(void);
-
-#endif
-
diff --git a/include/linux/major.h b/include/linux/major.h
index f65e8e7dd..5af26c50d 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -63,8 +63,7 @@
#define ACSI_MAJOR 28
#define AZTECH_CDROM_MAJOR 29
#define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */
-#define SHMIQ_MAJOR 85 /* Linux/MIPS, SGI /dev/shmiq */
-#define USEMA_MAJOR 86 /* Linux/MIPS, SGI /dev/usema */
+#define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */
#define CM206_CDROM_MAJOR 32
#define IDE2_MAJOR 33
#define IDE3_MAJOR 34
@@ -76,6 +75,7 @@
#define DDV_MAJOR 39 /* AP1000 DDV block device */
#define NBD_MAJOR 43 /* Network block device */
#define RISCOM8_NORMAL_MAJOR 48
+#define DAC960_MAJOR 48 /* 48..55 */
#define RISCOM8_CALLOUT_MAJOR 49
#define MKISS_MAJOR 55
#define DSP56K_MAJOR 55 /* DSP56001 processor device */
@@ -112,9 +112,13 @@
#define IDE6_MAJOR 88
#define IDE7_MAJOR 89
+#define IDE8_MAJOR 90
+#define IDE9_MAJOR 91
#define AURORA_MAJOR 79
+#define RAW_MAJOR 162
+
#define UNIX98_PTY_MASTER_MAJOR 128
#define UNIX98_PTY_MAJOR_COUNT 8
#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
diff --git a/include/linux/mc6821.h b/include/linux/mc6821.h
new file mode 100644
index 000000000..28e301e29
--- /dev/null
+++ b/include/linux/mc6821.h
@@ -0,0 +1,51 @@
+#ifndef _MC6821_H_
+#define _MC6821_H_
+
+/*
+ * This file describes the memery mapping of the MC6821 PIA.
+ * The unions describe overlayed registers. Which of them is used is
+ * determined by bit 2 of the corresponding control register.
+ * this files expects the PIA_REG_PADWIDTH to be defined the numeric
+ * value of the register spacing.
+ *
+ * Data came from MFC-31-Developer Kit (from Ralph Seidel,
+ * zodiac@darkness.gun.de) and Motorola Data Sheet (from
+ * Richard Hirst, srh@gpt.co.uk)
+ *
+ * 6.11.95 copyright Joerg Dorchain (dorchain@mpi-sb.mpg.de)
+ *
+ */
+
+#ifndef PIA_REG_PADWIDTH
+#define PIA_REG_PADWIDTH 255
+#endif
+
+struct pia {
+ union {
+ volatile u_char pra;
+ volatile u_char ddra;
+ } ua;
+ u_char pad1[PIA_REG_PADWIDTH];
+ volatile u_char cra;
+ u_char pad2[PIA_REG_PADWIDTH];
+ union {
+ volatile u_char prb;
+ volatile u_char ddrb;
+ } ub;
+ u_char pad3[PIA_REG_PADWIDTH];
+ volatile u_char crb;
+ u_char pad4[PIA_REG_PADWIDTH];
+};
+
+#define ppra ua.pra
+#define pddra ua.ddra
+#define pprb ub.prb
+#define pddrb ub.ddrb
+
+#define PIA_C1_ENABLE_IRQ (1<<0)
+#define PIA_C1_LOW_TO_HIGH (1<<1)
+#define PIA_DDR (1<<2)
+#define PIA_IRQ2 (1<<6)
+#define PIA_IRQ1 (1<<7)
+
+#endif
diff --git a/include/linux/mca.h b/include/linux/mca.h
index 5b6a6ebf0..1604c28bc 100644
--- a/include/linux/mca.h
+++ b/include/linux/mca.h
@@ -10,7 +10,9 @@
* The information is exported to the protected code, where this
* variable is set to one in case MCA bus was detected.
*/
+#ifndef MCA_bus__is_a_macro
extern int MCA_bus;
+#endif
/* maximal number of MCA slots - actually, some machines have less, but
they all have sufficient number of POS registers to cover 8. */
diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h
index b730d20a3..dcfbca271 100644
--- a/include/linux/minix_fs.h
+++ b/include/linux/minix_fs.h
@@ -100,11 +100,11 @@ extern int minix_link(struct dentry * old_dentry, struct inode * dir, struct den
extern int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, int rdev);
extern int minix_rename(struct inode * old_dir, struct dentry *old_dentry,
struct inode * new_dir, struct dentry *new_dentry);
-extern struct inode * minix_new_inode(const struct inode * dir);
+extern struct inode * minix_new_inode(const struct inode * dir, int * error);
extern void minix_free_inode(struct inode * inode);
extern unsigned long minix_count_free_inodes(struct super_block *sb);
-extern int minix_new_block(struct super_block * sb);
-extern void minix_free_block(struct super_block * sb, int block);
+extern int minix_new_block(struct inode * inode);
+extern void minix_free_block(struct inode * inode, int block);
extern unsigned long minix_count_free_blocks(struct super_block *sb);
extern int minix_bmap(struct inode *,int);
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index e04dc1b42..edf0f0768 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -10,7 +10,7 @@
#define SUN_MOUSE_MINOR 6
#define APOLLO_MOUSE_MINOR 7
#define PC110PAD_MINOR 9
-#define MAC_MOUSE_MINOR 10
+#define ADB_MOUSE_MINOR 10
#define WATCHDOG_MINOR 130 /* Watchdog timer */
#define TEMP_MINOR 131 /* Temperature Sensor */
#define RTC_MINOR 135
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 76c3ca553..281f6838e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -6,6 +6,7 @@
#ifdef __KERNEL__
+#include <linux/config.h>
#include <linux/string.h>
extern unsigned long max_mapnr;
@@ -56,7 +57,7 @@ struct vm_area_struct {
struct vm_operations_struct * vm_ops;
unsigned long vm_offset;
struct file * vm_file;
- unsigned long vm_pte; /* shared mem */
+ void * vm_private_data; /* was vm_pte (shared mem) */
};
/*
@@ -125,10 +126,11 @@ typedef struct page {
struct page *next_hash;
atomic_t count;
unsigned long flags; /* atomic flags, some possibly updated asynchronously */
+ struct list_head lru;
wait_queue_head_t wait;
struct page **pprev_hash;
struct buffer_head * buffers;
- int owner; /* temporary debugging check */
+ void *owner; /* temporary debugging check */
} mem_map_t;
#define get_page(p) do { atomic_inc(&(p)->count); \
@@ -145,13 +147,13 @@ typedef struct page {
#define PG_error 1
#define PG_referenced 2
#define PG_uptodate 3
-#define PG_free_after 4
#define PG_decr_after 5
-#define PG_free_swap_after 6
#define PG_DMA 7
#define PG_Slab 8
#define PG_swap_cache 9
#define PG_skip 10
+#define PG_swap_entry 11
+#define PG_BIGMEM 12
/* bits 21-30 unused */
#define PG_reserved 31
@@ -167,11 +169,11 @@ typedef struct page {
do { int _ret = test_and_set_bit(PG_locked, &(page)->flags); \
if (_ret) PAGE_BUG(page); \
if (page->owner) PAGE_BUG(page); \
- page->owner = (int)current; } while (0)
+ page->owner = current; } while (0)
#define TryLockPage(page) ({ int _ret = test_and_set_bit(PG_locked, &(page)->flags); \
- if (!_ret) page->owner = (int)current; _ret; })
+ if (!_ret) page->owner = current; _ret; })
#define UnlockPage(page) do { \
- if (page->owner != (int)current) { \
+ if (page->owner != current) { \
BUG(); } page->owner = 0; \
if (!test_and_clear_bit(PG_locked, &(page)->flags)) { \
PAGE_BUG(page); } wake_up(&page->wait); } while (0)
@@ -179,9 +181,7 @@ if (!test_and_clear_bit(PG_locked, &(page)->flags)) { \
#define SetPageError(page) ({ int _ret = test_and_set_bit(PG_error, &(page)->flags); _ret; })
#define ClearPageError(page) do { if (!test_and_clear_bit(PG_error, &(page)->flags)) BUG(); } while (0)
#define PageReferenced(page) (test_bit(PG_referenced, &(page)->flags))
-#define PageFreeAfter(page) (test_bit(PG_free_after, &(page)->flags))
#define PageDecrAfter(page) (test_bit(PG_decr_after, &(page)->flags))
-#define PageSwapUnlockAfter(page) (test_bit(PG_free_swap_after, &(page)->flags))
#define PageDMA(page) (test_bit(PG_DMA, &(page)->flags))
#define PageSlab(page) (test_bit(PG_Slab, &(page)->flags))
#define PageSwapCache(page) (test_bit(PG_swap_cache, &(page)->flags))
@@ -198,6 +198,11 @@ if (!test_and_clear_bit(PG_locked, &(page)->flags)) { \
#define PageTestandClearSwapCache(page) \
(test_and_clear_bit(PG_swap_cache, &(page)->flags))
+#ifdef CONFIG_BIGMEM
+#define PageBIGMEM(page) (test_bit(PG_BIGMEM, &(page)->flags))
+#else
+#define PageBIGMEM(page) 0 /* needed to optimize away at compile time */
+#endif
/*
* Various page->flags bits:
@@ -258,8 +263,6 @@ if (!test_and_clear_bit(PG_locked, &(page)->flags)) { \
* PG_uptodate tells whether the page's contents is valid.
* When a read completes, the page becomes uptodate, unless a disk I/O
* error happened.
- * When a write completes, and PG_free_after is set, the page is
- * freed without any further delay.
*
* For choosing which pages to swap out, inode pages carry a
* PG_referenced bit, which is set any time the system accesses
@@ -292,8 +295,6 @@ extern inline unsigned long get_free_page(int gfp_mask)
return page;
}
-extern int low_on_memory;
-
/* memory.c & swap.c*/
#define free_page(addr) free_pages((addr),0)
@@ -304,9 +305,7 @@ extern void show_free_areas(void);
extern unsigned long put_dirty_page(struct task_struct * tsk,unsigned long page,
unsigned long address);
-extern void free_page_tables(struct mm_struct * mm);
extern void clear_page_tables(struct mm_struct *, unsigned long, int);
-extern int new_page_tables(struct task_struct * tsk);
extern void zap_page_range(struct mm_struct *mm, unsigned long address, unsigned long size);
extern int copy_page_range(struct mm_struct *dst, struct mm_struct *src, struct vm_area_struct *vma);
@@ -328,6 +327,7 @@ extern void mem_init(unsigned long start_mem, unsigned long end_mem);
extern void show_mem(void);
extern void oom(struct task_struct * tsk);
extern void si_meminfo(struct sysinfo * val);
+extern void swapin_readahead(unsigned long);
/* mmap.c */
extern void vma_init(void);
@@ -359,12 +359,18 @@ extern void put_cached_page(unsigned long);
#define __GFP_HIGH 0x08
#define __GFP_IO 0x10
#define __GFP_SWAP 0x20
+#ifdef CONFIG_BIGMEM
+#define __GFP_BIGMEM 0x40
+#else
+#define __GFP_BIGMEM 0x0 /* noop */
+#endif
#define __GFP_UNCACHED 0x40
#define __GFP_DMA 0x80
#define GFP_BUFFER (__GFP_LOW | __GFP_WAIT)
#define GFP_ATOMIC (__GFP_HIGH)
+#define GFP_BIGUSER (__GFP_LOW | __GFP_WAIT | __GFP_IO | __GFP_BIGMEM)
#define GFP_USER (__GFP_LOW | __GFP_WAIT | __GFP_IO)
#define GFP_KERNEL (__GFP_MED | __GFP_WAIT | __GFP_IO)
#define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO)
@@ -383,7 +389,10 @@ extern void put_cached_page(unsigned long);
#define GFP_DMA __GFP_DMA
-#define GFP_LEVEL_MASK 0xf
+/* Flag - indicates that the buffer can be taken from big memory which is not
+ directly addressable by the kernel */
+
+#define GFP_BIGMEM __GFP_BIGMEM
/* vma is the first one with address < vma->vm_end,
* and even address < vma->vm_start. Have to extend vma. */
diff --git a/include/linux/module.h b/include/linux/module.h
index 94cce874f..e0b655aab 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -191,9 +191,10 @@ __asm__(".section .modinfo\n\t.previous");
/* Define the module variable, and usage macros. */
extern struct module __this_module;
-#define MOD_INC_USE_COUNT __MOD_INC_USE_COUNT(&__this_module)
-#define MOD_DEC_USE_COUNT __MOD_DEC_USE_COUNT(&__this_module)
-#define MOD_IN_USE __MOD_IN_USE(&__this_module)
+#define THIS_MODULE (&__this_module)
+#define MOD_INC_USE_COUNT __MOD_INC_USE_COUNT(THIS_MODULE)
+#define MOD_DEC_USE_COUNT __MOD_DEC_USE_COUNT(THIS_MODULE)
+#define MOD_IN_USE __MOD_IN_USE(THIS_MODULE)
#ifndef __NO_VERSION__
#include <linux/version.h>
@@ -215,6 +216,7 @@ const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
#ifndef __GENKSYMS__
+#define THIS_MODULE NULL
#define MOD_INC_USE_COUNT do { } while (0)
#define MOD_DEC_USE_COUNT do { } while (0)
#define MOD_IN_USE 1
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index b57519b72..5cf9853a2 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -126,19 +126,15 @@ struct igmpmsg
*/
#ifdef __KERNEL__
-extern struct sock *mroute_socket;
extern int ip_mroute_setsockopt(struct sock *, int, char *, int);
extern int ip_mroute_getsockopt(struct sock *, int, char *, int *);
extern int ipmr_ioctl(struct sock *sk, int cmd, unsigned long arg);
-extern void mroute_close(struct sock *sk);
-extern void ipmr_forward(struct sk_buff *skb, int is_frag);
-extern int ip_mr_find_tunnel(__u32, __u32);
extern void ip_mr_init(void);
struct vif_device
{
- struct device *dev; /* Device we are using */
+ struct net_device *dev; /* Device we are using */
unsigned long bytes_in,bytes_out;
unsigned long pkt_in,pkt_out; /* Statistics */
unsigned long rate_limit; /* Traffic shaping (NI) */
@@ -148,29 +144,35 @@ struct vif_device
int link; /* Physical interface index */
};
+#define VIFF_STATIC 0x8000
+
struct mfc_cache
{
struct mfc_cache *next; /* Next entry on cache line */
__u32 mfc_mcastgrp; /* Group the entry belongs to */
__u32 mfc_origin; /* Source of packet */
vifi_t mfc_parent; /* Source interface */
- struct timer_list mfc_timer; /* Expiry timer */
int mfc_flags; /* Flags on line */
- struct sk_buff_head mfc_unresolved; /* Unresolved buffers */
- int mfc_queuelen; /* Unresolved buffer counter */
- unsigned long mfc_last_assert;
- int mfc_minvif;
- int mfc_maxvif;
- unsigned long mfc_bytes;
- unsigned long mfc_pkt;
- unsigned long mfc_wrong_if;
- unsigned char mfc_ttls[MAXVIFS]; /* TTL thresholds */
-};
-#define MFC_QUEUED 1
-#define MFC_RESOLVED 2
-#define MFC_NOTIFY 4
+ union {
+ struct {
+ unsigned long expires;
+ struct sk_buff_head unresolved; /* Unresolved buffers */
+ } unres;
+ struct {
+ unsigned long last_assert;
+ int minvif;
+ int maxvif;
+ unsigned long bytes;
+ unsigned long pkt;
+ unsigned long wrong_if;
+ unsigned char ttls[MAXVIFS]; /* TTL thresholds */
+ } res;
+ } mfc_un;
+};
+#define MFC_STATIC 1
+#define MFC_NOTIFY 2
#define MFC_LINES 64
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index f9ef19e8c..3a7f28622 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -196,7 +196,7 @@ extern int fat_is_binary(char conversion,char *extension);
extern void lock_fat(struct super_block *sb);
extern void unlock_fat(struct super_block *sb);
extern int fat_add_cluster(struct inode *inode);
-extern struct buffer_head *fat_add_cluster1(struct inode *inode);
+extern struct buffer_head *fat_extend_dir(struct inode *inode);
extern int date_dos2unix(__u16 time, __u16 date);
extern void fat_fs_panic(struct super_block *s,const char *msg);
extern void fat_lock_creation(void);
@@ -225,7 +225,6 @@ void fat_clusters_flush(struct super_block *sb);
/* fat.c */
extern int fat_access(struct super_block *sb,int nr,int new_value);
-extern int fat_smap(struct inode *inode,int sector);
extern int fat_free(struct inode *inode,int skip);
void fat_cache_inval_inode(struct inode *inode);
void fat_cache_inval_dev(kdev_t device);
@@ -237,6 +236,7 @@ int fat_get_cluster(struct inode *inode,int cluster);
/* inode.c */
extern void fat_hash_init(void);
extern int fat_bmap(struct inode *inode,int block);
+extern int fat_get_block(struct inode *, long, struct buffer_head *, int);
extern int fat_notify_change(struct dentry *, struct iattr *);
extern void fat_clear_inode(struct inode *inode);
extern void fat_delete_inode(struct inode *inode);
@@ -261,6 +261,7 @@ extern int fat_dir_ioctl(struct inode * inode, struct file * filp,
int fat_add_entries(struct inode *dir,int slots, struct buffer_head **bh,
struct msdos_dir_entry **de, int *ino);
int fat_dir_empty(struct inode *dir);
+int fat_new_dir(struct inode *inode, struct inode *parent, int is_vfat);
/* file.c */
extern struct inode_operations fat_file_inode_operations;
diff --git a/include/linux/msdos_fs_i.h b/include/linux/msdos_fs_i.h
index b2381f6d4..bcb37bb80 100644
--- a/include/linux/msdos_fs_i.h
+++ b/include/linux/msdos_fs_i.h
@@ -10,12 +10,10 @@ struct msdos_inode_info {
int i_logstart; /* logical first cluster */
int i_attrs; /* unused attribute bits */
int i_ctime_ms; /* unused change time in milliseconds */
- int i_busy; /* file is either deleted but still open, or
- inconsistent (mkdir) */
- int i_binary; /* file contains non-text data */
int i_location; /* on-disk position of directory entry or 0 */
struct inode *i_fat_inode; /* struct inode of this one */
struct list_head i_fat_hash; /* hash by i_location */
+ int i_realsize;
};
#endif
diff --git a/include/linux/msdos_fs_sb.h b/include/linux/msdos_fs_sb.h
index a44bd960b..7abd87148 100644
--- a/include/linux/msdos_fs_sb.h
+++ b/include/linux/msdos_fs_sb.h
@@ -44,7 +44,7 @@ struct msdos_sb_info {
unsigned long root_cluster; /* first cluster of the root directory */
unsigned long fsinfo_offset; /* FAT32 fsinfo offset from start of disk */
wait_queue_head_t fat_wait;
- int fat_lock;
+ struct semaphore fat_lock;
int prev_free; /* previously returned free cluster number */
int free_clusters; /* -1 if undefined */
struct fat_mount_options options;
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 48c33aca7..7bfcfd084 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -11,8 +11,10 @@
#define MSG_NOERROR 010000 /* no error if message is too big */
#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
+#ifdef __KERNEL__
+
/* one msqid structure for each queue on the system */
-struct msqid_ds {
+struct msqid_ds_kern {
struct ipc_perm msg_perm;
struct msg *msg_first; /* first message on queue */
struct msg *msg_last; /* last message in queue */
@@ -28,6 +30,24 @@ struct msqid_ds {
__kernel_ipc_pid_t msg_lrpid; /* last receive pid */
};
+#endif
+
+struct msqid_ds {
+ struct ipc_perm msg_perm;
+ struct msg *msg_first; /* first message on queue */
+ struct msg *msg_last; /* last message in queue */
+ __kernel_time_t msg_stime; /* last msgsnd time */
+ __kernel_time_t msg_rtime; /* last msgrcv time */
+ __kernel_time_t msg_ctime; /* last change time */
+ unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */
+ unsigned long msg_lqbytes; /* ditto */
+ unsigned short msg_cbytes; /* current number of bytes on queue */
+ unsigned short msg_qnum; /* number of messages in queue */
+ unsigned short msg_qbytes; /* max number of bytes on queue */
+ __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */
+ __kernel_ipc_pid_t msg_lrpid; /* last receive pid */
+};
+
/* message buffer for msgsnd and msgrcv calls */
struct msgbuf {
long mtype; /* type of message */
@@ -69,11 +89,10 @@ struct msg {
short msg_ts; /* message text size */
};
-asmlinkage int sys_msgget (key_t key, int msgflg);
-asmlinkage int sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
-asmlinkage int sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp,
- int msgflg);
-asmlinkage int sys_msgctl (int msqid, int cmd, struct msqid_ds *buf);
+asmlinkage long sys_msgget (key_t key, int msgflg);
+asmlinkage long sys_msgsnd (int msqid, struct msgbuf *msgp, size_t msgsz, int msgflg);
+asmlinkage long sys_msgrcv (int msqid, struct msgbuf *msgp, size_t msgsz, long msgtyp, int msgflg);
+asmlinkage long sys_msgctl (int msqid, int cmd, struct msqid_ds *buf);
#endif /* __KERNEL__ */
diff --git a/include/linux/mtio.h b/include/linux/mtio.h
index b91b74164..c794ed898 100644
--- a/include/linux/mtio.h
+++ b/include/linux/mtio.h
@@ -79,8 +79,8 @@ struct mtget {
long mt_gstat; /* generic (device independent) status */
long mt_erreg; /* error register */
/* The next two fields are not always used */
- __kernel_daddr_t mt_fileno; /* number of current file on tape */
- __kernel_daddr_t mt_blkno; /* current block number */
+ __kernel_daddr_t mt_fileno; /* number of current file on tape */
+ __kernel_daddr_t mt_blkno; /* current block number */
};
diff --git a/include/linux/n_r3964.h b/include/linux/n_r3964.h
new file mode 100644
index 000000000..419774655
--- /dev/null
+++ b/include/linux/n_r3964.h
@@ -0,0 +1,221 @@
+/* r3964 linediscipline for linux
+ *
+ * -----------------------------------------------------------
+ * Copyright by
+ * Philips Automation Projects
+ * Kassel (Germany)
+ * http://www.pap-philips.de
+ * -----------------------------------------------------------
+ * This software may be used and distributed according to the terms of
+ * the GNU Public License, incorporated herein by reference.
+ *
+ * Author:
+ * L. Haag
+ *
+ * $Log: r3964.h,v $
+ * Revision 1.1.1.1 1998/10/13 16:43:14 dwmw2
+ * This'll screw the version control
+ *
+ * Revision 1.6 1998/09/30 00:40:38 dwmw2
+ * Updated to use kernel's N_R3964 if available
+ *
+ * Revision 1.4 1998/04/02 20:29:44 lhaag
+ * select, blocking, ...
+ *
+ * Revision 1.3 1998/02/12 18:58:43 root
+ * fixed some memory leaks
+ * calculation of checksum characters
+ *
+ * Revision 1.2 1998/02/07 13:03:17 root
+ * ioctl read_telegram
+ *
+ * Revision 1.1 1998/02/06 19:19:43 root
+ * Initial revision
+ *
+ *
+ */
+
+#ifndef __LINUX_N_R3964_H__
+#define __LINUX_N_R3964_H__
+
+/* line disciplines for r3964 protocol */
+#include <asm/termios.h>
+
+#ifdef __KERNEL__
+/*
+ * Common ascii handshake characters:
+ */
+
+#define STX 0x02
+#define ETX 0x03
+#define DLE 0x10
+#define NAK 0x15
+
+/*
+ * Timeouts (msecs/10 msecs per timer interrupt):
+ */
+
+#define R3964_TO_QVZ 550/10
+#define R3964_TO_ZVZ 220/10
+#define R3964_TO_NO_BUF 400/10
+#define R3964_NO_TX_ROOM 100/10
+#define R3964_TO_RX_PANIC 4000/10
+#define R3964_MAX_RETRIES 5
+
+#endif
+
+/*
+ * Ioctl-commands
+ */
+
+#define R3964_ENABLE_SIGNALS 0x5301
+#define R3964_SETPRIORITY 0x5302
+#define R3964_USE_BCC 0x5303
+#define R3964_READ_TELEGRAM 0x5304
+
+/* Options for R3964_SETPRIORITY */
+#define R3964_MASTER 0
+#define R3964_SLAVE 1
+
+/* Options for R3964_ENABLE_SIGNALS */
+#define R3964_SIG_ACK 0x0001
+#define R3964_SIG_DATA 0x0002
+#define R3964_SIG_ALL 0x000f
+#define R3964_SIG_NONE 0x0000
+#define R3964_USE_SIGIO 0x1000
+
+/*
+ * r3964 operation states:
+ */
+#ifdef __KERNEL__
+
+enum { R3964_IDLE,
+ R3964_TX_REQUEST, R3964_TRANSMITTING,
+ R3964_WAIT_ZVZ_BEFORE_TX_RETRY, R3964_WAIT_FOR_TX_ACK,
+ R3964_WAIT_FOR_RX_BUF,
+ R3964_RECEIVING, R3964_WAIT_FOR_BCC, R3964_WAIT_FOR_RX_REPEAT
+ };
+
+/*
+ * All open file-handles are 'clients' and are stored in a linked list:
+ */
+
+struct r3964_message;
+
+struct r3964_client_info {
+ pid_t pid;
+ unsigned int sig_flags;
+
+ struct r3964_client_info *next;
+
+ struct r3964_message *first_msg;
+ struct r3964_message *last_msg;
+ struct r3964_block_header *next_block_to_read;
+ int msg_count;
+};
+
+
+#endif
+
+/* types for msg_id: */
+enum {R3964_MSG_ACK=1, R3964_MSG_DATA };
+
+#define R3964_MAX_MSG_COUNT 32
+
+/* error codes for client messages */
+#define R3964_OK 0 /* no error. */
+#define R3964_TX_FAIL -1 /* transmission error, block NOT sent */
+#define R3964_OVERFLOW -2 /* msg queue overflow */
+
+/* the client gets this struct when calling read(fd,...): */
+struct r3964_client_message {
+ int msg_id;
+ int arg;
+ int error_code;
+};
+
+#define R3964_MTU 256
+
+
+#ifdef __KERNEL__
+
+struct r3964_block_header;
+
+/* internal version of client_message: */
+struct r3964_message {
+ int msg_id;
+ int arg;
+ int error_code;
+ struct r3964_block_header *block;
+ struct r3964_message *next;
+};
+
+/*
+ * Header of received block in rx_buf/tx_buf:
+ */
+
+struct r3964_block_header
+{
+ unsigned int length; /* length in chars without header */
+ unsigned char *data; /* usually data is located
+ immediatly behind this struct */
+ unsigned int locks; /* only used in rx_buffer */
+
+ struct r3964_block_header *next;
+ struct r3964_client_info *owner; /* =NULL in rx_buffer */
+};
+
+/*
+ * If rx_buf hasn't enough space to store R3964_MTU chars,
+ * we will reject all incoming STX-requests by sending NAK.
+ */
+
+#define RX_BUF_SIZE 4000
+#define TX_BUF_SIZE 4000
+#define R3964_MAX_BLOCKS_IN_RX_QUEUE 100
+
+#define R3964_PARITY 0x0001
+#define R3964_FRAME 0x0002
+#define R3964_OVERRUN 0x0004
+#define R3964_UNKNOWN 0x0008
+#define R3964_BREAK 0x0010
+#define R3964_CHECKSUM 0x0020
+#define R3964_ERROR 0x003f
+#define R3964_BCC 0x4000
+#define R3964_DEBUG 0x8000
+
+
+struct r3964_info {
+ struct tty_struct *tty;
+ unsigned char priority;
+ unsigned char *rx_buf; /* ring buffer */
+ unsigned char *tx_buf;
+
+ wait_queue_head_t read_wait;
+ //struct wait_queue *read_wait;
+
+ struct r3964_block_header *rx_first;
+ struct r3964_block_header *rx_last;
+ struct r3964_block_header *tx_first;
+ struct r3964_block_header *tx_last;
+ unsigned int tx_position;
+ unsigned int rx_position;
+ unsigned char last_rx;
+ unsigned char bcc;
+ unsigned int blocks_in_rx_queue;
+
+
+ struct r3964_client_info *firstClient;
+ unsigned int state;
+ unsigned int flags;
+
+ int count_down;
+ int nRetry;
+
+ struct tq_struct bh_1;
+ struct tq_struct bh_2;
+};
+
+#endif
+
+#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 906c83dce..8b4b3f35a 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -73,18 +73,17 @@ struct socket
short type;
unsigned char passcred;
- unsigned char tli;
};
#define SOCK_INODE(S) ((S)->inode)
struct scm_cookie;
+struct vm_area_struct;
struct proto_ops {
int family;
- int (*dup) (struct socket *newsock, struct socket *oldsock);
- int (*release) (struct socket *sock, struct socket *peer);
+ int (*release) (struct socket *sock);
int (*bind) (struct socket *sock, struct sockaddr *umyaddr,
int sockaddr_len);
int (*connect) (struct socket *sock, struct sockaddr *uservaddr,
@@ -107,6 +106,7 @@ struct proto_ops {
unsigned long arg);
int (*sendmsg) (struct socket *sock, struct msghdr *m, int total_len, struct scm_cookie *scm);
int (*recvmsg) (struct socket *sock, struct msghdr *m, int total_len, int flags, struct scm_cookie *scm);
+ int (*mmap) (struct file *file, struct socket *sock, struct vm_area_struct * vma);
};
struct net_proto_family
@@ -126,7 +126,6 @@ struct net_proto
void (*init_func)(struct net_proto *); /* Bootstrap */
};
-extern struct net_proto_family *net_families[];
extern int sock_wake_async(struct socket *sk, int how);
extern int sock_register(struct net_proto_family *fam);
extern int sock_unregister(int family);
@@ -142,5 +141,88 @@ extern int net_ratelimit(void);
extern unsigned long net_random(void);
extern void net_srandom(unsigned long);
+#ifndef __SMP__
+#define SOCKOPS_WRAPPED(name) name
+#define SOCKOPS_WRAP(name, fam)
+#else
+
+#define SOCKOPS_WRAPPED(name) __unlocked_##name
+
+#define SOCKCALL_WRAP(name, call, parms, args) \
+static int __lock_##name##_##call parms \
+{ \
+ int ret; \
+ lock_kernel(); \
+ ret = __unlocked_##name##_ops.call args ;\
+ unlock_kernel(); \
+ return ret; \
+}
+
+#define SOCKCALL_UWRAP(name, call, parms, args) \
+static unsigned int __lock_##name##_##call parms \
+{ \
+ int ret; \
+ lock_kernel(); \
+ ret = __unlocked_##name##_ops.call args ;\
+ unlock_kernel(); \
+ return ret; \
+}
+
+
+#define SOCKOPS_WRAP(name, fam) \
+SOCKCALL_WRAP(name, release, (struct socket *sock), (sock)) \
+SOCKCALL_WRAP(name, bind, (struct socket *sock, struct sockaddr *uaddr, int addr_len), \
+ (sock, uaddr, addr_len)) \
+SOCKCALL_WRAP(name, connect, (struct socket *sock, struct sockaddr * uaddr, \
+ int addr_len, int flags), \
+ (sock, uaddr, addr_len, flags)) \
+SOCKCALL_WRAP(name, socketpair, (struct socket *sock1, struct socket *sock2), \
+ (sock1, sock2)) \
+SOCKCALL_WRAP(name, accept, (struct socket *sock, struct socket *newsock, \
+ int flags), (sock, newsock, flags)) \
+SOCKCALL_WRAP(name, getname, (struct socket *sock, struct sockaddr *uaddr, \
+ int *addr_len, int peer), (sock, uaddr, addr_len, peer)) \
+SOCKCALL_UWRAP(name, poll, (struct file *file, struct socket *sock, struct poll_table_struct *wait), \
+ (file, sock, wait)) \
+SOCKCALL_WRAP(name, ioctl, (struct socket *sock, unsigned int cmd, \
+ unsigned long arg), (sock, cmd, arg)) \
+SOCKCALL_WRAP(name, listen, (struct socket *sock, int len), (sock, len)) \
+SOCKCALL_WRAP(name, shutdown, (struct socket *sock, int flags), (sock, flags)) \
+SOCKCALL_WRAP(name, setsockopt, (struct socket *sock, int level, int optname, \
+ char *optval, int optlen), (sock, level, optname, optval, optlen)) \
+SOCKCALL_WRAP(name, getsockopt, (struct socket *sock, int level, int optname, \
+ char *optval, int *optlen), (sock, level, optname, optval, optlen)) \
+SOCKCALL_WRAP(name, fcntl, (struct socket *sock, unsigned int cmd, \
+ unsigned long arg), (sock, cmd, arg)) \
+SOCKCALL_WRAP(name, sendmsg, (struct socket *sock, struct msghdr *m, int len, struct scm_cookie *scm), \
+ (sock, m, len, scm)) \
+SOCKCALL_WRAP(name, recvmsg, (struct socket *sock, struct msghdr *m, int len, int flags, struct scm_cookie *scm), \
+ (sock, m, len, flags, scm)) \
+SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \
+ (file, sock, vma)) \
+ \
+static struct proto_ops name##_ops = { \
+ fam, \
+ \
+ __lock_##name##_release, \
+ __lock_##name##_bind, \
+ __lock_##name##_connect, \
+ __lock_##name##_socketpair, \
+ __lock_##name##_accept, \
+ __lock_##name##_getname, \
+ __lock_##name##_poll, \
+ __lock_##name##_ioctl, \
+ __lock_##name##_listen, \
+ __lock_##name##_shutdown, \
+ __lock_##name##_setsockopt, \
+ __lock_##name##_getsockopt, \
+ __lock_##name##_fcntl, \
+ __lock_##name##_sendmsg, \
+ __lock_##name##_recvmsg, \
+ __lock_##name##_mmap, \
+};
+#endif
+
+
#endif /* __KERNEL__ */
#endif /* _LINUX_NET_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5fbcbad86..75d6f872d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -35,12 +35,16 @@
#ifdef CONFIG_NET_PROFILE
#include <net/profile.h>
#endif
+
+#define NET_XMIT_SUCCESS 0
+#define NET_XMIT_DROP 1 /* skb dropped */
+#define NET_XMIT_CN 2 /* congestion notification */
+#define NET_XMIT_POLICED 3 /* skb is shot by police */
+
+#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
+
#endif
-/*
- * For future expansion when we will have different priorities.
- */
-
#define MAX_ADDR_LEN 7 /* Largest hardware address length */
/*
@@ -166,11 +170,11 @@ struct hh_cache
* data with strictly "high-level" data, and it has to know about
* almost every data structure used in the INET module.
*
- * FIXME: cleanup struct device such that network protocol info
+ * FIXME: cleanup struct net_device such that network protocol info
* moves out.
*/
-struct device
+struct net_device
{
/*
@@ -202,11 +206,10 @@ struct device
unsigned long interrupt; /* bitops.. */
unsigned long tbusy; /* transmitter busy */
- struct device *next;
+ struct net_device *next;
/* The device initialization function. Called only once. */
- int (*init)(struct device *dev);
- void (*destructor)(struct device *dev);
+ int (*init)(struct net_device *dev);
/* Interface index. Unique device identifier */
int ifindex;
@@ -220,8 +223,8 @@ struct device
unsigned char if_port; /* Selectable AUI, TP,..*/
unsigned char dma; /* DMA channel */
- struct net_device_stats* (*get_stats)(struct device *dev);
- struct iw_statistics* (*get_wireless_stats)(struct device *dev);
+ struct net_device_stats* (*get_stats)(struct net_device *dev);
+ struct iw_statistics* (*get_wireless_stats)(struct net_device *dev);
/*
* This marks the end of the "visible" part of the structure. All
@@ -254,7 +257,7 @@ struct device
/* For load balancing driver pair support */
unsigned long pkt_queue; /* Packets queued */
- struct device *slave; /* Slave device */
+ struct net_device *slave; /* Slave device */
/* Protocol specific pointers */
@@ -276,52 +279,62 @@ struct device
int xmit_lock_owner;
/* device queue lock */
spinlock_t queue_lock;
+ /* Number of references to this device */
atomic_t refcnt;
+ /* The flag marking that device is unregistered, but held by an user */
+ int deadbeaf;
+ /* New style devices allow asynchronous destruction;
+ netdevice_unregister for old style devices blocks until
+ the last user will dereference this device.
+ */
+ int new_style;
+ /* Called after device is detached from network. */
+ void (*uninit)(struct net_device *dev);
+ /* Called after last user reference disappears. */
+ void (*destructor)(struct net_device *dev);
/* Pointers to interface service routines. */
- int (*open)(struct device *dev);
- int (*stop)(struct device *dev);
+ int (*open)(struct net_device *dev);
+ int (*stop)(struct net_device *dev);
int (*hard_start_xmit) (struct sk_buff *skb,
- struct device *dev);
+ struct net_device *dev);
int (*hard_header) (struct sk_buff *skb,
- struct device *dev,
+ struct net_device *dev,
unsigned short type,
void *daddr,
void *saddr,
unsigned len);
int (*rebuild_header)(struct sk_buff *skb);
#define HAVE_MULTICAST
- void (*set_multicast_list)(struct device *dev);
+ void (*set_multicast_list)(struct net_device *dev);
#define HAVE_SET_MAC_ADDR
- int (*set_mac_address)(struct device *dev,
+ int (*set_mac_address)(struct net_device *dev,
void *addr);
#define HAVE_PRIVATE_IOCTL
- int (*do_ioctl)(struct device *dev,
+ int (*do_ioctl)(struct net_device *dev,
struct ifreq *ifr, int cmd);
#define HAVE_SET_CONFIG
- int (*set_config)(struct device *dev,
+ int (*set_config)(struct net_device *dev,
struct ifmap *map);
#define HAVE_HEADER_CACHE
int (*hard_header_cache)(struct neighbour *neigh,
struct hh_cache *hh);
void (*header_cache_update)(struct hh_cache *hh,
- struct device *dev,
+ struct net_device *dev,
unsigned char * haddr);
#define HAVE_CHANGE_MTU
- int (*change_mtu)(struct device *dev, int new_mtu);
+ int (*change_mtu)(struct net_device *dev, int new_mtu);
int (*hard_header_parse)(struct sk_buff *skb,
unsigned char *haddr);
- int (*neigh_setup)(struct device *dev, struct neigh_parms *);
- int (*accept_fastpath)(struct device *, struct dst_entry*);
+ int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
+ int (*accept_fastpath)(struct net_device *, struct dst_entry*);
#ifdef CONFIG_NET_FASTROUTE
- /* Really, this semaphore may be necessary and for not fastroute code;
- f.e. SMP??
- */
- int tx_semaphore;
+ unsigned long tx_semaphore;
#define NETDEV_FASTROUTE_HMASK 0xF
/* Semi-private data. Keep it at the end of device struct. */
+ rwlock_t fastpath_lock;
struct dst_entry *fastpath[NETDEV_FASTROUTE_HMASK+1];
#endif
};
@@ -330,8 +343,8 @@ struct device
struct packet_type
{
unsigned short type; /* This is really htons(ether_type). */
- struct device *dev; /* NULL is wildcarded here */
- int (*func) (struct sk_buff *, struct device *,
+ struct net_device *dev; /* NULL is wildcarded here */
+ int (*func) (struct sk_buff *, struct net_device *,
struct packet_type *);
void *data; /* Private to the packet type */
struct packet_type *next;
@@ -341,31 +354,34 @@ struct packet_type
#include <linux/interrupt.h>
#include <linux/notifier.h>
-extern struct device loopback_dev; /* The loopback */
-extern struct device *dev_base; /* All devices */
+extern struct net_device loopback_dev; /* The loopback */
+extern struct net_device *dev_base; /* All devices */
extern rwlock_t dev_base_lock; /* Device list lock */
extern int netdev_dropping;
extern int net_cpu_congestion;
-extern struct device *dev_getbyhwaddr(unsigned short type, char *hwaddr);
+extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr);
extern void dev_add_pack(struct packet_type *pt);
extern void dev_remove_pack(struct packet_type *pt);
-extern struct device *dev_get(const char *name);
-extern struct device *dev_alloc(const char *name, int *err);
-extern int dev_alloc_name(struct device *dev, const char *name);
-extern int dev_open(struct device *dev);
-extern int dev_close(struct device *dev);
+extern int dev_get(const char *name);
+extern struct net_device *dev_get_by_name(const char *name);
+extern struct net_device *__dev_get_by_name(const char *name);
+extern struct net_device *dev_alloc(const char *name, int *err);
+extern int dev_alloc_name(struct net_device *dev, const char *name);
+extern int dev_open(struct net_device *dev);
+extern int dev_close(struct net_device *dev);
extern int dev_queue_xmit(struct sk_buff *skb);
extern void dev_loopback_xmit(struct sk_buff *skb);
-extern int register_netdevice(struct device *dev);
-extern int unregister_netdevice(struct device *dev);
+extern int register_netdevice(struct net_device *dev);
+extern int unregister_netdevice(struct net_device *dev);
extern int register_netdevice_notifier(struct notifier_block *nb);
extern int unregister_netdevice_notifier(struct notifier_block *nb);
extern int dev_new_index(void);
-extern struct device *dev_get_by_index(int ifindex);
-extern int dev_restart(struct device *dev);
+extern struct net_device *dev_get_by_index(int ifindex);
+extern struct net_device *__dev_get_by_index(int ifindex);
+extern int dev_restart(struct net_device *dev);
-typedef int gifconf_func_t(struct device * dev, char * bufptr, int len);
+typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len);
extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf);
extern __inline__ int unregister_gifconf(unsigned int family)
{
@@ -377,80 +393,58 @@ extern void netif_rx(struct sk_buff *skb);
extern void net_bh(void);
extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy);
extern int dev_ioctl(unsigned int cmd, void *);
-extern int dev_change_flags(struct device *, unsigned);
-extern void dev_queue_xmit_nit(struct sk_buff *skb, struct device *dev);
+extern int dev_change_flags(struct net_device *, unsigned);
+extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
extern void dev_init(void);
extern int netdev_nit;
-/* Locking protection for page faults during outputs to devices unloaded during the fault */
-
-extern atomic_t dev_lockct;
-
-/*
- * These two don't currently need to be atomic
- * but they may do soon. Do it properly anyway.
- */
-
-extern __inline__ void dev_lock_list(void)
+extern __inline__ void dev_init_buffers(struct net_device *dev)
{
- atomic_inc(&dev_lockct);
-}
-
-extern __inline__ void dev_unlock_list(void)
-{
- atomic_dec(&dev_lockct);
+ /* DO NOTHING */
}
-/*
- * This almost never occurs, isn't in performance critical paths
- * and we can thus be relaxed about it.
- *
- * FIXME: What if this is being run as a real time process ??
- * Linus: We need a way to force a yield here ?
- *
- * FIXME: Though dev_lockct is atomic varible, locking procedure
- * is not atomic.
- */
+extern int netdev_finish_unregister(struct net_device *dev);
-extern __inline__ void dev_lock_wait(void)
+extern __inline__ void dev_put(struct net_device *dev)
{
- while (atomic_read(&dev_lockct)) {
- current->policy |= SCHED_YIELD;
- schedule();
- }
+ if (atomic_dec_and_test(&dev->refcnt))
+ netdev_finish_unregister(dev);
}
-extern __inline__ void dev_init_buffers(struct device *dev)
-{
- /* DO NOTHING */
-}
+#define __dev_put(dev) atomic_dec(&(dev)->refcnt)
+#define dev_hold(dev) atomic_inc(&(dev)->refcnt)
+
/* These functions live elsewhere (drivers/net/net_init.c, but related) */
-extern void ether_setup(struct device *dev);
-extern void fddi_setup(struct device *dev);
-extern void tr_setup(struct device *dev);
-extern void tr_freedev(struct device *dev);
-extern int ether_config(struct device *dev, struct ifmap *map);
+extern void ether_setup(struct net_device *dev);
+extern void fddi_setup(struct net_device *dev);
+extern void tr_setup(struct net_device *dev);
+extern void fc_setup(struct net_device *dev);
+extern void tr_freedev(struct net_device *dev);
+extern void fc_freedev(struct net_device *dev);
+extern int ether_config(struct net_device *dev, struct ifmap *map);
/* Support for loadable net-drivers */
-extern int register_netdev(struct device *dev);
-extern void unregister_netdev(struct device *dev);
-extern int register_trdev(struct device *dev);
-extern void unregister_trdev(struct device *dev);
+extern int register_netdev(struct net_device *dev);
+extern void unregister_netdev(struct net_device *dev);
+extern int register_trdev(struct net_device *dev);
+extern void unregister_trdev(struct net_device *dev);
+extern int register_fcdev(struct net_device *dev);
+extern void unregister_fcdev(struct net_device *dev);
/* Functions used for multicast support */
-extern void dev_mc_upload(struct device *dev);
-extern int dev_mc_delete(struct device *dev, void *addr, int alen, int all);
-extern int dev_mc_add(struct device *dev, void *addr, int alen, int newonly);
-extern void dev_mc_discard(struct device *dev);
-extern void dev_set_promiscuity(struct device *dev, int inc);
-extern void dev_set_allmulti(struct device *dev, int inc);
-extern void netdev_state_change(struct device *dev);
+extern void dev_mc_upload(struct net_device *dev);
+extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
+extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
+extern void dev_mc_discard(struct net_device *dev);
+extern void dev_set_promiscuity(struct net_device *dev, int inc);
+extern void dev_set_allmulti(struct net_device *dev, int inc);
+extern void netdev_state_change(struct net_device *dev);
/* Load a device via the kmod */
extern void dev_load(const char *name);
extern void dev_mcast_init(void);
-extern int netdev_register_fc(struct device *dev, void (*stimul)(struct device *dev));
+extern int netdev_register_fc(struct net_device *dev, void (*stimul)(struct net_device *dev));
extern void netdev_unregister_fc(int bit);
extern int netdev_dropping;
extern int netdev_max_backlog;
@@ -459,7 +453,7 @@ extern unsigned long netdev_fc_xoff;
#ifdef CONFIG_NET_FASTROUTE
extern int netdev_fastroute;
extern int netdev_fastroute_obstacles;
-extern void dev_clear_fastroute(struct device *dev);
+extern void dev_clear_fastroute(struct net_device *dev);
extern struct net_fastroute_stats dev_fastroute_stat;
#endif
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
new file mode 100644
index 000000000..6c1b4a630
--- /dev/null
+++ b/include/linux/netfilter.h
@@ -0,0 +1,203 @@
+#ifndef __LINUX_NETFILTER_H
+#define __LINUX_NETFILTER_H
+
+#ifdef __KERNEL__
+#include <linux/init.h>
+#include <linux/types.h>
+#include <linux/skbuff.h>
+#include <linux/net.h>
+#include <linux/wait.h>
+#include <linux/list.h>
+#endif
+
+/* Responses from hook functions. */
+#define NF_DROP 0
+#define NF_ACCEPT 1
+#define NF_STOLEN 2
+#define NF_QUEUE 3
+#define NF_MAX_VERDICT NF_QUEUE
+
+/* Generic cache responses from hook functions. */
+#define NFC_ALTERED 0x8000
+#define NFC_UNKNOWN 0x4000
+
+#ifdef __KERNEL__
+#include <linux/config.h>
+#ifdef CONFIG_NETFILTER
+
+extern void netfilter_init(void);
+
+/* Largest hook number + 1 */
+#define NF_MAX_HOOKS 5
+
+struct sk_buff;
+struct net_device;
+
+typedef unsigned int nf_hookfn(unsigned int hooknum,
+ struct sk_buff **skb,
+ const struct net_device *in,
+ const struct net_device *out);
+
+typedef unsigned int nf_cacheflushfn(const void *packet,
+ const struct net_device *in,
+ const struct net_device *out,
+ u_int32_t packetcount,
+ u_int32_t bytecount);
+
+struct nf_hook_ops
+{
+ struct list_head list;
+
+ /* User fills in from here down. */
+ nf_hookfn *hook;
+ nf_cacheflushfn *flush;
+ int pf;
+ int hooknum;
+ /* Hooks are ordered in ascending priority. */
+ int priority;
+};
+
+struct nf_sockopt_ops
+{
+ struct list_head list;
+
+ int pf;
+
+ /* Non-inclusive ranges: use 0/0/NULL to never get called. */
+ int set_optmin;
+ int set_optmax;
+ int (*set)(struct sock *sk, int optval, void *user, unsigned int len);
+
+ int get_optmin;
+ int get_optmax;
+ int (*get)(struct sock *sk, int optval, void *user, int *len);
+};
+
+/* Function to register/unregister hook points. */
+int nf_register_hook(struct nf_hook_ops *reg);
+void nf_unregister_hook(struct nf_hook_ops *reg);
+
+/* Functions to register get/setsockopt ranges (non-inclusive). */
+int nf_register_sockopt(struct nf_sockopt_ops *reg);
+void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
+
+extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
+
+/* Activate hook/flush; either okfn or kfree_skb called, unless a hook
+ returns NF_STOLEN (in which case, it's up to the hook to deal with
+ the consequences).
+
+ Returns -ERRNO if packet dropped. Zero means queued, stolen or
+ accepted.
+*/
+
+/* RR:
+ > I don't want nf_hook to return anything because people might forget
+ > about async and trust the return value to mean "packet was ok".
+
+ AK:
+ Just document it clearly, then you can expect some sense from kernel
+ coders :)
+*/
+
+/* This is gross, but inline doesn't cut it for avoiding the function
+ call in fast path: gcc doesn't inline (needs value tracking?). --RR */
+#ifdef CONFIG_NETFILTER_DEBUG
+#define NF_HOOK nf_hook_slow
+#else
+#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) \
+(list_empty(&nf_hooks[(pf)][(hook)]) \
+ ? (okfn)(skb) \
+ : nf_hook_slow((pf), (hook), (skb), (indev), (outdev), (okfn)))
+#endif
+
+int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
+ struct net_device *indev, struct net_device *outdev,
+ int (*okfn)(struct sk_buff *));
+
+void nf_cacheflush(int pf, unsigned int hook, const void *packet,
+ const struct net_device *indev, const struct net_device *outdev,
+ __u32 packetcount, __u32 bytecount);
+
+/* Call setsockopt() */
+int nf_setsockopt(struct sock *sk, int pf, int optval, char *opt,
+ int len);
+int nf_getsockopt(struct sock *sk, int pf, int optval, char *opt,
+ int *len);
+
+struct nf_wakeme
+{
+ wait_queue_head_t sleep;
+ struct sk_buff_head skbq;
+};
+
+/* For netfilter device. */
+struct nf_interest
+{
+ struct list_head list;
+
+ int pf;
+ /* Bitmask of hook numbers to match (1 << hooknum). */
+ unsigned int hookmask;
+ /* If non-zero, only catch packets with this mark. */
+ unsigned int mark;
+ /* If non-zero, only catch packets of this reason. */
+ unsigned int reason;
+
+ struct nf_wakeme *wake;
+};
+
+/* For asynchronous packet handling. */
+extern void nf_register_interest(struct nf_interest *interest);
+extern void nf_unregister_interest(struct nf_interest *interest);
+extern void nf_getinfo(const struct sk_buff *skb,
+ struct net_device **indev,
+ struct net_device **outdev,
+ unsigned long *mark);
+extern void nf_reinject(struct sk_buff *skb,
+ unsigned long mark,
+ unsigned int verdict);
+
+#ifdef CONFIG_NETFILTER_DEBUG
+extern void nf_dump_skb(int pf, struct sk_buff *skb);
+#endif
+
+/* FIXME: Before cache is ever used, this must be implemented for real. */
+extern void nf_invalidate_cache(int pf);
+
+#else /* !CONFIG_NETFILTER */
+#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
+#endif /*CONFIG_NETFILTER*/
+
+/* From arch/i386/kernel/smp.c:
+ *
+ * Why isn't this somewhere standard ??
+ *
+ * Maybe because this procedure is horribly buggy, and does
+ * not deserve to live. Think about signedness issues for five
+ * seconds to see why. - Linus
+ */
+
+/* Two signed, return a signed. */
+#define SMAX(a,b) ((ssize_t)(a)>(ssize_t)(b) ? (ssize_t)(a) : (ssize_t)(b))
+#define SMIN(a,b) ((ssize_t)(a)<(ssize_t)(b) ? (ssize_t)(a) : (ssize_t)(b))
+
+/* Two unsigned, return an unsigned. */
+#define UMAX(a,b) ((size_t)(a)>(size_t)(b) ? (size_t)(a) : (size_t)(b))
+#define UMIN(a,b) ((size_t)(a)<(size_t)(b) ? (size_t)(a) : (size_t)(b))
+
+/* Two unsigned, return a signed. */
+#define SUMAX(a,b) ((size_t)(a)>(size_t)(b) ? (ssize_t)(a) : (ssize_t)(b))
+#define SUMIN(a,b) ((size_t)(a)<(size_t)(b) ? (ssize_t)(a) : (ssize_t)(b))
+#endif /*__KERNEL__*/
+
+enum nf_reason {
+ /* Do not, NOT, reorder these. Add at end. */
+ NF_REASON_NONE,
+ NF_REASON_SET_BY_IPCHAINS,
+ NF_REASON_FOR_ROUTING,
+ NF_REASON_FOR_CLS_FW,
+ NF_REASON_MIN_RESERVED_FOR_CONNTRACK = 1024,
+};
+
+#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter_ddp.h b/include/linux/netfilter_ddp.h
new file mode 100644
index 000000000..7c63c943f
--- /dev/null
+++ b/include/linux/netfilter_ddp.h
@@ -0,0 +1,14 @@
+#ifndef __LINUX_DDP_NETFILTER_H
+#define __LINUX_DDP_NETFILTER_H
+
+/* DDP-specific defines for netfilter. Complete me sometime.
+ * (C)1998 Rusty Russell -- This code is GPL.
+ */
+
+#include <linux/netfilter.h>
+
+/* Appletalk hooks */
+#define NF_DDP_INPUT 0
+#define NF_DDP_FORWARD 1
+#define NF_DDP_OUTPUT 2
+#endif /*__LINUX_DDP_NETFILTER_H*/
diff --git a/include/linux/netfilter_decnet.h b/include/linux/netfilter_decnet.h
new file mode 100644
index 000000000..04b122441
--- /dev/null
+++ b/include/linux/netfilter_decnet.h
@@ -0,0 +1,35 @@
+#ifndef __LINUX_DECNET_NETFILTER_H
+#define __LINUX_DECNET_NETFILTER_H
+
+/* DECnet-specific defines for netfilter.
+ * This file (C) Steve Whitehouse 1999 derived from the
+ * ipv4 netfilter header file which is
+ * (C)1998 Rusty Russell -- This code is GPL.
+ */
+
+#include <linux/netfilter.h>
+
+/* IP Cache bits. */
+/* Src IP address. */
+#define NFC_DN_SRC 0x0001
+/* Dest IP address. */
+#define NFC_DN_DST 0x0002
+/* Input device. */
+#define NFC_DN_IF_IN 0x0004
+/* Output device. */
+#define NFC_DN_IF_OUT 0x0008
+
+/* DECnet Hooks */
+/* After promisc drops, checksum checks. */
+#define NF_DN_PRE_ROUTING 0
+/* If the packet is destined for this box. */
+#define NF_DN_LOCAL_IN 1
+/* If the packet is destined for another interface. */
+#define NF_DN_FORWARD 2
+/* Packets coming from a local process. */
+#define NF_DN_LOCAL_OUT 3
+/* Packets about to hit the wire. */
+#define NF_DN_POST_ROUTING 4
+#define NF_DN_NUMHOOKS 5
+
+#endif /*__LINUX_DECNET_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
new file mode 100644
index 000000000..d3bc6887f
--- /dev/null
+++ b/include/linux/netfilter_ipv4.h
@@ -0,0 +1,61 @@
+#ifndef __LINUX_IP_NETFILTER_H
+#define __LINUX_IP_NETFILTER_H
+
+/* IPv4-specific defines for netfilter.
+ * (C)1998 Rusty Russell -- This code is GPL.
+ */
+
+#include <linux/config.h>
+#include <linux/netfilter.h>
+
+/* IP Cache bits. */
+/* Src IP address. */
+#define NFC_IP_SRC 0x0001
+/* Dest IP address. */
+#define NFC_IP_DST 0x0002
+/* Input device. */
+#define NFC_IP_IF_IN 0x0004
+/* Output device. */
+#define NFC_IP_IF_OUT 0x0008
+/* TOS. */
+#define NFC_IP_TOS 0x0010
+/* Protocol. */
+#define NFC_IP_PROTO 0x0020
+/* IP options. */
+#define NFC_IP_OPTIONS 0x0040
+/* Frag & flags. */
+#define NFC_IP_FRAG 0x0080
+
+/* Per-protocol information: only matters if proto match. */
+/* TCP flags. */
+#define NFC_IP_TCPFLAGS 0x0100
+/* Source port. */
+#define NFC_IP_SRC_PT 0x0200
+/* Dest port. */
+#define NFC_IP_DST_PT 0x0400
+/* Something else about the proto */
+#define NFC_IP_PROTO_UNKNOWN 0x2000
+
+/* IP Hooks */
+/* After promisc drops, checksum checks. */
+#define NF_IP_PRE_ROUTING 0
+/* If the packet is destined for this box. */
+#define NF_IP_LOCAL_IN 1
+/* If the packet is destined for another interface. */
+#define NF_IP_FORWARD 2
+/* Packets coming from a local process. */
+#define NF_IP_LOCAL_OUT 3
+/* Packets about to hit the wire. */
+#define NF_IP_POST_ROUTING 4
+#define NF_IP_NUMHOOKS 5
+
+#ifdef CONFIG_NETFILTER_DEBUG
+#ifdef __KERNEL__
+void debug_print_hooks_ip(unsigned int nf_debug);
+void nf_debug_ip_local_deliver(struct sk_buff *skb);
+void nf_debug_ip_loopback_xmit(struct sk_buff *newskb);
+void nf_debug_ip_finish_output2(struct sk_buff *skb);
+#endif /*__KERNEL__*/
+#endif /*CONFIG_NETFILTER_DEBUG*/
+
+#endif /*__LINUX_IP_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipx.h b/include/linux/netfilter_ipx.h
new file mode 100644
index 000000000..ebd93bfa6
--- /dev/null
+++ b/include/linux/netfilter_ipx.h
@@ -0,0 +1,14 @@
+#ifndef __LINUX_IPX_NETFILTER_H
+#define __LINUX_IPX_NETFILTER_H
+
+/* IPX-specific defines for netfilter. Complete me sometime.
+ * (C)1998 Rusty Russell -- This code is GPL.
+ */
+
+#include <linux/netfilter.h>
+
+/* IPX Hooks */
+#define NF_IPX_INPUT 0
+#define NF_IPX_FORWARD 1
+#define NF_IPX_OUTPUT 2
+#endif /*__LINUX_IPX_NETFILTER_H*/
diff --git a/include/linux/netfilter_x25.h b/include/linux/netfilter_x25.h
new file mode 100644
index 000000000..88e235457
--- /dev/null
+++ b/include/linux/netfilter_x25.h
@@ -0,0 +1,15 @@
+#ifndef __LINUX_X25_NETFILTER_H
+#define __LINUX_X25_NETFILTER_H
+
+/* X25-specific defines for netfilter. Complete me sometime.
+ * (C)1998 Rusty Russell -- This code is GPL.
+ */
+
+#include <linux/netfilter.h>
+
+/* Hooks */
+#define NF_X25_INPUT 0
+#define NF_X25_FORWARD 1
+#define NF_X25_OUTPUT 2
+
+#endif /*__LINUX_X25_NETFILTER_H*/
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index c09b95a93..5f46ddd93 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -1,96 +1,322 @@
+/*
+ nubus.h: various definitions and prototypes for NuBus drivers to use.
-struct nubus_slot
-{
- int slot_flags;
-#define NUBUS_DEVICE_PRESENT 1
-#define NUBUS_DEVICE_ACTIVE 2
-#define NUBUS_DEVICE_IRQ 4
- __u32 slot_directory;
- __u32 slot_dlength;
- __u32 slot_crc;
- __u8 slot_rev;
- __u8 slot_format;
- __u8 slot_lanes;
- /*
- * Stuff we pulled from the directory
- */
- __u32 slot_dirbase;
- __u32 slot_thisdir;
- char slot_vendor[64];
- char slot_cardname[64];
-};
-
-struct nbnamevec
-{
- char *name;
- int id;
+ Originally written by Alan Cox.
+
+ Hacked to death by C. Scott Ananian and David Huggins-Daines.
+
+ Some of the constants in here are from the corresponding
+ NetBSD/OpenBSD header file, by Allen Briggs. We figured out the
+ rest of them on our own. */
+
+#ifndef LINUX_NUBUS_H
+#define LINUX_NUBUS_H
+
+enum nubus_category {
+ NUBUS_CAT_BOARD = 0x0001,
+ NUBUS_CAT_DISPLAY = 0x0003,
+ NUBUS_CAT_NETWORK = 0x0004,
+ NUBUS_CAT_COMMUNICATIONS = 0x0006,
+ NUBUS_CAT_FONT = 0x0009,
+ NUBUS_CAT_CPU = 0x000A,
+ /* For lack of a better name */
+ NUBUS_CAT_DUODOCK = 0x0020
+};
+
+enum nubus_type_network {
+ NUBUS_TYPE_ETHERNET = 0x0001,
+ NUBUS_TYPE_RS232 = 0x0002
+};
+
+enum nubus_type_display {
+ NUBUS_TYPE_VIDEO = 0x0001
+};
+
+enum nubus_type_cpu {
+ NUBUS_TYPE_68020 = 0x0003,
+ NUBUS_TYPE_68030 = 0x0004,
+ NUBUS_TYPE_68040 = 0x0005
+};
+
+/* Known <Cat,Type,SW,HW> tuples: (according to TattleTech and Slots)
+ * 68030 motherboards: <10,4,0,24>
+ * 68040 motherboards: <10,5,0,24>
+ * DuoDock Plus: <32,1,1,2>
+ *
+ * Toby Frame Buffer card: <3,1,1,1>
+ * RBV built-in video (IIci): <3,1,1,24>
+ * Valkyrie built-in video (Q630): <3,1,1,46>
+ * Macintosh Display Card: <3,1,1,25>
+ * Sonora built-in video (P460): <3,1,1,34>
+ * Jet framebuffer (DuoDock Plus): <3,1,1,41>
+ *
+ * SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272>
+ * SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271>
+ * Sonic Systems Ethernet A-Series Card: <4,1,268,256>
+ * Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision)
+ * ROM on the above card: <2,1,0,0>
+ * Cabletron ethernet card: <4,1,1,265>
+ * Farallon ethernet card: <4,1,268,256> (identical to Sonic Systems card)
+ * Kinetics EtherPort IIN: <4,1,259,262>
+ * API Engineering EtherRun_LCa PDS enet card: <4,1,282,256>
+ *
+ * Add your devices to the list! You can obtain the "Slots" utility
+ * from Apple's FTP site at:
+ * ftp://dev.apple.com/devworld/Tool_Chest/Devices_-_Hardware/NuBus_Slot_Manager/
+ *
+ * Alternately, TattleTech can be found at any Info-Mac mirror site.
+ * or from its distribution site: ftp://ftp.decismkr.com/dms
+ */
+
+/* DrSW: Uniquely identifies the software interface to a board. This
+ is usually the one you want to look at when writing a driver. It's
+ not as useful as you think, though, because as we should know by
+ now (duh), "Apple Compatible" can mean a lot of things... */
+
+/* Add known DrSW values here */
+enum nubus_drsw {
+ /* NUBUS_CAT_DISPLAY */
+ NUBUS_DRSW_APPLE = 0x0001,
+ NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */
+
+ /* NUBUS_CAT_NETWORK */
+ NUBUS_DRSW_CABLETRON = 0x0001,
+ NUBUS_DRSW_SONIC_LC = 0x0001,
+ NUBUS_DRSW_KINETICS = 0x0103,
+ NUBUS_DRSW_ASANTE = 0x0104,
+ NUBUS_DRSW_DAYNA = 0x010b,
+ NUBUS_DRSW_FARALLON = 0x010c,
+ NUBUS_DRSW_APPLE_SN = 0x010f,
+ NUBUS_DRSW_FOCUS = 0x011a,
+ NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */
+
+ /* NUBUS_CAT_CPU */
+ NUBUS_DRSW_NONE = 0x0000,
+};
+
+/* DrHW: Uniquely identifies the hardware interface to a board (or at
+ least, it should... some video cards are known to incorrectly
+ identify themselves as Toby cards) */
+
+/* Add known DrHW values here */
+enum nubus_drhw {
+ /* NUBUS_CAT_DISPLAY */
+ NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */
+ NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */
+ NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */
+ NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */
+ NUBUS_DRHW_APPLE_VALKYRIE = 0x002e,
+ NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */
+
+ /* NUBUS_CAT_NETWORK */
+ NUBUS_DRHW_INTERLAN = 0x0100,
+ NUBUS_DRHW_SMC9194 = 0x0101,
+ NUBUS_DRHW_KINETICS = 0x0106,
+ NUBUS_DRHW_CABLETRON = 0x0109,
+ NUBUS_DRHW_ASANTE_LC = 0x010f,
+ NUBUS_DRHW_SONIC = 0x0110,
+};
+
+/* Resource IDs: These are the identifiers for the various weird and
+ wonderful tidbits of information that may or may not reside in the
+ NuBus ROM directory. */
+enum nubus_res_id {
+ NUBUS_RESID_TYPE = 0x0001,
+ NUBUS_RESID_NAME = 0x0002,
+ NUBUS_RESID_ICON = 0x0003,
+ NUBUS_RESID_DRVRDIR = 0x0004,
+ NUBUS_RESID_LOADREC = 0x0005,
+ NUBUS_RESID_BOOTREC = 0x0006,
+ NUBUS_RESID_FLAGS = 0x0007,
+ NUBUS_RESID_HWDEVID = 0x0008,
+ NUBUS_RESID_MINOR_BASEOS = 0x000a,
+ NUBUS_RESID_MINOR_LENGTH = 0x000b,
+ NUBUS_RESID_MAJOR_BASEOS = 0x000c,
+ NUBUS_RESID_MAJOR_LENGTH = 0x000d,
+ NUBUS_RESID_CICN = 0x000f,
+ NUBUS_RESID_ICL8 = 0x0010,
+ NUBUS_RESID_ICL4 = 0x0011,
+};
+
+/* Category-specific resources. */
+enum nubus_board_res_id {
+ NUBUS_RESID_BOARDID = 0x0020,
+ NUBUS_RESID_PRAMINITDATA = 0x0021,
+ NUBUS_RESID_PRIMARYINIT = 0x0022,
+ NUBUS_RESID_TIMEOUTCONST = 0x0023,
+ NUBUS_RESID_VENDORINFO = 0x0024,
+ NUBUS_RESID_BOARDFLAGS = 0x0025,
+ NUBUS_RESID_SECONDINIT = 0x0026,
+
+ /* Not sure why Apple put these next two in here */
+ NUBUS_RESID_VIDNAMES = 0x0041,
+ NUBUS_RESID_VIDMODES = 0x007e
+};
+
+/* Fields within the vendor info directory */
+enum nubus_vendor_res_id {
+ NUBUS_RESID_VEND_ID = 0x0001,
+ NUBUS_RESID_VEND_SERIAL = 0x0002,
+ NUBUS_RESID_VEND_REV = 0x0003,
+ NUBUS_RESID_VEND_PART = 0x0004,
+ NUBUS_RESID_VEND_DATE = 0x0005
+};
+
+enum nubus_net_res_id {
+ NUBUS_RESID_MAC_ADDRESS = 0x0080
+};
+
+enum nubus_cpu_res_id {
+ NUBUS_RESID_MEMINFO = 0x0081,
+ NUBUS_RESID_ROMINFO = 0x0082
+};
+
+enum nubus_display_res_id {
+ NUBUS_RESID_GAMMADIR = 0x0040,
+ NUBUS_RESID_FIRSTMODE = 0x0080,
+ NUBUS_RESID_SECONDMODE = 0x0081,
+ NUBUS_RESID_THIRDMODE = 0x0082,
+ NUBUS_RESID_FOURTHMODE = 0x0083,
+ NUBUS_RESID_FIFTHMODE = 0x0084,
+ NUBUS_RESID_SIXTHMODE = 0x0085
};
struct nubus_dir
{
unsigned char *base;
- int length;
- int count;
+ unsigned char *ptr;
+ int done;
int mask;
};
struct nubus_dirent
{
+ unsigned char *base;
unsigned char type;
- int value; /* Actually 24bits used */
+ __u32 data; /* Actually 24bits used */
int mask;
- int base; /* For dirptr function */
};
-struct nubus_type
-{
- __u16 category;
- __u16 type;
- __u16 DrHW;
- __u16 DrSW;
-};
+struct nubus_board {
+ struct nubus_board* next;
+ struct nubus_dev* first_dev;
+
+ /* Only 9-E actually exist, though 0-8 are also theoretically
+ possible, and 0 is a special case which represents the
+ motherboard and onboard peripherals (Ethernet, video) */
+ int slot;
+ /* For slot 0, this is bogus. */
+ char name[64];
-#define NUBUS_CAT_BOARD 0x0001
-#define NUBUS_CAT_DISPLAY 0x0003
-#define NUBUS_CAT_NETWORK 0x0004
-#define NUBUS_CAT_COMMUNICATIONS 0x0006
-#define NUBUS_CAT_FONT 0x0009
-#define NUBUS_CAT_CPU 0x000A
+ /* Format block */
+ unsigned char* fblock;
+ /* Root directory (does *not* always equal fblock + doffset!) */
+ unsigned char* directory;
+
+ unsigned long slot_addr;
+ /* Offset to root directory (sometimes) */
+ unsigned long doffset;
+ /* Length over which to compute the crc */
+ unsigned long rom_length;
+ /* Completely useless most of the time */
+ unsigned long crc;
+ unsigned char rev;
+ unsigned char format;
+ unsigned char lanes;
+};
-#define RES_ID_TYPE 0x0001
-#define RES_ID_NAME 0x0002
-#define RES_ID_BOARD_DIR 0x0001
-#define RES_ID_FLAGS 0x0007
+struct nubus_dev {
+ /* Next link in device list */
+ struct nubus_dev* next;
+ /* Directory entry in /proc/bus/nubus */
+ struct proc_dir_entry* procdir;
-struct nubus_device_specifier
-{
- int (*setup)(struct nubus_device_specifier *, int slot, struct nubus_type *);
- struct nubus_device_specifier *next;
+ /* The functional resource ID of this device */
+ unsigned char resid;
+ /* These are mostly here for convenience; we could always read
+ them from the ROMs if we wanted to */
+ unsigned short category;
+ unsigned short type;
+ unsigned short dr_sw;
+ unsigned short dr_hw;
+ /* This is the device's name rather than the board's.
+ Sometimes they are different. Usually the board name is
+ more correct. */
+ char name[64];
+ /* MacOS driver (I kid you not) */
+ unsigned char* driver;
+ /* Actually this is an offset */
+ unsigned long iobase;
+ unsigned long iosize;
+ unsigned char flags, hwdevid;
+
+ /* Functional directory */
+ unsigned char* directory;
+ /* Much of our info comes from here */
+ struct nubus_board* board;
};
+/* This is all NuBus devices (used to find devices later on) */
+extern struct nubus_dev* nubus_devices;
+/* This is all NuBus cards */
+extern struct nubus_board* nubus_boards;
-extern void register_nubus_device(struct nubus_device_specifier *nb);
-extern void unregister_nubus_device(struct nubus_device_specifier *nb);
-
-extern struct nubus_dir *nubus_openrootdir(int slot);
-extern struct nubus_dir *nubus_opensubdir(struct nubus_dirent *d);
-extern void nubus_closedir(struct nubus_dir *);
-extern struct nubus_dirent *nubus_readdir(struct nubus_dir *);
-extern unsigned char *nubus_dirptr(struct nubus_dirent *d);
-extern void nubus_strncpy(int slot, void *to, unsigned char *p, int len);
-extern void nubus_memcpy(int slot, void *to, unsigned char *p, int len);
+/* Generic NuBus interface functions, modelled after the PCI interface */
extern void nubus_init(void);
-extern void nubus_sweep_video(void);
-extern int nubus_ethernet_addr(int slot, unsigned char *addr);
+void nubus_scan_bus(void);
+extern void nubus_proc_init(void);
+int get_nubus_list(char *buf);
+int nubus_proc_attach_device(struct nubus_dev *dev);
+int nubus_proc_detach_device(struct nubus_dev *dev);
+/* If we need more precision we can add some more of these */
+struct nubus_dev* nubus_find_device(unsigned short category,
+ unsigned short type,
+ unsigned short dr_hw,
+ unsigned short dr_sw,
+ const struct nubus_dev* from);
+struct nubus_dev* nubus_find_type(unsigned short category,
+ unsigned short type,
+ const struct nubus_dev* from);
+/* Might have more than one device in a slot, you know... */
+struct nubus_dev* nubus_find_slot(unsigned int slot,
+ const struct nubus_dev* from);
+
+/* These are somewhat more NuBus-specific. They all return 0 for
+ success and -1 for failure, as you'd expect. */
-extern __inline void *nubus_slot_addr(int slot)
+/* The root directory which contains the board and functional
+ directories */
+int nubus_get_root_dir(const struct nubus_board* board,
+ struct nubus_dir* dir);
+/* The board directory */
+int nubus_get_board_dir(const struct nubus_board* board,
+ struct nubus_dir* dir);
+/* The functional directory */
+int nubus_get_func_dir(const struct nubus_dev* dev,
+ struct nubus_dir* dir);
+
+/* These work on any directory gotten via the above */
+int nubus_readdir(struct nubus_dir* dir,
+ struct nubus_dirent* ent);
+int nubus_find_rsrc(struct nubus_dir* dir,
+ unsigned char rsrc_type,
+ struct nubus_dirent* ent);
+int nubus_rewinddir(struct nubus_dir* dir);
+
+/* Things to do with directory entries */
+int nubus_get_subdir(const struct nubus_dirent* ent,
+ struct nubus_dir* dir);
+void nubus_get_rsrc_mem(void* dest,
+ const struct nubus_dirent *dirent,
+ int len);
+void nubus_get_rsrc_str(void* dest,
+ const struct nubus_dirent *dirent,
+ int maxlen);
+
+/* We'd like to get rid of this eventually. Only daynaport.c uses it now. */
+extern inline void *nubus_slot_addr(int slot)
{
return (void *)(0xF0000000|(slot<<24));
}
-extern int nubus_hwreg_present(volatile void *ptr);
-
-extern void nubus_init_via(void);
-extern int nubus_free_irq(int slot);
-extern int nubus_request_irq(int slot, void *dev_id, void (*handler)(int,void *,struct pt_regs *));
-
+#endif LINUX_NUBUS_H
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 33a969a98..0aff25c29 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -103,11 +103,8 @@ extern void ___wait_on_page(struct page *);
static inline void wait_on_page(struct page * page)
{
-
if (PageLocked(page))
___wait_on_page(page);
}
-extern void update_vm_cache(struct inode *, unsigned long, const char *, int);
-
#endif
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 0d65afa67..50256a87d 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -53,6 +53,7 @@ typedef enum {
#define PARPORT_MODE_ECP (1<<3) /* Hardware ECP. */
#define PARPORT_MODE_COMPAT (1<<4) /* Hardware 'printer protocol'. */
#define PARPORT_MODE_DMA (1<<5) /* Hardware can DMA. */
+#define PARPORT_MODE_SAFEININT (1<<6) /* SPP registers accessible in IRQ. */
/* IEEE1284 modes:
Nibble mode, byte mode, ECP, ECPRLE and EPP are their own
@@ -70,13 +71,22 @@ typedef enum {
#define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */
#define IEEE1284_DEVICEID (1<<2) /* This is a flag */
+/* For the benefit of parport_read/write, you can use these with
+ * parport_negotiate to use address operations. They have no effect
+ * other than to make parport_read/write use address transfers. */
+#define IEEE1284_ADDR (1<<13) /* This is a flag */
+#define IEEE1284_DATA 0 /* So is this */
+
+/* Flags for block transfer operations. */
+#define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */
+
/* The rest is for the kernel only */
#ifdef __KERNEL__
#include <linux/wait.h>
+#include <linux/spinlock.h>
#include <asm/system.h>
#include <asm/ptrace.h>
-#include <asm/spinlock.h>
#include <asm/semaphore.h>
#include <linux/proc_fs.h>
#include <linux/config.h>
@@ -138,15 +148,12 @@ struct parport_operations {
void (*data_reverse) (struct parport *);
/* For core parport code. */
- void (*interrupt)(int, void *, struct pt_regs *); /* ? */
-
void (*init_state)(struct pardevice *, struct parport_state *);
void (*save_state)(struct parport *, struct parport_state *);
void (*restore_state)(struct parport *, struct parport_state *);
void (*inc_use_count)(void);
void (*dec_use_count)(void);
- void (*fill_inode)(struct inode *inode, int fill); /* ? */
/* Block read/write */
size_t (*epp_write_data) (struct parport *port, const void *buf,
@@ -484,7 +491,8 @@ extern void dec_parport_count(void);
extern void inc_parport_count(void);
/* If PC hardware is the only type supported, we can optimise a bit. */
-#if (defined(CONFIG_PARPORT_PC) || defined(CONFIG_PARPORT_PC_MODULE)) && !(defined(CONFIG_PARPORT_AX) || defined(CONFIG_PARPORT_AX_MODULE)) && !(defined(CONFIG_PARPORT_ARC) || defined(CONFIG_PARPORT_ARC_MODULE)) && !(defined(CONFIG_PARPORT_AMIGA) || defined(CONFIG_PARPORT_AMIGA_MODULE)) && !(defined(CONFIG_PARPORT_MFC3) || defined(CONFIG_PARPORT_MFC3_MODULE)) && !(defined(CONFIG_PARPORT_ATARI) || defined(CONFIG_PARPORT_ATARI_MODULE)) && !defined(CONFIG_PARPORT_OTHER)
+#if (defined(CONFIG_PARPORT_PC) || defined(CONFIG_PARPORT_PC_MODULE)) && !(defined(CONFIG_PARPORT_ARC) || defined(CONFIG_PARPORT_ARC_MODULE)) && !(defined(CONFIG_PARPORT_AMIGA) || defined(CONFIG_PARPORT_AMIGA_MODULE)) && !(defined(CONFIG_PARPORT_MFC3) || defined(CONFIG_PARPORT_MFC3_MODULE)) && !(defined(CONFIG_PARPORT_ATARI) || defined(CONFIG_PARPORT_ATARI_MODULE)) && !(defined(CONFIG_USB_USS720) || defined(CONFIG_USB_USS720_MODULE)) && !(defined(CONFIG_PARPORT_SUNBPP) || defined(CONFIG_PARPORT_SUNBPP_MODULE)) && !defined(CONFIG_PARPORT_OTHER)
+
#undef PARPORT_NEED_GENERIC_OPS
#include <linux/parport_pc.h>
#define parport_write_data(p,x) parport_pc_write_data(p,x)
diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h
index 955e685ad..a8c67bc9d 100644
--- a/include/linux/parport_pc.h
+++ b/include/linux/parport_pc.h
@@ -53,12 +53,16 @@ extern __inline__ unsigned char __frob_control (struct parport *p,
unsigned char mask,
unsigned char val)
{
+ const unsigned char wm = (PARPORT_CONTROL_STROBE |
+ PARPORT_CONTROL_AUTOFD |
+ PARPORT_CONTROL_INIT |
+ PARPORT_CONTROL_SELECT);
struct parport_pc_private *priv = p->physport->private_data;
unsigned char ctr = priv->ctr;
ctr = (ctr & ~mask) ^ val;
ctr &= priv->ctr_writable; /* only write writable bits. */
outb (ctr, CONTROL (p));
- return priv->ctr = ctr; /* update soft copy */
+ return priv->ctr = ctr & wm; /* update soft copy */
}
extern __inline__ void parport_pc_data_reverse (struct parport *p)
@@ -147,4 +151,9 @@ extern void parport_pc_inc_use_count(void);
extern void parport_pc_dec_use_count(void);
+/* PCMCIA code will want to get us to look at a port. Provide a mechanism. */
+extern struct parport *parport_pc_probe_port (unsigned long base,
+ unsigned long base_hi,
+ int irq, int dma);
+
#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 22bae0020..5148fcd7f 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -38,7 +38,7 @@
#define PCI_STATUS 0x06 /* 16 bits */
#define PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
#define PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
-#define PCI_STATUS_UDF 0x40 /* Support User Definable Features */
+#define PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
#define PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
#define PCI_STATUS_PARITY 0x100 /* Detected parity error */
#define PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
@@ -86,7 +86,7 @@
#define PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
#define PCI_BASE_ADDRESS_MEM_TYPE_MASK 0x06
#define PCI_BASE_ADDRESS_MEM_TYPE_32 0x00 /* 32 bit address */
-#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M */
+#define PCI_BASE_ADDRESS_MEM_TYPE_1M 0x02 /* Below 1M [obsolete] */
#define PCI_BASE_ADDRESS_MEM_TYPE_64 0x04 /* 64 bit address */
#define PCI_BASE_ADDRESS_MEM_PREFETCH 0x08 /* prefetchable? */
#define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL)
@@ -135,7 +135,8 @@
#define PCI_PREF_LIMIT_UPPER32 0x2c
#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */
#define PCI_IO_LIMIT_UPPER16 0x32
-/* 0x34-0x3b is reserved */
+/* 0x34 same as for htype 0 */
+/* 0x35-0x3b is reserved */
#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */
/* 0x3c-0x3d are same as for htype 0 */
#define PCI_BRIDGE_CONTROL 0x3e
@@ -185,10 +186,81 @@
/* 0x48-0x7f reserved */
/* Capability lists */
+
#define PCI_CAP_LIST_ID 0 /* Capability ID */
#define PCI_CAP_ID_PM 0x01 /* Power Management */
#define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
+#define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */
+#define PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */
+#define PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
+#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
+#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
+#define PCI_CAP_SIZEOF 4
+
+/* Power Management Registers */
+
+#define PCI_PM_CAP_VER_MASK 0x0007 /* Version */
+#define PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
+#define PCI_PM_CAP_AUX_POWER 0x0010 /* Auxilliary power support */
+#define PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */
+#define PCI_PM_CAP_D1 0x0200 /* D1 power state support */
+#define PCI_PM_CAP_D2 0x0400 /* D2 power state support */
+#define PCI_PM_CAP_PME 0x0800 /* PME pin supported */
+#define PCI_PM_CTRL 4 /* PM control and status register */
+#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
+#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
+#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
+#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
+#define PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */
+#define PCI_PM_PPB_EXTENSIONS 6 /* PPB support extensions (??) */
+#define PCI_PM_PPB_B2_B3 0x40 /* Stop clock when in D3hot (??) */
+#define PCI_PM_BPCC_ENABLE 0x80 /* Bus power/clock control enable (??) */
+#define PCI_PM_DATA_REGISTER 7 /* (??) */
+#define PCI_PM_SIZEOF 8
+
+/* AGP registers */
+
+#define PCI_AGP_VERSION 2 /* BCD version number */
+#define PCI_AGP_RFU 3 /* Rest of capability flags */
+#define PCI_AGP_STATUS 4 /* Status register */
+#define PCI_AGP_STATUS_RQ_MASK 0xff000000 /* Maximum number of requests - 1 */
+#define PCI_AGP_STATUS_SBA 0x0200 /* Sideband addressing supported */
+#define PCI_AGP_STATUS_64BIT 0x0020 /* 64-bit addressing supported */
+#define PCI_AGP_STATUS_FW 0x0010 /* FW transfers supported */
+#define PCI_AGP_STATUS_RATE4 0x0004 /* 4x transfer rate supported */
+#define PCI_AGP_STATUS_RATE2 0x0002 /* 2x transfer rate supported */
+#define PCI_AGP_STATUS_RATE1 0x0001 /* 1x transfer rate supported */
+#define PCI_AGP_COMMAND 8 /* Control register */
+#define PCI_AGP_COMMAND_RQ_MASK 0xff000000 /* Master: Maximum number of requests */
+#define PCI_AGP_COMMAND_SBA 0x0200 /* Sideband addressing enabled */
+#define PCI_AGP_COMMAND_AGP 0x0100 /* Allow processing of AGP transactions */
+#define PCI_AGP_COMMAND_64BIT 0x0020 /* Allow processing of 64-bit addresses */
+#define PCI_AGP_COMMAND_FW 0x0010 /* Force FW transfers */
+#define PCI_AGP_COMMAND_RATE4 0x0004 /* Use 4x rate */
+#define PCI_AGP_COMMAND_RATE2 0x0002 /* Use 4x rate */
+#define PCI_AGP_COMMAND_RATE1 0x0001 /* Use 4x rate */
+#define PCI_AGP_SIZEOF 12
+
+/* Slot Identification */
+
+#define PCI_SID_ESR 2 /* Expansion Slot Register */
+#define PCI_SID_ESR_NSLOTS 0x1f /* Number of expansion slots available */
+#define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */
+#define PCI_SID_CHASSIS_NR 3 /* Chassis Number */
+
+/* Message Signalled Interrupts registers */
+
+#define PCI_MSI_FLAGS 2 /* Various flags */
+#define PCI_MSI_FLAGS_64BIT 0x80 /* 64-bit addresses allowed */
+#define PCI_MSI_FLAGS_QSIZE 0x70 /* Message queue size configured */
+#define PCI_MSI_FLAGS_QMASK 0x0e /* Maximum queue size available */
+#define PCI_MSI_FLAGS_ENABLE 0x01 /* MSI feature enabled */
+#define PCI_MSI_RFU 3 /* Rest of capability flags */
+#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
+#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
+#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */
+#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
/* Device classes and subclasses */
@@ -286,6 +358,7 @@
* <pci-ids@ucw.cz>.
*/
#define PCI_VENDOR_ID_COMPAQ 0x0e11
+#define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508
#define PCI_DEVICE_ID_COMPAQ_1280 0x3033
#define PCI_DEVICE_ID_COMPAQ_TRIFLEX 0x4000
#define PCI_DEVICE_ID_COMPAQ_SMART2P 0xae10
@@ -372,6 +445,7 @@
#define PCI_DEVICE_ID_DEC_21152 0x0024
#define PCI_DEVICE_ID_DEC_21153 0x0025
#define PCI_DEVICE_ID_DEC_21154 0x0026
+#define PCI_DEVICE_ID_DEC_21285 0x1065
#define PCI_DEVICE_ID_COMPAQ_42XX 0x0046
#define PCI_VENDOR_ID_CIRRUS 0x1013
@@ -382,6 +456,7 @@
#define PCI_DEVICE_ID_CIRRUS_5436 0x00ac
#define PCI_DEVICE_ID_CIRRUS_5446 0x00b8
#define PCI_DEVICE_ID_CIRRUS_5480 0x00bc
+#define PCI_DEVICE_ID_CIRRUS_5462 0x00d0
#define PCI_DEVICE_ID_CIRRUS_5464 0x00d4
#define PCI_DEVICE_ID_CIRRUS_5465 0x00d6
#define PCI_DEVICE_ID_CIRRUS_6729 0x1100
@@ -412,11 +487,21 @@
#define PCI_DEVICE_ID_AMD_SCSI 0x2020
#define PCI_VENDOR_ID_TRIDENT 0x1023
+#define PCI_DEVICE_ID_TRIDENT_9320 0x9320
+#define PCI_DEVICE_ID_TRIDENT_9388 0x9388
#define PCI_DEVICE_ID_TRIDENT_9397 0x9397
+#define PCI_DEVICE_ID_TRIDENT_939A 0x939A
+#define PCI_DEVICE_ID_TRIDENT_9520 0x9520
+#define PCI_DEVICE_ID_TRIDENT_9525 0x9525
#define PCI_DEVICE_ID_TRIDENT_9420 0x9420
#define PCI_DEVICE_ID_TRIDENT_9440 0x9440
#define PCI_DEVICE_ID_TRIDENT_9660 0x9660
#define PCI_DEVICE_ID_TRIDENT_9750 0x9750
+#define PCI_DEVICE_ID_TRIDENT_9850 0x9850
+#define PCI_DEVICE_ID_TRIDENT_9880 0x9880
+#define PCI_DEVICE_ID_TRIDENT_8400 0x8400
+#define PCI_DEVICE_ID_TRIDENT_8420 0x8420
+#define PCI_DEVICE_ID_TRIDENT_8500 0x8500
#define PCI_VENDOR_ID_AI 0x1025
#define PCI_DEVICE_ID_AI_M1435 0x1435
@@ -427,11 +512,13 @@
#define PCI_DEVICE_ID_MATROX_MYS 0x051A
#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b
#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f
-#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520
-#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521
#define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10
#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000
#define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001
+#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520
+#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521
+#define PCI_DEVICE_ID_MATROX_G400 0x0525
+#define PCI_DEVICE_ID_MATROX_VIA 0x4536
#define PCI_VENDOR_ID_CT 0x102c
#define PCI_DEVICE_ID_CT_65545 0x00d8
@@ -458,13 +545,18 @@
#define PCI_DEVICE_ID_SI_6205 0x0205
#define PCI_DEVICE_ID_SI_501 0x0406
#define PCI_DEVICE_ID_SI_496 0x0496
+#define PCI_DEVICE_ID_SI_530 0x0530
#define PCI_DEVICE_ID_SI_601 0x0601
+#define PCI_DEVICE_ID_SI_620 0x0620
#define PCI_DEVICE_ID_SI_5107 0x5107
#define PCI_DEVICE_ID_SI_5511 0x5511
#define PCI_DEVICE_ID_SI_5513 0x5513
#define PCI_DEVICE_ID_SI_5571 0x5571
#define PCI_DEVICE_ID_SI_5591 0x5591
#define PCI_DEVICE_ID_SI_5597 0x5597
+#define PCI_DEVICE_ID_SI_5600 0x5600
+#define PCI_DEVICE_ID_SI_6306 0x6306
+#define PCI_DEVICE_ID_SI_6326 0x6326
#define PCI_DEVICE_ID_SI_7001 0x7001
#define PCI_VENDOR_ID_HP 0x103c
@@ -517,6 +609,7 @@
/* Winbond have two vendor IDs! See 0x10ad as well */
#define PCI_VENDOR_ID_WINBOND2 0x1050
#define PCI_DEVICE_ID_WINBOND2_89C940 0x0940
+#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a
#define PCI_VENDOR_ID_MOTOROLA 0x1057
#define PCI_VENDOR_ID_MOTOROLA_OOPS 0x1507
@@ -550,6 +643,24 @@
#define PCI_VENDOR_ID_X 0x1061
#define PCI_DEVICE_ID_X_AGX016 0x0001
+#define PCI_VENDOR_ID_MYLEX 0x1069
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V2 0x0001
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V3 0x0002
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V4 0x0010
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V5 0x0020
+
+#define PCI_VENDOR_ID_MYLEX 0x1069
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V2 0x0001
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V3 0x0002
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V4 0x0010
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V5 0x0020
+
+#define PCI_VENDOR_ID_MYLEX 0x1069
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V2 0x0001
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V3 0x0002
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V4 0x0010
+#define PCI_DEVICE_ID_MYLEX_DAC960P_V5 0x0020
+
#define PCI_VENDOR_ID_PICOP 0x1066
#define PCI_DEVICE_ID_PICOP_PT86C52X 0x0001
#define PCI_DEVICE_ID_PICOP_PT80C524 0x8002
@@ -566,6 +677,7 @@
#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020
#define PCI_DEVICE_ID_QLOGIC_ISP1022 0x1022
#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100
+#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200
#define PCI_VENDOR_ID_CYRIX 0x1078
#define PCI_DEVICE_ID_CYRIX_5510 0x0000
@@ -625,9 +737,6 @@
#define PCI_VENDOR_ID_SGI 0x10a9
#define PCI_DEVICE_ID_SGI_IOC3 0x0003
-#define PCI_VENDOR_ID_SGI 0x10a9
-#define PCI_DEVICE_ID_SGI_IOC3 0x0003
-
#define PCI_VENDOR_ID_ACC 0x10aa
#define PCI_DEVICE_ID_ACC_2056 0x0000
@@ -640,11 +749,13 @@
#define PCI_DEVICE_ID_DATABOOK_87144 0xb106
#define PCI_VENDOR_ID_PLX 0x10b5
+#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103
#define PCI_DEVICE_ID_PLX_9050 0x9050
#define PCI_DEVICE_ID_PLX_9060 0x9060
#define PCI_DEVICE_ID_PLX_9060ES 0x906E
#define PCI_DEVICE_ID_PLX_9060SD 0x906D
#define PCI_DEVICE_ID_PLX_9080 0x9080
+#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001
#define PCI_VENDOR_ID_MADGE 0x10b6
#define PCI_DEVICE_ID_MADGE_MK2 0x0002
@@ -717,6 +828,12 @@
#define PCI_DEVICE_ID_CERN_HIPPI_SRC 0x0022
#define PCI_VENDOR_ID_NVIDIA 0x10de
+#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020
+#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028
+#define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029
+#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C
+#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D
+#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0
#define PCI_VENDOR_ID_IMS 0x10e0
#define PCI_DEVICE_ID_IMS_8849 0x8849
@@ -736,6 +853,7 @@
#define PCI_VENDOR_ID_INTERG 0x10ea
#define PCI_DEVICE_ID_INTERG_1680 0x1680
#define PCI_DEVICE_ID_INTERG_1682 0x1682
+#define PCI_DEVICE_ID_INTERG_2000 0x2000
#define PCI_VENDOR_ID_REALTEK 0x10ec
#define PCI_DEVICE_ID_REALTEK_8029 0x8029
@@ -751,8 +869,10 @@
#define PCI_VENDOR_ID_TTI 0x1103
#define PCI_DEVICE_ID_TTI_HPT343 0x0003
+#define PCI_DEVICE_ID_TTI_HPT366 0x0004
#define PCI_VENDOR_ID_VIA 0x1106
+#define PCI_DEVICE_ID_VIA_8501_0 0x0501
#define PCI_DEVICE_ID_VIA_82C505 0x0505
#define PCI_DEVICE_ID_VIA_82C561 0x0561
#define PCI_DEVICE_ID_VIA_82C586_1 0x0571
@@ -760,16 +880,25 @@
#define PCI_DEVICE_ID_VIA_82C585 0x0585
#define PCI_DEVICE_ID_VIA_82C586_0 0x0586
#define PCI_DEVICE_ID_VIA_82C595 0x0595
+#define PCI_DEVICE_ID_VIA_82C596 0x0596
#define PCI_DEVICE_ID_VIA_82C597_0 0x0597
-#define PCI_DEVICE_ID_VIA_82C598_0 0x0598
+#define PCI_DEVICE_ID_VIA_82C598_0 0x0598
+#define PCI_DEVICE_ID_VIA_82C680 0x0680
+#define PCI_DEVICE_ID_VIA_82C686 0x0686
+#define PCI_DEVICE_ID_VIA_82C691 0x0691
+#define PCI_DEVICE_ID_VIA_82C693 0x0693
#define PCI_DEVICE_ID_VIA_82C926 0x0926
#define PCI_DEVICE_ID_VIA_82C416 0x1571
#define PCI_DEVICE_ID_VIA_82C595_97 0x1595
#define PCI_DEVICE_ID_VIA_82C586_2 0x3038
#define PCI_DEVICE_ID_VIA_82C586_3 0x3040
+#define PCI_DEVICE_ID_VIA_82C686_4 0x3057
+#define PCI_DEVICE_ID_VIA_82C686_5 0x3058
+#define PCI_DEVICE_ID_VIA_82C686_6 0x3068
#define PCI_DEVICE_ID_VIA_86C100A 0x6100
+#define PCI_DEVICE_ID_VIA_8501_1 0x8501
#define PCI_DEVICE_ID_VIA_82C597_1 0x8597
-#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
+#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
#define PCI_VENDOR_ID_SMC2 0x1113
#define PCI_DEVICE_ID_SMC2_1211TX 0x1211
@@ -879,8 +1008,8 @@
#define PCI_VENDOR_ID_OMEGA 0x119b
#define PCI_DEVICE_ID_OMEGA_82C092G 0x1221
-#define PCI_VENDOR_ID_GALILEO 0x11ab
-#define PCI_DEVICE_ID_GALILEO_GT64011 0x4146
+#define PCI_SUBVENDOR_ID_KEYSPAN 0x11a9
+#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334
#define PCI_VENDOR_ID_GALILEO 0x11ab
#define PCI_DEVICE_ID_GALILEO_GT64011 0x4146
@@ -888,6 +1017,12 @@
#define PCI_VENDOR_ID_LITEON 0x11ad
#define PCI_DEVICE_ID_LITEON_LNE100TX 0x0002
+#define PCI_VENDOR_ID_V3 0x11b0
+#define PCI_DEVICE_ID_V3_V960 0x0001
+#define PCI_DEVICE_ID_V3_V350 0x0001
+#define PCI_DEVICE_ID_V3_V960V2 0x0002
+#define PCI_DEVICE_ID_V3_V350V2 0x0002
+
#define PCI_VENDOR_ID_NP 0x11bc
#define PCI_DEVICE_ID_NP_PCI_FDDI 0x0001
@@ -951,6 +1086,7 @@
#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001
#define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002
#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003
+#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005
#define PCI_VENDOR_ID_SIGMADES 0x1236
#define PCI_DEVICE_ID_SIGMADES_6425 0x6401
@@ -974,6 +1110,9 @@
#define PCI_DEVICE_ID_OPTIBASE_VPLEXCC 0x2120
#define PCI_DEVICE_ID_OPTIBASE_VQUEST 0x2130
+#define PCI_VENDOR_ID_ESS 0x125d
+#define PCI_DEVICE_ID_ESS_AUDIOPCI 0x1969
+
#define PCI_VENDOR_ID_SATSAGEM 0x1267
#define PCI_DEVICE_ID_SATSAGEM_PCR2101 0x5352
#define PCI_DEVICE_ID_SATSAGEM_TELSATTURBO 0x5a4b
@@ -988,6 +1127,16 @@
#define PCI_VENDOR_ID_ALTEON 0x12ae
#define PCI_DEVICE_ID_ALTEON_ACENIC 0x0001
+#define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232 0x0003
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485 0x0004
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4 0x0005
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485 0x0006
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2 0x0007
+#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485 0x0008
+
#define PCI_VENDOR_ID_PICTUREL 0x12c5
#define PCI_DEVICE_ID_PICTUREL_PCIVST 0x0081
@@ -997,9 +1146,47 @@
#define PCI_VENDOR_ID_CBOARDS 0x1307
#define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001
+#define PCI_VENDOR_ID_SIIG 0x131f
+#define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010
+#define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011
+#define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012
+#define PCI_DEVICE_ID_SIIG_1P_10x 0x1020
+#define PCI_DEVICE_ID_SIIG_2P_10x 0x1021
+#define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034
+#define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035
+#define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036
+#define PCI_DEVICE_ID_SIIG_1P_20x 0x2020
+#define PCI_DEVICE_ID_SIIG_2P_20x 0x2021
+#define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040
+#define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041
+#define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042
+#define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010
+#define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011
+#define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012
+#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060
+#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061
+#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062
+
+#define PCI_VENDOR_ID_SEALEVEL 0x135e
+#define PCI_DEVICE_ID_SEALEVEL_U530 0x7101
+#define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201
+#define PCI_DEVICE_ID_SEALEVEL_UCOMM422 0x7402
+#define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202
+#define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401
+#define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801
+
#define PCI_VENDOR_ID_NETGEAR 0x1385
#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a
+#define PCI_VENDOR_ID_LAVA 0x1407
+#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000
+#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */
+#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */
+
+#define PCI_VENDOR_ID_PANACOM 0x14d4
+#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
+#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402
+
#define PCI_VENDOR_ID_SYMPHONY 0x1c1c
#define PCI_DEVICE_ID_SYMPHONY_101 0x0001
@@ -1056,6 +1243,8 @@
#define PCI_DEVICE_ID_INTEL_82378 0x0484
#define PCI_DEVICE_ID_INTEL_82430 0x0486
#define PCI_DEVICE_ID_INTEL_82434 0x04a3
+#define PCI_DEVICE_ID_INTEL_I960 0x0960
+#define PCI_DEVICE_ID_INTEL_82559ER 0x1209
#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221
#define PCI_DEVICE_ID_INTEL_82092AA_1 0x1222
#define PCI_DEVICE_ID_INTEL_7116 0x1223
@@ -1079,6 +1268,9 @@
#define PCI_DEVICE_ID_INTEL_82371AB 0x7111
#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112
#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
+#define PCI_VENDOR_ID_COMPUTONE 0x8e0e
+#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291
+
#define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180
#define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181
#define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190
@@ -1150,6 +1342,18 @@
#define PCI_DEVICE_ID_ARK_STINGARK 0xa099
#define PCI_DEVICE_ID_ARK_2000MT 0xa0a1
+#define PCI_VENDOR_ID_INTERPHASE 0x107e
+#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004
+#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005
+
+#define PCI_VENDOR_ID_INTERPHASE 0x107e
+#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004
+#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005
+
+#define PCI_VENDOR_ID_INTERPHASE 0x107e
+#define PCI_DEVICE_ID_INTERPHASE_5526 0x0004
+#define PCI_DEVICE_ID_INTERPHASE_55x6 0x0005
+
/*
* The PCI interface treats multi-function devices as independent
* devices. The slot/function address of each device is encoded
@@ -1166,12 +1370,20 @@
#include <linux/types.h>
#include <linux/config.h>
+#include <linux/ioport.h>
+
+#define DEVICE_COUNT_COMPATIBLE 4
+#define DEVICE_COUNT_IRQ 2
+#define DEVICE_COUNT_DMA 2
+#define DEVICE_COUNT_RESOURCE 12
/*
- * There is one pci_dev structure for each slot-number/function-number
- * combination:
+ * The pci_dev structure is used to describe both PCI and ISAPnP devices.
*/
struct pci_dev {
+ int active; /* device is active */
+ int ro; /* Read/Only */
+
struct pci_bus *bus; /* bus this device is on */
struct pci_dev *sibling; /* next device on this bus */
struct pci_dev *next; /* chain of all devices */
@@ -1182,36 +1394,56 @@ struct pci_dev {
unsigned int devfn; /* encoded device & function index */
unsigned short vendor;
unsigned short device;
+ unsigned short subsystem_vendor;
+ unsigned short subsystem_device;
unsigned int class; /* 3 bytes: (base,sub,prog-if) */
unsigned int hdr_type; /* PCI header type */
- unsigned int master : 1; /* set if device is master capable */
+
+ unsigned short regs;
+
+ /* device is compatible with these IDs */
+ unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE];
+ unsigned short device_compatible[DEVICE_COUNT_COMPATIBLE];
+
/*
- * In theory, the irq level can be read from configuration
- * space and all would be fine. However, old PCI chips don't
- * support these registers and return 0 instead. For example,
- * the Vision864-P rev 0 chip can uses INTA, but returns 0 in
- * the interrupt line and pin registers. pci_init()
- * initializes this field with the value at PCI_INTERRUPT_LINE
- * and it is the job of pcibios_fixup() to change it if
- * necessary. The field must not be 0 unless the device
- * cannot generate interrupts at all.
+ * Instead of touching interrupt line and base address registers
+ * directly, use the values stored here. They might be different!
*/
- unsigned int irq; /* irq generated by this device */
+ unsigned int irq;
+ struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */
+ struct resource dma_resource[DEVICE_COUNT_DMA];
+ struct resource irq_resource[DEVICE_COUNT_IRQ];
- /* Base registers for this device, can be adjusted by
- * pcibios_fixup() as necessary.
- */
- unsigned long base_address[6];
- unsigned long rom_address;
+ char name[48]; /* Device name */
+
+ int (*prepare)(struct pci_dev *dev);
+ int (*activate)(struct pci_dev *dev);
+ int (*deactivate)(struct pci_dev *dev);
};
+/*
+ * For PCI devices, the region numbers are assigned this way:
+ *
+ * 0-5 standard PCI regions
+ * 6 expansion ROM
+ * 7-10 bridges: address space assigned to buses behind the bridge
+ */
+
+#define PCI_ROM_RESOURCE 6
+#define PCI_BRIDGE_RESOURCES 7
+#define PCI_NUM_RESOURCES 11
+
+#define PCI_REGION_FLAG_MASK 0x0f /* These bits of resource flags tell us the PCI region flags */
+
struct pci_bus {
struct pci_bus *parent; /* parent bus this bridge is on */
struct pci_bus *children; /* chain of P2P bridges on this bus */
struct pci_bus *next; /* chain of all PCI buses */
+ struct pci_ops *ops; /* configuration access functions */
struct pci_dev *self; /* bridge device as seen by parent */
struct pci_dev *devices; /* devices behind this bridge */
+ struct resource *resource[4]; /* address space routed to this bus */
void *sysdata; /* hook for sys-specific extension */
struct proc_dir_entry *procdir; /* directory entry in /proc/bus/pci */
@@ -1220,13 +1452,22 @@ struct pci_bus {
unsigned char primary; /* number of primary bridge */
unsigned char secondary; /* number of secondary bridge */
unsigned char subordinate; /* max number of subordinate buses */
+
+ char name[48];
+ unsigned short vendor;
+ unsigned short device;
+ unsigned int serial; /* serial number */
+ unsigned char pnpver; /* Plug & Play version */
+ unsigned char productver; /* product version */
+ unsigned char checksum; /* if zero - checksum passed */
+ unsigned char pad1;
};
-extern struct pci_bus pci_root; /* root bus */
+extern struct pci_bus *pci_root; /* root bus */
extern struct pci_dev *pci_devices; /* list of all devices */
/*
- * Error values that may be returned by the PCI bios.
+ * Error values that may be returned by PCI functions.
*/
#define PCIBIOS_SUCCESSFUL 0x00
#define PCIBIOS_FUNC_NOT_SUPPORTED 0x81
@@ -1238,11 +1479,27 @@ extern struct pci_dev *pci_devices; /* list of all devices */
/* Low-level architecture-dependent routines */
-int pcibios_present (void);
+struct pci_ops {
+ int (*read_byte)(struct pci_dev *, int where, u8 *val);
+ int (*read_word)(struct pci_dev *, int where, u16 *val);
+ int (*read_dword)(struct pci_dev *, int where, u32 *val);
+ int (*write_byte)(struct pci_dev *, int where, u8 val);
+ int (*write_word)(struct pci_dev *, int where, u16 val);
+ int (*write_dword)(struct pci_dev *, int where, u32 val);
+};
+
void pcibios_init(void);
-void pcibios_fixup(void);
void pcibios_fixup_bus(struct pci_bus *);
char *pcibios_setup (char *str);
+void pcibios_update_resource(struct pci_dev *, struct resource *,
+ struct resource *, int);
+void pcibios_update_irq(struct pci_dev *, int irq);
+
+
+/* Backward compatibility, don't use in new code! */
+
+int pcibios_present(void);
+#define pci_present pcibios_present
int pcibios_read_config_byte (unsigned char bus, unsigned char dev_fn,
unsigned char where, unsigned char *val);
int pcibios_read_config_word (unsigned char bus, unsigned char dev_fn,
@@ -1255,9 +1512,6 @@ int pcibios_write_config_word (unsigned char bus, unsigned char dev_fn,
unsigned char where, unsigned short val);
int pcibios_write_config_dword (unsigned char bus, unsigned char dev_fn,
unsigned char where, unsigned int val);
-
-/* Don't use these in new code, use pci_find_... instead */
-
int pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *dev_fn);
int pcibios_find_device (unsigned short vendor, unsigned short dev_id,
unsigned short index, unsigned char *bus,
@@ -1266,29 +1520,36 @@ int pcibios_find_device (unsigned short vendor, unsigned short dev_id,
/* Generic PCI interface functions */
void pci_init(void);
-void pci_setup(char *str, int *ints);
-void pci_quirks_init(void);
-unsigned int pci_scan_bus(struct pci_bus *bus);
-struct pci_bus *pci_scan_peer_bridge(int bus);
-void pci_proc_init(void);
-void proc_old_pci_init(void);
+struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata);
int get_pci_list(char *buf);
int pci_proc_attach_device(struct pci_dev *dev);
int pci_proc_detach_device(struct pci_dev *dev);
+void pci_name_device(struct pci_dev *dev);
+struct resource *pci_find_parent_resource(struct pci_dev *dev, struct resource *res);
struct pci_dev *pci_find_device (unsigned int vendor, unsigned int device, struct pci_dev *from);
+struct pci_dev *pci_find_subsys (unsigned int vendor, unsigned int device,
+ unsigned int ss_vendor, unsigned int ss_device,
+ struct pci_dev *from);
struct pci_dev *pci_find_class (unsigned int class, struct pci_dev *from);
struct pci_dev *pci_find_slot (unsigned int bus, unsigned int devfn);
+int pci_find_capability (struct pci_dev *dev, int cap);
+
+int pci_assign_resource(struct pci_dev *dev, int i);
+int pci_claim_resource(struct pci_dev *, int);
+void pci_assign_unassigned_resources(u32 min_io, u32 min_mem);
+void pci_set_bus_ranges(void);
+void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
+ int (*)(struct pci_dev *, u8, u8));
#define PCI_ANY_ID (~0)
-#define pci_present pcibios_present
-int pci_read_config_byte(struct pci_dev *dev, u8 where, u8 *val);
-int pci_read_config_word(struct pci_dev *dev, u8 where, u16 *val);
-int pci_read_config_dword(struct pci_dev *dev, u8 where, u32 *val);
-int pci_write_config_byte(struct pci_dev *dev, u8 where, u8 val);
-int pci_write_config_word(struct pci_dev *dev, u8 where, u16 val);
-int pci_write_config_dword(struct pci_dev *dev, u8 where, u32 val);
+int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val);
+int pci_read_config_word(struct pci_dev *dev, int where, u16 *val);
+int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val);
+int pci_write_config_byte(struct pci_dev *dev, int where, u8 val);
+int pci_write_config_word(struct pci_dev *dev, int where, u16 val);
+int pci_write_config_dword(struct pci_dev *dev, int where, u32 val);
void pci_set_master(struct pci_dev *dev);
#ifndef CONFIG_PCI
@@ -1299,7 +1560,7 @@ extern inline int pcibios_present(void) { return 0; }
#define _PCI_NOP(o,s,t) \
extern inline int pcibios_##o##_config_##s## (u8 bus, u8 dfn, u8 where, t val) \
{ return PCIBIOS_FUNC_NOT_SUPPORTED; } \
- extern inline int pci_##o##_config_##s## (struct pci_dev *dev, u8 where, t val) \
+ extern inline int pci_##o##_config_##s## (struct pci_dev *dev, int where, t val) \
{ return PCIBIOS_FUNC_NOT_SUPPORTED; }
#define _PCI_NOP_ALL(o,x) _PCI_NOP(o,byte,u8 x) \
_PCI_NOP(o,word,u16 x) \
@@ -1316,7 +1577,31 @@ extern inline struct pci_dev *pci_find_class(unsigned int class, struct pci_dev
extern inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn)
{ return NULL; }
+extern inline void pci_set_master(struct pci_dev *dev)
+{ return; }
+
+
#endif /* !CONFIG_PCI */
+/*
+ * The world is not perfect and supplies us with broken PCI devices.
+ * For at least a part of these bugs we need a work-around, so both
+ * generic (drivers/pci/quirks.c) and per-architecture code can define
+ * fixup hooks to be called for particular buggy devices.
+ */
+
+struct pci_fixup {
+ int pass;
+ u16 vendor, device; /* You can use PCI_ANY_ID here of course */
+ void (*hook)(struct pci_dev *dev);
+};
+
+extern struct pci_fixup pcibios_fixups[];
+
+#define PCI_FIXUP_HEADER 1 /* Called immediately after reading configuration header */
+#define PCI_FIXUP_FINAL 2 /* Final phase of device fixups */
+
+void pci_fixup_device(int pass, struct pci_dev *dev);
+
#endif /* __KERNEL__ */
#endif /* LINUX_PCI_H */
diff --git a/include/linux/personality.h b/include/linux/personality.h
index a927b9e71..31a42d62c 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -27,9 +27,11 @@
#define PER_IRIX32 (0x0009 | STICKY_TIMEOUTS) /* IRIX5 32-bit */
#define PER_IRIXN32 (0x000a | STICKY_TIMEOUTS) /* IRIX6 new 32-bit */
#define PER_IRIX64 (0x000b | STICKY_TIMEOUTS) /* IRIX6 64-bit */
+#define PER_RISCOS (0x000c)
+#define PER_SOLARIS (0x000d | STICKY_TIMEOUTS)
/* Prototype for an lcall7 syscall handler. */
-typedef void (*lcall7_func)(struct pt_regs *);
+typedef void (*lcall7_func)(int, struct pt_regs *);
/* Description of an execution domain - personality range supported,
@@ -52,6 +54,6 @@ extern struct exec_domain default_exec_domain;
extern struct exec_domain *lookup_exec_domain(unsigned long personality);
extern int register_exec_domain(struct exec_domain *it);
extern int unregister_exec_domain(struct exec_domain *it);
-asmlinkage int sys_personality(unsigned long personality);
+asmlinkage long sys_personality(unsigned long personality);
#endif /* _PERSONALITY_H */
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index c00d37845..eb2d91054 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -3,32 +3,29 @@
struct pipe_inode_info {
wait_queue_head_t wait;
- char * base;
+ char *base;
unsigned int start;
- unsigned int lock;
- unsigned int rd_openers;
- unsigned int wr_openers;
unsigned int readers;
unsigned int writers;
};
-#define PIPE_WAIT(inode) ((inode).i_pipe->wait)
+/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
+ memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
+#define PIPE_SIZE PAGE_SIZE
+
+#define PIPE_SEM(inode) (&(inode).i_sem)
+#define PIPE_WAIT(inode) (&(inode).i_pipe->wait)
#define PIPE_BASE(inode) ((inode).i_pipe->base)
#define PIPE_START(inode) ((inode).i_pipe->start)
#define PIPE_LEN(inode) ((inode).i_size)
-#define PIPE_RD_OPENERS(inode) ((inode).i_pipe->rd_openers)
-#define PIPE_WR_OPENERS(inode) ((inode).i_pipe->wr_openers)
#define PIPE_READERS(inode) ((inode).i_pipe->readers)
#define PIPE_WRITERS(inode) ((inode).i_pipe->writers)
-#define PIPE_LOCK(inode) ((inode).i_pipe->lock)
-#define PIPE_SIZE(inode) PIPE_LEN(inode)
-#define PIPE_EMPTY(inode) (PIPE_SIZE(inode)==0)
-#define PIPE_FULL(inode) (PIPE_SIZE(inode)==PIPE_BUF)
-#define PIPE_FREE(inode) (PIPE_BUF - PIPE_LEN(inode))
-#define PIPE_END(inode) ((PIPE_START(inode)+PIPE_LEN(inode))&\
- (PIPE_BUF-1))
-#define PIPE_MAX_RCHUNK(inode) (PIPE_BUF - PIPE_START(inode))
-#define PIPE_MAX_WCHUNK(inode) (PIPE_BUF - PIPE_END(inode))
+#define PIPE_EMPTY(inode) (PIPE_LEN(inode) == 0)
+#define PIPE_FULL(inode) (PIPE_LEN(inode) == PIPE_SIZE)
+#define PIPE_FREE(inode) (PIPE_SIZE - PIPE_LEN(inode))
+#define PIPE_END(inode) ((PIPE_START(inode) + PIPE_LEN(inode)) & (PIPE_SIZE-1))
+#define PIPE_MAX_RCHUNK(inode) (PIPE_SIZE - PIPE_START(inode))
+#define PIPE_MAX_WCHUNK(inode) (PIPE_SIZE - PIPE_END(inode))
#endif
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 4f804d15f..1f87131dc 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -277,4 +277,18 @@ enum
#define TCA_CBQ_MAX TCA_CBQ_POLICE
+/* ATM section */
+
+enum {
+ TCA_ATM_UNSPEC,
+ TCA_ATM_FD, /* file/socket descriptor */
+ TCA_ATM_PTR, /* pointer to descriptor - later */
+ TCA_ATM_HDR, /* LL header */
+ TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */
+ TCA_ATM_ADDR, /* PVC address (for output only) */
+ TCA_ATM_STATE /* VC state (ATM_VS_*; for output only) */
+};
+
+#define TCA_ATM_MAX TCA_ATM_STATE
+
#endif
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h
index 3a5d58651..8de67f77d 100644
--- a/include/linux/ppp-comp.h
+++ b/include/linux/ppp-comp.h
@@ -195,4 +195,9 @@ struct compressor {
#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */
#define CILEN_PREDICTOR_2 2 /* length of its config option */
+#ifdef __KERNEL__
+extern int ppp_register_compressor(struct compressor *);
+extern void ppp_unregister_compressor(struct compressor *);
+#endif /* __KERNEL__ */
+
#endif /* _NET_PPP_COMP_H */
diff --git a/include/linux/ppp_channel.h b/include/linux/ppp_channel.h
new file mode 100644
index 000000000..d3b2e1a15
--- /dev/null
+++ b/include/linux/ppp_channel.h
@@ -0,0 +1,62 @@
+/*
+ * Definitions for the interface between the generic PPP code
+ * and a PPP channel.
+ *
+ * A PPP channel provides a way for the generic PPP code to send
+ * and receive packets over some sort of communications medium.
+ * Packets are stored in sk_buffs and have the 2-byte PPP protocol
+ * number at the start, but not the address and control bytes.
+ *
+ * Copyright 1999 Paul Mackerras.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * ==FILEVERSION 990717==
+ */
+
+/* $Id$ */
+
+#include <linux/list.h>
+#include <linux/skbuff.h>
+
+struct ppp_channel;
+
+struct ppp_channel_ops {
+ /* Send a packet (or multilink fragment) on this channel.
+ Returns 1 if it was accepted, 0 if not. */
+ int (*start_xmit)(struct ppp_channel *, struct sk_buff *);
+
+};
+
+struct ppp_channel {
+ void *private; /* channel private data */
+ struct ppp_channel_ops *ops; /* operations for this channel */
+ int xmit_qlen; /* length of transmit queue (bytes) */
+ int speed; /* transfer rate (bytes/second) */
+ int latency; /* overhead time in milliseconds */
+ struct list_head list; /* link in list of channels per unit */
+ void *ppp; /* opaque to channel */
+};
+
+#ifdef __KERNEL__
+/* Called by the channel when it can send some more data. */
+extern void ppp_output_wakeup(struct ppp_channel *);
+
+/* Called by the channel to process a received PPP packet.
+ The packet should have just the 2-byte PPP protocol header. */
+extern void ppp_input(struct ppp_channel *, struct sk_buff *);
+
+/* Called by the channel when an input error occurs, indicating
+ that we may have missed a packet. */
+extern void ppp_input_error(struct ppp_channel *, int code);
+
+/* Attach a channel to a given PPP unit. */
+extern int ppp_register_channel(struct ppp_channel *, int unit);
+
+/* Detach a channel from its PPP unit (e.g. on hangup). */
+extern void ppp_unregister_channel(struct ppp_channel *);
+
+#endif /* __KERNEL__ */
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index f08f3c36e..3382a6a57 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -1,9 +1,10 @@
#ifndef _LINUX_PRCTL_H
#define _LINUX_PRCTL_H
-/* Values to pass as first argument to prctl() */
+/* Values to pass as first argument to prctl() */
-#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */
+#define PR_SET_PDEATHSIG 1 /* Second arg is a signal */
+#define PR_GET_PDEATHSIG 2 /* Second arg is a ptr to return the signal */
#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index bbe90c229..f4a7e6d32 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -23,6 +23,7 @@ enum root_directory_inos {
PROC_PCI,
PROC_MCA,
PROC_NUBUS,
+ PROC_MAC_VIA,
PROC_SELF, /* will change inode # */
PROC_NET,
PROC_SCSI,
@@ -54,7 +55,8 @@ enum root_directory_inos {
PROC_SOUND,
PROC_MTRR, /* whether enabled or not */
PROC_FS,
- PROC_SYSVIPC
+ PROC_SYSVIPC,
+ PROC_DRIVER,
};
enum pid_directory_inos {
@@ -194,6 +196,7 @@ enum scsi_directory_inos {
PROC_SCSI_ESP,
PROC_SCSI_QLOGICPTI,
PROC_SCSI_AMIGA7XX,
+ PROC_SCSI_MVME147,
PROC_SCSI_MVME16x,
PROC_SCSI_BVME6000,
PROC_SCSI_A3000,
@@ -208,6 +211,7 @@ enum scsi_directory_inos {
PROC_SCSI_PLUTO,
PROC_SCSI_INI9100U,
PROC_SCSI_INIA100,
+ PROC_SCSI_IPH5526_FC,
PROC_SCSI_FCAL,
PROC_SCSI_I2O,
PROC_SCSI_USB_SCSI,
@@ -231,6 +235,9 @@ enum bus_directory_inos {
PROC_BUS_PCI_DEVICES,
PROC_BUS_ZORRO,
PROC_BUS_ZORRO_DEVICES,
+ PROC_BUS_ECARD_DEVICES,
+ PROC_BUS_NUBUS,
+ PROC_BUS_NUBUS_DEVICES,
PROC_BUS_LAST
};
@@ -324,6 +331,7 @@ extern struct proc_dir_entry proc_pid_fd;
extern struct proc_dir_entry proc_mca;
extern struct proc_dir_entry *proc_bus;
extern struct proc_dir_entry *proc_sysvipc;
+extern struct proc_dir_entry proc_root_driver;
extern struct inode_operations proc_scsi_inode_operations;
@@ -333,6 +341,19 @@ extern void proc_base_init(void);
extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *);
extern int proc_unregister(struct proc_dir_entry *, int);
+/*
+ * generic.c
+ */
+extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
+ struct proc_dir_entry *parent);
+extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
+
+
+
+/*
+ * inlined /proc helper functions
+ */
+
static inline int proc_net_register(struct proc_dir_entry * x)
{
return proc_register(proc_net, x);
@@ -375,6 +396,50 @@ static inline int proc_scsi_unregister(struct proc_dir_entry *driver, int x)
}
}
+
+/*
+ * retrieve the proc_dir_entry associated with /proc/driver/$module_name
+ */
+extern inline
+struct proc_dir_entry *proc_driver_find (const char *module_name)
+{
+ struct proc_dir_entry *p;
+
+ p = proc_root_driver.subdir;
+ while (p != NULL) {
+ if (strcmp (p->name, module_name) == 0)
+ return p;
+
+ p = p->next;
+ }
+ return NULL;
+}
+
+
+/*
+ * remove /proc/driver/$module_name, and all its contents
+ */
+extern inline int proc_driver_unregister(const char *module_name)
+{
+ remove_proc_entry (module_name, &proc_root_driver);
+ return 0;
+}
+
+
+/*
+ * create driver-specific playground directory, /proc/driver/$module_name
+ */
+extern inline int proc_driver_register(const char *module_name)
+{
+ struct proc_dir_entry *p;
+
+ p = create_proc_entry (module_name, S_IFDIR, &proc_root_driver);
+
+ return (p == NULL) ? -1 : 0;
+}
+
+
+
extern struct super_block *proc_super_blocks;
extern struct dentry_operations proc_dentry_operations;
extern struct super_block *proc_read_super(struct super_block *,void *,int);
@@ -437,13 +502,6 @@ extern struct inode_operations proc_ppc_htab_inode_operations;
extern struct inode_operations proc_sysvipc_inode_operations;
/*
- * generic.c
- */
-struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
- struct proc_dir_entry *parent);
-void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
-
-/*
* proc_tty.c
*/
extern void proc_tty_init(void);
@@ -475,6 +533,23 @@ extern inline void remove_proc_entry(const char *name, struct proc_dir_entry *pa
extern inline void proc_tty_register_driver(struct tty_driver *driver) {};
extern inline void proc_tty_unregister_driver(struct tty_driver *driver) {};
+extern inline
+struct proc_dir_entry *proc_driver_find (const char *module_name)
+{
+ return NULL;
+}
+
+extern inline int proc_driver_unregister(const char *module_name)
+{
+ return 0;
+}
+
+extern inline int proc_driver_register(const char *module_name)
+{
+ return 0;
+}
+
+
+#endif /* CONFIG_PROC_FS */
-#endif
#endif /* _LINUX_PROC_FS_H */
diff --git a/include/linux/random.h b/include/linux/random.h
index 58c93b9b6..b63f406f8 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -52,6 +52,7 @@ extern void add_interrupt_randomness(int irq);
extern void add_blkdev_randomness(int major);
extern void get_random_bytes(void *buf, int nbytes);
+void generate_random_uuid(unsigned char uuid_out[16]);
extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
__u16 sport, __u16 dport);
diff --git a/include/linux/raw.h b/include/linux/raw.h
new file mode 100644
index 000000000..a2d9b14cd
--- /dev/null
+++ b/include/linux/raw.h
@@ -0,0 +1,23 @@
+#ifndef __LINUX_RAW_H
+#define __LINUX_RAW_H
+
+#include <linux/types.h>
+
+#define RAW_SETBIND _IO( 0xac, 0 )
+#define RAW_GETBIND _IO( 0xac, 1 )
+
+struct raw_config_request
+{
+ int raw_minor;
+ __u64 block_major;
+ __u64 block_minor;
+};
+
+#ifdef __KERNEL__
+
+/* drivers/char/raw.c */
+extern void raw_init(void);
+
+#endif /* __KERNEL__ */
+
+#endif /* __LINUX_RAW_H */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index fdbdedfe2..ce30d85ef 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -256,16 +256,26 @@ struct rta_cacheinfo
enum
{
RTAX_UNSPEC,
+#define RTAX_UNSPEC RTAX_UNSPEC
RTAX_LOCK,
+#define RTAX_LOCK RTAX_LOCK
RTAX_MTU,
+#define RTAX_MTU RTAX_MTU
RTAX_WINDOW,
+#define RTAX_WINDOW RTAX_WINDOW
RTAX_RTT,
- RTAX_HOPS,
+#define RTAX_RTT RTAX_RTT
+ RTAX_RTTVAR,
+#define RTAX_RTTVAR RTAX_RTTVAR
RTAX_SSTHRESH,
+#define RTAX_SSTHRESH RTAX_SSTHRESH
RTAX_CWND,
+#define RTAX_CWND RTAX_CWND
+ RTAX_ADVMSS,
+#define RTAX_ADVMSS RTAX_ADVMSS
};
-#define RTAX_MAX RTAX_CWND
+#define RTAX_MAX RTAX_ADVMSS
@@ -535,6 +545,7 @@ struct rtnetlink_link
extern struct rtnetlink_link * rtnetlink_links[NPROTO];
extern int rtnetlink_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb);
extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo);
+extern int rtnetlink_put_metrics(struct sk_buff *skb, unsigned *metrics);
extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
@@ -565,6 +576,10 @@ extern void rtnl_lock(void);
extern void rtnl_unlock(void);
extern void rtnetlink_init(void);
+#define ASSERT_RTNL() do { if (down_trylock(&rtnl_sem) == 0) { up(&rtnl_sem); \
+printk("RTNL: assertion failed at " __FILE__ "(%d):" __FUNCTION__ "\n", __LINE__); } \
+ } while(0);
+#define BUG_TRAP(x) if (!(x)) { printk("KERNEL: assertion (" #x ") failed at " __FILE__ "(%d):" __FUNCTION__ "\n", __LINE__); }
#endif /* __KERNEL__ */
diff --git a/include/linux/scc.h b/include/linux/scc.h
index 7ad72e102..fbe189460 100644
--- a/include/linux/scc.h
+++ b/include/linux/scc.h
@@ -221,7 +221,7 @@ struct scc_channel {
int init; /* channel exists? */
- struct device *dev; /* link to device control structure */
+ struct net_device *dev; /* link to device control structure */
struct net_device_stats dev_stat;/* device statistics */
char brand; /* manufacturer of the board */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index cd1cc2c46..87e0fb212 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -7,7 +7,7 @@ extern unsigned long event;
#include <linux/binfmts.h>
#include <linux/personality.h>
-#include <linux/tasks.h>
+#include <linux/threads.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/times.h>
@@ -35,6 +35,7 @@ extern unsigned long event;
#define CLONE_PID 0x00001000 /* set if pid shared */
#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
+#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
/*
* These are the constant used to fake the fixed-point load-average
@@ -63,7 +64,7 @@ extern unsigned long avenrun[]; /* Load averages */
#define CT_TO_SECS(x) ((x) / HZ)
#define CT_TO_USECS(x) (((x) % HZ) * 1000000/HZ)
-extern int nr_running, nr_tasks;
+extern int nr_running, nr_threads;
extern int last_pid;
#include <linux/fs.h>
@@ -82,6 +83,26 @@ extern int last_pid;
#define TASK_SWAPPING 16
#define TASK_EXCLUSIVE 32
+#define __set_task_state(tsk, state_value) \
+ do { tsk->state = state_value; } while (0)
+#ifdef __SMP__
+#define set_task_state(tsk, state_value) \
+ set_mb(tsk->state, state_value)
+#else
+#define set_task_state(tsk, state_value) \
+ __set_task_state(tsk, state_value)
+#endif
+
+#define __set_current_state(state_value) \
+ do { current->state = state_value; } while (0)
+#ifdef __SMP__
+#define set_current_state(state_value) \
+ set_mb(current->state, state_value)
+#else
+#define set_current_state(state_value) \
+ __set_current_state(state_value)
+#endif
+
/*
* Scheduling policies
*/
@@ -105,7 +126,7 @@ struct sched_param {
#ifdef __KERNEL__
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
/*
* This serializes "schedule()" and also protects
@@ -119,6 +140,7 @@ extern spinlock_t runqueue_lock;
extern void sched_init(void);
extern void init_idle(void);
extern void show_state(void);
+extern void cpu_init (void);
extern void trap_init(void);
#define MAX_SCHEDULE_TIMEOUT LONG_MAX
@@ -126,24 +148,40 @@ extern signed long FASTCALL(schedule_timeout(signed long timeout));
asmlinkage void schedule(void);
/*
+ * The default fd array needs to be at least BITS_PER_LONG,
+ * as this is the granularity returned by copy_fdset().
+ */
+#define NR_OPEN_DEFAULT BITS_PER_LONG
+
+/*
* Open file table structure
*/
struct files_struct {
atomic_t count;
rwlock_t file_lock;
int max_fds;
+ int max_fdset;
+ int next_fd;
struct file ** fd; /* current fd array */
- fd_set close_on_exec;
- fd_set open_fds;
+ fd_set *close_on_exec;
+ fd_set *open_fds;
+ fd_set close_on_exec_init;
+ fd_set open_fds_init;
+ struct file * fd_array[NR_OPEN_DEFAULT];
};
#define INIT_FILES { \
ATOMIC_INIT(1), \
RW_LOCK_UNLOCKED, \
- NR_OPEN, \
- &init_fd_array[0], \
+ NR_OPEN_DEFAULT, \
+ __FD_SETSIZE, \
+ 0, \
+ &init_files.fd_array[0], \
+ &init_files.close_on_exec_init, \
+ &init_files.open_fds_init, \
+ { { 0, } }, \
{ { 0, } }, \
- { { 0, } } \
+ { NULL, } \
}
struct fs_struct {
@@ -169,7 +207,8 @@ struct mm_struct {
struct vm_area_struct * mmap_avl; /* tree of VMAs */
struct vm_area_struct * mmap_cache; /* last find_vma result */
pgd_t * pgd;
- atomic_t count;
+ atomic_t mm_users; /* How many users with user space? */
+ atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
int map_count; /* number of VMAs */
struct semaphore mmap_sem;
spinlock_t page_table_lock;
@@ -192,7 +231,7 @@ struct mm_struct {
#define INIT_MM(name) { \
&init_mmap, NULL, NULL, \
swapper_pg_dir, \
- ATOMIC_INIT(1), 1, \
+ ATOMIC_INIT(2), ATOMIC_INIT(1), 1, \
__MUTEX_INITIALIZER(name.mmap_sem), \
SPIN_LOCK_UNLOCKED, \
0, \
@@ -231,7 +270,7 @@ struct task_struct {
0-0xFFFFFFFF for kernel-thread
*/
struct exec_domain *exec_domain;
- long need_resched;
+ volatile long need_resched;
/* various fields */
long counter;
@@ -243,7 +282,7 @@ struct task_struct {
int last_processor;
int lock_depth; /* Lock depth. We can context switch in and out of holding a syscall kernel lock... */
struct task_struct *next_task, *prev_task;
- struct task_struct *next_run, *prev_run;
+ struct list_head run_list;
/* task state */
struct linux_binfmt *binfmt;
@@ -270,9 +309,6 @@ struct task_struct {
struct task_struct *pidhash_next;
struct task_struct **pidhash_pprev;
- /* Pointer to task[] array linkage. */
- struct task_struct **tarray_ptr;
-
wait_queue_head_t wait_chldexit; /* for wait4() */
struct semaphore *vfork_sem; /* for vfork() */
unsigned long policy, rt_priority;
@@ -302,14 +338,15 @@ struct task_struct {
/* ipc stuff */
struct sem_undo *semundo;
struct sem_queue *semsleeping;
-/* tss for this task */
- struct thread_struct tss;
+/* CPU-specific state of this task */
+ struct thread_struct thread;
/* filesystem information */
struct fs_struct *fs;
/* open file information */
struct files_struct *files;
+
/* memory management info */
- struct mm_struct *mm;
+ struct mm_struct *mm, *active_mm;
/* signal handlers */
spinlock_t sigmask_lock; /* Protects signal and blocked */
@@ -355,13 +392,12 @@ struct task_struct {
/* state etc */ { 0,0,0,KERNEL_DS,&default_exec_domain,0, \
/* counter */ DEF_PRIORITY,DEF_PRIORITY,0, \
/* SMP */ 0,0,0,-1, \
-/* schedlink */ &init_task,&init_task, &init_task, &init_task, \
+/* schedlink */ &init_task,&init_task, LIST_HEAD_INIT(init_task.run_list), \
/* binfmt */ NULL, \
/* ec,brk... */ 0,0,0,0,0,0, \
/* pid etc.. */ 0,0,0,0,0, \
/* proc links*/ &init_task,&init_task,NULL,NULL,NULL, \
/* pidhash */ NULL, NULL, \
-/* tarray */ &task[0], \
/* chld wait */ __WAIT_QUEUE_HEAD_INITIALIZER(name.wait_chldexit), NULL, \
/* timeout */ SCHED_OTHER,0,0,0,0,0,0,0, \
/* timer */ { NULL, NULL, 0, 0, it_real_fn }, \
@@ -379,10 +415,10 @@ struct task_struct {
/* comm */ "swapper", \
/* fs info */ 0,NULL, \
/* ipc */ NULL, NULL, \
-/* tss */ INIT_TSS, \
+/* thread */ INIT_THREAD, \
/* fs */ &init_fs, \
/* files */ &init_files, \
-/* mm */ &init_mm, \
+/* mm */ NULL, &init_mm, \
/* signals */ SPIN_LOCK_UNLOCKED, &init_signals, {{0}}, {{0}}, NULL, &init_task.sigqueue, 0, 0, \
}
@@ -398,33 +434,10 @@ union task_union {
extern union task_union init_task_union;
extern struct mm_struct init_mm;
-extern struct task_struct *task[NR_TASKS];
+extern struct task_struct *init_tasks[NR_CPUS];
-extern struct task_struct **tarray_freelist;
-extern spinlock_t taskslot_lock;
-
-extern __inline__ void add_free_taskslot(struct task_struct **t)
-{
- spin_lock(&taskslot_lock);
- *t = (struct task_struct *) tarray_freelist;
- tarray_freelist = t;
- spin_unlock(&taskslot_lock);
-}
-
-extern __inline__ struct task_struct **get_free_taskslot(void)
-{
- struct task_struct **tslot;
-
- spin_lock(&taskslot_lock);
- if((tslot = tarray_freelist) != NULL)
- tarray_freelist = (struct task_struct **) *tslot;
- spin_unlock(&taskslot_lock);
-
- return tslot;
-}
-
-/* PID hashing. */
-#define PIDHASH_SZ (NR_TASKS >> 2)
+/* PID hashing. (shouldnt this be dynamic?) */
+#define PIDHASH_SZ (4096 >> 2)
extern struct task_struct *pidhash[PIDHASH_SZ];
#define pid_hashfn(x) ((((x) >> 8) ^ (x)) & (PIDHASH_SZ - 1))
@@ -554,7 +567,7 @@ static inline int on_sig_stack(unsigned long sp)
static inline int sas_ss_flags(unsigned long sp)
{
return (current->sas_ss_size == 0 ? SS_DISABLE
- : on_sig_stack(sp) ? SS_ONSTACK : 0);
+ : on_sig_stack(sp) ? SS_ONSTACK : 0);
}
extern int request_irq(unsigned int,
@@ -618,14 +631,65 @@ extern inline int capable(int cap)
* Routines for handling mm_structs
*/
extern struct mm_struct * mm_alloc(void);
-static inline void mmget(struct mm_struct * mm)
+
+extern struct mm_struct * start_lazy_tlb(void);
+extern void end_lazy_tlb(struct mm_struct *mm);
+
+/* mmdrop drops the mm and the page tables */
+extern inline void FASTCALL(__mmdrop(struct mm_struct *));
+static inline void mmdrop(struct mm_struct * mm)
{
- atomic_inc(&mm->count);
+ if (atomic_dec_and_test(&mm->mm_count))
+ __mmdrop(mm);
}
+
+/* mmput gets rid of the mappings and all user-space */
extern void mmput(struct mm_struct *);
/* Remove the current tasks stale references to the old mm_struct */
extern void mm_release(void);
+/*
+ * Routines for handling the fd arrays
+ */
+extern struct file ** alloc_fd_array(int);
+extern int expand_fd_array(struct files_struct *, int nr);
+extern void free_fd_array(struct file **, int);
+
+extern fd_set *alloc_fdset(int);
+extern int expand_fdset(struct files_struct *, int nr);
+extern void free_fdset(fd_set *, int);
+
+/* Expand files. Return <0 on error; 0 nothing done; 1 files expanded,
+ * we may have blocked.
+ *
+ * Should be called with the files->file_lock spinlock held for write.
+ */
+static inline int expand_files(struct files_struct *files, int nr)
+{
+ int err, expand = 0;
+#ifdef FDSET_DEBUG
+ printk (KERN_ERR __FUNCTION__ " %d: nr = %d\n", current->pid, nr);
+#endif
+
+ if (nr >= files->max_fdset) {
+ expand = 1;
+ if ((err = expand_fdset(files, nr)))
+ goto out;
+ }
+ if (nr >= files->max_fds) {
+ expand = 1;
+ if ((err = expand_fd_array(files, nr)))
+ goto out;
+ }
+ err = expand;
+ out:
+#ifdef FDSET_DEBUG
+ if (err)
+ printk (KERN_ERR __FUNCTION__ " %d: return %d\n", current->pid, err);
+#endif
+ return err;
+}
+
extern int copy_thread(int, unsigned long, unsigned long, struct task_struct *, struct pt_regs *);
extern void flush_thread(void);
extern void exit_thread(void);
@@ -673,7 +737,7 @@ do { \
\
add_wait_queue(&wq, &__wait); \
for (;;) { \
- current->state = TASK_UNINTERRUPTIBLE; \
+ set_current_state(TASK_UNINTERRUPTIBLE); \
if (condition) \
break; \
schedule(); \
@@ -696,7 +760,7 @@ do { \
\
add_wait_queue(&wq, &__wait); \
for (;;) { \
- current->state = TASK_INTERRUPTIBLE; \
+ set_current_state(TASK_INTERRUPTIBLE); \
if (condition) \
break; \
if (!signal_pending(current)) { \
@@ -743,6 +807,29 @@ do { \
#define for_each_task(p) \
for (p = &init_task ; (p = p->next_task) != &init_task ; )
+
+static inline void del_from_runqueue(struct task_struct * p)
+{
+ nr_running--;
+ list_del(&p->run_list);
+ p->run_list.next = NULL;
+}
+
+extern inline int task_on_runqueue(struct task_struct *p)
+{
+ return (p->run_list.next != NULL);
+}
+
+extern inline void unhash_process(struct task_struct *p)
+{
+ if (task_on_runqueue(p)) BUG();
+ nr_threads--;
+ write_lock_irq(&tasklist_lock);
+ unhash_pid(p);
+ REMOVE_LINKS(p);
+ write_unlock_irq(&tasklist_lock);
+}
+
#endif /* __KERNEL__ */
#endif
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 3896d7535..6f6677a64 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -105,9 +105,9 @@ struct sem_undo {
short * semadj; /* array of adjustments, one per semaphore */
};
-asmlinkage int sys_semget (key_t key, int nsems, int semflg);
-asmlinkage int sys_semop (int semid, struct sembuf *sops, unsigned nsops);
-asmlinkage int sys_semctl (int semid, int semnum, int cmd, union semun arg);
+asmlinkage long sys_semget (key_t key, int nsems, int semflg);
+asmlinkage long sys_semop (int semid, struct sembuf *sops, unsigned nsops);
+asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg);
#endif /* __KERNEL__ */
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 929618dd5..e1ad16ae6 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -24,7 +24,9 @@ struct serial_struct {
int hub6;
unsigned short closing_wait; /* time to wait before closing */
unsigned short closing_wait2; /* no longer used... */
- int reserved[4];
+ unsigned char *iomem_base;
+ unsigned short iomem_reg_shift;
+ int reserved[2];
};
/*
@@ -47,7 +49,10 @@ struct serial_struct {
#define PORT_16650V2 7
#define PORT_16750 8
#define PORT_STARTECH 9 /* usurped by cyclades.c */
-#define PORT_MAX 9
+#define PORT_16C950 10 /* Oxford Semiconductor */
+#define PORT_16654 11
+#define PORT_16850 12
+#define PORT_MAX 12
struct serial_uart_config {
char *name;
diff --git a/include/linux/serialP.h b/include/linux/serialP.h
index 28e66f9e4..02fcb9363 100644
--- a/include/linux/serialP.h
+++ b/include/linux/serialP.h
@@ -19,8 +19,13 @@
* For definitions of the flags field, see tty.h
*/
+#include <linux/config.h>
#include <linux/termios.h>
#include <linux/tqueue.h>
+#include <linux/wait.h>
+#ifdef CONFIG_PCI
+#include <linux/pci.h>
+#endif
/*
* Counters of the input lines (CTS, DSR, RI, CD) interrupts
@@ -40,9 +45,12 @@ struct serial_state {
int hub6;
int type;
int line;
+ int revision; /* Chip revision (950) */
int xmit_fifo_size;
int custom_divisor;
int count;
+ u8 *iomem_base;
+ u16 iomem_reg_shift;
unsigned short close_delay;
unsigned short closing_wait; /* time to wait before closing */
struct async_icount icount;
@@ -69,6 +77,8 @@ struct async_struct {
unsigned short closing_wait2;
int IER; /* Interrupt Enable Register */
int MCR; /* Modem control register */
+ int LCR; /* Line control register */
+ int ACR; /* 16950 Additional Control Reg. */
unsigned long event;
unsigned long last_active;
int line;
@@ -79,14 +89,24 @@ struct async_struct {
int xmit_head;
int xmit_tail;
int xmit_cnt;
+ u8 *iomem_base;
+ u16 iomem_reg_shift;
struct tq_struct tqueue;
+#ifdef DECLARE_WAITQUEUE
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
wait_queue_head_t delta_msr_wait;
+#else
+ struct wait_queue *open_wait;
+ struct wait_queue *close_wait;
+ struct wait_queue *delta_msr_wait;
+#endif
struct async_struct *next_port; /* For the linked list */
struct async_struct *prev_port;
};
+#define CONFIGURED_SERIAL_PORT(info) ((info)->port || ((info)->iomem_base))
+
#define SERIAL_MAGIC 0x5301
#define SSTATE_MAGIC 0x5302
@@ -116,4 +136,52 @@ struct rs_multiport_struct {
int port_monitor;
};
+#if defined(__alpha__) && !defined(CONFIG_PCI)
+/*
+ * Digital did something really horribly wrong with the OUT1 and OUT2
+ * lines on at least some ALPHA's. The failure mode is that if either
+ * is cleared, the machine locks up with endless interrupts.
+ */
+#define ALPHA_KLUDGE_MCR (UART_MCR_OUT2 | UART_MCR_OUT1)
+#else
+#define ALPHA_KLUDGE_MCR 0
+#endif
+
+#ifdef CONFIG_PCI
+/*
+ * Structures and definitions for PCI support
+ */
+struct pci_board {
+ unsigned short vendor;
+ unsigned short device;
+ unsigned short subvendor;
+ unsigned short subdevice;
+ int flags;
+ int num_ports;
+ int base_baud;
+ int uart_offset;
+ int reg_shift;
+ void (*init_fn)(struct pci_dev *dev, struct pci_board *board,
+ int enable);
+};
+
+struct pci_board_inst {
+ struct pci_board *board;
+ struct pci_dev *dev;
+};
+
+#ifndef PCI_ANY_ID
+#define PCI_ANY_ID (~0)
+#endif
+#endif
+
+#define SPCI_FL_BASE_MASK 0x0007
+#define SPCI_FL_BASE0 0x0000
+#define SPCI_FL_BASE1 0x0001
+#define SPCI_FL_BASE2 0x0002
+#define SPCI_FL_BASE3 0x0003
+#define SPCI_FL_BASE4 0x0004
+#define SPCI_FL_IOMEM 0x0008 /* Use I/O mapped memory */
+#define SPCI_FL_BASE_TABLE 0x0010 /* Use base address table for UART */
+
#endif /* _LINUX_SERIAL_H */
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index 713227a56..1787be41f 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -17,17 +17,29 @@
#define UART_RX 0 /* In: Receive buffer (DLAB=0) */
#define UART_TX 0 /* Out: Transmit buffer (DLAB=0) */
#define UART_DLL 0 /* Out: Divisor Latch Low (DLAB=1) */
+#define UART_TRG 0 /* (LCR=BF) FCTR bit 7 selects Rx or Tx
+ * In: Fifo count
+ * Out: Fifo custom trigger levels
+ * XR16C85x only */
+
#define UART_DLM 1 /* Out: Divisor Latch High (DLAB=1) */
#define UART_IER 1 /* Out: Interrupt Enable Register */
+#define UART_FCTR 1 /* (LCR=BF) Feature Control Register
+ * XR16C85x only */
+
#define UART_IIR 2 /* In: Interrupt ID Register */
#define UART_FCR 2 /* Out: FIFO Control Register */
#define UART_EFR 2 /* I/O: Extended Features Register */
/* (DLAB=1, 16C660 only) */
+
#define UART_LCR 3 /* Out: Line Control Register */
#define UART_MCR 4 /* Out: Modem Control Register */
#define UART_LSR 5 /* In: Line Status Register */
#define UART_MSR 6 /* In: Modem Status Register */
#define UART_SCR 7 /* I/O: Scratch Register */
+#define UART_EMSR 7 /* (LCR=BF) Extended Mode Select Register
+ * FCTR bit 6 selects SCR or EMSR
+ * XR16c85x only */
/*
* These are the definitions for the FIFO Control Register
@@ -140,5 +152,82 @@
* the low four bits control software flow control
*/
+/*
+ * These register definitions are for the 16C950
+ */
+#define UART_ASR 0x01 /* Additional Status Register */
+#define UART_RFL 0x03 /* Transmitter FIFO level */
+#define UART_TFL 0x04 /* Receiver FIFO level */
+#define UART_ICR 0x05 /* Index Control Register */
+
+/* The 16950 ICR registers */
+#define UART_ACR 0x00 /* Additional Control Register */
+#define UART_CPR 0x01 /* Clock Prescalar Register */
+#define UART_TCR 0x02 /* Times Clock Register */
+#define UART_CKS 0x03 /* Clock Select Register */
+#define UART_TTL 0x04 /* Transmitter Interrupt Trigger Level */
+#define UART_RTL 0x05 /* Receiver Interrupt Trigger Level */
+#define UART_FCL 0x06 /* Flow Control Level Lower */
+#define UART_FCH 0x07 /* Flow Control Level Higher */
+#define UART_ID1 0x08 /* ID #1 */
+#define UART_ID2 0x09 /* ID #2 */
+#define UART_ID3 0x0A /* ID #3 */
+#define UART_REV 0x0B /* Revision */
+#define UART_CSR 0x0C /* Channel Software Reset */
+#define UART_NMR 0x0D /* Nine-bit Mode Register */
+#define UART_CTR 0xFF
+
+/*
+ * The 16C950 Additional Control Reigster
+ */
+#define UART_ACR_RXDIS 0x01 /* Receiver disable */
+#define UART_ACR_TXDIS 0x02 /* Receiver disable */
+#define UART_ACR_DSRFC 0x04 /* DSR Flow Control */
+#define UART_ACR_TLENB 0x20 /* 950 trigger levels enable */
+#define UART_ACR_ICRRD 0x40 /* ICR Read enable */
+#define UART_ACR_ASREN 0x80 /* Additional status enable */
+
+/*
+ * These are the definitions for the Feature Control Register
+ * (XR16C85x only, when LCR=bf; doubles with the Interrupt Enable
+ * Register, UART register #1)
+ */
+#define UART_FCTR_RTS_NODELAY 0x00 /* RTS flow control delay */
+#define UART_FCTR_RTS_4DELAY 0x01
+#define UART_FCTR_RTS_6DELAY 0x02
+#define UART_FCTR_RTS_8DELAY 0x03
+#define UART_FCTR_IRDA 0x04 /* IrDa data encode select */
+#define UART_FCTR_TX_INT 0x08 /* Tx interrupt type select */
+#define UART_FCTR_TRGA 0x00 /* Tx/Rx 550 trigger table select */
+#define UART_FCTR_TRGB 0x10 /* Tx/Rx 650 trigger table select */
+#define UART_FCTR_TRGC 0x20 /* Tx/Rx 654 trigger table select */
+#define UART_FCTR_TRGD 0x30 /* Tx/Rx 850 programmable trigger select */
+#define UART_FCTR_SCR_SWAP 0x40 /* Scratch pad register swap */
+#define UART_FCTR_RX 0x00 /* Programmable trigger mode select */
+#define UART_FCTR_TX 0x80 /* Programmable trigger mode select */
+
+/*
+ * These are the definitions for the Enhanced Mode Select Register
+ * (XR16C85x only, when LCR=bf and FCTR bit 6=1; doubles with the
+ * Scratch register, UART register #7)
+ */
+#define UART_EMSR_FIFO_COUNT 0x01 /* Rx/Tx select */
+#define UART_EMSR_ALT_COUNT 0x02 /* Alternating count select */
+
+/*
+ * These are the definitions for the Programmable Trigger
+ * Register (XR16C85x only, when LCR=bf; doubles with the UART RX/TX
+ * register, UART register #0)
+ */
+#define UART_TRG_1 0x01
+#define UART_TRG_4 0x04
+#define UART_TRG_8 0x08
+#define UART_TRG_16 0x10
+#define UART_TRG_32 0x20
+#define UART_TRG_64 0x40
+#define UART_TRG_96 0x60
+#define UART_TRG_120 0x78
+#define UART_TRG_128 0x80
+
#endif /* _LINUX_SERIAL_REG_H */
diff --git a/include/linux/shm.h b/include/linux/shm.h
index a6d13e8d9..d83787312 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -68,10 +68,10 @@ struct shm_info {
#define SHM_DEST 01000 /* segment will be destroyed on last detach */
#define SHM_LOCKED 02000 /* segment will not be swapped */
-asmlinkage int sys_shmget (key_t key, int size, int flag);
-asmlinkage int sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr);
-asmlinkage int sys_shmdt (char *shmaddr);
-asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf);
+asmlinkage long sys_shmget (key_t key, int size, int flag);
+asmlinkage long sys_shmat (int shmid, char *shmaddr, int shmflg, unsigned long *addr);
+asmlinkage long sys_shmdt (char *shmaddr);
+asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds *buf);
extern void shm_unuse(unsigned long entry, unsigned long page);
#endif /* __KERNEL__ */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d499875de..27232bd5b 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -21,7 +21,7 @@
#include <asm/atomic.h>
#include <asm/types.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#define HAVE_ALLOC_SKB /* For the drivers to know */
#define HAVE_ALIGNABLE_SKB /* Ditto 8) */
@@ -31,6 +31,12 @@
#define CHECKSUM_HW 1
#define CHECKSUM_UNNECESSARY 2
+#ifdef __i386__
+#define NET_CALLER(arg) (*(((void**)&arg)-1))
+#else
+#define NET_CALLER(arg) __builtin_return_address(0)
+#endif
+
struct sk_buff_head {
/* These two members must be first. */
struct sk_buff * next;
@@ -48,7 +54,8 @@ struct sk_buff {
struct sk_buff_head * list; /* List we are on */
struct sock *sk; /* Socket we are owned by */
struct timeval stamp; /* Time we arrived */
- struct device *dev; /* Device we arrived on/are leaving by */
+ struct net_device *dev; /* Device we arrived on/are leaving by */
+ struct net_device *rx_dev;
/* Transport layer header */
union
@@ -102,9 +109,17 @@ struct sk_buff {
unsigned char *tail; /* Tail pointer */
unsigned char *end; /* End pointer */
void (*destructor)(struct sk_buff *); /* Destruct function */
-#ifdef CONFIG_IP_FIREWALL
- __u32 fwmark; /* Label made by fwchains, used by pktsched */
+#ifdef CONFIG_NETFILTER
+ /* Can be used for communication between hooks. */
+ unsigned long nfmark;
+ /* Reason for doing this to the packet (see netfilter.h) */
+ __u32 nfreason;
+ /* Cache info */
+ __u32 nfcache;
+#ifdef CONFIG_NETFILTER_DEBUG
+ unsigned int nf_debug;
#endif
+#endif /*CONFIG_NETFILTER*/
#if defined(CONFIG_SHAPER) || defined(CONFIG_SHAPER_MODULE)
__u32 shapelatency; /* Latency on frame */
__u32 shapeclock; /* Time it should go out */
@@ -200,6 +215,18 @@ extern __inline__ int skb_shared(struct sk_buff *skb)
return (atomic_read(&skb->users) != 1);
}
+extern __inline__ struct sk_buff *skb_share_check(struct sk_buff *skb, int pri)
+{
+ if (skb_shared(skb)) {
+ struct sk_buff *nskb;
+ nskb = skb_clone(skb, pri);
+ kfree_skb(skb);
+ return nskb;
+ }
+ return skb;
+}
+
+
/*
* Copy shared buffers into a new sk_buff. We effectively do COW on
* packets to handle cases where we have a local reader and forward
@@ -551,6 +578,13 @@ extern __inline__ void skb_queue_purge(struct sk_buff_head *list)
kfree_skb(skb);
}
+extern __inline__ void __skb_queue_purge(struct sk_buff_head *list)
+{
+ struct sk_buff *skb;
+ while ((skb=__skb_dequeue(list))!=NULL)
+ kfree_skb(skb);
+}
+
extern __inline__ struct sk_buff *dev_alloc_skb(unsigned int length)
{
struct sk_buff *skb;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0b46d3b73..3097a8db2 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -51,6 +51,7 @@ extern kmem_cache_t *kmem_find_general_cachep(size_t);
extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned long,
void (*)(void *, kmem_cache_t *, unsigned long),
void (*)(void *, kmem_cache_t *, unsigned long));
+extern int kmem_cache_destroy(kmem_cache_t *);
extern int kmem_cache_shrink(kmem_cache_t *);
extern void *kmem_cache_alloc(kmem_cache_t *, int);
extern void kmem_cache_free(kmem_cache_t *, void *);
diff --git a/include/linux/socket.h b/include/linux/socket.h
index bcb7ce731..33d8a97d9 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -146,7 +146,7 @@ struct ucred {
#define AF_DECnet 12 /* Reserved for DECnet project */
#define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/
#define AF_SECURITY 14 /* Security callback pseudo AF */
-#define pseudo_AF_KEY 15 /* PF_KEY key management API */
+#define AF_KEY 15 /* PF_KEY key management API */
#define AF_NETLINK 16
#define AF_ROUTE AF_NETLINK /* Alias to emulate 4.4BSD */
#define AF_PACKET 17 /* Packet family */
@@ -174,7 +174,7 @@ struct ucred {
#define PF_DECnet AF_DECnet
#define PF_NETBEUI AF_NETBEUI
#define PF_SECURITY AF_SECURITY
-#define PF_KEY pseudo_AF_KEY
+#define PF_KEY AF_KEY
#define PF_NETLINK AF_NETLINK
#define PF_ROUTE AF_ROUTE
#define PF_PACKET AF_PACKET
@@ -198,22 +198,19 @@ struct ucred {
#define MSG_DONTROUTE 4
#define MSG_TRYHARD 4 /* Synonym for MSG_DONTROUTE for DECnet */
#define MSG_CTRUNC 8
-#define MSG_PROXY 0x10 /* Supply or ask second address. */
+#define MSG_PROBE 0x10 /* Do not send. Only probe path f.e. for MTU */
#define MSG_TRUNC 0x20
#define MSG_DONTWAIT 0x40 /* Nonblocking io */
#define MSG_EOR 0x80 /* End of record */
#define MSG_WAITALL 0x100 /* Wait for a full request */
#define MSG_FIN 0x200
#define MSG_SYN 0x400
-#define MSG_URG 0x800
+#define MSG_CONFIRM 0x800 /* Confirm path validity */
#define MSG_RST 0x1000
-#define MSG_ERRQUEUE 0x2000
-#define MSG_NOSIGNAL 0x4000
-
-#define MSG_CTLIGNORE 0x80000000
+#define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */
+#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */
#define MSG_EOF MSG_FIN
-#define MSG_CTLFLAGS (MSG_OOB|MSG_URG|MSG_FIN|MSG_SYN|MSG_RST)
/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */
@@ -243,6 +240,10 @@ struct ucred {
#define TCP_NODELAY 1
#define TCP_MAXSEG 2
#define TCP_CORK 3 /* Linux specific (for use with sendfile) */
+#define TCP_KEEPIDLE 4
+#define TCP_KEEPINTVL 5
+#define TCP_KEEPCNT 6
+#define TCP_SYNCNT 7
#ifdef __KERNEL__
extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
diff --git a/include/linux/sonet.h b/include/linux/sonet.h
new file mode 100644
index 000000000..d4e12b8f1
--- /dev/null
+++ b/include/linux/sonet.h
@@ -0,0 +1,52 @@
+/* sonet.h - SONET/SHD physical layer control */
+
+/* Written 1995 by Werner Almesberger, EPFL LRC */
+
+
+#ifndef LINUX_SONET_H
+#define LINUX_SONET_H
+
+struct sonet_stats {
+ long section_bip; /* section parity errors (B1) */
+ long line_bip; /* line parity errors (B2) */
+ long path_bip; /* path parity errors (B3) */
+ long line_febe; /* line parity errors at remote */
+ long path_febe; /* path parity errors at remote */
+ long corr_hcs; /* correctable header errors */
+ long uncorr_hcs; /* uncorrectable header errors */
+ long tx_cells; /* cells sent */
+ long rx_cells; /* cells received */
+};
+
+#define SONET_GETSTAT _IOR('a',ATMIOC_PHYTYP,struct sonet_stats)
+ /* get statistics */
+#define SONET_GETSTATZ _IOR('a',ATMIOC_PHYTYP+1,struct sonet_stats)
+ /* ... and zero counters */
+#define SONET_SETDIAG _IOWR('a',ATMIOC_PHYTYP+2,int)
+ /* set error insertion */
+#define SONET_CLRDIAG _IOWR('a',ATMIOC_PHYTYP+3,int)
+ /* clear error insertion */
+#define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int)
+ /* query error insertion */
+#define SONET_SETFRAMING _IO('a',ATMIOC_PHYTYP+5)
+ /* set framing mode (SONET/SDH) */
+#define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int)
+ /* get framing mode */
+#define SONET_GETFRSENSE _IOR('a',ATMIOC_PHYTYP+7, \
+ unsigned char[SONET_FRSENSE_SIZE]) /* get framing sense information */
+
+#define SONET_INS_SBIP 1 /* section BIP */
+#define SONET_INS_LBIP 2 /* line BIP */
+#define SONET_INS_PBIP 4 /* path BIP */
+#define SONET_INS_FRAME 8 /* out of frame */
+#define SONET_INS_LOS 16 /* set line to zero */
+#define SONET_INS_LAIS 32 /* line alarm indication signal */
+#define SONET_INS_PAIS 64 /* path alarm indication signal */
+#define SONET_INS_HCS 128 /* insert HCS error */
+
+#define SONET_FRAME_SONET 0 /* SONET STS-3 framing */
+#define SONET_FRAME_SDH 1 /* SDH STM-1 framing */
+
+#define SONET_FRSENSE_SIZE 6 /* C1[3],H1[3] (0xff for unknown) */
+
+#endif
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
new file mode 100644
index 000000000..b76cb1434
--- /dev/null
+++ b/include/linux/spinlock.h
@@ -0,0 +1,120 @@
+#ifndef __LINUX_SPINLOCK_H
+#define __LINUX_SPINLOCK_H
+
+/*
+ * These are the generic versions of the spinlocks and read-write
+ * locks..
+ */
+#define spin_lock_irqsave(lock, flags) do { local_irq_save(flags); spin_lock(lock); } while (0)
+#define spin_lock_irq(lock) do { local_irq_disable(); spin_lock(lock); } while (0)
+#define spin_lock_bh(lock) do { local_bh_disable(); spin_lock(lock); } while (0)
+
+#define read_lock_irqsave(lock, flags) do { local_irq_save(flags); read_lock(lock); } while (0)
+#define read_lock_irq(lock) do { local_irq_disable(); read_lock(lock); } while (0)
+#define read_lock_bh(lock) do { local_bh_disable(); read_lock(lock); } while (0)
+
+#define write_lock_irqsave(lock, flags) do { local_irq_save(flags); write_lock(lock); } while (0)
+#define write_lock_irq(lock) do { local_irq_disable(); write_lock(lock); } while (0)
+#define write_lock_bh(lock) do { local_bh_disable(); write_lock(lock); } while (0)
+
+#define spin_unlock_irqrestore(lock, flags) do { spin_unlock(lock); local_irq_restore(flags); } while (0)
+#define spin_unlock_irq(lock) do { spin_unlock(lock); local_irq_enable(); } while (0)
+#define spin_unlock_bh(lock) do { spin_unlock(lock); local_bh_enable(); } while (0)
+
+#define read_unlock_irqrestore(lock, flags) do { read_unlock(lock); local_irq_restore(flags); } while (0)
+#define read_unlock_irq(lock) do { read_unlock(lock); local_irq_enable(); } while (0)
+#define read_unlock_bh(lock) do { read_unlock(lock); local_bh_enable(); } while (0)
+
+#define write_unlock_irqrestore(lock, flags) do { write_unlock(lock); local_irq_restore(flags); } while (0)
+#define write_unlock_irq(lock) do { write_unlock(lock); local_irq_enable(); } while (0)
+#define write_unlock_bh(lock) do { write_unlock(lock); local_bh_enable(); } while (0)
+
+#ifdef __SMP__
+#include <asm/spinlock.h>
+
+#else /* !SMP */
+
+#define DEBUG_SPINLOCKS 0 /* 0 == no debugging, 1 == maintain lock state, 2 == full debug */
+
+#if (DEBUG_SPINLOCKS < 1)
+
+/*
+ * Your basic spinlocks, allowing only a single CPU anywhere
+ *
+ * Gcc-2.7.x has a nasty bug with empty initializers.
+ */
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+ typedef struct { } spinlock_t;
+ #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
+#else
+ typedef struct { int gcc_is_buggy; } spinlock_t;
+ #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
+#endif
+
+#define spin_lock_init(lock) do { } while(0)
+#define spin_lock(lock) (void)(lock) /* Not "unused variable". */
+#define spin_trylock(lock) (1)
+#define spin_unlock_wait(lock) do { } while(0)
+#define spin_unlock(lock) do { } while(0)
+
+#elif (DEBUG_SPINLOCKS < 2)
+
+typedef struct {
+ volatile unsigned int lock;
+} spinlock_t;
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
+
+#define spin_lock_init(x) do { (x)->lock = 0; } while (0)
+#define spin_trylock(lock) (!test_and_set_bit(0,(lock)))
+
+#define spin_lock(x) do { (x)->lock = 1; } while (0)
+#define spin_unlock_wait(x) do { } while (0)
+#define spin_unlock(x) do { (x)->lock = 0; } while (0)
+
+#else /* (DEBUG_SPINLOCKS >= 2) */
+
+typedef struct {
+ volatile unsigned int lock;
+ volatile unsigned int babble;
+ const char *module;
+} spinlock_t;
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 25, __BASE_FILE__ }
+
+#include <linux/kernel.h>
+
+#define spin_lock_init(x) do { (x)->lock = 0; } while (0)
+#define spin_trylock(lock) (!test_and_set_bit(0,(lock)))
+
+#define spin_lock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_lock(%s:%p) already locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 1; restore_flags(__spinflags);} while (0)
+#define spin_unlock_wait(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock_wait(%s:%p) deadlock\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} restore_flags(__spinflags);} while (0)
+#define spin_unlock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if (!(x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock(%s:%p) not locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 0; restore_flags(__spinflags);} while (0)
+
+#endif /* DEBUG_SPINLOCKS */
+
+/*
+ * Read-write spinlocks, allowing multiple readers
+ * but only one writer.
+ *
+ * NOTE! it is quite common to have readers in interrupts
+ * but no interrupt writers. For those circumstances we
+ * can "mix" irq-safe locks - any writer needs to get a
+ * irq-safe write-lock, but readers can get non-irqsafe
+ * read-locks.
+ *
+ * Gcc-2.7.x has a nasty bug with empty initializers.
+ */
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+ typedef struct { } rwlock_t;
+ #define RW_LOCK_UNLOCKED (rwlock_t) { }
+#else
+ typedef struct { int gcc_is_buggy; } rwlock_t;
+ #define RW_LOCK_UNLOCKED (rwlock_t) { 0 }
+#endif
+
+#define read_lock(lock) (void)(lock) /* Not "unused variable". */
+#define read_unlock(lock) do { } while(0)
+#define write_lock(lock) (void)(lock) /* Not "unused variable". */
+#define write_unlock(lock) do { } while(0)
+
+#endif /* !SMP */
+#endif /* __LINUX_SPINLOCK_H */
diff --git a/include/linux/stallion.h b/include/linux/stallion.h
index 94f5a1734..a4f6e2278 100644
--- a/include/linux/stallion.h
+++ b/include/linux/stallion.h
@@ -4,7 +4,7 @@
* stallion.h -- stallion multiport serial driver.
*
* Copyright (C) 1996-1998 Stallion Technologies (support@stallion.oz.au).
- * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au).
+ * Copyright (C) 1994-1996 Greg Ungerer.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -95,8 +95,13 @@ typedef struct stlport {
unsigned long hwid;
void *uartp;
struct tty_struct *tty;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
+ struct wait_queue *open_wait;
+ struct wait_queue *close_wait;
+#else
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
+#endif
struct termios normaltermios;
struct termios callouttermios;
struct tq_struct tqueue;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index da5665a5b..0b0baf1e8 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -64,6 +64,8 @@ struct swap_info_struct {
extern int nr_swap_pages;
extern int nr_free_pages;
+extern int nr_lru_pages;
+extern struct list_head lru_cache;
extern atomic_t nr_async_pages;
extern struct inode swapper_inode;
extern atomic_t page_cache_size;
@@ -85,7 +87,6 @@ extern int try_to_free_pages(unsigned int gfp_mask);
/* linux/mm/page_io.c */
extern void rw_swap_page(int, struct page *, int);
-extern void rw_swap_page_nocache(int, unsigned long, char *);
extern void rw_swap_page_nolock(int, unsigned long, char *, int);
extern void swap_after_unlock_page (unsigned long entry);
@@ -100,6 +101,8 @@ struct page * lookup_swap_cache(unsigned long);
extern struct page * read_swap_cache_async(unsigned long, int);
#define read_swap_cache(entry) read_swap_cache_async(entry, 1);
extern int FASTCALL(swap_count(unsigned long));
+extern unsigned long acquire_swap_entry(struct page *page);
+
/*
* Make these inline later once they are working properly.
*/
@@ -119,8 +122,8 @@ struct swap_list_t {
int next; /* swapfile to be used next */
};
extern struct swap_list_t swap_list;
-asmlinkage int sys_swapoff(const char *);
-asmlinkage int sys_swapon(const char *, int);
+asmlinkage long sys_swapoff(const char *);
+asmlinkage long sys_swapon(const char *, int);
/*
* vm_ops not present page codes for shared memory.
@@ -156,11 +159,30 @@ static inline int is_page_shared(struct page *page)
count = page_count(page);
if (PageSwapCache(page))
count += swap_count(page->offset) - 2;
- if (PageFreeAfter(page))
- count--;
return count > 1;
}
+extern spinlock_t pagemap_lru_lock;
+
+/*
+ * Helper macros for lru_pages handling.
+ */
+#define lru_cache_add(page) \
+do { \
+ spin_lock(&pagemap_lru_lock); \
+ list_add(&(page)->lru, &lru_cache); \
+ nr_lru_pages++; \
+ spin_unlock(&pagemap_lru_lock); \
+} while (0)
+
+#define lru_cache_del(page) \
+do { \
+ spin_lock(&pagemap_lru_lock); \
+ list_del(&(page)->lru); \
+ nr_lru_pages--; \
+ spin_unlock(&pagemap_lru_lock); \
+} while (0)
+
#endif /* __KERNEL__*/
#endif /* _LINUX_SWAP_H */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 5d9eedc1d..c5ba9895f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -78,7 +78,7 @@ enum
KERN_NODENAME=7,
KERN_DOMAINNAME=8,
- KERN_SECURELVL=14, /* int: system security level */
+ KERN_CAP_BSET=14, /* int: capability bounding set */
KERN_PANIC=15, /* int: panic timeout */
KERN_REALROOTDEV=16, /* real root device to mount after initrd */
@@ -100,7 +100,10 @@ enum
KERN_SHMMAX=34, /* int: Maximum shared memory segment */
KERN_MSGMAX=35, /* int: Maximum size of a messege */
KERN_MSGMNB=36, /* int: Maximum message queue size */
- KERN_MSGPOOL=37 /* int: Maximum system message pool size */
+ KERN_MSGPOOL=37, /* int: Maximum system message pool size */
+ KERN_SYSRQ=38, /* int: Sysreq enable */
+ KERN_MAX_THREADS=39, /* int: Maximum nr of threads in the system */
+ KERN_RANDOM=40 /* Random driver */
};
@@ -138,7 +141,19 @@ enum
NET_X25=13,
NET_TR=14,
NET_DECNET=15,
- NET_ECONET=16
+ NET_ECONET=16,
+ NET_KHTTPD=17
+};
+
+/* /proc/sys/kernel/random */
+enum
+{
+ RANDOM_POOLSIZE=1,
+ RANDOM_ENTROPY_COUNT=2,
+ RANDOM_READ_THRESH=3,
+ RANDOM_WRITE_THRESH=4,
+ RANDOM_BOOT_ID=5,
+ RANDOM_UUID=6
};
/* /proc/sys/bus/isa */
@@ -221,7 +236,10 @@ enum
NET_IPV4_ICMP_PARAMPROB_RATE=62,
NET_IPV4_ICMP_ECHOREPLY_RATE=63,
NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64,
- NET_IPV4_IGMP_MAX_MEMBERSHIPS=65
+ NET_IPV4_IGMP_MAX_MEMBERSHIPS=65,
+ NET_TCP_TW_RECYCLE=66,
+ NET_IPV4_ALWAYS_DEFRAG=67,
+ NET_IPV4_TCP_KEEPALIVE_INTVL=68,
};
enum {
@@ -239,7 +257,9 @@ enum {
NET_IPV4_ROUTE_ERROR_COST=12,
NET_IPV4_ROUTE_ERROR_BURST=13,
NET_IPV4_ROUTE_GC_ELASTICITY=14,
- NET_IPV4_ROUTE_MTU_EXPIRES=15
+ NET_IPV4_ROUTE_MTU_EXPIRES=15,
+ NET_IPV4_ROUTE_MIN_PMTU=16,
+ NET_IPV4_ROUTE_MIN_ADVMSS=17
};
enum
@@ -262,7 +282,8 @@ enum
NET_IPV4_CONF_RP_FILTER=8,
NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9,
NET_IPV4_CONF_BOOTP_RELAY=10,
- NET_IPV4_CONF_LOG_MARTIANS=11
+ NET_IPV4_CONF_LOG_MARTIANS=11,
+ NET_IPV4_CONF_TAG=12
};
/* /proc/sys/net/ipv6 */
@@ -280,7 +301,8 @@ enum {
NET_IPV6_ROUTE_GC_TIMEOUT=5,
NET_IPV6_ROUTE_GC_INTERVAL=6,
NET_IPV6_ROUTE_GC_ELASTICITY=7,
- NET_IPV6_ROUTE_MTU_EXPIRES=8
+ NET_IPV6_ROUTE_MTU_EXPIRES=8,
+ NET_IPV6_ROUTE_MIN_ADVMSS=9
};
enum {
@@ -405,6 +427,23 @@ enum {
NET_DECNET_DEBUG_LEVEL = 255
};
+/* /proc/sys/net/khttpd/ */
+enum {
+ NET_KHTTPD_DOCROOT = 1,
+ NET_KHTTPD_START = 2,
+ NET_KHTTPD_STOP = 3,
+ NET_KHTTPD_UNLOAD = 4,
+ NET_KHTTPD_CLIENTPORT = 5,
+ NET_KHTTPD_PERMREQ = 6,
+ NET_KHTTPD_PERMFORBID = 7,
+ NET_KHTTPD_LOGGING = 8,
+ NET_KHTTPD_SERVERPORT = 9,
+ NET_KHTTPD_DYNAMICSTRING= 10,
+ NET_KHTTPD_SLOPPYMIME = 11,
+ NET_KHTTPD_THREADS = 12,
+ NET_KHTTPD_MAXCONNECT = 13
+};
+
/* /proc/sys/net/decnet/conf/<dev> */
enum {
NET_DECNET_CONF_LOOPBACK = -2,
@@ -456,7 +495,12 @@ enum {
/* /proc/sys/dev/cdrom */
enum {
- DEV_CDROM_INFO=1
+ DEV_CDROM_INFO=1,
+ DEV_CDROM_AUTOCLOSE=2,
+ DEV_CDROM_AUTOEJECT=3,
+ DEV_CDROM_DEBUG=4,
+ DEV_CDROM_LOCK=5,
+ DEV_CDROM_CHECK_MEDIA=6
};
/* /proc/sys/dev/parport */
@@ -490,7 +534,7 @@ enum {
#ifdef __KERNEL__
-extern asmlinkage int sys_sysctl(struct __sysctl_args *);
+extern asmlinkage long sys_sysctl(struct __sysctl_args *);
extern void sysctl_init(void);
typedef struct ctl_table ctl_table;
@@ -507,10 +551,16 @@ extern int proc_dostring(ctl_table *, int, struct file *,
void *, size_t *);
extern int proc_dointvec(ctl_table *, int, struct file *,
void *, size_t *);
+extern int proc_dointvec_bset(ctl_table *, int, struct file *,
+ void *, size_t *);
extern int proc_dointvec_minmax(ctl_table *, int, struct file *,
void *, size_t *);
extern int proc_dointvec_jiffies(ctl_table *, int, struct file *,
void *, size_t *);
+extern int proc_doulongvec_minmax(ctl_table *, int, struct file *,
+ void *, size_t *);
+extern int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int,
+ struct file *, void *, size_t *);
extern int do_sysctl (int *name, int nlen,
void *oldval, size_t *oldlenp,
@@ -523,6 +573,7 @@ extern int do_sysctl_strategy (ctl_table *table,
extern ctl_handler sysctl_string;
extern ctl_handler sysctl_intvec;
+extern ctl_handler sysctl_jiffies;
extern int do_string (
void *oldval, size_t *oldlenp, void *newval, size_t newlen,
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index e630aba70..6c080adba 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -36,3 +36,5 @@ void do_emergency_sync(void);
#else
#define CHECK_EMERGENCY_SYNC
#endif
+
+extern int sysrq_enabled;
diff --git a/include/linux/tasks.h b/include/linux/tasks.h
deleted file mode 100644
index 91b758f49..000000000
--- a/include/linux/tasks.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _LINUX_TASKS_H
-#define _LINUX_TASKS_H
-
-/*
- * This is the maximum nr of tasks - change it if you need to
- */
-
-#ifdef __SMP__
-#define NR_CPUS 32 /* Max processors that can be running in SMP */
-#else
-#define NR_CPUS 1
-#endif
-
-#define NR_TASKS 512 /* On x86 Max 4092, or 4090 w/APM configured. */
-
-#define MAX_TASKS_PER_USER (NR_TASKS/2)
-#define MIN_TASKS_LEFT_FOR_ROOT 4
-
-
-/*
- * This controls the maximum pid allocated to a process
- */
-#define PID_MAX 0x8000
-
-#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 9ee718102..73796d6c4 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -87,4 +87,27 @@ enum {
TCPF_CLOSING = (1 << 11)
};
+/*
+ * The union cast uses a gcc extension to avoid aliasing problems
+ * (union is compatible to any of its members)
+ * This means this part of the code is -fstrict-aliasing safe now.
+ */
+union tcp_word_hdr {
+ struct tcphdr hdr;
+ __u32 words[5];
+};
+
+#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
+
+enum {
+ TCP_FLAG_URG = __constant_htonl(0x00200000),
+ TCP_FLAG_ACK = __constant_htonl(0x00100000),
+ TCP_FLAG_PSH = __constant_htonl(0x00080000),
+ TCP_FLAG_RST = __constant_htonl(0x00040000),
+ TCP_FLAG_SYN = __constant_htonl(0x00020000),
+ TCP_FLAG_FIN = __constant_htonl(0x00010000),
+ TCP_RESERVED_BITS = __constant_htonl(0x0FC00000),
+ TCP_DATA_OFFSET = __constant_htonl(0xF0000000)
+};
+
#endif /* _LINUX_TCP_H */
diff --git a/include/linux/threads.h b/include/linux/threads.h
new file mode 100644
index 000000000..f1f502eb6
--- /dev/null
+++ b/include/linux/threads.h
@@ -0,0 +1,22 @@
+#ifndef _LINUX_THREADS_H
+#define _LINUX_THREADS_H
+
+/*
+ * The default limit for the nr of threads is now in
+ * /proc/sys/kernel/max-threads.
+ */
+
+#ifdef __SMP__
+#define NR_CPUS 32 /* Max processors that can be running in SMP */
+#else
+#define NR_CPUS 1
+#endif
+
+#define MIN_THREADS_LEFT_FOR_ROOT 4
+
+/*
+ * This controls the maximum pid allocated to a process
+ */
+#define PID_MAX 0x8000
+
+#endif
diff --git a/include/linux/tqueue.h b/include/linux/tqueue.h
index d886f7533..b02f07665 100644
--- a/include/linux/tqueue.h
+++ b/include/linux/tqueue.h
@@ -13,9 +13,9 @@
#ifndef _LINUX_TQUEUE_H
#define _LINUX_TQUEUE_H
+#include <linux/spinlock.h>
#include <asm/bitops.h>
#include <asm/system.h>
-#include <asm/spinlock.h>
/*
* New proposed "bottom half" handlers:
diff --git a/include/linux/trdevice.h b/include/linux/trdevice.h
index 8689db32d..a70f27946 100644
--- a/include/linux/trdevice.h
+++ b/include/linux/trdevice.h
@@ -28,12 +28,12 @@
#include <linux/if_tr.h>
#ifdef __KERNEL__
-extern int tr_header(struct sk_buff *skb, struct device *dev,
+extern int tr_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type, void *daddr,
void *saddr, unsigned len);
extern int tr_rebuild_header(struct sk_buff *skb);
-extern unsigned short tr_type_trans(struct sk_buff *skb, struct device *dev);
-extern struct device * init_trdev(struct device *, int);
+extern unsigned short tr_type_trans(struct sk_buff *skb, struct net_device *dev);
+extern struct net_device * init_trdev(struct net_device *, int);
#endif
diff --git a/include/linux/tty.h b/include/linux/tty.h
index fb10cd6c9..bbb3ea833 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -349,6 +349,7 @@ extern int rs_init(void);
extern int lp_init(void);
extern int pty_init(void);
extern int tty_init(void);
+extern int ip2_init(void);
extern int pcxe_init(void);
extern int pc_init(void);
extern int vcs_init(void);
diff --git a/include/linux/udf_167.h b/include/linux/udf_167.h
new file mode 100644
index 000000000..0fe77d0ef
--- /dev/null
+++ b/include/linux/udf_167.h
@@ -0,0 +1,778 @@
+#if !defined(_LINUX_UDF_167_H)
+#define _LINUX_UDF_167_H
+/*
+ * udf_167.h
+ *
+ * DESCRIPTION
+ * Definitions from the ECMA 167 standard.
+ * http://www.ecma.ch/
+ *
+ * These abbreviations are used to keep the symbols short:
+ * Alloc Allocation
+ * App Application
+ * Attr Attribute
+ * Char Characters
+ * Desc Descriptor
+ * Descs Descriptors
+ * Ext Extent
+ * Ident Identifier
+ * Imp Implementation
+ * Lvl Level
+ * Max Maximum
+ * Num Number
+ * Ptr Pointer
+ * Seq Sequence
+ * Std Standard
+ * Struct Structure
+ * Vol Volume
+ * The symbols are otherwise identical to the standard, and the
+ * sections of the standard to refer to are indicated.
+ *
+ * CONTACTS
+ * E-mail regarding any portion of the Linux UDF file system should be
+ * directed to the development team mailing list (run by majordomo):
+ * linux_udf@hootie.lvld.hp.com
+ *
+ * COPYRIGHT
+ * This file is distributed under the terms of the GNU General Public
+ * License (GPL). Copies of the GPL can be obtained from:
+ * ftp://prep.ai.mit.edu/pub/gnu/GPL
+ * Each contributing author retains all rights to their own work.
+ *
+ * HISTORY
+ * July 12, 1997 - Andrew E. Mileski
+ * Adapted from the ECMA-167 standard.
+ *
+ * 10/2/98 dgb Adaptation
+ * 10/4/98 Changes by HJA Sandkuyl
+ * 10/7/98 Changed FILE_EXISTENCE to FILE_HIDDEN, per UDF 2.0 spec
+ * 11/26/98 Modifed some entries for UDF 1.5/2.0
+ * 11/26/98 bf Fixed typos, non-linux types, more structures
+ * 12/5/98 dgb Adjusted structure and content of include files.
+ */
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#define Uint8 __u8
+#define Uint16 __u16
+#define Uint32 __u32
+#define Uint64 __u64
+typedef Uint8 dstring;
+#else
+#define Uint8 unsigned char
+#define Uint16 unsigned short
+#define Uint32 unsigned int
+#define Uint64 unsigned long long
+typedef Uint8 dstring;
+#endif
+
+/* make sure all structures are packed! */
+#pragma pack(1)
+
+/* CS0 Charspec (ECMA 167 1/7.2.1) */
+typedef struct {
+ Uint8 charSetType;
+ Uint8 charSetInfo[63];
+} charspec;
+
+/* Timestamp (ECMA 167 1/7.3) */
+typedef struct {
+ Uint16 typeAndTimezone;
+ Uint16 year;
+ Uint8 month;
+ Uint8 day;
+ Uint8 hour;
+ Uint8 minute;
+ Uint8 second;
+ Uint8 centiseconds;
+ Uint8 hundredsOfMicroseconds;
+ Uint8 microseconds;
+} timestamp;
+
+/* Timestamp types (ECMA 167 1/7.3.1) */
+#define TIMESTAMP_TYPE_CUT 0x0000U
+#define TIMESTAMP_TYPE_LOCAL 0x0001U
+#define TIMESTAMP_TYPE_AGREEMENT 0x0002U
+
+/* Entity Identifier (ECMA 167 1/7.4) */
+typedef struct {
+ Uint8 flags;
+ Uint8 ident[23];
+ Uint8 identSuffix[8];
+} EntityID;
+#define regid EntityID
+
+/* Entity identifier flags (ECMA 167 1/7.4.1) */
+#define ENTITYID_FLAGS_DIRTY 0x01U
+#define ENTITYID_FLAGS_PROTECTED 0x02U
+
+/* Volume Structure Descriptor (ECMA 167 2/9.1) */
+#define STD_ID_LEN 5
+struct VolStructDesc {
+ Uint8 structType;
+ Uint8 stdIdent[STD_ID_LEN];
+ Uint8 structVersion;
+ Uint8 structData[2041];
+};
+
+/* Std structure identifiers (ECMA 167 2/9.1.2) */
+#define STD_ID_BEA01 "BEA01"
+#define STD_ID_BOOT2 "BOOT2"
+#define STD_ID_CD001 "CD001"
+#define STD_ID_CDW02 "CDW02"
+#define STD_ID_NSR02 "NSR02"
+#define STD_ID_NSR03 "NSR03"
+#define STD_ID_TEA01 "TEA01"
+
+/* Beginning Extended Area Descriptor (ECMA 167 2/9.2) */
+struct BeginningExtendedAreaDesc {
+ Uint8 structType;
+ Uint8 stdIdent[STD_ID_LEN];
+ Uint8 structVersion;
+ Uint8 structData[2041];
+};
+
+/* Terminating Extended Area Descriptor (ECMA 167 2/9.3) */
+struct TerminatingExtendedAreaDesc {
+ Uint8 structType;
+ Uint8 stdIdent[STD_ID_LEN];
+ Uint8 structVersion;
+ Uint8 structData[2041];
+};
+
+/* Boot Descriptor (ECMA 167 2/9.4) */
+struct BootDesc {
+ Uint8 structType;
+ Uint8 stdIdent[STD_ID_LEN];
+ Uint8 structVersion;
+ Uint8 reserved1;
+ EntityID architectureType;
+ EntityID bootIdent;
+ Uint32 bootExtLocation;
+ Uint32 bootExtLength;
+ Uint64 loadAddress;
+ Uint64 startAddress;
+ timestamp descCreationDateAndTime;
+ Uint16 flags;
+ Uint8 reserved2[32];
+ Uint8 bootUse[1906];
+};
+
+/* Boot flags (ECMA 167 2/9.4.12) */
+#define BOOT_FLAGS_ERASE 1
+
+/* Extent Descriptor (ECMA 167 3/7.1) */
+typedef struct {
+ Uint32 extLength;
+ Uint32 extLocation;
+} extent_ad;
+
+/* Descriptor Tag (ECMA 167 3/7.2) */
+typedef struct {
+ Uint16 tagIdent;
+ Uint16 descVersion;
+ Uint8 tagChecksum;
+ Uint8 reserved;
+ Uint16 tagSerialNum;
+ Uint16 descCRC;
+ Uint16 descCRCLength;
+ Uint32 tagLocation;
+} tag;
+
+/* Tag Identifiers (ECMA 167 3/7.2.1) */
+#define TID_UNUSED_DESC 0x0000U
+#define TID_PRIMARY_VOL_DESC 0x0001U
+#define TID_ANCHOR_VOL_DESC_PTR 0x0002U
+#define TID_VOL_DESC_PTR 0x0003U
+#define TID_IMP_USE_VOL_DESC 0x0004U
+#define TID_PARTITION_DESC 0x0005U
+#define TID_LOGICAL_VOL_DESC 0x0006U
+#define TID_UNALLOC_SPACE_DESC 0x0007U
+#define TID_TERMINATING_DESC 0x0008U
+#define TID_LOGICAL_VOL_INTEGRITY_DESC 0x0009U
+
+/* Tag Identifiers (ECMA 167 4/7.2.1) */
+#define TID_FILE_SET_DESC 0x0100U
+#define TID_FILE_IDENT_DESC 0x0101U
+#define TID_ALLOC_EXTENT_DESC 0x0102U
+#define TID_INDIRECT_ENTRY 0x0103U
+#define TID_TERMINAL_ENTRY 0x0104U
+#define TID_FILE_ENTRY 0x0105U
+#define TID_EXTENDED_ATTRE_HEADER_DESC 0x0106U
+#define TID_UNALLOCATED_SPACE_ENTRY 0x0107U
+#define TID_SPACE_BITMAP_DESC 0x0108U
+#define TID_PARTITION_INTEGRITY_ENTRY 0x0109U
+#define TID_EXTENDED_FILE_ENTRY 0x010AU
+
+/* NSR Descriptor (ECMA 167 3/9.1) */
+struct NSRDesc {
+ Uint8 structType;
+ Uint8 stdIdent[STD_ID_LEN];
+ Uint8 structVersion;
+ Uint8 reserved;
+ Uint8 structData[2040];
+};
+
+/* Primary Volume Descriptor (ECMA 167 3/10.1) */
+struct PrimaryVolDesc {
+ tag descTag;
+ Uint32 volDescSeqNum;
+ Uint32 primaryVolDescNum;
+ dstring volIdent[32];
+ Uint16 volSeqNum;
+ Uint16 maxVolSeqNum;
+ Uint16 interchangeLvl;
+ Uint16 maxInterchangeLvl;
+ Uint32 charSetList;
+ Uint32 maxCharSetList;
+ dstring volSetIdent[128];
+ charspec descCharSet;
+ charspec explanatoryCharSet;
+ extent_ad volAbstract;
+ extent_ad volCopyright;
+ EntityID appIdent;
+ timestamp recordingDateAndTime;
+ EntityID impIdent;
+ Uint8 impUse[64];
+ Uint32 predecessorVolDescSeqLocation;
+ Uint16 flags;
+ Uint8 reserved[22];
+};
+
+/* Primary volume descriptor flags (ECMA 167 3/10.1.21) */
+#define VOL_SET_IDENT 1
+
+/* Anchor Volume Descriptor Pointer (ECMA 167 3/10.2) */
+struct AnchorVolDescPtr {
+ tag descTag;
+ extent_ad mainVolDescSeqExt;
+ extent_ad reserveVolDescSeqExt;
+ Uint8 reserved[480];
+};
+
+/* Volume Descriptor Pointer (ECMA 167 3/10.3) */
+struct VolDescPtr {
+ tag descTag;
+ Uint32 volDescSeqNum;
+ extent_ad nextVolDescSeqExt;
+ Uint8 reserved[484];
+};
+
+/* Implementation Use Volume Descriptor (ECMA 167 3/10.4) */
+struct ImpUseVolDesc {
+ tag descTag;
+ Uint32 volDescSeqNum;
+ EntityID impIdent;
+ Uint8 impUse[460];
+};
+
+/* Partition Descriptor (ECMA 167 3/10.5) */
+struct PartitionDesc {
+ tag descTag;
+ Uint32 volDescSeqNum;
+ Uint16 partitionFlags;
+ Uint16 partitionNumber;
+ EntityID partitionContents;
+ Uint8 partitionContentsUse[128];
+ Uint32 accessType;
+ Uint32 partitionStartingLocation;
+ Uint32 partitionLength;
+ EntityID impIdent;
+ Uint8 impUse[128];
+ Uint8 reserved[156];
+};
+
+/* Partition Flags (ECMA 167 3/10.5.3) */
+#define PARTITION_FLAGS_ALLOC 1
+
+/* Partition Contents (ECMA 167 3/10.5.5) */
+#define PARTITION_CONTENTS_FDC01 "+FDC01"
+#define PARTITION_CONTENTS_CD001 "+CD001"
+#define PARTITION_CONTENTS_CDW02 "+CDW02"
+#define PARTITION_CONTENTS_NSR02 "+NSR02"
+#define PARTITION_CONTENTS_NSR03 "+NSR03"
+
+/* Partition Access Types (ECMA 167 3/10.5.7) */
+#define PARTITION_ACCESS_NONE 0
+#define PARTITION_ACCESS_R 1
+#define PARTITION_ACCESS_WO 2
+#define PARTITION_ACCESS_RW 3
+#define PARTITION_ACCESS_OW 4
+
+/* Logical Volume Descriptor (ECMA 167 3/10.6) */
+struct LogicalVolDesc {
+ tag descTag;
+ Uint32 volDescSeqNum;
+ charspec descCharSet;
+ dstring logicalVolIdent[128];
+ Uint32 logicalBlockSize;
+ EntityID domainIdent;
+ Uint8 logicalVolContentsUse[16]; /* used to find fileset */
+ Uint32 mapTableLength;
+ Uint32 numPartitionMaps;
+ EntityID impIdent;
+ Uint8 impUse[128];
+ extent_ad integritySeqExt;
+ Uint8 partitionMaps[0];
+};
+
+/* Generic Partition Map (ECMA 167 3/10.7.1) */
+struct GenericPartitionMap {
+ Uint8 partitionMapType;
+ Uint8 partitionMapLength;
+ Uint8 partitionMapping[0];
+};
+
+/* Partition Map Type (ECMA 167 3/10.7.1.1) */
+#define PARTITION_MAP_TYPE_NONE 0
+#define PARTITION_MAP_TYPE_1 1
+#define PARTITION_MAP_TYPE_2 2
+
+/* Type 1 Partition Map (ECMA 167 3/10.7.2) */
+struct GenericPartitionMap1 {
+ Uint8 partitionMapType;
+ Uint8 partitionMapLength;
+ Uint16 volSeqNum;
+ Uint16 partitionNum;
+};
+
+/* Type 2 Partition Map (ECMA 167 3/10.7.3) */
+struct GenericPartitionMap2 {
+ Uint8 partitionMapType; /* 2 */
+ Uint8 partitionMapLength;
+ Uint8 partitionIdent[62];
+};
+
+/* Unallocated Space Descriptor (ECMA 167 3/10.8) */
+struct UnallocatedSpaceDesc {
+ tag descTag;
+ Uint32 volDescSeqNum;
+ Uint32 numAllocDescs;
+ extent_ad allocDescs[0];
+};
+
+/* Terminating Descriptor (ECMA 3/10.9) */
+struct TerminatingDesc {
+ tag descTag;
+ Uint8 reserved[496];
+};
+
+struct GenericDesc
+{
+ tag descTag;
+ Uint32 volDescSeqNum;
+};
+
+/* Logical Volume Integrity Descriptor (ECMA 167 3/10.10) */
+struct LogicalVolIntegrityDesc {
+ tag descTag;
+ timestamp recordingDateAndTime;
+ Uint32 integrityType;
+ extent_ad nextIntegrityExt;
+ Uint8 logicalVolContentsUse[32];
+ Uint32 numOfPartitions;
+ Uint32 lengthOfImpUse;
+ Uint32 freeSpaceTable[0];
+ Uint32 sizeTable[0];
+ Uint8 impUse[0];
+};
+
+/* Integrity Types (ECMA 167 3/10.10.3) */
+#define INTEGRITY_TYPE_OPEN 0
+#define INTEGRITY_TYPE_CLOSE 1
+
+/* Recorded Address (ECMA 167 4/7.1) */
+typedef struct {
+ Uint32 logicalBlockNum;
+ Uint16 partitionReferenceNum;
+} lb_addr;
+
+/* Extent interpretation (ECMA 167 4/14.14.1.1) */
+#define EXTENT_RECORDED_ALLOCATED 0x00
+#define EXTENT_NOT_RECORDED_ALLOCATED 0x01
+#define EXTENT_NOT_RECORDED_NOT_ALLOCATED 0x02
+#define EXTENT_NEXT_EXTENT_ALLOCDECS 0x03
+
+/* Long Allocation Descriptor (ECMA 167 4/14.14.2) */
+typedef struct {
+ Uint32 extLength;
+ lb_addr extLocation;
+ Uint8 impUse[6];
+} long_ad;
+ /* upper 2 bits of extLength indicate type */
+
+/* File Set Descriptor (ECMA 167 4/14.1) */
+struct FileSetDesc {
+ tag descTag;
+ timestamp recordingDateAndTime;
+ Uint16 interchangeLvl;
+ Uint16 maxInterchangeLvl;
+ Uint32 charSetList;
+ Uint32 maxCharSetList;
+ Uint32 fileSetNum;
+ Uint32 fileSetDescNum;
+ charspec logicalVolIdentCharSet;
+ dstring logicalVolIdent[128];
+ charspec fileSetCharSet;
+ dstring fileSetIdent[32];
+ dstring copyrightFileIdent[32];
+ dstring abstractFileIdent[32];
+ long_ad rootDirectoryICB;
+ EntityID domainIdent;
+ long_ad nextExt;
+ long_ad streamDirectoryICB;
+ Uint8 reserved[32];
+};
+
+/* Short Allocation Descriptor (ECMA 167 4/14.14.1) */
+typedef struct {
+ Uint32 extLength;
+ Uint32 extPosition;
+} short_ad;
+
+/* Partition Header Descriptor (ECMA 167 4/14.3) */
+struct PartitionHeaderDesc {
+ short_ad unallocatedSpaceTable;
+ short_ad unallocatedSpaceBitmap;
+ short_ad partitionIntegrityTable;
+ short_ad freedSpaceTable;
+ short_ad freedSpaceBitmap;
+ Uint8 reserved[88];
+};
+
+/* File Identifier Descriptor (ECMA 167 4/14.4) */
+struct FileIdentDesc
+{
+ tag descTag;
+ Uint16 fileVersionNum; /* 1 */
+ Uint8 fileCharacteristics;
+ Uint8 lengthFileIdent;
+ long_ad icb;
+ Uint16 lengthOfImpUse;
+ Uint8 impUse[0];
+ Uint8 fileIdent[0];
+ Uint8 padding[0];
+};
+
+/* File Characteristics (ECMA 167 4/14.4.3) */
+#define FILE_HIDDEN 1
+#define FILE_DIRECTORY 2
+#define FILE_DELETED 4
+#define FILE_PARENT 8
+#define FILE_METADATA 0x10 /* UDF 2.0 */
+
+/* Allocation Ext Descriptor (ECMA 167 4/14.5) */
+struct AllocExtDesc
+{
+ tag descTag;
+ Uint32 previousAllocExtLocation;
+ Uint32 lengthAllocDescs;
+};
+
+/* ICB Tag (ECMA 167 4/14.6) */
+typedef struct {
+ Uint32 priorRecordedNumDirectEntries;
+ Uint16 strategyType;
+ Uint16 strategyParameter;
+ Uint16 numEntries;
+ Uint8 reserved;
+ Uint8 fileType;
+ lb_addr parentICBLocation;
+ Uint16 flags;
+} icbtag;
+
+/* ICB File Type (ECMA 167 4/14.6.6) */
+#define FILE_TYPE_NONE 0x00U
+#define FILE_TYPE_UNALLOC 0x01U
+#define FILE_TYPE_INTEGRITY 0x02U
+#define FILE_TYPE_INDIRECT 0x03U
+#define FILE_TYPE_DIRECTORY 0x04U
+#define FILE_TYPE_REGULAR 0x05U
+#define FILE_TYPE_BLOCK 0x06U
+#define FILE_TYPE_CHAR 0x07U
+#define FILE_TYPE_EXTENDED 0x08U
+#define FILE_TYPE_FIFO 0x09U
+#define FILE_TYPE_SOCKET 0x0aU
+#define FILE_TYPE_TERMINAL 0x0bU
+#define FILE_TYPE_SYMLINK 0x0cU
+#define FILE_TYPE_STREAMDIR 0x0dU /* ECMA 167 4/13 */
+
+/* ICB Flags (ECMA 167 4/14.6.8) */
+#define ICB_FLAG_ALLOC_MASK 0x0007U
+#define ICB_FLAG_SORTED 0x0008U
+#define ICB_FLAG_NONRELOCATABLE 0x0010U
+#define ICB_FLAG_ARCHIVE 0x0020U
+#define ICB_FLAG_SETUID 0x0040U
+#define ICB_FLAG_SETGID 0x0080U
+#define ICB_FLAG_STICKY 0x0100U
+#define ICB_FLAG_CONTIGUOUS 0x0200U
+#define ICB_FLAG_SYSTEM 0x0400U
+#define ICB_FLAG_TRANSFORMED 0x0800U
+#define ICB_FLAG_MULTIVERSIONS 0x1000U
+
+/* ICB Flags Allocation type(ECMA 167 4/14.6.8) */
+#define ICB_FLAG_AD_SHORT 0
+#define ICB_FLAG_AD_LONG 1
+#define ICB_FLAG_AD_EXTENDED 2
+#define ICB_FLAG_AD_IN_ICB 3
+
+/* Indirect Entry (ECMA 167 4/14.7) */
+struct IndirectEntry {
+ tag descTag;
+ icbtag icbTag;
+ long_ad indirectICB;
+};
+
+/* Terminal Entry (ECMA 167 4/14.8) */
+struct TerminalEntry {
+ tag descTag;
+ icbtag icbTag;
+};
+
+/* File Entry (ECMA 167 4/14.9) */
+struct FileEntry {
+ tag descTag;
+ icbtag icbTag;
+ Uint32 uid;
+ Uint32 gid;
+ Uint32 permissions;
+ Uint16 fileLinkCount;
+ Uint8 recordFormat;
+ Uint8 recordDisplayAttr;
+ Uint32 recordLength;
+ Uint64 informationLength;
+ Uint64 logicalBlocksRecorded;
+ timestamp accessTime;
+ timestamp modificationTime;
+ timestamp attrTime;
+ Uint32 checkpoint;
+ long_ad extendedAttrICB;
+ EntityID impIdent;
+ Uint64 uniqueID; /* 0= root, 16- (2^32-1) */
+ Uint32 lengthExtendedAttr;
+ Uint32 lengthAllocDescs;
+ Uint8 extendedAttr[0];
+ Uint8 allocDescs[0];
+};
+
+/* File Permissions (ECMA 167 4/14.9.5) */
+#define PERM_O_EXEC 0x00000001U
+#define PERM_O_WRITE 0x00000002U
+#define PERM_O_READ 0x00000004U
+#define PERM_O_CHATTR 0x00000008U
+#define PERM_O_DELETE 0x00000010U
+#define PERM_G_EXEC 0x00000020U
+#define PERM_G_WRITE 0x00000040U
+#define PERM_G_READ 0x00000080U
+#define PERM_G_CHATTR 0x00000100U
+#define PERM_G_DELETE 0x00000200U
+#define PERM_U_EXEC 0x00000400U
+#define PERM_U_WRITE 0x00000800U
+#define PERM_U_READ 0x00001000U
+#define PERM_U_CHATTR 0x00002000U
+#define PERM_U_DELETE 0x00004000U
+
+/* File Record Format (ECMA 167 4/14.9.7) */
+#define RECORD_FMT_NONE 0
+#define RECORD_FMT_FIXED_PAD 1
+#define RECORD_FMT_FIXED 2
+#define RECORD_FMT_VARIABLE8 3
+#define RECORD_FMT_VARIABLE16 4
+#define RECORD_FMT_VARIABLE16_MSB 5
+#define RECORD_FMT_VARIABLE32 6
+#define RECORD_FMT_PRINT 7
+#define RECORD_FMT_LF 8
+#define RECORD_FMT_CR 9
+#define RECORD_FMT_CRLF 10
+#define RECORD_FMT_LFCR 10
+
+/* Extended Attribute Header Descriptor (ECMA 167 4/14.10.1) */
+struct ExtendedAttrHeaderDesc {
+ tag descTag;
+ Uint32 impAttrLocation;
+ Uint32 appAttrLocation;
+};
+
+/* Generic Attribute Format (ECMA 4/14.10.2) */
+struct GenericAttrFormat {
+ Uint32 attrType;
+ Uint8 attrSubtype;
+ Uint8 reserved[3];
+ Uint32 attrLength;
+ Uint8 attrData[0];
+};
+
+/* Character Set Attribute Format (ECMA 4/14.10.3) */
+struct CharSetAttrFormat {
+ Uint32 attrType; /* 1 */
+ Uint8 attrSubtype; /* 1 */
+ Uint8 reserved[3];
+ Uint32 attrLength;
+ Uint32 escapeSeqLength;
+ Uint8 charSetType;
+ Uint8 escapeSeq[0];
+};
+
+/* Alternate Permissions (ECMA 167 4/14.10.4) */
+struct AlternatePermissionsExtendedAttr {
+ Uint32 attrType; /* 3 */
+ Uint8 attrSubtype; /* 1 */
+ Uint8 reserved[3];
+ Uint32 attrLength;
+ Uint16 ownerIdent;
+ Uint16 groupIdent;
+ Uint16 permission;
+};
+
+/* File Times Extended Attribute (ECMA 167 4/14.10.5) */
+struct FileTimesExtendedAttr {
+ Uint32 attrType; /* 5 */
+ Uint8 attrSubtype; /* 1 */
+ Uint8 reserved[3];
+ Uint32 attrLength;
+ Uint32 dataLength;
+ Uint32 fileTimeExistence;
+ Uint8 fileTimes;
+};
+
+/* FileTimeExistence (ECMA 167 4/14.10.5.6) */
+#define FTE_CREATION 0
+#define FTE_DELETION 2
+#define FTE_EFFECTIVE 3
+#define FTE_BACKUP 5
+
+/* Information Times Extended Attribute (ECMA 167 4/14.10.6) */
+struct InfoTimesExtendedAttr {
+ Uint32 attrType; /* 6 */
+ Uint8 attrSubtype; /* 1 */
+ Uint8 reserved[3];
+ Uint32 attrLength;
+ Uint32 dataLength;
+ Uint32 infoTimeExistence;
+ Uint8 infoTimes[0];
+};
+
+/* Device Specification Extended Attribute (ECMA 167 4/14.10.7) */
+struct DeviceSpecificationExtendedAttr {
+ Uint32 attrType; /* 12 */
+ Uint8 attrSubtype; /* 1 */
+ Uint8 reserved[3];
+ Uint32 attrLength;
+ Uint32 impUseLength;
+ Uint32 majorDeviceIdent;
+ Uint32 minorDeviceIdent;
+ Uint8 impUse[0];
+};
+
+/* Implementation Use Extended Attr (ECMA 167 4/14.10.8) */
+struct ImpUseExtendedAttr {
+ Uint32 attrType; /* 2048 */
+ Uint8 attrSubtype; /* 1 */
+ Uint8 reserved[3];
+ Uint32 attrLength;
+ Uint32 impUseLength;
+ EntityID impIdent;
+ Uint8 impUse[0];
+};
+
+/* Application Use Extended Attribute (ECMA 167 4/14.10.9) */
+struct AppUseExtendedAttr {
+ Uint32 attrType; /* 65536 */
+ Uint8 attrSubtype; /* 1 */
+ Uint8 reserved[3];
+ Uint32 attrLength;
+ Uint32 appUseLength;
+ EntityID appIdent;
+ Uint8 appUse[0];
+};
+
+#define EXTATTR_CHAR_SET 1
+#define EXTATTR_ALT_PERMS 3
+#define EXTATTR_FILE_TIMES 5
+#define EXTATTR_INFO_TIMES 6
+#define EXTATTR_DEV_SPEC 12
+#define EXTATTR_IMP_USE 2048
+#define EXTATTR_APP_USE 65536
+
+
+/* Unallocated Space Entry (ECMA 167 4/14.11) */
+struct UnallocatedSpaceEntry {
+ tag descTag;
+ icbtag icbTag;
+ Uint32 lengthAllocDescs;
+ Uint8 allocDescs[0];
+};
+
+/* Space Bitmap Descriptor (ECMA 167 4/14.12) */
+struct SpaceBitmapDesc {
+ tag descTag;
+ Uint32 numOfBits;
+ Uint32 numOfBytes;
+ Uint8 bitmap[0];
+};
+
+/* Partition Integrity Entry (ECMA 167 4/14.13) */
+struct PartitionIntegrityEntry {
+ tag descTag;
+ icbtag icbTag;
+ timestamp recordingDateAndTime;
+ Uint8 integrityType;
+ Uint8 reserved[175];
+ EntityID impIdent;
+ Uint8 impUse[256];
+};
+
+/* Extended Allocation Descriptor (ECMA 167 4/14.14.3) */
+typedef struct { /* ECMA 167 4/14.14.3 */
+ Uint32 extLength;
+ Uint32 recordedLength;
+ Uint32 informationLength;
+ lb_addr extLocation;
+} ext_ad;
+
+/* Logical Volume Header Descriptor (ECMA 167 4/14.5) */
+struct LogicalVolHeaderDesc {
+ Uint64 uniqueID;
+ Uint8 reserved[24];
+};
+
+/* Path Component (ECMA 167 4/14.16.1) */
+struct PathComponent {
+ Uint8 componentType;
+ Uint8 lengthComponentIdent;
+ Uint16 componentFileVersionNum;
+ dstring componentIdent[0];
+};
+
+/* File Entry (ECMA 167 4/14.17) */
+struct ExtendedFileEntry {
+ tag descTag;
+ icbtag icbTag;
+ Uint32 uid;
+ Uint32 gid;
+ Uint32 permissions;
+ Uint16 fileLinkCount;
+ Uint8 recordFormat;
+ Uint8 recordDisplayAttr;
+ Uint32 recordLength;
+ Uint64 informationLength;
+ Uint64 objectSize;
+ Uint64 logicalBlocksRecorded;
+ timestamp accessTime;
+ timestamp modificationTime;
+ timestamp createTime;
+ timestamp attrTime;
+ Uint32 checkpoint;
+ Uint32 reserved;
+ long_ad extendedAttrICB;
+ long_ad streamDirectoryICB;
+ EntityID impIdent;
+ Uint64 uniqueID;
+ Uint32 lengthExtendedAttr;
+ Uint32 lengthAllocDescs;
+ Uint8 extendedAttr[0];
+ Uint8 allocDescs[0];
+};
+#pragma pack()
+
+#endif /* !defined(_LINUX_UDF_167_H) */
diff --git a/include/linux/udf_fs.h b/include/linux/udf_fs.h
new file mode 100644
index 000000000..890c5e00b
--- /dev/null
+++ b/include/linux/udf_fs.h
@@ -0,0 +1,63 @@
+/*
+ * udf_fs.h
+ *
+ * Included by fs/filesystems.c
+ *
+ * CONTACTS
+ * E-mail regarding any portion of the Linux UDF file system should be
+ * directed to the development team mailing list (run by majordomo):
+ * linux_udf@hootie.lvld.hp.com
+ *
+ * COPYRIGHT
+ * This file is distributed under the terms of the GNU General Public
+ * License (GPL). Copies of the GPL can be obtained from:
+ * ftp://prep.ai.mit.edu/pub/gnu/GPL
+ * Each contributing author retains all rights to their own work.
+ *
+ * HISTORY
+ * July 21, 1997 - Andrew E. Mileski
+ * Written, tested, and released.
+ *
+ * 10/2/98 dgb rearranged all headers
+ * 11/26/98 bf added byte order macros
+ * 12/5/98 dgb removed other includes to reduce kernel namespace pollution.
+ * This should only be included by the kernel now!
+ */
+#if !defined(_LINUX_UDF_FS_H)
+#define _LINUX_UDF_FS_H
+
+#define UDF_PREALLOCATE
+#define UDF_DEFAULT_PREALLOC_BLOCKS 8
+#define UDF_DEFAULT_PREALLOC_DIR_BLOCKS 0
+
+#define UDFFS_DATE "99/09/02"
+#define UDFFS_VERSION "0.8.9"
+#define UDFFS_DEBUG
+
+#ifdef UDFFS_DEBUG
+#define udf_debug(f, a...) \
+ { \
+ printk (KERN_DEBUG "UDF-fs DEBUG (%s, %d): %s: ", \
+ __FILE__, __LINE__, __FUNCTION__); \
+ printk (## f, ## a); \
+ }
+#else
+#define udf_debug(f, a...) /**/
+#endif
+
+#define udf_info(f, a...) \
+ printk (KERN_INFO "UDF-fs INFO " ## f, ## a);
+
+struct udf_addr
+{
+ __u32 block;
+ __u16 partition;
+ unsigned error : 1;
+ unsigned reserved : 15;
+};
+
+
+/* Prototype for fs/filesystem.c (the only thing really required in this file) */
+extern int init_udf_fs(void);
+
+#endif /* !defined(_LINUX_UDF_FS_H) */
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h
new file mode 100644
index 000000000..c9d7b2fe7
--- /dev/null
+++ b/include/linux/udf_fs_i.h
@@ -0,0 +1,60 @@
+/*
+ * udf_fs_i.h
+ *
+ * This file is intended for the Linux kernel/module.
+ *
+ * CONTACTS
+ * E-mail regarding any portion of the Linux UDF file system should be
+ * directed to the development team mailing list (run by majordomo):
+ * linux_udf@hootie.lvld.hp.com
+ *
+ * COPYRIGHT
+ * This file is distributed under the terms of the GNU General Public
+ * License (GPL). Copies of the GPL can be obtained from:
+ * ftp://prep.ai.mit.edu/pub/gnu/GPL
+ * Each contributing author retains all rights to their own work.
+ */
+
+#if !defined(_LINUX_UDF_FS_I_H)
+#define _LINUX_UDF_FS_I_H
+
+#ifdef __KERNEL__
+
+#ifndef _LINUX_UDF_167_H
+typedef struct
+{
+ __u32 logicalBlockNum;
+ __u16 partitionReferenceNum;
+} lb_addr;
+#endif
+
+struct udf_inode_info
+{
+ long i_uatime;
+ long i_umtime;
+ long i_uctime;
+ /* Physical address of inode */
+ lb_addr i_ext0Location; /* partition relative */
+ lb_addr i_location;
+ __u32 i_ext0Length; /* in blocks */
+ __u32 i_ext0Offset; /* for short directories */
+ __u64 i_unique;
+ __u32 i_lenEAttr;
+ __u32 i_lenAlloc;
+ __u32 i_next_alloc_block;
+ __u32 i_next_alloc_goal;
+ unsigned i_alloc_type : 3;
+ unsigned i_extended_fe : 1;
+ unsigned i_strat_4096 : 1;
+ unsigned reserved : 27;
+};
+
+#endif
+
+/* exported IOCTLs, we have 'l', 0x40-0x7f */
+
+#define UDF_GETEASIZE _IOR('l', 0x40, int)
+#define UDF_GETEABLOCK _IOR('l', 0x41, void *)
+#define UDF_GETVOLIDENT _IOR('l', 0x42, void *)
+
+#endif /* !defined(_LINUX_UDF_FS_I_H) */
diff --git a/include/linux/udf_fs_sb.h b/include/linux/udf_fs_sb.h
new file mode 100644
index 000000000..87635c411
--- /dev/null
+++ b/include/linux/udf_fs_sb.h
@@ -0,0 +1,108 @@
+/*
+ * udf_fs_sb.h
+ *
+ * This include file is for the Linux kernel/module.
+ *
+ * CONTACTS
+ * E-mail regarding any portion of the Linux UDF file system should be
+ * directed to the development team mailing list (run by majordomo):
+ * linux_udf@hootie.lvld.hp.com
+ *
+ * COPYRIGHT
+ * This file is distributed under the terms of the GNU General Public
+ * License (GPL). Copies of the GPL can be obtained from:
+ * ftp://prep.ai.mit.edu/pub/gnu/GPL
+ * Each contributing author retains all rights to their own work.
+ */
+
+#if !defined(_LINUX_UDF_FS_SB_H)
+#define _LINUX_UDF_FS_SB_H
+
+#pragma pack(1)
+
+#define UDF_MAX_BLOCK_LOADED 8
+
+#define UDF_TYPE1_MAP15 0x1511U
+#define UDF_VIRTUAL_MAP15 0x1512U
+#define UDF_VIRTUAL_MAP20 0x2012U
+#define UDF_SPARABLE_MAP15 0x1522U
+
+struct udf_sparing_data
+{
+ __u32 s_spar_loc;
+ __u16 s_spar_plen;
+};
+
+struct udf_virtual_data
+{
+ __u32 s_num_entries;
+ __u16 s_start_offset;
+};
+
+struct udf_part_map
+{
+ __u32 s_uspace_bitmap;
+ __u32 s_partition_root;
+ __u32 s_partition_len;
+ __u16 s_partition_type;
+ __u16 s_partition_num;
+ union
+ {
+ struct udf_sparing_data s_sparing;
+ struct udf_virtual_data s_virtual;
+ } s_type_specific;
+ __u16 s_volumeseqnum;
+};
+
+#pragma pack()
+
+struct udf_sb_info
+{
+ struct udf_part_map *s_partmaps;
+ __u8 s_volident[32];
+
+ /* Overall info */
+ __u16 s_partitions;
+ __u16 s_partition;
+
+ /* Sector headers */
+ __u32 s_session;
+ __u32 s_anchor[4];
+ __u32 s_lastblock;
+
+ struct buffer_head *s_lvidbh;
+
+ lb_addr s_location;
+
+ __u16 s_loaded_block_bitmaps;
+ __u32 s_block_bitmap_number[UDF_MAX_BLOCK_LOADED];
+ struct buffer_head *s_block_bitmap[UDF_MAX_BLOCK_LOADED];
+
+ /* Default permissions */
+ mode_t s_umask;
+ gid_t s_gid;
+ uid_t s_uid;
+
+ /* Root Info */
+ time_t s_recordtime;
+
+ /* Fileset Info */
+ __u16 s_serialnum;
+
+ /* Character Mapping Info */
+ struct nls_table *s_nls_iocharset;
+ __u8 s_utf8;
+
+ /* Miscellaneous flags */
+ __u32 s_flags;
+
+ /* VAT inode */
+ struct inode *s_vat;
+
+#if LINUX_VERSION_CODE < 0x020206
+ int s_rename_lock;
+ struct wait_queue * s_rename_wait;
+#endif
+};
+
+#endif /* !defined(_LINUX_UDF_FS_SB_H) */
diff --git a/include/linux/udf_udf.h b/include/linux/udf_udf.h
new file mode 100644
index 000000000..b9778916a
--- /dev/null
+++ b/include/linux/udf_udf.h
@@ -0,0 +1,228 @@
+#if !defined(_LINUX_UDF_UDF_H)
+#define _LINUX_UDF_UDF_H
+/*
+ * udf_udf.h
+ *
+ * PURPOSE
+ * OSTA-UDF(tm) format specification [based on ECMA 167 standard].
+ * http://www.osta.org/
+ *
+ * CONTACTS
+ * E-mail regarding any portion of the Linux UDF file system should be
+ * directed to the development team mailing list (run by majordomo):
+ * linux_udf@hootie.lvld.hp.com
+ *
+ * COPYRIGHT
+ * This file is distributed under the terms of the GNU General Public
+ * License (GPL). Copies of the GPL can be obtained from:
+ * ftp://prep.ai.mit.edu/pub/gnu/GPL
+ * Each contributing author retains all rights to their own work.
+ *
+ * HISTORY
+ * July 1, 1997 - Andrew E. Mileski
+ * Written, tested, and released.
+ *
+ * 10/2/98 dgb changed UDF_ID_DEVELOPER
+ * 11/26/98 bf changed UDF_ID_DEVELOPER,
+ * 12/5/98 dgb updated include file hierarchy, more UDF definitions
+ */
+
+/* based on ECMA 167 structure definitions */
+#include <linux/udf_167.h>
+
+#pragma pack(1)
+
+/* -------- Basic types and constants ----------- */
+/* UDF character set (UDF 1.50 2.1.2) */
+#define UDF_CHAR_SET_TYPE 0
+#define UDF_CHAR_SET_INFO "OSTA Compressed Unicode"
+
+#define UDF_ID_DEVELOPER "*Linux UDFFS"
+
+/* UDF 1.02 2.2.6.4 */
+struct LogicalVolIntegrityDescImpUse
+{
+ EntityID impIdent;
+ Uint32 numFiles;
+ Uint32 numDirs;
+ Uint16 minUDFReadRev;
+ Uint16 minUDFWriteRev;
+ Uint16 maxUDFWriteRev;
+};
+
+/* UDF 1.02 2.2.7.2 */
+/* LVInformation may be present in ImpUseVolDesc.impUse */
+struct ImpUseVolDescImpUse
+{
+ charspec LVICharset;
+ dstring logicalVolIdent[128];
+ dstring LVInfo1[36];
+ dstring LVInfo2[36];
+ dstring LVInfo3[36];
+ EntityID impIdent;
+ Uint8 impUse[128];
+};
+
+struct UdfPartitionMap2
+{
+ Uint8 partitionMapType;
+ Uint8 partitionMapLength;
+ Uint8 reserved1[2];
+ EntityID partIdent;
+ Uint16 volSeqNum;
+ Uint16 partitionNum;
+ Uint8 reserved2[24];
+};
+
+/* UDF 1.5 2.2.8 */
+struct VirtualPartitionMap
+{
+ Uint8 partitionMapType; /* 2 */
+ Uint8 partitionMapLength; /* 64 */
+ Uint8 reserved1[2]; /* #00 */
+ EntityID partIdent;
+ Uint16 volSeqNum;
+ Uint16 partitionNum;
+ Uint8 reserved2[24]; /* #00 */
+};
+
+/* UDF 1.5 2.2.9 */
+struct SparablePartitionMap
+{
+ Uint8 partitionMapType; /* 2 */
+ Uint8 partitionMapLength; /* 64 */
+ Uint8 reserved1[2]; /* #00 */
+ EntityID partIdent; /* Flags = 0 */
+ /* Id = UDF_ID_SPARABLE */
+ /* IdSuf = 2.1.5.3 */
+ Uint16 volSeqNum;
+ Uint16 partitionNum;
+ Uint16 packetLength; /* 32 */
+ Uint8 numSparingTables;
+ Uint8 reserved2[1]; /* #00 */
+ Uint32 sizeSparingTable;
+ Uint32 locSparingTable[0];
+ Uint8 pad[0];
+};
+
+/* DVD Copyright Management Info, see UDF 1.02 3.3.4.5.1.2 */
+/* when ImpUseExtendedAttr.impIdent= "*UDF DVD CGMS Info" */
+struct DVDCopyrightImpUse {
+ Uint16 headerChecksum;
+ Uint8 CGMSInfo;
+ Uint8 dataType;
+ Uint8 protectionSystemInfo[4];
+};
+
+/* the impUse of long_ad used in AllocDescs - UDF 1.02 2.3.10.1 */
+struct ADImpUse
+{
+ Uint16 flags;
+ Uint8 impUse[4];
+};
+
+/* UDF 1.02 2.3.10.1 */
+#define UDF_EXTENT_LENGTH_MASK 0x3FFFFFFF
+#define UDF_EXTENT_FLAG_MASK 0xc0000000
+#define UDF_EXTENT_FLAG_ERASED 0x40000000
+
+/*
+ * Important! VirtualAllocationTables are
+ * very different between 1.5 and 2.0!
+ */
+
+/* ----------- 1.5 ------------- */
+/* UDF 1.5 2.2.10 */
+#define FILE_TYPE_VAT15 0x0U
+
+/* UDF 1.5 2.2.10 - VAT layout: */
+struct VirutalAllocationTable15 {
+ Uint32 VirtualSector[0];
+ EntityID ident;
+ Uint32 previousVATICB;
+ };
+/* where number of VirtualSector's is (VATSize-36)/4 */
+
+/* ----------- 2.0 ------------- */
+/* UDF 2.0 2.2.10 */
+#define FILE_TYPE_VAT20 0xf8U
+
+/* UDF 2.0 2.2.10 (different from 1.5!) */
+struct VirtualAllocationTable20 {
+ Uint16 lengthHeader;
+ Uint16 lengthImpUse;
+ dstring logicalVolIdent[128];
+ Uint32 previousVatICBLoc;
+ Uint32 numFIDSFiles;
+ Uint32 numFIDSDirectories; /* non-parent */
+ Uint16 minReadRevision;
+ Uint16 minWriteRevision;
+ Uint16 maxWriteRevision;
+ Uint16 reserved;
+ Uint8 impUse[0];
+ Uint32 vatEntry[0];
+};
+
+/* Sparing maps, see UDF 1.5 2.2.11 */
+typedef struct {
+ Uint32 origLocation;
+ Uint32 mappedLocation;
+} SparingEntry;
+
+/* sparing maps, see UDF 2.0 2.2.11 */
+struct SparingTable {
+ tag descTag;
+ EntityID sparingIdent; /* *UDF Sparing Table */
+ Uint16 reallocationTableLen;
+ Uint16 reserved; /* #00 */
+ Uint32 sequenceNum;
+ SparingEntry mapEntry[0];
+};
+
+/* Entity Identifiers (UDF 1.50 6.1) */
+#define UDF_ID_COMPLIANT "*OSTA UDF Compliant"
+#define UDF_ID_LV_INFO "*UDF LV Info"
+#define UDF_ID_FREE_EA "*UDF FreeEASpace"
+#define UDF_ID_FREE_APP_EA "*UDF FreeAppEASpace"
+#define UDF_ID_DVD_CGMS "*UDF DVD CGMS Info"
+#define UDF_ID_OS2_EA "*UDF OS/2 EA"
+#define UDF_ID_OS2_EA_LENGTH "*UDF OS/2 EALength"
+#define UDF_ID_MAC_VOLUME "*UDF Mac VolumeInfo"
+#define UDF_ID_MAC_FINDER "*UDF Mac FinderInfo"
+#define UDF_ID_MAC_UNIQUE "*UDF Mac UniqueIDTable"
+#define UDF_ID_MAC_RESOURCE "*UDF Mac ResourceFork"
+#define UDF_ID_VIRTUAL "*UDF Virtual Partition"
+#define UDF_ID_SPARABLE "*UDF Sparable Partition"
+#define UDF_ID_ALLOC "*UDF Virtual Alloc Tbl"
+#define UDF_ID_SPARING "*UDF Sparing Table"
+
+/* Operating System Identifiers (UDF 1.50 6.3) */
+#define UDF_OS_CLASS_UNDEF 0x00U
+#define UDF_OS_CLASS_DOS 0x01U
+#define UDF_OS_CLASS_OS2 0x02U
+#define UDF_OS_CLASS_MAC 0x03U
+#define UDF_OS_CLASS_UNIX 0x04U
+#define UDF_OS_CLASS_WIN95 0x05U
+#define UDF_OS_CLASS_WINNT 0x06U
+#define UDF_OS_ID_UNDEF 0x00U
+#define UDF_OS_ID_DOS 0x00U
+#define UDF_OS_ID_OS2 0x00U
+#define UDF_OS_ID_MAC 0x00U
+#define UDF_OS_ID_UNIX 0x00U
+#define UDF_OS_ID_WIN95 0x00U
+#define UDF_OS_ID_WINNT 0x00U
+#define UDF_OS_ID_AIX 0x01U
+#define UDF_OS_ID_SOLARIS 0x02U
+#define UDF_OS_ID_HPUX 0x03U
+#define UDF_OS_ID_IRIX 0x04U
+#define UDF_OS_ID_LINUX 0x05U
+#define UDF_OS_ID_MKLINUX 0x06U
+#define UDF_OS_ID_FREEBSD 0x07U
+
+#define UDF_NAME_PAD 4
+#define UDF_NAME_LEN 255
+#define UDF_PATH_LEN 1023
+
+#pragma pack()
+
+#endif /* !defined(_LINUX_UDF_FMT_H) */
diff --git a/include/linux/umsdos_fs.h b/include/linux/umsdos_fs.h
index 14bdb829d..395226a23 100644
--- a/include/linux/umsdos_fs.h
+++ b/include/linux/umsdos_fs.h
@@ -174,10 +174,6 @@ struct umsdos_ioctl {
#endif
extern struct inode_operations umsdos_dir_inode_operations;
-extern struct file_operations umsdos_file_operations;
-extern struct inode_operations umsdos_file_inode_operations;
-extern struct inode_operations umsdos_file_inode_operations_no_bmap;
-extern struct inode_operations umsdos_file_inode_operations_readpage;
extern struct inode_operations umsdos_symlink_inode_operations;
extern int init_umsdos_fs (void);
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 590d4b10f..bff574aac 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -278,8 +278,9 @@ struct video_unit
#define VID_HARDWARE_TYPHOON 19
#define VID_HARDWARE_VINO 20 /* Reserved for SGI Indy Vino */
#define VID_HARDWARE_CADET 21 /* Cadet radio */
-#define VID_HARDWARE_CPIA 22
+#define VID_HARDWARE_TRUST 22 /* Trust FM Radio */
#define VID_HARDWARE_TERRATEC 23 /* TerraTec ActiveRadio */
+#define VID_HARDWARE_CPIA 24
/*
* Initialiser list
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 79fae9356..86bd08715 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -11,9 +11,9 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/stddef.h>
+#include <linux/spinlock.h>
#include <asm/page.h>
-#include <asm/spinlock.h>
#include <asm/processor.h>
/*
diff --git a/include/linux/wanpipe.h b/include/linux/wanpipe.h
index aa3cb84a3..434ade5a2 100644
--- a/include/linux/wanpipe.h
+++ b/include/linux/wanpipe.h
@@ -104,7 +104,7 @@ typedef struct global_stats
*/
typedef struct load_sharing
{
- struct device* dev_ptr;
+ struct net_device* dev_ptr;
struct load_sharing* next;
} load_sharing_t;
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index c2c5ff4c3..a9fc91a35 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -355,12 +355,12 @@ typedef struct wan_device
int (*update) (struct wan_device* wandev);
int (*ioctl) (struct wan_device* wandev, unsigned cmd,
unsigned long arg);
- int (*new_if) (struct wan_device* wandev, struct device* dev,
+ int (*new_if) (struct wan_device* wandev, struct net_device* dev,
wanif_conf_t* conf);
- int (*del_if) (struct wan_device* wandev, struct device* dev);
+ int (*del_if) (struct wan_device* wandev, struct net_device* dev);
/****** maintained by the router ****/
struct wan_device* next; /* -> next device */
- struct device* dev; /* list of network interfaces */
+ struct net_device* dev; /* list of network interfaces */
unsigned ndev; /* number of interfaces */
struct proc_dir_entry dent; /* proc filesystem entry */
} wan_device_t;
@@ -368,8 +368,8 @@ typedef struct wan_device
/* Public functions available for device drivers */
extern int register_wan_device(wan_device_t* wandev);
extern int unregister_wan_device(char* name);
-unsigned short wanrouter_type_trans(struct sk_buff* skb, struct device* dev);
-int wanrouter_encapsulate(struct sk_buff* skb, struct device* dev);
+unsigned short wanrouter_type_trans(struct sk_buff* skb, struct net_device* dev);
+int wanrouter_encapsulate(struct sk_buff* skb, struct net_device* dev);
/* Proc interface functions. These must not be called by the drivers! */
extern int wanrouter_proc_init (void);
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index d3c59fff5..acc0619eb 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -1,9 +1,9 @@
/*
* This file define a set of standard wireless extensions
*
- * Version : 7 23.4.99
+ * Version : 8 28.7.99
*
- * Authors : Jean Tourrilhes - HPLB - <jt@hplb.hpl.hp.com>
+ * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
*/
#ifndef _LINUX_WIRELESS_H
@@ -63,7 +63,7 @@
* (there is some stuff that will be added in the future...)
* I just plan to increment with each new version.
*/
-#define WIRELESS_EXT 6
+#define WIRELESS_EXT 8
/*
* Changes :
@@ -90,6 +90,12 @@
* V6 to V7
* --------
* - define IW_ESSID_MAX_SIZE and IW_MAX_AP
+ *
+ * V7 to V8
+ * --------
+ * - Changed my e-mail address
+ * - More 802.11 support (nickname, rate, rts, frag)
+ * - List index in frequencies
*/
/* -------------------------- IOCTL LIST -------------------------- */
@@ -117,24 +123,34 @@
#define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
/* Access Point manipulation */
-#define SIOCSIWAP 0x8B14 /* set access point hardware addresses */
-#define SIOCGIWAP 0x8B15 /* get access point hardware addresses */
+#define SIOCSIWAP 0x8B14 /* set access point MAC addresses */
+#define SIOCGIWAP 0x8B15 /* get access point MAC addresses */
#define SIOCGIWAPLIST 0x8B17 /* get list of access point in range */
/* 802.11 specific support */
#define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
#define SIOCGIWESSID 0x8B1B /* get ESSID */
-/* As the ESSID is a string up to 32 bytes long, it doesn't fit within the
- * 'iwreq' structure, so we need to use the 'data' member to point to a
- * string in user space, like it is done for RANGE...
- * The "flags" member indicate if the ESSID is active or not.
+#define SIOCSIWNICKN 0x8B1C /* set node name/nickname */
+#define SIOCGIWNICKN 0x8B1D /* get node name/nickname */
+/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
+ * within the 'iwreq' structure, so we need to use the 'data' member to
+ * point to a string in user space, like it is done for RANGE...
+ * The "flags" member indicate if the ESSID is active or not (promiscuous).
*/
+/* Other parameters usefull in 802.11 and some other devices */
+#define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */
+#define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */
+#define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */
+#define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */
+#define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */
+#define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */
+
/* ------------------------- IOCTL STUFF ------------------------- */
/* The first and the last (range) */
#define SIOCIWFIRST 0x8B00
-#define SIOCIWLAST 0x8B1B
+#define SIOCIWLAST 0x8B25
/* Even : get (world access), odd : set (root access) */
#define IW_IS_SET(cmd) (!((cmd) & 0x1))
@@ -171,6 +187,9 @@
* don't increase this constant and don't fill the frequency list.
* The user will be able to set by channel anyway... */
+/* Maximum bit rates in the range struct */
+#define IW_MAX_BITRATES 8
+
/* Maximum of address that you may set with SPY */
#define IW_MAX_SPY 8
@@ -178,7 +197,7 @@
list of access points in range */
#define IW_MAX_AP 8
-/* Maximum size of the ESSID string */
+/* Maximum size of the ESSID and NICKN strings */
#define IW_ESSID_MAX_SIZE 32
/****************************** TYPES ******************************/
@@ -186,15 +205,17 @@
/* --------------------------- SUBTYPES --------------------------- */
/*
* A frequency
- * For numbers lower than 10^9, we encode the number in 'mant' and
- * set 'exp' to 0
- * For number greater than 10^9, we divide it by a power of 10.
- * The power of 10 is in 'exp', the result is in 'mant'.
+ * For numbers lower than 10^9, we encode the number in 'm' and
+ * set 'e' to 0
+ * For number greater than 10^9, we divide it by the lowest power
+ * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
+ * The power of 10 is in 'e', the result of the division is in 'm'.
*/
struct iw_freq
{
__u32 m; /* Mantissa */
__u16 e; /* Exponent */
+ __u8 i; /* List index (when in range struct) */
};
/*
@@ -229,6 +250,15 @@ struct iw_encoding
__u64 code; /* Data/key used for algorithm */
};
+/*
+ * Generic format for parameters
+ */
+struct iw_param
+{
+ __s32 value; /* The value of the parameter itself */
+ __u8 fixed; /* Hardware should not use auto select */
+};
+
/* ------------------------ WIRELESS STATS ------------------------ */
/*
@@ -258,7 +288,7 @@ struct iwreq
{
union
{
- char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */
} ifr_ifrn;
/* Data part */
@@ -281,7 +311,11 @@ struct iwreq
struct iw_encoding encoding; /* Encoding stuff */
- __u32 sensitivity; /* signal level threshold */
+ __u32 sensitivity; /* Obsolete, but compatible */
+ struct iw_param sens; /* signal level threshold */
+ struct iw_param bitrate; /* default bit rate */
+ struct iw_param rts; /* RTS threshold threshold */
+ struct iw_param frag; /* Fragmentation threshold */
struct sockaddr ap_addr; /* Access point address */
@@ -309,6 +343,12 @@ struct iw_range
{
/* Informative stuff (to choose between different interface) */
__u32 throughput; /* To give an idea... */
+ /* In theory this value should be the maximum benchmarked
+ * TCP/IP throughput, because with most of these devices the
+ * bit rate is meaningless (overhead an co) to estimate how
+ * fast the connection will go and pick the fastest one.
+ * I suggest people to play with Netperf or any benchmark...
+ */
/* NWID (or domain id) */
__u32 min_nwid; /* Minimal NWID we are able to set */
@@ -321,13 +361,25 @@ struct iw_range
/* Note : this frequency list doesn't need to fit channel numbers */
/* signal level threshold range */
- __u32 sensitivity;
+ __s32 sensitivity;
/* Quality of link & SNR stuff */
struct iw_quality max_qual; /* Quality of the link */
/* Encoder stuff */
struct iw_encoding max_encoding; /* Encoding max range */
+
+ /* Rates */
+ __u8 num_bitrates; /* Number of entries in the list */
+ __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
+
+ /* RTS threshold */
+ __s32 min_rts; /* Minimal RTS threshold */
+ __s32 max_rts; /* Maximal RTS threshold */
+
+ /* Frag threshold */
+ __s32 min_frag; /* Minimal frag threshold */
+ __s32 max_frag; /* Maximal frag threshold */
};
/*
diff --git a/include/linux/yam.h b/include/linux/yam.h
new file mode 100644
index 000000000..7fe28228b
--- /dev/null
+++ b/include/linux/yam.h
@@ -0,0 +1,82 @@
+/*****************************************************************************/
+
+/*
+ * yam.h -- YAM radio modem driver.
+ *
+ * Copyright (C) 1998 Frederic Rible F1OAT (frible@teaser.fr)
+ * Adapted from baycom.c driver written by Thomas Sailer (sailer@ife.ee.ethz.ch)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Please note that the GPL allows you to use the driver, NOT the radio.
+ * In order to use the radio, you need a license from the communications
+ * authority of your country.
+ *
+ *
+ */
+
+/*****************************************************************************/
+
+#define SIOCYAMRESERVED (0)
+#define SIOCYAMSCFG (1) /* Set configuration */
+#define SIOCYAMGCFG (2) /* Get configuration */
+#define SIOCYAMSMCS (3) /* Set mcs data */
+
+#define YAM_IOBASE (1 << 0)
+#define YAM_IRQ (1 << 1)
+#define YAM_BITRATE (1 << 2) /* Bit rate of radio port ->57600 */
+#define YAM_MODE (1 << 3) /* 0=simplex 1=duplex 2=duplex+tempo */
+#define YAM_HOLDDLY (1 << 4) /* duplex tempo (sec) */
+#define YAM_TXDELAY (1 << 5) /* Tx Delay (ms) */
+#define YAM_TXTAIL (1 << 6) /* Tx Tail (ms) */
+#define YAM_PERSIST (1 << 7) /* Persist (ms) */
+#define YAM_SLOTTIME (1 << 8) /* Slottime (ms) */
+#define YAM_BAUDRATE (1 << 9) /* Baud rate of rs232 port ->115200 */
+
+#define YAM_MAXBITRATE 57600
+#define YAM_MAXBAUDRATE 115200
+#define YAM_MAXMODE 2
+#define YAM_MAXHOLDDLY 99
+#define YAM_MAXTXDELAY 999
+#define YAM_MAXTXTAIL 999
+#define YAM_MAXPERSIST 255
+#define YAM_MAXSLOTTIME 999
+
+#define YAM_FPGA_SIZE 5302
+
+struct yamcfg {
+ unsigned int mask; /* Mask of commands */
+ unsigned int iobase; /* IO Base of COM port */
+ unsigned int irq; /* IRQ of COM port */
+ unsigned int bitrate; /* Bit rate of radio port */
+ unsigned int baudrate; /* Baud rate of the RS232 port */
+ unsigned int txdelay; /* TxDelay */
+ unsigned int txtail; /* TxTail */
+ unsigned int persist; /* Persistence */
+ unsigned int slottime; /* Slottime */
+ unsigned int mode; /* mode 0 (simp), 1(Dupl), 2(Dupl+delay) */
+ unsigned int holddly; /* PTT delay in FullDuplex 2 mode */
+};
+
+struct yamdrv_ioctl_cfg {
+ int cmd;
+ struct yamcfg cfg;
+};
+
+struct yamdrv_ioctl_mcs {
+ int cmd;
+ int bitrate;
+ unsigned char bits[YAM_FPGA_SIZE];
+};
diff --git a/include/math-emu/double.h b/include/math-emu/double.h
new file mode 100644
index 000000000..ee581c2da
--- /dev/null
+++ b/include/math-emu/double.h
@@ -0,0 +1,197 @@
+/* Software floating-point emulation.
+ Definitions for IEEE Double Precision
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz),
+ David S. Miller (davem@redhat.com) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if _FP_W_TYPE_SIZE < 32
+#error "Here's a nickel kid. Go buy yourself a real computer."
+#endif
+
+#if _FP_W_TYPE_SIZE < 64
+#define _FP_FRACTBITS_D (2 * _FP_W_TYPE_SIZE)
+#else
+#define _FP_FRACTBITS_D _FP_W_TYPE_SIZE
+#endif
+
+#define _FP_FRACBITS_D 53
+#define _FP_FRACXBITS_D (_FP_FRACTBITS_D - _FP_FRACBITS_D)
+#define _FP_WFRACBITS_D (_FP_WORKBITS + _FP_FRACBITS_D)
+#define _FP_WFRACXBITS_D (_FP_FRACTBITS_D - _FP_WFRACBITS_D)
+#define _FP_EXPBITS_D 11
+#define _FP_EXPBIAS_D 1023
+#define _FP_EXPMAX_D 2047
+
+#define _FP_QNANBIT_D \
+ ((_FP_W_TYPE)1 << (_FP_FRACBITS_D-2) % _FP_W_TYPE_SIZE)
+#define _FP_IMPLBIT_D \
+ ((_FP_W_TYPE)1 << (_FP_FRACBITS_D-1) % _FP_W_TYPE_SIZE)
+#define _FP_OVERFLOW_D \
+ ((_FP_W_TYPE)1 << _FP_WFRACBITS_D % _FP_W_TYPE_SIZE)
+
+#if _FP_W_TYPE_SIZE < 64
+
+union _FP_UNION_D
+{
+ double flt;
+ struct {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned sign : 1;
+ unsigned exp : _FP_EXPBITS_D;
+ unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;
+ unsigned frac0 : _FP_W_TYPE_SIZE;
+#else
+ unsigned frac0 : _FP_W_TYPE_SIZE;
+ unsigned frac1 : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0) - _FP_W_TYPE_SIZE;
+ unsigned exp : _FP_EXPBITS_D;
+ unsigned sign : 1;
+#endif
+ } bits __attribute__((packed));
+};
+
+#define FP_DECL_D(X) _FP_DECL(2,X)
+#define FP_UNPACK_RAW_D(X,val) _FP_UNPACK_RAW_2(D,X,val)
+#define FP_UNPACK_RAW_DP(X,val) _FP_UNPACK_RAW_2_P(D,X,val)
+#define FP_PACK_RAW_D(val,X) _FP_PACK_RAW_2(D,val,X)
+#define FP_PACK_RAW_DP(val,X) \
+ do { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P(D,val,X); \
+ } while (0)
+
+#define FP_UNPACK_D(X,val) \
+ do { \
+ _FP_UNPACK_RAW_2(D,X,val); \
+ _FP_UNPACK_CANONICAL(D,2,X); \
+ } while (0)
+
+#define FP_UNPACK_DP(X,val) \
+ do { \
+ _FP_UNPACK_RAW_2_P(D,X,val); \
+ _FP_UNPACK_CANONICAL(D,2,X); \
+ } while (0)
+
+#define FP_PACK_D(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(D,2,X); \
+ _FP_PACK_RAW_2(D,val,X); \
+ } while (0)
+
+#define FP_PACK_DP(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(D,2,X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P(D,val,X); \
+ } while (0)
+
+#define FP_ISSIGNAN_D(X) _FP_ISSIGNAN(D,2,X)
+#define FP_NEG_D(R,X) _FP_NEG(D,2,R,X)
+#define FP_ADD_D(R,X,Y) _FP_ADD(D,2,R,X,Y)
+#define FP_SUB_D(R,X,Y) _FP_SUB(D,2,R,X,Y)
+#define FP_MUL_D(R,X,Y) _FP_MUL(D,2,R,X,Y)
+#define FP_DIV_D(R,X,Y) _FP_DIV(D,2,R,X,Y)
+#define FP_SQRT_D(R,X) _FP_SQRT(D,2,R,X)
+#define _FP_SQRT_MEAT_D(R,S,T,X,Q) _FP_SQRT_MEAT_2(R,S,T,X,Q)
+
+#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,2,r,X,Y,un)
+#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,2,r,X,Y)
+
+#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
+#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,2,X,r,rs,rt)
+
+#define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_2(X)
+#define _FP_FRAC_HIGH_RAW_D(X) _FP_FRAC_HIGH_2(X)
+
+#else
+
+union _FP_UNION_D
+{
+ double flt;
+ struct {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned sign : 1;
+ unsigned exp : _FP_EXPBITS_D;
+ unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
+#else
+ unsigned long frac : _FP_FRACBITS_D - (_FP_IMPLBIT_D != 0);
+ unsigned exp : _FP_EXPBITS_D;
+ unsigned sign : 1;
+#endif
+ } bits __attribute__((packed));
+};
+
+#define FP_DECL_D(X) _FP_DECL(1,X)
+#define FP_UNPACK_RAW_D(X,val) _FP_UNPACK_RAW_1(D,X,val)
+#define FP_UNPACK_RAW_DP(X,val) _FP_UNPACK_RAW_1_P(D,X,val)
+#define FP_PACK_RAW_D(val,X) _FP_PACK_RAW_1(D,val,X)
+#define FP_PACK_RAW_DP(val,X) \
+ do { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P(D,val,X); \
+ } while (0)
+
+#define FP_UNPACK_D(X,val) \
+ do { \
+ _FP_UNPACK_RAW_1(D,X,val); \
+ _FP_UNPACK_CANONICAL(D,1,X); \
+ } while (0)
+
+#define FP_UNPACK_DP(X,val) \
+ do { \
+ _FP_UNPACK_RAW_1_P(D,X,val); \
+ _FP_UNPACK_CANONICAL(D,1,X); \
+ } while (0)
+
+#define FP_PACK_D(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(D,1,X); \
+ _FP_PACK_RAW_1(D,val,X); \
+ } while (0)
+
+#define FP_PACK_DP(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(D,1,X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P(D,val,X); \
+ } while (0)
+
+#define FP_ISSIGNAN_D(X) _FP_ISSIGNAN(D,1,X)
+#define FP_NEG_D(R,X) _FP_NEG(D,1,R,X)
+#define FP_ADD_D(R,X,Y) _FP_ADD(D,1,R,X,Y)
+#define FP_SUB_D(R,X,Y) _FP_SUB(D,1,R,X,Y)
+#define FP_MUL_D(R,X,Y) _FP_MUL(D,1,R,X,Y)
+#define FP_DIV_D(R,X,Y) _FP_DIV(D,1,R,X,Y)
+#define FP_SQRT_D(R,X) _FP_SQRT(D,1,R,X)
+#define _FP_SQRT_MEAT_D(R,S,T,X,Q) _FP_SQRT_MEAT_1(R,S,T,X,Q)
+
+/* The implementation of _FP_MUL_D and _FP_DIV_D should be chosen by
+ the target machine. */
+
+#define FP_CMP_D(r,X,Y,un) _FP_CMP(D,1,r,X,Y,un)
+#define FP_CMP_EQ_D(r,X,Y) _FP_CMP_EQ(D,1,r,X,Y)
+
+#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,1,r,X,rsz,rsg)
+#define FP_FROM_INT_D(X,r,rs,rt) _FP_FROM_INT(D,1,X,r,rs,rt)
+
+#define _FP_FRAC_HIGH_D(X) _FP_FRAC_HIGH_1(X)
+#define _FP_FRAC_HIGH_RAW_D(X) _FP_FRAC_HIGH_1(X)
+
+#endif /* W_TYPE_SIZE < 64 */
diff --git a/include/math-emu/extended.h b/include/math-emu/extended.h
new file mode 100644
index 000000000..4a1d7e711
--- /dev/null
+++ b/include/math-emu/extended.h
@@ -0,0 +1,388 @@
+/* Software floating-point emulation.
+ Definitions for IEEE Extended Precision.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek (jj@ultra.linux.cz).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if _FP_W_TYPE_SIZE < 32
+#error "Here's a nickel, kid. Go buy yourself a real computer."
+#endif
+
+#if _FP_W_TYPE_SIZE < 64
+#define _FP_FRACTBITS_E (4*_FP_W_TYPE_SIZE)
+#else
+#define _FP_FRACTBITS_E (2*_FP_W_TYPE_SIZE)
+#endif
+
+#define _FP_FRACBITS_E 64
+#define _FP_FRACXBITS_E (_FP_FRACTBITS_E - _FP_FRACBITS_E)
+#define _FP_WFRACBITS_E (_FP_WORKBITS + _FP_FRACBITS_E)
+#define _FP_WFRACXBITS_E (_FP_FRACTBITS_E - _FP_WFRACBITS_E)
+#define _FP_EXPBITS_E 15
+#define _FP_EXPBIAS_E 16383
+#define _FP_EXPMAX_E 32767
+
+#define _FP_QNANBIT_E \
+ ((_FP_W_TYPE)1 << (_FP_FRACBITS_E-2) % _FP_W_TYPE_SIZE)
+#define _FP_IMPLBIT_E \
+ ((_FP_W_TYPE)1 << (_FP_FRACBITS_E-1) % _FP_W_TYPE_SIZE)
+#define _FP_OVERFLOW_E \
+ ((_FP_W_TYPE)1 << (_FP_WFRACBITS_E % _FP_W_TYPE_SIZE))
+
+#if _FP_W_TYPE_SIZE < 64
+
+union _FP_UNION_E
+{
+ long double flt;
+ struct
+ {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned long pad1 : _FP_W_TYPE_SIZE;
+ unsigned long pad2 : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
+ unsigned long sign : 1;
+ unsigned long exp : _FP_EXPBITS_E;
+ unsigned long frac1 : _FP_W_TYPE_SIZE;
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+#else
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+ unsigned long frac1 : _FP_W_TYPE_SIZE;
+ unsigned exp : _FP_EXPBITS_E;
+ unsigned sign : 1;
+#endif /* not bigendian */
+ } bits __attribute__((packed));
+};
+
+
+#define FP_DECL_E(X) _FP_DECL(4,X)
+
+#define FP_UNPACK_RAW_E(X, val) \
+ do { \
+ union _FP_UNION_E _flo; _flo.flt = (val); \
+ \
+ X##_f[2] = 0; X##_f[3] = 0; \
+ X##_f[0] = _flo.bits.frac0; \
+ X##_f[1] = _flo.bits.frac1; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ if (!X##_e && (X##_f[1] || X##_f[0]) \
+ && !(X##_f[1] & _FP_IMPLBIT_E)) \
+ { \
+ X##_e++; \
+ FP_SET_EXCEPTION(FP_EX_DENORM); \
+ } \
+ } while (0)
+
+#define FP_UNPACK_RAW_EP(X, val) \
+ do { \
+ union _FP_UNION_E *_flo = \
+ (union _FP_UNION_E *)(val); \
+ \
+ X##_f[2] = 0; X##_f[3] = 0; \
+ X##_f[0] = _flo->bits.frac0; \
+ X##_f[1] = _flo->bits.frac1; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ if (!X##_e && (X##_f[1] || X##_f[0]) \
+ && !(X##_f[1] & _FP_IMPLBIT_E)) \
+ { \
+ X##_e++; \
+ FP_SET_EXCEPTION(FP_EX_DENORM); \
+ } \
+ } while (0)
+
+#define FP_PACK_RAW_E(val, X) \
+ do { \
+ union _FP_UNION_E _flo; \
+ \
+ if (X##_e) X##_f[1] |= _FP_IMPLBIT_E; \
+ else X##_f[1] &= ~(_FP_IMPLBIT_E); \
+ _flo.bits.frac0 = X##_f[0]; \
+ _flo.bits.frac1 = X##_f[1]; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ \
+ (val) = _flo.flt; \
+ } while (0)
+
+#define FP_PACK_RAW_EP(val, X) \
+ do { \
+ if (!FP_INHIBIT_RESULTS) \
+ { \
+ union _FP_UNION_E *_flo = \
+ (union _FP_UNION_E *)(val); \
+ \
+ if (X##_e) X##_f[1] |= _FP_IMPLBIT_E; \
+ else X##_f[1] &= ~(_FP_IMPLBIT_E); \
+ _flo->bits.frac0 = X##_f[0]; \
+ _flo->bits.frac1 = X##_f[1]; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } \
+ } while (0)
+
+#define FP_UNPACK_E(X,val) \
+ do { \
+ FP_UNPACK_RAW_E(X,val); \
+ _FP_UNPACK_CANONICAL(E,4,X); \
+ } while (0)
+
+#define FP_UNPACK_EP(X,val) \
+ do { \
+ FP_UNPACK_RAW_2_P(X,val); \
+ _FP_UNPACK_CANONICAL(E,4,X); \
+ } while (0)
+
+#define FP_PACK_E(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(E,4,X); \
+ FP_PACK_RAW_E(val,X); \
+ } while (0)
+
+#define FP_PACK_EP(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(E,4,X); \
+ FP_PACK_RAW_EP(val,X); \
+ } while (0)
+
+#define FP_ISSIGNAN_E(X) _FP_ISSIGNAN(E,4,X)
+#define FP_NEG_E(R,X) _FP_NEG(E,4,R,X)
+#define FP_ADD_E(R,X,Y) _FP_ADD(E,4,R,X,Y)
+#define FP_SUB_E(R,X,Y) _FP_SUB(E,4,R,X,Y)
+#define FP_MUL_E(R,X,Y) _FP_MUL(E,4,R,X,Y)
+#define FP_DIV_E(R,X,Y) _FP_DIV(E,4,R,X,Y)
+#define FP_SQRT_E(R,X) _FP_SQRT(E,4,R,X)
+
+/*
+ * Square root algorithms:
+ * We have just one right now, maybe Newton approximation
+ * should be added for those machines where division is fast.
+ * This has special _E version because standard _4 square
+ * root would not work (it has to start normally with the
+ * second word and not the first), but as we have to do it
+ * anyway, we optimize it by doing most of the calculations
+ * in two UWtype registers instead of four.
+ */
+
+#define _FP_SQRT_MEAT_E(R, S, T, X, q) \
+ do { \
+ q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
+ _FP_FRAC_SRL_4(X, (_FP_WORKBITS)); \
+ while (q) \
+ { \
+ T##_f[1] = S##_f[1] + q; \
+ if (T##_f[1] <= X##_f[1]) \
+ { \
+ S##_f[1] = T##_f[1] + q; \
+ X##_f[1] -= T##_f[1]; \
+ R##_f[1] += q; \
+ } \
+ _FP_FRAC_SLL_2(X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q) \
+ { \
+ T##_f[0] = S##_f[0] + q; \
+ T##_f[1] = S##_f[1]; \
+ if (T##_f[1] < X##_f[1] || \
+ (T##_f[1] == X##_f[1] && \
+ T##_f[0] <= X##_f[0])) \
+ { \
+ S##_f[0] = T##_f[0] + q; \
+ S##_f[1] += (T##_f[0] > S##_f[0]); \
+ _FP_FRAC_DEC_2(X, T); \
+ R##_f[0] += q; \
+ } \
+ _FP_FRAC_SLL_2(X, 1); \
+ q >>= 1; \
+ } \
+ _FP_FRAC_SLL_4(R, (_FP_WORKBITS)); \
+ if (X##_f[0] | X##_f[1]) \
+ { \
+ if (S##_f[1] < X##_f[1] || \
+ (S##_f[1] == X##_f[1] && \
+ S##_f[0] < X##_f[0])) \
+ R##_f[0] |= _FP_WORK_ROUND; \
+ R##_f[0] |= _FP_WORK_STICKY; \
+ } \
+ } while (0)
+
+#define FP_CMP_E(r,X,Y,un) _FP_CMP(E,4,r,X,Y,un)
+#define FP_CMP_EQ_E(r,X,Y) _FP_CMP_EQ(E,4,r,X,Y)
+
+#define FP_TO_INT_E(r,X,rsz,rsg) _FP_TO_INT(E,4,r,X,rsz,rsg)
+#define FP_FROM_INT_E(X,r,rs,rt) _FP_FROM_INT(E,4,X,r,rs,rt)
+
+#define _FP_FRAC_HIGH_E(X) (X##_f[2])
+#define _FP_FRAC_HIGH_RAW_E(X) (X##_f[1])
+
+#else /* not _FP_W_TYPE_SIZE < 64 */
+union _FP_UNION_E
+{
+ long double flt /* __attribute__((mode(TF))) */ ;
+ struct {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned long pad : (_FP_W_TYPE_SIZE - 1 - _FP_EXPBITS_E);
+ unsigned sign : 1;
+ unsigned exp : _FP_EXPBITS_E;
+ unsigned long frac : _FP_W_TYPE_SIZE;
+#else
+ unsigned long frac : _FP_W_TYPE_SIZE;
+ unsigned exp : _FP_EXPBITS_E;
+ unsigned sign : 1;
+#endif
+ } bits;
+};
+
+#define FP_DECL_E(X) _FP_DECL(2,X)
+
+#define FP_UNPACK_RAW_E(X, val) \
+ do { \
+ union _FP_UNION_E _flo; _flo.flt = (val); \
+ \
+ X##_f0 = _flo.bits.frac; \
+ X##_f1 = 0; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E)) \
+ { \
+ X##_e++; \
+ FP_SET_EXCEPTION(FP_EX_DENORM); \
+ } \
+ } while (0)
+
+#define FP_UNPACK_RAW_EP(X, val) \
+ do { \
+ union _FP_UNION_E *_flo = \
+ (union _FP_UNION_E *)(val); \
+ \
+ X##_f0 = _flo->bits.frac; \
+ X##_f1 = 0; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ if (!X##_e && X##_f0 && !(X##_f0 & _FP_IMPLBIT_E)) \
+ { \
+ X##_e++; \
+ FP_SET_EXCEPTION(FP_EX_DENORM); \
+ } \
+ } while (0)
+
+#define FP_PACK_RAW_E(val, X) \
+ do { \
+ union _FP_UNION_E _flo; \
+ \
+ if (X##_e) X##_f0 |= _FP_IMPLBIT_E; \
+ else X##_f0 &= ~(_FP_IMPLBIT_E); \
+ _flo.bits.frac = X##_f0; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ \
+ (val) = _flo.flt; \
+ } while (0)
+
+#define FP_PACK_RAW_EP(fs, val, X) \
+ do { \
+ if (!FP_INHIBIT_RESULTS) \
+ { \
+ union _FP_UNION_E *_flo = \
+ (union _FP_UNION_E *)(val); \
+ \
+ if (X##_e) X##_f0 |= _FP_IMPLBIT_E; \
+ else X##_f0 &= ~(_FP_IMPLBIT_E); \
+ _flo->bits.frac = X##_f0; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } \
+ } while (0)
+
+
+#define FP_UNPACK_E(X,val) \
+ do { \
+ FP_UNPACK_RAW_E(X,val); \
+ _FP_UNPACK_CANONICAL(E,2,X); \
+ } while (0)
+
+#define FP_UNPACK_EP(X,val) \
+ do { \
+ FP_UNPACK_RAW_EP(X,val); \
+ _FP_UNPACK_CANONICAL(E,2,X); \
+ } while (0)
+
+#define FP_PACK_E(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(E,2,X); \
+ FP_PACK_RAW_E(val,X); \
+ } while (0)
+
+#define FP_PACK_EP(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(E,2,X); \
+ FP_PACK_RAW_EP(val,X); \
+ } while (0)
+
+#define FP_ISSIGNAN_E(X) _FP_ISSIGNAN(E,2,X)
+#define FP_NEG_E(R,X) _FP_NEG(E,2,R,X)
+#define FP_ADD_E(R,X,Y) _FP_ADD(E,2,R,X,Y)
+#define FP_SUB_E(R,X,Y) _FP_SUB(E,2,R,X,Y)
+#define FP_MUL_E(R,X,Y) _FP_MUL(E,2,R,X,Y)
+#define FP_DIV_E(R,X,Y) _FP_DIV(E,2,R,X,Y)
+#define FP_SQRT_E(R,X) _FP_SQRT(E,2,R,X)
+
+/*
+ * Square root algorithms:
+ * We have just one right now, maybe Newton approximation
+ * should be added for those machines where division is fast.
+ * We optimize it by doing most of the calculations
+ * in one UWtype registers instead of two, although we don't
+ * have to.
+ */
+#define _FP_SQRT_MEAT_E(R, S, T, X, q) \
+ do { \
+ q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
+ _FP_FRAC_SRL_2(X, (_FP_WORKBITS)); \
+ while (q) \
+ { \
+ T##_f0 = S##_f0 + q; \
+ if (T##_f0 <= X##_f0) \
+ { \
+ S##_f0 = T##_f0 + q; \
+ X##_f0 -= T##_f0; \
+ R##_f0 += q; \
+ } \
+ _FP_FRAC_SLL_1(X, 1); \
+ q >>= 1; \
+ } \
+ _FP_FRAC_SLL_2(R, (_FP_WORKBITS)); \
+ if (X##_f0) \
+ { \
+ if (S##_f0 < X##_f0) \
+ R##_f0 |= _FP_WORK_ROUND; \
+ R##_f0 |= _FP_WORK_STICKY; \
+ } \
+ } while (0)
+
+#define FP_CMP_E(r,X,Y,un) _FP_CMP(E,2,r,X,Y,un)
+#define FP_CMP_EQ_E(r,X,Y) _FP_CMP_EQ(E,2,r,X,Y)
+
+#define FP_TO_INT_E(r,X,rsz,rsg) _FP_TO_INT(E,2,r,X,rsz,rsg)
+#define FP_FROM_INT_E(X,r,rs,rt) _FP_FROM_INT(E,2,X,r,rs,rt)
+
+#define _FP_FRAC_HIGH_E(X) (X##_f1)
+#define _FP_FRAC_HIGH_RAW_E(X) (X##_f0)
+
+#endif /* not _FP_W_TYPE_SIZE < 64 */
diff --git a/include/math-emu/op-1.h b/include/math-emu/op-1.h
new file mode 100644
index 000000000..48bf4ce7e
--- /dev/null
+++ b/include/math-emu/op-1.h
@@ -0,0 +1,297 @@
+/* Software floating-point emulation.
+ Basic one-word fraction declaration and manipulation.
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz),
+ David S. Miller (davem@redhat.com) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define _FP_FRAC_DECL_1(X) _FP_W_TYPE X##_f
+#define _FP_FRAC_COPY_1(D,S) (D##_f = S##_f)
+#define _FP_FRAC_SET_1(X,I) (X##_f = I)
+#define _FP_FRAC_HIGH_1(X) (X##_f)
+#define _FP_FRAC_LOW_1(X) (X##_f)
+#define _FP_FRAC_WORD_1(X,w) (X##_f)
+
+#define _FP_FRAC_ADDI_1(X,I) (X##_f += I)
+#define _FP_FRAC_SLL_1(X,N) \
+ do { \
+ if (__builtin_constant_p(N) && (N) == 1) \
+ X##_f += X##_f; \
+ else \
+ X##_f <<= (N); \
+ } while (0)
+#define _FP_FRAC_SRL_1(X,N) (X##_f >>= N)
+
+/* Right shift with sticky-lsb. */
+#define _FP_FRAC_SRS_1(X,N,sz) __FP_FRAC_SRS_1(X##_f, N, sz)
+
+#define __FP_FRAC_SRS_1(X,N,sz) \
+ (X = (X >> (N) | (__builtin_constant_p(N) && (N) == 1 \
+ ? X & 1 : (X << (_FP_W_TYPE_SIZE - (N))) != 0)))
+
+#define _FP_FRAC_ADD_1(R,X,Y) (R##_f = X##_f + Y##_f)
+#define _FP_FRAC_SUB_1(R,X,Y) (R##_f = X##_f - Y##_f)
+#define _FP_FRAC_DEC_1(X,Y) (X##_f -= Y##_f)
+#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ(z, X##_f)
+
+/* Predicates */
+#define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE)X##_f < 0)
+#define _FP_FRAC_ZEROP_1(X) (X##_f == 0)
+#define _FP_FRAC_OVERP_1(fs,X) (X##_f & _FP_OVERFLOW_##fs)
+#define _FP_FRAC_EQ_1(X, Y) (X##_f == Y##_f)
+#define _FP_FRAC_GE_1(X, Y) (X##_f >= Y##_f)
+#define _FP_FRAC_GT_1(X, Y) (X##_f > Y##_f)
+
+#define _FP_ZEROFRAC_1 0
+#define _FP_MINFRAC_1 1
+#define _FP_MAXFRAC_1 (~(_FP_WS_TYPE)0)
+
+/*
+ * Unpack the raw bits of a native fp value. Do not classify or
+ * normalize the data.
+ */
+
+#define _FP_UNPACK_RAW_1(fs, X, val) \
+ do { \
+ union _FP_UNION_##fs _flo; _flo.flt = (val); \
+ \
+ X##_f = _flo.bits.frac; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ } while (0)
+
+#define _FP_UNPACK_RAW_1_P(fs, X, val) \
+ do { \
+ union _FP_UNION_##fs *_flo = \
+ (union _FP_UNION_##fs *)(val); \
+ \
+ X##_f = _flo->bits.frac; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ } while (0)
+
+/*
+ * Repack the raw bits of a native fp value.
+ */
+
+#define _FP_PACK_RAW_1(fs, val, X) \
+ do { \
+ union _FP_UNION_##fs _flo; \
+ \
+ _flo.bits.frac = X##_f; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ \
+ (val) = _flo.flt; \
+ } while (0)
+
+#define _FP_PACK_RAW_1_P(fs, val, X) \
+ do { \
+ union _FP_UNION_##fs *_flo = \
+ (union _FP_UNION_##fs *)(val); \
+ \
+ _flo->bits.frac = X##_f; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } while (0)
+
+
+/*
+ * Multiplication algorithms:
+ */
+
+/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
+ multiplication immediately. */
+
+#define _FP_MUL_MEAT_1_imm(wfracbits, R, X, Y) \
+ do { \
+ R##_f = X##_f * Y##_f; \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_1(R, wfracbits-1, 2*wfracbits); \
+ } while (0)
+
+/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
+
+#define _FP_MUL_MEAT_1_wide(wfracbits, R, X, Y, doit) \
+ do { \
+ _FP_W_TYPE _Z_f0, _Z_f1; \
+ doit(_Z_f1, _Z_f0, X##_f, Y##_f); \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_2(_Z, wfracbits-1, 2*wfracbits); \
+ R##_f = _Z_f0; \
+ } while (0)
+
+/* Finally, a simple widening multiply algorithm. What fun! */
+
+#define _FP_MUL_MEAT_1_hard(wfracbits, R, X, Y) \
+ do { \
+ _FP_W_TYPE _xh, _xl, _yh, _yl, _z_f0, _z_f1, _a_f0, _a_f1; \
+ \
+ /* split the words in half */ \
+ _xh = X##_f >> (_FP_W_TYPE_SIZE/2); \
+ _xl = X##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
+ _yh = Y##_f >> (_FP_W_TYPE_SIZE/2); \
+ _yl = Y##_f & (((_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2)) - 1); \
+ \
+ /* multiply the pieces */ \
+ _z_f0 = _xl * _yl; \
+ _a_f0 = _xh * _yl; \
+ _a_f1 = _xl * _yh; \
+ _z_f1 = _xh * _yh; \
+ \
+ /* reassemble into two full words */ \
+ if ((_a_f0 += _a_f1) < _a_f1) \
+ _z_f1 += (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE/2); \
+ _a_f1 = _a_f0 >> (_FP_W_TYPE_SIZE/2); \
+ _a_f0 = _a_f0 << (_FP_W_TYPE_SIZE/2); \
+ _FP_FRAC_ADD_2(_z, _z, _a); \
+ \
+ /* normalize */ \
+ _FP_FRAC_SRS_2(_z, wfracbits - 1, 2*wfracbits); \
+ R##_f = _z_f0; \
+ } while (0)
+
+
+/*
+ * Division algorithms:
+ */
+
+/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
+ division immediately. Give this macro either _FP_DIV_HELP_imm for
+ C primitives or _FP_DIV_HELP_ldiv for the ISO function. Which you
+ choose will depend on what the compiler does with divrem4. */
+
+#define _FP_DIV_MEAT_1_imm(fs, R, X, Y, doit) \
+ do { \
+ _FP_W_TYPE _q, _r; \
+ X##_f <<= (X##_f < Y##_f \
+ ? R##_e--, _FP_WFRACBITS_##fs \
+ : _FP_WFRACBITS_##fs - 1); \
+ doit(_q, _r, X##_f, Y##_f); \
+ R##_f = _q | (_r != 0); \
+ } while (0)
+
+/* GCC's longlong.h defines a 2W / 1W => (1W,1W) primitive udiv_qrnnd
+ that may be useful in this situation. This first is for a primitive
+ that requires normalization, the second for one that does not. Look
+ for UDIV_NEEDS_NORMALIZATION to tell which your machine needs. */
+
+#define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y) \
+ do { \
+ _FP_W_TYPE _nh, _nl, _q, _r; \
+ \
+ /* Normalize Y -- i.e. make the most significant bit set. */ \
+ Y##_f <<= _FP_WFRACXBITS_##fs - 1; \
+ \
+ /* Shift X op correspondingly high, that is, up one full word. */ \
+ if (X##_f <= Y##_f) \
+ { \
+ _nl = 0; \
+ _nh = X##_f; \
+ } \
+ else \
+ { \
+ R##_e++; \
+ _nl = X##_f << (_FP_W_TYPE_SIZE-1); \
+ _nh = X##_f >> 1; \
+ } \
+ \
+ udiv_qrnnd(_q, _r, _nh, _nl, Y##_f); \
+ R##_f = _q | (_r != 0); \
+ } while (0)
+
+#define _FP_DIV_MEAT_1_udiv(fs, R, X, Y) \
+ do { \
+ _FP_W_TYPE _nh, _nl, _q, _r; \
+ if (X##_f < Y##_f) \
+ { \
+ R##_e--; \
+ _nl = X##_f << _FP_WFRACBITS_##fs; \
+ _nh = X##_f >> _FP_WFRACXBITS_##fs; \
+ } \
+ else \
+ { \
+ _nl = X##_f << (_FP_WFRACBITS_##fs - 1); \
+ _nh = X##_f >> (_FP_WFRACXBITS_##fs + 1); \
+ } \
+ udiv_qrnnd(_q, _r, _nh, _nl, Y##_f); \
+ R##_f = _q | (_r != 0); \
+ } while (0)
+
+
+/*
+ * Square root algorithms:
+ * We have just one right now, maybe Newton approximation
+ * should be added for those machines where division is fast.
+ */
+
+#define _FP_SQRT_MEAT_1(R, S, T, X, q) \
+ do { \
+ while (q != _FP_WORK_ROUND) \
+ { \
+ T##_f = S##_f + q; \
+ if (T##_f <= X##_f) \
+ { \
+ S##_f = T##_f + q; \
+ X##_f -= T##_f; \
+ R##_f += q; \
+ } \
+ _FP_FRAC_SLL_1(X, 1); \
+ q >>= 1; \
+ } \
+ if (X##_f) \
+ { \
+ if (S##_f < X##_f) \
+ R##_f |= _FP_WORK_ROUND; \
+ R##_f |= _FP_WORK_STICKY; \
+ } \
+ } while (0)
+
+/*
+ * Assembly/disassembly for converting to/from integral types.
+ * No shifting or overflow handled here.
+ */
+
+#define _FP_FRAC_ASSEMBLE_1(r, X, rsize) (r = X##_f)
+#define _FP_FRAC_DISASSEMBLE_1(X, r, rsize) (X##_f = r)
+
+
+/*
+ * Convert FP values between word sizes
+ */
+
+#define _FP_FRAC_CONV_1_1(dfs, sfs, D, S) \
+ do { \
+ D##_f = S##_f; \
+ if (_FP_WFRACBITS_##sfs > _FP_WFRACBITS_##dfs) \
+ { \
+ if (S##_c != FP_CLS_NAN) \
+ _FP_FRAC_SRS_1(D, (_FP_WFRACBITS_##sfs-_FP_WFRACBITS_##dfs), \
+ _FP_WFRACBITS_##sfs); \
+ else \
+ _FP_FRAC_SRL_1(D, (_FP_WFRACBITS_##sfs-_FP_WFRACBITS_##dfs)); \
+ } \
+ else \
+ D##_f <<= _FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs; \
+ } while (0)
diff --git a/include/math-emu/op-2.h b/include/math-emu/op-2.h
new file mode 100644
index 000000000..ad3fbc538
--- /dev/null
+++ b/include/math-emu/op-2.h
@@ -0,0 +1,608 @@
+/* Software floating-point emulation.
+ Basic two-word fraction declaration and manipulation.
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz),
+ David S. Miller (davem@redhat.com) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1
+#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
+#define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I)
+#define _FP_FRAC_HIGH_2(X) (X##_f1)
+#define _FP_FRAC_LOW_2(X) (X##_f0)
+#define _FP_FRAC_WORD_2(X,w) (X##_f##w)
+
+#define _FP_FRAC_SLL_2(X,N) \
+ do { \
+ if ((N) < _FP_W_TYPE_SIZE) \
+ { \
+ if (__builtin_constant_p(N) && (N) == 1) \
+ { \
+ X##_f1 = X##_f1 + X##_f1 + (((_FP_WS_TYPE)(X##_f0)) < 0); \
+ X##_f0 += X##_f0; \
+ } \
+ else \
+ { \
+ X##_f1 = X##_f1 << (N) | X##_f0 >> (_FP_W_TYPE_SIZE - (N)); \
+ X##_f0 <<= (N); \
+ } \
+ } \
+ else \
+ { \
+ X##_f1 = X##_f0 << ((N) - _FP_W_TYPE_SIZE); \
+ X##_f0 = 0; \
+ } \
+ } while (0)
+
+#define _FP_FRAC_SRL_2(X,N) \
+ do { \
+ if ((N) < _FP_W_TYPE_SIZE) \
+ { \
+ X##_f0 = X##_f0 >> (N) | X##_f1 << (_FP_W_TYPE_SIZE - (N)); \
+ X##_f1 >>= (N); \
+ } \
+ else \
+ { \
+ X##_f0 = X##_f1 >> ((N) - _FP_W_TYPE_SIZE); \
+ X##_f1 = 0; \
+ } \
+ } while (0)
+
+/* Right shift with sticky-lsb. */
+#define _FP_FRAC_SRS_2(X,N,sz) \
+ do { \
+ if ((N) < _FP_W_TYPE_SIZE) \
+ { \
+ X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) | \
+ (__builtin_constant_p(N) && (N) == 1 \
+ ? X##_f0 & 1 \
+ : (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
+ X##_f1 >>= (N); \
+ } \
+ else \
+ { \
+ X##_f0 = (X##_f1 >> ((N) - _FP_W_TYPE_SIZE) | \
+ (((X##_f1 << (sz - (N))) | X##_f0) != 0)); \
+ X##_f1 = 0; \
+ } \
+ } while (0)
+
+#define _FP_FRAC_ADDI_2(X,I) \
+ __FP_FRAC_ADDI_2(X##_f1, X##_f0, I)
+
+#define _FP_FRAC_ADD_2(R,X,Y) \
+ __FP_FRAC_ADD_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
+
+#define _FP_FRAC_SUB_2(R,X,Y) \
+ __FP_FRAC_SUB_2(R##_f1, R##_f0, X##_f1, X##_f0, Y##_f1, Y##_f0)
+
+#define _FP_FRAC_DEC_2(X,Y) \
+ __FP_FRAC_DEC_2(X##_f1, X##_f0, Y##_f1, Y##_f0)
+
+#define _FP_FRAC_CLZ_2(R,X) \
+ do { \
+ if (X##_f1) \
+ __FP_CLZ(R,X##_f1); \
+ else \
+ { \
+ __FP_CLZ(R,X##_f0); \
+ R += _FP_W_TYPE_SIZE; \
+ } \
+ } while(0)
+
+/* Predicates */
+#define _FP_FRAC_NEGP_2(X) ((_FP_WS_TYPE)X##_f1 < 0)
+#define _FP_FRAC_ZEROP_2(X) ((X##_f1 | X##_f0) == 0)
+#define _FP_FRAC_OVERP_2(fs,X) (_FP_FRAC_HIGH_##fs(X) & _FP_OVERFLOW_##fs)
+#define _FP_FRAC_EQ_2(X, Y) (X##_f1 == Y##_f1 && X##_f0 == Y##_f0)
+#define _FP_FRAC_GT_2(X, Y) \
+ (X##_f1 > Y##_f1 || X##_f1 == Y##_f1 && X##_f0 > Y##_f0)
+#define _FP_FRAC_GE_2(X, Y) \
+ (X##_f1 > Y##_f1 || X##_f1 == Y##_f1 && X##_f0 >= Y##_f0)
+
+#define _FP_ZEROFRAC_2 0, 0
+#define _FP_MINFRAC_2 0, 1
+#define _FP_MAXFRAC_2 (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0)
+
+/*
+ * Internals
+ */
+
+#define __FP_FRAC_SET_2(X,I1,I0) (X##_f0 = I0, X##_f1 = I1)
+
+#define __FP_CLZ_2(R, xh, xl) \
+ do { \
+ if (xh) \
+ __FP_CLZ(R,xh); \
+ else \
+ { \
+ __FP_CLZ(R,xl); \
+ R += _FP_W_TYPE_SIZE; \
+ } \
+ } while(0)
+
+#if 0
+
+#ifndef __FP_FRAC_ADDI_2
+#define __FP_FRAC_ADDI_2(xh, xl, i) \
+ (xh += ((xl += i) < i))
+#endif
+#ifndef __FP_FRAC_ADD_2
+#define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \
+ (rh = xh + yh + ((rl = xl + yl) < xl))
+#endif
+#ifndef __FP_FRAC_SUB_2
+#define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \
+ (rh = xh - yh - ((rl = xl - yl) > xl))
+#endif
+#ifndef __FP_FRAC_DEC_2
+#define __FP_FRAC_DEC_2(xh, xl, yh, yl) \
+ do { \
+ UWtype _t = xl; \
+ xh -= yh + ((xl -= yl) > _t); \
+ } while (0)
+#endif
+
+#else
+
+#undef __FP_FRAC_ADDI_2
+#define __FP_FRAC_ADDI_2(xh, xl, i) add_ssaaaa(xh, xl, xh, xl, 0, i)
+#undef __FP_FRAC_ADD_2
+#define __FP_FRAC_ADD_2 add_ssaaaa
+#undef __FP_FRAC_SUB_2
+#define __FP_FRAC_SUB_2 sub_ddmmss
+#undef __FP_FRAC_DEC_2
+#define __FP_FRAC_DEC_2(xh, xl, yh, yl) sub_ddmmss(xh, xl, xh, xl, yh, yl)
+
+#endif
+
+/*
+ * Unpack the raw bits of a native fp value. Do not classify or
+ * normalize the data.
+ */
+
+#define _FP_UNPACK_RAW_2(fs, X, val) \
+ do { \
+ union _FP_UNION_##fs _flo; _flo.flt = (val); \
+ \
+ X##_f0 = _flo.bits.frac0; \
+ X##_f1 = _flo.bits.frac1; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ } while (0)
+
+#define _FP_UNPACK_RAW_2_P(fs, X, val) \
+ do { \
+ union _FP_UNION_##fs *_flo = \
+ (union _FP_UNION_##fs *)(val); \
+ \
+ X##_f0 = _flo->bits.frac0; \
+ X##_f1 = _flo->bits.frac1; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ } while (0)
+
+
+/*
+ * Repack the raw bits of a native fp value.
+ */
+
+#define _FP_PACK_RAW_2(fs, val, X) \
+ do { \
+ union _FP_UNION_##fs _flo; \
+ \
+ _flo.bits.frac0 = X##_f0; \
+ _flo.bits.frac1 = X##_f1; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ \
+ (val) = _flo.flt; \
+ } while (0)
+
+#define _FP_PACK_RAW_2_P(fs, val, X) \
+ do { \
+ union _FP_UNION_##fs *_flo = \
+ (union _FP_UNION_##fs *)(val); \
+ \
+ _flo->bits.frac0 = X##_f0; \
+ _flo->bits.frac1 = X##_f1; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } while (0)
+
+
+/*
+ * Multiplication algorithms:
+ */
+
+/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
+
+#define _FP_MUL_MEAT_2_wide(wfracbits, R, X, Y, doit) \
+ do { \
+ _FP_FRAC_DECL_4(_z); _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \
+ \
+ doit(_FP_FRAC_WORD_4(_z,1), _FP_FRAC_WORD_4(_z,0), X##_f0, Y##_f0); \
+ doit(_b_f1, _b_f0, X##_f0, Y##_f1); \
+ doit(_c_f1, _c_f0, X##_f1, Y##_f0); \
+ doit(_FP_FRAC_WORD_4(_z,3), _FP_FRAC_WORD_4(_z,2), X##_f1, Y##_f1); \
+ \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _FP_FRAC_WORD_4(_z,1), 0, _b_f1, _b_f0, \
+ _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _FP_FRAC_WORD_4(_z,1)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _FP_FRAC_WORD_4(_z,1), 0, _c_f1, _c_f0, \
+ _FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _FP_FRAC_WORD_4(_z,1)); \
+ \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_4(_z, wfracbits-1, 2*wfracbits); \
+ R##_f0 = _FP_FRAC_WORD_4(_z,0); \
+ R##_f1 = _FP_FRAC_WORD_4(_z,1); \
+ } while (0)
+
+/* Given a 1W * 1W => 2W primitive, do the extended multiplication.
+ Do only 3 multiplications instead of four. This one is for machines
+ where multiplication is much more expensive than subtraction. */
+
+#define _FP_MUL_MEAT_2_wide_3mul(wfracbits, R, X, Y, doit) \
+ do { \
+ _FP_FRAC_DECL_4(_z); _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \
+ _FP_W_TYPE _d; \
+ int _c1, _c2; \
+ \
+ _b_f0 = X##_f0 + X##_f1; \
+ _c1 = _b_f0 < X##_f0; \
+ _b_f1 = Y##_f0 + Y##_f1; \
+ _c2 = _b_f1 < Y##_f0; \
+ doit(_d, _FP_FRAC_WORD_4(_z,0), X##_f0, Y##_f0); \
+ doit(_FP_FRAC_WORD_4(_z,2), _FP_FRAC_WORD_4(_z,1), _b_f0, _b_f1); \
+ doit(_c_f1, _c_f0, X##_f1, Y##_f1); \
+ \
+ _b_f0 &= -_c2; \
+ _b_f1 &= -_c1; \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _FP_FRAC_WORD_4(_z,1), (_c1 & _c2), 0, _d, \
+ 0, _FP_FRAC_WORD_4(_z,2), _FP_FRAC_WORD_4(_z,1)); \
+ __FP_FRAC_ADDI_2(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _b_f0); \
+ __FP_FRAC_ADDI_2(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _b_f1); \
+ __FP_FRAC_DEC_3(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _FP_FRAC_WORD_4(_z,1), \
+ 0, _d, _FP_FRAC_WORD_4(_z,0)); \
+ __FP_FRAC_DEC_3(_FP_FRAC_WORD_4(_z,3),_FP_FRAC_WORD_4(_z,2), \
+ _FP_FRAC_WORD_4(_z,1), 0, _c_f1, _c_f0); \
+ __FP_FRAC_ADD_2(_FP_FRAC_WORD_4(_z,3), _FP_FRAC_WORD_4(_z,2), \
+ _c_f1, _c_f0, \
+ _FP_FRAC_WORD_4(_z,3), _FP_FRAC_WORD_4(_z,2)); \
+ \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_4(_z, wfracbits-1, 2*wfracbits); \
+ R##_f0 = _FP_FRAC_WORD_4(_z,0); \
+ R##_f1 = _FP_FRAC_WORD_4(_z,1); \
+ } while (0)
+
+#define _FP_MUL_MEAT_2_gmp(wfracbits, R, X, Y) \
+ do { \
+ _FP_FRAC_DECL_4(_z); \
+ _FP_W_TYPE _x[2], _y[2]; \
+ _x[0] = X##_f0; _x[1] = X##_f1; \
+ _y[0] = Y##_f0; _y[1] = Y##_f1; \
+ \
+ mpn_mul_n(_z_f, _x, _y, 2); \
+ \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_4(_z, wfracbits-1, 2*wfracbits); \
+ R##_f0 = _z_f[0]; \
+ R##_f1 = _z_f[1]; \
+ } while (0)
+
+/* Do at most 120x120=240 bits multiplication using double floating
+ point multiplication. This is useful if floating point
+ multiplication has much bigger throughput than integer multiply.
+ It is supposed to work for _FP_W_TYPE_SIZE 64 and wfracbits
+ between 106 and 120 only.
+ Caller guarantees that X and Y has (1LLL << (wfracbits - 1)) set.
+ SETFETZ is a macro which will disable all FPU exceptions and set rounding
+ towards zero, RESETFE should optionally reset it back. */
+
+#define _FP_MUL_MEAT_2_120_240_double(wfracbits, R, X, Y, setfetz, resetfe) \
+ do { \
+ static const double _const[] = { \
+ /* 2^-24 */ 5.9604644775390625e-08, \
+ /* 2^-48 */ 3.5527136788005009e-15, \
+ /* 2^-72 */ 2.1175823681357508e-22, \
+ /* 2^-96 */ 1.2621774483536189e-29, \
+ /* 2^28 */ 2.68435456e+08, \
+ /* 2^4 */ 1.600000e+01, \
+ /* 2^-20 */ 9.5367431640625e-07, \
+ /* 2^-44 */ 5.6843418860808015e-14, \
+ /* 2^-68 */ 3.3881317890172014e-21, \
+ /* 2^-92 */ 2.0194839173657902e-28, \
+ /* 2^-116 */ 1.2037062152420224e-35}; \
+ double _a240, _b240, _c240, _d240, _e240, _f240, \
+ _g240, _h240, _i240, _j240, _k240; \
+ union { double d; UDItype i; } _l240, _m240, _n240, _o240, \
+ _p240, _q240, _r240, _s240; \
+ UDItype _t240, _u240, _v240, _w240, _x240, _y240 = 0; \
+ \
+ if (wfracbits < 106 || wfracbits > 120) \
+ abort(); \
+ \
+ setfetz; \
+ \
+ _e240 = (double)(long)(X##_f0 & 0xffffff); \
+ _j240 = (double)(long)(Y##_f0 & 0xffffff); \
+ _d240 = (double)(long)((X##_f0 >> 24) & 0xffffff); \
+ _i240 = (double)(long)((Y##_f0 >> 24) & 0xffffff); \
+ _c240 = (double)(long)(((X##_f1 << 16) & 0xffffff) | (X##_f0 >> 48)); \
+ _h240 = (double)(long)(((Y##_f1 << 16) & 0xffffff) | (Y##_f0 >> 48)); \
+ _b240 = (double)(long)((X##_f1 >> 8) & 0xffffff); \
+ _g240 = (double)(long)((Y##_f1 >> 8) & 0xffffff); \
+ _a240 = (double)(long)(X##_f1 >> 32); \
+ _f240 = (double)(long)(Y##_f1 >> 32); \
+ _e240 *= _const[3]; \
+ _j240 *= _const[3]; \
+ _d240 *= _const[2]; \
+ _i240 *= _const[2]; \
+ _c240 *= _const[1]; \
+ _h240 *= _const[1]; \
+ _b240 *= _const[0]; \
+ _g240 *= _const[0]; \
+ _s240.d = _e240*_j240;\
+ _r240.d = _d240*_j240 + _e240*_i240;\
+ _q240.d = _c240*_j240 + _d240*_i240 + _e240*_h240;\
+ _p240.d = _b240*_j240 + _c240*_i240 + _d240*_h240 + _e240*_g240;\
+ _o240.d = _a240*_j240 + _b240*_i240 + _c240*_h240 + _d240*_g240 + _e240*_f240;\
+ _n240.d = _a240*_i240 + _b240*_h240 + _c240*_g240 + _d240*_f240; \
+ _m240.d = _a240*_h240 + _b240*_g240 + _c240*_f240; \
+ _l240.d = _a240*_g240 + _b240*_f240; \
+ _k240 = _a240*_f240; \
+ _r240.d += _s240.d; \
+ _q240.d += _r240.d; \
+ _p240.d += _q240.d; \
+ _o240.d += _p240.d; \
+ _n240.d += _o240.d; \
+ _m240.d += _n240.d; \
+ _l240.d += _m240.d; \
+ _k240 += _l240.d; \
+ _s240.d -= ((_const[10]+_s240.d)-_const[10]); \
+ _r240.d -= ((_const[9]+_r240.d)-_const[9]); \
+ _q240.d -= ((_const[8]+_q240.d)-_const[8]); \
+ _p240.d -= ((_const[7]+_p240.d)-_const[7]); \
+ _o240.d += _const[7]; \
+ _n240.d += _const[6]; \
+ _m240.d += _const[5]; \
+ _l240.d += _const[4]; \
+ if (_s240.d != 0.0) _y240 = 1; \
+ if (_r240.d != 0.0) _y240 = 1; \
+ if (_q240.d != 0.0) _y240 = 1; \
+ if (_p240.d != 0.0) _y240 = 1; \
+ _t240 = (DItype)_k240; \
+ _u240 = _l240.i; \
+ _v240 = _m240.i; \
+ _w240 = _n240.i; \
+ _x240 = _o240.i; \
+ R##_f1 = (_t240 << (128 - (wfracbits - 1))) \
+ | ((_u240 & 0xffffff) >> ((wfracbits - 1) - 104)); \
+ R##_f0 = ((_u240 & 0xffffff) << (168 - (wfracbits - 1))) \
+ | ((_v240 & 0xffffff) << (144 - (wfracbits - 1))) \
+ | ((_w240 & 0xffffff) << (120 - (wfracbits - 1))) \
+ | ((_x240 & 0xffffff) >> ((wfracbits - 1) - 96)) \
+ | _y240; \
+ resetfe; \
+ } while (0)
+
+/*
+ * Division algorithms:
+ */
+
+#define _FP_DIV_MEAT_2_udiv(fs, R, X, Y) \
+ do { \
+ _FP_W_TYPE _n_f2, _n_f1, _n_f0, _r_f1, _r_f0, _m_f1, _m_f0; \
+ if (_FP_FRAC_GT_2(X, Y)) \
+ { \
+ _n_f2 = X##_f1 >> 1; \
+ _n_f1 = X##_f1 << (_FP_W_TYPE_SIZE - 1) | X##_f0 >> 1; \
+ _n_f0 = X##_f0 << (_FP_W_TYPE_SIZE - 1); \
+ } \
+ else \
+ { \
+ R##_e--; \
+ _n_f2 = X##_f1; \
+ _n_f1 = X##_f0; \
+ _n_f0 = 0; \
+ } \
+ \
+ /* Normalize, i.e. make the most significant bit of the \
+ denominator set. */ \
+ _FP_FRAC_SLL_2(Y, _FP_WFRACXBITS_##fs); \
+ \
+ udiv_qrnnd(R##_f1, _r_f1, _n_f2, _n_f1, Y##_f1); \
+ umul_ppmm(_m_f1, _m_f0, R##_f1, Y##_f0); \
+ _r_f0 = _n_f0; \
+ if (_FP_FRAC_GT_2(_m, _r)) \
+ { \
+ R##_f1--; \
+ _FP_FRAC_ADD_2(_r, Y, _r); \
+ if (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r)) \
+ { \
+ R##_f1--; \
+ _FP_FRAC_ADD_2(_r, Y, _r); \
+ } \
+ } \
+ _FP_FRAC_DEC_2(_r, _m); \
+ \
+ if (_r_f1 == Y##_f1) \
+ { \
+ /* This is a special case, not an optimization \
+ (_r/Y##_f1 would not fit into UWtype). \
+ As _r is guaranteed to be < Y, R##_f0 can be either \
+ (UWtype)-1 or (UWtype)-2. But as we know what kind \
+ of bits it is (sticky, guard, round), we don't care. \
+ We also don't care what the reminder is, because the \
+ guard bit will be set anyway. -jj */ \
+ R##_f0 = -1; \
+ } \
+ else \
+ { \
+ udiv_qrnnd(R##_f0, _r_f1, _r_f1, _r_f0, Y##_f1); \
+ umul_ppmm(_m_f1, _m_f0, R##_f0, Y##_f0); \
+ _r_f0 = 0; \
+ if (_FP_FRAC_GT_2(_m, _r)) \
+ { \
+ R##_f0--; \
+ _FP_FRAC_ADD_2(_r, Y, _r); \
+ if (_FP_FRAC_GE_2(_r, Y) && _FP_FRAC_GT_2(_m, _r)) \
+ { \
+ R##_f0--; \
+ _FP_FRAC_ADD_2(_r, Y, _r); \
+ } \
+ } \
+ if (!_FP_FRAC_EQ_2(_r, _m)) \
+ R##_f0 |= _FP_WORK_STICKY; \
+ } \
+ } while (0)
+
+
+#define _FP_DIV_MEAT_2_gmp(fs, R, X, Y) \
+ do { \
+ _FP_W_TYPE _x[4], _y[2], _z[4]; \
+ _y[0] = Y##_f0; _y[1] = Y##_f1; \
+ _x[0] = _x[3] = 0; \
+ if (_FP_FRAC_GT_2(X, Y)) \
+ { \
+ R##_e++; \
+ _x[1] = (X##_f0 << (_FP_WFRACBITS_##fs-1 - _FP_W_TYPE_SIZE) | \
+ X##_f1 >> (_FP_W_TYPE_SIZE - \
+ (_FP_WFRACBITS_##fs-1 - _FP_W_TYPE_SIZE))); \
+ _x[2] = X##_f1 << (_FP_WFRACBITS_##fs-1 - _FP_W_TYPE_SIZE); \
+ } \
+ else \
+ { \
+ _x[1] = (X##_f0 << (_FP_WFRACBITS_##fs - _FP_W_TYPE_SIZE) | \
+ X##_f1 >> (_FP_W_TYPE_SIZE - \
+ (_FP_WFRACBITS_##fs - _FP_W_TYPE_SIZE))); \
+ _x[2] = X##_f1 << (_FP_WFRACBITS_##fs - _FP_W_TYPE_SIZE); \
+ } \
+ \
+ (void) mpn_divrem (_z, 0, _x, 4, _y, 2); \
+ R##_f1 = _z[1]; \
+ R##_f0 = _z[0] | ((_x[0] | _x[1]) != 0); \
+ } while (0)
+
+
+/*
+ * Square root algorithms:
+ * We have just one right now, maybe Newton approximation
+ * should be added for those machines where division is fast.
+ */
+
+#define _FP_SQRT_MEAT_2(R, S, T, X, q) \
+ do { \
+ while (q) \
+ { \
+ T##_f1 = S##_f1 + q; \
+ if (T##_f1 <= X##_f1) \
+ { \
+ S##_f1 = T##_f1 + q; \
+ X##_f1 -= T##_f1; \
+ R##_f1 += q; \
+ } \
+ _FP_FRAC_SLL_2(X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q != _FP_WORK_ROUND) \
+ { \
+ T##_f0 = S##_f0 + q; \
+ T##_f1 = S##_f1; \
+ if (T##_f1 < X##_f1 || \
+ (T##_f1 == X##_f1 && T##_f0 <= X##_f0)) \
+ { \
+ S##_f0 = T##_f0 + q; \
+ S##_f1 += (T##_f0 > S##_f0); \
+ _FP_FRAC_DEC_2(X, T); \
+ R##_f0 += q; \
+ } \
+ _FP_FRAC_SLL_2(X, 1); \
+ q >>= 1; \
+ } \
+ if (X##_f0 | X##_f1) \
+ { \
+ if (S##_f1 < X##_f1 || \
+ (S##_f1 == X##_f1 && S##_f0 < X##_f0)) \
+ R##_f0 |= _FP_WORK_ROUND; \
+ R##_f0 |= _FP_WORK_STICKY; \
+ } \
+ } while (0)
+
+
+/*
+ * Assembly/disassembly for converting to/from integral types.
+ * No shifting or overflow handled here.
+ */
+
+#define _FP_FRAC_ASSEMBLE_2(r, X, rsize) \
+ do { \
+ if (rsize <= _FP_W_TYPE_SIZE) \
+ r = X##_f0; \
+ else \
+ { \
+ r = X##_f1; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f0; \
+ } \
+ } while (0)
+
+#define _FP_FRAC_DISASSEMBLE_2(X, r, rsize) \
+ do { \
+ X##_f0 = r; \
+ X##_f1 = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
+ } while (0)
+
+/*
+ * Convert FP values between word sizes
+ */
+
+#define _FP_FRAC_CONV_1_2(dfs, sfs, D, S) \
+ do { \
+ if (S##_c != FP_CLS_NAN) \
+ _FP_FRAC_SRS_2(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
+ _FP_WFRACBITS_##sfs); \
+ else \
+ _FP_FRAC_SRL_2(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs)); \
+ D##_f = S##_f0; \
+ } while (0)
+
+#define _FP_FRAC_CONV_2_1(dfs, sfs, D, S) \
+ do { \
+ D##_f0 = S##_f; \
+ D##_f1 = 0; \
+ _FP_FRAC_SLL_2(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
+ } while (0)
+
diff --git a/include/math-emu/op-4.h b/include/math-emu/op-4.h
new file mode 100644
index 000000000..f5235f5d9
--- /dev/null
+++ b/include/math-emu/op-4.h
@@ -0,0 +1,661 @@
+/* Software floating-point emulation.
+ Basic four-word fraction declaration and manipulation.
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz),
+ David S. Miller (davem@redhat.com) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define _FP_FRAC_DECL_4(X) _FP_W_TYPE X##_f[4]
+#define _FP_FRAC_COPY_4(D,S) \
+ (D##_f[0] = S##_f[0], D##_f[1] = S##_f[1], \
+ D##_f[2] = S##_f[2], D##_f[3] = S##_f[3])
+#define _FP_FRAC_SET_4(X,I) __FP_FRAC_SET_4(X, I)
+#define _FP_FRAC_HIGH_4(X) (X##_f[3])
+#define _FP_FRAC_LOW_4(X) (X##_f[0])
+#define _FP_FRAC_WORD_4(X,w) (X##_f[w])
+
+#define _FP_FRAC_SLL_4(X,N) \
+ do { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _up = (N) % _FP_W_TYPE_SIZE; \
+ _down = _FP_W_TYPE_SIZE - _up; \
+ if (!_up) \
+ for (_i = 3; _i >= _skip; --_i) \
+ X##_f[_i] = X##_f[_i-_skip]; \
+ else \
+ { \
+ for (_i = 3; _i > _skip; --_i) \
+ X##_f[_i] = X##_f[_i-_skip] << _up \
+ | X##_f[_i-_skip-1] >> _down; \
+ X##_f[_i--] = X##_f[0] << _up; \
+ } \
+ for (; _i >= 0; --_i) \
+ X##_f[_i] = 0; \
+ } while (0)
+
+/* This one was broken too */
+#define _FP_FRAC_SRL_4(X,N) \
+ do { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _down = (N) % _FP_W_TYPE_SIZE; \
+ _up = _FP_W_TYPE_SIZE - _down; \
+ if (!_down) \
+ for (_i = 0; _i <= 3-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip]; \
+ else \
+ { \
+ for (_i = 0; _i < 3-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip] >> _down \
+ | X##_f[_i+_skip+1] << _up; \
+ X##_f[_i++] = X##_f[3] >> _down; \
+ } \
+ for (; _i < 4; ++_i) \
+ X##_f[_i] = 0; \
+ } while (0)
+
+
+/* Right shift with sticky-lsb.
+ * What this actually means is that we do a standard right-shift,
+ * but that if any of the bits that fall off the right hand side
+ * were one then we always set the LSbit.
+ */
+#define _FP_FRAC_SRS_4(X,N,size) \
+ do { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _FP_W_TYPE _s; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _down = (N) % _FP_W_TYPE_SIZE; \
+ _up = _FP_W_TYPE_SIZE - _down; \
+ for (_s = _i = 0; _i < _skip; ++_i) \
+ _s |= X##_f[_i]; \
+ _s |= X##_f[_i] << _up; \
+/* s is now != 0 if we want to set the LSbit */ \
+ if (!_down) \
+ for (_i = 0; _i <= 3-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip]; \
+ else \
+ { \
+ for (_i = 0; _i < 3-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip] >> _down \
+ | X##_f[_i+_skip+1] << _up; \
+ X##_f[_i++] = X##_f[3] >> _down; \
+ } \
+ for (; _i < 4; ++_i) \
+ X##_f[_i] = 0; \
+ /* don't fix the LSB until the very end when we're sure f[0] is stable */ \
+ X##_f[0] |= (_s != 0); \
+ } while (0)
+
+#define _FP_FRAC_ADD_4(R,X,Y) \
+ __FP_FRAC_ADD_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
+ X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
+
+#define _FP_FRAC_SUB_4(R,X,Y) \
+ __FP_FRAC_SUB_4(R##_f[3], R##_f[2], R##_f[1], R##_f[0], \
+ X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
+
+#define _FP_FRAC_DEC_4(X,Y) \
+ __FP_FRAC_DEC_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ Y##_f[3], Y##_f[2], Y##_f[1], Y##_f[0])
+
+#define _FP_FRAC_ADDI_4(X,I) \
+ __FP_FRAC_ADDI_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], I)
+
+#define _FP_ZEROFRAC_4 0,0,0,0
+#define _FP_MINFRAC_4 0,0,0,1
+#define _FP_MAXFRAC_4 (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0)
+
+#define _FP_FRAC_ZEROP_4(X) ((X##_f[0] | X##_f[1] | X##_f[2] | X##_f[3]) == 0)
+#define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE)X##_f[3] < 0)
+#define _FP_FRAC_OVERP_4(fs,X) (_FP_FRAC_HIGH_##fs(X) & _FP_OVERFLOW_##fs)
+
+#define _FP_FRAC_EQ_4(X,Y) \
+ (X##_f[0] == Y##_f[0] && X##_f[1] == Y##_f[1] \
+ && X##_f[2] == Y##_f[2] && X##_f[3] == Y##_f[3])
+
+#define _FP_FRAC_GT_4(X,Y) \
+ (X##_f[3] > Y##_f[3] || \
+ (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \
+ (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \
+ (X##_f[1] == Y##_f[1] && X##_f[0] > Y##_f[0]) \
+ )) \
+ )) \
+ )
+
+#define _FP_FRAC_GE_4(X,Y) \
+ (X##_f[3] > Y##_f[3] || \
+ (X##_f[3] == Y##_f[3] && (X##_f[2] > Y##_f[2] || \
+ (X##_f[2] == Y##_f[2] && (X##_f[1] > Y##_f[1] || \
+ (X##_f[1] == Y##_f[1] && X##_f[0] >= Y##_f[0]) \
+ )) \
+ )) \
+ )
+
+
+#define _FP_FRAC_CLZ_4(R,X) \
+ do { \
+ if (X##_f[3]) \
+ { \
+ __FP_CLZ(R,X##_f[3]); \
+ } \
+ else if (X##_f[2]) \
+ { \
+ __FP_CLZ(R,X##_f[2]); \
+ R += _FP_W_TYPE_SIZE; \
+ } \
+ else if (X##_f[1]) \
+ { \
+ __FP_CLZ(R,X##_f[2]); \
+ R += _FP_W_TYPE_SIZE*2; \
+ } \
+ else \
+ { \
+ __FP_CLZ(R,X##_f[0]); \
+ R += _FP_W_TYPE_SIZE*3; \
+ } \
+ } while(0)
+
+
+#define _FP_UNPACK_RAW_4(fs, X, val) \
+ do { \
+ union _FP_UNION_##fs _flo; _flo.flt = (val); \
+ X##_f[0] = _flo.bits.frac0; \
+ X##_f[1] = _flo.bits.frac1; \
+ X##_f[2] = _flo.bits.frac2; \
+ X##_f[3] = _flo.bits.frac3; \
+ X##_e = _flo.bits.exp; \
+ X##_s = _flo.bits.sign; \
+ } while (0)
+
+#define _FP_UNPACK_RAW_4_P(fs, X, val) \
+ do { \
+ union _FP_UNION_##fs *_flo = \
+ (union _FP_UNION_##fs *)(val); \
+ \
+ X##_f[0] = _flo->bits.frac0; \
+ X##_f[1] = _flo->bits.frac1; \
+ X##_f[2] = _flo->bits.frac2; \
+ X##_f[3] = _flo->bits.frac3; \
+ X##_e = _flo->bits.exp; \
+ X##_s = _flo->bits.sign; \
+ } while (0)
+
+#define _FP_PACK_RAW_4(fs, val, X) \
+ do { \
+ union _FP_UNION_##fs _flo; \
+ _flo.bits.frac0 = X##_f[0]; \
+ _flo.bits.frac1 = X##_f[1]; \
+ _flo.bits.frac2 = X##_f[2]; \
+ _flo.bits.frac3 = X##_f[3]; \
+ _flo.bits.exp = X##_e; \
+ _flo.bits.sign = X##_s; \
+ (val) = _flo.flt; \
+ } while (0)
+
+#define _FP_PACK_RAW_4_P(fs, val, X) \
+ do { \
+ union _FP_UNION_##fs *_flo = \
+ (union _FP_UNION_##fs *)(val); \
+ \
+ _flo->bits.frac0 = X##_f[0]; \
+ _flo->bits.frac1 = X##_f[1]; \
+ _flo->bits.frac2 = X##_f[2]; \
+ _flo->bits.frac3 = X##_f[3]; \
+ _flo->bits.exp = X##_e; \
+ _flo->bits.sign = X##_s; \
+ } while (0)
+
+/*
+ * Multiplication algorithms:
+ */
+
+/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
+
+#define _FP_MUL_MEAT_4_wide(wfracbits, R, X, Y, doit) \
+ do { \
+ _FP_FRAC_DECL_8(_z); _FP_FRAC_DECL_2(_b); _FP_FRAC_DECL_2(_c); \
+ _FP_FRAC_DECL_2(_d); _FP_FRAC_DECL_2(_e); _FP_FRAC_DECL_2(_f); \
+ \
+ doit(_FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0), X##_f[0], Y##_f[0]); \
+ doit(_b_f1, _b_f0, X##_f[0], Y##_f[1]); \
+ doit(_c_f1, _c_f0, X##_f[1], Y##_f[0]); \
+ doit(_d_f1, _d_f0, X##_f[1], Y##_f[1]); \
+ doit(_e_f1, _e_f0, X##_f[0], Y##_f[2]); \
+ doit(_f_f1, _f_f0, X##_f[2], Y##_f[0]); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,3),_FP_FRAC_WORD_8(_z,2), \
+ _FP_FRAC_WORD_8(_z,1), 0,_b_f1,_b_f0, \
+ 0,0,_FP_FRAC_WORD_8(_z,1)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,3),_FP_FRAC_WORD_8(_z,2), \
+ _FP_FRAC_WORD_8(_z,1), 0,_c_f1,_c_f0, \
+ _FP_FRAC_WORD_8(_z,3),_FP_FRAC_WORD_8(_z,2), \
+ _FP_FRAC_WORD_8(_z,1)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,4),_FP_FRAC_WORD_8(_z,3), \
+ _FP_FRAC_WORD_8(_z,2), 0,_d_f1,_d_f0, \
+ 0,_FP_FRAC_WORD_8(_z,3),_FP_FRAC_WORD_8(_z,2)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,4),_FP_FRAC_WORD_8(_z,3), \
+ _FP_FRAC_WORD_8(_z,2), 0,_e_f1,_e_f0, \
+ _FP_FRAC_WORD_8(_z,4),_FP_FRAC_WORD_8(_z,3), \
+ _FP_FRAC_WORD_8(_z,2)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,4),_FP_FRAC_WORD_8(_z,3), \
+ _FP_FRAC_WORD_8(_z,2), 0,_f_f1,_f_f0, \
+ _FP_FRAC_WORD_8(_z,4),_FP_FRAC_WORD_8(_z,3), \
+ _FP_FRAC_WORD_8(_z,2)); \
+ doit(_b_f1, _b_f0, X##_f[0], Y##_f[3]); \
+ doit(_c_f1, _c_f0, X##_f[3], Y##_f[0]); \
+ doit(_d_f1, _d_f0, X##_f[1], Y##_f[2]); \
+ doit(_e_f1, _e_f0, X##_f[2], Y##_f[1]); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,5),_FP_FRAC_WORD_8(_z,4), \
+ _FP_FRAC_WORD_8(_z,3), 0,_b_f1,_b_f0, \
+ 0,_FP_FRAC_WORD_8(_z,4),_FP_FRAC_WORD_8(_z,3)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,5),_FP_FRAC_WORD_8(_z,4), \
+ _FP_FRAC_WORD_8(_z,3), 0,_c_f1,_c_f0, \
+ _FP_FRAC_WORD_8(_z,5),_FP_FRAC_WORD_8(_z,4), \
+ _FP_FRAC_WORD_8(_z,3)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,5),_FP_FRAC_WORD_8(_z,4), \
+ _FP_FRAC_WORD_8(_z,3), 0,_d_f1,_d_f0, \
+ _FP_FRAC_WORD_8(_z,5),_FP_FRAC_WORD_8(_z,4), \
+ _FP_FRAC_WORD_8(_z,3)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,5),_FP_FRAC_WORD_8(_z,4), \
+ _FP_FRAC_WORD_8(_z,3), 0,_e_f1,_e_f0, \
+ _FP_FRAC_WORD_8(_z,5),_FP_FRAC_WORD_8(_z,4), \
+ _FP_FRAC_WORD_8(_z,3)); \
+ doit(_b_f1, _b_f0, X##_f[2], Y##_f[2]); \
+ doit(_c_f1, _c_f0, X##_f[1], Y##_f[3]); \
+ doit(_d_f1, _d_f0, X##_f[3], Y##_f[1]); \
+ doit(_e_f1, _e_f0, X##_f[2], Y##_f[3]); \
+ doit(_f_f1, _f_f0, X##_f[3], Y##_f[2]); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,6),_FP_FRAC_WORD_8(_z,5), \
+ _FP_FRAC_WORD_8(_z,4), 0,_b_f1,_b_f0, \
+ 0,_FP_FRAC_WORD_8(_z,5),_FP_FRAC_WORD_8(_z,4)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,6),_FP_FRAC_WORD_8(_z,5), \
+ _FP_FRAC_WORD_8(_z,4), 0,_c_f1,_c_f0, \
+ _FP_FRAC_WORD_8(_z,6),_FP_FRAC_WORD_8(_z,5), \
+ _FP_FRAC_WORD_8(_z,4)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,6),_FP_FRAC_WORD_8(_z,5), \
+ _FP_FRAC_WORD_8(_z,4), 0,_d_f1,_d_f0, \
+ _FP_FRAC_WORD_8(_z,6),_FP_FRAC_WORD_8(_z,5), \
+ _FP_FRAC_WORD_8(_z,4)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,7),_FP_FRAC_WORD_8(_z,6), \
+ _FP_FRAC_WORD_8(_z,5), 0,_e_f1,_e_f0, \
+ 0,_FP_FRAC_WORD_8(_z,6),_FP_FRAC_WORD_8(_z,5)); \
+ __FP_FRAC_ADD_3(_FP_FRAC_WORD_8(_z,7),_FP_FRAC_WORD_8(_z,6), \
+ _FP_FRAC_WORD_8(_z,5), 0,_f_f1,_f_f0, \
+ _FP_FRAC_WORD_8(_z,7),_FP_FRAC_WORD_8(_z,6), \
+ _FP_FRAC_WORD_8(_z,5)); \
+ doit(_b_f1, _b_f0, X##_f[3], Y##_f[3]); \
+ __FP_FRAC_ADD_2(_FP_FRAC_WORD_8(_z,7),_FP_FRAC_WORD_8(_z,6), \
+ _b_f1,_b_f0, \
+ _FP_FRAC_WORD_8(_z,7),_FP_FRAC_WORD_8(_z,6)); \
+ \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_8(_z, wfracbits-1, 2*wfracbits); \
+ __FP_FRAC_SET_4(R, _FP_FRAC_WORD_8(_z,3), _FP_FRAC_WORD_8(_z,2), \
+ _FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0)); \
+ } while (0)
+
+#define _FP_MUL_MEAT_4_gmp(wfracbits, R, X, Y) \
+ do { \
+ _FP_FRAC_DECL_8(_z); \
+ \
+ mpn_mul_n(_z_f, _x_f, _y_f, 4); \
+ \
+ /* Normalize since we know where the msb of the multiplicands \
+ were (bit B), we know that the msb of the of the product is \
+ at either 2B or 2B-1. */ \
+ _FP_FRAC_SRS_8(_z, wfracbits-1, 2*wfracbits); \
+ __FP_FRAC_SET_4(R, _FP_FRAC_WORD_8(_z,3), _FP_FRAC_WORD_8(_z,2), \
+ _FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0)); \
+ } while (0)
+
+/*
+ * Helper utility for _FP_DIV_MEAT_4_udiv:
+ * pppp = m * nnn
+ */
+#define umul_ppppmnnn(p3,p2,p1,p0,m,n2,n1,n0) \
+ do { \
+ UWtype _t; \
+ umul_ppmm(p1,p0,m,n0); \
+ umul_ppmm(p2,_t,m,n1); \
+ __FP_FRAC_ADDI_2(p2,p1,_t); \
+ umul_ppmm(p3,_t,m,n2); \
+ __FP_FRAC_ADDI_2(p3,p2,_t); \
+ } while (0)
+
+/*
+ * Division algorithms:
+ */
+
+#define _FP_DIV_MEAT_4_udiv(fs, R, X, Y) \
+ do { \
+ int _i; \
+ _FP_FRAC_DECL_4(_n); _FP_FRAC_DECL_4(_m); \
+ _FP_FRAC_SET_4(_n, _FP_ZEROFRAC_4); \
+ if (_FP_FRAC_GT_4(X, Y)) \
+ { \
+ _n_f[3] = X##_f[0] << (_FP_W_TYPE_SIZE - 1); \
+ _FP_FRAC_SRL_4(X, 1); \
+ } \
+ else \
+ R##_e--; \
+ \
+ /* Normalize, i.e. make the most significant bit of the \
+ denominator set. */ \
+ _FP_FRAC_SLL_4(Y, _FP_WFRACXBITS_##fs); \
+ \
+ for (_i = 3; ; _i--) \
+ { \
+ if (X##_f[3] == Y##_f[3]) \
+ { \
+ /* This is a special case, not an optimization \
+ (X##_f[3]/Y##_f[3] would not fit into UWtype). \
+ As X## is guaranteed to be < Y, R##_f[_i] can be either \
+ (UWtype)-1 or (UWtype)-2. */ \
+ R##_f[_i] = -1; \
+ if (!_i) \
+ break; \
+ __FP_FRAC_SUB_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], \
+ Y##_f[2], Y##_f[1], Y##_f[0], 0, \
+ X##_f[2], X##_f[1], X##_f[0], _n_f[_i]); \
+ _FP_FRAC_SUB_4(X, Y, X); \
+ if (X##_f[3] > Y##_f[3]) \
+ { \
+ R##_f[_i] = -2; \
+ _FP_FRAC_ADD_4(X, Y, X); \
+ } \
+ } \
+ else \
+ { \
+ udiv_qrnnd(R##_f[_i], X##_f[3], X##_f[3], X##_f[2], Y##_f[3]); \
+ umul_ppppmnnn(_m_f[3], _m_f[2], _m_f[1], _m_f[0], \
+ R##_f[_i], Y##_f[2], Y##_f[1], Y##_f[0]); \
+ X##_f[2] = X##_f[1]; \
+ X##_f[1] = X##_f[0]; \
+ X##_f[0] = _n_f[_i]; \
+ if (_FP_FRAC_GT_4(_m, X)) \
+ { \
+ R##_f[_i]--; \
+ _FP_FRAC_ADD_4(X, Y, X); \
+ if (_FP_FRAC_GE_4(X, Y) && _FP_FRAC_GT_4(_m, X)) \
+ { \
+ R##_f[_i]--; \
+ _FP_FRAC_ADD_4(X, Y, X); \
+ } \
+ } \
+ _FP_FRAC_DEC_4(X, _m); \
+ if (!_i) \
+ { \
+ if (!_FP_FRAC_EQ_4(X, _m)) \
+ R##_f[0] |= _FP_WORK_STICKY; \
+ break; \
+ } \
+ } \
+ } \
+ } while (0)
+
+
+/*
+ * Square root algorithms:
+ * We have just one right now, maybe Newton approximation
+ * should be added for those machines where division is fast.
+ */
+
+#define _FP_SQRT_MEAT_4(R, S, T, X, q) \
+ do { \
+ while (q) \
+ { \
+ T##_f[3] = S##_f[3] + q; \
+ if (T##_f[3] <= X##_f[3]) \
+ { \
+ S##_f[3] = T##_f[3] + q; \
+ X##_f[3] -= T##_f[3]; \
+ R##_f[3] += q; \
+ } \
+ _FP_FRAC_SLL_4(X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q) \
+ { \
+ T##_f[2] = S##_f[2] + q; \
+ T##_f[3] = S##_f[3]; \
+ if (T##_f[3] < X##_f[3] || \
+ (T##_f[3] == X##_f[3] && T##_f[2] <= X##_f[2])) \
+ { \
+ S##_f[2] = T##_f[2] + q; \
+ S##_f[3] += (T##_f[2] > S##_f[2]); \
+ __FP_FRAC_DEC_2(X##_f[3], X##_f[2], \
+ T##_f[3], T##_f[2]); \
+ R##_f[2] += q; \
+ } \
+ _FP_FRAC_SLL_4(X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q) \
+ { \
+ T##_f[1] = S##_f[1] + q; \
+ T##_f[2] = S##_f[2]; \
+ T##_f[3] = S##_f[3]; \
+ if (T##_f[3] < X##_f[3] || \
+ (T##_f[3] == X##_f[3] && (T##_f[2] < X##_f[2] || \
+ (T##_f[2] == X##_f[2] && T##_f[1] <= X##_f[1])))) \
+ { \
+ S##_f[1] = T##_f[1] + q; \
+ S##_f[2] += (T##_f[1] > S##_f[1]); \
+ S##_f[3] += (T##_f[2] > S##_f[2]); \
+ __FP_FRAC_DEC_3(X##_f[3], X##_f[2], X##_f[1], \
+ T##_f[3], T##_f[2], T##_f[1]); \
+ R##_f[1] += q; \
+ } \
+ _FP_FRAC_SLL_4(X, 1); \
+ q >>= 1; \
+ } \
+ q = (_FP_W_TYPE)1 << (_FP_W_TYPE_SIZE - 1); \
+ while (q != _FP_WORK_ROUND) \
+ { \
+ T##_f[0] = S##_f[0] + q; \
+ T##_f[1] = S##_f[1]; \
+ T##_f[2] = S##_f[2]; \
+ T##_f[3] = S##_f[3]; \
+ if (_FP_FRAC_GE_4(X,T)) \
+ { \
+ S##_f[0] = T##_f[0] + q; \
+ S##_f[1] += (T##_f[0] > S##_f[0]); \
+ S##_f[2] += (T##_f[1] > S##_f[1]); \
+ S##_f[3] += (T##_f[2] > S##_f[2]); \
+ _FP_FRAC_DEC_4(X, T); \
+ R##_f[0] += q; \
+ } \
+ _FP_FRAC_SLL_4(X, 1); \
+ q >>= 1; \
+ } \
+ if (!_FP_FRAC_ZEROP_4(X)) \
+ { \
+ if (_FP_FRAC_GT_4(X,S)) \
+ R##_f[0] |= _FP_WORK_ROUND; \
+ R##_f[0] |= _FP_WORK_STICKY; \
+ } \
+ } while (0)
+
+
+/*
+ * Internals
+ */
+
+#define __FP_FRAC_SET_4(X,I3,I2,I1,I0) \
+ (X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)
+
+#ifndef __FP_FRAC_ADD_3
+#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
+ (r0 = x0 + y0, \
+ r1 = x1 + y1 + (r0 < x0), \
+ r2 = x2 + y2 + (r1 < x1))
+#endif
+
+#ifndef __FP_FRAC_ADD_4
+#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
+ (r0 = x0 + y0, \
+ r1 = x1 + y1 + (r0 < x0), \
+ r2 = x2 + y2 + (r1 < x1), \
+ r3 = x3 + y3 + (r2 < x2))
+#endif
+
+#ifndef __FP_FRAC_SUB_3
+#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
+ (r0 = x0 - y0, \
+ r1 = x1 - y1 - (r0 > x0), \
+ r2 = x2 - y2 - (r1 > x1))
+#endif
+
+#ifndef __FP_FRAC_SUB_4
+#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
+ (r0 = x0 - y0, \
+ r1 = x1 - y1 - (r0 > x0), \
+ r2 = x2 - y2 - (r1 > x1), \
+ r3 = x3 - y3 - (r2 > x2))
+#endif
+
+#ifndef __FP_FRAC_DEC_3
+#define __FP_FRAC_DEC_3(x2,x1,x0,y2,y1,y0) \
+ do { \
+ UWtype _t0, _t1; \
+ _t0 = x0; \
+ x0 -= y0; \
+ _t1 = x1; \
+ x1 -= y1 + (x0 > _t0); \
+ x2 -= y2 + (x1 > _t1); \
+ } while (0)
+#endif
+
+#ifndef __FP_FRAC_DEC_4
+#define __FP_FRAC_DEC_4(x3,x2,x1,x0,y3,y2,y1,y0) \
+ do { \
+ UWtype _t0, _t1; \
+ _t0 = x0; \
+ x0 -= y0; \
+ _t1 = x1; \
+ x1 -= y1 + (x0 > _t0); \
+ _t0 = x2; \
+ x2 -= y2 + (x1 > _t1); \
+ x3 -= y3 + (x2 > _t0); \
+ } while (0)
+#endif
+
+#ifndef __FP_FRAC_ADDI_4
+#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \
+ do { \
+ UWtype _t; \
+ _t = ((x0 += i) < i); \
+ x1 += _t; _t = (x1 < _t); \
+ x2 += _t; _t = (x2 < _t); \
+ x3 += _t; \
+ } while (0)
+#endif
+
+/* Convert FP values between word sizes. This appears to be more
+ * complicated than I'd have expected it to be, so these might be
+ * wrong... These macros are in any case somewhat bogus because they
+ * use information about what various FRAC_n variables look like
+ * internally [eg, that 2 word vars are X_f0 and x_f1]. But so do
+ * the ones in op-2.h and op-1.h.
+ */
+#define _FP_FRAC_CONV_1_4(dfs, sfs, D, S) \
+ do { \
+ if (S##_c != FP_CLS_NAN) \
+ _FP_FRAC_SRS_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
+ _FP_WFRACBITS_##sfs); \
+ else \
+ _FP_FRAC_SRL_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs)); \
+ D##_f = S##_f[0]; \
+ } while (0)
+
+#define _FP_FRAC_CONV_2_4(dfs, sfs, D, S) \
+ do { \
+ if (S##_c != FP_CLS_NAN) \
+ _FP_FRAC_SRS_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs), \
+ _FP_WFRACBITS_##sfs); \
+ else \
+ _FP_FRAC_SRL_4(S, (_FP_WFRACBITS_##sfs - _FP_WFRACBITS_##dfs)); \
+ D##_f0 = S##_f[0]; \
+ D##_f1 = S##_f[1]; \
+ } while (0)
+
+/* Assembly/disassembly for converting to/from integral types.
+ * No shifting or overflow handled here.
+ */
+/* Put the FP value X into r, which is an integer of size rsize. */
+#define _FP_FRAC_ASSEMBLE_4(r, X, rsize) \
+ do { \
+ if (rsize <= _FP_W_TYPE_SIZE) \
+ r = X##_f[0]; \
+ else if (rsize <= 2*_FP_W_TYPE_SIZE) \
+ { \
+ r = X##_f[1]; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f[0]; \
+ } \
+ else \
+ { \
+ /* I'm feeling lazy so we deal with int == 3words (implausible)*/ \
+ /* and int == 4words as a single case. */ \
+ r = X##_f[3]; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f[2]; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f[1]; \
+ r <<= _FP_W_TYPE_SIZE; \
+ r += X##_f[0]; \
+ } \
+ } while (0)
+
+/* "No disassemble Number Five!" */
+/* move an integer of size rsize into X's fractional part. We rely on
+ * the _f[] array consisting of words of size _FP_W_TYPE_SIZE to avoid
+ * having to mask the values we store into it.
+ */
+#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \
+ do { \
+ X##_f[0] = r; \
+ X##_f[1] = (rsize <= _FP_W_TYPE_SIZE ? 0 : r >> _FP_W_TYPE_SIZE); \
+ X##_f[2] = (rsize <= 2*_FP_W_TYPE_SIZE ? 0 : r >> 2*_FP_W_TYPE_SIZE); \
+ X##_f[3] = (rsize <= 3*_FP_W_TYPE_SIZE ? 0 : r >> 3*_FP_W_TYPE_SIZE); \
+ } while (0);
+
+#define _FP_FRAC_CONV_4_1(dfs, sfs, D, S) \
+ do { \
+ D##_f[0] = S##_f; \
+ D##_f[1] = D##_f[2] = D##_f[3] = 0; \
+ _FP_FRAC_SLL_4(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
+ } while (0)
+
+#define _FP_FRAC_CONV_4_2(dfs, sfs, D, S) \
+ do { \
+ D##_f[0] = S##_f0; \
+ D##_f[1] = S##_f1; \
+ D##_f[2] = D##_f[3] = 0; \
+ _FP_FRAC_SLL_4(D, (_FP_WFRACBITS_##dfs - _FP_WFRACBITS_##sfs)); \
+ } while (0)
+
diff --git a/include/math-emu/op-8.h b/include/math-emu/op-8.h
new file mode 100644
index 000000000..a9d7dbf59
--- /dev/null
+++ b/include/math-emu/op-8.h
@@ -0,0 +1,103 @@
+/* Software floating-point emulation.
+ Basic eight-word fraction declaration and manipulation.
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* We need just a few things from here for op-4, if we ever need some
+ other macros, they can be added. */
+#define _FP_FRAC_DECL_8(X) _FP_W_TYPE X##_f[8]
+#define _FP_FRAC_HIGH_8(X) (X##_f[7])
+#define _FP_FRAC_LOW_8(X) (X##_f[0])
+#define _FP_FRAC_WORD_8(X,w) (X##_f[w])
+
+#define _FP_FRAC_SLL_8(X,N) \
+ do { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _up = (N) % _FP_W_TYPE_SIZE; \
+ _down = _FP_W_TYPE_SIZE - _up; \
+ if (!_up) \
+ for (_i = 7; _i >= _skip; --_i) \
+ X##_f[_i] = X##_f[_i-_skip]; \
+ else \
+ { \
+ for (_i = 7; _i > _skip; --_i) \
+ X##_f[_i] = X##_f[_i-_skip] << _up \
+ | X##_f[_i-_skip-1] >> _down; \
+ X##_f[_i--] = X##_f[0] << _up; \
+ } \
+ for (; _i >= 0; --_i) \
+ X##_f[_i] = 0; \
+ } while (0)
+
+#define _FP_FRAC_SRL_8(X,N) \
+ do { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _down = (N) % _FP_W_TYPE_SIZE; \
+ _up = _FP_W_TYPE_SIZE - _down; \
+ if (!_down) \
+ for (_i = 0; _i <= 7-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip]; \
+ else \
+ { \
+ for (_i = 0; _i < 7-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip] >> _down \
+ | X##_f[_i+_skip+1] << _up; \
+ X##_f[_i++] = X##_f[7] >> _down; \
+ } \
+ for (; _i < 8; ++_i) \
+ X##_f[_i] = 0; \
+ } while (0)
+
+
+/* Right shift with sticky-lsb.
+ * What this actually means is that we do a standard right-shift,
+ * but that if any of the bits that fall off the right hand side
+ * were one then we always set the LSbit.
+ */
+#define _FP_FRAC_SRS_8(X,N,size) \
+ do { \
+ _FP_I_TYPE _up, _down, _skip, _i; \
+ _FP_W_TYPE _s; \
+ _skip = (N) / _FP_W_TYPE_SIZE; \
+ _down = (N) % _FP_W_TYPE_SIZE; \
+ _up = _FP_W_TYPE_SIZE - _down; \
+ for (_s = _i = 0; _i < _skip; ++_i) \
+ _s |= X##_f[_i]; \
+ _s |= X##_f[_i] << _up; \
+/* s is now != 0 if we want to set the LSbit */ \
+ if (!_down) \
+ for (_i = 0; _i <= 7-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip]; \
+ else \
+ { \
+ for (_i = 0; _i < 7-_skip; ++_i) \
+ X##_f[_i] = X##_f[_i+_skip] >> _down \
+ | X##_f[_i+_skip+1] << _up; \
+ X##_f[_i++] = X##_f[7] >> _down; \
+ } \
+ for (; _i < 8; ++_i) \
+ X##_f[_i] = 0; \
+ /* don't fix the LSB until the very end when we're sure f[0] is stable */ \
+ X##_f[0] |= (_s != 0); \
+ } while (0)
+
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
new file mode 100644
index 000000000..207aa7738
--- /dev/null
+++ b/include/math-emu/op-common.h
@@ -0,0 +1,767 @@
+/* Software floating-point emulation. Common operations.
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz),
+ David S. Miller (davem@redhat.com) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#define _FP_DECL(wc, X) \
+ _FP_I_TYPE X##_c, X##_s, X##_e; \
+ _FP_FRAC_DECL_##wc(X)
+
+/*
+ * Finish truely unpacking a native fp value by classifying the kind
+ * of fp value and normalizing both the exponent and the fraction.
+ */
+
+#define _FP_UNPACK_CANONICAL(fs, wc, X) \
+do { \
+ switch (X##_e) \
+ { \
+ default: \
+ _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_IMPLBIT_##fs; \
+ _FP_FRAC_SLL_##wc(X, _FP_WORKBITS); \
+ X##_e -= _FP_EXPBIAS_##fs; \
+ X##_c = FP_CLS_NORMAL; \
+ break; \
+ \
+ case 0: \
+ if (_FP_FRAC_ZEROP_##wc(X)) \
+ X##_c = FP_CLS_ZERO; \
+ else \
+ { \
+ /* a denormalized number */ \
+ _FP_I_TYPE _shift; \
+ _FP_FRAC_CLZ_##wc(_shift, X); \
+ _shift -= _FP_FRACXBITS_##fs; \
+ _FP_FRAC_SLL_##wc(X, (_shift+_FP_WORKBITS)); \
+ X##_e -= _FP_EXPBIAS_##fs - 1 + _shift; \
+ X##_c = FP_CLS_NORMAL; \
+ FP_SET_EXCEPTION(FP_EX_DENORM); \
+ } \
+ break; \
+ \
+ case _FP_EXPMAX_##fs: \
+ if (_FP_FRAC_ZEROP_##wc(X)) \
+ X##_c = FP_CLS_INF; \
+ else \
+ { \
+ X##_c = FP_CLS_NAN; \
+ /* Check for signaling NaN */ \
+ if (!(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \
+ FP_SET_EXCEPTION(FP_EX_INVALID); \
+ } \
+ break; \
+ } \
+} while (0)
+
+/*
+ * Before packing the bits back into the native fp result, take care
+ * of such mundane things as rounding and overflow. Also, for some
+ * kinds of fp values, the original parts may not have been fully
+ * extracted -- but that is ok, we can regenerate them now.
+ */
+
+#define _FP_PACK_CANONICAL(fs, wc, X) \
+do { \
+ switch (X##_c) \
+ { \
+ case FP_CLS_NORMAL: \
+ X##_e += _FP_EXPBIAS_##fs; \
+ if (X##_e > 0) \
+ { \
+ _FP_ROUND(wc, X); \
+ if (_FP_FRAC_OVERP_##wc(fs, X)) \
+ { \
+ _FP_FRAC_SRL_##wc(X, (_FP_WORKBITS+1)); \
+ X##_e++; \
+ } \
+ else \
+ _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
+ if (X##_e >= _FP_EXPMAX_##fs) \
+ { \
+ /* overflow */ \
+ switch (FP_ROUNDMODE) \
+ { \
+ case FP_RND_NEAREST: \
+ X##_c = FP_CLS_INF; \
+ break; \
+ case FP_RND_PINF: \
+ if (!X##_s) X##_c = FP_CLS_INF; \
+ break; \
+ case FP_RND_MINF: \
+ if (X##_s) X##_c = FP_CLS_INF; \
+ break; \
+ } \
+ if (X##_c == FP_CLS_INF) \
+ { \
+ /* Overflow to infinity */ \
+ X##_e = _FP_EXPMAX_##fs; \
+ _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
+ } \
+ else \
+ { \
+ /* Overflow to maximum normal */ \
+ X##_e = _FP_EXPMAX_##fs - 1; \
+ _FP_FRAC_SET_##wc(X, _FP_MAXFRAC_##wc); \
+ } \
+ FP_SET_EXCEPTION(FP_EX_OVERFLOW); \
+ FP_SET_EXCEPTION(FP_EX_INEXACT); \
+ } \
+ } \
+ else \
+ { \
+ /* we've got a denormalized number */ \
+ X##_e = -X##_e + 1; \
+ if (X##_e <= _FP_WFRACBITS_##fs) \
+ { \
+ _FP_FRAC_SRS_##wc(X, X##_e, _FP_WFRACBITS_##fs); \
+ _FP_ROUND(wc, X); \
+ if (_FP_FRAC_HIGH_##fs(X) \
+ & (_FP_OVERFLOW_##fs >> 1)) \
+ { \
+ X##_e = 1; \
+ _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
+ } \
+ else \
+ { \
+ X##_e = 0; \
+ _FP_FRAC_SRL_##wc(X, _FP_WORKBITS); \
+ FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
+ } \
+ } \
+ else \
+ { \
+ /* underflow to zero */ \
+ X##_e = 0; \
+ if (!_FP_FRAC_ZEROP_##wc(X)) \
+ { \
+ _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
+ _FP_ROUND(wc, X); \
+ _FP_FRAC_LOW_##wc(X) >>= (_FP_WORKBITS); \
+ } \
+ FP_SET_EXCEPTION(FP_EX_UNDERFLOW); \
+ } \
+ } \
+ break; \
+ \
+ case FP_CLS_ZERO: \
+ X##_e = 0; \
+ _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
+ break; \
+ \
+ case FP_CLS_INF: \
+ X##_e = _FP_EXPMAX_##fs; \
+ _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
+ break; \
+ \
+ case FP_CLS_NAN: \
+ X##_e = _FP_EXPMAX_##fs; \
+ if (!_FP_KEEPNANFRACP) \
+ { \
+ _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
+ X##_s = _FP_NANSIGN_##fs; \
+ } \
+ else \
+ _FP_FRAC_HIGH_RAW_##fs(X) |= _FP_QNANBIT_##fs; \
+ break; \
+ } \
+} while (0)
+
+/* This one accepts raw argument and not cooked, returns
+ * 1 if X is a signaling NaN.
+ */
+#define _FP_ISSIGNAN(fs, wc, X) \
+({ \
+ int __ret = 0; \
+ if (X##_e == _FP_EXPMAX_##fs) \
+ { \
+ if (!_FP_FRAC_ZEROP_##wc(X) \
+ && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \
+ __ret = 1; \
+ } \
+ __ret; \
+})
+
+
+
+
+
+/*
+ * Main addition routine. The input values should be cooked.
+ */
+
+#define _FP_ADD_INTERNAL(fs, wc, R, X, Y, OP) \
+do { \
+ switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
+ { \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
+ { \
+ /* shift the smaller number so that its exponent matches the larger */ \
+ _FP_I_TYPE diff = X##_e - Y##_e; \
+ \
+ if (diff < 0) \
+ { \
+ diff = -diff; \
+ if (diff <= _FP_WFRACBITS_##fs) \
+ _FP_FRAC_SRS_##wc(X, diff, _FP_WFRACBITS_##fs); \
+ else if (!_FP_FRAC_ZEROP_##wc(X)) \
+ _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
+ R##_e = Y##_e; \
+ } \
+ else \
+ { \
+ if (diff > 0) \
+ { \
+ if (diff <= _FP_WFRACBITS_##fs) \
+ _FP_FRAC_SRS_##wc(Y, diff, _FP_WFRACBITS_##fs); \
+ else if (!_FP_FRAC_ZEROP_##wc(Y)) \
+ _FP_FRAC_SET_##wc(Y, _FP_MINFRAC_##wc); \
+ } \
+ R##_e = X##_e; \
+ } \
+ \
+ R##_c = FP_CLS_NORMAL; \
+ \
+ if (X##_s == Y##_s) \
+ { \
+ R##_s = X##_s; \
+ _FP_FRAC_ADD_##wc(R, X, Y); \
+ if (_FP_FRAC_OVERP_##wc(fs, R)) \
+ { \
+ _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
+ R##_e++; \
+ } \
+ } \
+ else \
+ { \
+ R##_s = X##_s; \
+ _FP_FRAC_SUB_##wc(R, X, Y); \
+ if (_FP_FRAC_ZEROP_##wc(R)) \
+ { \
+ /* return an exact zero */ \
+ if (FP_ROUNDMODE == FP_RND_MINF) \
+ R##_s |= Y##_s; \
+ else \
+ R##_s &= Y##_s; \
+ R##_c = FP_CLS_ZERO; \
+ } \
+ else \
+ { \
+ if (_FP_FRAC_NEGP_##wc(R)) \
+ { \
+ _FP_FRAC_SUB_##wc(R, Y, X); \
+ R##_s = Y##_s; \
+ } \
+ \
+ /* renormalize after subtraction */ \
+ _FP_FRAC_CLZ_##wc(diff, R); \
+ diff -= _FP_WFRACXBITS_##fs; \
+ if (diff) \
+ { \
+ R##_e -= diff; \
+ _FP_FRAC_SLL_##wc(R, diff); \
+ } \
+ } \
+ } \
+ break; \
+ } \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
+ _FP_CHOOSENAN(fs, wc, R, X, Y, OP); \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
+ R##_e = X##_e; \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
+ _FP_FRAC_COPY_##wc(R, X); \
+ R##_s = X##_s; \
+ R##_c = X##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
+ R##_e = Y##_e; \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
+ _FP_FRAC_COPY_##wc(R, Y); \
+ R##_s = Y##_s; \
+ R##_c = Y##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
+ if (X##_s != Y##_s) \
+ { \
+ /* +INF + -INF => NAN */ \
+ _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
+ R##_s = _FP_NANSIGN_##fs; \
+ R##_c = FP_CLS_NAN; \
+ FP_SET_EXCEPTION(FP_EX_INVALID); \
+ break; \
+ } \
+ /* FALLTHRU */ \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
+ R##_s = X##_s; \
+ R##_c = FP_CLS_INF; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
+ R##_s = Y##_s; \
+ R##_c = FP_CLS_INF; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
+ /* make sure the sign is correct */ \
+ if (FP_ROUNDMODE == FP_RND_MINF) \
+ R##_s = X##_s | Y##_s; \
+ else \
+ R##_s = X##_s & Y##_s; \
+ R##_c = FP_CLS_ZERO; \
+ break; \
+ \
+ default: \
+ abort(); \
+ } \
+} while (0)
+
+#define _FP_ADD(fs, wc, R, X, Y) _FP_ADD_INTERNAL(fs, wc, R, X, Y, '+')
+#define _FP_SUB(fs, wc, R, X, Y) \
+ do { \
+ if (Y##_c != FP_CLS_NAN) Y##_s ^= 1; \
+ _FP_ADD_INTERNAL(fs, wc, R, X, Y, '-'); \
+ } while (0)
+
+
+/*
+ * Main negation routine. FIXME -- when we care about setting exception
+ * bits reliably, this will not do. We should examine all of the fp classes.
+ */
+
+#define _FP_NEG(fs, wc, R, X) \
+ do { \
+ _FP_FRAC_COPY_##wc(R, X); \
+ R##_c = X##_c; \
+ R##_e = X##_e; \
+ R##_s = 1 ^ X##_s; \
+ } while (0)
+
+
+/*
+ * Main multiplication routine. The input values should be cooked.
+ */
+
+#define _FP_MUL(fs, wc, R, X, Y) \
+do { \
+ R##_s = X##_s ^ Y##_s; \
+ switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
+ { \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
+ R##_c = FP_CLS_NORMAL; \
+ R##_e = X##_e + Y##_e + 1; \
+ \
+ _FP_MUL_MEAT_##fs(R,X,Y); \
+ \
+ if (_FP_FRAC_OVERP_##wc(fs, R)) \
+ _FP_FRAC_SRS_##wc(R, 1, _FP_WFRACBITS_##fs); \
+ else \
+ R##_e--; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
+ _FP_CHOOSENAN(fs, wc, R, X, Y, '*'); \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
+ R##_s = X##_s; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
+ _FP_FRAC_COPY_##wc(R, X); \
+ R##_c = X##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
+ R##_s = Y##_s; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
+ _FP_FRAC_COPY_##wc(R, Y); \
+ R##_c = Y##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
+ R##_s = _FP_NANSIGN_##fs; \
+ R##_c = FP_CLS_NAN; \
+ _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION(FP_EX_INVALID); \
+ break; \
+ \
+ default: \
+ abort(); \
+ } \
+} while (0)
+
+
+/*
+ * Main division routine. The input values should be cooked.
+ */
+
+#define _FP_DIV(fs, wc, R, X, Y) \
+do { \
+ R##_s = X##_s ^ Y##_s; \
+ switch (_FP_CLS_COMBINE(X##_c, Y##_c)) \
+ { \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NORMAL): \
+ R##_c = FP_CLS_NORMAL; \
+ R##_e = X##_e - Y##_e; \
+ \
+ _FP_DIV_MEAT_##fs(R,X,Y); \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NAN): \
+ _FP_CHOOSENAN(fs, wc, R, X, Y, '/'); \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_NORMAL): \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_NAN,FP_CLS_ZERO): \
+ R##_s = X##_s; \
+ _FP_FRAC_COPY_##wc(R, X); \
+ R##_c = X##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_NAN): \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NAN): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NAN): \
+ R##_s = Y##_s; \
+ _FP_FRAC_COPY_##wc(R, Y); \
+ R##_c = Y##_c; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_NORMAL): \
+ R##_c = FP_CLS_ZERO; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_NORMAL,FP_CLS_ZERO): \
+ FP_SET_EXCEPTION(FP_EX_DIVZERO); \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_ZERO): \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_NORMAL): \
+ R##_c = FP_CLS_INF; \
+ break; \
+ \
+ case _FP_CLS_COMBINE(FP_CLS_INF,FP_CLS_INF): \
+ case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
+ R##_s = _FP_NANSIGN_##fs; \
+ R##_c = FP_CLS_NAN; \
+ _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION(FP_EX_INVALID); \
+ break; \
+ \
+ default: \
+ abort(); \
+ } \
+} while (0)
+
+
+/*
+ * Main differential comparison routine. The inputs should be raw not
+ * cooked. The return is -1,0,1 for normal values, 2 otherwise.
+ */
+
+#define _FP_CMP(fs, wc, ret, X, Y, un) \
+ do { \
+ /* NANs are unordered */ \
+ if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
+ || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) \
+ { \
+ ret = un; \
+ } \
+ else \
+ { \
+ int __is_zero_x; \
+ int __is_zero_y; \
+ \
+ __is_zero_x = (!X##_e && _FP_FRAC_ZEROP_##wc(X)) ? 1 : 0; \
+ __is_zero_y = (!Y##_e && _FP_FRAC_ZEROP_##wc(Y)) ? 1 : 0; \
+ \
+ if (__is_zero_x && __is_zero_y) \
+ ret = 0; \
+ else if (__is_zero_x) \
+ ret = Y##_s ? 1 : -1; \
+ else if (__is_zero_y) \
+ ret = X##_s ? -1 : 1; \
+ else if (X##_s != Y##_s) \
+ ret = X##_s ? -1 : 1; \
+ else if (X##_e > Y##_e) \
+ ret = X##_s ? -1 : 1; \
+ else if (X##_e < Y##_e) \
+ ret = X##_s ? 1 : -1; \
+ else if (_FP_FRAC_GT_##wc(X, Y)) \
+ ret = X##_s ? -1 : 1; \
+ else if (_FP_FRAC_GT_##wc(Y, X)) \
+ ret = X##_s ? 1 : -1; \
+ else \
+ ret = 0; \
+ } \
+ } while (0)
+
+
+/* Simplification for strict equality. */
+
+#define _FP_CMP_EQ(fs, wc, ret, X, Y) \
+ do { \
+ /* NANs are unordered */ \
+ if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(X)) \
+ || (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc(Y))) \
+ { \
+ ret = 1; \
+ } \
+ else \
+ { \
+ ret = !(X##_e == Y##_e \
+ && _FP_FRAC_EQ_##wc(X, Y) \
+ && (X##_s == Y##_s || !X##_e && _FP_FRAC_ZEROP_##wc(X))); \
+ } \
+ } while (0)
+
+/*
+ * Main square root routine. The input value should be cooked.
+ */
+
+#define _FP_SQRT(fs, wc, R, X) \
+do { \
+ _FP_FRAC_DECL_##wc(T); _FP_FRAC_DECL_##wc(S); \
+ _FP_W_TYPE q; \
+ switch (X##_c) \
+ { \
+ case FP_CLS_NAN: \
+ _FP_FRAC_COPY_##wc(R, X); \
+ R##_s = X##_s; \
+ R##_c = FP_CLS_NAN; \
+ break; \
+ case FP_CLS_INF: \
+ if (X##_s) \
+ { \
+ R##_s = _FP_NANSIGN_##fs; \
+ R##_c = FP_CLS_NAN; /* NAN */ \
+ _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION(FP_EX_INVALID); \
+ } \
+ else \
+ { \
+ R##_s = 0; \
+ R##_c = FP_CLS_INF; /* sqrt(+inf) = +inf */ \
+ } \
+ break; \
+ case FP_CLS_ZERO: \
+ R##_s = X##_s; \
+ R##_c = FP_CLS_ZERO; /* sqrt(+-0) = +-0 */ \
+ break; \
+ case FP_CLS_NORMAL: \
+ R##_s = 0; \
+ if (X##_s) \
+ { \
+ R##_c = FP_CLS_NAN; /* sNAN */ \
+ R##_s = _FP_NANSIGN_##fs; \
+ _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
+ FP_SET_EXCEPTION(FP_EX_INVALID); \
+ break; \
+ } \
+ R##_c = FP_CLS_NORMAL; \
+ if (X##_e & 1) \
+ _FP_FRAC_SLL_##wc(X, 1); \
+ R##_e = X##_e >> 1; \
+ _FP_FRAC_SET_##wc(S, _FP_ZEROFRAC_##wc); \
+ _FP_FRAC_SET_##wc(R, _FP_ZEROFRAC_##wc); \
+ q = _FP_OVERFLOW_##fs >> 1; \
+ _FP_SQRT_MEAT_##wc(R, S, T, X, q); \
+ } \
+ } while (0)
+
+/*
+ * Convert from FP to integer
+ */
+
+/* RSIGNED can have following values:
+ * 0: the number is required to be 0..(2^rsize)-1, if not, NV is set plus
+ * the result is either 0 or (2^rsize)-1 depending on the sign in such case.
+ * 1: the number is required to be -(2^(rsize-1))..(2^(rsize-1))-1, if not, NV is
+ * set plus the result is either -(2^(rsize-1)) or (2^(rsize-1))-1 depending
+ * on the sign in such case.
+ * -1: the number is required to be -(2^(rsize-1))..(2^rsize)-1, if not, NV is
+ * set plus the result is either -(2^(rsize-1)) or (2^(rsize-1))-1 depending
+ * on the sign in such case.
+ */
+#define _FP_TO_INT(fs, wc, r, X, rsize, rsigned) \
+ do { \
+ switch (X##_c) \
+ { \
+ case FP_CLS_NORMAL: \
+ if (X##_e < 0) \
+ { \
+ FP_SET_EXCEPTION(FP_EX_INEXACT); \
+ case FP_CLS_ZERO: \
+ r = 0; \
+ } \
+ else if (X##_e >= rsize - (rsigned > 0 || X##_s) \
+ || (!rsigned && X##_s)) \
+ { /* overflow */ \
+ case FP_CLS_NAN: \
+ case FP_CLS_INF: \
+ if (rsigned) \
+ { \
+ r = 1; \
+ r <<= rsize - 1; \
+ r -= 1 - X##_s; \
+ } else { \
+ r = 0; \
+ if (X##_s) \
+ r = ~r; \
+ } \
+ FP_SET_EXCEPTION(FP_EX_INVALID); \
+ } \
+ else \
+ { \
+ if (_FP_W_TYPE_SIZE*wc < rsize) \
+ { \
+ _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \
+ r <<= X##_e - _FP_WFRACBITS_##fs; \
+ } \
+ else \
+ { \
+ if (X##_e >= _FP_WFRACBITS_##fs) \
+ _FP_FRAC_SLL_##wc(X, (X##_e - _FP_WFRACBITS_##fs + 1)); \
+ else if (X##_e < _FP_WFRACBITS_##fs - 1) \
+ { \
+ _FP_FRAC_SRS_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 2), \
+ _FP_WFRACBITS_##fs); \
+ if (_FP_FRAC_LOW_##wc(X) & 1) \
+ FP_SET_EXCEPTION(FP_EX_INEXACT); \
+ _FP_FRAC_SRL_##wc(X, 1); \
+ } \
+ _FP_FRAC_ASSEMBLE_##wc(r, X, rsize); \
+ } \
+ if (rsigned && X##_s) \
+ r = -r; \
+ } \
+ break; \
+ } \
+ } while (0)
+
+#define _FP_FROM_INT(fs, wc, X, r, rsize, rtype) \
+ do { \
+ if (r) \
+ { \
+ X##_c = FP_CLS_NORMAL; \
+ \
+ if ((X##_s = (r < 0))) \
+ r = -r; \
+ \
+ if (rsize <= _FP_W_TYPE_SIZE) \
+ __FP_CLZ(X##_e, r); \
+ else \
+ __FP_CLZ_2(X##_e, (_FP_W_TYPE)(r >> _FP_W_TYPE_SIZE), \
+ (_FP_W_TYPE)r); \
+ if (rsize < _FP_W_TYPE_SIZE) \
+ X##_e -= (_FP_W_TYPE_SIZE - rsize); \
+ X##_e = rsize - X##_e - 1; \
+ \
+ if (_FP_FRACBITS_##fs < rsize && _FP_WFRACBITS_##fs < X##_e) \
+ __FP_FRAC_SRS_1(r, (X##_e - _FP_WFRACBITS_##fs), rsize); \
+ r &= ~((rtype)1 << X##_e); \
+ _FP_FRAC_DISASSEMBLE_##wc(X, ((unsigned rtype)r), rsize); \
+ _FP_FRAC_SLL_##wc(X, (_FP_WFRACBITS_##fs - X##_e - 1)); \
+ } \
+ else \
+ { \
+ X##_c = FP_CLS_ZERO, X##_s = 0; \
+ } \
+ } while (0)
+
+
+#define FP_CONV(dfs,sfs,dwc,swc,D,S) \
+ do { \
+ _FP_FRAC_CONV_##dwc##_##swc(dfs, sfs, D, S); \
+ D##_e = S##_e; \
+ D##_c = S##_c; \
+ D##_s = S##_s; \
+ } while (0)
+
+/*
+ * Helper primitives.
+ */
+
+/* Count leading zeros in a word. */
+
+#ifndef __FP_CLZ
+#if _FP_W_TYPE_SIZE < 64
+/* this is just to shut the compiler up about shifts > word length -- PMM 02/1998 */
+#define __FP_CLZ(r, x) \
+ do { \
+ _FP_W_TYPE _t = (x); \
+ r = _FP_W_TYPE_SIZE - 1; \
+ if (_t > 0xffff) r -= 16; \
+ if (_t > 0xffff) _t >>= 16; \
+ if (_t > 0xff) r -= 8; \
+ if (_t > 0xff) _t >>= 8; \
+ if (_t & 0xf0) r -= 4; \
+ if (_t & 0xf0) _t >>= 4; \
+ if (_t & 0xc) r -= 2; \
+ if (_t & 0xc) _t >>= 2; \
+ if (_t & 0x2) r -= 1; \
+ } while (0)
+#else /* not _FP_W_TYPE_SIZE < 64 */
+#define __FP_CLZ(r, x) \
+ do { \
+ _FP_W_TYPE _t = (x); \
+ r = _FP_W_TYPE_SIZE - 1; \
+ if (_t > 0xffffffff) r -= 32; \
+ if (_t > 0xffffffff) _t >>= 32; \
+ if (_t > 0xffff) r -= 16; \
+ if (_t > 0xffff) _t >>= 16; \
+ if (_t > 0xff) r -= 8; \
+ if (_t > 0xff) _t >>= 8; \
+ if (_t & 0xf0) r -= 4; \
+ if (_t & 0xf0) _t >>= 4; \
+ if (_t & 0xc) r -= 2; \
+ if (_t & 0xc) _t >>= 2; \
+ if (_t & 0x2) r -= 1; \
+ } while (0)
+#endif /* not _FP_W_TYPE_SIZE < 64 */
+#endif /* ndef __FP_CLZ */
+
+#define _FP_DIV_HELP_imm(q, r, n, d) \
+ do { \
+ q = n / d, r = n % d; \
+ } while (0)
+
diff --git a/include/math-emu/quad.h b/include/math-emu/quad.h
new file mode 100644
index 000000000..92a1e2b48
--- /dev/null
+++ b/include/math-emu/quad.h
@@ -0,0 +1,201 @@
+/* Software floating-point emulation.
+ Definitions for IEEE Quad Precision.
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz),
+ David S. Miller (davem@redhat.com) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if _FP_W_TYPE_SIZE < 32
+#error "Here's a nickel, kid. Go buy yourself a real computer."
+#endif
+
+#if _FP_W_TYPE_SIZE < 64
+#define _FP_FRACTBITS_Q (4*_FP_W_TYPE_SIZE)
+#else
+#define _FP_FRACTBITS_Q (2*_FP_W_TYPE_SIZE)
+#endif
+
+#define _FP_FRACBITS_Q 113
+#define _FP_FRACXBITS_Q (_FP_FRACTBITS_Q - _FP_FRACBITS_Q)
+#define _FP_WFRACBITS_Q (_FP_WORKBITS + _FP_FRACBITS_Q)
+#define _FP_WFRACXBITS_Q (_FP_FRACTBITS_Q - _FP_WFRACBITS_Q)
+#define _FP_EXPBITS_Q 15
+#define _FP_EXPBIAS_Q 16383
+#define _FP_EXPMAX_Q 32767
+
+#define _FP_QNANBIT_Q \
+ ((_FP_W_TYPE)1 << (_FP_FRACBITS_Q-2) % _FP_W_TYPE_SIZE)
+#define _FP_IMPLBIT_Q \
+ ((_FP_W_TYPE)1 << (_FP_FRACBITS_Q-1) % _FP_W_TYPE_SIZE)
+#define _FP_OVERFLOW_Q \
+ ((_FP_W_TYPE)1 << (_FP_WFRACBITS_Q % _FP_W_TYPE_SIZE))
+
+#if _FP_W_TYPE_SIZE < 64
+
+union _FP_UNION_Q
+{
+ long double flt;
+ struct
+ {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned sign : 1;
+ unsigned exp : _FP_EXPBITS_Q;
+ unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
+ unsigned long frac2 : _FP_W_TYPE_SIZE;
+ unsigned long frac1 : _FP_W_TYPE_SIZE;
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+#else
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+ unsigned long frac1 : _FP_W_TYPE_SIZE;
+ unsigned long frac2 : _FP_W_TYPE_SIZE;
+ unsigned long frac3 : _FP_FRACBITS_Q - (_FP_IMPLBIT_Q != 0)-(_FP_W_TYPE_SIZE * 3);
+ unsigned exp : _FP_EXPBITS_Q;
+ unsigned sign : 1;
+#endif /* not bigendian */
+ } bits __attribute__((packed));
+};
+
+
+#define FP_DECL_Q(X) _FP_DECL(4,X)
+#define FP_UNPACK_RAW_Q(X,val) _FP_UNPACK_RAW_4(Q,X,val)
+#define FP_UNPACK_RAW_QP(X,val) _FP_UNPACK_RAW_4_P(Q,X,val)
+#define FP_PACK_RAW_Q(val,X) _FP_PACK_RAW_4(Q,val,X)
+#define FP_PACK_RAW_QP(val,X) \
+ do { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_4_P(Q,val,X); \
+ } while (0)
+
+#define FP_UNPACK_Q(X,val) \
+ do { \
+ _FP_UNPACK_RAW_4(Q,X,val); \
+ _FP_UNPACK_CANONICAL(Q,4,X); \
+ } while (0)
+
+#define FP_UNPACK_QP(X,val) \
+ do { \
+ _FP_UNPACK_RAW_4_P(Q,X,val); \
+ _FP_UNPACK_CANONICAL(Q,4,X); \
+ } while (0)
+
+#define FP_PACK_Q(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(Q,4,X); \
+ _FP_PACK_RAW_4(Q,val,X); \
+ } while (0)
+
+#define FP_PACK_QP(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(Q,4,X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_4_P(Q,val,X); \
+ } while (0)
+
+#define FP_ISSIGNAN_Q(X) _FP_ISSIGNAN(Q,4,X)
+#define FP_NEG_Q(R,X) _FP_NEG(Q,4,R,X)
+#define FP_ADD_Q(R,X,Y) _FP_ADD(Q,4,R,X,Y)
+#define FP_SUB_Q(R,X,Y) _FP_SUB(Q,4,R,X,Y)
+#define FP_MUL_Q(R,X,Y) _FP_MUL(Q,4,R,X,Y)
+#define FP_DIV_Q(R,X,Y) _FP_DIV(Q,4,R,X,Y)
+#define FP_SQRT_Q(R,X) _FP_SQRT(Q,4,R,X)
+#define _FP_SQRT_MEAT_Q(R,S,T,X,Q) _FP_SQRT_MEAT_4(R,S,T,X,Q)
+
+#define FP_CMP_Q(r,X,Y,un) _FP_CMP(Q,4,r,X,Y,un)
+#define FP_CMP_EQ_Q(r,X,Y) _FP_CMP_EQ(Q,4,r,X,Y)
+
+#define FP_TO_INT_Q(r,X,rsz,rsg) _FP_TO_INT(Q,4,r,X,rsz,rsg)
+#define FP_FROM_INT_Q(X,r,rs,rt) _FP_FROM_INT(Q,4,X,r,rs,rt)
+
+#define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_4(X)
+#define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_4(X)
+
+#else /* not _FP_W_TYPE_SIZE < 64 */
+union _FP_UNION_Q
+{
+ long double flt /* __attribute__((mode(TF))) */ ;
+ struct {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned sign : 1;
+ unsigned exp : _FP_EXPBITS_Q;
+ unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+#else
+ unsigned long frac0 : _FP_W_TYPE_SIZE;
+ unsigned long frac1 : _FP_FRACBITS_Q-(_FP_IMPLBIT_Q != 0)-_FP_W_TYPE_SIZE;
+ unsigned exp : _FP_EXPBITS_Q;
+ unsigned sign : 1;
+#endif
+ } bits;
+};
+
+#define FP_DECL_Q(X) _FP_DECL(2,X)
+#define FP_UNPACK_RAW_Q(X,val) _FP_UNPACK_RAW_2(Q,X,val)
+#define FP_UNPACK_RAW_QP(X,val) _FP_UNPACK_RAW_2_P(Q,X,val)
+#define FP_PACK_RAW_Q(val,X) _FP_PACK_RAW_2(Q,val,X)
+#define FP_PACK_RAW_QP(val,X) \
+ do { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P(Q,val,X); \
+ } while (0)
+
+#define FP_UNPACK_Q(X,val) \
+ do { \
+ _FP_UNPACK_RAW_2(Q,X,val); \
+ _FP_UNPACK_CANONICAL(Q,2,X); \
+ } while (0)
+
+#define FP_UNPACK_QP(X,val) \
+ do { \
+ _FP_UNPACK_RAW_2_P(Q,X,val); \
+ _FP_UNPACK_CANONICAL(Q,2,X); \
+ } while (0)
+
+#define FP_PACK_Q(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(Q,2,X); \
+ _FP_PACK_RAW_2(Q,val,X); \
+ } while (0)
+
+#define FP_PACK_QP(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(Q,2,X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_2_P(Q,val,X); \
+ } while (0)
+
+#define FP_ISSIGNAN_Q(X) _FP_ISSIGNAN(Q,2,X)
+#define FP_NEG_Q(R,X) _FP_NEG(Q,2,R,X)
+#define FP_ADD_Q(R,X,Y) _FP_ADD(Q,2,R,X,Y)
+#define FP_SUB_Q(R,X,Y) _FP_SUB(Q,2,R,X,Y)
+#define FP_MUL_Q(R,X,Y) _FP_MUL(Q,2,R,X,Y)
+#define FP_DIV_Q(R,X,Y) _FP_DIV(Q,2,R,X,Y)
+#define FP_SQRT_Q(R,X) _FP_SQRT(Q,2,R,X)
+#define _FP_SQRT_MEAT_Q(R,S,T,X,Q) _FP_SQRT_MEAT_2(R,S,T,X,Q)
+
+#define FP_CMP_Q(r,X,Y,un) _FP_CMP(Q,2,r,X,Y,un)
+#define FP_CMP_EQ_Q(r,X,Y) _FP_CMP_EQ(Q,2,r,X,Y)
+
+#define FP_TO_INT_Q(r,X,rsz,rsg) _FP_TO_INT(Q,2,r,X,rsz,rsg)
+#define FP_FROM_INT_Q(X,r,rs,rt) _FP_FROM_INT(Q,2,X,r,rs,rt)
+
+#define _FP_FRAC_HIGH_Q(X) _FP_FRAC_HIGH_2(X)
+#define _FP_FRAC_HIGH_RAW_Q(X) _FP_FRAC_HIGH_2(X)
+
+#endif /* not _FP_W_TYPE_SIZE < 64 */
diff --git a/include/math-emu/single.h b/include/math-emu/single.h
new file mode 100644
index 000000000..6504e5283
--- /dev/null
+++ b/include/math-emu/single.h
@@ -0,0 +1,110 @@
+/* Software floating-point emulation.
+ Definitions for IEEE Single Precision.
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz),
+ David S. Miller (davem@redhat.com) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if _FP_W_TYPE_SIZE < 32
+#error "Here's a nickel kid. Go buy yourself a real computer."
+#endif
+
+#define _FP_FRACBITS_S 24
+#define _FP_FRACXBITS_S (_FP_W_TYPE_SIZE - _FP_FRACBITS_S)
+#define _FP_WFRACBITS_S (_FP_WORKBITS + _FP_FRACBITS_S)
+#define _FP_WFRACXBITS_S (_FP_W_TYPE_SIZE - _FP_WFRACBITS_S)
+#define _FP_EXPBITS_S 8
+#define _FP_EXPBIAS_S 127
+#define _FP_EXPMAX_S 255
+#define _FP_QNANBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-2))
+#define _FP_IMPLBIT_S ((_FP_W_TYPE)1 << (_FP_FRACBITS_S-1))
+#define _FP_OVERFLOW_S ((_FP_W_TYPE)1 << (_FP_WFRACBITS_S))
+
+/* The implementation of _FP_MUL_MEAT_S and _FP_DIV_MEAT_S should be
+ chosen by the target machine. */
+
+union _FP_UNION_S
+{
+ float flt;
+ struct {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned sign : 1;
+ unsigned exp : _FP_EXPBITS_S;
+ unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
+#else
+ unsigned frac : _FP_FRACBITS_S - (_FP_IMPLBIT_S != 0);
+ unsigned exp : _FP_EXPBITS_S;
+ unsigned sign : 1;
+#endif
+ } bits __attribute__((packed));
+};
+
+#define FP_DECL_S(X) _FP_DECL(1,X)
+#define FP_UNPACK_RAW_S(X,val) _FP_UNPACK_RAW_1(S,X,val)
+#define FP_UNPACK_RAW_SP(X,val) _FP_UNPACK_RAW_1_P(S,X,val)
+#define FP_PACK_RAW_S(val,X) _FP_PACK_RAW_1(S,val,X)
+#define FP_PACK_RAW_SP(val,X) \
+ do { \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P(S,val,X); \
+ } while (0)
+
+#define FP_UNPACK_S(X,val) \
+ do { \
+ _FP_UNPACK_RAW_1(S,X,val); \
+ _FP_UNPACK_CANONICAL(S,1,X); \
+ } while (0)
+
+#define FP_UNPACK_SP(X,val) \
+ do { \
+ _FP_UNPACK_RAW_1_P(S,X,val); \
+ _FP_UNPACK_CANONICAL(S,1,X); \
+ } while (0)
+
+#define FP_PACK_S(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(S,1,X); \
+ _FP_PACK_RAW_1(S,val,X); \
+ } while (0)
+
+#define FP_PACK_SP(val,X) \
+ do { \
+ _FP_PACK_CANONICAL(S,1,X); \
+ if (!FP_INHIBIT_RESULTS) \
+ _FP_PACK_RAW_1_P(S,val,X); \
+ } while (0)
+
+#define FP_ISSIGNAN_S(X) _FP_ISSIGNAN(S,1,X)
+#define FP_NEG_S(R,X) _FP_NEG(S,1,R,X)
+#define FP_ADD_S(R,X,Y) _FP_ADD(S,1,R,X,Y)
+#define FP_SUB_S(R,X,Y) _FP_SUB(S,1,R,X,Y)
+#define FP_MUL_S(R,X,Y) _FP_MUL(S,1,R,X,Y)
+#define FP_DIV_S(R,X,Y) _FP_DIV(S,1,R,X,Y)
+#define FP_SQRT_S(R,X) _FP_SQRT(S,1,R,X)
+#define _FP_SQRT_MEAT_S(R,S,T,X,Q) _FP_SQRT_MEAT_1(R,S,T,X,Q)
+
+#define FP_CMP_S(r,X,Y,un) _FP_CMP(S,1,r,X,Y,un)
+#define FP_CMP_EQ_S(r,X,Y) _FP_CMP_EQ(S,1,r,X,Y)
+
+#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
+#define FP_FROM_INT_S(X,r,rs,rt) _FP_FROM_INT(S,1,X,r,rs,rt)
+
+#define _FP_FRAC_HIGH_S(X) _FP_FRAC_HIGH_1(X)
+#define _FP_FRAC_HIGH_RAW_S(X) _FP_FRAC_HIGH_1(X)
diff --git a/include/math-emu/soft-fp.h b/include/math-emu/soft-fp.h
new file mode 100644
index 000000000..3c5072e51
--- /dev/null
+++ b/include/math-emu/soft-fp.h
@@ -0,0 +1,176 @@
+/* Software floating-point emulation.
+ Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Richard Henderson (rth@cygnus.com),
+ Jakub Jelinek (jj@ultra.linux.cz),
+ David S. Miller (davem@redhat.com) and
+ Peter Maydell (pmaydell@chiark.greenend.org.uk).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, write to the Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef SOFT_FP_H
+#define SOFT_FP_H
+
+#include "sfp-machine.h"
+
+/* Allow sfp-machine to have its own byte order definitions. */
+#ifndef __BYTE_ORDER
+#include <endian.h>
+#endif
+
+#define _FP_WORKBITS 3
+#define _FP_WORK_LSB ((_FP_W_TYPE)1 << 3)
+#define _FP_WORK_ROUND ((_FP_W_TYPE)1 << 2)
+#define _FP_WORK_GUARD ((_FP_W_TYPE)1 << 1)
+#define _FP_WORK_STICKY ((_FP_W_TYPE)1 << 0)
+
+#ifndef FP_RND_NEAREST
+# define FP_RND_NEAREST 0
+# define FP_RND_ZERO 1
+# define FP_RND_PINF 2
+# define FP_RND_MINF 3
+#ifndef FP_ROUNDMODE
+# define FP_ROUNDMODE FP_RND_NEAREST
+#endif
+#endif
+
+/* By default don't care about exceptions. */
+#ifndef FP_EX_INVALID
+#define FP_EX_INVALID 0
+#endif
+#ifndef FP_EX_OVERFLOW
+#define FP_EX_OVERFLOW 0
+#endif
+#ifndef FP_EX_UNDERFLOW
+#define FP_EX_UNDERFLOW
+#endif
+#ifndef FP_EX_DIVZERO
+#define FP_EX_DIVZERO 0
+#endif
+#ifndef FP_EX_INEXACT
+#define FP_EX_INEXACT 0
+#endif
+#ifndef FP_EX_DENORM
+#define FP_EX_DENORM 0
+#endif
+
+#ifdef _FP_DECL_EX
+#define FP_DECL_EX \
+ int _fex = 0; \
+ _FP_DECL_EX
+#else
+#define FP_DECL_EX int _fex = 0
+#endif
+
+#ifndef FP_INIT_ROUNDMODE
+#define FP_INIT_ROUNDMODE do {} while (0)
+#endif
+
+#ifndef FP_HANDLE_EXCEPTIONS
+#define FP_HANDLE_EXCEPTIONS do {} while (0)
+#endif
+
+#ifndef FP_INHIBIT_RESULTS
+/* By default we write the results always.
+ * sfp-machine may override this and e.g.
+ * check if some exceptions are unmasked
+ * and inhibit it in such a case.
+ */
+#define FP_INHIBIT_RESULTS 0
+#endif
+
+#define FP_SET_EXCEPTION(ex) \
+ _fex |= (ex)
+
+#define FP_UNSET_EXCEPTION(ex) \
+ _fex &= ~(ex)
+
+#define FP_CLEAR_EXCEPTIONS \
+ _fex = 0
+
+#define _FP_ROUND_NEAREST(wc, X) \
+do { \
+ if ((_FP_FRAC_LOW_##wc(X) & 15) != _FP_WORK_ROUND) \
+ _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \
+} while (0)
+
+#define _FP_ROUND_ZERO(wc, X) 0
+
+#define _FP_ROUND_PINF(wc, X) \
+do { \
+ if (!X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
+ _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
+} while (0)
+
+#define _FP_ROUND_MINF(wc, X) \
+do { \
+ if (X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
+ _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
+} while (0)
+
+#define _FP_ROUND(wc, X) \
+do { \
+ if (_FP_FRAC_LOW_##wc(X) & 7) \
+ FP_SET_EXCEPTION(FP_EX_INEXACT); \
+ switch (FP_ROUNDMODE) \
+ { \
+ case FP_RND_NEAREST: \
+ _FP_ROUND_NEAREST(wc,X); \
+ break; \
+ case FP_RND_ZERO: \
+ _FP_ROUND_ZERO(wc,X); \
+ break; \
+ case FP_RND_PINF: \
+ _FP_ROUND_PINF(wc,X); \
+ break; \
+ case FP_RND_MINF: \
+ _FP_ROUND_MINF(wc,X); \
+ break; \
+ } \
+} while (0)
+
+#define FP_CLS_NORMAL 0
+#define FP_CLS_ZERO 1
+#define FP_CLS_INF 2
+#define FP_CLS_NAN 3
+
+#define _FP_CLS_COMBINE(x,y) (((x) << 2) | (y))
+
+#include "op-1.h"
+#include "op-2.h"
+#include "op-4.h"
+#include "op-8.h"
+#include "op-common.h"
+
+/* Sigh. Silly things longlong.h needs. */
+#define UWtype _FP_W_TYPE
+#define W_TYPE_SIZE _FP_W_TYPE_SIZE
+
+typedef int SItype __attribute__((mode(SI)));
+typedef int DItype __attribute__((mode(DI)));
+typedef unsigned int USItype __attribute__((mode(SI)));
+typedef unsigned int UDItype __attribute__((mode(DI)));
+#if _FP_W_TYPE_SIZE == 32
+typedef unsigned int UHWtype __attribute__((mode(HI)));
+#elif _FP_W_TYPE_SIZE == 64
+typedef USItype UHWtype;
+#endif
+
+#ifndef umul_ppmm
+#include <stdlib/longlong.h>
+#endif
+
+#endif
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 730fe97b4..6a5b87ee6 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -51,12 +51,14 @@ extern int addrconf_add_ifaddr(void *arg);
extern int addrconf_del_ifaddr(void *arg);
extern int addrconf_set_dstaddr(void *arg);
-extern struct inet6_ifaddr * ipv6_chk_addr(struct in6_addr *addr,
- struct device *dev, int nd);
+extern int ipv6_chk_addr(struct in6_addr *addr,
+ struct net_device *dev);
+extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr,
+ struct net_device *dev);
extern int ipv6_get_saddr(struct dst_entry *dst,
struct in6_addr *daddr,
struct in6_addr *saddr);
-extern int ipv6_get_lladdr(struct device *dev, struct in6_addr *);
+extern int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *);
/*
* multicast prototypes (mcast.c)
@@ -70,22 +72,65 @@ extern int ipv6_sock_mc_drop(struct sock *sk,
extern void ipv6_sock_mc_close(struct sock *sk);
extern int inet6_mc_check(struct sock *sk, struct in6_addr *addr);
-extern int ipv6_dev_mc_inc(struct device *dev,
+extern int ipv6_dev_mc_inc(struct net_device *dev,
struct in6_addr *addr);
-extern int ipv6_dev_mc_dec(struct device *dev,
+extern int ipv6_dev_mc_dec(struct net_device *dev,
struct in6_addr *addr);
extern void ipv6_mc_up(struct inet6_dev *idev);
extern void ipv6_mc_down(struct inet6_dev *idev);
extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
-extern int ipv6_chk_mcast_addr(struct device *dev,
+extern int ipv6_chk_mcast_addr(struct net_device *dev,
struct in6_addr *addr);
-extern void addrconf_prefix_rcv(struct device *dev,
+extern void addrconf_prefix_rcv(struct net_device *dev,
u8 *opt, int len);
-extern struct inet6_dev * ipv6_get_idev(struct device *dev);
+extern __inline__ struct inet6_dev *
+__in6_dev_get(struct net_device *dev)
+{
+ return (struct inet6_dev *)dev->ip6_ptr;
+}
+
+extern rwlock_t addrconf_lock;
+
+extern __inline__ struct inet6_dev *
+in6_dev_get(struct net_device *dev)
+{
+ struct inet6_dev *idev = NULL;
+ read_lock(&addrconf_lock);
+ idev = dev->ip6_ptr;
+ if (idev)
+ atomic_inc(&idev->refcnt);
+ read_unlock(&addrconf_lock);
+ return idev;
+}
+
+extern void in6_dev_finish_destroy(struct inet6_dev *idev);
+
+extern __inline__ void
+in6_dev_put(struct inet6_dev *idev)
+{
+ if (atomic_dec_and_test(&idev->refcnt))
+ in6_dev_finish_destroy(idev);
+}
+
+#define __in6_dev_put(idev) atomic_dec(&(idev)->refcnt)
+#define in6_dev_hold(idev) atomic_inc(&(idev)->refcnt)
+
+
+extern void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp);
+
+extern __inline__ void in6_ifa_put(struct inet6_ifaddr *ifp)
+{
+ if (atomic_dec_and_test(&ifp->refcnt))
+ inet6_ifa_finish_destroy(ifp);
+}
+
+#define __in6_ifa_put(idev) atomic_dec(&(idev)->refcnt)
+#define in6_ifa_hold(idev) atomic_inc(&(idev)->refcnt)
+
extern void addrconf_forwarding_on(void);
/*
@@ -95,7 +140,6 @@ extern void addrconf_forwarding_on(void);
static __inline__ u8 ipv6_addr_hash(struct in6_addr *addr)
{
__u32 word;
- unsigned tmp;
/*
* We perform the hash function over the last 64 bits of the address
@@ -103,15 +147,10 @@ static __inline__ u8 ipv6_addr_hash(struct in6_addr *addr)
*/
word = addr->s6_addr[2] ^ addr->s6_addr32[3];
- tmp = word ^ (word>>16);
- tmp ^= (tmp >> 8);
+ word ^= (word>>16);
+ word ^= (word >> 8);
- return ((tmp ^ (tmp >> 4)) & 0x0f);
-}
-
-static __inline__ int ipv6_devindex_hash(int ifindex)
-{
- return ifindex & (IN6_ADDR_HSIZE - 1);
+ return ((word ^ (word >> 4)) & 0x0f);
}
/*
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 06970ac67..f8603212a 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -7,9 +7,13 @@ extern void unix_notinflight(struct file *fp);
typedef struct sock unix_socket;
extern void unix_gc(void);
-#define UNIX_HASH_SIZE 16
+#define UNIX_HASH_SIZE 256
extern unix_socket *unix_socket_table[UNIX_HASH_SIZE+1];
+extern rwlock_t unix_table_lock;
+
+extern atomic_t unix_tot_inflight;
+
#define forall_unix_sockets(i, s) for (i=0; i<=UNIX_HASH_SIZE; i++) \
for (s=unix_socket_table[i]; s; s=s->next)
@@ -26,10 +30,14 @@ struct unix_skb_parms
{
struct ucred creds; /* Skb credentials */
struct scm_fp_list *fp; /* Passed files */
- unsigned attr; /* Special attributes */
};
#define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb))
#define UNIXCREDS(skb) (&UNIXCB((skb)).creds)
+#define unix_state_rlock(s) read_lock(&(s)->protinfo.af_unix.lock)
+#define unix_state_runlock(s) read_unlock(&(s)->protinfo.af_unix.lock)
+#define unix_state_wlock(s) write_lock(&(s)->protinfo.af_unix.lock)
+#define unix_state_wunlock(s) write_unlock(&(s)->protinfo.af_unix.lock)
+
#endif
diff --git a/include/net/arp.h b/include/net/arp.h
index b672bacb6..f65d245f4 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -8,16 +8,16 @@
extern struct neigh_table arp_tbl;
extern void arp_init(void);
-extern int arp_rcv(struct sk_buff *skb, struct device *dev,
+extern int arp_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt);
extern int arp_find(unsigned char *haddr, struct sk_buff *skb);
extern int arp_ioctl(unsigned int cmd, void *arg);
extern void arp_send(int type, int ptype, u32 dest_ip,
- struct device *dev, u32 src_ip,
+ struct net_device *dev, u32 src_ip,
unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th);
extern int arp_bind_neighbour(struct dst_entry *dst);
-extern int arp_mc_map(u32 addr, u8 *haddr, struct device *dev, int dir);
-extern void arp_ifdown(struct device *dev);
+extern int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir);
+extern void arp_ifdown(struct net_device *dev);
extern struct neigh_ops arp_broken_ops;
diff --git a/include/net/atmclip.h b/include/net/atmclip.h
new file mode 100644
index 000000000..f350c3103
--- /dev/null
+++ b/include/net/atmclip.h
@@ -0,0 +1,63 @@
+/* net/atm/atmarp.h - RFC1577 ATM ARP */
+
+/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */
+
+
+#ifndef _ATMCLIP_H
+#define _ATMCLIP_H
+
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/atm.h>
+#include <linux/atmdev.h>
+#include <linux/atmarp.h>
+#include <net/neighbour.h>
+
+
+#define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back))
+#define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key)
+
+
+struct clip_vcc {
+ struct atm_vcc *vcc; /* VCC descriptor */
+ struct atmarp_entry *entry; /* ATMARP table entry, NULL if IP addr.
+ isn't known yet */
+ unsigned char encap; /* 0: NULL, 1: LLC/SNAP */
+ unsigned long last_use; /* last send or receive operation */
+ unsigned long idle_timeout; /* keep open idle for so many jiffies*/
+ void (*old_push)(struct atm_vcc *vcc,struct sk_buff *skb);
+ /* keep old push fn for detaching */
+ struct clip_vcc *next; /* next VCC */
+};
+
+
+struct atmarp_entry {
+ u32 ip; /* IP address */
+ struct clip_vcc *vccs; /* active VCCs; NULL if resolution is
+ pending */
+ unsigned long expires; /* entry expiration time */
+ struct neighbour *neigh; /* neighbour back-pointer */
+};
+
+
+#define PRIV(dev) ((struct clip_priv *) ((struct net_device *) (dev)+1))
+
+
+struct clip_priv {
+ char name[8]; /* interface name */
+ int number; /* for convenience ... */
+ struct net_device_stats stats;
+ struct net_device *next; /* next CLIP interface */
+};
+
+
+extern struct atm_vcc *atmarpd; /* ugly */
+extern struct neigh_table clip_tbl;
+
+int clip_create(int number);
+int clip_mkip(struct atm_vcc *vcc,int timeout);
+int clip_setentry(struct atm_vcc *vcc,u32 ip);
+int clip_encap(struct atm_vcc *vcc,int mode);
+void atm_clip_init(void);
+
+#endif
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 2c8d20a62..96780fc1f 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -148,7 +148,7 @@ typedef struct {
typedef struct ax25_route {
struct ax25_route *next;
ax25_address callsign;
- struct device *dev;
+ struct net_device *dev;
ax25_digi *digipeat;
char ip_mode;
} ax25_route;
@@ -165,8 +165,8 @@ typedef struct {
typedef struct ax25_dev {
struct ax25_dev *next;
- struct device *dev;
- struct device *forward;
+ struct net_device *dev;
+ struct net_device *forward;
struct ctl_table systable[AX25_MAX_VALUES+1];
int values[AX25_MAX_VALUES];
#if defined(CONFIG_AX25_DAMA_SLAVE) || defined(CONFIG_AX25_DAMA_MASTER)
@@ -200,9 +200,9 @@ typedef struct ax25_cb {
extern ax25_cb *volatile ax25_list;
extern void ax25_free_cb(ax25_cb *);
extern void ax25_insert_socket(ax25_cb *);
-struct sock *ax25_find_listener(ax25_address *, int, struct device *, int);
+struct sock *ax25_find_listener(ax25_address *, int, struct net_device *, int);
struct sock *ax25_find_socket(ax25_address *, ax25_address *, int);
-extern ax25_cb *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *, struct device *);
+extern ax25_cb *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *, struct net_device *);
extern struct sock *ax25_addr_match(ax25_address *);
extern void ax25_send_to_raw(struct sock *, struct sk_buff *, int);
extern void ax25_destroy_socket(ax25_cb *);
@@ -224,12 +224,12 @@ extern void ax25_digi_invert(ax25_digi *, ax25_digi *);
/* ax25_dev.c */
extern ax25_dev *ax25_dev_list;
-extern ax25_dev *ax25_dev_ax25dev(struct device *);
+extern ax25_dev *ax25_dev_ax25dev(struct net_device *);
extern ax25_dev *ax25_addr_ax25dev(ax25_address *);
-extern void ax25_dev_device_up(struct device *);
-extern void ax25_dev_device_down(struct device *);
+extern void ax25_dev_device_up(struct net_device *);
+extern void ax25_dev_device_down(struct net_device *);
extern int ax25_fwd_ioctl(unsigned int, struct ax25_fwd_struct *);
-extern struct device *ax25_fwd_dev(struct device *);
+extern struct net_device *ax25_fwd_dev(struct net_device *);
extern void ax25_dev_free(void);
/* ax25_ds_in.c */
@@ -260,23 +260,23 @@ extern int ax25_protocol_register(unsigned int, int (*)(struct sk_buff *, ax25_
extern void ax25_protocol_release(unsigned int);
extern int ax25_linkfail_register(void (*)(ax25_cb *, int));
extern void ax25_linkfail_release(void (*)(ax25_cb *, int));
-extern int ax25_listen_register(ax25_address *, struct device *);
-extern void ax25_listen_release(ax25_address *, struct device *);
+extern int ax25_listen_register(ax25_address *, struct net_device *);
+extern void ax25_listen_release(ax25_address *, struct net_device *);
extern int (*ax25_protocol_function(unsigned int))(struct sk_buff *, ax25_cb *);
-extern int ax25_listen_mine(ax25_address *, struct device *);
+extern int ax25_listen_mine(ax25_address *, struct net_device *);
extern void ax25_link_failed(ax25_cb *, int);
extern int ax25_protocol_is_registered(unsigned int);
/* ax25_in.c */
extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *);
-extern int ax25_kiss_rcv(struct sk_buff *, struct device *, struct packet_type *);
+extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *);
/* ax25_ip.c */
-extern int ax25_encapsulate(struct sk_buff *, struct device *, unsigned short, void *, void *, unsigned int);
+extern int ax25_encapsulate(struct sk_buff *, struct net_device *, unsigned short, void *, void *, unsigned int);
extern int ax25_rebuild_header(struct sk_buff *);
/* ax25_out.c */
-extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct device *);
+extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct net_device *);
extern void ax25_output(ax25_cb *, int, struct sk_buff *);
extern void ax25_kick(ax25_cb *);
extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int);
@@ -284,11 +284,11 @@ extern void ax25_queue_xmit(struct sk_buff *);
extern int ax25_check_iframes_acked(ax25_cb *, unsigned short);
/* ax25_route.c */
-extern void ax25_rt_device_down(struct device *);
+extern void ax25_rt_device_down(struct net_device *);
extern int ax25_rt_ioctl(unsigned int, void *);
extern int ax25_rt_get_info(char *, char **, off_t, int, int);
extern int ax25_rt_autobind(ax25_cb *, ax25_address *);
-extern ax25_route *ax25_rt_find_route(ax25_address *, struct device *);
+extern ax25_route *ax25_rt_find_route(ax25_address *, struct net_device *);
extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *);
extern void ax25_rt_free(void);
@@ -316,7 +316,7 @@ extern void ax25_requeue_frames(ax25_cb *);
extern int ax25_validate_nr(ax25_cb *, unsigned short);
extern int ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *);
extern void ax25_send_control(ax25_cb *, int, int, int);
-extern void ax25_return_dm(struct device *, ax25_address *, ax25_address *, ax25_digi *);
+extern void ax25_return_dm(struct net_device *, ax25_address *, ax25_address *, ax25_digi *);
extern void ax25_calculate_t1(ax25_cb *);
extern void ax25_calculate_rtt(ax25_cb *);
extern void ax25_disconnect(ax25_cb *, int);
diff --git a/include/net/br.h b/include/net/br.h
index 1210b4e3e..82b79ca5d 100644
--- a/include/net/br.h
+++ b/include/net/br.h
@@ -42,7 +42,7 @@
/* broacast/multicast storm limitation. This per source. */
#define MAX_MCAST_PER_PERIOD 4
-#define MCAST_HOLD_TIME 10 /* in jiffies unit (10ms increment) */
+#define MCAST_HOLD_TIME (10*HZ/100)
#define Default_path_cost 10
@@ -160,7 +160,7 @@ typedef struct {
unsigned short designated_port; /* (4.5.5.7) */
unsigned int top_change_ack; /* (4.5.5.8) */
unsigned int config_pending; /* (4.5.5.9) */
- struct device *dev;
+ struct net_device *dev;
struct fdb *fdb; /* head of per port fdb chain */
} Port_data;
diff --git a/include/net/datalink.h b/include/net/datalink.h
index 44e56990c..d07c21afb 100644
--- a/include/net/datalink.h
+++ b/include/net/datalink.h
@@ -6,7 +6,7 @@ struct datalink_proto {
unsigned char type[8];
const char *string_name;
unsigned short header_length;
- int (*rcvfunc)(struct sk_buff *, struct device *,
+ int (*rcvfunc)(struct sk_buff *, struct net_device *,
struct packet_type *);
void (*datalink_header)(struct datalink_proto *, struct sk_buff *,
unsigned char *);
diff --git a/include/net/dn.h b/include/net/dn.h
index b2ad40426..dde6da176 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -46,6 +46,7 @@ struct dn_scp /* Session Control Port */
#define DN_NOCHANGE 0
unsigned char accept_mode;
unsigned short mss;
+ unsigned long seg_size; /* Running total of current segment */
struct optdata_dn conndata_in;
struct optdata_dn conndata_out;
@@ -181,7 +182,6 @@ static __inline__ void dn_dn2eth(unsigned char *ethaddr, dn_address addr)
extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr);
extern struct sock *dn_find_by_skb(struct sk_buff *skb);
-extern unsigned short dn_alloc_port(void);
#define DN_ASCBUF_LEN 7
extern char *dn_addr2asc(dn_address, char *);
extern void dn_destroy_sock(struct sock *sk);
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index cb9eda018..aae14d087 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -58,8 +58,6 @@ struct dn_ifaddr {
* down() - Called to turn device off when it goes down
* timer1() - Called when timer 1 goes off
* timer3() - Called when timer 3 goes off
- * setsrc() - Called for each incomming frame to set previous hop info
- * neigh_setup() - Called to do device specific setup of neighbours
*
* sysctl - Hook for sysctl things
*
@@ -79,19 +77,17 @@ struct dn_dev_parms {
int priority; /* Priority to be a router */
char *name; /* Name for sysctl */
int ctl_name; /* Index for sysctl */
- int (*up)(struct device *);
- void (*down)(struct device *);
- void (*timer1)(struct device *);
- void (*timer3)(struct device *);
- int (*setsrc)(struct sk_buff *skb);
- int (*neigh_setup)(struct neighbour *);
+ int (*up)(struct net_device *);
+ void (*down)(struct net_device *);
+ void (*timer1)(struct net_device *);
+ void (*timer3)(struct net_device *);
void *sysctl;
};
struct dn_dev {
struct dn_ifaddr *ifa_list;
- struct device *dev;
+ struct net_device *dev;
struct dn_dev_parms parms;
char use_long;
struct timer_list timer;
@@ -169,12 +165,12 @@ extern void dn_dev_init_pkt(struct sk_buff *skb);
extern void dn_dev_veri_pkt(struct sk_buff *skb);
extern void dn_dev_hello(struct sk_buff *skb);
-extern void dn_dev_up(struct device *);
-extern void dn_dev_down(struct device *);
+extern void dn_dev_up(struct net_device *);
+extern void dn_dev_down(struct net_device *);
-extern struct device *decnet_default_device;
+extern struct net_device *decnet_default_device;
-static __inline__ int dn_dev_islocal(struct device *dev, dn_address addr)
+static __inline__ int dn_dev_islocal(struct net_device *dev, dn_address addr)
{
struct dn_dev *dn_db = dev->dn_ptr;
struct dn_ifaddr *ifa;
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index d8118449c..360f2eba3 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -73,12 +73,12 @@ extern void dn_fib_cleanup(void);
extern int dn_fib_rt_message(struct sk_buff *skb);
extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
+extern int dn_fib_resolve(struct dn_fib_res *res);
#ifdef CONFIG_RTNETLINK
extern int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
extern int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
-extern int dn_fib_rtm_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
#endif /* CONFIG_RTNETLINK */
#endif /* CONFIG_DECNET_ROUTER */
diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h
index b4e7ed1d8..7a1be0265 100644
--- a/include/net/dn_neigh.h
+++ b/include/net/dn_neigh.h
@@ -7,7 +7,7 @@
*/
struct dn_neigh {
struct neighbour n;
- unsigned char addr[ETH_ALEN];
+ dn_address addr;
unsigned long flags;
#define DN_NDFLAG_R1 0x0001 /* Router L1 */
#define DN_NDFLAG_R2 0x0002 /* Router L2 */
@@ -22,7 +22,7 @@ extern struct neighbour *dn_neigh_lookup(struct neigh_table *tbl, void *ptr);
extern void dn_neigh_router_hello(struct sk_buff *skb);
extern void dn_neigh_endnode_hello(struct sk_buff *skb);
extern void dn_neigh_pointopoint_hello(struct sk_buff *skb);
-extern int dn_neigh_elist(struct device *dev, unsigned char *ptr, int n);
+extern int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n);
extern struct neigh_table dn_neigh_table;
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index ecd1f313b..793d59072 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -14,11 +14,11 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*******************************************************************************/
-/* dn_route.c functions prototyping */
-extern void dn_send_skb(struct sk_buff *);
-extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri);
-extern int dn_route_output(struct sock *sk);
+extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, int pri);
+extern int dn_route_output(struct dst_entry **pprt, dn_address dst, dn_address src, int flags);
+extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
+extern int dn_cache_getroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
/* Masks for flags field */
#define DN_RT_F_PID 0x07 /* Mask for packet type */
#define DN_RT_F_PF 0x80 /* Padding Follows */
@@ -71,4 +71,54 @@ struct dn_route {
extern void dn_route_init(void);
extern void dn_route_cleanup(void);
+#include <net/sock.h>
+#include <linux/if_arp.h>
+
+extern __inline__ void dn_rt_send(struct sk_buff *skb)
+{
+ dev_queue_xmit(skb);
+}
+
+extern __inline__ void dn_rt_finish_output(struct sk_buff *skb, char *dst)
+{
+ struct net_device *dev = skb->dev;
+
+ if ((dev->type != ARPHRD_ETHER) && (dev->type != ARPHRD_LOOPBACK))
+ dst = NULL;
+
+ if (!dev->hard_header || (dev->hard_header(skb, dev, ETH_P_DNA_RT,
+ dst, NULL, skb->len) >= 0))
+ dn_rt_send(skb);
+ else
+ kfree_skb(skb);
+}
+
+extern __inline__ void dn_nsp_send(struct sk_buff *skb)
+{
+ struct sock *sk = skb->sk;
+ struct dn_scp *scp = &sk->protinfo.dn;
+ struct dst_entry *dst;
+
+ skb->h.raw = skb->data;
+ scp->stamp = jiffies;
+
+ if ((dst = sk->dst_cache) && !dst->obsolete) {
+try_again:
+ skb->dst = dst_clone(dst);
+ dst->output(skb);
+ return;
+ }
+
+ dst_release(xchg(&sk->dst_cache, NULL));
+
+ if (dn_route_output(&sk->dst_cache, dn_saddr2dn(&scp->peer), dn_saddr2dn(&scp->addr), 0) == 0) {
+ dst = sk->dst_cache;
+ goto try_again;
+ }
+
+ sk->err = EHOSTUNREACH;
+ if (!sk->dead)
+ sk->state_change(sk);
+}
+
#endif /* _NET_DN_ROUTE_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index d34eb5079..79a3cd392 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -27,9 +27,9 @@ struct sk_buff;
struct dst_entry
{
struct dst_entry *next;
- atomic_t refcnt; /* tree/hash references */
- atomic_t use; /* client references */
- struct device *dev;
+ atomic_t __refcnt; /* client references */
+ int __use;
+ struct net_device *dev;
int obsolete;
unsigned long lastuse;
unsigned long expires;
@@ -37,6 +37,10 @@ struct dst_entry
unsigned pmtu;
unsigned window;
unsigned rtt;
+ unsigned rttvar;
+ unsigned ssthresh;
+ unsigned cwnd;
+ unsigned advmss;
unsigned long rate_last; /* rate limiting for ICMP */
unsigned long rate_tokens;
@@ -71,17 +75,24 @@ struct dst_ops
void (*destroy)(struct dst_entry *);
struct dst_entry * (*negative_advice)(struct dst_entry *);
void (*link_failure)(struct sk_buff *);
+ int entry_size;
atomic_t entries;
+ kmem_cache_t *kmem_cachep;
};
#ifdef __KERNEL__
+extern __inline__ void dst_hold(struct dst_entry * dst)
+{
+ atomic_inc(&dst->__refcnt);
+}
+
extern __inline__
struct dst_entry * dst_clone(struct dst_entry * dst)
{
if (dst)
- atomic_inc(&dst->use);
+ atomic_inc(&dst->__refcnt);
return dst;
}
@@ -89,42 +100,10 @@ extern __inline__
void dst_release(struct dst_entry * dst)
{
if (dst)
- atomic_dec(&dst->use);
-}
-
-/* The following primitive should be use if and only if
- destination entry has just been removed from a location
- accessed directly by hard irq.
- */
-extern __inline__
-void dst_release_irqwait(struct dst_entry * dst)
-{
- if (dst) {
- synchronize_irq();
- atomic_dec(&dst->use);
- }
-}
-
-extern __inline__
-struct dst_entry * dst_check(struct dst_entry ** dst_p, u32 cookie)
-{
- struct dst_entry * dst = *dst_p;
- if (dst && dst->obsolete)
- dst = dst->ops->check(dst, cookie);
- return (*dst_p = dst);
-}
-
-extern __inline__
-struct dst_entry * dst_reroute(struct dst_entry ** dst_p, struct sk_buff *skb)
-{
- struct dst_entry * dst = *dst_p;
- if (dst && dst->obsolete)
- dst = dst->ops->reroute(dst, skb);
- return (*dst_p = dst);
+ atomic_dec(&dst->__refcnt);
}
-
-extern void * dst_alloc(int size, struct dst_ops * ops);
+extern void * dst_alloc(struct dst_ops * ops);
extern void __dst_free(struct dst_entry * dst);
extern void dst_destroy(struct dst_entry * dst);
@@ -133,7 +112,7 @@ void dst_free(struct dst_entry * dst)
{
if (dst->obsolete > 1)
return;
- if (!atomic_read(&dst->use)) {
+ if (!atomic_read(&dst->__refcnt)) {
dst_destroy(dst);
return;
}
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 6e9c54188..2d5faa68d 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -36,7 +36,4 @@ extern void icmp_init(struct net_proto_family *ops);
/* Move into dst.h ? */
extern int xrlim_allow(struct dst_entry *dst, int timeout);
-/* CONFIG_IP_TRANSPARENT_PROXY */
-extern int icmp_chkaddr(struct sk_buff *skb);
-
#endif /* _ICMP_H */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 3702028b6..ae4134d76 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -15,22 +15,6 @@
#ifndef _NET_IF_INET6_H
#define _NET_IF_INET6_H
-/* These flags match corresponding IFA_F_* flags but ADDR_INVALID,
- which is invisible externally.
- */
-
-#define ADDR_PERMANENT 0x80
-
-#define DAD_COMPLETE 0x00
-#define DAD_INCOMPLETE 0x40
-#define DAD_STATUS 0x40
-
-#define ADDR_STATUS 0x21
-#define ADDR_DEPRECATED 0x20
-#define ADDR_INVALID 0x01
-
-
-
#define IF_RA_RCVD 0x20
#define IF_RS_SENT 0x10
@@ -45,6 +29,7 @@ struct inet6_ifaddr
__u32 prefered_lft;
unsigned long tstamp;
atomic_t refcnt;
+ spinlock_t lock;
__u8 probes;
__u8 flags;
@@ -57,8 +42,9 @@ struct inet6_ifaddr
struct inet6_ifaddr *lst_next; /* next addr in addr_lst */
struct inet6_ifaddr *if_next; /* next addr in inet6_dev */
-};
+ int dead;
+};
struct ipv6_mc_socklist
{
@@ -74,9 +60,8 @@ struct ipv6_mc_socklist
struct ifmcaddr6
{
struct in6_addr mca_addr;
- struct device *dev;
+ struct inet6_dev *idev;
struct ifmcaddr6 *next;
- struct ifmcaddr6 *if_next;
struct timer_list mca_timer;
unsigned mca_flags;
atomic_t mca_users;
@@ -105,12 +90,14 @@ struct ipv6_devconf
struct inet6_dev
{
- struct device *dev;
+ struct net_device *dev;
struct inet6_ifaddr *addr_list;
struct ifmcaddr6 *mc_list;
rwlock_t lock;
+ atomic_t refcnt;
__u32 if_flags;
+ int dead;
struct neigh_parms *nd_parms;
struct inet6_dev *next;
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 9c7c8b947..87b3fd324 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -11,8 +11,7 @@ extern struct proto_ops inet_dgram_ops;
extern void inet_remove_sock(struct sock *sk1);
extern void inet_put_sock(unsigned short num,
struct sock *sk);
-extern int inet_release(struct socket *sock,
- struct socket *peer);
+extern int inet_release(struct socket *sock);
extern int inet_stream_connect(struct socket *sock,
struct sockaddr * uaddr,
int addr_len, int flags);
@@ -40,6 +39,10 @@ extern int inet_fcntl(struct socket *sock,
unsigned long arg);
extern int inet_listen(struct socket *sock, int backlog);
+extern void inet_sock_release(struct sock *sk);
+extern void inet_sock_destruct(struct sock *sk);
+extern atomic_t inet_sock_nr;
+
#endif
diff --git a/include/net/ip.h b/include/net/ip.h
index c078484c3..4d4dbf7ce 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -66,6 +66,7 @@ struct ip_ra_chain
};
extern struct ip_ra_chain *ip_ra_chain;
+extern rwlock_t ip_ra_lock;
/* IP flags. */
#define IP_CE 0x8000 /* Flag: "Congestion" */
@@ -76,7 +77,7 @@ extern struct ip_ra_chain *ip_ra_chain;
#define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */
extern void ip_mc_dropsocket(struct sock *);
-extern void ip_mc_dropdevice(struct device *dev);
+extern void ip_mc_dropdevice(struct net_device *dev);
extern int ip_mc_procinfo(char *, char **, off_t, int, int);
/*
@@ -86,17 +87,17 @@ extern int ip_mc_procinfo(char *, char **, off_t, int, int);
extern void ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
u32 saddr, u32 daddr,
struct ip_options *opt);
-extern int ip_rcv(struct sk_buff *skb, struct device *dev,
+extern int ip_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *pt);
extern int ip_local_deliver(struct sk_buff *skb);
extern int ip_mr_input(struct sk_buff *skb);
extern int ip_output(struct sk_buff *skb);
extern int ip_mc_output(struct sk_buff *skb);
-extern void ip_fragment(struct sk_buff *skb, int (*out)(struct sk_buff*));
+extern int ip_fragment(struct sk_buff *skb, int (*out)(struct sk_buff*));
extern int ip_do_nat(struct sk_buff *skb);
extern void ip_send_check(struct iphdr *ip);
extern int ip_id_count;
-extern void ip_queue_xmit(struct sk_buff *skb);
+extern int ip_queue_xmit(struct sk_buff *skb);
extern void ip_init(void);
extern int ip_build_xmit(struct sock *sk,
int getfrag (const void *,
@@ -121,7 +122,7 @@ struct ip_reply_arg {
void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
unsigned int len);
-extern int __ip_finish_output(struct sk_buff *skb);
+extern __inline__ int ip_finish_output(struct sk_buff *skb);
struct ipv4_config
{
@@ -136,34 +137,12 @@ extern struct linux_mib net_statistics;
extern int sysctl_local_port_range[2];
-extern __inline__ int ip_finish_output(struct sk_buff *skb)
-{
- struct dst_entry *dst = skb->dst;
- struct device *dev = dst->dev;
- struct hh_cache *hh = dst->hh;
-
- skb->dev = dev;
- skb->protocol = __constant_htons(ETH_P_IP);
-
- if (hh) {
- read_lock_bh(&hh->hh_lock);
- memcpy(skb->data - 16, hh->hh_data, 16);
- read_unlock_bh(&hh->hh_lock);
- skb_push(skb, hh->hh_len);
- return hh->hh_output(skb);
- } else if (dst->neighbour)
- return dst->neighbour->output(skb);
-
- kfree_skb(skb);
- return -EINVAL;
-}
-
-extern __inline__ void ip_send(struct sk_buff *skb)
+extern __inline__ int ip_send(struct sk_buff *skb)
{
if (skb->len > skb->dst->pmtu)
- ip_fragment(skb, __ip_finish_output);
+ return ip_fragment(skb, ip_finish_output);
else
- ip_finish_output(skb);
+ return ip_finish_output(skb);
}
extern __inline__
@@ -180,8 +159,8 @@ int ip_decrease_ttl(struct iphdr *iph)
extern __inline__
int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
{
- return (sk->ip_pmtudisc == IP_PMTUDISC_DO ||
- (sk->ip_pmtudisc == IP_PMTUDISC_WANT &&
+ return (sk->protinfo.af_inet.pmtudisc == IP_PMTUDISC_DO ||
+ (sk->protinfo.af_inet.pmtudisc == IP_PMTUDISC_WANT &&
!(dst->mxlock&(1<<RTAX_MTU))));
}
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index efd652f28..e07802554 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -94,20 +94,25 @@ struct fib6_walker_t
};
extern struct fib6_walker_t fib6_walker_list;
+extern rwlock_t fib6_walker_lock;
extern __inline__ void fib6_walker_link(struct fib6_walker_t *w)
{
+ write_lock_bh(&fib6_walker_lock);
w->next = fib6_walker_list.next;
w->prev = &fib6_walker_list;
w->next->prev = w;
w->prev->next = w;
+ write_unlock_bh(&fib6_walker_lock);
}
extern __inline__ void fib6_walker_unlink(struct fib6_walker_t *w)
{
+ write_lock_bh(&fib6_walker_lock);
w->next->prev = w->prev;
w->prev->next = w->next;
w->prev = w->next = w;
+ write_unlock_bh(&fib6_walker_lock);
}
struct rt6_statistics {
@@ -173,5 +178,6 @@ extern void fib6_run_gc(unsigned long dummy);
extern void fib6_gc_cleanup(void);
+extern void fib6_init(void);
#endif
#endif
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 9311cc34e..cd6097d45 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -40,15 +40,15 @@ extern int ip6_route_add(struct in6_rtmsg *rtmsg);
extern int ip6_del_rt(struct rt6_info *);
extern int ip6_rt_addr_add(struct in6_addr *addr,
- struct device *dev);
+ struct net_device *dev);
extern int ip6_rt_addr_del(struct in6_addr *addr,
- struct device *dev);
+ struct net_device *dev);
extern void rt6_sndmsg(int type, struct in6_addr *dst,
struct in6_addr *src,
struct in6_addr *gw,
- struct device *dev,
+ struct net_device *dev,
int dstlen, int srclen,
int metric, __u32 flags);
@@ -61,9 +61,9 @@ extern struct rt6_info *rt6_lookup(struct in6_addr *daddr,
*
*/
extern struct rt6_info * rt6_get_dflt_router(struct in6_addr *addr,
- struct device *dev);
+ struct net_device *dev);
extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr,
- struct device *dev);
+ struct net_device *dev);
extern void rt6_purge_dflt_routers(int lst_resort);
@@ -74,7 +74,7 @@ extern void rt6_redirect(struct in6_addr *dest,
extern void rt6_pmtu_discovery(struct in6_addr *daddr,
struct in6_addr *saddr,
- struct device *dev,
+ struct net_device *dev,
u32 pmtu);
struct nlmsghdr;
@@ -84,8 +84,10 @@ extern int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *a
extern int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet6_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
-extern void rt6_ifdown(struct device *dev);
-extern void rt6_mtu_change(struct device *dev, unsigned mtu);
+extern void rt6_ifdown(struct net_device *dev);
+extern void rt6_mtu_change(struct net_device *dev, unsigned mtu);
+
+extern rwlock_t rt6_lock;
/*
* Store a destination cache entry in a socket
@@ -95,16 +97,14 @@ extern void rt6_mtu_change(struct device *dev, unsigned mtu);
extern __inline__ void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
struct in6_addr *daddr)
{
- struct ipv6_pinfo *np;
- struct rt6_info *rt;
-
- np = &sk->net_pinfo.af_inet6;
- dst_release(xchg(&sk->dst_cache,dst));
-
- rt = (struct rt6_info *) dst;
+ struct ipv6_pinfo *np = &sk->net_pinfo.af_inet6;
+ struct rt6_info *rt = (struct rt6_info *) dst;
+ write_lock(&sk->dst_lock);
+ __sk_dst_set(sk, dst);
np->daddr_cache = daddr;
np->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
+ write_unlock(&sk->dst_lock);
}
#endif
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 6e1fd8690..afcec35f6 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -36,7 +36,7 @@ struct kern_rta
struct fib_nh
{
- struct device *nh_dev;
+ struct net_device *nh_dev;
unsigned nh_flags;
unsigned char nh_scope;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
@@ -58,16 +58,18 @@ struct fib_info
{
struct fib_info *fib_next;
struct fib_info *fib_prev;
- int fib_refcnt;
+ int fib_treeref;
+ atomic_t fib_clntref;
+ int fib_dead;
unsigned fib_flags;
int fib_protocol;
u32 fib_prefsrc;
u32 fib_priority;
-#define FIB_MAX_METRICS RTAX_RTT
- unsigned fib_metrics[FIB_MAX_METRICS];
+ unsigned fib_metrics[RTAX_MAX];
#define fib_mtu fib_metrics[RTAX_MTU-1]
#define fib_window fib_metrics[RTAX_WINDOW-1]
#define fib_rtt fib_metrics[RTAX_RTT-1]
+#define fib_advmss fib_metrics[RTAX_ADVMSS-1]
int fib_nhs;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
int fib_power;
@@ -83,7 +85,6 @@ struct fib_rule;
struct fib_result
{
- u32 *prefix;
unsigned char prefixlen;
unsigned char nh_sel;
unsigned char type;
@@ -94,6 +95,7 @@ struct fib_result
#endif
};
+
#ifdef CONFIG_IP_ROUTE_MULTIPATH
#define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel])
@@ -171,6 +173,7 @@ extern __inline__ void fib_select_default(const struct rt_key *key, struct fib_r
extern struct fib_table * fib_tables[RT_TABLE_MAX+1];
extern int fib_lookup(const struct rt_key *key, struct fib_result *res);
extern struct fib_table *__fib_new_table(int id);
+extern void fib_rule_put(struct fib_rule *r);
extern __inline__ struct fib_table *fib_get_table(int id)
{
@@ -200,11 +203,11 @@ extern int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar
extern int inet_rtm_getroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg);
extern int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb);
extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif,
- struct device *dev, u32 *spec_dst, u32 *itag);
+ struct net_device *dev, u32 *spec_dst, u32 *itag);
extern void fib_select_multipath(const struct rt_key *key, struct fib_result *res);
/* Exported by fib_semantics.c */
-extern int ip_fib_check_default(u32 gw, struct device *dev);
+extern int ip_fib_check_default(u32 gw, struct net_device *dev);
extern void fib_release_info(struct fib_info *);
extern int fib_semantic_match(int type, struct fib_info *,
const struct rt_key *, struct fib_result*);
@@ -214,8 +217,8 @@ extern int fib_nh_match(struct rtmsg *r, struct nlmsghdr *, struct kern_rta *rta
extern int fib_dump_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
u8 tb_id, u8 type, u8 scope, void *dst, int dst_len, u8 tos,
struct fib_info *fi);
-extern int fib_sync_down(u32 local, struct device *dev, int force);
-extern int fib_sync_up(struct device *dev);
+extern int fib_sync_down(u32 local, struct net_device *dev, int force);
+extern int fib_sync_up(struct net_device *dev);
extern int fib_convert_rtentry(int cmd, struct nlmsghdr *nl, struct rtmsg *rtm,
struct kern_rta *rta, struct rtentry *r);
extern void fib_node_get_info(int type, int dead, struct fib_info *fi, u32 prefix, u32 mask, char *buffer);
@@ -254,4 +257,23 @@ extern __inline__ void fib_combine_itag(u32 *itag, struct fib_result *res)
#endif
}
+extern void free_fib_info(struct fib_info *fi);
+
+extern __inline__ void fib_info_put(struct fib_info *fi)
+{
+ if (atomic_dec_and_test(&fi->fib_clntref))
+ free_fib_info(fi);
+}
+
+extern __inline__ void fib_res_put(struct fib_result *res)
+{
+ if (res->fi)
+ fib_info_put(res->fi);
+#ifdef CONFIG_IP_MULTIPLE_TABLES
+ if (res->r)
+ fib_rule_put(res->r);
+#endif
+}
+
+
#endif _NET_FIB_H
diff --git a/include/net/ip_masq.h b/include/net/ip_masq.h
deleted file mode 100644
index 518e5c4d8..000000000
--- a/include/net/ip_masq.h
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * IP masquerading functionality definitions
- */
-
-#include <linux/config.h> /* for CONFIG_IP_MASQ_DEBUG */
-#ifndef _IP_MASQ_H
-#define _IP_MASQ_H
-
-#ifdef __KERNEL__
-#include <linux/types.h>
-#include <linux/netdevice.h>
-#include <linux/ip.h>
-#include <linux/skbuff.h>
-#endif /* __KERNEL__ */
-
-/*
- * This define affects the number of ports that can be handled
- * by each of the protocol helper modules.
- */
-#define MAX_MASQ_APP_PORTS 12
-
-/*
- * Linux ports don't normally get allocated above 32K.
- * I used an extra 4K port-space
- */
-
-#define PORT_MASQ_BEGIN 61000
-#define PORT_MASQ_END (PORT_MASQ_BEGIN+4096)
-
-#define MASQUERADE_EXPIRE_TCP 15*60*HZ
-#define MASQUERADE_EXPIRE_TCP_FIN 2*60*HZ
-#define MASQUERADE_EXPIRE_UDP 5*60*HZ
-/*
- * ICMP can no longer be modified on the fly using an ioctl - this
- * define is the only way to change the timeouts
- */
-#define MASQUERADE_EXPIRE_ICMP 125*HZ
-
-#define IP_MASQ_MOD_CTL 0x00
-#define IP_MASQ_USER_CTL 0x01
-
-#ifdef __KERNEL__
-
-#define IP_MASQ_TAB_SIZE 256
-
-#define IP_MASQ_F_NO_DADDR 0x0001 /* no daddr yet */
-#define IP_MASQ_F_NO_DPORT 0x0002 /* no dport set yet */
-#define IP_MASQ_F_NO_SADDR 0x0004 /* no sport set yet */
-#define IP_MASQ_F_NO_SPORT 0x0008 /* no sport set yet */
-
-#define IP_MASQ_F_DLOOSE 0x0010 /* loose dest binding */
-#define IP_MASQ_F_NO_REPLY 0x0080 /* no reply yet from outside */
-
-#define IP_MASQ_F_HASHED 0x0100 /* hashed entry */
-#define IP_MASQ_F_OUT_SEQ 0x0200 /* must do output seq adjust */
-#define IP_MASQ_F_IN_SEQ 0x0400 /* must do input seq adjust */
-
-#define IP_MASQ_F_MPORT 0x1000 /* own mport specified */
-#define IP_MASQ_F_USER 0x2000 /* from uspace */
-
-/*
- * Delta seq. info structure
- * Each MASQ struct has 2 (output AND input seq. changes).
- */
-
-struct ip_masq_seq {
- __u32 init_seq; /* Add delta from this seq */
- short delta; /* Delta in sequence numbers */
- short previous_delta; /* Delta in sequence numbers before last resized pkt */
-};
-
-/*
- * MASQ structure allocated for each masqueraded association
- */
-struct ip_masq {
- struct ip_masq *m_link, *s_link; /* hashed link ptrs */
- atomic_t refcnt; /* reference count */
- struct timer_list timer; /* Expiration timer */
- __u16 protocol; /* Which protocol are we talking? */
- __u16 sport, dport, mport; /* src, dst & masq ports */
- __u32 saddr, daddr, maddr; /* src, dst & masq addresses */
- struct ip_masq_seq out_seq, in_seq;
- struct ip_masq_app *app; /* bound ip_masq_app object */
- void *app_data; /* Application private data */
- struct ip_masq *control; /* Master control connection */
- atomic_t n_control; /* Number of "controlled" masqs */
- unsigned flags; /* status flags */
- unsigned timeout; /* timeout */
- unsigned state; /* state info */
- struct ip_masq_timeout_table *timeout_table;
-};
-
-/*
- * Timeout values
- * ipchains holds a copy of this definition
- */
-
-struct ip_fw_masq {
- int tcp_timeout;
- int tcp_fin_timeout;
- int udp_timeout;
-};
-
-union ip_masq_tphdr {
- unsigned char *raw;
- struct udphdr *uh;
- struct tcphdr *th;
- struct icmphdr *icmph;
- __u16 *portp;
-};
-/*
- * [0]: UDP free_ports
- * [1]: TCP free_ports
- * [2]: ICMP free_ports
- */
-
-extern atomic_t ip_masq_free_ports[3];
-
-/*
- * ip_masq initializer (registers symbols and /proc/net entries)
- */
-extern int ip_masq_init(void);
-
-/*
- * functions called from ip layer
- */
-extern int ip_fw_masquerade(struct sk_buff **, __u32 maddr);
-extern int ip_fw_masq_icmp(struct sk_buff **, __u32 maddr);
-extern int ip_fw_unmasq_icmp(struct sk_buff *);
-extern int ip_fw_demasquerade(struct sk_buff **);
-
-/*
- * ip_masq obj creation/deletion functions.
- */
-extern struct ip_masq *ip_masq_new(int proto, __u32 maddr, __u16 mport, __u32 saddr, __u16 sport, __u32 daddr, __u16 dport, unsigned flags);
-
-extern void ip_masq_control_add(struct ip_masq *ms, struct ip_masq* ctl_ms);
-extern void ip_masq_control_del(struct ip_masq *ms);
-extern struct ip_masq * ip_masq_control_get(struct ip_masq *ms);
-
-struct ip_masq_ctl;
-
-struct ip_masq_hook {
- int (*ctl)(int, struct ip_masq_ctl *, int);
- int (*info)(char *, char **, off_t, int, int);
-};
-
-extern struct ip_masq *ip_masq_m_tab[IP_MASQ_TAB_SIZE];
-extern struct ip_masq *ip_masq_s_tab[IP_MASQ_TAB_SIZE];
-extern const char * ip_masq_state_name(int state);
-extern struct ip_masq_hook *ip_masq_user_hook;
-extern u32 ip_masq_select_addr(struct device *dev, u32 dst, int scope);
-/*
- *
- * IP_MASQ_APP: IP application masquerading definitions
- *
- */
-
-struct ip_masq_app
-{
- struct ip_masq_app *next;
- char *name; /* name of application proxy */
- unsigned type; /* type = proto<<16 | port (host byte order)*/
- int n_attach;
- int (*masq_init_1) /* ip_masq initializer */
- (struct ip_masq_app *, struct ip_masq *);
- int (*masq_done_1) /* ip_masq fin. */
- (struct ip_masq_app *, struct ip_masq *);
- int (*pkt_out) /* output (masquerading) hook */
- (struct ip_masq_app *, struct ip_masq *, struct sk_buff **, __u32);
- int (*pkt_in) /* input (demasq) hook */
- (struct ip_masq_app *, struct ip_masq *, struct sk_buff **, __u32);
-};
-
-/*
- * ip_masq_app initializer
- */
-extern int ip_masq_app_init(void);
-
-/*
- * ip_masq_app object registration functions (port: host byte order)
- */
-extern int register_ip_masq_app(struct ip_masq_app *mapp, unsigned short proto, __u16 port);
-extern int unregister_ip_masq_app(struct ip_masq_app *mapp);
-
-/*
- * get ip_masq_app obj by proto,port(net_byte_order)
- */
-extern struct ip_masq_app * ip_masq_app_get(unsigned short proto, __u16 port);
-
-/*
- * ip_masq TO ip_masq_app (un)binding functions.
- */
-extern struct ip_masq_app * ip_masq_bind_app(struct ip_masq *ms);
-extern int ip_masq_unbind_app(struct ip_masq *ms);
-
-/*
- * output and input app. masquerading hooks.
- *
- */
-extern int ip_masq_app_pkt_out(struct ip_masq *, struct sk_buff **skb_p, __u32 maddr);
-extern int ip_masq_app_pkt_in(struct ip_masq *, struct sk_buff **skb_p, __u32 maddr);
-
-/*
- * service routine(s).
- */
-
-extern struct ip_masq * ip_masq_out_get(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
-extern struct ip_masq * ip_masq_in_get(int protocol, __u32 s_addr, __u16 s_port, __u32 d_addr, __u16 d_port);
-
-extern int ip_masq_listen(struct ip_masq *);
-
-static __inline__ struct ip_masq * ip_masq_in_get_iph(const struct iphdr *iph)
-{
- const __u16 *portp = (__u16 *)&(((char *)iph)[iph->ihl*4]);
- return ip_masq_in_get(iph->protocol,
- iph->saddr, portp[0],
- iph->daddr, portp[1]);
-}
-
-static __inline__ struct ip_masq * ip_masq_out_get_iph(const struct iphdr *iph)
-{
- const __u16 *portp = (__u16 *)&(((char *)iph)[iph->ihl*4]);
- return ip_masq_out_get(iph->protocol,
- iph->saddr, portp[0],
- iph->daddr, portp[1]);
-}
-
-extern void ip_masq_put(struct ip_masq *ms);
-
-
-extern rwlock_t __ip_masq_lock;
-
-
-/*
- * Debugging stuff
- */
-
-extern int ip_masq_get_debug_level(void);
-
-#ifdef CONFIG_IP_MASQ_DEBUG
-#define IP_MASQ_DEBUG(level, msg...) do { \
- if (level <= ip_masq_get_debug_level()) \
- printk(KERN_DEBUG "IP_MASQ:" ## msg); \
- } while (0)
-#else /* NO DEBUGGING at ALL */
-#define IP_MASQ_DEBUG(level, msg...) do { } while (0)
-#endif
-
-#define IP_MASQ_INFO(msg...) \
- printk(KERN_INFO "IP_MASQ:" ## msg)
-
-#define IP_MASQ_ERR(msg...) \
- printk(KERN_ERR "IP_MASQ:" ## msg)
-
-#define IP_MASQ_WARNING(msg...) \
- printk(KERN_WARNING "IP_MASQ:" ## msg)
-
-
-/*
- * /proc/net entry
- */
-extern int ip_masq_proc_register(struct proc_dir_entry *);
-extern void ip_masq_proc_unregister(struct proc_dir_entry *);
-extern int ip_masq_app_getinfo(char *buffer, char **start, off_t offset, int length, int dummy);
-
-/*
- * skb_replace function used by "client" modules to replace
- * a segment of skb.
- */
-extern struct sk_buff * ip_masq_skb_replace(struct sk_buff *skb, int pri, char *o_buf, int o_len, char *n_buf, int n_len);
-
-/*
- * masq_proto_num returns 0 for UDP, 1 for TCP, 2 for ICMP
- */
-
-static __inline__ int masq_proto_num(unsigned proto)
-{
- switch (proto)
- {
- case IPPROTO_UDP: return (0); break;
- case IPPROTO_TCP: return (1); break;
- case IPPROTO_ICMP: return (2); break;
- default: return (-1); break;
- }
-}
-
-static __inline__ const char *masq_proto_name(unsigned proto)
-{
- static char buf[20];
- static const char *strProt[] = {"UDP","TCP","ICMP"};
- int msproto = masq_proto_num(proto);
-
- if (msproto<0||msproto>2) {
- sprintf(buf, "IP_%d", proto);
- return buf;
- }
- return strProt[msproto];
-}
-
-enum {
- IP_MASQ_S_NONE = 0,
- IP_MASQ_S_ESTABLISHED,
- IP_MASQ_S_SYN_SENT,
- IP_MASQ_S_SYN_RECV,
- IP_MASQ_S_FIN_WAIT,
- IP_MASQ_S_TIME_WAIT,
- IP_MASQ_S_CLOSE,
- IP_MASQ_S_CLOSE_WAIT,
- IP_MASQ_S_LAST_ACK,
- IP_MASQ_S_LISTEN,
- IP_MASQ_S_UDP,
- IP_MASQ_S_ICMP,
- IP_MASQ_S_LAST
-};
-
-struct ip_masq_timeout_table {
- atomic_t refcnt;
- int scale;
- int timeout[IP_MASQ_S_LAST+1];
-};
-
-static __inline__ void ip_masq_timeout_attach(struct ip_masq *ms, struct ip_masq_timeout_table *mstim)
-{
- atomic_inc (&mstim->refcnt);
- ms->timeout_table=mstim;
-}
-
-static __inline__ void ip_masq_timeout_detach(struct ip_masq *ms)
-{
- struct ip_masq_timeout_table *mstim = ms->timeout_table;
-
- if (!mstim)
- return;
- atomic_dec(&mstim->refcnt);
-}
-
-#endif /* __KERNEL__ */
-
-#endif /* _IP_MASQ_H */
diff --git a/include/net/ip_masq_mod.h b/include/net/ip_masq_mod.h
deleted file mode 100644
index 7cd9a7f32..000000000
--- a/include/net/ip_masq_mod.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * IP Masquerading Modules Support
- *
- * Version: @(#)ip_masq_mod.h 0.01 97/10/30
- *
- * Author: Juan Jose Ciarlante, <jjciarla@raiz.uncu.edu.ar>
- *
- */
-
-
-#ifdef __KERNEL__
-#include <linux/types.h>
-#include <linux/ip_fw.h>
-#include <linux/proc_fs.h>
-#include <net/ip_masq.h>
-
-#define IP_MASQ_MOD_NOP 0
-#define IP_MASQ_MOD_ACCEPT 1
-#define IP_MASQ_MOD_REJECT -1
-
-struct ip_masq_mod {
- struct ip_masq_mod *next; /* next mod for addrs. lookups */
- struct ip_masq_mod *next_reg; /* next mod for configuration ctls */
- char *mmod_name;
- atomic_t refcnt;
- atomic_t mmod_nent; /* number of entries */
- struct proc_dir_entry *mmod_proc_ent;
- int (*mmod_ctl) (int optname, struct ip_masq_ctl *, int optlen);
- int (*mmod_init) (void);
- int (*mmod_done) (void);
- int (*mmod_in_rule) (const struct sk_buff *, const struct iphdr *);
- int (*mmod_in_update) (const struct sk_buff *, const struct iphdr *,
- struct ip_masq *);
- struct ip_masq * (*mmod_in_create) (const struct sk_buff *, const struct iphdr *, __u32);
- int (*mmod_out_rule) (const struct sk_buff *, const struct iphdr *);
- int (*mmod_out_update) (const struct sk_buff *, const struct iphdr *,
- struct ip_masq *);
- struct ip_masq * (*mmod_out_create) (const struct sk_buff *, const struct iphdr *, __u32);
-};
-
-/*
- * Service routines (called from ip_masq.c)
- */
-
-int ip_masq_mod_out_rule(const struct sk_buff *, const struct iphdr *);
-int ip_masq_mod_out_update(const struct sk_buff *, const struct iphdr *, struct ip_masq *ms);
-struct ip_masq * ip_masq_mod_out_create(const struct sk_buff *, const struct iphdr *iph, __u32 maddr);
-
-int ip_masq_mod_in_rule(const struct sk_buff *, const struct iphdr *iph);
-int ip_masq_mod_in_update(const struct sk_buff *, const struct iphdr *iph, struct ip_masq *ms);
-struct ip_masq * ip_masq_mod_in_create(const struct sk_buff *, const struct iphdr *iph, __u32 maddr);
-
-extern int ip_masq_mod_ctl(int optname, struct ip_masq_ctl *, int len);
-
-/*
- * ip_masq_mod registration functions
- */
-extern int register_ip_masq_mod(struct ip_masq_mod *mmod);
-extern int unregister_ip_masq_mod(struct ip_masq_mod *mmod);
-extern int ip_masq_mod_lkp_unlink(struct ip_masq_mod *mmod);
-extern int ip_masq_mod_lkp_link(struct ip_masq_mod *mmod);
-
-/*
- * init functions protos
- */
-extern int ip_portfw_init(void);
-extern int ip_markfw_init(void);
-extern int ip_autofw_init(void);
-
-/*
- * Utility ...
- */
-static __inline__ void ip_masq_mod_dec_nent(struct ip_masq_mod *mmod)
-{
- if (atomic_dec_and_test(&mmod->mmod_nent)) {
- ip_masq_mod_lkp_unlink(mmod);
- }
-}
-static __inline__ void ip_masq_mod_inc_nent(struct ip_masq_mod *mmod)
-{
- atomic_inc(&mmod->mmod_nent);
- if (atomic_read(&mmod->mmod_nent)==1)
- ip_masq_mod_lkp_link(mmod);
-}
-
-#endif /* __KERNEL__ */
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 22c464c3c..b522397f8 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -9,7 +9,7 @@
struct ip_tunnel
{
struct ip_tunnel *next;
- struct device *dev;
+ struct net_device *dev;
struct net_device_stats stat;
int recursion; /* Depth of hard_start_xmit recursion */
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 50e2299fb..d66b14066 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -4,7 +4,7 @@
* Authors:
* Pedro Roque <roque@di.fc.ul.pt>
*
- * $Id: ipv6.h,v 1.16 1999/04/22 10:07:27 davem Exp $
+ * $Id: ipv6.h,v 1.18 1999/08/20 11:00:53 davem Exp $
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -89,6 +89,7 @@ struct frag_hdr {
extern struct ipv6_mib ipv6_statistics;
extern struct icmpv6_mib icmpv6_statistics;
extern struct udp_mib udp_stats_in6;
+extern atomic_t inet6_sock_nr;
struct ip6_ra_chain
{
@@ -99,6 +100,7 @@ struct ip6_ra_chain
};
extern struct ip6_ra_chain *ip6_ra_chain;
+extern rwlock_t ip6_ra_lock;
/*
This structure is prepared by protocol, when parsing
@@ -232,7 +234,7 @@ extern __inline__ int ipv6_addr_any(struct in6_addr *a)
*/
extern int ipv6_rcv(struct sk_buff *skb,
- struct device *dev,
+ struct net_device *dev,
struct packet_type *pt);
/*
@@ -245,7 +247,7 @@ extern int ip6_xmit(struct sock *sk,
extern int ip6_nd_hdr(struct sock *sk,
struct sk_buff *skb,
- struct device *dev,
+ struct net_device *dev,
struct in6_addr *saddr,
struct in6_addr *daddr,
int proto, int len);
diff --git a/include/net/ipx.h b/include/net/ipx.h
index 2152e388b..667098922 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -49,7 +49,7 @@ typedef struct ipx_interface {
unsigned char if_node[IPX_NODE_LEN];
/* physical device info */
- struct device *if_dev;
+ struct net_device *if_dev;
struct datalink_proto *if_dlink;
unsigned short if_dlink_type;
diff --git a/include/net/irda/discovery.h b/include/net/irda/discovery.h
index 15e254b33..4d0fe7157 100644
--- a/include/net/irda/discovery.h
+++ b/include/net/irda/discovery.h
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Apr 6 16:53:53 1999
- * Modified at: Thu Apr 22 11:04:56 1999
+ * Modified at: Mon Aug 23 09:26:24 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
@@ -39,6 +39,8 @@
#define DISCOVERY_EXPIRE_TIMEOUT 6*HZ
#define DISCOVERY_DEFAULT_SLOTS 0
+#define NICKNAME_MAX_LEN 21
+
/*
* The DISCOVERY structure is used for both discovery requests and responses
*/
@@ -50,17 +52,17 @@ typedef struct {
LAP_REASON condition; /* More info about the discovery */
__u16_host_order hints; /* Discovery hint bits */
- __u8 charset;
- char info[32]; /* Usually the name of the device */
- __u8 info_len; /* Length of device info field */
+ __u8 charset; /* Encoding of nickname */
+ char nickname[22]; /* The name of the device (21 bytes + \0) */
+ int name_len; /* Lenght of nickname */
int gen_addr_bit; /* Need to generate a new device address? */
int nslots; /* Number of slots to use when discovering */
- int timestamp; /* Time discovered */
+ unsigned long timestamp; /* Time discovered */
} discovery_t;
void irlmp_add_discovery(hashbin_t *cachelog, discovery_t *discovery);
void irlmp_add_discovery_log(hashbin_t *cachelog, hashbin_t *log);
-void irlmp_expire_discoveries(hashbin_t *log, int saddr, int force);
+void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force);
#endif
diff --git a/include/net/irda/dongle.h b/include/net/irda/dongle.h
index 82f129fca..fd7c7131f 100644
--- a/include/net/irda/dongle.h
+++ b/include/net/irda/dongle.h
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Wed Oct 21 22:47:12 1998
- * Modified at: Sun May 16 13:40:03 1999
+ * Modified at: Sat Jun 26 16:58:44 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
@@ -35,6 +35,7 @@ typedef enum {
ACTISYS_PLUS_DONGLE,
GIRBIL_DONGLE,
LITELINK_DONGLE,
+ AIRPORT_DONGLE,
} IRDA_DONGLE;
struct irda_device;
@@ -44,7 +45,7 @@ struct dongle {
void (*open)(struct irda_device *, int type);
void (*close)(struct irda_device *);
void (*reset)( struct irda_device *);
- void (*change_speed)( struct irda_device *, int baudrate);
+ void (*change_speed)( struct irda_device *, __u32 speed);
void (*qos_init)( struct irda_device *, struct qos_info *);
};
diff --git a/include/net/irda/ircomm_common.h b/include/net/irda/ircomm_common.h
deleted file mode 100644
index 44d1b1774..000000000
--- a/include/net/irda/ircomm_common.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*********************************************************************
- *
- * Filename: ircomm_common.h
- * Version:
- * Description: An implementation of IrCOMM service interface and state machine
- * Status: Experimental.
- * Author: Takahide Higuchi <thiguchi@pluto.dti.ne.jp>
- *
- * Copyright (c) 1998-1999, Takahide Higuchi, <thiguchi@pluto.dti.ne.jp>,
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * I, Takahide Higuchi, provide no warranty for any of this software.
- * This material is provided "AS-IS" and at no charge.
- *
- ********************************************************************/
-
-#ifndef IRCOMM_H
-#define IRCOMM_H
-
-/* #define DEBUG(n, args...) printk( KERN_DEBUG args) */ /* enable all debug message */
-
-#include <linux/types.h>
-#include <net/irda/irmod.h>
-
-typedef enum {
- COMM_IDLE,
-
- COMM_DISCOVERY_WAIT,
- COMM_QUERYPARAM_WAIT,
- COMM_QUERYLSAP_WAIT,
-
- COMM_WAITI,
- COMM_WAITR,
- COMM_CONN,
-} IRCOMM_STATE;
-
-/* IrCOMM Events */
-typedef enum {
- IRCOMM_CONNECT_REQUEST,
- TTP_CONNECT_INDICATION,
- LMP_CONNECT_INDICATION,
-
- TTP_CONNECT_CONFIRM,
- TTP_DISCONNECT_INDICATION,
- LMP_CONNECT_CONFIRM,
- LMP_DISCONNECT_INDICATION,
-
- IRCOMM_CONNECT_RESPONSE,
- IRCOMM_DISCONNECT_REQUEST,
-
- TTP_DATA_INDICATION,
- IRCOMM_DATA_REQUEST,
- LMP_DATA_INDICATION,
- IRCOMM_CONTROL_REQUEST,
-
- DISCOVERY_INDICATION,
- GOT_PARAMETERS,
- GOT_LSAPSEL,
- QUERYIAS_ERROR,
-
-} IRCOMM_EVENT;
-
-typedef enum {
- TX_READY,
- TX_BUSY,
-
- IAS_PARAM,
- CONTROL_CHANNEL,
-} IRCOMM_CMD;
-
-
-
-#define IRCOMM_MAGIC 0x434f4d4d
-#define COMM_INIT_CTRL_PARAM 3 /* length of initial control parameters */
-#define COMM_HEADER_SIZE 1 /* length of clen field */
-#define COMM_MAX_HEADER_SIZE (TTP_MAX_HEADER+COMM_HEADER_SIZE)
-#define COMM_DEFAULT_SDU_SIZE (64 - COMM_HEADER_SIZE)
-#define IRCOMM_MAX_CONNECTION 1 /* Don't change for now */
-
-
-
-
-#define UNKNOWN 0x00 /* not defined yet. */
-/* we use 9wire if servicetype=DEFAULT, but is it good? */
-#define DEFAULT 0x0a /* private number */
-#define THREE_WIRE_RAW 0x01 /* bit 0 */
-#define THREE_WIRE 0x02 /* bit 1 */
-#define NINE_WIRE 0x04 /* bit 2 */
-#define CENTRONICS 0x08 /* bit 3 */
-
-#define SERIAL 0x01 /* bit 0 */
-#define PARALLEL 0x02 /* bit 1 */
-
-
-#define SERVICETYPE 0x00
-#define PORT_TYPE 0x01
-#define PORT_NAME 0x02
-#define FIXED_PORT_NAME 0x82
-
-#define DATA_RATE 0x10
-#define DATA_FORMAT 0x11
-#define FLOW_CONTROL 0x12
-#define XON_XOFF_CHAR 0x13
-#define ENQ_ACK_CHAR 0x14
-#define LINESTATUS 0x15
-#define BREAK_SIGNAL 0x16
-
-#define DTELINE_STATE 0x20
-#define DCELINE_STATE 0x21
-#define POLL_FOR_LINE_SETTINGS 0x22
-
-#define STATUS_QUERY 0x30
-#define SET_BUSY_TIMEOUT 0x31
-#define IEEE1284_MODE_SUPPORT 0x32
-#define IEEE1284_DEVICEID 0x33
-#define IEEE1284_MODE 0x34
-#define IEEE1284_ECP_EPP_DATA_TRANSFER 0x35
-
-/* parameters of FLOW_CONTROL */
-
-#define USE_RTS 0x08 /* use RTS on output */
-#define USE_CTS 0x04 /* use CTS on input */
-#define USE_DTR 0x20 /* use DTR on output */
-
-/* parameters of DTELINE_STATE */
-
-#define DELTA_DTR 0x01
-#define DELTA_RTS 0x02
-#define MCR_DTR 0x04
-#define MCR_RTS 0x08
-
-/* parameters of DCELINE_STATE */
-
-#define DELTA_CTS 0x01
-#define DELTA_DSR 0x02
-#define DELTA_RI 0x04
-#define DELTA_DCD 0x08
-#define MSR_CTS 0x10
-#define MSR_DSR 0x20
-#define MSR_RI 0x40
-#define MSR_DCD 0x80
-
-/* parameters of DATA_FORMAT */
-
-#define IRCOMM_WLEN5 0x00 /* word length is 5bit */
-#define IRCOMM_WLEN6 0x01 /* word length is 6bit */
-#define IRCOMM_WLEN7 0x02 /* word length is 7bit */
-#define IRCOMM_WLEN8 0x03 /* word length is 8bit */
-
-#define IRCOMM_STOP2 0x04 /* 2 stop bits mode */
-#define IRCOMM_PARENB 0x08 /* parity enable */
-#define IRCOMM_PARODD 0x00 /* odd parity */
-#define IRCOMM_PAREVEN 0x10 /* even parity */
-#define IRCOMM_PARMARK 0x20
-#define IRCOMM_PARSPC 0x30
-
-/* parameters of LINE_STATUS */
-
-#define LSR_OE 0x02 /* Overrun error indicator */
-#define LSR_PE 0x04 /* Parity error indicator */
-#define LSR_FE 0x08 /* Frame error indicator */
-#define LSR_BI 0x01 /* Break interrupt indicator */
-
-
-struct ircomm_cb {
- int magic;
- int state; /* Current state of IrCOMM layer:
- * DISCOVERY,COMM_IDLE, COMM_WAITR,
- * COMM_WAITI, COMM_CONN
- */
- int in_use;
- int null_modem_mode; /* switch for null modem emulation */
- int ttp_stop;
-
- __u32 tx_max_sdu_size;
- __u32 rx_max_sdu_size;
- __u8 max_header_size;
-
- __u32 daddr; /* Device address of the peer device */
- __u32 saddr;
- __u32 skey;
- __u32 ckey;
- int queryias_lock;
- int ias_type;
- int disconnect_priority; /* P_NORMAL or P_HIGH. see irttp.h */
- struct notify_t notify; /* container of callbacks */
- void (*d_handler)(struct ircomm_cb *self);
-
- int control_ch_pending;
- struct sk_buff *ctrl_skb; /* queue of control channel */
-
- __u8 dlsap; /* IrLMP dlsap */
- __u8 lsap; /* sap of local device */
- struct tsap_cb *tsap; /* IrTTP/LMP handle */
- struct qos_info *qos; /* Quality of Service */
- int reason; /* I don't know about reason:
- see Irlmp.c or somewhere :p)*/
- int peer_cap; /* capability of peer device */
-
- wait_queue_head_t discovery_wait;
- wait_queue_head_t ias_wait;
-
- /* statistics */
- int tx_packets;
- int rx_packets;
- int tx_controls;
- int pending_control_tuples;
- int ignored_control_tuples;
-
- __u8 pi ; /* instruction of control channel*/
-
- __u8 port_type;
- __u8 peer_port_type;
-
- __u8 servicetype;
- __u8 peer_servicetype;
- __u8 data_format;
- __u8 peer_data_format;
- __u8 flow_ctrl;
- __u8 peer_flow_ctrl;
- __u8 line_status;
- __u8 peer_line_status;
- __u8 break_signal;
- __u8 peer_break_signal;
- __u8 dte;
- __u8 peer_dte;
- __u8 dce;
- __u8 peer_dce;
- __u8 xon_char;
- __u8 xoff_char;
- __u8 peer_xon_char;
- __u8 peer_xoff_char;
- __u8 enq_char;
- __u8 ack_char;
- __u8 peer_enq_char;
- __u8 peer_ack_char;
- __u8 busy_timeout;
- __u8 peer_busy_timeout;
- __u8 ecp_epp_mode;
- __u8 peer_ecp_epp_mode;
- __u8 channel_or_addr;
- __u8 peer_channel_or_addr;
-
- __u32 data_rate;
- __u32 peer_data_rate;
- char port_name[33];
- int port_name_critical;
-};
-
-void ircomm_connect_request(struct ircomm_cb *self, __u8 servicetype);
-void ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata,
- __u32 maxsdusize);
-void ircomm_disconnect_request(struct ircomm_cb *self,
- struct sk_buff *userdata, int priority);
-int ircomm_data_request(struct ircomm_cb *self,
- struct sk_buff *userdata);
-void ircomm_control_request(struct ircomm_cb *self, __u8 instruction);
-
-void ircomm_parse_tuples(struct ircomm_cb *self, struct sk_buff *skb, int type);
-
-struct ircomm_cb *ircomm_open_instance(struct notify_t notify);
-int ircomm_close_instance(struct ircomm_cb *self);
-
-
-#endif
diff --git a/include/net/irda/ircomm_core.h b/include/net/irda/ircomm_core.h
new file mode 100644
index 000000000..0af1767fe
--- /dev/null
+++ b/include/net/irda/ircomm_core.h
@@ -0,0 +1,110 @@
+/*********************************************************************
+ *
+ * Filename: ircomm_core.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Wed Jun 9 08:58:43 1999
+ * Modified at: Fri Aug 13 07:24:18 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ********************************************************************/
+
+#ifndef IRCOMM_CORE_H
+#define IRCOMM_CORE_H
+
+#include <net/irda/irda.h>
+#include <net/irda/ircomm_event.h>
+
+#define IRCOMM_MAGIC 0x98347298
+#define IRCOMM_HEADER_SIZE 1
+
+struct ircomm_cb; /* Forward decl. */
+
+/*
+ * A small call-table, so we don't have to check the service-type whenever
+ * we want to do something
+ */
+typedef struct {
+ int (*data_request)(struct ircomm_cb *, struct sk_buff *, int clen);
+ int (*connect_request)(struct ircomm_cb *, struct sk_buff *,
+ struct ircomm_info *);
+ int (*connect_response)(struct ircomm_cb *, struct sk_buff *);
+ int (*disconnect_request)(struct ircomm_cb *, struct sk_buff *,
+ struct ircomm_info *);
+} call_t;
+
+struct ircomm_cb {
+ QUEUE queue;
+ magic_t magic;
+
+ notify_t notify;
+ call_t issue;
+
+ int state;
+ int line; /* Which TTY line we are using */
+
+ struct tsap_cb *tsap;
+ struct lsap_cb *lsap;
+
+ __u8 dlsap_sel; /* Destination LSAP/TSAP selector */
+ __u8 slsap_sel; /* Source LSAP/TSAP selector */
+
+ __u32 saddr; /* Source device address (link we are using) */
+ __u32 daddr; /* Destination device address */
+
+ int max_header_size; /* Header space we must reserve for each frame */
+ int max_data_size; /* The amount of data we can fill in each frame */
+
+ LOCAL_FLOW flow_status; /* Used by ircomm_lmp */
+ int pkt_count; /* Number of frames we have sent to IrLAP */
+
+ __u8 service_type;
+};
+
+extern hashbin_t *ircomm;
+
+struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line);
+int ircomm_close(struct ircomm_cb *self);
+
+int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb);
+void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb);
+void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb);
+int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb);
+int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel,
+ __u32 saddr, __u32 daddr, struct sk_buff *skb,
+ __u8 service_type);
+void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb,
+ struct ircomm_info *info);
+void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb,
+ struct ircomm_info *info);
+int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata);
+int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata);
+void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb,
+ struct ircomm_info *info);
+void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow);
+
+extern inline int ircomm_is_connected(struct ircomm_cb *self)
+{
+ return self->state == IRCOMM_CONN;
+}
+
+#endif
diff --git a/include/net/irda/ircomm_event.h b/include/net/irda/ircomm_event.h
new file mode 100644
index 000000000..8bcffa8ac
--- /dev/null
+++ b/include/net/irda/ircomm_event.h
@@ -0,0 +1,84 @@
+/*********************************************************************
+ *
+ * Filename: ircomm_event.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Jun 6 23:51:13 1999
+ * Modified at: Thu Jun 10 08:36:25 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ********************************************************************/
+
+#ifndef IRCOMM_EVENT_H
+#define IRCOMM_EVENT_H
+
+typedef enum {
+ IRCOMM_IDLE,
+ IRCOMM_WAITI,
+ IRCOMM_WAITR,
+ IRCOMM_CONN,
+} IRCOMM_STATE;
+
+/* IrCOMM Events */
+typedef enum {
+ IRCOMM_CONNECT_REQUEST,
+ IRCOMM_CONNECT_RESPONSE,
+ IRCOMM_TTP_CONNECT_INDICATION,
+ IRCOMM_LMP_CONNECT_INDICATION,
+ IRCOMM_TTP_CONNECT_CONFIRM,
+ IRCOMM_LMP_CONNECT_CONFIRM,
+
+ IRCOMM_LMP_DISCONNECT_INDICATION,
+ IRCOMM_TTP_DISCONNECT_INDICATION,
+ IRCOMM_DISCONNECT_REQUEST,
+
+ IRCOMM_TTP_DATA_INDICATION,
+ IRCOMM_LMP_DATA_INDICATION,
+ IRCOMM_DATA_REQUEST,
+ IRCOMM_CONTROL_REQUEST,
+ IRCOMM_CONTROL_INDICATION,
+} IRCOMM_EVENT;
+
+/*
+ * Used for passing information through the state-machine
+ */
+struct ircomm_info {
+ __u32 saddr; /* Source device address */
+ __u32 daddr; /* Destination device address */
+ __u8 dlsap_sel;
+ LM_REASON reason; /* Reason for disconnect */
+ __u32 max_data_size;
+ __u32 max_header_size;
+
+ struct qos_info *qos;
+};
+
+extern char *ircomm_state[];
+extern char *ircomm_event[];
+
+struct ircomm_cb; /* Forward decl. */
+
+int ircomm_do_event(struct ircomm_cb *self, IRCOMM_EVENT event,
+ struct sk_buff *skb, struct ircomm_info *info);
+void ircomm_next_state(struct ircomm_cb *self, IRCOMM_STATE state);
+
+#endif
diff --git a/include/net/irda/ircomm_lmp.h b/include/net/irda/ircomm_lmp.h
new file mode 100644
index 000000000..fd738be7c
--- /dev/null
+++ b/include/net/irda/ircomm_lmp.h
@@ -0,0 +1,65 @@
+/*********************************************************************
+ *
+ * Filename: ircomm_lmp.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Wed Jun 9 10:06:07 1999
+ * Modified at: Fri Aug 13 07:32:32 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ********************************************************************/
+
+#ifndef IRCOMM_LMP_H
+#define IRCOMM_LMP_H
+
+#include <net/irda/ircomm_core.h>
+#include <net/irda/ircomm_event.h>
+
+int ircomm_open_lsap(struct ircomm_cb *self);
+int ircomm_lmp_connect_request(struct ircomm_cb *self,
+ struct sk_buff *userdata,
+ struct ircomm_info *info);
+int ircomm_lmp_connect_response(struct ircomm_cb *self, struct sk_buff *skb);
+int ircomm_lmp_disconnect_request(struct ircomm_cb *self,
+ struct sk_buff *userdata,
+ struct ircomm_info *info);
+int ircomm_lmp_data_request(struct ircomm_cb *self, struct sk_buff *skb,
+ int clen);
+int ircomm_lmp_control_request(struct ircomm_cb *self,
+ struct sk_buff *userdata);
+int ircomm_lmp_data_indication(void *instance, void *sap,
+ struct sk_buff *skb);
+void ircomm_lmp_connect_confirm(void *instance, void *sap,
+ struct qos_info *qos,
+ __u32 max_sdu_size,
+ __u8 max_header_size,
+ struct sk_buff *skb);
+void ircomm_lmp_connect_indication(void *instance, void *sap,
+ struct qos_info *qos,
+ __u32 max_sdu_size,
+ __u8 max_header_size,
+ struct sk_buff *skb);
+void ircomm_lmp_disconnect_indication(void *instance, void *sap,
+ LM_REASON reason,
+ struct sk_buff *skb);
+
+#endif
diff --git a/include/net/irda/ircomm_param.h b/include/net/irda/ircomm_param.h
new file mode 100644
index 000000000..5f46fb258
--- /dev/null
+++ b/include/net/irda/ircomm_param.h
@@ -0,0 +1,150 @@
+/*********************************************************************
+ *
+ * Filename: ircomm_param.h
+ * Version: 1.0
+ * Description: Parameter handling for the IrCOMM protocol
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Mon Jun 7 08:47:28 1999
+ * Modified at: Wed Aug 25 13:46:33 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ********************************************************************/
+
+#ifndef IRCOMM_PARAMS_H
+#define IRCOMM_PARAMS_H
+
+#include <net/irda/parameters.h>
+
+/* Parameters common to all service types */
+#define IRCOMM_SERVICE_TYPE 0x00
+#define IRCOMM_PORT_TYPE 0x01 /* Only used in LM-IAS */
+#define IRCOMM_PORT_NAME 0x02 /* Only used in LM-IAS */
+
+/* Parameters for both 3 wire and 9 wire */
+#define IRCOMM_DATA_RATE 0x10
+#define IRCOMM_DATA_FORMAT 0x11
+#define IRCOMM_FLOW_CONTROL 0x12
+#define IRCOMM_XON_XOFF 0x13
+#define IRCOMM_ENQ_ACK 0x14
+#define IRCOMM_LINE_STATUS 0x15
+#define IRCOMM_BREAK 0x16
+
+/* Parameters for 9 wire */
+#define IRCOMM_DTE 0x20
+#define IRCOMM_DCE 0x21
+#define IRCOMM_POLL 0x22
+
+/* Service type (details) */
+#define IRCOMM_3_WIRE_RAW 0x01
+#define IRCOMM_3_WIRE 0x02
+#define IRCOMM_9_WIRE 0x04
+#define IRCOMM_CENTRONICS 0x08
+
+/* Port type (details) */
+#define IRCOMM_SERIAL 0x00
+#define IRCOMM_PARALLEL 0x01
+
+/* Data format (details) */
+#define IRCOMM_WSIZE_5 0x00
+#define IRCOMM_WSIZE_6 0x01
+#define IRCOMM_WSIZE_7 0x02
+#define IRCOMM_WSIZE_8 0x03
+
+#define IRCOMM_1_STOP_BIT 0x00
+#define IRCOMM_2_STOP_BIT 0x04 /* 1.5 if char len 5 */
+
+#define IRCOMM_PARITY_DISABLE 0x00
+#define IRCOMM_PARITY_ENABLE 0x08
+
+#define IRCOMM_PARITY_ODD 0x00
+#define IRCOMM_PARITY_EVEN 0x10
+#define IRCOMM_PARITY_MARK 0x20
+#define IRCOMM_PARITY_SPACE 0x30
+
+/* Flow control */
+#define IRCOMM_XON_XOFF_IN 0x01
+#define IRCOMM_XON_XOFF_OUT 0x02
+#define IRCOMM_RTS_CTS_IN 0x04
+#define IRCOMM_RTS_CTS_OUT 0x08
+#define IRCOMM_DSR_DTR_IN 0x10
+#define IRCOMM_DSR_DTR_OUT 0x20
+#define IRCOMM_ENQ_ACK_IN 0x40
+#define IRCOMM_ENQ_ACK_OUT 0x80
+
+/* Line status */
+#define IRCOMM_OVERRUN_ERROR 0x02
+#define IRCOMM_PARITY_ERROR 0x04
+#define IRCOMM_FRAMING_ERROR 0x08
+
+/* DTE (Data terminal equipment) line settings */
+#define IRCOMM_DELTA_DTR 0x01
+#define IRCOMM_DELTA_RTS 0x02
+#define IRCOMM_DTR 0x04
+#define IRCOMM_RTS 0x08
+
+/* DCE (Data communications equipment) line settings */
+#define IRCOMM_DELTA_CTS 0x01 /* Clear to send has changed */
+#define IRCOMM_DELTA_DSR 0x02 /* Data set ready has changed */
+#define IRCOMM_DELTA_RI 0x04 /* Ring indicator has changed */
+#define IRCOMM_DELTA_CD 0x08 /* Carrier detect has changed */
+#define IRCOMM_CTS 0x10 /* Clear to send is high */
+#define IRCOMM_DSR 0x20 /* Data set ready is high */
+#define IRCOMM_RI 0x40 /* Ring indicator is high */
+#define IRCOMM_CD 0x80 /* Carrier detect is high */
+#define IRCOMM_DCE_DELTA_ANY 0x0f
+
+/*
+ * Parameter state
+ */
+struct ircomm_params {
+ /* General control params */
+ __u8 service_type;
+ __u8 port_type;
+ char port_name[32];
+
+ /* Control params for 3- and 9-wire service type */
+ __u32 data_rate; /* Data rate in bps */
+ __u8 data_format;
+ __u8 flow_control;
+ char xonxoff[2];
+ char enqack[2];
+ __u8 line_status;
+ __u8 _break;
+
+ __u8 null_modem;
+
+ /* Control params for 9-wire service type */
+ __u8 dte;
+ __u8 dce;
+ __u8 poll;
+
+ /* Control params for Centronics service type */
+};
+
+struct ircomm_tty_cb; /* Forward decl. */
+
+int ircomm_param_flush(struct ircomm_tty_cb *self);
+int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush);
+
+extern pi_param_info_t ircomm_param_info;
+
+#endif /* IRCOMM_PARAMS_H */
+
diff --git a/include/net/irda/ircomm_ttp.h b/include/net/irda/ircomm_ttp.h
new file mode 100644
index 000000000..014d7f56e
--- /dev/null
+++ b/include/net/irda/ircomm_ttp.h
@@ -0,0 +1,70 @@
+/*********************************************************************
+ *
+ * Filename: ircomm_ttp.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Wed Jun 9 10:06:07 1999
+ * Modified at: Fri Aug 13 07:32:22 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ********************************************************************/
+
+#ifndef IRCOMM_TTP_H
+#define IRCOMM_TTP_H
+
+#include <net/irda/ircomm_core.h>
+#include <net/irda/ircomm_event.h>
+
+int ircomm_open_tsap(struct ircomm_cb *self);
+int ircomm_ttp_connect_request(struct ircomm_cb *self,
+ struct sk_buff *userdata,
+ struct ircomm_info *info);
+int ircomm_ttp_connect_response(struct ircomm_cb *self, struct sk_buff *skb);
+int ircomm_ttp_disconnect_request(struct ircomm_cb *self,
+ struct sk_buff *userdata,
+ struct ircomm_info *info);
+int ircomm_ttp_data_request(struct ircomm_cb *self, struct sk_buff *skb,
+ int clen);
+int ircomm_ttp_control_request(struct ircomm_cb *self,
+ struct sk_buff *userdata);
+int ircomm_ttp_data_indication(void *instance, void *sap,
+ struct sk_buff *skb);
+void ircomm_ttp_connect_confirm(void *instance, void *sap,
+ struct qos_info *qos,
+ __u32 max_sdu_size,
+ __u8 max_header_size,
+ struct sk_buff *skb);
+void ircomm_ttp_connect_indication(void *instance, void *sap,
+ struct qos_info *qos,
+ __u32 max_sdu_size,
+ __u8 max_header_size,
+ struct sk_buff *skb);
+void ircomm_ttp_disconnect_indication(void *instance, void *sap,
+ LM_REASON reason,
+ struct sk_buff *skb);
+void ircomm_ttp_flow_indication(void *instance, void *sap, LOCAL_FLOW cmd);
+
+#endif
+
+
+
+
diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h
new file mode 100644
index 000000000..500baba37
--- /dev/null
+++ b/include/net/irda/ircomm_tty.h
@@ -0,0 +1,116 @@
+/*********************************************************************
+ *
+ * Filename: ircomm_tty.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Sun Jun 6 23:24:22 1999
+ * Modified at: Tue Aug 31 10:22:02 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ********************************************************************/
+
+#ifndef IRCOMM_TTY_H
+#define IRCOMM_TTY_H
+
+#include <linux/serial.h>
+
+#include <net/irda/irias_object.h>
+#include <net/irda/ircomm_core.h>
+#include <net/irda/ircomm_param.h>
+
+#define IRCOMM_TTY_PORTS 32
+#define IRCOMM_TTY_MAGIC 0x3432
+#define IRCOMM_TTY_MAJOR 161
+#define IRCOMM_TTY_MINOR 0
+
+/*
+ * IrCOMM TTY driver state
+ */
+struct ircomm_tty_cb {
+ QUEUE queue;
+ magic_t magic;
+
+ int state;
+
+ struct tty_struct *tty;
+ struct ircomm_cb *ircomm;
+
+ struct sk_buff_head tx_queue; /* Frames to be transmitted */
+ struct sk_buff *tx_skb;
+ struct sk_buff *ctrl_skb;
+
+ /* Parameters */
+ struct ircomm_params session;
+
+ __u8 service_type;
+
+ int line;
+ int flags;
+
+ __u8 dlsap_sel;
+ __u8 slsap_sel;
+
+ __u32 saddr;
+ __u32 daddr;
+
+ __u32 max_data_size;
+ __u32 max_header_size;
+
+ struct ias_object* obj;
+ int skey;
+ int ckey;
+
+ struct termios normal_termios;
+ struct termios callout_termios;
+
+ wait_queue_head_t open_wait;
+ wait_queue_head_t close_wait;
+ struct timer_list watchdog_timer;
+ struct tq_struct tqueue;
+
+ unsigned short close_delay;
+ unsigned short closing_wait; /* time to wait before closing */
+
+ long pgrp; /* pgrp of opening process */
+ int open_count;
+ int blocked_open; /* # of blocked opens */
+};
+
+void ircomm_tty_start(struct tty_struct *tty);
+void ircomm_tty_stop(struct tty_struct *tty);
+void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
+
+extern void ircomm_tty_change_speed(struct ircomm_tty_cb *self);
+extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
+ unsigned int cmd, unsigned long arg);
+extern void ircomm_tty_set_termios(struct tty_struct *tty,
+ struct termios *old_termios);
+extern hashbin_t *ircomm_tty;
+
+#endif
+
+
+
+
+
+
+
diff --git a/include/net/irda/ircomm_tty_attach.h b/include/net/irda/ircomm_tty_attach.h
new file mode 100644
index 000000000..545bf20a6
--- /dev/null
+++ b/include/net/irda/ircomm_tty_attach.h
@@ -0,0 +1,93 @@
+/*********************************************************************
+ *
+ * Filename: ircomm_tty_attach.h
+ * Version:
+ * Description:
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Wed Jun 9 15:55:18 1999
+ * Modified at: Thu Sep 2 10:29:30 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ********************************************************************/
+
+#ifndef IRCOMM_TTY_ATTACH_H
+#define IRCOMM_TTY_ATTACH_H
+
+#include <net/irda/ircomm_tty.h>
+
+typedef enum {
+ IRCOMM_TTY_IDLE,
+ IRCOMM_TTY_SEARCH,
+ IRCOMM_TTY_QUERY_PARAMETERS,
+ IRCOMM_TTY_QUERY_LSAP_SEL,
+ IRCOMM_TTY_SETUP,
+ IRCOMM_TTY_READY,
+} IRCOMM_TTY_STATE;
+
+/* IrCOMM TTY Events */
+typedef enum {
+ IRCOMM_TTY_ATTACH_CABLE,
+ IRCOMM_TTY_DETACH_CABLE,
+ IRCOMM_TTY_DATA_REQUEST,
+ IRCOMM_TTY_DATA_INDICATION,
+ IRCOMM_TTY_DISCOVERY_REQUEST,
+ IRCOMM_TTY_DISCOVERY_INDICATION,
+ IRCOMM_TTY_CONNECT_CONFIRM,
+ IRCOMM_TTY_CONNECT_INDICATION,
+ IRCOMM_TTY_DISCONNECT_REQUEST,
+ IRCOMM_TTY_DISCONNECT_INDICATION,
+ IRCOMM_TTY_WD_TIMER_EXPIRED,
+ IRCOMM_TTY_GOT_PARAMETERS,
+ IRCOMM_TTY_GOT_LSAPSEL,
+} IRCOMM_TTY_EVENT;
+
+/* Used for passing information through the state-machine */
+struct ircomm_tty_info {
+ __u32 saddr; /* Source device address */
+ __u32 daddr; /* Destination device address */
+ __u8 dlsap_sel;
+};
+
+extern char *ircomm_state[];
+extern char *ircomm_event[];
+extern char *ircomm_tty_state[];
+
+int ircomm_tty_do_event(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event,
+ struct sk_buff *skb, struct ircomm_tty_info *info);
+void ircomm_tty_next_state(struct ircomm_tty_cb *self, IRCOMM_TTY_STATE state);
+
+
+int ircomm_tty_attach_cable(struct ircomm_tty_cb *self);
+void ircomm_tty_detach_cable(struct ircomm_tty_cb *self);
+void ircomm_tty_connect_confirm(void *instance, void *sap,
+ struct qos_info *qos,
+ __u32 max_sdu_size,
+ __u8 max_header_size,
+ struct sk_buff *skb);
+void ircomm_tty_disconnect_indication(void *instance, void *sap,
+ LM_REASON reason,
+ struct sk_buff *skb);
+void ircomm_tty_connect_indication(void *instance, void *sap,
+ struct qos_info *qos,
+ __u32 max_sdu_size,
+ __u8 max_header_size,
+ struct sk_buff *skb);
+#endif
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index b0e67385b..5e00eec7a 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Dec 9 21:13:12 1997
- * Modified at: Mon May 10 09:51:13 1999
+ * Modified at: Mon Sep 27 11:13:18 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
@@ -40,6 +40,10 @@
#define FALSE 0
#endif
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+
#define ALIGN __attribute__((aligned))
#define PACK __attribute__((packed))
@@ -51,7 +55,7 @@ extern __u32 irda_debug;
/* use 0 for production, 1 for verification, >2 for debug */
#define IRDA_DEBUG_LEVEL 0
-#define DEBUG(n, args...) if (irda_debug >= (n)) printk(KERN_DEBUG args)
+#define DEBUG(n, args...) (irda_debug >= (n)) ? (printk(KERN_DEBUG args)) : 0
#define ASSERT(expr, func) \
if(!(expr)) { \
printk( "Assertion failed! %s,%s,%s,line=%d\n",\
@@ -66,12 +70,14 @@ if(!(expr)) { \
#define MESSAGE(args...) printk(KERN_INFO args)
#define ERROR(args...) printk(KERN_ERR args)
-#define MSECS_TO_JIFFIES(ms) (ms*HZ/1000)
+#define MSECS_TO_JIFFIES(ms) (((ms)*HZ+999)/1000)
/*
- * Magic numbers used by Linux/IR. Random numbers which must be unique to
+ * Magic numbers used by Linux-IrDA. Random numbers which must be unique to
* give the best protection
*/
+typedef __u32 magic_t;
+
#define IRTTY_MAGIC 0x2357
#define LAP_MAGIC 0x1357
#define LMP_MAGIC 0x4321
@@ -141,6 +147,16 @@ typedef union {
__u8 byte[2];
} __u16_host_order;
+/* Per-packet information we need to hide inside sk_buff */
+struct irda_skb_cb {
+ magic_t magic; /* Be sure that we can trust the information */
+ int mtt; /* minimum turn around time */
+ int xbofs; /* number of xbofs required, used by SIR mode */
+ int line; /* Used by IrCOMM in IrLPT mode */
+ void *instance; /* Used by IrTTP */
+ void (*destructor)(struct sk_buff *skb); /* Used for flow control */
+};
+
/*
* Information monitored by some layers
*/
@@ -222,21 +238,21 @@ typedef enum {
/*
* Notify structure used between transport and link management layers
*/
-struct notify_t {
+typedef struct {
int (*data_indication)(void *priv, void *sap, struct sk_buff *skb);
int (*udata_indication)(void *priv, void *sap, struct sk_buff *skb);
void (*connect_confirm)(void *instance, void *sap,
struct qos_info *qos, __u32 max_sdu_size,
__u8 max_header_size, struct sk_buff *skb);
void (*connect_indication)(void *instance, void *sap,
- struct qos_info *qos, __u32 max_sdu_size,
+ struct qos_info *qos, __u32 max_sdu_size,
__u8 max_header_size, struct sk_buff *skb);
void (*disconnect_indication)(void *instance, void *sap,
LM_REASON reason, struct sk_buff *);
void (*flow_indication)(void *instance, void *sap, LOCAL_FLOW flow);
void *instance; /* Layer instance pointer */
char name[16]; /* Name of layer */
-};
+} notify_t;
#define NOTIFY_MAX_NAME 16
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
index 5272633f7..5c5d2280e 100644
--- a/include/net/irda/irda_device.h
+++ b/include/net/irda/irda_device.h
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Apr 14 12:41:42 1998
- * Modified at: Wed May 19 08:44:48 1999
+ * Modified at: Mon Sep 20 11:21:31 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1999 Dag Brattli, All Rights Reserved.
@@ -35,8 +35,7 @@
#include <linux/tty.h>
#include <linux/netdevice.h>
-
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#include <net/irda/irda.h>
#include <net/irda/qos.h>
@@ -44,6 +43,11 @@
#include <net/irda/irqueue.h>
#include <net/irda/irlap_frame.h>
+/* Some private IOCTL's */
+#define SIOCSDONGLE (SIOCDEVPRIVATE + 0)
+#define SIOCSBANDWIDTH (SIOCDEVPRIVATE + 1)
+#define SIOCSMEDIABUSY (SIOCDEVPRIVATE + 2)
+
/* Some non-standard interface flags (should not conflict with any in if.h) */
#define IFF_SIR 0x0001 /* Supports SIR speeds */
#define IFF_MIR 0x0002 /* Supports MIR speeds */
@@ -75,7 +79,7 @@ struct chipio_t {
int irqflags; /* interrupt flags (ie, SA_SHIRQ|SA_INTERRUPT) */
int direction; /* Link direction, used by some FIR drivers */
- int baudrate; /* Currently used baudrate */
+ __u32 baudrate; /* Currently used baudrate */
int dongle_id; /* Dongle or transceiver currently used */
};
@@ -102,17 +106,17 @@ struct iobuff_t {
* stuff from IrDA port implementations.
*/
struct irda_device {
- QUEUE q; /* Must be first */
+ QUEUE q; /* Must be first */
+ magic_t magic; /* Our magic bullet */
- int magic; /* Our magic bullet */
char name[16]; /* Name of device "irda0" */
char description[32]; /* Something like "irda0 <-> ttyS0" */
- struct irlap_cb *irlap; /* The link layer we are connected to */
- struct device netdev; /* Yes! we are some kind of netdevice */
+ struct irlap_cb *irlap; /* The link layer we are connected to */
+ struct net_device netdev; /* Yes! we are some kind of netdevice */
struct enet_statistics stats;
- int flags; /* Interface flags (see defs above) */
+ __u32 flags; /* Interface flags (see defs above) */
void *priv; /* Pointer to low level implementation */
@@ -130,11 +134,16 @@ struct irda_device {
int media_busy;
struct timer_list media_busy_timer;
- /* Callbacks for driver specific implementation */
- void (*change_speed)(struct irda_device *idev, int baud);
+ int raw_mode;
+
+ /* Callbacks to driver specific implementations */
+ void (*change_speed)(struct irda_device *idev, __u32 speed);
int (*is_receiving)(struct irda_device *); /* receiving? */
void (*set_dtr_rts)(struct irda_device *idev, int dtr, int rts);
+ void (*set_raw_mode)(struct irda_device *dev, int mode);
int (*raw_write)(struct irda_device *idev, __u8 *buf, int len);
+ int (*raw_read)(struct irda_device *idev, __u8 *buf, int len,
+ int timeout);
void (*wait_until_sent)(struct irda_device *);
void (*set_caddr)(struct irda_device *); /* Set connection addr */
};
@@ -149,21 +158,25 @@ int irda_device_open(struct irda_device *, char *name, void *priv);
void irda_device_close(struct irda_device *);
/* Interface to be uses by IrLAP */
-inline void irda_device_set_media_busy(struct irda_device *, int status);
-inline int irda_device_is_media_busy(struct irda_device *);
-inline int irda_device_is_receiving(struct irda_device *);
-inline void irda_device_change_speed(struct irda_device *, int);
-
-inline struct qos_info *irda_device_get_qos(struct irda_device *self);
-int irda_device_txqueue_empty(struct irda_device *self);
+void irda_device_set_media_busy(struct net_device *dev, int status);
+int irda_device_is_media_busy(struct net_device *dev);
+int irda_device_is_receiving(struct net_device *dev);
+struct qos_info *irda_device_get_qos(struct net_device *dev);
+
+/* Interface for internal use */
+void irda_device_change_speed(struct irda_device *, int);
+int irda_device_txqueue_empty(struct irda_device *self);
void irda_device_init_dongle(struct irda_device *self, int type);
void irda_device_unregister_dongle(struct dongle *dongle);
-int irda_device_register_dongle(struct dongle *dongle);
-
-int irda_device_setup(struct device *dev);
+int irda_device_register_dongle(struct dongle *dongle);
+int irda_device_set_raw_mode(struct irda_device* self, int status);
+int irda_device_setup(struct net_device *dev);
void setup_dma(int channel, char *buffer, int count, int mode);
+int irda_device_net_open(struct net_device *dev);
+int irda_device_net_close(struct net_device *dev);
+
/*
* Function irda_get_mtt (skb)
*
@@ -174,10 +187,10 @@ extern inline __u16 irda_get_mtt(struct sk_buff *skb)
{
__u16 mtt;
- if (((struct irlap_skb_cb *)(skb->cb))->magic != LAP_MAGIC)
+ if (((struct irda_skb_cb *)(skb->cb))->magic != LAP_MAGIC)
mtt = 10000;
else
- mtt = ((struct irlap_skb_cb *)(skb->cb))->mtt;
+ mtt = ((struct irda_skb_cb *)(skb->cb))->mtt;
ASSERT(mtt <= 10000, return 10000;);
diff --git a/include/net/irda/iriap.h b/include/net/irda/iriap.h
index 355751afa..994c49f61 100644
--- a/include/net/irda/iriap.h
+++ b/include/net/irda/iriap.h
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Thu Aug 21 00:02:07 1997
- * Modified at: Sun May 9 10:56:57 1999
+ * Modified at: Thu Jul 1 10:10:42 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
@@ -57,9 +57,9 @@ typedef void (*CONFIRM_CALLBACK)(int result, __u16 obj_id,
struct ias_value *value, void *priv);
struct iriap_cb {
- QUEUE queue; /* Must be first */
-
- int magic; /* Magic cookie */
+ QUEUE queue; /* Must be first */
+ magic_t magic; /* Magic cookie */
+
int mode; /* Client or server */
__u32 saddr;
@@ -88,9 +88,9 @@ struct iriap_cb {
int iriap_init(void);
void iriap_cleanup(void);
-void iriap_getvaluebyclass_request( char *name, char *attr,
- __u32 saddr, __u32 daddr,
- CONFIRM_CALLBACK callback, void *priv);
+void iriap_getvaluebyclass_request(char *name, char *attr,
+ __u32 saddr, __u32 daddr,
+ CONFIRM_CALLBACK callback, void *priv);
void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb);
void iriap_send_ack( struct iriap_cb *self);
@@ -98,13 +98,13 @@ void iriap_call_indication(struct iriap_cb *self, struct sk_buff *skb);
void iriap_register_server(void);
-void iriap_watchdog_timer_expired( unsigned long data);
+void iriap_watchdog_timer_expired(void *data);
-static inline void iriap_start_watchdog_timer( struct iriap_cb *self,
- int timeout)
+static inline void iriap_start_watchdog_timer(struct iriap_cb *self,
+ int timeout)
{
- irda_start_timer( &self->watchdog_timer, timeout,
- (unsigned long) self, iriap_watchdog_timer_expired);
+ irda_start_timer(&self->watchdog_timer, timeout, self,
+ iriap_watchdog_timer_expired);
}
#endif
diff --git a/include/net/irda/irias_object.h b/include/net/irda/irias_object.h
index 4a76018b6..b057b2a4f 100644
--- a/include/net/irda/irias_object.h
+++ b/include/net/irda/irias_object.h
@@ -6,10 +6,10 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Thu Oct 1 22:49:50 1998
- * Modified at: Wed Feb 3 10:38:02 1999
+ * Modified at: Thu Jul 1 11:37:15 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1998 Dag Brattli, All Rights Reserved.
+ * Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -25,6 +25,7 @@
#ifndef LM_IAS_OBJECT_H
#define LM_IAS_OBJECT_H
+#include <net/irda/irda.h>
#include <net/irda/irqueue.h>
/* LM-IAS Attribute types */
@@ -37,8 +38,8 @@
* LM-IAS Object
*/
struct ias_object {
- QUEUE queue; /* Must be first! */
- int magic;
+ QUEUE queue; /* Must be first! */
+ magic_t magic;
char *name;
int id;
@@ -72,12 +73,12 @@ struct ias_attrib {
struct ias_value *value; /* Attribute value */
};
-char *strdup( char *str);
+char *strdup(char *str);
-struct ias_object *irias_new_object( char *name, int id);
-void irias_insert_object( struct ias_object *obj);
-void __irias_delete_object( struct ias_object *obj);
-void irias_delete_object( char *name);
+struct ias_object *irias_new_object(char *name, int id);
+void irias_insert_object(struct ias_object *obj);
+int irias_delete_object(struct ias_object *obj);
+void __irias_delete_object(struct ias_object *obj);
void irias_add_integer_attrib(struct ias_object *obj, char *name, int value);
void irias_add_string_attrib(struct ias_object *obj, char *name, char *value);
@@ -85,13 +86,13 @@ void irias_add_octseq_attrib(struct ias_object *obj, char *name, __u8 *octets,
int len);
int irias_object_change_attribute(char *obj_name, char *attrib_name,
struct ias_value *new_value);
-struct ias_object *irias_find_object( char *name);
-struct ias_attrib *irias_find_attrib( struct ias_object *obj, char *name);
+struct ias_object *irias_find_object(char *name);
+struct ias_attrib *irias_find_attrib(struct ias_object *obj, char *name);
-struct ias_value *irias_new_string_value( char *string);
-struct ias_value *irias_new_integer_value( int integer);
-struct ias_value *irias_new_octseq_value( __u8 *octseq , int len);
-void irias_delete_value( struct ias_value *value);
+struct ias_value *irias_new_string_value(char *string);
+struct ias_value *irias_new_integer_value(int integer);
+struct ias_value *irias_new_octseq_value(__u8 *octseq , int len);
+void irias_delete_value(struct ias_value *value);
extern struct ias_value missing;
extern hashbin_t *objects;
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h
index fc343e5c0..236d27602 100644
--- a/include/net/irda/irlan_common.h
+++ b/include/net/irda/irlan_common.h
@@ -163,7 +163,7 @@ struct irlan_cb {
int magic;
char ifname[9];
- struct device dev; /* Ethernet device structure*/
+ struct net_device dev; /* Ethernet device structure*/
struct enet_statistics stats;
__u32 saddr; /* Source device address */
diff --git a/include/net/irda/irlan_eth.h b/include/net/irda/irlan_eth.h
index 376df91ff..8f0ca03ac 100644
--- a/include/net/irda/irlan_eth.h
+++ b/include/net/irda/irlan_eth.h
@@ -25,16 +25,16 @@
#ifndef IRLAN_ETH_H
#define IRLAN_ETH_H
-int irlan_eth_init(struct device *dev);
-int irlan_eth_open(struct device *dev);
-int irlan_eth_close(struct device *dev);
+int irlan_eth_init(struct net_device *dev);
+int irlan_eth_open(struct net_device *dev);
+int irlan_eth_close(struct net_device *dev);
int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb);
-int irlan_eth_xmit(struct sk_buff *skb, struct device *dev);
+int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev);
void irlan_eth_flow_indication( void *instance, void *sap, LOCAL_FLOW flow);
-void irlan_eth_send_gratuitous_arp(struct device *dev);
+void irlan_eth_send_gratuitous_arp(struct net_device *dev);
-void irlan_eth_set_multicast_list( struct device *dev);
-struct enet_statistics *irlan_eth_get_stats(struct device *dev);
+void irlan_eth_set_multicast_list( struct net_device *dev);
+struct enet_statistics *irlan_eth_get_stats(struct net_device *dev);
#endif
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h
index c5767397e..f21365188 100644
--- a/include/net/irda/irlap.h
+++ b/include/net/irda/irlap.h
@@ -6,10 +6,11 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Aug 4 20:40:53 1997
- * Modified at: Sun May 9 11:38:18 1999
+ * Modified at: Mon Sep 20 10:14:47 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
+ * All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -31,6 +32,7 @@
#include <linux/netdevice.h>
#include <linux/ppp_defs.h>
#include <linux/ppp-comp.h>
+#include <linux/timer.h>
#include <net/irda/irlap_event.h>
@@ -54,7 +56,7 @@
#define XID_FORMAT 0x01 /* Discovery XID format */
#define LAP_WINDOW_SIZE 8
-#define MAX_CONNECTIONS 1
+#define LAP_MAX_QUEUE 10
#define NR_EXPECTED 1
#define NR_UNEXPECTED 0
@@ -85,12 +87,10 @@ struct irda_compressor {
/* Main structure of IrLAP */
struct irlap_cb {
- QUEUE q; /* Must be first */
+ QUEUE q; /* Must be first */
+ magic_t magic;
- int magic;
-
- struct irda_device *irdev;
- struct device *netdev;
+ struct net_device *netdev;
/* Connection state */
volatile IRLAP_STATE state; /* Current state */
@@ -138,12 +138,11 @@ struct irlap_cb {
__u8 vs; /* Next frame to be sent */
__u8 vr; /* Next frame to be received */
-/* int tmp; */
__u8 va; /* Last frame acked */
int window; /* Nr of I-frames allowed to send */
int window_size; /* Current negotiated window size */
- int window_bytes; /* Number of bytes allowed to send */
- int bytes_left; /* Number of bytes allowed to transmit */
+ __u32 window_bytes; /* Number of bytes allowed to send */
+ __u32 bytes_left; /* Number of bytes allowed to transmit */
struct sk_buff_head wx_list;
@@ -161,7 +160,7 @@ struct irlap_cb {
struct qos_info qos_tx; /* QoS requested by peer */
struct qos_info qos_rx; /* QoS requested by self */
- struct notify_t notify; /* Callbacks to IrLMP */
+ notify_t notify; /* Callbacks to IrLMP */
int mtt_required; /* Minumum turnaround time required */
int xbofs_delay; /* Nr of XBOF's used to MTT */
@@ -180,55 +179,60 @@ extern hashbin_t *irlap;
/*
* Function prototypes
*/
+int irlap_init(void);
+void irlap_cleanup(void);
-int irlap_init( void);
-void irlap_cleanup( void);
-
-struct irlap_cb *irlap_open( struct irda_device *dev);
-void irlap_close( struct irlap_cb *self);
+struct irlap_cb *irlap_open(struct net_device *dev);
+void irlap_close(struct irlap_cb *self);
-void irlap_connect_request( struct irlap_cb *self, __u32 daddr,
- struct qos_info *qos, int sniff);
-void irlap_connect_response( struct irlap_cb *self, struct sk_buff *skb);
-void irlap_connect_indication( struct irlap_cb *self, struct sk_buff *skb);
-void irlap_connect_confirm( struct irlap_cb *, struct sk_buff *skb);
+void irlap_connect_request(struct irlap_cb *self, __u32 daddr,
+ struct qos_info *qos, int sniff);
+void irlap_connect_response(struct irlap_cb *self, struct sk_buff *skb);
+void irlap_connect_indication(struct irlap_cb *self, struct sk_buff *skb);
+void irlap_connect_confirm(struct irlap_cb *, struct sk_buff *skb);
-inline void irlap_data_indication( struct irlap_cb *, struct sk_buff *);
-inline void irlap_unit_data_indication( struct irlap_cb *, struct sk_buff *);
-inline void irlap_data_request( struct irlap_cb *, struct sk_buff *,
- int reliable);
+inline void irlap_data_indication(struct irlap_cb *, struct sk_buff *);
+inline void irlap_unit_data_indication(struct irlap_cb *, struct sk_buff *);
+inline void irlap_data_request(struct irlap_cb *, struct sk_buff *,
+ int reliable);
-void irlap_disconnect_request( struct irlap_cb *);
-void irlap_disconnect_indication( struct irlap_cb *, LAP_REASON reason);
+void irlap_disconnect_request(struct irlap_cb *);
+void irlap_disconnect_indication(struct irlap_cb *, LAP_REASON reason);
-void irlap_status_indication( int quality_of_link);
+void irlap_status_indication(int quality_of_link);
-void irlap_test_request( __u8 *info, int len);
+void irlap_test_request(__u8 *info, int len);
void irlap_discovery_request(struct irlap_cb *, discovery_t *discovery);
void irlap_discovery_confirm(struct irlap_cb *, hashbin_t *discovery_log);
void irlap_discovery_indication(struct irlap_cb *, discovery_t *discovery);
-void irlap_reset_indication( struct irlap_cb *self);
+void irlap_reset_indication(struct irlap_cb *self);
void irlap_reset_confirm(void);
-void irlap_update_nr_received( struct irlap_cb *, int nr);
-int irlap_validate_nr_received( struct irlap_cb *, int nr);
-int irlap_validate_ns_received( struct irlap_cb *, int ns);
+void irlap_update_nr_received(struct irlap_cb *, int nr);
+int irlap_validate_nr_received(struct irlap_cb *, int nr);
+int irlap_validate_ns_received(struct irlap_cb *, int ns);
-int irlap_generate_rand_time_slot( int S, int s);
-void irlap_initiate_connection_state( struct irlap_cb *);
+int irlap_generate_rand_time_slot(int S, int s);
+void irlap_initiate_connection_state(struct irlap_cb *);
void irlap_flush_all_queues(struct irlap_cb *);
-void irlap_change_speed(struct irlap_cb *, int);
+void irlap_change_speed(struct irlap_cb *self, __u32 speed);
void irlap_wait_min_turn_around(struct irlap_cb *, struct qos_info *);
void irlap_init_qos_capabilities(struct irlap_cb *, struct qos_info *);
void irlap_apply_default_connection_parameters(struct irlap_cb *self);
void irlap_apply_connection_parameters(struct irlap_cb *, struct qos_info *);
+void irlap_set_local_busy(struct irlap_cb *self, int status);
extern inline __u8 irlap_get_header_size(struct irlap_cb *self)
{
return 2;
}
+extern inline int irlap_get_tx_queue_len(struct irlap_cb *self)
+{
+ return skb_queue_len(&self->tx_list);
+}
+
#endif
diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h
index 015814b45..d58eed3da 100644
--- a/include/net/irda/irlap_event.h
+++ b/include/net/irda/irlap_event.h
@@ -1,25 +1,33 @@
/*********************************************************************
*
+ *
* Filename: irlap_event.h
* Version: 0.1
* Description:
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Aug 16 00:59:29 1997
- * Modified at: Tue Apr 6 17:10:38 1999
+ * Modified at: Mon Aug 16 10:16:12 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
+ * All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
- * Neither Dag Brattli nor University of Tromsø admit liability nor
- * provide warranty for any of this software. This material is
- * provided "AS-IS" and at no charge.
- *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
********************************************************************/
#ifndef IRLAP_EVENT_H
@@ -115,9 +123,11 @@ struct irlap_info {
extern const char *irlap_state[];
-void irlap_do_event( struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info);
-void irlap_next_state( struct irlap_cb *self, IRLAP_STATE state);
-void irlap_print_event( IRLAP_EVENT event);
+void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info);
+void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state);
+void irlap_print_event(IRLAP_EVENT event);
+
+extern int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb);
#endif
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 7425b41b4..a6ff9a7f8 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
@@ -2,24 +2,31 @@
*
* Filename: irlap_frame.h
* Version: 0.9
- * Description: Build and transmit IrLAP frames
+ * Description: IrLAP frame declarations
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Aug 19 10:27:26 1997
- * Modified at: Fri Apr 23 09:33:55 1999
+ * Modified at: Mon Aug 23 09:38:46 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1997-1999 Dag Brattli <dagb@cs.uit.no>,
+ * All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
- * Neither Dag Brattli nor University of Tromsø admit liability nor
- * provide warranty for any of this software. This material is
- * provided "AS-IS" and at no charge.
- *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
********************************************************************/
#ifndef IRLAP_FRAME_H
@@ -73,7 +80,6 @@ struct xid_frame {
__u8 flags; /* Discovery flags */
__u8 slotnr;
__u8 version;
- __u8 discovery_info[0];
} PACK;
struct test_frame {
@@ -81,7 +87,6 @@ struct test_frame {
__u8 control;
__u32 saddr; /* Source device address */
__u32 daddr; /* Destination device address */
- __u8 info[0]; /* Information */
} PACK;
struct ua_frame {
@@ -90,13 +95,11 @@ struct ua_frame {
__u32 saddr; /* Source device address */
__u32 daddr; /* Dest device address */
- __u8 params[0];
} PACK;
struct i_frame {
__u8 caddr;
__u8 control;
- __u8 data[0];
} PACK;
struct snrm_frame {
@@ -105,37 +108,30 @@ struct snrm_frame {
__u32 saddr;
__u32 daddr;
__u8 ncaddr;
- __u8 params[0];
} PACK;
-/* Per-packet information we need to hide inside sk_buff */
-struct irlap_skb_cb {
- int magic; /* Be sure that we can trust the information */
- int mtt; /* minimum turn around time */
- int xbofs; /* number of xbofs required */
- int vs; /* next frame to send */
- int vr; /* next frame to receive */
-};
-
-void irlap_send_discovery_xid_frame( struct irlap_cb *, int S, __u8 s,
- __u8 command, discovery_t *discovery);
-void irlap_send_snrm_frame( struct irlap_cb *, struct qos_info *);
+void irlap_send_discovery_xid_frame(struct irlap_cb *, int S, __u8 s,
+ __u8 command, discovery_t *discovery);
+void irlap_send_snrm_frame(struct irlap_cb *, struct qos_info *);
void irlap_send_test_frame(struct irlap_cb *self, __u32 daddr,
struct sk_buff *cmd);
-void irlap_send_ua_response_frame( struct irlap_cb *, struct qos_info *);
-void irlap_send_ui_frame( struct irlap_cb *self, struct sk_buff *skb,
- int command);
-void irlap_send_dm_frame( struct irlap_cb *);
-void irlap_send_disc_frame( struct irlap_cb *);
-void irlap_send_rr_frame( struct irlap_cb *, int command);
-
-void irlap_send_data_primary( struct irlap_cb *, struct sk_buff *);
-void irlap_send_data_primary_poll( struct irlap_cb *, struct sk_buff *);
-void irlap_send_data_secondary( struct irlap_cb *, struct sk_buff *);
-void irlap_send_data_secondary_final( struct irlap_cb *, struct sk_buff *);
-void irlap_resend_rejected_frames( struct irlap_cb *, int command);
-
-void irlap_send_i_frame( struct irlap_cb *, struct sk_buff *, int command);
-void irlap_send_ui_frame( struct irlap_cb *, struct sk_buff *, int command);
+void irlap_send_ua_response_frame(struct irlap_cb *, struct qos_info *);
+void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
+ int command);
+void irlap_send_dm_frame(struct irlap_cb *);
+void irlap_send_disc_frame(struct irlap_cb *);
+void irlap_send_rr_frame(struct irlap_cb *, int command);
+
+void irlap_send_data_primary(struct irlap_cb *, struct sk_buff *);
+void irlap_send_data_primary_poll(struct irlap_cb *, struct sk_buff *);
+void irlap_send_data_secondary(struct irlap_cb *, struct sk_buff *);
+void irlap_send_data_secondary_final(struct irlap_cb *, struct sk_buff *);
+void irlap_resend_rejected_frames(struct irlap_cb *, int command);
+
+void irlap_send_i_frame(struct irlap_cb *, struct sk_buff *, int command);
+void irlap_send_ui_frame(struct irlap_cb *, struct sk_buff *, int command);
+
+extern int irlap_insert_qos_negotiation_params(struct irlap_cb *self,
+ struct sk_buff *skb);
#endif
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h
index e879c6b94..40024d38c 100644
--- a/include/net/irda/irlmp.h
+++ b/include/net/irda/irlmp.h
@@ -6,10 +6,11 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Aug 17 20:54:32 1997
- * Modified at: Sun May 9 11:01:34 1999
+ * Modified at: Thu Jul 8 13:44:20 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
+ * All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -97,9 +98,8 @@ struct lap_cb; /* Forward decl. */
* Information about each logical LSAP connection
*/
struct lsap_cb {
- QUEUE queue; /* Must be first */
-
- int magic;
+ QUEUE queue; /* Must be first */
+ magic_t magic;
int connected;
int persistent;
@@ -114,7 +114,7 @@ struct lsap_cb {
struct timer_list watchdog_timer;
IRLMP_STATE lsap_state; /* Connection state */
- struct notify_t notify; /* Indication/Confirm entry points */
+ notify_t notify; /* Indication/Confirm entry points */
struct qos_info qos; /* QoS for this connection */
struct lap_cb *lap; /* Pointer to LAP connection structure */
@@ -124,9 +124,9 @@ struct lsap_cb {
* Information about each registred IrLAP layer
*/
struct lap_cb {
- QUEUE queue; /* Must be first */
+ QUEUE queue; /* Must be first */
+ magic_t magic;
- int magic;
int reason; /* LAP disconnect reason */
IRLMP_STATE lap_state;
@@ -157,7 +157,7 @@ typedef struct {
* Main structure for IrLMP
*/
struct irlmp_cb {
- int magic;
+ magic_t magic;
__u8 conflict_flag;
@@ -187,7 +187,7 @@ struct irlmp_cb {
/* Prototype declarations */
int irlmp_init(void);
void irlmp_cleanup(void);
-struct lsap_cb *irlmp_open_lsap( __u8 slsap, struct notify_t *notify);
+struct lsap_cb *irlmp_open_lsap( __u8 slsap, notify_t *notify);
void irlmp_close_lsap( struct lsap_cb *self);
__u16 irlmp_service_to_hint(int service);
@@ -199,27 +199,27 @@ int irlmp_unregister_client(__u32 handle);
int irlmp_update_client(__u32 handle, __u16 hint_mask,
DISCOVERY_CALLBACK1, DISCOVERY_CALLBACK2);
-void irlmp_register_link(struct irlap_cb *, __u32 saddr, struct notify_t *);
+void irlmp_register_link(struct irlap_cb *, __u32 saddr, notify_t *);
void irlmp_unregister_link(__u32 saddr);
int irlmp_connect_request(struct lsap_cb *, __u8 dlsap_sel,
__u32 saddr, __u32 daddr,
struct qos_info *, struct sk_buff *);
void irlmp_connect_indication(struct lsap_cb *self, struct sk_buff *skb);
-void irlmp_connect_response(struct lsap_cb *, struct sk_buff *);
+int irlmp_connect_response(struct lsap_cb *, struct sk_buff *);
void irlmp_connect_confirm(struct lsap_cb *, struct sk_buff *);
struct lsap_cb *irlmp_dup(struct lsap_cb *self, void *instance);
void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
struct sk_buff *userdata);
-void irlmp_disconnect_request(struct lsap_cb *, struct sk_buff *userdata);
+int irlmp_disconnect_request(struct lsap_cb *, struct sk_buff *userdata);
void irlmp_discovery_confirm(hashbin_t *discovery_log);
void irlmp_discovery_request(int nslots);
void irlmp_do_discovery(int nslots);
discovery_t *irlmp_get_discovery_response(void);
-void irlmp_data_request(struct lsap_cb *, struct sk_buff *);
+int irlmp_data_request(struct lsap_cb *, struct sk_buff *);
inline void irlmp_udata_request(struct lsap_cb *, struct sk_buff *);
inline void irlmp_data_indication(struct lsap_cb *, struct sk_buff *);
inline void irlmp_udata_indication(struct lsap_cb *, struct sk_buff *);
@@ -235,10 +235,20 @@ __u32 irlmp_get_saddr(struct lsap_cb *self);
__u32 irlmp_get_daddr(struct lsap_cb *self);
extern char *lmp_reasons[];
+extern int sysctl_discovery_timeout;
extern int sysctl_discovery_slots;
extern int sysctl_discovery;
extern struct irlmp_cb *irlmp;
static inline hashbin_t *irlmp_get_cachelog(void) { return irlmp->cachelog; }
+static inline int irlmp_get_lap_tx_queue_len(struct lsap_cb *self)
+{
+ ASSERT(self != NULL, return 0;);
+ ASSERT(self->lap != NULL, return 0;);
+ ASSERT(self->lap->irlap != NULL, return 0;);
+
+ return irlap_get_tx_queue_len(self->lap->irlap);
+}
+
#endif
diff --git a/include/net/irda/irlmp_event.h b/include/net/irda/irlmp_event.h
index b83627983..1c960e6a0 100644
--- a/include/net/irda/irlmp_event.h
+++ b/include/net/irda/irlmp_event.h
@@ -6,10 +6,11 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Mon Aug 4 20:40:53 1997
- * Modified at: Thu Feb 25 20:49:16 1999
+ * Modified at: Thu Jul 8 12:18:54 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1997, 1999 Dag Brattli <dagb@cs.uit.no>,
+ * All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -98,17 +99,21 @@ struct irlmp_event {
extern const char *irlmp_state[];
extern const char *irlsap_state[];
-void irlmp_watchdog_timer_expired( unsigned long data);
-void irlmp_discovery_timer_expired( unsigned long data);
-void irlmp_idle_timer_expired( unsigned long data);
+void irlmp_watchdog_timer_expired(void *data);
+void irlmp_discovery_timer_expired(void *data);
+void irlmp_idle_timer_expired(void *data);
+
+void irlmp_next_station_state(IRLMP_STATE state);
+void irlmp_next_lsap_state(struct lsap_cb *self, LSAP_STATE state);
+void irlmp_next_lap_state(struct lap_cb *self, IRLMP_STATE state);
+
+void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb);
+int irlmp_do_lsap_event(struct lsap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb);
+
+#endif /* IRLMP_EVENT_H */
+
-void irlmp_next_station_state( IRLMP_STATE state);
-void irlmp_next_lsap_state( struct lsap_cb *self, LSAP_STATE state);
-void irlmp_next_lap_state( struct lap_cb *self, IRLMP_STATE state);
-void irlmp_do_lap_event( struct lap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb);
-void irlmp_do_lsap_event( struct lsap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb);
-#endif
diff --git a/include/net/irda/irlpt_cli.h b/include/net/irda/irlpt_cli.h
deleted file mode 100644
index ab3178885..000000000
--- a/include/net/irda/irlpt_cli.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*********************************************************************
- *
- * Filename: irlpt_cli.h
- * Version: 0.1
- * Description:
- * Status: Experimental.
- * Author: Dag Brattli <dagb@cs.uit.no>
- * Created at: Sat Feb 21 18:54:38 1998
- * Modified at: Wed Apr 21 16:46:26 1999
- * Modified by: Dag Brattli <dagb@cs.uit.no>
- *
- * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>
- * Copyright (c) 1998, Dag Brattli,
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * I, Thomas Davis, provide no warranty for any of this software. This
- * material is provided "AS-IS" and at no charge.
- *
- ********************************************************************/
-
-#ifndef IRLPT_CLIENT_H
-#define IRLPT_CLIENT_H
-
-/* Debug function */
-
-/* int client_init( struct device *dev); */
-
-/*
- * if it's static, it doesn't go in here.
- */
-
-void irlpt_client_get_value_confirm(int result, __u16 obj_id,
- struct ias_value *value,
- void *priv);
-void irlpt_client_connect_indication( void *instance,
- void *sap,
- struct qos_info *qos,
- int max_seg_size,
- struct sk_buff *skb);
-void irlpt_client_connect_request( struct irlpt_cb *self);
-
-extern hashbin_t *irlpt_clients;
-
-#endif
diff --git a/include/net/irda/irlpt_cli_fsm.h b/include/net/irda/irlpt_cli_fsm.h
deleted file mode 100644
index b6fd153a5..000000000
--- a/include/net/irda/irlpt_cli_fsm.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*********************************************************************
- *
- * Filename: irlpt_cli_fsm.h
- * Version: 0.1
- * Sources: irlan_event.h
- *
- * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>,
- * All Rights Reserved.
- * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>,
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * I, Thomas Davis, provide no warranty for any of this software.
- * This material is provided "AS-IS" and at no charge.
- *
- ********************************************************************/
-
-#ifndef IRLPT_EVENT_H
-#define IRLPT_EVENT_H
-
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-
-extern void irlpt_client_do_event( struct irlpt_cb *self,
- IRLPT_EVENT event,
- struct sk_buff *skb,
- struct irlpt_info *info);
-extern void irlpt_client_next_state( struct irlpt_cb *self,
- IRLPT_CLIENT_STATE state);
-
-#endif
-
diff --git a/include/net/irda/irlpt_common.h b/include/net/irda/irlpt_common.h
deleted file mode 100644
index 25ad8ef01..000000000
--- a/include/net/irda/irlpt_common.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/*********************************************************************
- *
- * Filename: irlpt_common.h
- * Version:
- * Description:
- * Status: Experimental.
- * Author: Thomas Davis, <ratbert@radiks.net>
- * Created at: Sat Feb 21 18:54:38 1998
- * Modified at: Sun Mar 8 23:44:19 1998
- * Modified by: Dag Brattli <dagb@cs.uit.no>
- * Sources: irlan.c
- *
- * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>,
- * Dag Brattli, <dagb@cs.uit.no>
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * I, Thomas Davis, provide no warranty for any of this software.
- * This material is provided "AS-IS" and at no charge.
- *
- ********************************************************************/
-
-#ifndef IRLPT_COMMON_H
-#define IRLPT_COMMON_H
-
-#include <net/irda/qos.h>
-#include <net/irda/irmod.h>
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <linux/miscdevice.h>
-
-#include <linux/poll.h>
-
-extern char *irlpt_service_type[];
-extern char *irlpt_port_type[];
-extern char *irlpt_connected[];
-extern char *irlpt_reasons[];
-extern char *irlpt_client_fsm_state[];
-extern char *irlpt_server_fsm_state[];
-extern char *irlpt_fsm_event[];
-
-extern wait_queue_head_t lpt_wait;
-
-extern struct irlpt_cb *irlpt_find_handle(unsigned int minor);
-extern void irlpt_flow_control(struct sk_buff *skb);
-
-extern ssize_t irlpt_read( struct file *file, char *buffer,
- size_t count, loff_t *noidea);
-extern ssize_t irlpt_write(struct file *file, const char *buffer,
- size_t count, loff_t *noidea);
-extern loff_t irlpt_seek(struct file *, loff_t, int);
-extern int irlpt_open(struct inode * inode, struct file *file);
-extern int irlpt_close(struct inode *inode, struct file *file);
-extern u_int irlpt_poll(struct file *file, poll_table *wait);
-
-/* FSM definitions */
-
-typedef enum {
- IRLPT_CLIENT_IDLE,
- IRLPT_CLIENT_QUERY,
- IRLPT_CLIENT_READY,
- IRLPT_CLIENT_WAITI,
- IRLPT_CLIENT_CONN,
-} IRLPT_CLIENT_STATE;
-
-typedef enum {
- IRLPT_SERVER_IDLE,
- IRLPT_SERVER_CONN,
-} IRLPT_SERVER_STATE;
-
-/* IrLPT Events */
-
-typedef enum {
- QUERY_REMOTE_IAS,
- IAS_PROVIDER_AVAIL,
- IAS_PROVIDER_NOT_AVAIL,
- LAP_DISCONNECT,
- LMP_CONNECT,
- LMP_DISCONNECT,
- LMP_CONNECT_INDICATION,
- LMP_DISCONNECT_INDICATION,
- IRLPT_DISCOVERY_INDICATION,
- IRLPT_CONNECT_REQUEST,
- IRLPT_DISCONNECT_REQUEST,
- CLIENT_DATA_INDICATION,
-} IRLPT_EVENT;
-
-struct irlpt_info {
- struct lsap_cb *lsap;
- __u8 dlsap_sel;
- __u32 daddr;
- __u32 saddr;
-};
-
-/* Command packet types */
-
-#define IRLPT_MAX_PACKET 1024
-#define IRLPT_MAX_HEADER LMP_MAX_HEADER
-#define IRLPT_MAX_DEVICES 3
-#define IRLPT_MAGIC 0x0755
-
-typedef enum {
- IRLPT_DISCONNECTED,
- IRLPT_WAITING,
- IRLPT_CONNECTED,
- IRLPT_FLUSHED,
-} IRLPT_SERVER_STATUS;
-
-#define IRLPT_LSAP 0x09
-
-#define PI_SERVICE_TYPE 0x00
-
-#define IRLPT_UNKNOWN 0x00 /* not defined yet. */
-#define IRLPT_THREE_WIRE_RAW 0x01 /* bit 0 */
-#define IRLPT_THREE_WIRE 0x02 /* bit 1 */
-#define IRLPT_NINE_WIRE 0x04 /* bit 2 */
-#define IRLPT_CENTRONICS 0x08 /* bit 3 */
-#define IRLPT_SERVER_MODE 0xFF /* our own flag */
-
-#define PI_PORT_TYPE 0x01
-
-#define IRLPT_SERIAL 0x01 /* bit 0 */
-#define IRLPT_PARALLEL 0x02 /* bit 1 */
-
-#define PI_PORT_NAME 0x02
-
-#define PI_CRITICAL 0x80
-
-struct irlpt_cb {
- QUEUE queue; /* must be first. */
-
- int magic; /* magic used to detect corruption of
- the struct */
- __u32 daddr; /* address of remote printer */
- __u32 saddr; /* my local address. */
-
- struct timer_list retry_timer;
-
- int volatile state; /* Current state of IrCOMM layer */
- int open_retries;
- int in_use; /* flag to prevent re-use */
- char ifname[16]; /* name of the allocated instance,
- and registered device. */
- struct lsap_cb *lsap; /* lmp handle */
-
- __u8 dlsap_sel; /* remote LSAP selector address */
- __u8 slsap_sel; /* local LSAP selectoraddress */
- __u8 servicetype; /* Type of remote service, ie THREE_WIRE_RAW */
- __u8 porttype; /* type of remote port. */
-
- struct miscdevice ir_dev; /* used to register the misc device. */
-
- int count; /* open count */
- int max_data_size; /* max frame size we can send */
- int max_header_size; /* how much header space is needed */
- int pkt_count; /* how many packets are queued up */
-
- wait_queue_head_t read_wait; /* wait queues */
- wait_queue_head_t write_wait;
- wait_queue_head_t ex_wait;
-
- /* this is used to remove the printer when it's gone */
- struct timer_list lpt_timer;
- void (*timeout) (unsigned long data);
-
- void (*do_event) (struct irlpt_cb *self, IRLPT_EVENT event,
- struct sk_buff *skb,
- struct irlpt_info *info);
-
- /* this is used by the server side of the system */
-
- IRLPT_SERVER_STATE connected;
-
- int eof;
- int service_LSAP;
-
- struct sk_buff_head rx_queue; /* read buffer queue */
-};
-
-/* Debug function */
-void irlpt_dump_buffer(struct sk_buff *);
-
-#endif
diff --git a/include/net/irda/irlpt_server.h b/include/net/irda/irlpt_server.h
deleted file mode 100644
index 44e310f95..000000000
--- a/include/net/irda/irlpt_server.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*********************************************************************
- *
- * Filename: irlpt_server.h
- * Version: 0.1
- * Description:
- * Status: Experimental.
- * Author: Dag Brattli <dagb@cs.uit.no>
- * Created at: Sat Feb 21 18:54:38 1998
- * Modified at: Tue Sep 22 11:41:42 1998
- * Modified by: Dag Brattli <dagb@cs.uit.no>
- *
- * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>
- * Copyright (c) 1998, Dag Brattli,
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * I, Thomas Davis, provide no warranty for any of this software. This
- * material is provided "AS-IS" and at no charge.
- *
- ********************************************************************/
-
-#ifndef IRLPT_SERVER_H
-#define IRLPT_SERVER_H
-
-#include "qos.h"
-#include "irmod.h"
-
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <linux/miscdevice.h>
-
-/* int server_init( struct device *dev); */
-
-extern struct irlpt_cb *irlpt_server;
-
-#endif
diff --git a/include/net/irda/irlpt_server_fsm.h b/include/net/irda/irlpt_server_fsm.h
deleted file mode 100644
index c7ee3f871..000000000
--- a/include/net/irda/irlpt_server_fsm.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*********************************************************************
- *
- * Filename: server_server_fsm.h
- * Version: 0.1
- * Sources: irlan_event.h
- *
- * Copyright (c) 1997 Dag Brattli <dagb@cs.uit.no>,
- * All Rights Reserved.
- * Copyright (c) 1998, Thomas Davis, <ratbert@radiks.net>,
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * I, Thomas Davis, provide no warranty for any of this software.
- * This material is provided "AS-IS" and at no charge.
- *
- ********************************************************************/
-
-#ifndef IRLPT_EVENT_H
-#define IRLPT_EVENT_H
-
-#include <linux/kernel.h>
-#include <linux/skbuff.h>
-
-void irlpt_server_do_event( struct irlpt_cb *self,
- IRLPT_EVENT event,
- struct sk_buff *skb,
- struct irlpt_info *info);
-void irlpt_server_next_state( struct irlpt_cb *self,
- IRLPT_SERVER_STATE state);
-
-#endif
diff --git a/include/net/irda/irmod.h b/include/net/irda/irmod.h
index ba551b7d4..f80221fb8 100644
--- a/include/net/irda/irmod.h
+++ b/include/net/irda/irmod.h
@@ -119,7 +119,7 @@ static inline int irda_lock(int *lock)
inline int irda_unlock(int *lock);
-void irda_notify_init(struct notify_t *notify);
+void irda_notify_init(notify_t *notify);
void irda_execute_as_process(void *self, TODO_CALLBACK callback, __u32 param);
void irmanager_notify(struct irmanager_event *event);
diff --git a/include/net/irda/irport.h b/include/net/irda/irport.h
index 0912e0496..74d6133d8 100644
--- a/include/net/irda/irport.h
+++ b/include/net/irda/irport.h
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Aug 3 13:49:59 1997
- * Modified at: Wed May 19 15:31:16 1999
+ * Modified at: Sat Jun 26 16:57:03 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no>
@@ -53,10 +53,10 @@ void irport_start(struct irda_device *idev, int iobase);
void irport_stop(struct irda_device *idev, int iobase);
int irport_probe(int iobase);
-void irport_change_speed(struct irda_device *idev, int speed);
+void irport_change_speed(struct irda_device *idev, __u32 speed);
void irport_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-int irport_hard_xmit(struct sk_buff *skb, struct device *dev);
+int irport_hard_xmit(struct sk_buff *skb, struct net_device *dev);
void irport_wait_until_sent(struct irda_device *idev);
#endif
diff --git a/include/net/irda/irqueue.h b/include/net/irda/irqueue.h
index 523de0db6..52ce2b9d7 100644
--- a/include/net/irda/irqueue.h
+++ b/include/net/irda/irqueue.h
@@ -6,10 +6,10 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Jun 9 13:26:50 1998
- * Modified at: Tue May 25 07:54:41 1999
+ * Modified at: Thu Jul 1 10:18:21 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (C) 1998, Aage Kvalnes <aage@cs.uit.no>
+ * Copyright (C) 1998-1999, Aage Kvalnes <aage@cs.uit.no>
* Copyright (c) 1998, Dag Brattli
* All Rights Reserved.
*
@@ -28,7 +28,7 @@
********************************************************************/
#include <linux/types.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#ifndef QUEUE_H
#define QUEUE_H
@@ -70,25 +70,25 @@ struct queue_t {
};
typedef struct hashbin_t {
- int magic;
- int hb_type;
- int hb_size;
+ __u32 magic;
+ int hb_type;
+ int hb_size;
spinlock_t hb_mutex[ HASHBIN_SIZE ] ALIGN;
QUEUE* hb_queue[ HASHBIN_SIZE ] ALIGN;
QUEUE* hb_current;
} hashbin_t;
-hashbin_t *hashbin_new( int type);
-int hashbin_delete( hashbin_t* hashbin, FREE_FUNC func);
-int hashbin_clear( hashbin_t* hashbin, FREE_FUNC free_func);
-void hashbin_insert( hashbin_t* hashbin, QUEUE* entry, __u32 hashv,
- char* name);
-void* hashbin_find( hashbin_t* hashbin, __u32 hashv, char* name);
-void* hashbin_remove( hashbin_t* hashbin, __u32 hashv, char* name);
-void* hashbin_remove_first( hashbin_t *hashbin);
-QUEUE *hashbin_get_first( hashbin_t *hashbin);
-QUEUE *hashbin_get_next( hashbin_t *hashbin);
+hashbin_t *hashbin_new(int type);
+int hashbin_delete(hashbin_t* hashbin, FREE_FUNC func);
+int hashbin_clear(hashbin_t* hashbin, FREE_FUNC free_func);
+void hashbin_insert(hashbin_t* hashbin, QUEUE* entry, __u32 hashv,
+ char* name);
+void* hashbin_find(hashbin_t* hashbin, __u32 hashv, char* name);
+void* hashbin_remove(hashbin_t* hashbin, __u32 hashv, char* name);
+void* hashbin_remove_first(hashbin_t *hashbin);
+QUEUE *hashbin_get_first(hashbin_t *hashbin);
+QUEUE *hashbin_get_next(hashbin_t *hashbin);
void enqueue_last(QUEUE **queue, QUEUE* element);
void enqueue_first(QUEUE **queue, QUEUE* element);
@@ -100,7 +100,7 @@ QUEUE *dequeue_first(QUEUE **queue);
* Returns the number of elements in the hashbin
*
*/
-extern __inline__ int hashbin_get_size( hashbin_t* hashbin)
+extern __inline__ int hashbin_get_size(hashbin_t* hashbin)
{
return hashbin->hb_size;
}
diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h
index 3e6511cea..a44ab2b9f 100644
--- a/include/net/irda/irttp.h
+++ b/include/net/irda/irttp.h
@@ -6,10 +6,11 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Aug 31 20:14:31 1997
- * Modified at: Mon May 10 19:14:51 1999
+ * Modified at: Mon Sep 27 11:38:01 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1998-1999 Dag Brattli <dagb@cs.uit.no>,
+ * All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -27,7 +28,7 @@
#include <linux/types.h>
#include <linux/skbuff.h>
-#include <asm/spinlock.h>
+#include <linux/spinlock.h>
#include <net/irda/irda.h>
#include <net/irda/irlmp.h>
@@ -41,11 +42,11 @@
#define TTP_PARAMETERS 0x80
#define TTP_MORE 0x80
-#define DEFAULT_INITIAL_CREDIT 22
+#define DEFAULT_INITIAL_CREDIT 14
-#define LOW_THRESHOLD 4
-#define HIGH_THRESHOLD 8
-#define TTP_MAX_QUEUE 22
+#define LOW_THRESHOLD 4
+#define HIGH_THRESHOLD 10
+#define TTP_MAX_QUEUE 14
/* Some priorities for disconnect requests */
#define P_NORMAL 0
@@ -54,13 +55,16 @@
#define SAR_DISABLE 0
#define SAR_UNBOUND 0xffffffff
+/* Parameters */
+#define TTP_MAX_SDU_SIZE 0x01
+
/*
* This structure contains all data assosiated with one instance of a TTP
* connection.
*/
struct tsap_cb {
- QUEUE queue; /* For linking it into the hashbin */
- int magic; /* Just in case */
+ QUEUE queue; /* For linking it into the hashbin */
+ magic_t magic; /* Just in case */
__u8 stsap_sel; /* Source TSAP */
__u8 dtsap_sel; /* Destination TSAP */
@@ -82,7 +86,7 @@ struct tsap_cb {
int rx_queue_lock;
spinlock_t lock;
- struct notify_t notify; /* Callbacks to client layer */
+ notify_t notify; /* Callbacks to client layer */
struct irda_statistics stats;
struct timer_list todo_timer;
@@ -103,16 +107,14 @@ struct tsap_cb {
};
struct irttp_cb {
- int magic;
-
+ magic_t magic;
hashbin_t *tsaps;
};
int irttp_init(void);
void irttp_cleanup(void);
-struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit,
- struct notify_t *notify);
+struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify);
int irttp_close_tsap(struct tsap_cb *self);
int irttp_data_request(struct tsap_cb *self, struct sk_buff *skb);
@@ -122,12 +124,12 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel,
__u32 saddr, __u32 daddr,
struct qos_info *qos, __u32 max_sdu_size,
struct sk_buff *userdata);
-void irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size,
+int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size,
struct sk_buff *userdata);
-struct tsap_cb *irttp_dup(struct tsap_cb *self, void *instance);
-void irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *skb,
- int priority);
+int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *skb,
+ int priority);
void irttp_flow_request(struct tsap_cb *self, LOCAL_FLOW flow);
+struct tsap_cb *irttp_dup(struct tsap_cb *self, void *instance);
static __inline __u32 irttp_get_saddr(struct tsap_cb *self)
{
@@ -139,6 +141,11 @@ static __inline __u32 irttp_get_daddr(struct tsap_cb *self)
return irlmp_get_daddr(self->lsap);
}
+static __inline __u32 irttp_get_max_seq_size(struct tsap_cb *self)
+{
+ return self->max_seg_size;
+}
+
extern struct irttp_cb *irttp;
#endif /* IRTTP_H */
diff --git a/include/net/irda/irtty.h b/include/net/irda/irtty.h
index 38b5c4d81..b04d093d1 100644
--- a/include/net/irda/irtty.h
+++ b/include/net/irda/irtty.h
@@ -6,7 +6,7 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Tue Dec 9 21:13:12 1997
- * Modified at: Mon May 10 13:22:23 1999
+ * Modified at: Thu Jul 1 10:13:02 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
* Copyright (c) 1997, 1999 Dag Brattli, All Rights Reserved.
@@ -42,11 +42,10 @@
#endif
struct irtty_cb {
- QUEUE q; /* Must be first */
-
- int magic;
+ QUEUE q; /* Must be first */
+ magic_t magic;
- struct tty_struct *tty; /* Ptr to TTY structure */
+ struct tty_struct *tty;
struct irda_device idev;
};
diff --git a/include/net/irda/irvtd.h b/include/net/irda/irvtd.h
deleted file mode 100644
index 68340087a..000000000
--- a/include/net/irda/irvtd.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*********************************************************************
- *
- * Filename: irvtd.h
- * Version: 0.1
- * Sources: irlpt.h
- *
- * Copyright (c) 1998, Takahide Higuchi <thiguchi@pluto.dti.ne.jp>,
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * I, Takahide Higuchi, provide no warranty for any of this software.
- * This material is provided "AS-IS" and at no charge.
- *
- ********************************************************************/
-
-#ifndef IRVTD_H
-#define IRVTD_H
-
-#include <linux/types.h>
-#include <linux/ioctl.h>
-#include <linux/tqueue.h>
-#include <linux/serial.h>
-
-#include <net/irda/irmod.h>
-#include <net/irda/qos.h>
-#include <net/irda/ircomm_common.h>
-
-
-#define IRVTD_MAGIC 0xff545943 /* random */
-#define COMM_MAX_TTY 1
-#define IRVTD_RX_QUEUE_HIGH 10
-#define IRVTD_RX_QUEUE_LOW 2
-
-#define IRCOMM_MAJOR 60; /* Zero means automatic allocation
- 60,61,62,and 63 is reserved for experiment */
-#define IRVTD_MINOR 64
-
-
-
-struct irvtd_cb {
-
- int magic; /* magic used to detect corruption of the struct */
-
- /* if daddr is NULL, remote device have not been discovered yet */
-
- int tx_disable;
- int rx_disable;
- struct sk_buff *txbuff;
- struct sk_buff_head rxbuff;
- struct ircomm_cb *comm; /* ircomm instance */
-
- __u32 tx_max_sdu_size;
- __u32 max_header_size;
- /*
- * These members are used for compatibility with usual serial device.
- * See linux/serial.h
- */
-
- int flags;
- struct tty_struct *tty;
-
- int line;
- int count; /* open count */
- int blocked_open;
- wait_queue_head_t open_wait;
- wait_queue_head_t close_wait;
- wait_queue_head_t delta_msr_wait;
- wait_queue_head_t tx_wait;
-
- struct timer_list tx_timer;
- struct timer_list rx_timer;
-
- long pgrp;
- long session;
- unsigned short closing_wait; /* time to wait before closing */
- unsigned short close_delay;
-
- int custom_divisor;
- int mcr;
- int msr;
- int cts_stoptx;
- int ttp_stoptx;
- int ttp_stoprx;
- int disconnect_pend;
- struct serial_icounter_struct icount;
- int read_status_mask;
- int ignore_status_mask;
-};
-
-
-#endif
diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
new file mode 100644
index 000000000..e661f2dfa
--- /dev/null
+++ b/include/net/irda/parameters.h
@@ -0,0 +1,108 @@
+/*********************************************************************
+ *
+ * Filename: parameters.h
+ * Version: 1.0
+ * Description: A more general way to handle (pi,pl,pv) parameters
+ * Status: Experimental.
+ * Author: Dag Brattli <dagb@cs.uit.no>
+ * Created at: Mon Jun 7 08:47:28 1999
+ * Modified at: Sun Jun 13 09:17:54 1999
+ * Modified by: Dag Brattli <dagb@cs.uit.no>
+ *
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ********************************************************************/
+
+#ifndef IRDA_PARAMS_H
+#define IRDA_PARAMS_H
+
+/*
+ * The currently supported types. Beware not to change the sequence since
+ * it a good reason why the sized integers has a value equal to their size
+ */
+typedef enum {
+ PV_INTEGER, /* Integer of any (pl) length */
+ PV_INT_8_BITS, /* Integer of 8 bits in length */
+ PV_INT_16_BITS, /* Integer of 16 bits in length */
+ PV_STRING, /* \0 terminated string */
+ PV_INT_32_BITS, /* Integer of 32 bits in length */
+ PV_OCT_SEQ, /* Octet sequence */
+ PV_NO_VALUE /* Does not contain any value (pl=0) */
+} PV_TYPE;
+
+/* Bit 7 of type field */
+#define PV_BIG_ENDIAN 0x80
+#define PV_LITTLE_ENDIAN 0x00
+#define PV_MASK 0x7f /* To mask away endian bit */
+
+#define PV_PUT 0
+#define PV_GET 1
+
+typedef union {
+ char *c;
+ __u8 b;
+ __u16 s;
+ __u32 i;
+ __u8 *bp;
+ __u16 *sp;
+ __u32 *ip;
+} pv_t;
+
+typedef struct {
+ __u8 pi;
+ __u8 pl;
+ pv_t pv;
+} param_t;
+
+typedef int (*PI_HANDLER)(void *self, param_t *param, int get);
+typedef int (*PV_HANDLER)(void *self, __u8 *buf, int len, __u8 pi,
+ PV_TYPE type, PI_HANDLER func);
+
+typedef struct {
+ PI_HANDLER func; /* Handler for this parameter identifier */
+ PV_TYPE type; /* Data type for this parameter */
+} pi_minor_info_t;
+
+typedef struct {
+ pi_minor_info_t *pi_minor_call_table;
+ int len;
+} pi_major_info_t;
+
+typedef struct {
+ pi_major_info_t *tables;
+ int len;
+ __u8 pi_mask;
+ int pi_major_offset;
+} pi_param_info_t;
+
+int irda_param_pack(__u8 *buf, char *fmt, ...);
+int irda_param_unpack(__u8 *buf, char *fmt, ...);
+
+int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
+ pi_param_info_t *info);
+int irda_param_extract(void *self, __u8 *buf, int len, pi_param_info_t *info);
+int irda_param_extract_all(void *self, __u8 *buf, int len,
+ pi_param_info_t *info);
+
+extern inline int irda_param_insert_byte(__u8 *buf, __u8 pi, __u8 pv)
+{
+ return irda_param_pack(buf, "bbb", pi, 1, pv);
+}
+
+#endif /* IRDA_PARAMS_H */
+
diff --git a/include/net/irda/qos.h b/include/net/irda/qos.h
index 39ca2b7b9..9f7876cf7 100644
--- a/include/net/irda/qos.h
+++ b/include/net/irda/qos.h
@@ -1,33 +1,41 @@
/*********************************************************************
*
* Filename: qos.h
- * Version: 0.1
+ * Version: 1.0
* Description: Quality of Service definitions
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Fri Sep 19 23:21:09 1997
- * Modified at: Wed Dec 9 10:32:47 1998
+ * Modified at: Mon Aug 16 10:00:18 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1998 Dag Brattli <dagb@cs.uit.no>, All Rights Reserved.
+ * Copyright (c) 1999 Dag Brattli, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
- * Neither Dag Brattli nor University of Tromsø admit liability nor
- * provide warranty for any of this software. This material is
- * provided "AS-IS" and at no charge.
- *
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
********************************************************************/
-#ifndef QOS_H
-#define QOS_H
+#ifndef IRDA_QOS_H
+#define IRDA_QOS_H
#include <linux/config.h>
#include <linux/skbuff.h>
+#include <net/irda/parameters.h>
+
#define PI_BAUD_RATE 0x01
#define PI_MAX_TURN_TIME 0x82
#define PI_DATA_SIZE 0x83
@@ -41,21 +49,22 @@
#define IR_115200_MAX 0x3f
/* Baud rates (first byte) */
-#define IR_2400 0x01
-#define IR_9600 0x02
-#define IR_19200 0x04
-#define IR_38400 0x08
-#define IR_57600 0x10
-#define IR_115200 0x20
-#define IR_576000 0x40
-#define IR_1152000 0x80
+#define IR_2400 0x01
+#define IR_9600 0x02
+#define IR_19200 0x04
+#define IR_38400 0x08
+#define IR_57600 0x10
+#define IR_115200 0x20
+#define IR_576000 0x40
+#define IR_1152000 0x80
/* Baud rates (second byte) */
-#define IR_4000000 0x01
+#define IR_4000000 0x01
+#define IR_16000000 0x02
/* Quality of Service information */
typedef struct {
- int value;
+ __u32 value;
__u16 bits; /* LSB is first byte, MSB is second byte */
} qos_value_t;
@@ -77,24 +86,21 @@ struct qos_info {
#endif
};
-extern int baud_rates[];
-extern int data_size[];
-extern int min_turn_time[];
-extern int add_bofs[];
-extern int compression[];
+extern __u32 baud_rates[];
+extern __u32 data_size[];
+extern __u32 min_turn_time[];
+extern __u32 add_bofs[];
+extern __u32 compression[];
-void irda_init_max_qos_capabilies( struct qos_info *qos);
-void irda_qos_compute_intersection( struct qos_info *, struct qos_info *);
-int irda_insert_qos_negotiation_params( struct qos_info *qos, __u8 *fp);
-void irda_qos_negotiate( struct qos_info *qos_rx, struct qos_info *qos_tx,
- struct sk_buff *skb);
+void irda_init_max_qos_capabilies(struct qos_info *qos);
+void irda_qos_compute_intersection(struct qos_info *, struct qos_info *);
-int msb_index ( __u16 byte);
-int byte_value( __u8 byte, int *array);
-int value_index( int value, int *array);
-int index_value( int index, int *array);
+int msb_index(__u16 byte);
+__u32 byte_value(__u8 byte, int *array);
+int value_index(__u32 value, int *array);
+__u32 index_value(int index, int *array);
-void irda_qos_bits_to_value( struct qos_info *qos);
+void irda_qos_bits_to_value(struct qos_info *qos);
#endif
diff --git a/include/net/irda/timer.h b/include/net/irda/timer.h
index 6c194a3d4..f9e598a09 100644
--- a/include/net/irda/timer.h
+++ b/include/net/irda/timer.h
@@ -6,10 +6,10 @@
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sat Aug 16 00:59:29 1997
- * Modified at: Tue Apr 6 16:17:16 1999
+ * Modified at: Wed Jun 23 22:56:51 1999
* Modified by: Dag Brattli <dagb@cs.uit.no>
*
- * Copyright (c) 1997, 1998 Dag Brattli <dagb@cs.uit.no>,
+ * Copyright (c) 1997, 1998-1999 Dag Brattli <dagb@cs.uit.no>,
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
@@ -37,28 +37,34 @@
/*
* Timeout definitions, some defined in IrLAP p. 92
*/
-#define POLL_TIMEOUT 450*HZ/1000 /* Must never exceed 500 ms */
-#define FINAL_TIMEOUT 500*HZ/1000 /* Must never exceed 500 ms */
+#define POLL_TIMEOUT (450*HZ/1000) /* Must never exceed 500 ms */
+#define FINAL_TIMEOUT (500*HZ/1000) /* Must never exceed 500 ms */
/*
* Normally twice of p-timer. Note 3, IrLAP p. 60 suggests at least twice
* duration of the P-timer.
*/
-#define WD_TIMEOUT POLL_TIMEOUT*2
-#define MEDIABUSY_TIMEOUT 500*HZ/1000 /* 500 msec */
+#define WD_TIMEOUT (POLL_TIMEOUT*2)
+#define MEDIABUSY_TIMEOUT (500*HZ/1000) /* 500 msec */
/*
* Slot timer must never exceed 85 ms, and must always be at least 25 ms,
- * suggested to 75-85 msec by IrDA lite
+ * suggested to 75-85 msec by IrDA lite. This doesn't work with a lot of
+ * devices, and other stackes uses a lot more, so it's best we do it as well
*/
-#define SLOT_TIMEOUT 80*HZ/1000
-#define QUERY_TIMEOUT HZ /* 1 sec */
+#define SLOT_TIMEOUT (90*HZ/1000)
-#define WATCHDOG_TIMEOUT 20*HZ /* 20 sec */
+/*
+ * We set the query timeout to 100 ms and then expect the value to be
+ * multiplied with the number of slots to product the actual timeout value
+ */
+#define QUERY_TIMEOUT (HZ/10)
+
+#define WATCHDOG_TIMEOUT (20*HZ) /* 20 sec */
-typedef void (*TIMER_CALLBACK)(unsigned long);
+typedef void (*TIMER_CALLBACK)(void *);
-void irda_start_timer(struct timer_list *ptimer, int timeout, int data,
+void irda_start_timer(struct timer_list *ptimer, int timeout, void* data,
TIMER_CALLBACK callback);
inline void irlap_start_slot_timer(struct irlap_cb *self, int timeout);
diff --git a/include/net/irda/toshoboe.h b/include/net/irda/toshoboe.h
index b2f5b953b..dc2ea1269 100644
--- a/include/net/irda/toshoboe.h
+++ b/include/net/irda/toshoboe.h
@@ -25,6 +25,12 @@
/*
* $Log: toshoboe.h,v $
+ * Revision 1.4 1999/06/29 13:46:42 root
+ * ls
+ *
+ * Revision 1.3 1999/06/29 12:31:03 root
+ * *** empty log message ***
+ *
* Revision 1.2 1999/05/09 01:43:08 root
* *** empty log message ***
*
@@ -157,6 +163,8 @@ struct toshoboe_cb
struct OboeTaskFile *taskfile; /*The taskfile */
void *xmit_bufs[TX_SLOTS]; /*The buffers */
void *recv_bufs[RX_SLOTS];
+ int open;
+ int stopped; /*Stopped by some or other APM stuff*/
};
diff --git a/include/net/llc.h b/include/net/llc.h
index 654a658d7..609b2123d 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -70,7 +70,7 @@ struct llc_struct
unsigned char local_sap;
unsigned char remote_sap ;
char remote_mac[MAX_ADDR_LEN]; /* MAC address of remote session partner */
- struct device *dev; /* Device we are attached to */
+ struct net_device *dev; /* Device we are attached to */
unsigned char llc_mode; /* See doc 7.1 on p70 */
#define MODE_ADM 1
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 7a51f367a..d4f99ff72 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -62,13 +62,13 @@ extern void ndisc_cleanup(void);
extern int ndisc_rcv(struct sk_buff *skb, unsigned long len);
-extern void ndisc_send_ns(struct device *dev,
+extern void ndisc_send_ns(struct net_device *dev,
struct neighbour *neigh,
struct in6_addr *solicit,
struct in6_addr *daddr,
struct in6_addr *saddr);
-extern void ndisc_send_rs(struct device *dev,
+extern void ndisc_send_rs(struct net_device *dev,
struct in6_addr *saddr,
struct in6_addr *daddr);
@@ -79,7 +79,7 @@ extern void ndisc_send_redirect(struct sk_buff *skb,
struct neighbour *neigh,
struct in6_addr *target);
-extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct device *dev, int dir);
+extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
struct rt6_info * dflt_rt_lookup(void);
@@ -101,18 +101,12 @@ extern int igmp6_event_report(struct sk_buff *skb,
extern void igmp6_cleanup(void);
-extern __inline__ struct neighbour * ndisc_get_neigh(struct device *dev, struct in6_addr *addr)
+extern __inline__ struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr)
{
- if (dev) {
- struct neighbour *neigh;
+ if (dev)
+ return __neigh_lookup(&nd_tbl, addr, dev, 1);
- start_bh_atomic();
- neigh = __neigh_lookup(&nd_tbl, addr, dev, 1);
- end_bh_atomic();
-
- return neigh;
- }
return NULL;
}
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 95803be46..1a6f1dad0 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -89,16 +89,17 @@ struct neighbour
struct neighbour *next;
struct neigh_table *tbl;
struct neigh_parms *parms;
- struct device *dev;
+ struct net_device *dev;
unsigned long used;
unsigned long confirmed;
unsigned long updated;
__u8 flags;
__u8 nud_state;
__u8 type;
+ __u8 dead;
atomic_t probes;
rwlock_t lock;
- unsigned char ha[MAX_ADDR_LEN];
+ unsigned char ha[(MAX_ADDR_LEN+sizeof(unsigned long)-1)&~(sizeof(unsigned long)-1)];
struct hh_cache *hh;
atomic_t refcnt;
int (*output)(struct sk_buff *skb);
@@ -123,7 +124,7 @@ struct neigh_ops
struct pneigh_entry
{
struct pneigh_entry *next;
- struct device *dev;
+ struct net_device *dev;
u8 key[0];
};
@@ -141,10 +142,12 @@ struct neigh_table
int family;
int entry_size;
int key_len;
+ __u32 (*hash)(const void *pkey, const struct net_device *);
int (*constructor)(struct neighbour *);
int (*pconstructor)(struct pneigh_entry *);
void (*pdestructor)(struct pneigh_entry *);
void (*proxy_redo)(struct sk_buff *skb);
+ char *id;
struct neigh_parms parms;
/* HACK. gc_* shoul follow parms without a gap! */
int gc_interval;
@@ -159,6 +162,7 @@ struct neigh_table
rwlock_t lock;
unsigned long last_rand;
struct neigh_parms *parms_list;
+ kmem_cache_t *kmem_cachep;
struct neigh_statistics stats;
struct neighbour *hash_buckets[NEIGH_HASHMASK+1];
struct pneigh_entry *phash_buckets[PNEIGH_HASHMASK+1];
@@ -168,29 +172,29 @@ extern void neigh_table_init(struct neigh_table *tbl);
extern int neigh_table_clear(struct neigh_table *tbl);
extern struct neighbour * neigh_lookup(struct neigh_table *tbl,
const void *pkey,
- struct device *dev);
+ struct net_device *dev);
extern struct neighbour * neigh_create(struct neigh_table *tbl,
const void *pkey,
- struct device *dev);
+ struct net_device *dev);
extern void neigh_destroy(struct neighbour *neigh);
extern int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb);
-extern int neigh_update(struct neighbour *neigh, u8 *lladdr, u8 new, int override, int arp);
-extern int neigh_ifdown(struct neigh_table *tbl, struct device *dev);
+extern int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new, int override, int arp);
+extern int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev);
extern int neigh_resolve_output(struct sk_buff *skb);
extern int neigh_connected_output(struct sk_buff *skb);
extern int neigh_compat_output(struct sk_buff *skb);
extern struct neighbour *neigh_event_ns(struct neigh_table *tbl,
u8 *lladdr, void *saddr,
- struct device *dev);
+ struct net_device *dev);
-extern struct neigh_parms *neigh_parms_alloc(struct device *dev, struct neigh_table *tbl);
+extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl);
extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms);
extern unsigned long neigh_rand_reach_time(unsigned long base);
extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
struct sk_buff *skb);
-extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct device *dev, int creat);
-extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct device *dev);
+extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat);
+extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev);
struct netlink_callback;
struct nlmsghdr;
@@ -199,21 +203,17 @@ extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
extern void neigh_app_ns(struct neighbour *n);
-extern int neigh_sysctl_register(struct device *dev, struct neigh_parms *p,
+extern int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
int p_id, int pdev_id, char *p_name);
extern void neigh_sysctl_unregister(struct neigh_parms *p);
/*
* Neighbour references
- *
- * When neighbour pointers are passed to "client" code the
- * reference count is increased. The count is 0 if the node
- * is only referenced by the corresponding table.
*/
extern __inline__ void neigh_release(struct neighbour *neigh)
{
- if (atomic_dec_and_test(&neigh->refcnt) && neigh->tbl == NULL)
+ if (atomic_dec_and_test(&neigh->refcnt))
neigh_destroy(neigh);
}
@@ -224,6 +224,8 @@ extern __inline__ struct neighbour * neigh_clone(struct neighbour *neigh)
return neigh;
}
+#define neigh_hold(n) atomic_inc(&(n)->refcnt)
+
extern __inline__ void neigh_confirm(struct neighbour *neigh)
{
if (neigh)
@@ -249,7 +251,7 @@ extern __inline__ int neigh_event_send(struct neighbour *neigh, struct sk_buff *
}
extern __inline__ struct neighbour *
-__neigh_lookup(struct neigh_table *tbl, const void *pkey, struct device *dev, int creat)
+__neigh_lookup(struct neigh_table *tbl, const void *pkey, struct net_device *dev, int creat)
{
struct neighbour *n = neigh_lookup(tbl, pkey, dev);
diff --git a/include/net/netrom.h b/include/net/netrom.h
index 356a7d270..e69d76a01 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -56,7 +56,7 @@ enum {
typedef struct {
ax25_address user_addr, source_addr, dest_addr;
- struct device *device;
+ struct net_device *device;
unsigned char my_index, my_id;
unsigned char your_index, your_id;
unsigned char state, condition, bpqext, window;
@@ -79,7 +79,7 @@ struct nr_neigh {
ax25_address callsign;
ax25_digi *digipeat;
ax25_cb *ax25;
- struct device *dev;
+ struct net_device *dev;
unsigned char quality;
unsigned char locked;
unsigned short count;
@@ -114,12 +114,12 @@ extern int sysctl_netrom_transport_requested_window_size;
extern int sysctl_netrom_transport_no_activity_timeout;
extern int sysctl_netrom_routing_control;
extern int sysctl_netrom_link_fails_count;
-extern int nr_rx_frame(struct sk_buff *, struct device *);
+extern int nr_rx_frame(struct sk_buff *, struct net_device *);
extern void nr_destroy_socket(struct sock *);
/* nr_dev.c */
-extern int nr_rx_ip(struct sk_buff *, struct device *);
-extern int nr_init(struct device *);
+extern int nr_rx_ip(struct sk_buff *, struct net_device *);
+extern int nr_init(struct net_device *);
#include <net/nrcall.h>
@@ -141,9 +141,9 @@ extern void nr_enquiry_response(struct sock *);
extern void nr_check_iframes_acked(struct sock *, unsigned short);
/* nr_route.c */
-extern void nr_rt_device_down(struct device *);
-extern struct device *nr_dev_first(void);
-extern struct device *nr_dev_get(ax25_address *);
+extern void nr_rt_device_down(struct net_device *);
+extern struct net_device *nr_dev_first(void);
+extern struct net_device *nr_dev_get(ax25_address *);
extern int nr_rt_ioctl(unsigned int, void *);
extern void nr_link_failed(ax25_cb *, int);
extern int nr_route_frame(struct sk_buff *, ax25_cb *);
diff --git a/include/net/p8022.h b/include/net/p8022.h
index 03d7c3d66..8b8871c97 100644
--- a/include/net/p8022.h
+++ b/include/net/p8022.h
@@ -1,7 +1,7 @@
#ifndef _NET_P8022_H
#define _NET_P8022_H
-extern struct datalink_proto *register_8022_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *));
+extern struct datalink_proto *register_8022_client(unsigned char type, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *));
extern void unregister_8022_client(unsigned char type);
#endif
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 46262159d..7307cc76a 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -86,7 +86,7 @@ struct Qdisc
u32 handle;
atomic_t refcnt;
struct sk_buff_head q;
- struct device *dev;
+ struct net_device *dev;
struct tc_stats stats;
unsigned long tx_timeo;
@@ -137,16 +137,23 @@ extern __inline__ void tcf_tree_unlock(struct tcf_proto *tp)
extern __inline__ unsigned long
cls_set_class(struct tcf_proto *tp, unsigned long *clp, unsigned long cl)
{
+ unsigned long old_cl;
+
tcf_tree_lock(tp);
- cl = xchg(clp, cl);
+ old_cl = *clp;
+ *clp = cl;
tcf_tree_unlock(tp);
- return cl;
+ return old_cl;
}
extern __inline__ unsigned long
__cls_set_class(unsigned long *clp, unsigned long cl)
{
- return xchg(clp, cl);
+ unsigned long old_cl;
+
+ old_cl = *clp;
+ *clp = cl;
+ return old_cl;
}
@@ -412,15 +419,15 @@ extern struct Qdisc_ops bfifo_qdisc_ops;
int register_qdisc(struct Qdisc_ops *qops);
int unregister_qdisc(struct Qdisc_ops *qops);
-struct Qdisc *qdisc_lookup(struct device *dev, u32 handle);
-struct Qdisc *qdisc_lookup_class(struct device *dev, u32 handle);
-void dev_init_scheduler(struct device *dev);
-void dev_shutdown(struct device *dev);
-void dev_activate(struct device *dev);
-void dev_deactivate(struct device *dev);
+struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
+struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
+void dev_init_scheduler(struct net_device *dev);
+void dev_shutdown(struct net_device *dev);
+void dev_activate(struct net_device *dev);
+void dev_deactivate(struct net_device *dev);
void qdisc_reset(struct Qdisc *qdisc);
void qdisc_destroy(struct Qdisc *qdisc);
-struct Qdisc * qdisc_create_dflt(struct device *dev, struct Qdisc_ops *ops);
+struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops);
int qdisc_new_estimator(struct tc_stats *stats, struct rtattr *opt);
void qdisc_kill_estimator(struct tc_stats *stats);
struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct rtattr *tab);
@@ -430,7 +437,7 @@ int tc_filter_init(void);
int pktsched_init(void);
extern void qdisc_run_queues(void);
-extern int qdisc_restart(struct device *dev);
+extern int qdisc_restart(struct net_device *dev);
extern spinlock_t qdisc_runqueue_lock;
@@ -453,7 +460,7 @@ extern __inline__ int qdisc_pending(void)
extern __inline__ void qdisc_run(struct Qdisc *q)
{
spin_lock(&qdisc_runqueue_lock);
- if (!qdisc_on_runqueue(q)) {
+ if (!qdisc_on_runqueue(q) && q->dev) {
q->h.forw = &qdisc_head;
q->h.back = qdisc_head.back;
qdisc_head.back->forw = &q->h;
@@ -462,24 +469,33 @@ extern __inline__ void qdisc_run(struct Qdisc *q)
spin_unlock(&qdisc_runqueue_lock);
}
+extern __inline__ int __qdisc_wakeup(struct net_device *dev)
+{
+ int res;
+
+ while ((res = qdisc_restart(dev))<0 && !dev->tbusy)
+ /* NOTHING */;
+
+ return res;
+}
+
+
/* If the device is not throttled, restart it and add to run list.
- * BH must be disabled on this CPU.
+ * BH must be disabled on this CPU. Usually, it is called by timers.
*/
-extern __inline__ void qdisc_wakeup(struct device *dev)
+extern __inline__ void qdisc_wakeup(struct net_device *dev)
{
- if (!dev->tbusy) {
- spin_lock(&dev->queue_lock);
- if (qdisc_restart(dev))
- qdisc_run(dev->qdisc);
- spin_unlock(&dev->queue_lock);
- }
+ spin_lock(&dev->queue_lock);
+ if (dev->tbusy || __qdisc_wakeup(dev))
+ qdisc_run(dev->qdisc);
+ spin_unlock(&dev->queue_lock);
}
/* Calculate maximal size of packet seen by hard_start_xmit
routine of this device.
*/
-extern __inline__ unsigned psched_mtu(struct device *dev)
+extern __inline__ unsigned psched_mtu(struct net_device *dev)
{
unsigned mtu = dev->mtu;
return dev->hard_header ? mtu + dev->hard_header_len : mtu;
diff --git a/include/net/protocol.h b/include/net/protocol.h
index f6e947b1f..53b58205e 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -45,6 +45,9 @@ struct inet_protocol
const char *name;
};
+extern rwlock_t inet_protocol_lock;
+
+
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
struct inet6_protocol
{
@@ -61,6 +64,8 @@ struct inet6_protocol
void *data;
const char *name;
};
+
+extern rwlock_t inet6_protocol_lock;
#endif
extern struct inet_protocol *inet_protocol_base;
diff --git a/include/net/psnap.h b/include/net/psnap.h
index 49a68f7e9..30dbee161 100644
--- a/include/net/psnap.h
+++ b/include/net/psnap.h
@@ -1,7 +1,7 @@
#ifndef _NET_PSNAP_H
#define _NET_PSNAP_H
-extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct device *, struct packet_type *));
+extern struct datalink_proto *register_snap_client(unsigned char *desc, int (*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *));
extern void unregister_snap_client(unsigned char *desc);
#endif
diff --git a/include/net/rarp.h b/include/net/rarp.h
deleted file mode 100644
index 7bfb08ef1..000000000
--- a/include/net/rarp.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* linux/net/inet/rarp.h */
-#ifndef _RARP_H
-#define _RARP_H
-
-extern int rarp_ioctl(unsigned int cmd, void *arg);
-extern int rarp_get_info(char *buffer,
- char **start,
- off_t offset,
- int length,
- int dummy);
-#endif /* _RARP_H */
-
diff --git a/include/net/raw.h b/include/net/raw.h
index 4d2e6e98b..00b8f5dd5 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -30,9 +30,13 @@ extern int raw_rcv(struct sock *, struct sk_buff *);
#define RAWV4_HTABLE_SIZE MAX_INET_PROTOS
extern struct sock *raw_v4_htable[RAWV4_HTABLE_SIZE];
+extern rwlock_t raw_v4_lock;
-extern struct sock *raw_v4_lookup(struct sock *sk, unsigned short num,
- unsigned long raddr, unsigned long laddr,
- int dif);
+
+extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num,
+ unsigned long raddr, unsigned long laddr,
+ int dif);
+
+extern struct sock *raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash);
#endif /* _RAW_H */
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index d54572d1f..51954bc25 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -5,10 +5,14 @@
#define RAWV6_HTABLE_SIZE MAX_INET_PROTOS
extern struct sock *raw_v6_htable[RAWV6_HTABLE_SIZE];
+extern rwlock_t raw_v6_lock;
+extern struct sock * ipv6_raw_deliver(struct sk_buff *skb,
+ int nexthdr, unsigned long len);
-extern struct sock *raw_v6_lookup(struct sock *sk, unsigned short num,
- struct in6_addr *loc_addr, struct in6_addr *rmt_addr);
+
+extern struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num,
+ struct in6_addr *loc_addr, struct in6_addr *rmt_addr);
extern int rawv6_rcv(struct sock *sk,
struct sk_buff *skb,
diff --git a/include/net/rose.h b/include/net/rose.h
index 1c8684d2d..a74f132c2 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -84,7 +84,7 @@ struct rose_neigh {
ax25_address callsign;
ax25_digi *digipeat;
ax25_cb *ax25;
- struct device *dev;
+ struct net_device *dev;
unsigned short count;
unsigned short use;
unsigned int number;
@@ -121,7 +121,7 @@ typedef struct {
ax25_address source_digis[ROSE_MAX_DIGIS];
ax25_address dest_digis[ROSE_MAX_DIGIS];
struct rose_neigh *neighbour;
- struct device *device;
+ struct net_device *device;
unsigned int lci, rand;
unsigned char state, condition, qbitincl, defer;
unsigned char cause, diagnostic;
@@ -156,12 +156,12 @@ extern char *rose2asc(rose_address *);
extern struct sock *rose_find_socket(unsigned int, struct rose_neigh *);
extern void rose_kill_by_neigh(struct rose_neigh *);
extern unsigned int rose_new_lci(struct rose_neigh *);
-extern int rose_rx_call_request(struct sk_buff *, struct device *, struct rose_neigh *, unsigned int);
+extern int rose_rx_call_request(struct sk_buff *, struct net_device *, struct rose_neigh *, unsigned int);
extern void rose_destroy_socket(struct sock *);
/* rose_dev.c */
-extern int rose_rx_ip(struct sk_buff *, struct device *);
-extern int rose_init(struct device *);
+extern int rose_rx_ip(struct sk_buff *, struct net_device *);
+extern int rose_init(struct net_device *);
#include <net/rosecall.h>
@@ -197,12 +197,12 @@ extern struct rose_neigh *rose_loopback_neigh;
extern int rose_add_loopback_neigh(void);
extern int rose_add_loopback_node(rose_address *);
extern void rose_del_loopback_node(rose_address *);
-extern void rose_rt_device_down(struct device *);
-extern void rose_link_device_down(struct device *);
-extern struct device *rose_dev_first(void);
-extern struct device *rose_dev_get(rose_address *);
+extern void rose_rt_device_down(struct net_device *);
+extern void rose_link_device_down(struct net_device *);
+extern struct net_device *rose_dev_first(void);
+extern struct net_device *rose_dev_get(rose_address *);
extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *);
-extern struct device *rose_ax25_dev_get(char *);
+extern struct net_device *rose_ax25_dev_get(char *);
extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *);
extern int rose_rt_ioctl(unsigned int, void *);
extern void rose_link_failed(ax25_cb *, int);
diff --git a/include/net/route.h b/include/net/route.h
index e230f45fc..3a2e8e2e4 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -38,11 +38,7 @@
#define RTO_ONLINK 0x01
#define RTO_TPROXY 0x80000000
-#ifdef CONFIG_IP_TRANSPARENT_PROXY
-#define RTO_CONN RTO_TPROXY
-#else
#define RTO_CONN 0
-#endif
struct rt_key
{
@@ -100,11 +96,11 @@ extern rwlock_t ip_rt_acct_lock;
extern void ip_rt_init(void);
extern void ip_rt_redirect(u32 old_gw, u32 dst, u32 new_gw,
- u32 src, u8 tos, struct device *dev);
+ u32 src, u8 tos, struct net_device *dev);
extern void ip_rt_advice(struct rtable **rp, int advice);
extern void rt_cache_flush(int how);
extern int ip_route_output(struct rtable **, u32 dst, u32 src, u32 tos, int oif);
-extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct device *devin);
+extern int ip_route_input(struct sk_buff*, u32 dst, u32 src, u8 tos, struct net_device *devin);
extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
extern void ip_rt_update_pmtu(struct dst_entry *dst, unsigned mtu);
extern void ip_rt_send_redirect(struct sk_buff *skb);
diff --git a/include/net/sock.h b/include/net/sock.h
index af6bf7679..6b05d7107 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -85,42 +85,32 @@
#include <net/irda/irda.h>
#endif
+#if defined(CONFIG_ATM) || defined(CONFIG_ATM_MODULE)
+struct atm_vcc;
+#endif
+
#ifdef CONFIG_FILTER
#include <linux/filter.h>
#endif
#include <asm/atomic.h>
+#include <net/dst.h>
#define MIN_WRITE_SPACE 2048
/* The AF_UNIX specific socket options */
struct unix_opt {
- int family;
- char * name;
- int locks;
struct unix_address *addr;
struct dentry * dentry;
struct semaphore readsem;
struct sock * other;
struct sock ** list;
struct sock * gc_tree;
- int inflight;
- atomic_t user_count;
+ atomic_t inflight;
+ rwlock_t lock;
+ wait_queue_head_t peer_wait;
};
-#ifdef CONFIG_NETLINK
-struct netlink_callback;
-
-struct netlink_opt {
- pid_t pid;
- unsigned groups;
- pid_t dst_pid;
- unsigned dst_groups;
- int (*handler)(int unit, struct sk_buff *skb);
- atomic_t locks;
- struct netlink_callback *cb;
-};
-#endif
/* Once the IPX ncpd patches are in these are going into protinfo. */
#if defined(CONFIG_IPX) || defined(CONFIG_IPX_MODULE)
@@ -196,6 +186,25 @@ struct raw_opt {
};
#endif
+#if defined(CONFIG_INET) || defined (CONFIG_INET_MODULE)
+struct inet_opt
+{
+ int ttl; /* TTL setting */
+ int tos; /* TOS */
+ unsigned cmsg_flags;
+ struct ip_options *opt;
+ unsigned char hdrincl; /* Include headers ? */
+ __u8 mc_ttl; /* Multicasting TTL */
+ __u8 mc_loop; /* Loopback */
+ __u8 recverr;
+ __u8 pmtudisc;
+ int mc_index; /* Multicast device index */
+ __u32 mc_addr;
+ struct ip_mc_socklist *mc_list; /* Group array */
+};
+#endif
+
+
/* This defines a selective acknowledgement block. */
struct tcp_sack_block {
__u32 start_seq;
@@ -252,6 +261,7 @@ struct tcp_opt {
*/
__u32 snd_ssthresh; /* Slow start size threshold */
__u16 snd_cwnd_cnt; /* Linear increase counter */
+ __u16 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
__u8 dup_acks; /* Consequetive duplicate acks seen from other end */
__u8 delayed_acks;
__u16 user_mss; /* mss requested by user in ioctl */
@@ -287,7 +297,7 @@ struct tcp_opt {
__u32 rcv_tsval; /* Time stamp value */
__u32 rcv_tsecr; /* Time stamp echo reply */
__u32 ts_recent; /* Time stamp to echo next */
- __u32 ts_recent_stamp;/* Time we stored ts_recent (for aging) */
+ long ts_recent_stamp;/* Time we stored ts_recent (for aging) */
int num_sacks; /* Number of SACK blocks */
struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
@@ -306,6 +316,12 @@ struct tcp_opt {
struct open_request **syn_wait_last;
int syn_backlog; /* Backlog of received SYNs */
+ int write_pending;
+
+ unsigned int keepalive_time; /* time before keep alive takes place */
+ unsigned int keepalive_intvl; /* time interval between keep alive probes */
+ unsigned char keepalive_probes; /* num of allowed keep alive probes */
+ unsigned char syn_retries; /* num of allowed syn retries */
};
@@ -344,6 +360,10 @@ struct tcp_opt {
* } tp_pinfo;
*
* }
+ *
+ * The idea failed because IPv6 transition asssumes dual IP/IPv6 sockets.
+ * So, net_pinfo is IPv6 are really, and protinfo unifies all another
+ * private areas.
*/
/* Define this to get the sk->debug debugging facility. */
@@ -371,10 +391,6 @@ do { spin_lock_init(&((__sk)->lock.slock)); \
} while(0);
struct sock {
- /* Local port binding hash linkage. */
- struct sock *bind_next;
- struct sock **bind_pprev;
-
/* Socket demultiplex comparisons on incoming packets. */
__u32 daddr; /* Foreign IPv4 addr */
__u32 rcv_saddr; /* Bound local IPv4 addr */
@@ -385,6 +401,8 @@ struct sock {
/* Main hash linkage for various protocol lookup tables. */
struct sock *next;
struct sock **pprev;
+ struct sock *bind_next;
+ struct sock **bind_pprev;
volatile unsigned char state, /* Connection state */
zapped; /* In ax25 & ipx means not linked */
@@ -393,12 +411,14 @@ struct sock {
unsigned short family; /* Address family */
unsigned char reuse, /* SO_REUSEADDR setting */
nonagle; /* Disable Nagle algorithm? */
+ atomic_t refcnt; /* Reference count */
socket_lock_t lock; /* Synchronizer... */
int rcvbuf; /* Size of receive buffer in bytes */
- wait_queue_head_t *sleep; /* Sock wait queue */
+ wait_queue_head_t *sleep; /* Sock wait queue */
struct dst_entry *dst_cache; /* Destination cache */
+ rwlock_t dst_lock;
atomic_t rmem_alloc; /* Receive queue bytes committed */
struct sk_buff_head receive_queue; /* Incoming packets */
atomic_t wmem_alloc; /* Transmit queue bytes committed */
@@ -437,6 +457,8 @@ struct sock {
struct sk_buff *tail;
} backlog;
+ rwlock_t callback_lock;
+
/* Error queue, rarely used. */
struct sk_buff_head error_queue;
@@ -487,6 +509,9 @@ struct sock {
union {
void *destruct_hook;
struct unix_opt af_unix;
+#if defined(CONFIG_INET) || defined (CONFIG_INET_MODULE)
+ struct inet_opt af_inet;
+#endif
#if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE)
struct atalk_sock af_at;
#endif
@@ -512,32 +537,22 @@ struct sock {
rose_cb *rose;
#endif
#ifdef CONFIG_NETLINK
- struct netlink_opt af_netlink;
+ struct netlink_opt *af_netlink;
#endif
#if defined(CONFIG_ECONET) || defined(CONFIG_ECONET_MODULE)
struct econet_opt *af_econet;
#endif
+#if defined(CONFIG_ATM) || defined(CONFIG_ATM_MODULE)
+ struct atm_vcc *af_atm;
+#endif
#if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE)
struct irda_sock *irda;
#endif
} protinfo;
- /* IP 'private area' or will be eventually. */
- int ip_ttl; /* TTL setting */
- int ip_tos; /* TOS */
- unsigned ip_cmsg_flags;
- struct ip_options *opt;
- unsigned char ip_hdrincl; /* Include headers ? */
- __u8 ip_mc_ttl; /* Multicasting TTL */
- __u8 ip_mc_loop; /* Loopback */
- __u8 ip_recverr;
- __u8 ip_pmtudisc;
- int ip_mc_index; /* Multicast device index */
- __u32 ip_mc_addr;
- struct ip_mc_socklist *ip_mc_list; /* Group array */
-
- /* This part is used for the timeout functions (timer.c). */
- int timeout; /* What are we waiting for? */
+
+ /* This part is used for the timeout functions. */
+ spinlock_t timer_lock; /* Required until timer in core is repaired */
struct timer_list timer; /* This is the sock cleanup timer. */
struct timeval stamp;
@@ -580,8 +595,9 @@ struct proto {
int (*connect)(struct sock *sk,
struct sockaddr *uaddr,
int addr_len);
+ int (*disconnect)(struct sock *sk, int flags);
- struct sock * (*accept) (struct sock *sk, int flags);
+ struct sock * (*accept) (struct sock *sk, int flags, int *err);
void (*retransmit)(struct sock *sk, int all);
void (*write_wakeup)(struct sock *sk);
void (*read_wakeup)(struct sock *sk);
@@ -621,14 +637,6 @@ struct proto {
int inuse, highestinuse;
};
-#define TIME_WRITE 1 /* Not yet used */
-#define TIME_RETRANS 2 /* Retransmit timer */
-#define TIME_DACK 3 /* Delayed ack timer */
-#define TIME_CLOSE 4
-#define TIME_KEEPOPEN 5
-#define TIME_DESTROY 6
-#define TIME_DONE 7 /* Used to absorb those last few packets */
-#define TIME_PROBE0 8
/* About 10 seconds */
#define SOCK_DESTROY_TIME (10*HZ)
@@ -640,23 +648,6 @@ struct proto {
#define RCV_SHUTDOWN 1
#define SEND_SHUTDOWN 2
-/* Per-protocol hash table implementations use this to make sure
- * nothing changes.
- */
-extern rwlock_t sockhash_lock;
-#define SOCKHASH_LOCK_READ() read_lock_bh(&sockhash_lock)
-#define SOCKHASH_UNLOCK_READ() read_unlock_bh(&sockhash_lock)
-#define SOCKHASH_LOCK_WRITE() write_lock_bh(&sockhash_lock)
-#define SOCKHASH_UNLOCK_WRITE() write_unlock_bh(&sockhash_lock)
-
-/* The following variants must _only_ be used when you know you
- * can only be executing in a BH context.
- */
-#define SOCKHASH_LOCK_READ_BH() read_lock(&sockhash_lock)
-#define SOCKHASH_UNLOCK_READ_BH() read_unlock(&sockhash_lock)
-#define SOCKHASH_LOCK_WRITE_BH() write_lock(&sockhash_lock)
-#define SOCKHASH_UNLOCK_WRITE_BH() write_unlock(&sockhash_lock)
-
/* Used by processes to "lock" a socket state, so that
* interrupts and bottom half handlers won't change it
* from under us. It essentially blocks any incoming
@@ -667,8 +658,23 @@ extern rwlock_t sockhash_lock;
* the backlog queue. This queue is processed by the
* owner of the socket lock right before it is released.
*/
-extern void lock_sock(struct sock *sk);
-extern void release_sock(struct sock *sk);
+extern void __lock_sock(struct sock *sk);
+extern void __release_sock(struct sock *sk);
+#define lock_sock(__sk) \
+do { spin_lock_bh(&((__sk)->lock.slock)); \
+ if ((__sk)->lock.users != 0) \
+ __lock_sock(__sk); \
+ (__sk)->lock.users = 1; \
+ spin_unlock_bh(&((__sk)->lock.slock)); \
+} while(0)
+#define release_sock(__sk) \
+do { spin_lock_bh(&((__sk)->lock.slock)); \
+ (__sk)->lock.users = 0; \
+ if ((__sk)->backlog.tail != NULL) \
+ __release_sock(__sk); \
+ wake_up(&((__sk)->lock.wq)); \
+ spin_unlock_bh(&((__sk)->lock.slock)); \
+} while(0)
/* BH context may only use the following locking interface. */
#define bh_lock_sock(__sk) spin_lock(&((__sk)->lock.slock))
@@ -696,7 +702,6 @@ static __inline__ int max(unsigned int a, unsigned int b)
extern struct sock * sk_alloc(int family, int priority, int zero_it);
extern void sk_free(struct sock *sk);
-extern void destroy_sock(struct sock *sk);
extern struct sk_buff *sock_wmalloc(struct sock *sk,
unsigned long size, int force,
@@ -706,6 +711,7 @@ extern struct sk_buff *sock_rmalloc(struct sock *sk,
int priority);
extern void sock_wfree(struct sk_buff *skb);
extern void sock_rfree(struct sk_buff *skb);
+extern void sock_cfree(struct sk_buff *skb);
extern unsigned long sock_rspace(struct sock *sk);
extern unsigned long sock_wspace(struct sock *sk);
@@ -729,9 +735,7 @@ extern void sock_kfree_s(struct sock *sk, void *mem, int size);
* Functions to fill in entries in struct proto_ops when a protocol
* does not implement a particular function.
*/
-extern int sock_no_dup(struct socket *, struct socket *);
-extern int sock_no_release(struct socket *,
- struct socket *);
+extern int sock_no_release(struct socket *);
extern int sock_no_bind(struct socket *,
struct sockaddr *, int);
extern int sock_no_connect(struct socket *,
@@ -760,6 +764,9 @@ extern int sock_no_sendmsg(struct socket *,
extern int sock_no_recvmsg(struct socket *,
struct msghdr *, int,
struct scm_cookie *);
+extern int sock_no_mmap(struct file *file,
+ struct socket *sock,
+ struct vm_area_struct *vma);
/*
* Default socket callbacks and setup code
@@ -815,6 +822,139 @@ extern __inline__ void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
#endif /* CONFIG_FILTER */
/*
+ * Socket reference counting postulates.
+ *
+ * * Each user of socket SHOULD hold a reference count.
+ * * Each access point to socket (an hash table bucket, reference from a list,
+ * running timer, skb in flight MUST hold a reference count.
+ * * When reference count hits 0, it means it will never increase back.
+ * * When reference count hits 0, it means that no references from
+ * outside exist to this socket and current process on current CPU
+ * is last user and may/should destroy this socket.
+ * * sk_free is called from any context: process, BH, IRQ. When
+ * it is called, socket has no references from outside -> sk_free
+ * may release descendant resources allocated by the socket, but
+ * to the time when it is called, socket is NOT referenced by any
+ * hash tables, lists etc.
+ * * Packets, delivered from outside (from network or from another process)
+ * and enqueued on receive/error queues SHOULD NOT grab reference count,
+ * when they sit in queue. Otherwise, packets will leak to hole, when
+ * socket is looked up by one cpu and unhasing is made by another CPU.
+ * It is true for udp/raw, netlink (leak to receive and error queues), tcp
+ * (leak to backlog). Packet socket does all the processing inside
+ * ptype_lock, so that it has not this race condition. UNIX sockets
+ * use separate SMP lock, so that they are prone too.
+ */
+
+/* Grab socket reference count. This operation is valid only
+ when sk is ALREADY grabbed f.e. it is found in hash table
+ or a list and the lookup is made under lock preventing hash table
+ modifications.
+ */
+
+extern __inline__ void sock_hold(struct sock *sk)
+{
+ atomic_inc(&sk->refcnt);
+}
+
+/* Ungrab socket in the context, which assumes that socket refcnt
+ cannot hit zero, f.e. it is true in context of any socketcall.
+ */
+extern __inline__ void __sock_put(struct sock *sk)
+{
+ atomic_dec(&sk->refcnt);
+}
+
+/* Ungrab socket and destroy it, if it was the last reference. */
+extern __inline__ void sock_put(struct sock *sk)
+{
+ if (atomic_dec_and_test(&sk->refcnt))
+ sk_free(sk);
+}
+
+extern __inline__ struct dst_entry *
+__sk_dst_get(struct sock *sk)
+{
+ return sk->dst_cache;
+}
+
+extern __inline__ struct dst_entry *
+sk_dst_get(struct sock *sk)
+{
+ struct dst_entry *dst;
+
+ read_lock(&sk->dst_lock);
+ dst = sk->dst_cache;
+ if (dst)
+ dst_hold(dst);
+ read_unlock(&sk->dst_lock);
+ return dst;
+}
+
+extern __inline__ void
+__sk_dst_set(struct sock *sk, struct dst_entry *dst)
+{
+ struct dst_entry *old_dst;
+
+ old_dst = sk->dst_cache;
+ sk->dst_cache = dst;
+ dst_release(old_dst);
+}
+
+extern __inline__ void
+sk_dst_set(struct sock *sk, struct dst_entry *dst)
+{
+ write_lock(&sk->dst_lock);
+ __sk_dst_set(sk, dst);
+ write_unlock(&sk->dst_lock);
+}
+
+extern __inline__ void
+__sk_dst_reset(struct sock *sk)
+{
+ struct dst_entry *old_dst;
+
+ old_dst = sk->dst_cache;
+ sk->dst_cache = NULL;
+ dst_release(old_dst);
+}
+
+extern __inline__ void
+sk_dst_reset(struct sock *sk)
+{
+ write_lock(&sk->dst_lock);
+ __sk_dst_reset(sk);
+ write_unlock(&sk->dst_lock);
+}
+
+extern __inline__ struct dst_entry *
+__sk_dst_check(struct sock *sk, u32 cookie)
+{
+ struct dst_entry *dst = sk->dst_cache;
+
+ if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
+ sk->dst_cache = NULL;
+ return NULL;
+ }
+
+ return dst;
+}
+
+extern __inline__ struct dst_entry *
+sk_dst_check(struct sock *sk, u32 cookie)
+{
+ struct dst_entry *dst = sk_dst_get(sk);
+
+ if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
+ sk_dst_reset(sk);
+ return NULL;
+ }
+
+ return dst;
+}
+
+
+/*
* Queue a received datagram if it will fit. Stream and sequenced
* protocols can't normally use this as they need to fit buffers in
* and play with them.
@@ -825,6 +965,7 @@ extern __inline__ void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
extern __inline__ void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
{
+ sock_hold(sk);
skb->sk = sk;
skb->destructor = sock_wfree;
atomic_add(skb->truesize, &sk->wmem_alloc);
@@ -837,12 +978,16 @@ extern __inline__ void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
atomic_add(skb->truesize, &sk->rmem_alloc);
}
+extern __inline__ void skb_set_owner_c(struct sk_buff *skb, struct sock *sk)
+{
+ sock_hold(sk);
+ skb->sk = sk;
+ skb->destructor = sock_cfree;
+}
+
extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
{
-#ifdef CONFIG_FILTER
- struct sk_filter *filter;
-#endif
/* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
number of warnings when compiling with -W --ANK
*/
@@ -850,8 +995,21 @@ extern __inline__ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
return -ENOMEM;
#ifdef CONFIG_FILTER
- if ((filter = sk->filter) != NULL && sk_filter(skb, filter))
- return -EPERM; /* Toss packet */
+ if (sk->filter) {
+ int err = 0;
+ struct sk_filter *filter;
+
+ /* It would be deadlock, if sock_queue_rcv_skb is used
+ with socket lock! We assume that users of this
+ function are lock free.
+ */
+ bh_lock_sock(sk);
+ if ((filter = sk->filter) != NULL && sk_filter(skb, filter))
+ err = -EPERM;
+ bh_unlock_sock(sk);
+ if (err)
+ return err; /* Toss packet */
+ }
#endif /* CONFIG_FILTER */
skb_set_owner_r(skb, sk);
@@ -906,26 +1064,17 @@ extern __inline__ int sock_writeable(struct sock *sk)
return sock_wspace(sk) >= MIN_WRITE_SPACE;
}
-/*
- * Declarations from timer.c
- */
-
-extern struct sock *timer_base;
-
-extern void net_delete_timer (struct sock *);
-extern void net_reset_timer (struct sock *, int, unsigned long);
-extern void net_timer (unsigned long);
-
extern __inline__ int gfp_any(void)
{
return in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
}
+
/*
* Enable debug/info messages
*/
-#if 1
+#if 0
#define NETDEBUG(x) do { } while (0)
#else
#define NETDEBUG(x) do { x; } while (0)
@@ -952,5 +1101,4 @@ extern __inline__ int gfp_any(void)
lock_sock(sk); \
}
-
#endif /* _SOCK_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 9127795c2..6c73eef3f 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -18,17 +18,25 @@
#ifndef _TCP_H
#define _TCP_H
+#define TCP_DEBUG 1
+
#include <linux/config.h>
#include <linux/tcp.h>
#include <linux/slab.h>
#include <net/checksum.h>
+#include <net/sock.h>
/* This is for all connections with a full identity, no wildcards.
* New scheme, half the table is for TIME_WAIT, the other half is
* for the rest. I'll experiment with dynamic table growth later.
*/
+struct tcp_ehash_bucket {
+ rwlock_t lock;
+ struct sock *chain;
+} __attribute__((__aligned__(8)));
+
extern int tcp_ehash_size;
-extern struct sock **tcp_ehash;
+extern struct tcp_ehash_bucket *tcp_ehash;
/* This is for listening sockets, thus all sockets which possess wildcards. */
#define TCP_LHTABLE_SIZE 32 /* Yes, really, this is all you need. */
@@ -38,6 +46,9 @@ extern struct sock **tcp_ehash;
* the port space is shared.
*/
extern struct sock *tcp_listening_hash[TCP_LHTABLE_SIZE];
+extern rwlock_t tcp_lhash_lock;
+extern atomic_t tcp_lhash_users;
+extern wait_queue_head_t tcp_lhash_wait;
/* There are a few simple rules, which allow for local port reuse by
* an application. In essence:
@@ -78,32 +89,21 @@ struct tcp_bind_bucket {
struct tcp_bind_bucket **pprev;
};
-extern struct tcp_bind_bucket **tcp_bhash;
+struct tcp_bind_hashbucket {
+ spinlock_t lock;
+ struct tcp_bind_bucket *chain;
+};
+
+extern struct tcp_bind_hashbucket *tcp_bhash;
extern int tcp_bhash_size;
+extern spinlock_t tcp_portalloc_lock;
extern kmem_cache_t *tcp_bucket_cachep;
-extern struct tcp_bind_bucket *tcp_bucket_create(unsigned short snum);
+extern struct tcp_bind_bucket *tcp_bucket_create(struct tcp_bind_hashbucket *head,
+ unsigned short snum);
extern void tcp_bucket_unlock(struct sock *sk);
extern int tcp_port_rover;
-
-/* Level-1 socket-demux cache. */
-#define TCP_NUM_REGS 32
-extern struct sock *tcp_regs[TCP_NUM_REGS];
-
-#define TCP_RHASH_FN(__fport) \
- ((((__fport) >> 7) ^ (__fport)) & (TCP_NUM_REGS - 1))
-#define TCP_RHASH(__fport) tcp_regs[TCP_RHASH_FN((__fport))]
-#define TCP_SK_RHASH_FN(__sock) TCP_RHASH_FN((__sock)->dport)
-#define TCP_SK_RHASH(__sock) tcp_regs[TCP_SK_RHASH_FN((__sock))]
-
-static __inline__ void tcp_reg_zap(struct sock *sk)
-{
- struct sock **rpp;
-
- rpp = &(TCP_SK_RHASH(sk));
- if(*rpp == sk)
- *rpp = NULL;
-}
+extern struct sock *tcp_v4_lookup_listener(u32 addr, unsigned short hnum, int dif);
/* These are AF independent. */
static __inline__ int tcp_bhashfn(__u16 lport)
@@ -120,8 +120,6 @@ struct tcp_tw_bucket {
* XXX Yes I know this is gross, but I'd have to edit every single
* XXX networking file if I created a "struct sock_header". -DaveM
*/
- struct sock *bind_next;
- struct sock **bind_pprev;
__u32 daddr;
__u32 rcv_saddr;
__u16 dport;
@@ -129,20 +127,30 @@ struct tcp_tw_bucket {
int bound_dev_if;
struct sock *next;
struct sock **pprev;
+ struct sock *bind_next;
+ struct sock **bind_pprev;
unsigned char state,
zapped;
__u16 sport;
unsigned short family;
unsigned char reuse,
nonagle;
+ atomic_t refcnt;
/* And these are ours. */
+ int hashent;
__u32 rcv_nxt;
- struct tcp_func *af_specific;
+ __u32 snd_nxt;
+ __u32 ts_recent;
+ long ts_recent_stamp;
struct tcp_bind_bucket *tb;
struct tcp_tw_bucket *next_death;
struct tcp_tw_bucket **pprev_death;
int death_slot;
+#ifdef CONFIG_TCP_TW_RECYCLE
+ unsigned long ttd;
+ int rto;
+#endif
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
struct in6_addr v6_daddr;
struct in6_addr v6_rcv_saddr;
@@ -151,6 +159,23 @@ struct tcp_tw_bucket {
extern kmem_cache_t *tcp_timewait_cachep;
+extern __inline__ void tcp_tw_put(struct tcp_tw_bucket *tw)
+{
+ if (atomic_dec_and_test(&tw->refcnt)) {
+#ifdef INET_REFCNT_DEBUG
+ printk(KERN_DEBUG "tw_bucket %p released\n", tw);
+#endif
+ kmem_cache_free(tcp_timewait_cachep, tw);
+ }
+}
+
+extern int tcp_tw_death_row_slot;
+extern void tcp_timewait_kill(struct tcp_tw_bucket *tw);
+extern void tcp_tw_schedule(struct tcp_tw_bucket *tw);
+extern void tcp_tw_reschedule(struct tcp_tw_bucket *tw);
+extern void tcp_tw_deschedule(struct tcp_tw_bucket *tw);
+
+
/* Socket demux engine toys. */
#ifdef __BIG_ENDIAN
#define TCP_COMBINED_PORTS(__sport, __dport) \
@@ -220,10 +245,14 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
* poor stacks do signed 16bit maths!
*/
#define MAX_WINDOW 32767
-#define MIN_WINDOW 2048
-#define MAX_ACK_BACKLOG 2
#define MAX_DELAY_ACK 2
-#define TCP_WINDOW_DIFF 2048
+
+/*
+ * How much of the receive buffer do we advertize
+ * (the rest is reserved for headers and driver packet overhead)
+ * Use a power of 2.
+ */
+#define WINDOW_ADVERTISE_DIVISOR 2
/* urg_data states */
#define URG_VALID 0x0100
@@ -247,8 +276,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
#define TCP_FIN_TIMEOUT (3*60*HZ) /* BSD style FIN_WAIT2 deadlock breaker */
#define TCP_ACK_TIME (3*HZ) /* time to delay before sending an ACK */
-#define TCP_DONE_TIME (5*HZ/2)/* maximum time to wait before actually
- * destroying a socket */
#define TCP_WRITE_TIME (30*HZ) /* initial time to wait for an ACK,
* after last transmit */
#define TCP_TIMEOUT_INIT (3*HZ) /* RFC 1122 initial timeout value */
@@ -259,15 +286,18 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
* there is no window */
#define TCP_KEEPALIVE_TIME (120*60*HZ) /* two hours */
#define TCP_KEEPALIVE_PROBES 9 /* Max of 9 keepalive probes */
-#define TCP_KEEPALIVE_PERIOD ((75*HZ)>>2) /* period of keepalive check */
+#define TCP_KEEPALIVE_INTVL (75*HZ)
+
+#define MAX_TCP_KEEPIDLE 32767
+#define MAX_TCP_KEEPINTVL 32767
+#define MAX_TCP_KEEPCNT 127
+#define MAX_TCP_SYNCNT 127
#define TCP_SYNACK_PERIOD (HZ/2) /* How often to run the synack slow timer */
#define TCP_QUICK_TRIES 8 /* How often we try to retransmit, until
* we tell the link layer that it is something
* wrong (e.g. that it can expire redirects) */
-#define TCP_BUCKETGC_PERIOD (HZ)
-
/* TIME_WAIT reaping mechanism. */
#define TCP_TWKILL_SLOTS 8 /* Please keep this a power of 2. */
#define TCP_TWKILL_PERIOD ((HZ*60)/TCP_TWKILL_SLOTS)
@@ -301,10 +331,24 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
#define TCPOLEN_SACK_BASE_ALIGNED 4
#define TCPOLEN_SACK_PERBLOCK 8
+#define TIME_WRITE 1 /* Not yet used */
+#define TIME_RETRANS 2 /* Retransmit timer */
+#define TIME_DACK 3 /* Delayed ack timer */
+#define TIME_PROBE0 4
+#define TIME_KEEPOPEN 5
+
+/* sysctl variables for tcp */
+extern int sysctl_tcp_keepalive_time;
+extern int sysctl_tcp_keepalive_probes;
+extern int sysctl_tcp_keepalive_intvl;
+extern int sysctl_tcp_syn_retries;
+
struct open_request;
struct or_calltable {
+ int family;
void (*rtx_syn_ack) (struct sock *sk, struct open_request *req);
+ void (*send_ack) (struct sk_buff *skb, struct open_request *req);
void (*destructor) (struct open_request *req);
void (*send_reset) (struct sk_buff *skb);
};
@@ -351,9 +395,6 @@ struct open_request {
struct tcp_v6_open_req v6_req;
#endif
} af;
-#ifdef CONFIG_IP_TRANSPARENT_PROXY
- __u16 lcl_port; /* LVE */
-#endif
};
/* SLAB cache for open requests. */
@@ -362,6 +403,12 @@ extern kmem_cache_t *tcp_openreq_cachep;
#define tcp_openreq_alloc() kmem_cache_alloc(tcp_openreq_cachep, SLAB_ATOMIC)
#define tcp_openreq_free(req) kmem_cache_free(tcp_openreq_cachep, req)
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+#define TCP_INET_FAMILY(fam) ((fam) == AF_INET)
+#else
+#define TCP_INET_FAMILY(fam) 1
+#endif
+
/*
* Pointers to address related TCP functions
* (i.e. things that depend on the address family)
@@ -375,7 +422,7 @@ extern kmem_cache_t *tcp_openreq_cachep;
*/
struct tcp_func {
- void (*queue_xmit) (struct sk_buff *skb);
+ int (*queue_xmit) (struct sk_buff *skb);
void (*send_check) (struct sock *sk,
struct tcphdr *th,
@@ -385,16 +432,14 @@ struct tcp_func {
int (*rebuild_header) (struct sock *sk);
int (*conn_request) (struct sock *sk,
- struct sk_buff *skb,
- __u32 isn);
+ struct sk_buff *skb);
struct sock * (*syn_recv_sock) (struct sock *sk,
struct sk_buff *skb,
struct open_request *req,
struct dst_entry *dst);
- struct sock * (*get_sock) (struct sk_buff *skb,
- struct tcphdr *th);
+ int (*hash_connecting) (struct sock *sk);
__u16 net_header_len;
@@ -473,14 +518,26 @@ extern int tcp_rcv_established(struct sock *sk,
struct tcphdr *th,
unsigned len);
-extern int tcp_timewait_state_process(struct tcp_tw_bucket *tw,
+enum tcp_tw_status
+{
+ TCP_TW_SUCCESS = 0,
+ TCP_TW_RST = 1,
+ TCP_TW_ACK = 2,
+ TCP_TW_SYN = 3
+};
+
+extern enum tcp_tw_status tcp_timewait_state_process(struct tcp_tw_bucket *tw,
struct sk_buff *skb,
struct tcphdr *th,
unsigned len);
+extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
+ struct open_request *req,
+ struct open_request *prev);
+
extern void tcp_close(struct sock *sk,
long timeout);
-extern struct sock * tcp_accept(struct sock *sk, int flags);
+extern struct sock * tcp_accept(struct sock *sk, int flags, int *err);
extern unsigned int tcp_poll(struct file * file, struct socket *sock, struct poll_table_struct *wait);
extern void tcp_write_space(struct sock *sk);
@@ -513,8 +570,7 @@ extern void tcp_v4_send_check(struct sock *sk,
struct sk_buff *skb);
extern int tcp_v4_conn_request(struct sock *sk,
- struct sk_buff *skb,
- __u32 isn);
+ struct sk_buff *skb);
extern struct sock * tcp_create_openreq_child(struct sock *sk,
struct open_request *req,
@@ -532,14 +588,18 @@ extern int tcp_v4_connect(struct sock *sk,
struct sockaddr *uaddr,
int addr_len);
-extern void tcp_connect(struct sock *sk,
- struct sk_buff *skb,
- int est_mss);
+extern int tcp_connect(struct sock *sk,
+ struct sk_buff *skb);
extern struct sk_buff * tcp_make_synack(struct sock *sk,
struct dst_entry *dst,
- struct open_request *req,
- int mss);
+ struct open_request *req);
+
+extern int tcp_disconnect(struct sock *sk, int flags);
+
+extern void tcp_unhash(struct sock *sk);
+
+extern int tcp_v4_hash_connecting(struct sock *sk);
/* From syncookies.c */
@@ -562,18 +622,14 @@ extern void tcp_send_probe0(struct sock *);
extern void tcp_send_partial(struct sock *);
extern void tcp_write_wakeup(struct sock *);
extern void tcp_send_fin(struct sock *sk);
-extern void tcp_send_active_reset(struct sock *sk);
+extern void tcp_send_active_reset(struct sock *sk, int priority);
extern int tcp_send_synack(struct sock *);
extern void tcp_transmit_skb(struct sock *, struct sk_buff *);
extern void tcp_send_skb(struct sock *, struct sk_buff *, int force_queue);
extern void tcp_send_ack(struct sock *sk);
-extern void tcp_send_delayed_ack(struct tcp_opt *tp, int max_timeout);
-
-/* CONFIG_IP_TRANSPARENT_PROXY */
-extern int tcp_chkaddr(struct sk_buff *);
+extern void tcp_send_delayed_ack(struct sock *sk, int max_timeout);
/* tcp_timer.c */
-#define tcp_reset_msl_timer(x,y,z) net_reset_timer(x,y,z)
extern void tcp_reset_xmit_timer(struct sock *, int, unsigned long);
extern void tcp_init_xmit_timers(struct sock *);
extern void tcp_clear_xmit_timers(struct sock *);
@@ -582,8 +638,9 @@ extern void tcp_retransmit_timer(unsigned long);
extern void tcp_delack_timer(unsigned long);
extern void tcp_probe_timer(unsigned long);
-extern struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
- struct open_request *req);
+extern void tcp_delete_keepalive_timer (struct sock *);
+extern void tcp_reset_keepalive_timer (struct sock *, unsigned long);
+extern void tcp_keepalive_timer (unsigned long);
/*
* TCP slow timer
@@ -598,9 +655,8 @@ struct tcp_sl_timer {
};
#define TCP_SLT_SYNACK 0
-#define TCP_SLT_KEEPALIVE 1
-#define TCP_SLT_TWKILL 2
-#define TCP_SLT_MAX 3
+#define TCP_SLT_TWKILL 1
+#define TCP_SLT_MAX 2
extern struct tcp_sl_timer tcp_slt_array[TCP_SLT_MAX];
@@ -625,6 +681,28 @@ static __inline__ unsigned int tcp_current_mss(struct sock *sk)
return mss_now > 8 ? mss_now : 8;
}
+/* Initialize RCV_MSS value.
+ * RCV_MSS is an our guess about MSS used by the peer.
+ * We haven't any direct information about the MSS.
+ * It's better to underestimate the RCV_MSS rather than overestimate.
+ * Overestimations make us ACKing less frequently than needed.
+ * Underestimations are more easy to detect and fix by tcp_measure_rcv_mss().
+ */
+
+extern __inline__ void tcp_initialize_rcv_mss(struct sock *sk)
+{
+ struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
+ struct dst_entry *dst = __sk_dst_get(sk);
+ int mss;
+
+ if (dst)
+ mss = dst->advmss;
+ else
+ mss = tp->mss_cache;
+
+ tp->rcv_mss = max(min(mss, 536), 8);
+}
+
/* Compute the actual receive window we are currently advertising.
* Rcv_nxt can be after the window if our peer push more data
* than the offered window.
@@ -685,21 +763,6 @@ extern __inline__ int tcp_raise_window(struct sock *sk)
return (new_win && (new_win > (cur_win << 1)));
}
-/* Recalculate snd_ssthresh, we want to set it to:
- *
- * one half the current congestion window, but no
- * less than two segments
- *
- * We must take into account the current send window
- * as well, however we keep track of that using different
- * units so a conversion is necessary. -DaveM
- */
-extern __inline__ __u32 tcp_recalc_ssthresh(struct tcp_opt *tp)
-{
- __u32 snd_wnd_packets = tp->snd_wnd / max(tp->mss_cache, 1);
-
- return max(min(snd_wnd_packets, tp->snd_cwnd) >> 1, 2);
-}
/* TCP timestamps are only 32-bits, this causes a slight
* complication on 64-bit systems since we store a snapshot
@@ -767,6 +830,32 @@ static __inline__ int tcp_packets_in_flight(struct tcp_opt *tp)
return tp->packets_out - tp->fackets_out + tp->retrans_out;
}
+/* Recalculate snd_ssthresh, we want to set it to:
+ *
+ * one half the current congestion window, but no
+ * less than two segments
+ *
+ * We must take into account the current send window
+ * as well, however we keep track of that using different
+ * units so a conversion is necessary. -DaveM
+ *
+ * RED-PEN.
+ * RFC 2581: "an easy mistake to make is to simply use cwnd,
+ * rather than FlightSize"
+ * I see no references to FlightSize here. snd_wnd is not FlightSize,
+ * it is also apriory characteristics.
+ *
+ * FlightSize = min((snd_nxt-snd_una)/mss, packets_out) ?
+ */
+extern __inline__ __u32 tcp_recalc_ssthresh(struct tcp_opt *tp)
+{
+ u32 FlightSize = (tp->snd_nxt - tp->snd_una)/tp->mss_cache;
+
+ FlightSize = min(FlightSize, tcp_packets_in_flight(tp));
+
+ return max(min(FlightSize, tp->snd_cwnd) >> 1, 2);
+}
+
/* This checks if the data bearing packet SKB (usually tp->send_head)
* should be put on the wire right now.
*/
@@ -796,6 +885,15 @@ static __inline__ int tcp_snd_test(struct sock *sk, struct sk_buff *skb)
!(TCP_SKB_CB(skb)->flags & (TCPCB_FLAG_URG|TCPCB_FLAG_FIN))))
nagle_check = 0;
+ /*
+ * Reset CWND after idle period longer rto. Actually, it would
+ * be better to save last send time, but VJ in SIGCOMM'88 proposes
+ * to use keepalive timestamp. Well, it is not good, certainly,
+ * because SMTP is still broken, but it is better than nothing yet.
+ */
+ if (tp->packets_out==0 && (s32)(tcp_time_stamp - tp->rcv_tstamp) > tp->rto)
+ tp->snd_cwnd = min(tp->snd_cwnd, 2);
+
/* Don't be strict about the congestion window for the
* final FIN frame. -DaveM
*/
@@ -844,6 +942,17 @@ extern __inline const int tcp_connected(const int state)
TCPF_FIN_WAIT2|TCPF_SYN_RECV));
}
+extern __inline const int tcp_established(const int state)
+{
+ return ((1 << state) &
+ (TCPF_ESTABLISHED|TCPF_CLOSE_WAIT|TCPF_FIN_WAIT1|
+ TCPF_FIN_WAIT2));
+}
+
+
+extern void tcp_destroy_sock(struct sock *sk);
+
+
/*
* Calculate(/check) TCP checksum
*/
@@ -868,12 +977,6 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
{
int oldstate = sk->state;
- sk->state = state;
-
-#ifdef STATE_TRACE
- SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]);
-#endif
-
switch (state) {
case TCP_ESTABLISHED:
if (oldstate != TCP_ESTABLISHED)
@@ -881,17 +984,31 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
break;
case TCP_CLOSE:
- {
- struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
- /* Should be about 2 rtt's */
- net_reset_timer(sk, TIME_DONE, min(tp->srtt * 2, TCP_DONE_TIME));
sk->prot->unhash(sk);
/* fall through */
- }
default:
if (oldstate==TCP_ESTABLISHED)
tcp_statistics.TcpCurrEstab--;
}
+
+ /* Change state AFTER socket is unhashed to avoid closed
+ * socket sitting in hash tables.
+ */
+ sk->state = state;
+
+#ifdef STATE_TRACE
+ SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]);
+#endif
+}
+
+static __inline__ void tcp_done(struct sock *sk)
+{
+ sk->shutdown = SHUTDOWN_MASK;
+
+ if (!sk->dead)
+ sk->state_change(sk);
+ else
+ tcp_destroy_sock(sk);
}
static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_opt *tp, __u32 tstamp)
@@ -930,7 +1047,7 @@ extern __inline__ void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sa
/* We always get an MSS option.
* The option bytes which will be seen in normal data
* packets should timestamps be used, must be in the MSS
- * advertised. But we subtract them from sk->mss so
+ * advertised. But we subtract them from tp->mss_cache so
* that calculations in tcp_sendmsg are simpler etc.
* So account for this fact here if necessary. If we
* don't do this correctly, as a receiver we won't
@@ -964,7 +1081,7 @@ extern __inline__ void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sa
* be a multiple of mss if possible. We assume here that mss >= 1.
* This MUST be enforced by all callers.
*/
-extern __inline__ void tcp_select_initial_window(__u32 space, __u16 mss,
+extern __inline__ void tcp_select_initial_window(int space, __u32 mss,
__u32 *rcv_wnd,
__u32 *window_clamp,
int wscale_ok,
@@ -998,6 +1115,18 @@ extern __inline__ void tcp_select_initial_window(__u32 space, __u16 mss,
(*window_clamp) = min(65535<<(*rcv_wscale),*window_clamp);
}
+/* Note: caller must be prepared to deal with negative returns */
+extern __inline__ int tcp_space(struct sock *sk)
+{
+ return (sk->rcvbuf - atomic_read(&sk->rmem_alloc)) /
+ WINDOW_ADVERTISE_DIVISOR;
+}
+
+extern __inline__ int tcp_full_space( struct sock *sk)
+{
+ return sk->rcvbuf / WINDOW_ADVERTISE_DIVISOR;
+}
+
extern __inline__ void tcp_synq_unlink(struct tcp_opt *tp, struct open_request *req, struct open_request *prev)
{
if(!req->dl_next)
@@ -1059,29 +1188,74 @@ static inline void tcp_clear_xmit_timer(struct sock *sk, int what)
printk(timer_bug_msg);
return;
};
- if(timer->prev != NULL)
- del_timer(timer);
+
+ spin_lock_bh(&sk->timer_lock);
+ if (timer->prev != NULL && del_timer(timer))
+ __sock_put(sk);
+ spin_unlock_bh(&sk->timer_lock);
}
+/* This function does not return reliable answer. You is only as advice.
+ */
+
static inline int tcp_timer_is_set(struct sock *sk, int what)
{
struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
+ int ret;
switch (what) {
case TIME_RETRANS:
- return tp->retransmit_timer.prev != NULL;
+ ret = tp->retransmit_timer.prev != NULL;
break;
case TIME_DACK:
- return tp->delack_timer.prev != NULL;
+ ret = tp->delack_timer.prev != NULL;
break;
case TIME_PROBE0:
- return tp->probe_timer.prev != NULL;
+ ret = tp->probe_timer.prev != NULL;
break;
default:
+ ret = 0;
printk(timer_bug_msg);
};
- return 0;
+ return ret;
+}
+
+
+extern void tcp_listen_wlock(void);
+
+/* - We may sleep inside this lock.
+ * - If sleeping is not required (or called from BH),
+ * use plain read_(un)lock(&tcp_lhash_lock).
+ */
+
+extern __inline__ void tcp_listen_lock(void)
+{
+ /* read_lock synchronizes to candidates to writers */
+ read_lock(&tcp_lhash_lock);
+ atomic_inc(&tcp_lhash_users);
+ read_unlock(&tcp_lhash_lock);
}
+extern __inline__ void tcp_listen_unlock(void)
+{
+ if (atomic_dec_and_test(&tcp_lhash_users))
+ wake_up(&tcp_lhash_wait);
+}
+
+static inline int keepalive_intvl_when(struct tcp_opt *tp)
+{
+ if (tp->keepalive_intvl)
+ return tp->keepalive_intvl;
+ else
+ return sysctl_tcp_keepalive_intvl;
+}
+
+static inline int keepalive_time_when(struct tcp_opt *tp)
+{
+ if (tp->keepalive_time)
+ return tp->keepalive_time;
+ else
+ return sysctl_tcp_keepalive_time;
+}
#endif /* _TCP_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index dcc2fd093..e082a4a9b 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -32,6 +32,7 @@
* the port space is shared.
*/
extern struct sock *udp_hash[UDP_HTABLE_SIZE];
+extern rwlock_t udp_hash_lock;
extern int udp_port_rover;
@@ -66,8 +67,6 @@ extern int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len);
extern int udp_rcv(struct sk_buff *skb, unsigned short len);
extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
-
-/* CONFIG_IP_TRANSPARENT_PROXY */
-extern int udp_chkaddr(struct sk_buff *skb);
+extern int udp_disconnect(struct sock *sk, int flags);
#endif /* _UDP_H */
diff --git a/include/net/x25.h b/include/net/x25.h
index 5ac507bd5..b2ea4f8b6 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -102,12 +102,12 @@ struct x25_route {
struct x25_route *next;
x25_address address; /* Start of address range */
unsigned int sigdigits; /* Number of sig digits */
- struct device *dev; /* More than one for MLP */
+ struct net_device *dev; /* More than one for MLP */
};
struct x25_neigh {
struct x25_neigh *next;
- struct device *dev;
+ struct net_device *dev;
unsigned int state;
unsigned int extended;
struct sk_buff_head queue;
@@ -153,8 +153,8 @@ extern void x25_kill_by_neigh(struct x25_neigh *);
/* x25_dev.c */
extern void x25_send_frame(struct sk_buff *, struct x25_neigh *);
-extern int x25_lapb_receive_frame(struct sk_buff *, struct device *, struct packet_type *);
-extern int x25_llc_receive_frame(struct sk_buff *, struct device *, struct packet_type *);
+extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *);
+extern int x25_llc_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *);
extern void x25_establish_link(struct x25_neigh *);
extern void x25_terminate_link(struct x25_neigh *);
@@ -169,8 +169,8 @@ extern int x25_process_rx_frame(struct sock *, struct sk_buff *);
/* x25_link.c */
extern void x25_link_control(struct sk_buff *, struct x25_neigh *, unsigned short);
-extern void x25_link_device_up(struct device *);
-extern void x25_link_device_down(struct device *);
+extern void x25_link_device_up(struct net_device *);
+extern void x25_link_device_down(struct net_device *);
extern void x25_link_established(struct x25_neigh *);
extern void x25_link_terminated(struct x25_neigh *);
extern void x25_transmit_restart_request(struct x25_neigh *);
@@ -179,7 +179,7 @@ extern void x25_transmit_diagnostic(struct x25_neigh *, unsigned char);
extern void x25_transmit_clear_request(struct x25_neigh *, unsigned int, unsigned char);
extern void x25_transmit_link(struct sk_buff *, struct x25_neigh *);
extern int x25_subscr_ioctl(unsigned int, void *);
-extern struct x25_neigh *x25_get_neigh(struct device *);
+extern struct x25_neigh *x25_get_neigh(struct net_device *);
extern void x25_link_free(void);
/* x25_out.c */
@@ -188,9 +188,9 @@ extern void x25_kick(struct sock *);
extern void x25_enquiry_response(struct sock *);
/* x25_route.c */
-extern struct device *x25_get_route(x25_address *);
-extern struct device *x25_dev_get(char *);
-extern void x25_route_device_down(struct device *);
+extern struct net_device *x25_get_route(x25_address *);
+extern struct net_device *x25_dev_get(char *);
+extern void x25_route_device_down(struct net_device *);
extern int x25_route_ioctl(unsigned int, void *);
extern int x25_routes_get_info(char *, char **, off_t, int, int);
extern void x25_route_free(void);
diff --git a/include/pcmcia/bulkmem.h b/include/pcmcia/bulkmem.h
new file mode 100644
index 000000000..634693c4d
--- /dev/null
+++ b/include/pcmcia/bulkmem.h
@@ -0,0 +1,195 @@
+/*
+ * Definitions for bulk memory services
+ *
+ * bulkmem.h 1.10 1999/08/28 04:12:33
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ * bulkmem.h 1.3 1995/05/27 04:49:49
+ */
+
+#ifndef _LINUX_BULKMEM_H
+#define _LINUX_BULKMEM_H
+
+/* For GetFirstRegion and GetNextRegion */
+typedef struct region_info_t {
+ u_int Attributes;
+ u_int CardOffset;
+ u_int RegionSize;
+ u_int AccessSpeed;
+ u_int BlockSize;
+ u_int PartMultiple;
+ u_char JedecMfr, JedecInfo;
+ memory_handle_t next;
+} region_info_t;
+
+#define REGION_TYPE 0x0001
+#define REGION_TYPE_CM 0x0000
+#define REGION_TYPE_AM 0x0001
+#define REGION_PREFETCH 0x0008
+#define REGION_CACHEABLE 0x0010
+#define REGION_BAR_MASK 0xe000
+#define REGION_BAR_SHIFT 13
+
+/* For OpenMemory */
+typedef struct open_mem_t {
+ u_int Attributes;
+ u_int Offset;
+} open_mem_t;
+
+/* Attributes for OpenMemory */
+#define MEMORY_TYPE 0x0001
+#define MEMORY_TYPE_CM 0x0000
+#define MEMORY_TYPE_AM 0x0001
+#define MEMORY_EXCLUSIVE 0x0002
+#define MEMORY_PREFETCH 0x0008
+#define MEMORY_CACHEABLE 0x0010
+#define MEMORY_BAR_MASK 0xe000
+#define MEMORY_BAR_SHIFT 13
+
+typedef struct eraseq_entry_t {
+ memory_handle_t Handle;
+ u_char State;
+ u_int Size;
+ u_int Offset;
+ void *Optional;
+} eraseq_entry_t;
+
+typedef struct eraseq_hdr_t {
+ int QueueEntryCnt;
+ eraseq_entry_t *QueueEntryArray;
+} eraseq_hdr_t;
+
+#define ERASE_QUEUED 0x00
+#define ERASE_IN_PROGRESS(n) (((n) > 0) && ((n) < 0x80))
+#define ERASE_IDLE 0xff
+#define ERASE_PASSED 0xe0
+#define ERASE_FAILED 0xe1
+
+#define ERASE_MISSING 0x80
+#define ERASE_MEDIA_WRPROT 0x84
+#define ERASE_NOT_ERASABLE 0x85
+#define ERASE_BAD_OFFSET 0xc1
+#define ERASE_BAD_TECH 0xc2
+#define ERASE_BAD_SOCKET 0xc3
+#define ERASE_BAD_VCC 0xc4
+#define ERASE_BAD_VPP 0xc5
+#define ERASE_BAD_SIZE 0xc6
+
+/* For CopyMemory */
+typedef struct copy_op_t {
+ u_int Attributes;
+ u_int SourceOffset;
+ u_int DestOffset;
+ u_int Count;
+} copy_op_t;
+
+/* For ReadMemory and WriteMemory */
+typedef struct mem_op_t {
+ u_int Attributes;
+ u_int Offset;
+ u_int Count;
+} mem_op_t;
+
+#define MEM_OP_BUFFER 0x01
+#define MEM_OP_BUFFER_USER 0x00
+#define MEM_OP_BUFFER_KERNEL 0x01
+#define MEM_OP_DISABLE_ERASE 0x02
+#define MEM_OP_VERIFY 0x04
+
+/* For RegisterMTD */
+typedef struct mtd_reg_t {
+ u_int Attributes;
+ u_int Offset;
+ u_long MediaID;
+} mtd_reg_t;
+
+/*
+ * Definitions for MTD requests
+ */
+
+typedef struct mtd_request_t {
+ u_int SrcCardOffset;
+ u_int DestCardOffset;
+ u_int TransferLength;
+ u_int Function;
+ u_long MediaID;
+ u_int Status;
+ u_int Timeout;
+} mtd_request_t;
+
+/* Fields in MTD Function */
+#define MTD_REQ_ACTION 0x003
+#define MTD_REQ_ERASE 0x000
+#define MTD_REQ_READ 0x001
+#define MTD_REQ_WRITE 0x002
+#define MTD_REQ_COPY 0x003
+#define MTD_REQ_NOERASE 0x004
+#define MTD_REQ_VERIFY 0x008
+#define MTD_REQ_READY 0x010
+#define MTD_REQ_TIMEOUT 0x020
+#define MTD_REQ_LAST 0x040
+#define MTD_REQ_FIRST 0x080
+#define MTD_REQ_KERNEL 0x100
+
+/* Status codes */
+#define MTD_WAITREQ 0x00
+#define MTD_WAITTIMER 0x01
+#define MTD_WAITRDY 0x02
+#define MTD_WAITPOWER 0x03
+
+/*
+ * Definitions for MTD helper functions
+ */
+
+/* For MTDModifyWindow */
+typedef struct mtd_mod_win_t {
+ u_int Attributes;
+ u_int AccessSpeed;
+ u_int CardOffset;
+} mtd_mod_win_t;
+
+/* For MTDSetVpp */
+typedef struct mtd_vpp_req_t {
+ u_char Vpp1, Vpp2;
+} mtd_vpp_req_t;
+
+/* For MTDRDYMask */
+typedef struct mtd_rdy_req_t {
+ u_int Mask;
+} mtd_rdy_req_t;
+
+enum mtd_helper {
+ MTDRequestWindow, MTDModifyWindow, MTDReleaseWindow,
+ MTDSetVpp, MTDRDYMask
+};
+
+#ifdef IN_CARD_SERVICES
+extern int MTDHelperEntry(int func, void *a1, void *a2);
+#else
+extern int MTDHelperEntry(int func, ...);
+#endif
+
+#endif /* _LINUX_BULKMEM_H */
diff --git a/include/pcmcia/bus_ops.h b/include/pcmcia/bus_ops.h
new file mode 100644
index 000000000..867ad832c
--- /dev/null
+++ b/include/pcmcia/bus_ops.h
@@ -0,0 +1,150 @@
+/*
+ * bus_ops.h 1.7 1999/09/10 06:22:33
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_BUS_OPS_H
+#define _LINUX_BUS_OPS_H
+
+#ifdef CONFIG_VIRTUAL_BUS
+
+typedef struct bus_operations {
+ void *priv;
+ u32 (*b_in)(void *bus, u32 port, s32 sz);
+ void (*b_ins)(void *bus, u32 port, void *buf,
+ u32 count, s32 sz);
+ void (*b_out)(void *bus, u32 val, u32 port, s32 sz);
+ void (*b_outs)(void *bus, u32 port, void *buf,
+ u32 count, s32 sz);
+ void *(*b_ioremap)(void *bus, u_long ofs, u_long sz);
+ void (*b_iounmap)(void *bus, void *addr);
+ u32 (*b_read)(void *bus, void *addr, s32 sz);
+ void (*b_write)(void *bus, u32 val, void *addr, s32 sz);
+ void (*b_copy_from)(void *bus, void *d, void *s, u32 count);
+ void (*b_copy_to)(void *bus, void *d, void *s, u32 count);
+ int (*b_request_irq)(void *bus, u_int irq,
+ void (*handler)(int, void *,
+ struct pt_regs *),
+ u_long flags, const char *device,
+ void *dev_id);
+ void (*b_free_irq)(void *bus, u_int irq, void *dev_id);
+} bus_operations;
+
+#define bus_inb(b,p) (b)->b_in((b),(p),0)
+#define bus_inw(b,p) (b)->b_in((b),(p),1)
+#define bus_inl(b,p) (b)->b_in((b),(p),2)
+#define bus_inw_ns(b,p) (b)->b_in((b),(p),-1)
+#define bus_inl_ns(b,p) (b)->b_in((b),(p),-2)
+
+#define bus_insb(b,p,a,c) (b)->b_ins((b),(p),(a),(c),0)
+#define bus_insw(b,p,a,c) (b)->b_ins((b),(p),(a),(c),1)
+#define bus_insl(b,p,a,c) (b)->b_ins((b),(p),(a),(c),2)
+#define bus_insw_ns(b,p,a,c) (b)->b_ins((b),(p),(a),(c),-1)
+#define bus_insl_ns(b,p,a,c) (b)->b_ins((b),(p),(a),(c),-2)
+
+#define bus_outb(b,v,p) (b)->b_out((b),(v),(p),0)
+#define bus_outw(b,v,p) (b)->b_out((b),(v),(p),1)
+#define bus_outl(b,v,p) (b)->b_out((b),(v),(p),2)
+#define bus_outw_ns(b,v,p) (b)->b_out((b),(v),(p),-1)
+#define bus_outl_ns(b,v,p) (b)->b_out((b),(v),(p),-2)
+
+#define bus_outsb(b,p,a,c) (b)->b_outs((b),(p),(a),(c),0)
+#define bus_outsw(b,p,a,c) (b)->b_outs((b),(p),(a),(c),1)
+#define bus_outsl(b,p,a,c) (b)->b_outs((b),(p),(a),(c),2)
+#define bus_outsw_ns(b,p,a,c) (b)->b_outs((b),(p),(a),(c),-1)
+#define bus_outsl_ns(b,p,a,c) (b)->b_outs((b),(p),(a),(c),-2)
+
+#define bus_readb(b,a) (b)->b_read((b),(a),0)
+#define bus_readw(b,a) (b)->b_read((b),(a),1)
+#define bus_readl(b,a) (b)->b_read((b),(a),2)
+#define bus_readw_ns(b,a) (b)->b_read((b),(a),-1)
+#define bus_readl_ns(b,a) (b)->b_read((b),(a),-2)
+
+#define bus_writeb(b,v,a) (b)->b_write((b),(v),(a),0)
+#define bus_writew(b,v,a) (b)->b_write((b),(v),(a),1)
+#define bus_writel(b,v,a) (b)->b_write((b),(v),(a),2)
+#define bus_writew_ns(b,v,a) (b)->b_write((b),(v),(a),-1)
+#define bus_writel_ns(b,v,a) (b)->b_write((b),(v),(a),-2)
+
+#define bus_ioremap(b,s,n) (b)->b_ioremap((b),(s),(n))
+#define bus_iounmap(b,a) (b)->b_iounmap((b),(a))
+#define bus_memcpy_fromio(b,d,s,n) (b)->b_copy_from((b),(d),(s),(n))
+#define bus_memcpy_toio(b,d,s,n) (b)->b_copy_to((b),(d),(s),(n))
+
+#define bus_request_irq(b,i,h,f,n,d) \
+ (b)->b_request_irq((b),(i),(h),(f),(n),(d))
+#define bus_free_irq(b,i,d) (b)->b_free_irq((b),(i),(d))
+
+#else
+
+#define bus_inb(b,p) inb(p)
+#define bus_inw(b,p) inw(p)
+#define bus_inl(b,p) inl(p)
+#define bus_inw_ns(b,p) inw_ns(p)
+#define bus_inl_ns(b,p) inl_ns(p)
+
+#define bus_insb(b,p,a,c) insb(p,a,c)
+#define bus_insw(b,p,a,c) insw(p,a,c)
+#define bus_insl(b,p,a,c) insl(p,a,c)
+#define bus_insw_ns(b,p,a,c) insw_ns(p,a,c)
+#define bus_insl_ns(b,p,a,c) insl_ns(p,a,c)
+
+#define bus_outb(b,v,p) outb(b,v,p)
+#define bus_outw(b,v,p) outw(b,v,p)
+#define bus_outl(b,v,p) outl(b,v,p)
+#define bus_outw_ns(b,v,p) outw_ns(b,v,p)
+#define bus_outl_ns(b,v,p) outl_ns(b,v,p)
+
+#define bus_outsb(b,p,a,c) outsb(p,a,c)
+#define bus_outsw(b,p,a,c) outsw(p,a,c)
+#define bus_outsl(b,p,a,c) outsl(p,a,c)
+#define bus_outsw_ns(b,p,a,c) outsw_ns(p,a,c)
+#define bus_outsl_ns(b,p,a,c) outsl_ns(p,a,c)
+
+#define bus_readb(b,a) readb(a)
+#define bus_readw(b,a) readw(a)
+#define bus_readl(b,a) readl(a)
+#define bus_readw_ns(b,a) readw_ns(a)
+#define bus_readl_ns(b,a) readl_ns(a)
+
+#define bus_writeb(b,v,a) writeb(v,a)
+#define bus_writew(b,v,a) writew(v,a)
+#define bus_writel(b,v,a) writel(v,a)
+#define bus_writew_ns(b,v,a) writew_ns(v,a)
+#define bus_writel_ns(b,v,a) writel_ns(v,a)
+
+#define bus_ioremap(b,s,n) ioremap(s,n)
+#define bus_iounmap(b,a) iounmap(a)
+#define bus_memcpy_fromio(b,d,s,n) memcpy_fromio(d,s,n)
+#define bus_memcpy_toio(b,d,s,n) memcpy_toio(d,s,n)
+
+#define bus_request_irq(b,i,h,f,n,d) request_irq((i),(h),(f),(n),(d))
+#define bus_free_irq(b,i,d) free_irq((i),(d))
+
+#endif /* CONFIG_VIRTUAL_BUS */
+
+#endif /* _LINUX_BUS_OPS_H */
diff --git a/include/pcmcia/ciscode.h b/include/pcmcia/ciscode.h
new file mode 100644
index 000000000..32915c167
--- /dev/null
+++ b/include/pcmcia/ciscode.h
@@ -0,0 +1,115 @@
+/*
+ * ciscode.h 1.38 1999/08/28 04:12:32
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_CISCODE_H
+#define _LINUX_CISCODE_H
+
+/* Manufacturer and Product ID codes */
+
+#define MANFID_3COM 0x0101
+#define PRODID_3COM_3CXEM556 0x0035
+#define PRODID_3COM_3CCFEM556 0x0556
+#define PRODID_3COM_3C562 0x0562
+
+#define MANFID_ACCTON 0x01bf
+#define PRODID_ACCTON_EN2226 0x010a
+
+#define MANFID_ADAPTEC 0x012f
+#define PRODID_ADAPTEC_SCSI 0x0001
+
+#define MANFID_ATT 0xffff
+#define PRODID_ATT_KIT 0x0100
+
+#define MANFID_CONTEC 0xc001
+
+#define MANFID_FUJITSU 0x0004
+#define PRODID_FUJITSU_MBH10302 0x0004
+#define PRODID_FUJITSU_MBH10304 0x1003
+#define PRODID_FUJITSU_LA501 0x2000
+
+#define MANFID_IBM 0x00a4
+#define PRODID_IBM_HOME_AND_AWAY 0x002e
+
+#define MANFID_INTEL 0x0089
+#define PRODID_INTEL_DUAL_RS232 0x0301
+#define PRODID_INTEL_2PLUS 0x8422
+
+#define MANFID_LINKSYS 0x0143
+#define PRODID_LINKSYS_PCMLM28 0xc0ab
+#define PRODID_LINKSYS_3400 0x3341
+
+#define MANFID_MEGAHERTZ 0x0102
+#define PRODID_MEGAHERTZ_VARIOUS 0x0000
+#define PRODID_MEGAHERTZ_EM3288 0x0006
+
+#define MANFID_MACNICA 0xc00b
+
+#define MANFID_MOTOROLA 0x0109
+#define PRODID_MOTOROLA_MARINER 0x0501
+
+#define MANFID_NATINST 0x010b
+#define PRODID_NATINST_QUAD_RS232 0xd180
+
+#define MANFID_NEW_MEDIA 0x0057
+
+#define MANFID_OLICOM 0x0121
+#define PRODID_OLICOM_OC2231 0x3122
+#define PRODID_OLICOM_OC2232 0x3222
+
+#define MANFID_OMEGA 0x0137
+#define PRODID_OMEGA_QSP_100 0x0025
+
+#define MANFID_OSITECH 0x0140
+#define PRODID_OSITECH_JACK_144 0x0001
+#define PRODID_OSITECH_JACK_288 0x0002
+#define PRODID_OSITECH_JACK_336 0x0007
+#define PRODID_OSITECH_SEVEN 0x0008
+
+#define MANFID_PSION 0x016c
+
+#define MANFID_QUATECH 0x0137
+#define PRODID_QUATECH_SPP100 0x0003
+#define PRODID_QUATECH_DUAL_RS232 0x0012
+#define PRODID_QUATECH_DUAL_RS232_D1 0x0007
+#define PRODID_QUATECH_QUAD_RS232 0x001b
+
+#define MANFID_SMC 0x0108
+#define PRODID_SMC_ETHER 0x0105
+
+#define MANFID_SOCKET 0x0104
+#define PRODID_SOCKET_DUAL_RS232 0x0006
+#define PRODID_SOCKET_LPE 0x000d
+
+#define MANFID_SUNDISK 0x0045
+
+#define MANFID_TDK 0x0105
+
+#define MANFID_XIRCOM 0x0105
+
+#endif /* _LINUX_CISCODE_H */
diff --git a/include/pcmcia/cisreg.h b/include/pcmcia/cisreg.h
new file mode 100644
index 000000000..16c3dee31
--- /dev/null
+++ b/include/pcmcia/cisreg.h
@@ -0,0 +1,116 @@
+/*
+ * cisreg.h 1.13 1999/08/28 04:12:32
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_CISREG_H
+#define _LINUX_CISREG_H
+
+/* Offsets from ConfigBase for CIS registers */
+#define CISREG_COR 0x00
+#define CISREG_CCSR 0x02
+#define CISREG_PRR 0x04
+#define CISREG_SCR 0x06
+#define CISREG_ESR 0x08
+#define CISREG_IOBASE_0 0x0a
+#define CISREG_IOBASE_1 0x0c
+#define CISREG_IOBASE_2 0x0e
+#define CISREG_IOBASE_3 0x10
+#define CISREG_IOSIZE 0x12
+
+/*
+ * Configuration Option Register
+ */
+#define COR_CONFIG_MASK 0x3f
+#define COR_MFC_CONFIG_MASK 0x38
+#define COR_FUNC_ENA 0x01
+#define COR_ADDR_DECODE 0x02
+#define COR_IREQ_ENA 0x04
+#define COR_LEVEL_REQ 0x40
+#define COR_SOFT_RESET 0x80
+
+/*
+ * Card Configuration and Status Register
+ */
+#define CCSR_INTR_ACK 0x01
+#define CCSR_INTR_PENDING 0x02
+#define CCSR_POWER_DOWN 0x04
+#define CCSR_AUDIO_ENA 0x08
+#define CCSR_IOIS8 0x20
+#define CCSR_SIGCHG_ENA 0x40
+#define CCSR_CHANGED 0x80
+
+/*
+ * Pin Replacement Register
+ */
+#define PRR_WP_STATUS 0x01
+#define PRR_READY_STATUS 0x02
+#define PRR_BVD2_STATUS 0x04
+#define PRR_BVD1_STATUS 0x08
+#define PRR_WP_EVENT 0x10
+#define PRR_READY_EVENT 0x20
+#define PRR_BVD2_EVENT 0x40
+#define PRR_BVD1_EVENT 0x80
+
+/*
+ * Socket and Copy Register
+ */
+#define SCR_SOCKET_NUM 0x0f
+#define SCR_COPY_NUM 0x70
+
+/*
+ * Extended Status Register
+ */
+#define ESR_REQ_ATTN_ENA 0x01
+#define ESR_REQ_ATTN 0x10
+
+/*
+ * CardBus Function Status Registers
+ */
+#define CBFN_EVENT 0x00
+#define CBFN_MASK 0x04
+#define CBFN_STATE 0x08
+#define CBFN_FORCE 0x0c
+
+/*
+ * These apply to all the CardBus function registers
+ */
+#define CBFN_WP 0x0001
+#define CBFN_READY 0x0002
+#define CBFN_BVD2 0x0004
+#define CBFN_BVD1 0x0008
+#define CBFN_GWAKE 0x0010
+#define CBFN_INTR 0x8000
+
+/*
+ * Extra bits in the Function Event Mask Register
+ */
+#define FEMR_BAM_ENA 0x0020
+#define FEMR_PWM_ENA 0x0040
+#define FEMR_WKUP_MASK 0x4000
+
+#endif /* _LINUX_CISREG_H */
diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h
new file mode 100644
index 000000000..200665387
--- /dev/null
+++ b/include/pcmcia/cistpl.h
@@ -0,0 +1,583 @@
+/*
+ * cistpl.h 1.30 1999/08/28 04:12:32
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_CISTPL_H
+#define _LINUX_CISTPL_H
+
+#define CISTPL_NULL 0x00
+#define CISTPL_DEVICE 0x01
+#define CISTPL_LONGLINK_CB 0x02
+#define CISTPL_CONFIG_CB 0x04
+#define CISTPL_CFTABLE_ENTRY_CB 0x05
+#define CISTPL_LONGLINK_MFC 0x06
+#define CISTPL_BAR 0x07
+#define CISTPL_CHECKSUM 0x10
+#define CISTPL_LONGLINK_A 0x11
+#define CISTPL_LONGLINK_C 0x12
+#define CISTPL_LINKTARGET 0x13
+#define CISTPL_NO_LINK 0x14
+#define CISTPL_VERS_1 0x15
+#define CISTPL_ALTSTR 0x16
+#define CISTPL_DEVICE_A 0x17
+#define CISTPL_JEDEC_C 0x18
+#define CISTPL_JEDEC_A 0x19
+#define CISTPL_CONFIG 0x1a
+#define CISTPL_CFTABLE_ENTRY 0x1b
+#define CISTPL_DEVICE_OC 0x1c
+#define CISTPL_DEVICE_OA 0x1d
+#define CISTPL_DEVICE_GEO 0x1e
+#define CISTPL_DEVICE_GEO_A 0x1f
+#define CISTPL_MANFID 0x20
+#define CISTPL_FUNCID 0x21
+#define CISTPL_FUNCE 0x22
+#define CISTPL_SWIL 0x23
+#define CISTPL_END 0xff
+/* Layer 2 tuples */
+#define CISTPL_VERS_2 0x40
+#define CISTPL_FORMAT 0x41
+#define CISTPL_GEOMETRY 0x42
+#define CISTPL_BYTEORDER 0x43
+#define CISTPL_DATE 0x44
+#define CISTPL_BATTERY 0x45
+/* Layer 3 tuples */
+#define CISTPL_ORG 0x46
+
+typedef struct cistpl_longlink_t {
+ u_int addr;
+} cistpl_longlink_t;
+
+typedef struct cistpl_checksum_t {
+ u_short addr;
+ u_short len;
+ u_char sum;
+} cistpl_checksum_t;
+
+#define CISTPL_MAX_FUNCTIONS 8
+#define CISTPL_MFC_ATTR 0x00
+#define CISTPL_MFC_COMMON 0x01
+
+typedef struct cistpl_longlink_mfc_t {
+ u_char nfn;
+ struct {
+ u_char space;
+ u_int addr;
+ } fn[CISTPL_MAX_FUNCTIONS];
+} cistpl_longlink_mfc_t;
+
+#define CISTPL_MAX_ALTSTR_STRINGS 4
+
+typedef struct cistpl_altstr_t {
+ u_char ns;
+ u_char ofs[CISTPL_MAX_ALTSTR_STRINGS];
+ char str[254];
+} cistpl_altstr_t;
+
+#define CISTPL_DTYPE_NULL 0x00
+#define CISTPL_DTYPE_ROM 0x01
+#define CISTPL_DTYPE_OTPROM 0x02
+#define CISTPL_DTYPE_EPROM 0x03
+#define CISTPL_DTYPE_EEPROM 0x04
+#define CISTPL_DTYPE_FLASH 0x05
+#define CISTPL_DTYPE_SRAM 0x06
+#define CISTPL_DTYPE_DRAM 0x07
+#define CISTPL_DTYPE_FUNCSPEC 0x0d
+#define CISTPL_DTYPE_EXTEND 0x0e
+
+#define CISTPL_MAX_DEVICES 4
+
+typedef struct cistpl_device_t {
+ u_char ndev;
+ struct {
+ u_char type;
+ u_char wp;
+ u_int speed;
+ u_int size;
+ } dev[CISTPL_MAX_DEVICES];
+} cistpl_device_t;
+
+#define CISTPL_DEVICE_MWAIT 0x01
+#define CISTPL_DEVICE_3VCC 0x02
+
+typedef struct cistpl_device_o_t {
+ u_char flags;
+ cistpl_device_t device;
+} cistpl_device_o_t;
+
+#define CISTPL_VERS_1_MAX_PROD_STRINGS 4
+
+typedef struct cistpl_vers_1_t {
+ u_char major;
+ u_char minor;
+ u_char ns;
+ u_char ofs[CISTPL_VERS_1_MAX_PROD_STRINGS];
+ char str[254];
+} cistpl_vers_1_t;
+
+typedef struct cistpl_jedec_t {
+ u_char nid;
+ struct {
+ u_char mfr;
+ u_char info;
+ } id[CISTPL_MAX_DEVICES];
+} cistpl_jedec_t;
+
+typedef struct cistpl_manfid_t {
+ u_short manf;
+ u_short card;
+} cistpl_manfid_t;
+
+#define CISTPL_FUNCID_MULTI 0x00
+#define CISTPL_FUNCID_MEMORY 0x01
+#define CISTPL_FUNCID_SERIAL 0x02
+#define CISTPL_FUNCID_PARALLEL 0x03
+#define CISTPL_FUNCID_FIXED 0x04
+#define CISTPL_FUNCID_VIDEO 0x05
+#define CISTPL_FUNCID_NETWORK 0x06
+#define CISTPL_FUNCID_AIMS 0x07
+#define CISTPL_FUNCID_SCSI 0x08
+
+#define CISTPL_SYSINIT_POST 0x01
+#define CISTPL_SYSINIT_ROM 0x02
+
+typedef struct cistpl_funcid_t {
+ u_char func;
+ u_char sysinit;
+} cistpl_funcid_t;
+
+typedef struct cistpl_funce_t {
+ u_char type;
+ u_char data[0];
+} cistpl_funce_t;
+
+/*======================================================================
+
+ Modem Function Extension Tuples
+
+======================================================================*/
+
+#define CISTPL_FUNCE_SERIAL_IF 0x00
+#define CISTPL_FUNCE_SERIAL_CAP 0x01
+#define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02
+#define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03
+#define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04
+#define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05
+#define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06
+#define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07
+#define CISTPL_FUNCE_SERIAL_IF_DATA 0x08
+#define CISTPL_FUNCE_SERIAL_IF_FAX 0x09
+#define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a
+
+/* UART identification */
+#define CISTPL_SERIAL_UART_8250 0x00
+#define CISTPL_SERIAL_UART_16450 0x01
+#define CISTPL_SERIAL_UART_16550 0x02
+#define CISTPL_SERIAL_UART_8251 0x03
+#define CISTPL_SERIAL_UART_8530 0x04
+#define CISTPL_SERIAL_UART_85230 0x05
+
+/* UART capabilities */
+#define CISTPL_SERIAL_UART_SPACE 0x01
+#define CISTPL_SERIAL_UART_MARK 0x02
+#define CISTPL_SERIAL_UART_ODD 0x04
+#define CISTPL_SERIAL_UART_EVEN 0x08
+#define CISTPL_SERIAL_UART_5BIT 0x01
+#define CISTPL_SERIAL_UART_6BIT 0x02
+#define CISTPL_SERIAL_UART_7BIT 0x04
+#define CISTPL_SERIAL_UART_8BIT 0x08
+#define CISTPL_SERIAL_UART_1STOP 0x10
+#define CISTPL_SERIAL_UART_MSTOP 0x20
+#define CISTPL_SERIAL_UART_2STOP 0x40
+
+typedef struct cistpl_serial_t {
+ u_char uart_type;
+ u_char uart_cap_0;
+ u_char uart_cap_1;
+} cistpl_serial_t;
+
+typedef struct cistpl_modem_cap_t {
+ u_char flow;
+ u_char cmd_buf;
+ u_char rcv_buf_0, rcv_buf_1, rcv_buf_2;
+ u_char xmit_buf_0, xmit_buf_1, xmit_buf_2;
+} cistpl_modem_cap_t;
+
+#define CISTPL_SERIAL_MOD_103 0x01
+#define CISTPL_SERIAL_MOD_V21 0x02
+#define CISTPL_SERIAL_MOD_V23 0x04
+#define CISTPL_SERIAL_MOD_V22 0x08
+#define CISTPL_SERIAL_MOD_212A 0x10
+#define CISTPL_SERIAL_MOD_V22BIS 0x20
+#define CISTPL_SERIAL_MOD_V26 0x40
+#define CISTPL_SERIAL_MOD_V26BIS 0x80
+#define CISTPL_SERIAL_MOD_V27BIS 0x01
+#define CISTPL_SERIAL_MOD_V29 0x02
+#define CISTPL_SERIAL_MOD_V32 0x04
+#define CISTPL_SERIAL_MOD_V32BIS 0x08
+#define CISTPL_SERIAL_MOD_V34 0x10
+
+#define CISTPL_SERIAL_ERR_MNP2_4 0x01
+#define CISTPL_SERIAL_ERR_V42_LAPM 0x02
+
+#define CISTPL_SERIAL_CMPR_V42BIS 0x01
+#define CISTPL_SERIAL_CMPR_MNP5 0x02
+
+#define CISTPL_SERIAL_CMD_AT1 0x01
+#define CISTPL_SERIAL_CMD_AT2 0x02
+#define CISTPL_SERIAL_CMD_AT3 0x04
+#define CISTPL_SERIAL_CMD_MNP_AT 0x08
+#define CISTPL_SERIAL_CMD_V25BIS 0x10
+#define CISTPL_SERIAL_CMD_V25A 0x20
+#define CISTPL_SERIAL_CMD_DMCL 0x40
+
+typedef struct cistpl_data_serv_t {
+ u_char max_data_0;
+ u_char max_data_1;
+ u_char modulation_0;
+ u_char modulation_1;
+ u_char error_control;
+ u_char compression;
+ u_char cmd_protocol;
+ u_char escape;
+ u_char encrypt;
+ u_char misc_features;
+ u_char ccitt_code[0];
+} cistpl_data_serv_t;
+
+typedef struct cistpl_fax_serv_t {
+ u_char max_data_0;
+ u_char max_data_1;
+ u_char modulation;
+ u_char encrypt;
+ u_char features_0;
+ u_char features_1;
+ u_char ccitt_code[0];
+} cistpl_fax_serv_t;
+
+typedef struct cistpl_voice_serv_t {
+ u_char max_data_0;
+ u_char max_data_1;
+} cistpl_voice_serv_t;
+
+/*======================================================================
+
+ LAN Function Extension Tuples
+
+======================================================================*/
+
+#define CISTPL_FUNCE_LAN_TECH 0x01
+#define CISTPL_FUNCE_LAN_SPEED 0x02
+#define CISTPL_FUNCE_LAN_MEDIA 0x03
+#define CISTPL_FUNCE_LAN_NODE_ID 0x04
+#define CISTPL_FUNCE_LAN_CONNECTOR 0x05
+
+/* LAN technologies */
+#define CISTPL_LAN_TECH_ARCNET 0x01
+#define CISTPL_LAN_TECH_ETHERNET 0x02
+#define CISTPL_LAN_TECH_TOKENRING 0x03
+#define CISTPL_LAN_TECH_LOCALTALK 0x04
+#define CISTPL_LAN_TECH_FDDI 0x05
+#define CISTPL_LAN_TECH_ATM 0x06
+#define CISTPL_LAN_TECH_WIRELESS 0x07
+
+typedef struct cistpl_lan_tech_t {
+ u_char tech;
+} cistpl_lan_tech_t;
+
+typedef struct cistpl_lan_speed_t {
+ u_int speed;
+} cistpl_lan_speed_t;
+
+/* LAN media definitions */
+#define CISTPL_LAN_MEDIA_UTP 0x01
+#define CISTPL_LAN_MEDIA_STP 0x02
+#define CISTPL_LAN_MEDIA_THIN_COAX 0x03
+#define CISTPL_LAN_MEDIA_THICK_COAX 0x04
+#define CISTPL_LAN_MEDIA_FIBER 0x05
+#define CISTPL_LAN_MEDIA_900MHZ 0x06
+#define CISTPL_LAN_MEDIA_2GHZ 0x07
+#define CISTPL_LAN_MEDIA_5GHZ 0x08
+#define CISTPL_LAN_MEDIA_DIFF_IR 0x09
+#define CISTPL_LAN_MEDIA_PTP_IR 0x0a
+
+typedef struct cistpl_lan_media_t {
+ u_char media;
+} cistpl_lan_media_t;
+
+typedef struct cistpl_lan_node_id_t {
+ u_char nb;
+ u_char id[16];
+} cistpl_lan_node_id_t;
+
+typedef struct cistpl_lan_connector_t {
+ u_char code;
+} cistpl_lan_connector_t;
+
+/*======================================================================
+
+ IDE Function Extension Tuples
+
+======================================================================*/
+
+#define CISTPL_IDE_INTERFACE 0x01
+
+typedef struct cistpl_ide_interface_t {
+ u_char interface;
+} cistpl_ide_interface_t;
+
+/* First feature byte */
+#define CISTPL_IDE_SILICON 0x04
+#define CISTPL_IDE_UNIQUE 0x08
+#define CISTPL_IDE_DUAL 0x10
+
+/* Second feature byte */
+#define CISTPL_IDE_HAS_SLEEP 0x01
+#define CISTPL_IDE_HAS_STANDBY 0x02
+#define CISTPL_IDE_HAS_IDLE 0x04
+#define CISTPL_IDE_LOW_POWER 0x08
+#define CISTPL_IDE_REG_INHIBIT 0x10
+#define CISTPL_IDE_HAS_INDEX 0x20
+#define CISTPL_IDE_IOIS16 0x40
+
+typedef struct cistpl_ide_feature_t {
+ u_char feature1;
+ u_char feature2;
+} cistpl_ide_feature_t;
+
+#define CISTPL_FUNCE_IDE_IFACE 0x01
+#define CISTPL_FUNCE_IDE_MASTER 0x02
+#define CISTPL_FUNCE_IDE_SLAVE 0x03
+
+/*======================================================================
+
+ Configuration Table Entries
+
+======================================================================*/
+
+#define CISTPL_BAR_SPACE 0x07
+#define CISTPL_BAR_SPACE_IO 0x10
+#define CISTPL_BAR_PREFETCH 0x20
+#define CISTPL_BAR_CACHEABLE 0x40
+#define CISTPL_BAR_1MEG_MAP 0x80
+
+typedef struct cistpl_bar_t {
+ u_char attr;
+ u_int size;
+} cistpl_bar_t;
+
+typedef struct cistpl_config_t {
+ u_char last_idx;
+ u_int base;
+ u_int rmask[4];
+ u_char subtuples;
+} cistpl_config_t;
+
+/* These are bits in the 'present' field, and indices in 'param' */
+#define CISTPL_POWER_VNOM 0
+#define CISTPL_POWER_VMIN 1
+#define CISTPL_POWER_VMAX 2
+#define CISTPL_POWER_ISTATIC 3
+#define CISTPL_POWER_IAVG 4
+#define CISTPL_POWER_IPEAK 5
+#define CISTPL_POWER_IDOWN 6
+
+#define CISTPL_POWER_HIGHZ_OK 0x01
+#define CISTPL_POWER_HIGHZ_REQ 0x02
+
+typedef struct cistpl_power_t {
+ u_char present;
+ u_char flags;
+ u_int param[7];
+} cistpl_power_t;
+
+typedef struct cistpl_timing_t {
+ u_int wait, waitscale;
+ u_int ready, rdyscale;
+ u_int reserved, rsvscale;
+} cistpl_timing_t;
+
+#define CISTPL_IO_LINES_MASK 0x1f
+#define CISTPL_IO_8BIT 0x20
+#define CISTPL_IO_16BIT 0x40
+#define CISTPL_IO_RANGE 0x80
+
+#define CISTPL_IO_MAX_WIN 16
+
+typedef struct cistpl_io_t {
+ u_char flags;
+ u_char nwin;
+ struct {
+ u_int base;
+ u_int len;
+ } win[CISTPL_IO_MAX_WIN];
+} cistpl_io_t;
+
+typedef struct cistpl_irq_t {
+ u_int IRQInfo1;
+ u_int IRQInfo2;
+} cistpl_irq_t;
+
+#define CISTPL_MEM_MAX_WIN 8
+
+typedef struct cistpl_mem_t {
+ u_char flags;
+ u_char nwin;
+ struct {
+ u_int len;
+ u_int card_addr;
+ u_int host_addr;
+ } win[CISTPL_MEM_MAX_WIN];
+} cistpl_mem_t;
+
+#define CISTPL_CFTABLE_DEFAULT 0x0001
+#define CISTPL_CFTABLE_BVDS 0x0002
+#define CISTPL_CFTABLE_WP 0x0004
+#define CISTPL_CFTABLE_RDYBSY 0x0008
+#define CISTPL_CFTABLE_MWAIT 0x0010
+#define CISTPL_CFTABLE_AUDIO 0x0800
+#define CISTPL_CFTABLE_READONLY 0x1000
+#define CISTPL_CFTABLE_PWRDOWN 0x2000
+
+typedef struct cistpl_cftable_entry_t {
+ u_char index;
+ u_short flags;
+ u_char interface;
+ cistpl_power_t vcc, vpp1, vpp2;
+ cistpl_timing_t timing;
+ cistpl_io_t io;
+ cistpl_irq_t irq;
+ cistpl_mem_t mem;
+ u_char subtuples;
+} cistpl_cftable_entry_t;
+
+#define CISTPL_CFTABLE_MASTER 0x000100
+#define CISTPL_CFTABLE_INVALIDATE 0x000200
+#define CISTPL_CFTABLE_VGA_PALETTE 0x000400
+#define CISTPL_CFTABLE_PARITY 0x000800
+#define CISTPL_CFTABLE_WAIT 0x001000
+#define CISTPL_CFTABLE_SERR 0x002000
+#define CISTPL_CFTABLE_FAST_BACK 0x004000
+#define CISTPL_CFTABLE_BINARY_AUDIO 0x010000
+#define CISTPL_CFTABLE_PWM_AUDIO 0x020000
+
+typedef struct cistpl_cftable_entry_cb_t {
+ u_char index;
+ u_int flags;
+ cistpl_power_t vcc, vpp1, vpp2;
+ u_char io;
+ cistpl_irq_t irq;
+ u_char mem;
+ u_char subtuples;
+} cistpl_cftable_entry_cb_t;
+
+typedef struct cistpl_device_geo_t {
+ u_char ngeo;
+ struct {
+ u_char buswidth;
+ u_int erase_block;
+ u_int read_block;
+ u_int write_block;
+ u_int partition;
+ u_int interleave;
+ } geo[CISTPL_MAX_DEVICES];
+} cistpl_device_geo_t;
+
+typedef struct cistpl_vers_2_t {
+ u_char vers;
+ u_char comply;
+ u_short dindex;
+ u_char vspec8, vspec9;
+ u_char nhdr;
+ u_char vendor, info;
+ char str[244];
+} cistpl_vers_2_t;
+
+typedef struct cistpl_org_t {
+ u_char data_org;
+ char desc[30];
+} cistpl_org_t;
+
+#define CISTPL_ORG_FS 0x00
+#define CISTPL_ORG_APPSPEC 0x01
+#define CISTPL_ORG_XIP 0x02
+
+typedef union cisparse_t {
+ cistpl_device_t device;
+ cistpl_checksum_t checksum;
+ cistpl_longlink_t longlink;
+ cistpl_longlink_mfc_t longlink_mfc;
+ cistpl_vers_1_t version_1;
+ cistpl_altstr_t altstr;
+ cistpl_jedec_t jedec;
+ cistpl_manfid_t manfid;
+ cistpl_funcid_t funcid;
+ cistpl_funce_t funce;
+ cistpl_bar_t bar;
+ cistpl_config_t config;
+ cistpl_cftable_entry_t cftable_entry;
+ cistpl_cftable_entry_cb_t cftable_entry_cb;
+ cistpl_device_geo_t device_geo;
+ cistpl_vers_2_t vers_2;
+ cistpl_org_t org;
+} cisparse_t;
+
+typedef struct tuple_t {
+ u_int Attributes;
+ cisdata_t DesiredTuple;
+ u_int Flags; /* internal use */
+ u_int LinkOffset; /* internal use */
+ u_int CISOffset; /* internal use */
+ cisdata_t TupleCode;
+ cisdata_t TupleLink;
+ cisdata_t TupleOffset;
+ cisdata_t TupleDataMax;
+ cisdata_t TupleDataLen;
+ cisdata_t *TupleData;
+} tuple_t;
+
+/* Special cisdata_t value */
+#define RETURN_FIRST_TUPLE 0xff
+
+/* Attributes for tuple calls */
+#define TUPLE_RETURN_LINK 0x01
+#define TUPLE_RETURN_COMMON 0x02
+
+/* For ValidateCIS */
+typedef struct cisinfo_t {
+ u_int Chains;
+} cisinfo_t;
+
+#define CISTPL_MAX_CIS_SIZE 0x200
+
+/* For ReplaceCIS */
+typedef struct cisdump_t {
+ u_int Length;
+ cisdata_t Data[CISTPL_MAX_CIS_SIZE];
+} cisdump_t;
+
+#endif /* LINUX_CISTPL_H */
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h
new file mode 100644
index 000000000..2325ad3b2
--- /dev/null
+++ b/include/pcmcia/cs.h
@@ -0,0 +1,468 @@
+/*
+ * cs.h 1.67 1999/09/02 18:34:59
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_CS_H
+#define _LINUX_CS_H
+
+/* For AccessConfigurationRegister */
+typedef struct conf_reg_t {
+ u_char Function;
+ u_int Action;
+ off_t Offset;
+ u_int Value;
+} conf_reg_t;
+
+/* Actions */
+#define CS_READ 1
+#define CS_WRITE 2
+
+/* for AdjustResourceInfo */
+typedef struct adjust_t {
+ u_int Action;
+ u_int Resource;
+ u_int Attributes;
+ union {
+ struct memory {
+ u_long Base;
+ u_long Size;
+ } memory;
+ struct io {
+ ioaddr_t BasePort;
+ ioaddr_t NumPorts;
+ u_int IOAddrLines;
+ } io;
+ struct irq {
+ u_int IRQ;
+ } irq;
+ } resource;
+} adjust_t;
+
+/* Action field */
+#define REMOVE_MANAGED_RESOURCE 1
+#define ADD_MANAGED_RESOURCE 2
+#define GET_FIRST_MANAGED_RESOURCE 3
+#define GET_NEXT_MANAGED_RESOURCE 4
+/* Resource field */
+#define RES_MEMORY_RANGE 1
+#define RES_IO_RANGE 2
+#define RES_IRQ 3
+/* Attribute field */
+#define RES_IRQ_TYPE 0x03
+#define RES_IRQ_TYPE_EXCLUSIVE 0
+#define RES_IRQ_TYPE_TIME 1
+#define RES_IRQ_TYPE_DYNAMIC 2
+#define RES_IRQ_CSC 0x04
+#define RES_SHARED 0x08
+#define RES_RESERVED 0x10
+#define RES_ALLOCATED 0x20
+#define RES_REMOVED 0x40
+
+typedef struct servinfo_t {
+ char Signature[2];
+ u_int Count;
+ u_int Revision;
+ u_int CSLevel;
+ char *VendorString;
+} servinfo_t;
+
+typedef struct event_callback_args_t {
+ client_handle_t client_handle;
+ void *info;
+ void *mtdrequest;
+ void *buffer;
+ void *misc;
+ void *client_data;
+ struct bus_operations *bus;
+} event_callback_args_t;
+
+/* for GetConfigurationInfo */
+typedef struct config_info_t {
+ u_char Function;
+ u_int Attributes;
+ u_int Vcc, Vpp1, Vpp2;
+ u_int IntType;
+ u_int ConfigBase;
+ u_char Status, Pin, Copy, Option, ExtStatus;
+ u_int Present;
+ u_int CardValues;
+ u_int AssignedIRQ;
+ u_int IRQAttributes;
+ ioaddr_t BasePort1;
+ ioaddr_t NumPorts1;
+ u_int Attributes1;
+ ioaddr_t BasePort2;
+ ioaddr_t NumPorts2;
+ u_int Attributes2;
+ u_int IOAddrLines;
+} config_info_t;
+
+/* For CardValues field */
+#define CV_OPTION_VALUE 0x01
+#define CV_STATUS_VALUE 0x02
+#define CV_PIN_REPLACEMENT 0x04
+#define CV_COPY_VALUE 0x08
+#define CV_EXT_STATUS 0x10
+
+/* For GetFirst/NextClient */
+typedef struct client_req_t {
+ socket_t Socket;
+ u_int Attributes;
+} client_req_t;
+
+#define CLIENT_THIS_SOCKET 0x01
+
+/* For RegisterClient */
+typedef struct client_reg_t {
+ dev_info_t *dev_info;
+ u_int Attributes;
+ u_int EventMask;
+ int (*event_handler)(event_t event, int priority,
+ event_callback_args_t *);
+ event_callback_args_t event_callback_args;
+ u_int Version;
+} client_reg_t;
+
+/* ModifyConfiguration */
+typedef struct modconf_t {
+ u_int Attributes;
+ u_int Vcc, Vpp1, Vpp2;
+} modconf_t;
+
+/* Attributes for ModifyConfiguration */
+#define CONF_IRQ_CHANGE_VALID 0x100
+#define CONF_VCC_CHANGE_VALID 0x200
+#define CONF_VPP1_CHANGE_VALID 0x400
+#define CONF_VPP2_CHANGE_VALID 0x800
+
+/* For RequestConfiguration */
+typedef struct config_req_t {
+ u_int Attributes;
+ u_int Vcc, Vpp1, Vpp2;
+ u_int IntType;
+ u_int ConfigBase;
+ u_char Status, Pin, Copy, ExtStatus;
+ u_char ConfigIndex;
+ u_int Present;
+} config_req_t;
+
+/* Attributes for RequestConfiguration */
+#define CONF_ENABLE_IRQ 0x01
+#define CONF_ENABLE_DMA 0x02
+#define CONF_ENABLE_SPKR 0x04
+#define CONF_VALID_CLIENT 0x100
+
+/* IntType field */
+#define INT_MEMORY 0x01
+#define INT_MEMORY_AND_IO 0x02
+#define INT_CARDBUS 0x04
+
+/* For RequestIO and ReleaseIO */
+typedef struct io_req_t {
+ ioaddr_t BasePort1;
+ ioaddr_t NumPorts1;
+ u_int Attributes1;
+ ioaddr_t BasePort2;
+ ioaddr_t NumPorts2;
+ u_int Attributes2;
+ u_int IOAddrLines;
+} io_req_t;
+
+/* Attributes for RequestIO and ReleaseIO */
+#define IO_SHARED 0x01
+#define IO_FIRST_SHARED 0x02
+#define IO_FORCE_ALIAS_ACCESS 0x04
+#define IO_DATA_PATH_WIDTH 0x18
+#define IO_DATA_PATH_WIDTH_8 0x00
+#define IO_DATA_PATH_WIDTH_16 0x08
+#define IO_DATA_PATH_WIDTH_AUTO 0x10
+
+/* For RequestIRQ and ReleaseIRQ */
+typedef struct irq_req_t {
+ u_int Attributes;
+ u_int AssignedIRQ;
+ u_int IRQInfo1, IRQInfo2;
+ void *Handler;
+ void *Instance;
+} irq_req_t;
+
+/* Attributes for RequestIRQ and ReleaseIRQ */
+#define IRQ_TYPE 0x03
+#define IRQ_TYPE_EXCLUSIVE 0x00
+#define IRQ_TYPE_TIME 0x01
+#define IRQ_TYPE_DYNAMIC_SHARING 0x02
+#define IRQ_FORCED_PULSE 0x04
+#define IRQ_FIRST_SHARED 0x08
+#define IRQ_HANDLE_PRESENT 0x10
+#define IRQ_PULSE_ALLOCATED 0x100
+
+/* Bits in IRQInfo1 field */
+#define IRQ_MASK 0x0f
+#define IRQ_NMI_ID 0x01
+#define IRQ_IOCK_ID 0x02
+#define IRQ_BERR_ID 0x04
+#define IRQ_VEND_ID 0x08
+#define IRQ_INFO2_VALID 0x10
+#define IRQ_LEVEL_ID 0x20
+#define IRQ_PULSE_ID 0x40
+#define IRQ_SHARE_ID 0x80
+
+typedef struct eventmask_t {
+ u_int Attributes;
+ u_int EventMask;
+} eventmask_t;
+
+#define CONF_EVENT_MASK_VALID 0x01
+
+/* Configuration registers present */
+#define PRESENT_OPTION 0x001
+#define PRESENT_STATUS 0x002
+#define PRESENT_PIN_REPLACE 0x004
+#define PRESENT_COPY 0x008
+#define PRESENT_EXT_STATUS 0x010
+#define PRESENT_IOBASE_0 0x020
+#define PRESENT_IOBASE_1 0x040
+#define PRESENT_IOBASE_2 0x080
+#define PRESENT_IOBASE_3 0x100
+#define PRESENT_IOSIZE 0x200
+
+/* Attributes for Request/GetConfiguration */
+#define CONF_ENABLE_IRQ 0x01
+#define EXCLUSIVE_USE 0x02
+#define VALID_CLIENT 0x04
+
+/* For GetMemPage, MapMemPage */
+typedef struct memreq_t {
+ u_int CardOffset;
+ page_t Page;
+} memreq_t;
+
+/* For ModifyWindow */
+typedef struct modwin_t {
+ u_int Attributes;
+ u_int AccessSpeed;
+} modwin_t;
+
+/* For RequestWindow */
+typedef struct win_req_t {
+ u_int Attributes;
+ u_long Base;
+ u_int Size;
+ u_int AccessSpeed;
+} win_req_t;
+
+/* Attributes for RequestWindow */
+#define WIN_ADDR_SPACE 0x0001
+#define WIN_ADDR_SPACE_MEM 0x0000
+#define WIN_ADDR_SPACE_IO 0x0001
+#define WIN_MEMORY_TYPE 0x0002
+#define WIN_MEMORY_TYPE_CM 0x0000
+#define WIN_MEMORY_TYPE_AM 0x0002
+#define WIN_ENABLE 0x0004
+#define WIN_DATA_WIDTH 0x0018
+#define WIN_DATA_WIDTH_8 0x0000
+#define WIN_DATA_WIDTH_16 0x0008
+#define WIN_DATA_WIDTH_32 0x0010
+#define WIN_PAGED 0x0020
+#define WIN_SHARED 0x0040
+#define WIN_FIRST_SHARED 0x0080
+#define WIN_USE_WAIT 0x0100
+#define WIN_MAP_BELOW_1MB 0x0400
+#define WIN_PREFETCH 0x0800
+#define WIN_CACHEABLE 0x1000
+#define WIN_BAR_MASK 0xe000
+#define WIN_BAR_SHIFT 13
+
+/* Attributes for RegisterClient */
+#define INFO_MASTER_CLIENT 0x01
+#define INFO_IO_CLIENT 0x02
+#define INFO_MTD_CLIENT 0x04
+#define INFO_MEM_CLIENT 0x08
+#define MAX_NUM_CLIENTS 3
+
+#define INFO_CARD_SHARE 0x10
+#define INFO_CARD_EXCL 0x20
+
+typedef struct cs_status_t {
+ u_char Function;
+ event_t CardState;
+ event_t SocketState;
+} cs_status_t;
+
+typedef struct error_info_t {
+ int func;
+ int retcode;
+} error_info_t;
+
+/* Special stuff for binding drivers to sockets */
+typedef struct bind_req_t {
+ socket_t Socket;
+ u_char Function;
+ dev_info_t *dev_info;
+} bind_req_t;
+
+/* Flag to bind to all functions */
+#define BIND_FN_ALL 0xff
+
+typedef struct mtd_bind_t {
+ socket_t Socket;
+ u_int Attributes;
+ u_int CardOffset;
+ dev_info_t *dev_info;
+} mtd_bind_t;
+
+/* Events */
+#define CS_EVENT_PRI_LOW 0
+#define CS_EVENT_PRI_HIGH 1
+
+#define CS_EVENT_WRITE_PROTECT 0x000001
+#define CS_EVENT_CARD_LOCK 0x000002
+#define CS_EVENT_CARD_INSERTION 0x000004
+#define CS_EVENT_CARD_REMOVAL 0x000008
+#define CS_EVENT_BATTERY_DEAD 0x000010
+#define CS_EVENT_BATTERY_LOW 0x000020
+#define CS_EVENT_READY_CHANGE 0x000040
+#define CS_EVENT_CARD_DETECT 0x000080
+#define CS_EVENT_RESET_REQUEST 0x000100
+#define CS_EVENT_RESET_PHYSICAL 0x000200
+#define CS_EVENT_CARD_RESET 0x000400
+#define CS_EVENT_REGISTRATION_COMPLETE 0x000800
+#define CS_EVENT_RESET_COMPLETE 0x001000
+#define CS_EVENT_PM_SUSPEND 0x002000
+#define CS_EVENT_PM_RESUME 0x004000
+#define CS_EVENT_INSERTION_REQUEST 0x008000
+#define CS_EVENT_EJECTION_REQUEST 0x010000
+#define CS_EVENT_MTD_REQUEST 0x020000
+#define CS_EVENT_ERASE_COMPLETE 0x040000
+#define CS_EVENT_REQUEST_ATTENTION 0x080000
+#define CS_EVENT_CB_DETECT 0x100000
+#define CS_EVENT_3VCARD 0x200000
+#define CS_EVENT_XVCARD 0x400000
+
+/* Return codes */
+#define CS_SUCCESS 0x00
+#define CS_BAD_ADAPTER 0x01
+#define CS_BAD_ATTRIBUTE 0x02
+#define CS_BAD_BASE 0x03
+#define CS_BAD_EDC 0x04
+#define CS_BAD_IRQ 0x06
+#define CS_BAD_OFFSET 0x07
+#define CS_BAD_PAGE 0x08
+#define CS_READ_FAILURE 0x09
+#define CS_BAD_SIZE 0x0a
+#define CS_BAD_SOCKET 0x0b
+#define CS_BAD_TYPE 0x0d
+#define CS_BAD_VCC 0x0e
+#define CS_BAD_VPP 0x0f
+#define CS_BAD_WINDOW 0x11
+#define CS_WRITE_FAILURE 0x12
+#define CS_NO_CARD 0x14
+#define CS_UNSUPPORTED_FUNCTION 0x15
+#define CS_UNSUPPORTED_MODE 0x16
+#define CS_BAD_SPEED 0x17
+#define CS_BUSY 0x18
+#define CS_GENERAL_FAILURE 0x19
+#define CS_WRITE_PROTECTED 0x1a
+#define CS_BAD_ARG_LENGTH 0x1b
+#define CS_BAD_ARGS 0x1c
+#define CS_CONFIGURATION_LOCKED 0x1d
+#define CS_IN_USE 0x1e
+#define CS_NO_MORE_ITEMS 0x1f
+#define CS_OUT_OF_RESOURCE 0x20
+#define CS_BAD_HANDLE 0x21
+
+#define CS_BAD_TUPLE 0x40
+
+#ifdef __KERNEL__
+
+/*
+ * Calls to set up low-level "Socket Services" drivers
+ */
+
+typedef int (*ss_entry_t)(u_int sock, u_int cmd, void *arg);
+extern int register_ss_entry(int nsock, ss_entry_t entry);
+extern void unregister_ss_entry(ss_entry_t entry);
+
+/*
+ * The main Card Services entry point
+ */
+
+enum service {
+ AccessConfigurationRegister, AddSocketServices,
+ AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
+ DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
+ GetClientInfo, GetConfigurationInfo, GetEventMask,
+ GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
+ GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
+ GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
+ MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
+ OpenMemory, ParseTuple, ReadMemory, RegisterClient,
+ RegisterEraseQueue, RegisterMTD, RegisterTimer,
+ ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
+ ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
+ RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
+ RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
+ SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
+ WriteMemory, BindDevice, BindMTD, ReportError,
+ SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
+ GetFirstWindow, GetNextWindow, GetMemPage
+};
+
+#ifdef IN_CARD_SERVICES
+extern int CardServices(int func, void *a1, void *a2, void *a3);
+#else
+extern int CardServices(int func, ...);
+#endif
+
+#ifdef __BEOS__
+#define SS_MODULE_NAME(s) ("busses/pcmcia/" s "/v1")
+#define MTD_MODULE_NAME(s) ("busses/pcmcia/" s "/v1")
+#define CS_CLIENT_MODULE_NAME "bus_managers/pcmcia_cs/client/v1"
+typedef struct cs_client_module_info {
+ bus_manager_info binfo;
+ int (*_CardServices)(int, ...);
+ int (*_MTDHelperEntry)(int, ...);
+ void (*_add_timer)(struct timer_list *);
+ void (*_del_timer)(struct timer_list *);
+} cs_client_module_info;
+#define CS_SOCKET_MODULE_NAME "bus_managers/pcmcia_cs/socket/v1"
+typedef struct cs_socket_module_info {
+ bus_manager_info binfo;
+ int (*_register_ss_entry)(int, ss_entry_t);
+ void (*_unregister_ss_entry)(ss_entry_t);
+ void (*_add_timer)(struct timer_list *);
+ void (*_del_timer)(struct timer_list *);
+ int (*register_resource)(int, u_long, u_long);
+ int (*release_resource)(int, u_long, u_long);
+ int (*check_resource)(int, u_long, u_long);
+} cs_socket_module_info;
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_CS_H */
diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h
new file mode 100644
index 000000000..3df641d41
--- /dev/null
+++ b/include/pcmcia/cs_types.h
@@ -0,0 +1,61 @@
+/*
+ * cs_types.h 1.15 1999/08/28 04:12:32
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_CS_TYPES_H
+#define _LINUX_CS_TYPES_H
+
+#ifdef __linux__
+#include <linux/types.h>
+#endif
+
+typedef u_short socket_t;
+typedef u_short ioaddr_t;
+typedef u_int event_t;
+typedef u_char cisdata_t;
+typedef u_short page_t;
+
+struct client_t;
+typedef struct client_t *client_handle_t;
+
+struct window_t;
+typedef struct window_t *window_handle_t;
+
+struct region_t;
+typedef struct region_t *memory_handle_t;
+
+struct eraseq_t;
+typedef struct eraseq_t *eraseq_handle_t;
+
+#ifndef DEV_NAME_LEN
+#define DEV_NAME_LEN 32
+#endif
+
+typedef char dev_info_t[DEV_NAME_LEN];
+
+#endif /* _LINUX_CS_TYPES_H */
diff --git a/include/pcmcia/driver_ops.h b/include/pcmcia/driver_ops.h
new file mode 100644
index 000000000..395374cc0
--- /dev/null
+++ b/include/pcmcia/driver_ops.h
@@ -0,0 +1,82 @@
+/*
+ * driver_ops.h 1.13 1999/08/28 04:12:33
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_DRIVER_OPS_H
+#define _LINUX_DRIVER_OPS_H
+
+#ifndef DEV_NAME_LEN
+#define DEV_NAME_LEN 32
+#endif
+
+#ifdef __KERNEL__
+
+typedef struct dev_node_t {
+ char dev_name[DEV_NAME_LEN];
+ u_short major, minor;
+ struct dev_node_t *next;
+} dev_node_t;
+
+typedef struct dev_locator_t {
+ enum { LOC_ISA, LOC_PCI } bus;
+ union {
+ struct {
+ u_short io_base_1, io_base_2;
+ u_long mem_base;
+ u_char irq, dma;
+ } isa;
+ struct {
+ u_char bus;
+ u_char devfn;
+ } pci;
+ } b;
+} dev_locator_t;
+
+typedef struct driver_operations {
+ char *name;
+ dev_node_t *(*attach) (dev_locator_t *loc);
+ void (*suspend) (dev_node_t *dev);
+ void (*resume) (dev_node_t *dev);
+ void (*detach) (dev_node_t *dev);
+} driver_operations;
+
+int register_driver(struct driver_operations *ops);
+void unregister_driver(struct driver_operations *ops);
+
+#ifdef __BEOS__
+#define CB_ENABLER_MODULE_NAME "bus_managers/cb_enabler/v1"
+typedef struct cb_enabler_module_info {
+ bus_manager_info binfo;
+ int (*register_driver)(struct driver_operations *ops);
+ void (*unregister_driver)(struct driver_operations *ops);
+} cb_enabler_module_info;
+#endif /* __BEOS__ */
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_DRIVER_OPS_H */
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
new file mode 100644
index 000000000..06aa7f1cb
--- /dev/null
+++ b/include/pcmcia/ds.h
@@ -0,0 +1,163 @@
+/*
+ * ds.h 1.54 1999/09/03 16:44:49
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_DS_H
+#define _LINUX_DS_H
+
+#include <pcmcia/driver_ops.h>
+#include <pcmcia/bulkmem.h>
+
+typedef struct tuple_parse_t {
+ tuple_t tuple;
+ cisdata_t data[255];
+ cisparse_t parse;
+} tuple_parse_t;
+
+typedef struct win_info_t {
+ window_handle_t handle;
+ win_req_t window;
+ memreq_t map;
+} win_info_t;
+
+typedef struct bind_info_t {
+ dev_info_t dev_info;
+ u_char function;
+ struct dev_link_t *instance;
+ char name[DEV_NAME_LEN];
+ u_short major, minor;
+ void *next;
+} bind_info_t;
+
+typedef struct mtd_info_t {
+ dev_info_t dev_info;
+ u_int Attributes;
+ u_int CardOffset;
+} mtd_info_t;
+
+typedef union ds_ioctl_arg_t {
+ servinfo_t servinfo;
+ adjust_t adjust;
+ config_info_t config;
+ tuple_t tuple;
+ tuple_parse_t tuple_parse;
+ client_req_t client_req;
+ cs_status_t status;
+ conf_reg_t conf_reg;
+ cisinfo_t cisinfo;
+ region_info_t region;
+ bind_info_t bind_info;
+ mtd_info_t mtd_info;
+ win_info_t win_info;
+ cisdump_t cisdump;
+} ds_ioctl_arg_t;
+
+#define DS_GET_CARD_SERVICES_INFO _IOR ('d', 1, servinfo_t)
+#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
+#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
+#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
+#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
+#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
+#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
+#define DS_RESET_CARD _IO ('d', 8)
+#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
+#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
+#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
+#define DS_SUSPEND_CARD _IO ('d', 12)
+#define DS_RESUME_CARD _IO ('d', 13)
+#define DS_EJECT_CARD _IO ('d', 14)
+#define DS_INSERT_CARD _IO ('d', 15)
+#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
+#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
+#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
+#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
+#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
+#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
+
+#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
+#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
+#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
+#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
+#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
+
+#ifdef __KERNEL__
+
+typedef struct dev_link_t {
+ dev_node_t *dev;
+ u_int state, open;
+ wait_queue_head_t pending;
+ struct timer_list release;
+ client_handle_t handle;
+ io_req_t io;
+ irq_req_t irq;
+ config_req_t conf;
+ window_handle_t win;
+ void *priv;
+ struct dev_link_t *next;
+} dev_link_t;
+
+/* Flags for device state */
+#define DEV_PRESENT 0x01
+#define DEV_CONFIG 0x02
+#define DEV_STALE_CONFIG 0x04 /* release on close */
+#define DEV_STALE_LINK 0x08 /* detach on release */
+#define DEV_CONFIG_PENDING 0x10
+#define DEV_RELEASE_PENDING 0x20
+#define DEV_SUSPEND 0x40
+#define DEV_BUSY 0x80
+
+#define DEV_OK(l) \
+ ((l) && ((l->state & ~DEV_BUSY) == (DEV_CONFIG|DEV_PRESENT)))
+
+int register_pccard_driver(dev_info_t *dev_info,
+ dev_link_t *(*attach)(void),
+ void (*detach)(dev_link_t *));
+
+int unregister_pccard_driver(dev_info_t *dev_info);
+
+#define register_pcmcia_driver register_pccard_driver
+#define unregister_pcmcia_driver unregister_pccard_driver
+
+#ifdef __BEOS__
+#define DS_MODULE_NAME "bus_managers/pcmcia_ds/v1"
+typedef struct ds_module_info {
+ bus_manager_info binfo;
+ int (*_register_pccard_driver)(dev_info_t *,
+ dev_link_t *(*)(void),
+ void (*)(dev_link_t *));
+ int (*_unregister_pccard_driver)(dev_info_t *);
+ struct driver_info_t **root_driver;
+ int *sockets;
+ struct socket_info_t **socket_table;
+ sem_id *list_sem;
+} ds_module_info;
+#endif /* __BEOS__ */
+
+#endif /* __KERNEL__ */
+
+#endif /* _LINUX_DS_H */
diff --git a/include/pcmcia/ftl.h b/include/pcmcia/ftl.h
new file mode 100644
index 000000000..8bf70a5b8
--- /dev/null
+++ b/include/pcmcia/ftl.h
@@ -0,0 +1,73 @@
+/*
+ * ftl.h 1.6 1999/08/28 04:12:33
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_FTL_H
+#define _LINUX_FTL_H
+
+typedef struct erase_unit_header_t {
+ u_char LinkTargetTuple[5];
+ u_char DataOrgTuple[10];
+ u_char NumTransferUnits;
+ u_int EraseCount;
+ u_short LogicalEUN;
+ u_char BlockSize;
+ u_char EraseUnitSize;
+ u_short FirstPhysicalEUN;
+ u_short NumEraseUnits;
+ u_int FormattedSize;
+ u_int FirstVMAddress;
+ u_short NumVMPages;
+ u_char Flags;
+ u_char Code;
+ u_int SerialNumber;
+ u_int AltEUHOffset;
+ u_int BAMOffset;
+ u_char Reserved[12];
+ u_char EndTuple[2];
+} erase_unit_header_t;
+
+/* Flags in erase_unit_header_t */
+#define HIDDEN_AREA 0x01
+#define REVERSE_POLARITY 0x02
+#define DOUBLE_BAI 0x04
+
+/* Definitions for block allocation information */
+
+#define BLOCK_FREE(b) ((b) == 0xffffffff)
+#define BLOCK_DELETED(b) (((b) == 0) || ((b) == 0xfffffffe))
+
+#define BLOCK_TYPE(b) ((b) & 0x7f)
+#define BLOCK_ADDRESS(b) ((b) & ~0x7f)
+#define BLOCK_NUMBER(b) ((b) >> 9)
+#define BLOCK_CONTROL 0x30
+#define BLOCK_DATA 0x40
+#define BLOCK_REPLACEMENT 0x60
+#define BLOCK_BAD 0x70
+
+#endif /* _LINUX_FTL_H */
diff --git a/include/pcmcia/mem_op.h b/include/pcmcia/mem_op.h
new file mode 100644
index 000000000..8e8e0df79
--- /dev/null
+++ b/include/pcmcia/mem_op.h
@@ -0,0 +1,133 @@
+/*
+ * mem_op.h 1.11 1999/09/15 07:14:03
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_MEM_OP_H
+#define _LINUX_MEM_OP_H
+
+#include <asm/uaccess.h>
+
+/*
+ If UNSAFE_MEMCPY is defined, we use the (optimized) system routines
+ to copy between a card and kernel memory. These routines do 32-bit
+ operations which may not work with all PCMCIA controllers. The
+ safe versions defined here will do only 8-bit and 16-bit accesses.
+*/
+
+#ifdef UNSAFE_MEMCPY
+
+#define copy_from_pc memcpy_fromio
+#define copy_to_pc memcpy_toio
+
+static inline void copy_pc_to_user(void *to, const void *from, size_t n)
+{
+ size_t odd = (n & 3);
+ n -= odd;
+ while (n) {
+ put_user(__raw_readl(from), (int *)to);
+ (char *)from += 4; (char *)to += 4; n -= 4;
+ }
+ while (odd--)
+ put_user(readb((char *)from++), (char *)to++);
+}
+
+static inline void copy_user_to_pc(void *to, const void *from, size_t n)
+{
+ int l;
+ char c;
+ size_t odd = (n & 3);
+ n -= odd;
+ while (n) {
+ get_user(l, (int *)from);
+ __raw_writel(l, to);
+ (char *)to += 4; (char *)from += 4; n -= 4;
+ }
+ while (odd--) {
+ get_user(c, (char *)from++);
+ writeb(c, (char *)to++);
+ }
+}
+
+#else /* UNSAFE_MEMCPY */
+
+static inline void copy_from_pc(void *to, const void *from, size_t n)
+{
+ size_t odd = (n & 1);
+ n -= odd;
+ while (n) {
+ *(u_short *)to = __raw_readw(from);
+ (char *)to += 2; (char *)from += 2; n -= 2;
+ }
+ if (odd)
+ *(u_char *)to = readb(from);
+}
+
+static inline void copy_to_pc(void *to, const void *from, size_t n)
+{
+ size_t odd = (n & 1);
+ n -= odd;
+ while (n) {
+ __raw_writew(*(u_short *)from, to);
+ (char *)to += 2; (char *)from += 2; n -= 2;
+ }
+ if (odd)
+ writeb(*(u_char *)from, to);
+}
+
+static inline void copy_pc_to_user(void *to, const void *from, size_t n)
+{
+ size_t odd = (n & 1);
+ n -= odd;
+ while (n) {
+ put_user(__raw_readw(from), (short *)to);
+ (char *)to += 2; (char *)from += 2; n -= 2;
+ }
+ if (odd)
+ put_user(readb(from), (char *)to);
+}
+
+static inline void copy_user_to_pc(void *to, const void *from, size_t n)
+{
+ short s;
+ char c;
+ size_t odd = (n & 1);
+ n -= odd;
+ while (n) {
+ get_user(s, (short *)from);
+ __raw_writew(s, to);
+ (char *)to += 2; (char *)from += 2; n -= 2;
+ }
+ if (odd) {
+ get_user(c, (char *)from);
+ writeb(c, to);
+ }
+}
+
+#endif /* UNSAFE_MEMCPY */
+
+#endif /* _LINUX_MEM_OP_H */
diff --git a/include/pcmcia/memory.h b/include/pcmcia/memory.h
new file mode 100644
index 000000000..8324ac4f6
--- /dev/null
+++ b/include/pcmcia/memory.h
@@ -0,0 +1,41 @@
+/*
+ * memory.h 1.5 1999/08/28 04:12:33
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_MEMORY_H
+#define _LINUX_MEMORY_H
+
+typedef struct erase_info_t {
+ u_long Offset;
+ u_long Size;
+} erase_info_t;
+
+#define MEMGETINFO _IOR('M', 1, region_info_t)
+#define MEMERASE _IOW('M', 2, erase_info_t)
+
+#endif /* _LINUX_MEMORY_H */
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
new file mode 100644
index 000000000..e39477e2e
--- /dev/null
+++ b/include/pcmcia/ss.h
@@ -0,0 +1,130 @@
+/*
+ * ss.h 1.24 1999/08/28 04:12:33
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
+ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU Public License version 2 (the "GPL"), in which
+ * case the provisions of the GPL are applicable instead of the
+ * above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use
+ * your version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.
+ */
+
+#ifndef _LINUX_SS_H
+#define _LINUX_SS_H
+
+/* For RegisterCallback */
+typedef struct ss_callback_t {
+ void (*handler)(void *info, u_int events);
+ void *info;
+} ss_callback_t;
+
+/* Definitions for card status flags for GetStatus */
+#define SS_WRPROT 0x0001
+#define SS_CARDLOCK 0x0002
+#define SS_EJECTION 0x0004
+#define SS_INSERTION 0x0008
+#define SS_BATDEAD 0x0010
+#define SS_BATWARN 0x0020
+#define SS_READY 0x0040
+#define SS_DETECT 0x0080
+#define SS_POWERON 0x0100
+#define SS_GPI 0x0200
+#define SS_STSCHG 0x0400
+#define SS_CARDBUS 0x0800
+#define SS_3VCARD 0x1000
+#define SS_XVCARD 0x2000
+
+/* for InquireSocket */
+typedef struct socket_cap_t {
+ u_int features;
+ u_int irq_mask;
+ u_int map_size;
+ u_char pci_irq;
+ u_char cardbus;
+ struct pci_bus *cb_bus;
+ struct bus_operations *bus;
+} socket_cap_t;
+
+/* InquireSocket capabilities */
+#define SS_CAP_PAGE_REGS 0x0001
+#define SS_CAP_VIRTUAL_BUS 0x0002
+#define SS_CAP_MEM_ALIGN 0x0004
+#define SS_CAP_PCCARD 0x4000
+#define SS_CAP_CARDBUS 0x8000
+
+/* for GetSocket, SetSocket */
+typedef struct socket_state_t {
+ u_int flags;
+ u_int csc_mask;
+ u_char Vcc, Vpp;
+ u_char io_irq;
+} socket_state_t;
+
+/* Socket configuration flags */
+#define SS_PWR_AUTO 0x0010
+#define SS_IOCARD 0x0020
+#define SS_RESET 0x0040
+#define SS_DMA_MODE 0x0080
+#define SS_SPKR_ENA 0x0100
+#define SS_OUTPUT_ENA 0x0200
+
+/* Flags for I/O port and memory windows */
+#define MAP_ACTIVE 0x01
+#define MAP_16BIT 0x02
+#define MAP_AUTOSZ 0x04
+#define MAP_0WS 0x08
+#define MAP_WRPROT 0x10
+#define MAP_ATTRIB 0x20
+#define MAP_USE_WAIT 0x40
+#define MAP_PREFETCH 0x80
+
+/* Use this just for bridge windows */
+#define MAP_IOSPACE 0x20
+
+typedef struct pccard_io_map {
+ u_char map;
+ u_char flags;
+ u_short speed;
+ u_short start, stop;
+} pccard_io_map;
+
+typedef struct pccard_mem_map {
+ u_char map;
+ u_char flags;
+ u_short speed;
+ u_long sys_start, sys_stop;
+ u_int card_start;
+} pccard_mem_map;
+
+typedef struct cb_bridge_map {
+ u_char map;
+ u_char flags;
+ u_int start, stop;
+} cb_bridge_map;
+
+enum ss_service {
+ SS_RegisterCallback, SS_InquireSocket,
+ SS_GetStatus, SS_GetSocket, SS_SetSocket,
+ SS_GetIOMap, SS_SetIOMap, SS_GetMemMap, SS_SetMemMap,
+ SS_GetBridge, SS_SetBridge, SS_ProcSetup
+};
+
+#endif /* _LINUX_SS_H */
diff --git a/include/pcmcia/version.h b/include/pcmcia/version.h
new file mode 100644
index 000000000..0df81b31e
--- /dev/null
+++ b/include/pcmcia/version.h
@@ -0,0 +1,4 @@
+/* version.h 1.72 1999/08/05 06:09:53 (David Hinds) */
+
+#define CS_RELEASE "3.1.0"
+#define CS_RELEASE_CODE 0x3100
diff --git a/include/video/fbcon.h b/include/video/fbcon.h
index 812a2ff9b..1d972dda3 100644
--- a/include/video/fbcon.h
+++ b/include/video/fbcon.h
@@ -12,6 +12,7 @@
#define _VIDEO_FBCON_H
#include <linux/config.h>
+#include <linux/types.h>
#include <linux/console_struct.h>
#include <linux/vt_buffer.h>
@@ -510,4 +511,25 @@ static __inline__ void fast_memmove(char *dst, const char *src, size_t size)
#endif
+
+#if defined(__i386__) || defined(__alpha__)
+
+#define fb_readb __raw_readb
+#define fb_readw __raw_readw
+#define fb_readl __raw_readl
+#define fb_writeb __raw_writeb
+#define fb_writew __raw_writew
+#define fb_writel __raw_writel
+
+#else
+
+#define fb_readb(addr) (*(volatile u8 *) (addr))
+#define fb_readw(addr) (*(volatile u16 *) (addr))
+#define fb_readl(addr) (*(volatile u32 *) (addr))
+#define fb_writeb(b,addr) (*(volatile u8 *) (addr) = (b))
+#define fb_writew(b,addr) (*(volatile u16 *) (addr) = (b))
+#define fb_writel(b,addr) (*(volatile u32 *) (addr) = (b))
+
+#endif
+
#endif /* _VIDEO_FBCON_H */
diff --git a/include/video/sbusfb.h b/include/video/sbusfb.h
index 2511cbd5f..eed14d1fa 100644
--- a/include/video/sbusfb.h
+++ b/include/video/sbusfb.h
@@ -56,6 +56,10 @@ struct fb_info_cgfourteen {
int ramsize;
int mode;
};
+struct fb_info_p9100 {
+ struct p9100_ctrl *ctrl;
+ volatile u32 *fbmem;
+};
struct cg_cursor {
char enable; /* cursor is enabled */
@@ -96,6 +100,7 @@ struct fb_info_sbusfb {
struct fb_info_tcx tcx;
struct fb_info_leo leo;
struct fb_info_cgfourteen cg14;
+ struct fb_info_p9100 p9100;
} s;
unsigned char *color_map;
struct cg_cursor cursor;
@@ -134,6 +139,7 @@ extern char *tcxfb_init(struct fb_info_sbusfb *);
extern char *leofb_init(struct fb_info_sbusfb *);
extern char *bwtwofb_init(struct fb_info_sbusfb *);
extern char *cgfourteenfb_init(struct fb_info_sbusfb *);
+extern char *p9100fb_init(struct fb_info_sbusfb *);
#define sbusfbinfod(disp) ((struct fb_info_sbusfb *)(disp->fb_info))
#define sbusfbinfo(info) ((struct fb_info_sbusfb *)(info))